From 5b8d1ca82812f771f42c731437c52060663c5855 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 8 Aug 2026 11:04:31 +0700 Subject: [PATCH 1/5] Add the option to Hide Mouse and fixes inconsistent tab size --- game/game.js | 145167 ++++++++++++++++++++++++------------------------ 1 file changed, 72583 insertions(+), 72584 deletions(-) diff --git a/game/game.js b/game/game.js index d722ac3..e233518 100644 --- a/game/game.js +++ b/game/game.js @@ -3,309 +3,309 @@ var game; var bgOnly = false, showcaseOnly = false; -var version = "v1.17.2"; +var version = "v1.17.1"; (() => { var e = { - 8465: (e, t, a) => { - function i() { - ((this.upload = { - addEventListener: this.addEventListener.bind(this), - }), - (this.observer = { - load: null, - error: null, - abort: null, - progress: null, - })); - } - ((i.prototype.open = function (e, t, a) { - ((this.url = t), (this.method = e), (this.async = a)); + 8465: (e, t, a) => { + function i() { + ((this.upload = { + addEventListener: this.addEventListener.bind(this), }), - (i.prototype.send = function (e) { - e.submit( - this.url, - function (e, t) { - (e ? this.observer.error(e) : this.observer.load(t), - t.resume()); - }.bind(this), - ); - }), - (i.prototype.addEventListener = function (e, t) { - this.observer[e] = t; + (this.observer = { + load: null, + error: null, + abort: null, + progress: null, })); - var n = a(3976); - ((t.RX = n.BrainCloudWrapper), n.BrainCloudClient, a(6754)); - }, - 3976: (e, t, a) => { - if (null == n) var n = a(1354); - function s() { - var e = this, - t = - "function" == typeof customSetInterval - ? customSetInterval - : setInterval; - ((e.name = "BrainCloudManager"), - (e._sendQueue = []), - (e._inProgressQueue = []), - (e._abTestingId = -1), - (e._sessionId = ""), - (e._packetId = -1), - (e._loader = null), - (e._eventCallback = null), - (e._rewardCallback = null), - (e._errorCallback = null), - (e._jsonedQueue = ""), - (e._idleTimeout = 30), - (e._heartBeatIntervalId = null), - (e._bundlerIntervalId = null), - (e._packetTimeouts = [15, 20, 35, 50]), - (e._retry = 0), - (e._requestId = 0), - (e._appId = ""), - (e._secret = ""), - (e._secretMap = {})); - if (true) { - ((e._serverUrl = "something that doesn't exist. why?"), - (e._dispatcherUrl = e._serverUrl + "/dispatcherv2/index.php"), + } + ((i.prototype.open = function (e, t, a) { + ((this.url = t), (this.method = e), (this.async = a)); + }), + (i.prototype.send = function (e) { + e.submit( + this.url, + function (e, t) { + (e ? this.observer.error(e) : this.observer.load(t), + t.resume()); + }.bind(this), + ); + }), + (i.prototype.addEventListener = function (e, t) { + this.observer[e] = t; + })); + var n = a(3976); + ((t.RX = n.BrainCloudWrapper), n.BrainCloudClient, a(6754)); + }, + 3976: (e, t, a) => { + if (null == n) var n = a(1354); + function s() { + var e = this, + t = + "function" == typeof customSetInterval + ? customSetInterval + : setInterval; + ((e.name = "BrainCloudManager"), + (e._sendQueue = []), + (e._inProgressQueue = []), + (e._abTestingId = -1), + (e._sessionId = ""), + (e._packetId = -1), + (e._loader = null), + (e._eventCallback = null), + (e._rewardCallback = null), + (e._errorCallback = null), + (e._jsonedQueue = ""), + (e._idleTimeout = 30), + (e._heartBeatIntervalId = null), + (e._bundlerIntervalId = null), + (e._packetTimeouts = [15, 20, 35, 50]), + (e._retry = 0), + (e._requestId = 0), + (e._appId = ""), + (e._secret = ""), + (e._secretMap = {})); + if (true) { + ((e._serverUrl = "something that doesn't exist. why?"), + (e._dispatcherUrl = e._serverUrl + "/dispatcherv2/index.php"), + (e._fileUploadUrl = e._serverUrl + "/uploader/index.php")); + } else { + ((e._serverUrl = "https://api.braincloudservers.com"), + (e._dispatcherUrl = e._serverUrl + "/dispatcherv2"), + (e._fileUploadUrl = e._serverUrl + "/uploader")); + } + ((e._appVersion = ""), + (e._debugEnabled = true), + (e._requestInProgress = false), + (e._bundleDelayActive = false), + (e._statusCodeCache = 403), + (e._reasonCodeCache = 40304), + (e._statusMessageCache = "No session"), + (e._killSwitchThreshold = 11), + (e._killSwitchEngaged = false), + (e._killSwitchErrorCount = 0), + (e._killSwitchService = ""), + (e._killSwitchOperation = ""), + (e._isInitialized = false), + (e._isAuthenticated = false), + (e.initialize = function (t, a, i) { + ((e._appId = t), + (e._secret = a), + (e._secretMap = {}), + (e._secretMap[t] = a), + (e._appVersion = i), + (e._isInitialized = true)); + }), + (e.initializeWithApps = function (t, a, i) { + ((e._appId = t), + (e._secret = a[t]), + (e._secretMap = a), + (e._appVersion = i), + (e._isInitialized = true)); + }), + (e.setServerUrl = function (t) { + for ( + e._serverUrl = t, + e._serverUrl.endsWith("/dispatcherv2/index.php") && + (e._serverUrl = e._serverUrl.substring( + 0, + e._serverUrl.length - "/dispatcherv2/index.php".length, + )); + e._serverUrl.length > 0 && + "/" == e._serverUrl.charAt(e._serverUrl.length - 1); + ) + e._serverUrl = e._serverUrl.substring( + 0, + e._serverUrl.length - 1, + ); + ((e._dispatcherUrl = e._serverUrl + "/dispatcherv2/index.php"), (e._fileUploadUrl = e._serverUrl + "/uploader/index.php")); - } else { - ((e._serverUrl = "https://api.braincloudservers.com"), - (e._dispatcherUrl = e._serverUrl + "/dispatcherv2"), - (e._fileUploadUrl = e._serverUrl + "/uploader")); - } - ((e._appVersion = ""), - (e._debugEnabled = true), - (e._requestInProgress = false), - (e._bundleDelayActive = false), - (e._statusCodeCache = 403), - (e._reasonCodeCache = 40304), - (e._statusMessageCache = "No session"), - (e._killSwitchThreshold = 11), - (e._killSwitchEngaged = false), - (e._killSwitchErrorCount = 0), - (e._killSwitchService = ""), - (e._killSwitchOperation = ""), - (e._isInitialized = false), - (e._isAuthenticated = false), - (e.initialize = function (t, a, i) { - ((e._appId = t), - (e._secret = a), - (e._secretMap = {}), - (e._secretMap[t] = a), - (e._appVersion = i), - (e._isInitialized = true)); - }), - (e.initializeWithApps = function (t, a, i) { - ((e._appId = t), - (e._secret = a[t]), - (e._secretMap = a), - (e._appVersion = i), - (e._isInitialized = true)); - }), - (e.setServerUrl = function (t) { - for ( - e._serverUrl = t, - e._serverUrl.endsWith("/dispatcherv2/index.php") && - (e._serverUrl = e._serverUrl.substring( - 0, - e._serverUrl.length - "/dispatcherv2/index.php".length, - )); - e._serverUrl.length > 0 && - "/" == e._serverUrl.charAt(e._serverUrl.length - 1); - ) - e._serverUrl = e._serverUrl.substring( - 0, - e._serverUrl.length - 1, - ); - ((e._dispatcherUrl = e._serverUrl + "/dispatcherv2/index.php"), - (e._fileUploadUrl = e._serverUrl + "/uploader/index.php")); - }), - (e.getDispatcherUrl = function () { - return e._dispatcherUrl; - }), - (e.getFileUploadUrl = function () { - return e._fileUploadUrl; - }), - (e.setABTestingId = function (t) { - e._abTestingId = t; - }), - (e.getABTestingId = function () { - return e._abTestingId; - }), - (e.getSessionId = function () { - return e._sessionId; - }), - (e.setSessionId = function (t) { - (null !== t || "" !== t - ? (e._isAuthenticated = true) - : (e._packetId = -1), - (e._sessionId = t)); - }), - (e.getSecret = function () { - return e._secret; - }), - (e.setSecret = function (t) { - e._secret = t; - }), - (e.getAppVersion = function () { - return e._appVersion; - }), - (e.setAppVersion = function (t) { - e._appVersion = t; - }), - (e.getAppId = function () { - return e._appId; - }), - (e.setAppId = function (t) { - e._appId = t; - }), - (e.registerEventCallback = function (t) { - e._eventCallback = t; - }), - (e.deregisterEventCallback = function () { - e._eventCallback = null; - }), - (e.registerRewardCallback = function (t) { - e._rewardCallback = t; - }), - (e.deregisterRewardCallback = function () { - e._rewardCallback = null; - }), - (e.setErrorCallback = function (t) { - e._errorCallback = t; - }), - (e.setDebugEnabled = function (t) { - e._debugEnabled = t; - }), - (e.isInitialized = function () { - return e._isInitialized; - }), - (e.isAuthenticated = function () { - return e._isAuthenticated; - }), - (e.setAuthenticated = function () { - ((e._isAuthenticated = true), e.startHeartBeat()); - }), - (e.debugLog = function (t, a) { - true === e._debugEnabled && - (a ? console.error(t) : console.log(t)); - true === e._debugEnabled && - (a ? console.error(t) : console.log(t)); - }), - (e.sendRequest = function (t) { - (e.debugLog("SendRequest: " + JSON.stringify(t)), - e._sendQueue.push(t), - e._requestInProgress || - e._bundleDelayActive || - ((e._bundleDelayActive = true), - setTimeout(function () { - ((e._bundleDelayActive = false), e.processQueue()); - }, 0))); - }), - (e.resetCommunication = function () { - (e.stopHeartBeat(), - (e._sendQueue = []), - (e._inProgressQueue = []), - (e._sessionId = ""), - (e.packetId = -1), - (e._isAuthenticated = false), - (e._requestInProgress = false), - e.resetErrorCache()); - }), - (e.resetErrorCache = function () { - ((e._statusCodeCache = 403), - (e._reasonCodeCache = 40304), - (e._statusMessageCache = "No session")); - }), - (e.updateKillSwitch = function (t, a, i) { - i !== e.statusCodes.CLIENT_NETWORK_ERROR && - (0 === e._killSwitchService.length - ? ((e._killSwitchService = t), - (e._killSwitchOperation = a), - e._killSwitchErrorCount++) - : t === e._killSwitchService && - a === e._killSwitchOperation && - e._killSwitchErrorCount++, + }), + (e.getDispatcherUrl = function () { + return e._dispatcherUrl; + }), + (e.getFileUploadUrl = function () { + return e._fileUploadUrl; + }), + (e.setABTestingId = function (t) { + e._abTestingId = t; + }), + (e.getABTestingId = function () { + return e._abTestingId; + }), + (e.getSessionId = function () { + return e._sessionId; + }), + (e.setSessionId = function (t) { + (null !== t || "" !== t + ? (e._isAuthenticated = true) + : (e._packetId = -1), + (e._sessionId = t)); + }), + (e.getSecret = function () { + return e._secret; + }), + (e.setSecret = function (t) { + e._secret = t; + }), + (e.getAppVersion = function () { + return e._appVersion; + }), + (e.setAppVersion = function (t) { + e._appVersion = t; + }), + (e.getAppId = function () { + return e._appId; + }), + (e.setAppId = function (t) { + e._appId = t; + }), + (e.registerEventCallback = function (t) { + e._eventCallback = t; + }), + (e.deregisterEventCallback = function () { + e._eventCallback = null; + }), + (e.registerRewardCallback = function (t) { + e._rewardCallback = t; + }), + (e.deregisterRewardCallback = function () { + e._rewardCallback = null; + }), + (e.setErrorCallback = function (t) { + e._errorCallback = t; + }), + (e.setDebugEnabled = function (t) { + e._debugEnabled = t; + }), + (e.isInitialized = function () { + return e._isInitialized; + }), + (e.isAuthenticated = function () { + return e._isAuthenticated; + }), + (e.setAuthenticated = function () { + ((e._isAuthenticated = true), e.startHeartBeat()); + }), + (e.debugLog = function (t, a) { + true === e._debugEnabled && + (a ? console.error(t) : console.log(t)); + true === e._debugEnabled && + (a ? console.error(t) : console.log(t)); + }), + (e.sendRequest = function (t) { + (e.debugLog("SendRequest: " + JSON.stringify(t)), + e._sendQueue.push(t), + e._requestInProgress || + e._bundleDelayActive || + ((e._bundleDelayActive = true), + setTimeout(function () { + ((e._bundleDelayActive = false), e.processQueue()); + }, 0))); + }), + (e.resetCommunication = function () { + (e.stopHeartBeat(), + (e._sendQueue = []), + (e._inProgressQueue = []), + (e._sessionId = ""), + (e.packetId = -1), + (e._isAuthenticated = false), + (e._requestInProgress = false), + e.resetErrorCache()); + }), + (e.resetErrorCache = function () { + ((e._statusCodeCache = 403), + (e._reasonCodeCache = 40304), + (e._statusMessageCache = "No session")); + }), + (e.updateKillSwitch = function (t, a, i) { + i !== e.statusCodes.CLIENT_NETWORK_ERROR && + (0 === e._killSwitchService.length + ? ((e._killSwitchService = t), + (e._killSwitchOperation = a), + e._killSwitchErrorCount++) + : t === e._killSwitchService && + a === e._killSwitchOperation && + e._killSwitchErrorCount++, !e._killSwitchEngaged && - e._killSwitchErrorCount >= e._killSwitchThreshold && - ((e._killSwitchEngaged = true), + e._killSwitchErrorCount >= e._killSwitchThreshold && + ((e._killSwitchEngaged = true), e.debugLog( "Client disabled due to repeated errors from a single API call: " + - t + - " | " + - a, + t + + " | " + + a, ))); - }), - (e.resetKillSwitch = function () { - ((e._killSwitchErrorCount = 0), - (e._killSwitchService = ""), - (e._killSwitchOperation = "")); - }), - (e.startHeartBeat = function () { - (e.stopHeartBeat(), - (e._heartBeatIntervalId = t(function () { - e.sendRequest({ - service: "heartbeat", - operation: "READ", - callback: function (e) {}, - }); - }, 1000 * e._idleTimeout))); - }), - (e.stopHeartBeat = function () { - e._heartBeatIntervalId && - (clearInterval(e._heartBeatIntervalId), + }), + (e.resetKillSwitch = function () { + ((e._killSwitchErrorCount = 0), + (e._killSwitchService = ""), + (e._killSwitchOperation = "")); + }), + (e.startHeartBeat = function () { + (e.stopHeartBeat(), + (e._heartBeatIntervalId = t(function () { + e.sendRequest({ + service: "heartbeat", + operation: "READ", + callback: function (e) { }, + }); + }, 1000 * e._idleTimeout))); + }), + (e.stopHeartBeat = function () { + e._heartBeatIntervalId && + (clearInterval(e._heartBeatIntervalId), (e._heartBeatIntervalId = null)); - }), - (e.handleSuccessResponse = function (t) { - var a = t.responses; - if (e._debugEnabled) - for (var i = 0; i < a.length; ++i) - 200 == a[i].status - ? e.debugLog( - "Response(" + - a[i].status + - "): " + - JSON.stringify(a[i]), - ) - : e.debugLog( - "Response(" + - a[i].status + - "): " + - JSON.stringify(a[i]), - true, - ); - for (i = 0; i < e._inProgressQueue.length && i < a.length; ++i) { - var n = e._inProgressQueue[i].callback; - if ( - (null != e._inProgressQueue[i] && - e._errorCallback && - 200 != a[i].status && - e._errorCallback(a[i]), + }), + (e.handleSuccessResponse = function (t) { + var a = t.responses; + if (e._debugEnabled) + for (var i = 0; i < a.length; ++i) + 200 == a[i].status + ? e.debugLog( + "Response(" + + a[i].status + + "): " + + JSON.stringify(a[i]), + ) + : e.debugLog( + "Response(" + + a[i].status + + "): " + + JSON.stringify(a[i]), + true, + ); + for (i = 0; i < e._inProgressQueue.length && i < a.length; ++i) { + var n = e._inProgressQueue[i].callback; + if ( + (null != e._inProgressQueue[i] && + e._errorCallback && + 200 != a[i].status && + e._errorCallback(a[i]), null == e._inProgressQueue[i]) - ) - return; - if (200 == a[i].status) { - e.resetKillSwitch(); - var s = a[i].data; - if ( - (!s || - ("authenticationV2" != e._inProgressQueue[i].service && - "identity" != e._inProgressQueue[i].service) || - (s.sessionId && (e._sessionId = s.sessionId), + ) + return; + if (200 == a[i].status) { + e.resetKillSwitch(); + var s = a[i].data; + if ( + (!s || + ("authenticationV2" != e._inProgressQueue[i].service && + "identity" != e._inProgressQueue[i].service) || + (s.sessionId && (e._sessionId = s.sessionId), s.profileId && (e.authentication.profileId = s.profileId), s.switchToAppId && - ((e._appId = s.switchToAppId), + ((e._appId = s.switchToAppId), (e._secret = e._secretMap[s.switchToAppId]))), "playerState" != e._inProgressQueue[i].service || - ("LOGOUT" != e._inProgressQueue[i].operation && - "FULL_RESET" != e._inProgressQueue[i].operation) + ("LOGOUT" != e._inProgressQueue[i].operation && + "FULL_RESET" != e._inProgressQueue[i].operation) ? "AUTHENTICATE" == e._inProgressQueue[i].operation && - ((e._isAuthenticated = true), + ((e._isAuthenticated = true), s.hasOwnProperty("playerSessionExpiry") ? (e._idleTimeout = 0.85 * s.playerSessionExpiry) : (e._idleTimeout = 30), s.hasOwnProperty("maxKillCount") && - (e._killSwitchThreshold = s.maxKillCount), + (e._killSwitchThreshold = s.maxKillCount), e.resetErrorCache(), e.startHeartBeat()) : (e.stopHeartBeat(), @@ -313,869 +313,937 @@ var version = "v1.17.2"; (e._sessionId = ""), (e.authentication.profileId = "")), e._rewardCallback) - ) { - var o = null; - s && - e._inProgressQueue[i].service && - e._inProgressQueue[i].operation && - ("authenticationV2" == e._inProgressQueue[i].service && + ) { + var o = null; + s && + e._inProgressQueue[i].service && + e._inProgressQueue[i].operation && + ("authenticationV2" == e._inProgressQueue[i].service && "AUTHENTICATE" == e._inProgressQueue[i].operation - ? (e.resetErrorCache(), - s.rewards && s.rewards.rewards && (o = s.rewards)) - : (("playerStatistics" == - e._inProgressQueue[i].service && - "UPDATE" == e._inProgressQueue[i].operation) || - ("playerStatisticsEvent" == - e._inProgressQueue[i].service && - ("TRIGGER" == e._inProgressQueue[i].operation || - "TRIGGER_MULTIPLE" == - e._inProgressQueue[i].operation))) && - s.rewards && - (o = s), + ? (e.resetErrorCache(), + s.rewards && s.rewards.rewards && (o = s.rewards)) + : (("playerStatistics" == + e._inProgressQueue[i].service && + "UPDATE" == e._inProgressQueue[i].operation) || + ("playerStatisticsEvent" == + e._inProgressQueue[i].service && + ("TRIGGER" == e._inProgressQueue[i].operation || + "TRIGGER_MULTIPLE" == + e._inProgressQueue[i].operation))) && + s.rewards && + (o = s), o && e._rewardCallback(o)); - } - } else { - var r = a[i].status, - l = a[i].reason_code; - ((40303 !== l && 40304 !== l && 40356 !== l) || - (e.stopHeartBeat(), + } + } else { + var r = a[i].status, + l = a[i].reason_code; + ((40303 !== l && 40304 !== l && 40356 !== l) || + (e.stopHeartBeat(), (e._isAuthenticated = false), (e._sessionID = ""), (e._statusCodeCache = r), (e._reasonCodeCache = l), (e._statusMessageCache = a[i].status_message)), - e.debugLog( - "STATUSCodes:" + e.statusCodes.CLIENT_NETWORK_ERROR, - ), - e.updateKillSwitch( - e._inProgressQueue[i].service, - e._inProgressQueue[i].operation, - r, - )); - } - n && n(a[i]); + e.debugLog( + "STATUSCodes:" + e.statusCodes.CLIENT_NETWORK_ERROR, + ), + e.updateKillSwitch( + e._inProgressQueue[i].service, + e._inProgressQueue[i].operation, + r, + )); } - var c = t.events; - if (c && e._eventCallback) - for (i = 0; i < c.length; ++i) { - var d = { events: c }; - e._eventCallback(d); - } - }), - (e.fakeErrorResponse = function (t, a, i) { - var n = [], - s = {}; - ((s.status = t), - (s.reason_code = a), - (s.status_message = i), - (s.severity = "ERROR")); - for (var o = 0; o < e._inProgressQueue.length; o++) n.push(s); - e.handleSuccessResponse({ responses: n }); - }), - (e.setHeader = function (t) { - var a = n.MD5(e._jsonedQueue + e._secret); - (t.setRequestHeader("X-SIG", a), - t.setRequestHeader("X-APPID", e._appId)); - }), - (e.retry = function () { - e._retry <= e._packetTimeouts.length - ? (e._retry++, - e.debugLog("Retry # " + e._retry.toString(), false), - 1 === e._retry - ? (e.debugLog("Retrying right away", false), - e.performQuery()) - : (e.debugLog( - "Waiting for " + - e._packetTimeouts[e._retry - 1] + - " sec...", - false, - ), - setTimeout( - e.performQuery, - 1000 * e._packetTimeouts[e._retry - 1], - ))) - : (e.debugLog("Failed after " + e._retry + " retries.", true), - null != e._errorCallback && e._errorCallback, - e.fakeErrorResponse( - e.statusCodes.CLIENT_NETWORK_ERROR, - e.reasonCodes.CLIENT_NETWORK_ERROR_TIMEOUT, - "Request timed out", + n && n(a[i]); + } + var c = t.events; + if (c && e._eventCallback) + for (i = 0; i < c.length; ++i) { + var d = { events: c }; + e._eventCallback(d); + } + }), + (e.fakeErrorResponse = function (t, a, i) { + var n = [], + s = {}; + ((s.status = t), + (s.reason_code = a), + (s.status_message = i), + (s.severity = "ERROR")); + for (var o = 0; o < e._inProgressQueue.length; o++) n.push(s); + e.handleSuccessResponse({ responses: n }); + }), + (e.setHeader = function (t) { + var a = n.MD5(e._jsonedQueue + e._secret); + (t.setRequestHeader("X-SIG", a), + t.setRequestHeader("X-APPID", e._appId)); + }), + (e.retry = function () { + e._retry <= e._packetTimeouts.length + ? (e._retry++, + e.debugLog("Retry # " + e._retry.toString(), false), + 1 === e._retry + ? (e.debugLog("Retrying right away", false), + e.performQuery()) + : (e.debugLog( + "Waiting for " + + e._packetTimeouts[e._retry - 1] + + " sec...", + false, ), - (e._requestInProgress = false), - e.processQueue()); - }), - (e.performQuery = function () { - var t; - (clearTimeout(e.xml_timeoutId), - (e.xml_timeoutId = null), - (e._requestInProgress = true), - ((t = window.XMLHttpRequest - ? new XMLHttpRequest() - : new ActiveXObject("Microsoft.XMLHTTP")).requestId = - ++e._requestId), - (t.ontimeout_bc = function () { - t.readyState < 4 && - ((t.hasTimedOut = true), + setTimeout( + e.performQuery, + 1000 * e._packetTimeouts[e._retry - 1], + ))) + : (e.debugLog("Failed after " + e._retry + " retries.", true), + null != e._errorCallback && e._errorCallback, + e.fakeErrorResponse( + e.statusCodes.CLIENT_NETWORK_ERROR, + e.reasonCodes.CLIENT_NETWORK_ERROR_TIMEOUT, + "Request timed out", + ), + (e._requestInProgress = false), + e.processQueue()); + }), + (e.performQuery = function () { + var t; + (clearTimeout(e.xml_timeoutId), + (e.xml_timeoutId = null), + (e._requestInProgress = true), + ((t = window.XMLHttpRequest + ? new XMLHttpRequest() + : new ActiveXObject("Microsoft.XMLHTTP")).requestId = + ++e._requestId), + (t.ontimeout_bc = function () { + t.readyState < 4 && + ((t.hasTimedOut = true), t.abort(), (t.hasTimedOut = null), (e.xml_timeoutId = null), e.debugLog("timeout", false), e.retry()); - }), - (t.onreadystatechange = function () { + }), + (t.onreadystatechange = function () { + if ( + !t.hasTimedOut && + t.requestId == e._requestId && + t.readyState == XMLHttpRequest.DONE + ) if ( - !t.hasTimedOut && - t.requestId == e._requestId && - t.readyState == XMLHttpRequest.DONE - ) - if ( - (clearTimeout(e.xml_timeoutId), + (clearTimeout(e.xml_timeoutId), (e.xml_timeoutId = null), e.debugLog("response status : " + t.status), e.debugLog("response : " + t.responseText), 200 == t.status) - ) { - var a = JSON.parse(t.responseText); - (e.handleSuccessResponse(a), - (e._requestInProgress = false), - e.processQueue()); - } else { - if (503 == t.status) - return ( - e.debugLog("packet in progress", false), - void e.retry() - ); - try { - var i = JSON.parse(t.responseText); - (i.reason_code && (reasonCode = i.reason_code), - i.status_message - ? (statusMessage = i.status_message) - : (statusMessage = t.responseText)); - } catch (e) { - ((reasonCode = 0), (statusMessage = t.responseText)); - } - var n = t.responseText; - (e.debugLog("Failed", true), - null != e._errorCallback && - "function" == typeof e._errorCallback && - e._errorCallback(n), - (n && "" != n) || - (n = - "Unknown error. Did you lose internet connection?"), - e.fakeErrorResponse( - e.statusCodes.CLIENT_NETWORK_ERROR, - reasonCode, - n, - )); + ) { + var a = JSON.parse(t.responseText); + (e.handleSuccessResponse(a), + (e._requestInProgress = false), + e.processQueue()); + } else { + if (503 == t.status) + return ( + e.debugLog("packet in progress", false), + void e.retry() + ); + try { + var i = JSON.parse(t.responseText); + (i.reason_code && (reasonCode = i.reason_code), + i.status_message + ? (statusMessage = i.status_message) + : (statusMessage = t.responseText)); + } catch (e) { + ((reasonCode = 0), (statusMessage = t.responseText)); } - }), - (e.xml_timeoutId = setTimeout( - t.ontimeout_bc, - 1000 * e._packetTimeouts[0], - ))); - return; - (t.open("POST", e._dispatcherUrl, true), - t.setRequestHeader("Content-type", "application/json")); - var a = n.MD5(e._jsonedQueue + e._secret); - (t.setRequestHeader("X-SIG", a), - t.setRequestHeader("X-APPID", e._appId), - t.send(e._jsonedQueue)); - }), - (e.processQueue = function () { - if (e._sendQueue.length > 0) { - var t; - for ( - e._inProgressQueue = [], t = 0; - t < e._sendQueue.length; - ++t - ) { - var a = e._sendQueue[t]; - if ("END_BUNDLE_MARKER" == a.operation) { - if (0 == e._inProgressQueue.length) continue; - ++t; - break; + var n = t.responseText; + (e.debugLog("Failed", true), + null != e._errorCallback && + "function" == typeof e._errorCallback && + e._errorCallback(n), + (n && "" != n) || + (n = + "Unknown error. Did you lose internet connection?"), + e.fakeErrorResponse( + e.statusCodes.CLIENT_NETWORK_ERROR, + reasonCode, + n, + )); } - e._inProgressQueue.push(a); + }), + (e.xml_timeoutId = setTimeout( + t.ontimeout_bc, + 1000 * e._packetTimeouts[0], + ))); + return; + (t.open("POST", e._dispatcherUrl, true), + t.setRequestHeader("Content-type", "application/json")); + var a = n.MD5(e._jsonedQueue + e._secret); + (t.setRequestHeader("X-SIG", a), + t.setRequestHeader("X-APPID", e._appId), + t.send(e._jsonedQueue)); + }), + (e.processQueue = function () { + if (e._sendQueue.length > 0) { + var t; + for ( + e._inProgressQueue = [], t = 0; + t < e._sendQueue.length; + ++t + ) { + var a = e._sendQueue[t]; + if ("END_BUNDLE_MARKER" == a.operation) { + if (0 == e._inProgressQueue.length) continue; + ++t; + break; } - if ((e._sendQueue.splice(0, t), e._inProgressQueue.length <= 0)) - return; - if ( - ((e._jsonedQueue = JSON.stringify({ - messages: e._inProgressQueue, - gameId: e._appId, - sessionId: e._sessionId, - packetId: e._packetId++, - })), + e._inProgressQueue.push(a); + } + if ((e._sendQueue.splice(0, t), e._inProgressQueue.length <= 0)) + return; + if ( + ((e._jsonedQueue = JSON.stringify({ + messages: e._inProgressQueue, + gameId: e._appId, + sessionId: e._sessionId, + packetId: e._packetId++, + })), localStorage.setItem("lastPacketId", e._packetId), e._killSwitchEngaged) - ) + ) + return void e.fakeErrorResponse( + e.statusCodes.CLIENT_NETWORK_ERROR, + e.reasonCodes.CLIENT_DISABLED, + "Client disabled due to repeated errors from a single API call", + ); + if (!e._isAuthenticated) { + var n = false; + for (i = 0; i < e._inProgressQueue.length; i++) + if ( + "AUTHENTICATE" == e._inProgressQueue[i].operation || + "RESET_EMAIL_PASSWORD" == + e._inProgressQueue[i].operation || + "RESET_EMAIL_PASSWORD_ADVANCED" == + e._inProgressQueue[i].operation + ) { + n = true; + break; + } + if (!n) return void e.fakeErrorResponse( - e.statusCodes.CLIENT_NETWORK_ERROR, - e.reasonCodes.CLIENT_DISABLED, - "Client disabled due to repeated errors from a single API call", + e._statusCodeCache, + e._reasonCodeCache, + e._statusMessageCache, ); - if (!e._isAuthenticated) { - var n = false; - for (i = 0; i < e._inProgressQueue.length; i++) - if ( - "AUTHENTICATE" == e._inProgressQueue[i].operation || - "RESET_EMAIL_PASSWORD" == - e._inProgressQueue[i].operation || - "RESET_EMAIL_PASSWORD_ADVANCED" == - e._inProgressQueue[i].operation - ) { - n = true; - break; - } - if (!n) - return void e.fakeErrorResponse( - e._statusCodeCache, - e._reasonCodeCache, - e._statusMessageCache, - ); - } - ((e._retry = 0), e.performQuery()); } - })); - } - function o() { - var e = this; - ((e.abtests = {}), - (e.abtests.loadABTestData = function (e, t) { - (console.log("called loadABTestData(" + e + ",callback)"), - jQuery - .ajax({ - timeout: 15e3, - url: e, - type: "POST", - contentType: "application/json", - dataType: "json", - data: JSON.stringify({}), - }) - .done(function (e) { - (console.log( - "loadABTestData() - GOT: " + JSON.stringify(e), - ), - null != e && (abTestData = e), - t && t()); - }) - .fail(function (e, t, a) { - console.log( - "loadABTestData() - FAILED: " + e + " " + t + " " + a, + ((e._retry = 0), e.performQuery()); + } + })); + } + function o() { + var e = this; + ((e.abtests = {}), + (e.abtests.loadABTestData = function (e, t) { + (console.log("called loadABTestData(" + e + ",callback)"), + jQuery + .ajax({ + timeout: 15e3, + url: e, + type: "POST", + contentType: "application/json", + dataType: "json", + data: JSON.stringify({}), + }) + .done(function (e) { + (console.log( + "loadABTestData() - GOT: " + JSON.stringify(e), + ), + null != e && (abTestData = e), + t && t()); + }) + .fail(function (e, t, a) { + console.log( + "loadABTestData() - FAILED: " + e + " " + t + " " + a, + ); + })); + }), + (e.abtests.getABTest = function (e, t) { + console.log("called getABTest(" + e + "," + t + ")."); + for (var a = 0; a < abTestData.ab_tests.length; a++) + if ( + abTestData.ab_tests[a].name == t && + "true" == abTestData.ab_tests[a].active + ) + for (var i = 0; i < abTestData.ab_tests[a].data.length; i++) { + var n = abTestData.ab_tests[a].data[i].min, + s = abTestData.ab_tests[a].data[i].max; + if (e >= n && e <= s) + return ( + console.log( + "getABTest() - Found AB test '" + + t + + ":" + + abTestData.ab_tests[a].data[i].name + + "' for abTestingId '" + + e + + "' in range '" + + n + + "' to '" + + s + + "'.", + ), + abTestData.ab_tests[a].data[i].name ); - })); - }), - (e.abtests.getABTest = function (e, t) { - console.log("called getABTest(" + e + "," + t + ")."); - for (var a = 0; a < abTestData.ab_tests.length; a++) - if ( - abTestData.ab_tests[a].name == t && - "true" == abTestData.ab_tests[a].active - ) - for (var i = 0; i < abTestData.ab_tests[a].data.length; i++) { - var n = abTestData.ab_tests[a].data[i].min, - s = abTestData.ab_tests[a].data[i].max; - if (e >= n && e <= s) - return ( - console.log( - "getABTest() - Found AB test '" + - t + - ":" + - abTestData.ab_tests[a].data[i].name + - "' for abTestingId '" + - e + - "' in range '" + - n + - "' to '" + - s + - "'.", - ), - abTestData.ab_tests[a].data[i].name - ); - } - return ( - console.log( - "getABTest() - Could not find an '" + - t + - "' AB test for abTestingId '" + - e + - "'.", - ), - null - ); - }), - (e.abtests.pushABTestResult = function (e, t, a, i) { + } + return ( console.log( - "called pushABTestResult(" + - e + - "," + - t + - "," + - a + - "," + - i + - ").", - ); - }), - (e.abtests.setABTestingId = function (t) { - e.brainCloudManager.setABTestingId(t); - }), - (e.abtests.getABTestingId = function () { - return e.brainCloudManager.getABTestingId(); - })); - } - function r() { - var e = this; - ((e.appStore = {}), - (e.SERVICE_APP_STORE = "appStore"), - (e.appStore.OPERATION_VERIFY_PURCHASE = "VERIFY_PURCHASE"), - (e.appStore.OPERATION_GET_ELIGIBLE_PROMOTIONS = - "ELIGIBLE_PROMOTIONS"), - (e.appStore.OPERATION_GET_SALES_INVENTORY = "GET_INVENTORY"), - (e.appStore.OPERATION_START_PURCHASE = "START_PURCHASE"), - (e.appStore.OPERATION_FINALIZE_PURCHASE = "FINALIZE_PURCHASE"), - (e.appStore.OPERATION_REFRESH_PROMOTIONS = "REFRESH_PROMOTIONS"), - (e.appStore.verifyPurchase = function (t, a, i) { - var n = { storeId: t, receiptData: a }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_APP_STORE, - operation: e.appStore.OPERATION_VERIFY_PURCHASE, - data: n, - callback: i, - }); - }), - (e.appStore.getEligiblePromotions = function (t) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_APP_STORE, - operation: e.appStore.OPERATION_GET_ELIGIBLE_PROMOTIONS, - data: {}, - callback: t, - }); - }), - (e.appStore.getSalesInventory = function (t, a, i) { - e.appStore.getSalesInventoryByCategory(t, a, null, i); - }), - (e.appStore.getSalesInventoryByCategory = function (t, a, i, n) { - var s = { - storeId: t, - category: i, - priceInfoCriteria: { userCurrency: a }, - }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_APP_STORE, - operation: e.appStore.OPERATION_GET_SALES_INVENTORY, - data: s, - callback: n, - }); - }), - (e.appStore.startPurchase = function (t, a, i) { - var n = { storeId: t, purchaseData: a }; + "getABTest() - Could not find an '" + + t + + "' AB test for abTestingId '" + + e + + "'.", + ), + null + ); + }), + (e.abtests.pushABTestResult = function (e, t, a, i) { + console.log( + "called pushABTestResult(" + + e + + "," + + t + + "," + + a + + "," + + i + + ").", + ); + }), + (e.abtests.setABTestingId = function (t) { + e.brainCloudManager.setABTestingId(t); + }), + (e.abtests.getABTestingId = function () { + return e.brainCloudManager.getABTestingId(); + })); + } + function r() { + var e = this; + ((e.appStore = {}), + (e.SERVICE_APP_STORE = "appStore"), + (e.appStore.OPERATION_VERIFY_PURCHASE = "VERIFY_PURCHASE"), + (e.appStore.OPERATION_GET_ELIGIBLE_PROMOTIONS = + "ELIGIBLE_PROMOTIONS"), + (e.appStore.OPERATION_GET_SALES_INVENTORY = "GET_INVENTORY"), + (e.appStore.OPERATION_START_PURCHASE = "START_PURCHASE"), + (e.appStore.OPERATION_FINALIZE_PURCHASE = "FINALIZE_PURCHASE"), + (e.appStore.OPERATION_REFRESH_PROMOTIONS = "REFRESH_PROMOTIONS"), + (e.appStore.verifyPurchase = function (t, a, i) { + var n = { storeId: t, receiptData: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_APP_STORE, + operation: e.appStore.OPERATION_VERIFY_PURCHASE, + data: n, + callback: i, + }); + }), + (e.appStore.getEligiblePromotions = function (t) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_APP_STORE, + operation: e.appStore.OPERATION_GET_ELIGIBLE_PROMOTIONS, + data: {}, + callback: t, + }); + }), + (e.appStore.getSalesInventory = function (t, a, i) { + e.appStore.getSalesInventoryByCategory(t, a, null, i); + }), + (e.appStore.getSalesInventoryByCategory = function (t, a, i, n) { + var s = { + storeId: t, + category: i, + priceInfoCriteria: { userCurrency: a }, + }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_APP_STORE, + operation: e.appStore.OPERATION_GET_SALES_INVENTORY, + data: s, + callback: n, + }); + }), + (e.appStore.startPurchase = function (t, a, i) { + var n = { storeId: t, purchaseData: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_APP_STORE, + operation: e.appStore.OPERATION_START_PURCHASE, + data: n, + callback: i, + }); + }), + (e.appStore.finalizePurchase = function (t, a, i, n) { + var s = { storeId: t, transactionId: a, transactionData: i }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_APP_STORE, + operation: e.appStore.OPERATION_FINALIZE_PURCHASE, + data: s, + callback: n, + }); + }), + (e.appStore.refreshPromotions = function (t) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_APP_STORE, + operation: e.appStore.OPERATION_REFRESH_PROMOTIONS, + data: {}, + callback: t, + }); + })); + } + function l() { + var e = this; + ((e.asyncMatch = {}), + (e.SERVICE_ASYNC_MATCH = "asyncMatch"), + (e.asyncMatch.OPERATION_SUBMIT_TURN = "SUBMIT_TURN"), + (e.asyncMatch.OPERATION_UPDATE_SUMMARY = "UPDATE_SUMMARY"), + (e.asyncMatch.OPERATION_ABANDON = "ABANDON"), + (e.asyncMatch.OPERATION_COMPLETE = "COMPLETE"), + (e.asyncMatch.OPERATION_CREATE = "CREATE"), + (e.asyncMatch.OPERATION_READ_MATCH = "READ_MATCH"), + (e.asyncMatch.OPERATION_READ_MATCH_HISTORY = "READ_MATCH_HISTORY"), + (e.asyncMatch.OPERATION_FIND_MATCHES = "FIND_MATCHES"), + (e.asyncMatch.OPERATION_FIND_MATCHES_COMPLETED = + "FIND_MATCHES_COMPLETED"), + (e.asyncMatch.OPERATION_DELETE_MATCH = "DELETE_MATCH"), + (e.asyncMatch.OPERATION_ABANDON_MATCH_WITH_SUMMARY_DATA = + "ABANDON_MATCH_WITH_SUMMARY_DATA"), + (e.asyncMatch.OPERATION_COMPLETE_MATCH_WITH_SUMMARY_DATA = + "COMPLETE_MATCH_WITH_SUMMARY_DATA"), + (e.asyncMatch.createMatch = function (t, a, i) { + var n = { players: t }; + (a && (n.pushContent = a), e.brainCloudManager.sendRequest({ - service: e.SERVICE_APP_STORE, - operation: e.appStore.OPERATION_START_PURCHASE, + service: e.SERVICE_ASYNC_MATCH, + operation: e.asyncMatch.OPERATION_CREATE, data: n, callback: i, - }); - }), - (e.appStore.finalizePurchase = function (t, a, i, n) { - var s = { storeId: t, transactionId: a, transactionData: i }; + })); + }), + (e.asyncMatch.createMatchWithInitialTurn = function ( + t, + a, + i, + n, + s, + o, + ) { + var r = { players: t }; + ((r.matchState = a || {}), + i && (r.pushContent = i), + n && (r.status = { currentPlayer: n }), + s && (r.summary = s), e.brainCloudManager.sendRequest({ - service: e.SERVICE_APP_STORE, - operation: e.appStore.OPERATION_FINALIZE_PURCHASE, - data: s, - callback: n, - }); - }), - (e.appStore.refreshPromotions = function (t) { + service: e.SERVICE_ASYNC_MATCH, + operation: e.asyncMatch.OPERATION_CREATE, + data: r, + callback: o, + })); + }), + (e.asyncMatch.readMatch = function (t, a, i) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_ASYNC_MATCH, + operation: e.asyncMatch.OPERATION_READ_MATCH, + data: { ownerId: t, matchId: a }, + callback: i, + }); + }), + (e.asyncMatch.submitTurn = function (t, a, i, n, s, o, r, l, c) { + var d = { ownerId: t, matchId: a, version: i }; + (n && (d.matchState = n), + o && (d.status = { currentPlayer: o }), + r && (d.summary = r), + l && (d.statistics = l), + s && (d.pushContent = s), e.brainCloudManager.sendRequest({ - service: e.SERVICE_APP_STORE, - operation: e.appStore.OPERATION_REFRESH_PROMOTIONS, - data: {}, - callback: t, - }); - })); - } - function l() { - var e = this; - ((e.asyncMatch = {}), - (e.SERVICE_ASYNC_MATCH = "asyncMatch"), - (e.asyncMatch.OPERATION_SUBMIT_TURN = "SUBMIT_TURN"), - (e.asyncMatch.OPERATION_UPDATE_SUMMARY = "UPDATE_SUMMARY"), - (e.asyncMatch.OPERATION_ABANDON = "ABANDON"), - (e.asyncMatch.OPERATION_COMPLETE = "COMPLETE"), - (e.asyncMatch.OPERATION_CREATE = "CREATE"), - (e.asyncMatch.OPERATION_READ_MATCH = "READ_MATCH"), - (e.asyncMatch.OPERATION_READ_MATCH_HISTORY = "READ_MATCH_HISTORY"), - (e.asyncMatch.OPERATION_FIND_MATCHES = "FIND_MATCHES"), - (e.asyncMatch.OPERATION_FIND_MATCHES_COMPLETED = - "FIND_MATCHES_COMPLETED"), - (e.asyncMatch.OPERATION_DELETE_MATCH = "DELETE_MATCH"), - (e.asyncMatch.OPERATION_ABANDON_MATCH_WITH_SUMMARY_DATA = - "ABANDON_MATCH_WITH_SUMMARY_DATA"), - (e.asyncMatch.OPERATION_COMPLETE_MATCH_WITH_SUMMARY_DATA = - "COMPLETE_MATCH_WITH_SUMMARY_DATA"), - (e.asyncMatch.createMatch = function (t, a, i) { - var n = { players: t }; - (a && (n.pushContent = a), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_ASYNC_MATCH, - operation: e.asyncMatch.OPERATION_CREATE, - data: n, - callback: i, - })); - }), - (e.asyncMatch.createMatchWithInitialTurn = function ( + service: e.SERVICE_ASYNC_MATCH, + operation: e.asyncMatch.OPERATION_SUBMIT_TURN, + data: d, + callback: c, + })); + }), + (e.asyncMatch.updateMatchSummaryData = function (t, a, i, n, s) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_ASYNC_MATCH, + operation: e.asyncMatch.OPERATION_UPDATE_SUMMARY, + data: { ownerId: t, matchId: a, version: i, summary: n }, + callback: s, + }); + }), + (e.asyncMatch.abandonMatch = function (t, a, i) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_ASYNC_MATCH, + operation: e.asyncMatch.OPERATION_ABANDON, + data: { ownerId: t, matchId: a }, + callback: i, + }); + }), + (e.asyncMatch.completeMatch = function (t, a, i) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_ASYNC_MATCH, + operation: e.asyncMatch.OPERATION_COMPLETE, + data: { ownerId: t, matchId: a }, + callback: i, + }); + }), + (e.asyncMatch.readMatchHistory = function (t, a, i) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_ASYNC_MATCH, + operation: e.asyncMatch.OPERATION_READ_MATCH_HISTORY, + data: { ownerId: t, matchId: a }, + callback: i, + }); + }), + (e.asyncMatch.findMatches = function (t) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_ASYNC_MATCH, + operation: e.asyncMatch.OPERATION_FIND_MATCHES, + callback: t, + }); + }), + (e.asyncMatch.findCompleteMatches = function (t) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_ASYNC_MATCH, + operation: e.asyncMatch.OPERATION_FIND_MATCHES_COMPLETED, + callback: t, + }); + }), + (e.asyncMatch.deleteMatch = function (t, a, i) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_ASYNC_MATCH, + operation: e.asyncMatch.OPERATION_DELETE_MATCH, + data: { ownerId: t, matchId: a }, + callback: i, + }); + }), + (e.asyncMatch.completeMatchWithSummaryData = function ( + t, + a, + i, + n, + s, + ) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_ASYNC_MATCH, + operation: + e.asyncMatch.OPERATION_COMPLETE_MATCH_WITH_SUMMARY_DATA, + data: { ownerId: t, matchId: a, pushContent: i, summary: n }, + callback: s, + }); + }), + (e.asyncMatch.abandonMatchWithSummaryData = function ( + t, + a, + i, + n, + s, + ) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_ASYNC_MATCH, + operation: + e.asyncMatch.OPERATION_ABANDON_MATCH_WITH_SUMMARY_DATA, + data: { ownerId: t, matchId: a, pushContent: i, summary: n }, + callback: s, + }); + })); + } + function c() { + var e = this; + ((e.authentication = {}), + (e.SERVICE_AUTHENTICATION = "authenticationV2"), + (e.authentication.OPERATION_AUTHENTICATE = "AUTHENTICATE"), + (e.authentication.OPERATION_RESET_EMAIL_PASSWORD = + "RESET_EMAIL_PASSWORD"), + (e.authentication.OPERATION_RESET_EMAIL_PASSWORD_ADVANCED = + "RESET_EMAIL_PASSWORD_ADVANCED"), + (e.authentication.OPERATION_RESET_EMAIL_PASSWORD_WITH_EXPIRY = + "RESET_EMAIL_PASSWORD_WITH_EXPIRY"), + (e.authentication.OPERATION_RESET_EMAIL_PASSWORD_ADVANCED_WITH_EXPIRY = + "RESET_EMAIL_PASSWORD_ADVANCED_WITH_EXPIRY"), + (e.authentication.OPERATION_RESET_UNIVERSAL_ID_PASSWORD = + "RESET_UNIVERSAL_ID_PASSWORD"), + (e.authentication.OPERATION_RESET_UNIVERSAL_ID_PASSWORD_ADVANCED = + "RESET_UNIVERSAL_ID_PASSWORD_ADVANCED"), + (e.authentication.OPERATION_RESET_UNIVERSAL_ID_PASSWORD_WITH_EXPIRY = + "RESET_UNIVERSAL_ID_PASSWORD_WITH_EXPIRY"), + (e.authentication.OPERATION_RESET_UNIVERSAL_ID_PASSWORD_ADVANCED_WITH_EXPIRY = + "RESET_UNIVERSAL_ID_PASSWORD_ADVANCED_WITH_EXPIRY"), + (e.authentication.AUTHENTICATION_TYPE_ANONYMOUS = "Anonymous"), + (e.authentication.AUTHENTICATION_TYPE_EMAIL = "Email"), + (e.authentication.AUTHENTICATION_TYPE_EXTERNAL = "External"), + (e.authentication.AUTHENTICATION_TYPE_FACEBOOK = "Facebook"), + (e.authentication.AUTHENTICATION_TYPE_FACEBOOK_LIMITED = + "FacebookLimited"), + (e.authentication.AUTHENTICATION_TYPE_APPLE = "Apple"), + (e.authentication.AUTHENTICATION_TYPE_GOOGLE = "Google"), + (e.authentication.AUTHENTICATION_TYPE_GOOGLE_OPEN_ID = + "GoogleOpenId"), + (e.authentication.AUTHENTICATION_TYPE_APPLE = "Apple"), + (e.authentication.AUTHENTICATION_TYPE_ULTRA = "Ultra"), + (e.authentication.AUTHENTICATION_TYPE_UNIVERSAL = "Universal"), + (e.authentication.AUTHENTICATION_TYPE_GAME_CENTER = "GameCenter"), + (e.authentication.AUTHENTICATION_TYPE_STEAM = "Steam"), + (e.authentication.AUTHENTICATION_TYPE_BLOCKCHAIN = "Blockchain"), + (e.authentication.AUTHENTICATION_TYPE_TWITTER = "Twitter"), + (e.authentication.AUTHENTICATION_TYPE_PARSE = "Parse"), + (e.authentication.AUTHENTICATION_TYPE_HANDOFF = "Handoff"), + (e.authentication.AUTHENTICATION_TYPE_SETTOP_HANDOFF = + "SettopHandoff"), + (e.authentication.profileId = ""), + (e.authentication.anonymousId = ""), + (e.authentication.initialize = function (t, a) { + ((e.authentication.anonymousId = a), + (e.authentication.profileId = t)); + }), + (e.authentication.generateAnonymousId = function () { + var e = new Date().getTime(); + return ( + window.performance && + "function" == typeof window.performance.now && + (e += performance.now()), + "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace( + /[xy]/g, + function (t) { + var a = ((e + 16 * Math.random()) % 16) | 0; + return ( + (e = Math.floor(e / 16)), + ("x" == t ? a : (3 & a) | 8).toString(16) + ); + }, + ) + ); + }), + (e.authentication.clearSavedProfileId = function () { + e.authentication.profileId = ""; + }), + (e.authentication.authenticateAnonymous = function (t, a) { + e.authentication.authenticate( + e.authentication.anonymousId, + "", + e.authentication.AUTHENTICATION_TYPE_ANONYMOUS, + null, + t, + null, + a, + ); + }), + (e.authentication.authenticateEmailPassword = function ( + t, + a, + i, + n, + ) { + e.authentication.authenticate( t, a, + e.authentication.AUTHENTICATION_TYPE_EMAIL, + null, i, + null, n, - s, - o, - ) { - var r = { players: t }; - ((r.matchState = a || {}), - i && (r.pushContent = i), - n && (r.status = { currentPlayer: n }), - s && (r.summary = s), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_ASYNC_MATCH, - operation: e.asyncMatch.OPERATION_CREATE, - data: r, - callback: o, - })); - }), - (e.asyncMatch.readMatch = function (t, a, i) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_ASYNC_MATCH, - operation: e.asyncMatch.OPERATION_READ_MATCH, - data: { ownerId: t, matchId: a }, - callback: i, - }); - }), - (e.asyncMatch.submitTurn = function (t, a, i, n, s, o, r, l, c) { - var d = { ownerId: t, matchId: a, version: i }; - (n && (d.matchState = n), - o && (d.status = { currentPlayer: o }), - r && (d.summary = r), - l && (d.statistics = l), - s && (d.pushContent = s), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_ASYNC_MATCH, - operation: e.asyncMatch.OPERATION_SUBMIT_TURN, - data: d, - callback: c, - })); - }), - (e.asyncMatch.updateMatchSummaryData = function (t, a, i, n, s) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_ASYNC_MATCH, - operation: e.asyncMatch.OPERATION_UPDATE_SUMMARY, - data: { ownerId: t, matchId: a, version: i, summary: n }, - callback: s, - }); - }), - (e.asyncMatch.abandonMatch = function (t, a, i) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_ASYNC_MATCH, - operation: e.asyncMatch.OPERATION_ABANDON, - data: { ownerId: t, matchId: a }, - callback: i, - }); - }), - (e.asyncMatch.completeMatch = function (t, a, i) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_ASYNC_MATCH, - operation: e.asyncMatch.OPERATION_COMPLETE, - data: { ownerId: t, matchId: a }, - callback: i, - }); - }), - (e.asyncMatch.readMatchHistory = function (t, a, i) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_ASYNC_MATCH, - operation: e.asyncMatch.OPERATION_READ_MATCH_HISTORY, - data: { ownerId: t, matchId: a }, - callback: i, - }); - }), - (e.asyncMatch.findMatches = function (t) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_ASYNC_MATCH, - operation: e.asyncMatch.OPERATION_FIND_MATCHES, - callback: t, - }); - }), - (e.asyncMatch.findCompleteMatches = function (t) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_ASYNC_MATCH, - operation: e.asyncMatch.OPERATION_FIND_MATCHES_COMPLETED, - callback: t, - }); - }), - (e.asyncMatch.deleteMatch = function (t, a, i) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_ASYNC_MATCH, - operation: e.asyncMatch.OPERATION_DELETE_MATCH, - data: { ownerId: t, matchId: a }, - callback: i, - }); - }), - (e.asyncMatch.completeMatchWithSummaryData = function ( + ); + }), + (e.authentication.authenticateExternal = function (t, a, i, n, s) { + e.authentication.authenticate( t, a, + e.authentication.AUTHENTICATION_TYPE_EXTERNAL, i, n, + null, s, - ) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_ASYNC_MATCH, - operation: - e.asyncMatch.OPERATION_COMPLETE_MATCH_WITH_SUMMARY_DATA, - data: { ownerId: t, matchId: a, pushContent: i, summary: n }, - callback: s, - }); - }), - (e.asyncMatch.abandonMatchWithSummaryData = function ( + ); + }), + (e.authentication.authenticateFacebook = function (t, a, i, n) { + e.authentication.authenticate( t, a, + e.authentication.AUTHENTICATION_TYPE_FACEBOOK, + null, i, + null, n, - s, - ) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_ASYNC_MATCH, - operation: - e.asyncMatch.OPERATION_ABANDON_MATCH_WITH_SUMMARY_DATA, - data: { ownerId: t, matchId: a, pushContent: i, summary: n }, - callback: s, - }); - })); - } - function c() { - var e = this; - ((e.authentication = {}), - (e.SERVICE_AUTHENTICATION = "authenticationV2"), - (e.authentication.OPERATION_AUTHENTICATE = "AUTHENTICATE"), - (e.authentication.OPERATION_RESET_EMAIL_PASSWORD = - "RESET_EMAIL_PASSWORD"), - (e.authentication.OPERATION_RESET_EMAIL_PASSWORD_ADVANCED = - "RESET_EMAIL_PASSWORD_ADVANCED"), - (e.authentication.OPERATION_RESET_EMAIL_PASSWORD_WITH_EXPIRY = - "RESET_EMAIL_PASSWORD_WITH_EXPIRY"), - (e.authentication.OPERATION_RESET_EMAIL_PASSWORD_ADVANCED_WITH_EXPIRY = - "RESET_EMAIL_PASSWORD_ADVANCED_WITH_EXPIRY"), - (e.authentication.OPERATION_RESET_UNIVERSAL_ID_PASSWORD = - "RESET_UNIVERSAL_ID_PASSWORD"), - (e.authentication.OPERATION_RESET_UNIVERSAL_ID_PASSWORD_ADVANCED = - "RESET_UNIVERSAL_ID_PASSWORD_ADVANCED"), - (e.authentication.OPERATION_RESET_UNIVERSAL_ID_PASSWORD_WITH_EXPIRY = - "RESET_UNIVERSAL_ID_PASSWORD_WITH_EXPIRY"), - (e.authentication.OPERATION_RESET_UNIVERSAL_ID_PASSWORD_ADVANCED_WITH_EXPIRY = - "RESET_UNIVERSAL_ID_PASSWORD_ADVANCED_WITH_EXPIRY"), - (e.authentication.AUTHENTICATION_TYPE_ANONYMOUS = "Anonymous"), - (e.authentication.AUTHENTICATION_TYPE_EMAIL = "Email"), - (e.authentication.AUTHENTICATION_TYPE_EXTERNAL = "External"), - (e.authentication.AUTHENTICATION_TYPE_FACEBOOK = "Facebook"), - (e.authentication.AUTHENTICATION_TYPE_FACEBOOK_LIMITED = - "FacebookLimited"), - (e.authentication.AUTHENTICATION_TYPE_APPLE = "Apple"), - (e.authentication.AUTHENTICATION_TYPE_GOOGLE = "Google"), - (e.authentication.AUTHENTICATION_TYPE_GOOGLE_OPEN_ID = - "GoogleOpenId"), - (e.authentication.AUTHENTICATION_TYPE_APPLE = "Apple"), - (e.authentication.AUTHENTICATION_TYPE_ULTRA = "Ultra"), - (e.authentication.AUTHENTICATION_TYPE_UNIVERSAL = "Universal"), - (e.authentication.AUTHENTICATION_TYPE_GAME_CENTER = "GameCenter"), - (e.authentication.AUTHENTICATION_TYPE_STEAM = "Steam"), - (e.authentication.AUTHENTICATION_TYPE_BLOCKCHAIN = "Blockchain"), - (e.authentication.AUTHENTICATION_TYPE_TWITTER = "Twitter"), - (e.authentication.AUTHENTICATION_TYPE_PARSE = "Parse"), - (e.authentication.AUTHENTICATION_TYPE_HANDOFF = "Handoff"), - (e.authentication.AUTHENTICATION_TYPE_SETTOP_HANDOFF = - "SettopHandoff"), - (e.authentication.profileId = ""), - (e.authentication.anonymousId = ""), - (e.authentication.initialize = function (t, a) { - ((e.authentication.anonymousId = a), - (e.authentication.profileId = t)); - }), - (e.authentication.generateAnonymousId = function () { - var e = new Date().getTime(); - return ( - window.performance && - "function" == typeof window.performance.now && - (e += performance.now()), - "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace( - /[xy]/g, - function (t) { - var a = ((e + 16 * Math.random()) % 16) | 0; - return ( - (e = Math.floor(e / 16)), - ("x" == t ? a : (3 & a) | 8).toString(16) - ); - }, - ) - ); - }), - (e.authentication.clearSavedProfileId = function () { - e.authentication.profileId = ""; - }), - (e.authentication.authenticateAnonymous = function (t, a) { - e.authentication.authenticate( - e.authentication.anonymousId, - "", - e.authentication.AUTHENTICATION_TYPE_ANONYMOUS, - null, - t, - null, - a, - ); - }), - (e.authentication.authenticateEmailPassword = function ( + ); + }), + (e.authentication.authenticateFacebookLimited = function ( + t, + a, + i, + n, + ) { + e.authentication.authenticate( t, a, + e.authentication.AUTHENTICATION_TYPE_FACEBOOK_LIMITED, + null, i, + null, n, - ) { - e.authentication.authenticate( - t, - a, - e.authentication.AUTHENTICATION_TYPE_EMAIL, - null, - i, - null, - n, - ); - }), - (e.authentication.authenticateExternal = function (t, a, i, n, s) { - e.authentication.authenticate( - t, - a, - e.authentication.AUTHENTICATION_TYPE_EXTERNAL, - i, - n, - null, - s, - ); - }), - (e.authentication.authenticateFacebook = function (t, a, i, n) { - e.authentication.authenticate( - t, - a, - e.authentication.AUTHENTICATION_TYPE_FACEBOOK, - null, - i, - null, - n, - ); - }), - (e.authentication.authenticateFacebookLimited = function ( + ); + }), + (e.authentication.authenticateApple = function (t, a, i, n) { + e.authentication.authenticate( t, a, + e.authentication.AUTHENTICATION_TYPE_APPLE, + null, i, + null, n, - ) { - e.authentication.authenticate( - t, - a, - e.authentication.AUTHENTICATION_TYPE_FACEBOOK_LIMITED, - null, - i, - null, - n, - ); - }), - (e.authentication.authenticateApple = function (t, a, i, n) { - e.authentication.authenticate( - t, - a, - e.authentication.AUTHENTICATION_TYPE_APPLE, - null, - i, - null, - n, - ); - }), - (e.authentication.authenticateGameCenter = function (t, a, i) { - e.authentication.authenticate( - t, - null, - e.authentication.AUTHENTICATION_TYPE_GAME_CENTER, - null, - a, - null, - i, - ); - }), - (e.authentication.authenticateApple = function (t, a, i, n) { - e.authentication.authenticate( - t, - a, - e.authentication.AUTHENTICATION_TYPE_APPLE, - null, - i, - null, - n, - ); - }), - (e.authentication.authenticateGoogle = function (t, a, i, n) { - e.authentication.authenticate( - t, - a, - e.authentication.AUTHENTICATION_TYPE_GOOGLE, - null, - i, - null, - n, - ); - }), - (e.authentication.authenticateGoogleOpenId = function (t, a, i, n) { - e.authentication.authenticate( - t, - a, - e.authentication.AUTHENTICATION_TYPE_GOOGLE_OPEN_ID, - null, - i, - null, - n, - ); - }), - (e.authentication.authenticateGoogleOpenId = function (t, a, i, n) { - e.authentication.authenticate( - t, - a, - e.authentication.AUTHENTICATION_TYPE_GOOGLE_OPEN_ID, - null, - i, - null, - n, - ); - }), - (e.authentication.authenticateUltra = function (t, a, i, n) { - e.authentication.authenticate( - t, - a, - e.authentication.AUTHENTICATION_TYPE_ULTRA, - null, - i, - null, - n, - ); - }), - (e.authentication.authenticateSteam = function (t, a, i, n) { - e.authentication.authenticate( - t, - a, - e.authentication.AUTHENTICATION_TYPE_STEAM, - null, - i, - null, - n, - ); - }), - (e.authentication.authenticateTwitter = function (t, a, i, n, s) { - e.authentication.authenticate( - t, - a + ":" + i, - e.authentication.AUTHENTICATION_TYPE_TWITTER, - null, - n, - null, - s, - ); - }), - (e.authentication.authenticateUniversal = function (t, a, i, n) { - e.authentication.authenticate( - t, - a, - e.authentication.AUTHENTICATION_TYPE_UNIVERSAL, - null, - i, - null, - n, - ); - }), - (e.authentication.authenticateAdvanced = function (t, a, i, n, s) { - e.authentication.authenticate( - a.externalId, - a.authenticationToken, - t, - a.authenticationSubType, - i, - n, - s, - ); - }), - (e.authentication.authenticateParse = function (t, a, i, n) { - e.authentication.authenticate( - t, - a, - e.authentication.AUTHENTICATION_TYPE_PARSE, - null, - i, - null, - n, - ); - }), - (e.authentication.resetEmailPassword = function (t, a) { - var i = a, - n = e.brainCloudManager.getAppId(), - s = { - service: e.SERVICE_AUTHENTICATION, - operation: e.authentication.OPERATION_RESET_EMAIL_PASSWORD, - data: { gameId: n, externalId: t }, - callerCallback: a, - callback: function (e) { - (e && e.status, i && i(e)); - }, - }; - e.brainCloudManager.sendRequest(s); - }), - (e.authentication.resetEmailPasswordAdvanced = function (t, a, i) { - var n = e.brainCloudManager.getAppId(), - s = { - service: e.SERVICE_AUTHENTICATION, - operation: - e.authentication.OPERATION_RESET_EMAIL_PASSWORD_ADVANCED, - data: { gameId: n, emailAddress: t, serviceParams: a }, - callback: i, - }; - e.brainCloudManager.sendRequest(s); - }), - (e.authentication.resetEmailPasswordWithExpiry = function ( + ); + }), + (e.authentication.authenticateGameCenter = function (t, a, i) { + e.authentication.authenticate( t, + null, + e.authentication.AUTHENTICATION_TYPE_GAME_CENTER, + null, a, + null, i, - ) { - var n = i, - s = e.brainCloudManager.getAppId(), - o = { - service: e.SERVICE_AUTHENTICATION, - operation: - e.authentication.OPERATION_RESET_EMAIL_PASSWORD_WITH_EXPIRY, - data: { gameId: s, externalId: t, tokenTtlInMinutes: a }, - callerCallback: i, - callback: function (e) { - (e && e.status, n && n(e)); - }, - }; - e.brainCloudManager.sendRequest(o); - }), - (e.authentication.resetEmailPasswordAdvancedWithExpiry = function ( + ); + }), + (e.authentication.authenticateApple = function (t, a, i, n) { + e.authentication.authenticate( t, a, + e.authentication.AUTHENTICATION_TYPE_APPLE, + null, i, + null, n, - ) { + ); + }), + (e.authentication.authenticateGoogle = function (t, a, i, n) { + e.authentication.authenticate( + t, + a, + e.authentication.AUTHENTICATION_TYPE_GOOGLE, + null, + i, + null, + n, + ); + }), + (e.authentication.authenticateGoogleOpenId = function (t, a, i, n) { + e.authentication.authenticate( + t, + a, + e.authentication.AUTHENTICATION_TYPE_GOOGLE_OPEN_ID, + null, + i, + null, + n, + ); + }), + (e.authentication.authenticateGoogleOpenId = function (t, a, i, n) { + e.authentication.authenticate( + t, + a, + e.authentication.AUTHENTICATION_TYPE_GOOGLE_OPEN_ID, + null, + i, + null, + n, + ); + }), + (e.authentication.authenticateUltra = function (t, a, i, n) { + e.authentication.authenticate( + t, + a, + e.authentication.AUTHENTICATION_TYPE_ULTRA, + null, + i, + null, + n, + ); + }), + (e.authentication.authenticateSteam = function (t, a, i, n) { + e.authentication.authenticate( + t, + a, + e.authentication.AUTHENTICATION_TYPE_STEAM, + null, + i, + null, + n, + ); + }), + (e.authentication.authenticateTwitter = function (t, a, i, n, s) { + e.authentication.authenticate( + t, + a + ":" + i, + e.authentication.AUTHENTICATION_TYPE_TWITTER, + null, + n, + null, + s, + ); + }), + (e.authentication.authenticateUniversal = function (t, a, i, n) { + e.authentication.authenticate( + t, + a, + e.authentication.AUTHENTICATION_TYPE_UNIVERSAL, + null, + i, + null, + n, + ); + }), + (e.authentication.authenticateAdvanced = function (t, a, i, n, s) { + e.authentication.authenticate( + a.externalId, + a.authenticationToken, + t, + a.authenticationSubType, + i, + n, + s, + ); + }), + (e.authentication.authenticateParse = function (t, a, i, n) { + e.authentication.authenticate( + t, + a, + e.authentication.AUTHENTICATION_TYPE_PARSE, + null, + i, + null, + n, + ); + }), + (e.authentication.resetEmailPassword = function (t, a) { + var i = a, + n = e.brainCloudManager.getAppId(), + s = { + service: e.SERVICE_AUTHENTICATION, + operation: e.authentication.OPERATION_RESET_EMAIL_PASSWORD, + data: { gameId: n, externalId: t }, + callerCallback: a, + callback: function (e) { + (e && e.status, i && i(e)); + }, + }; + e.brainCloudManager.sendRequest(s); + }), + (e.authentication.resetEmailPasswordAdvanced = function (t, a, i) { + var n = e.brainCloudManager.getAppId(), + s = { + service: e.SERVICE_AUTHENTICATION, + operation: + e.authentication.OPERATION_RESET_EMAIL_PASSWORD_ADVANCED, + data: { gameId: n, emailAddress: t, serviceParams: a }, + callback: i, + }; + e.brainCloudManager.sendRequest(s); + }), + (e.authentication.resetEmailPasswordWithExpiry = function ( + t, + a, + i, + ) { + var n = i, + s = e.brainCloudManager.getAppId(), + o = { + service: e.SERVICE_AUTHENTICATION, + operation: + e.authentication.OPERATION_RESET_EMAIL_PASSWORD_WITH_EXPIRY, + data: { gameId: s, externalId: t, tokenTtlInMinutes: a }, + callerCallback: i, + callback: function (e) { + (e && e.status, n && n(e)); + }, + }; + e.brainCloudManager.sendRequest(o); + }), + (e.authentication.resetEmailPasswordAdvancedWithExpiry = function ( + t, + a, + i, + n, + ) { + var s = e.brainCloudManager.getAppId(), + o = { + service: e.SERVICE_AUTHENTICATION, + operation: + e.authentication + .OPERATION_RESET_EMAIL_PASSWORD_ADVANCED_WITH_EXPIRY, + data: { + gameId: s, + emailAddress: t, + serviceParams: a, + tokenTtlInMinutes: i, + }, + callback: n, + }; + e.brainCloudManager.sendRequest(o); + }), + (e.authentication.resetUniversalIdPassword = function (t, a) { + var i = a, + n = e.brainCloudManager.getAppId(), + s = { + service: e.SERVICE_AUTHENTICATION, + operation: + e.authentication.OPERATION_RESET_UNIVERSAL_ID_PASSWORD, + data: { gameId: n, universalId: t }, + callerCallback: a, + callback: function (e) { + (e && e.status, i && i(e)); + }, + }; + e.brainCloudManager.sendRequest(s); + }), + (e.authentication.resetUniversalIdPasswordAdvanced = function ( + t, + a, + i, + ) { + var n = e.brainCloudManager.getAppId(), + s = { + service: e.SERVICE_AUTHENTICATION, + operation: + e.authentication + .OPERATION_RESET_UNIVERSAL_ID_PASSWORD_ADVANCED, + data: { gameId: n, universalId: t, serviceParams: a }, + callback: i, + }; + e.brainCloudManager.sendRequest(s); + }), + (e.authentication.resetUniversalIdPasswordWithExpiry = function ( + t, + a, + i, + ) { + var n = i, + s = e.brainCloudManager.getAppId(), + o = { + service: e.SERVICE_AUTHENTICATION, + operation: + e.authentication.OPERATION_RESET_UNIVERSAL_ID_PASSWORD, + data: { gameId: s, universalId: t, tokenTtlInMinutes: a }, + callerCallback: i, + callback: function (e) { + (e && e.status, n && n(e)); + }, + }; + e.brainCloudManager.sendRequest(o); + }), + (e.authentication.resetUniversalIdPasswordAdvancedWithExpiry = + function (t, a, i, n) { var s = e.brainCloudManager.getAppId(), o = { service: e.SERVICE_AUTHENTICATION, operation: e.authentication - .OPERATION_RESET_EMAIL_PASSWORD_ADVANCED_WITH_EXPIRY, + .OPERATION_RESET_UNIVERSAL_ID_PASSWORD_ADVANCED, data: { gameId: s, - emailAddress: t, + universalId: t, serviceParams: a, tokenTtlInMinutes: i, }, @@ -1183,8640 +1251,8572 @@ var version = "v1.17.2"; }; e.brainCloudManager.sendRequest(o); }), - (e.authentication.resetUniversalIdPassword = function (t, a) { - var i = a, - n = e.brainCloudManager.getAppId(), - s = { - service: e.SERVICE_AUTHENTICATION, - operation: - e.authentication.OPERATION_RESET_UNIVERSAL_ID_PASSWORD, - data: { gameId: n, universalId: t }, - callerCallback: a, - callback: function (e) { - (e && e.status, i && i(e)); - }, - }; - e.brainCloudManager.sendRequest(s); - }), - (e.authentication.resetUniversalIdPasswordAdvanced = function ( + (e.authentication.authenticateHandoff = function (t, a, i) { + e.authentication.authenticate( t, a, + e.authentication.AUTHENTICATION_TYPE_HANDOFF, + null, + false, + null, i, - ) { - var n = e.brainCloudManager.getAppId(), - s = { - service: e.SERVICE_AUTHENTICATION, - operation: - e.authentication - .OPERATION_RESET_UNIVERSAL_ID_PASSWORD_ADVANCED, - data: { gameId: n, universalId: t, serviceParams: a }, - callback: i, - }; - e.brainCloudManager.sendRequest(s); - }), - (e.authentication.resetUniversalIdPasswordWithExpiry = function ( + ); + }), + (e.authentication.authenticateSettopHandoff = function (t, a) { + e.authentication.authenticate( t, + "", + e.authentication.AUTHENTICATION_TYPE_SETTOP_HANDOFF, + null, + false, + null, a, - i, - ) { - var n = i, - s = e.brainCloudManager.getAppId(), - o = { - service: e.SERVICE_AUTHENTICATION, - operation: - e.authentication.OPERATION_RESET_UNIVERSAL_ID_PASSWORD, - data: { gameId: s, universalId: t, tokenTtlInMinutes: a }, - callerCallback: i, - callback: function (e) { - (e && e.status, n && n(e)); - }, - }; - e.brainCloudManager.sendRequest(o); - }), - (e.authentication.resetUniversalIdPasswordAdvancedWithExpiry = - function (t, a, i, n) { - var s = e.brainCloudManager.getAppId(), - o = { - service: e.SERVICE_AUTHENTICATION, - operation: - e.authentication - .OPERATION_RESET_UNIVERSAL_ID_PASSWORD_ADVANCED, - data: { - gameId: s, - universalId: t, - serviceParams: a, - tokenTtlInMinutes: i, - }, - callback: n, - }; - e.brainCloudManager.sendRequest(o); - }), - (e.authentication.authenticateHandoff = function (t, a, i) { - e.authentication.authenticate( - t, - a, - e.authentication.AUTHENTICATION_TYPE_HANDOFF, - null, - false, - null, - i, - ); - }), - (e.authentication.authenticateSettopHandoff = function (t, a) { - e.authentication.authenticate( - t, - "", - e.authentication.AUTHENTICATION_TYPE_SETTOP_HANDOFF, - null, - false, - null, - a, - ); - }), - (e.authentication.authenticate = function (t, a, i, n, s, o, r) { - var l = r, - c = window.navigator.userLanguage || window.navigator.language; - c = c.split("-"); - var d = null == e.languageCode ? c[0] : e.languageCode, - u = null == e.countryCode ? c[1] : e.countryCode, - h = -new Date().getTimezoneOffset() / 60, - p = e.brainCloudManager.getAppId(), - g = e.brainCloudManager.getAppVersion(); - e.brainCloudManager.setSessionId(""); - var m = { - gameId: p, - externalId: t, - releasePlatform: "WEB", - gameVersion: g, - clientLibVersion: e.version || e.brainCloudClient.version, - authenticationToken: a, - authenticationType: i, - forceCreate: s, - anonymousId: e.authentication.anonymousId, - profileId: e.authentication.profileId, - timeZoneOffset: h, - languageCode: d, - countryCode: u, - clientLib: "js", - }; - (n && (m.externalAuthName = n), o && (m.extraJson = o)); - var f = { - service: e.SERVICE_AUTHENTICATION, - operation: e.authentication.OPERATION_AUTHENTICATE, - data: m, - callback: function (t) { - (t && - 200 == t.status && - (e.brainCloudManager.setABTestingId(t.data.abTestingId), + ); + }), + (e.authentication.authenticate = function (t, a, i, n, s, o, r) { + var l = r, + c = window.navigator.userLanguage || window.navigator.language; + c = c.split("-"); + var d = null == e.languageCode ? c[0] : e.languageCode, + u = null == e.countryCode ? c[1] : e.countryCode, + h = -new Date().getTimezoneOffset() / 60, + p = e.brainCloudManager.getAppId(), + g = e.brainCloudManager.getAppVersion(); + e.brainCloudManager.setSessionId(""); + var m = { + gameId: p, + externalId: t, + releasePlatform: "WEB", + gameVersion: g, + clientLibVersion: e.version || e.brainCloudClient.version, + authenticationToken: a, + authenticationType: i, + forceCreate: s, + anonymousId: e.authentication.anonymousId, + profileId: e.authentication.profileId, + timeZoneOffset: h, + languageCode: d, + countryCode: u, + clientLib: "js", + }; + (n && (m.externalAuthName = n), o && (m.extraJson = o)); + var f = { + service: e.SERVICE_AUTHENTICATION, + operation: e.authentication.OPERATION_AUTHENTICATE, + data: m, + callback: function (t) { + (t && + 200 == t.status && + (e.brainCloudManager.setABTestingId(t.data.abTestingId), e.brainCloudManager.setSessionId(t.data.sessionId), (e.authentication.profileId = t.data.profileId)), - l && l(t)); - }, - }; - e.brainCloudManager.sendRequest(f); - }), - (e.invokeRawAPI = function (t, a, i, n) { - var s = false; - t == e.SERVICE_AUTHENTICATION && - a == e.authentication.OPERATION_AUTHENTICATE && - ((s = true), e.setSessionId("")); - var o = { - service: t, - operation: a, - data: i, - callback: function (t) { - (s && - t && - 200 == t.status && - (e.setABTestingId(t.data.abTestingId), + l && l(t)); + }, + }; + e.brainCloudManager.sendRequest(f); + }), + (e.invokeRawAPI = function (t, a, i, n) { + var s = false; + t == e.SERVICE_AUTHENTICATION && + a == e.authentication.OPERATION_AUTHENTICATE && + ((s = true), e.setSessionId("")); + var o = { + service: t, + operation: a, + data: i, + callback: function (t) { + (s && + t && + 200 == t.status && + (e.setABTestingId(t.data.abTestingId), e.setUserId(t.data.userId), e.setSessionId(t.data._sessionId)), - n && n(t)); - }, - }; - e.brainCloudManager.sendRequest(o); - })); - } - function d() { - var e = this; - ((e.chat = {}), - (e.SERVICE_CHAT = "chat"), - (e.chat.OPERATION_CHANNEL_CONNECT = "CHANNEL_CONNECT"), - (e.chat.OPERATION_CHANNEL_DISCONNECT = "CHANNEL_DISCONNECT"), - (e.chat.OPERATION_DELETE_CHAT_MESSAGE = "DELETE_CHAT_MESSAGE"), - (e.chat.OPERATION_GET_CHANNEL_ID = "GET_CHANNEL_ID"), - (e.chat.OPERATION_GET_CHANNEL_INFO = "GET_CHANNEL_INFO"), - (e.chat.OPERATION_GET_CHAT_MESSAGE = "GET_CHAT_MESSAGE"), - (e.chat.OPERATION_GET_RECENT_CHAT_MESSAGES = - "GET_RECENT_CHAT_MESSAGES"), - (e.chat.OPERATION_GET_SUBSCRIBED_CHANNELS = - "GET_SUBSCRIBED_CHANNELS"), - (e.chat.OPERATION_POST_CHAT_MESSAGE = "POST_CHAT_MESSAGE"), - (e.chat.OPERATION_UPDATE_CHAT_MESSAGE = "UPDATE_CHAT_MESSAGE"), - (e.chat.channelConnect = function (t, a, i) { - var n = { channelId: t, maxReturn: a }; + n && n(t)); + }, + }; + e.brainCloudManager.sendRequest(o); + })); + } + function d() { + var e = this; + ((e.chat = {}), + (e.SERVICE_CHAT = "chat"), + (e.chat.OPERATION_CHANNEL_CONNECT = "CHANNEL_CONNECT"), + (e.chat.OPERATION_CHANNEL_DISCONNECT = "CHANNEL_DISCONNECT"), + (e.chat.OPERATION_DELETE_CHAT_MESSAGE = "DELETE_CHAT_MESSAGE"), + (e.chat.OPERATION_GET_CHANNEL_ID = "GET_CHANNEL_ID"), + (e.chat.OPERATION_GET_CHANNEL_INFO = "GET_CHANNEL_INFO"), + (e.chat.OPERATION_GET_CHAT_MESSAGE = "GET_CHAT_MESSAGE"), + (e.chat.OPERATION_GET_RECENT_CHAT_MESSAGES = + "GET_RECENT_CHAT_MESSAGES"), + (e.chat.OPERATION_GET_SUBSCRIBED_CHANNELS = + "GET_SUBSCRIBED_CHANNELS"), + (e.chat.OPERATION_POST_CHAT_MESSAGE = "POST_CHAT_MESSAGE"), + (e.chat.OPERATION_UPDATE_CHAT_MESSAGE = "UPDATE_CHAT_MESSAGE"), + (e.chat.channelConnect = function (t, a, i) { + var n = { channelId: t, maxReturn: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_CHAT, + operation: e.chat.OPERATION_CHANNEL_CONNECT, + data: n, + callback: i, + }); + }), + (e.chat.channelDisconnect = function (t, a) { + var i = { channelId: t }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_CHAT, + operation: e.chat.OPERATION_CHANNEL_DISCONNECT, + data: i, + callback: a, + }); + }), + (e.chat.deleteChatMessage = function (t, a, i, n) { + var s = { channelId: t, msgId: a, version: i }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_CHAT, + operation: e.chat.OPERATION_DELETE_CHAT_MESSAGE, + data: s, + callback: n, + }); + }), + (e.chat.getChannelId = function (t, a, i) { + var n = { channelType: t, channelSubId: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_CHAT, + operation: e.chat.OPERATION_GET_CHANNEL_ID, + data: n, + callback: i, + }); + }), + (e.chat.getChannelInfo = function (t, a) { + var i = { channelId: t }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_CHAT, + operation: e.chat.OPERATION_GET_CHANNEL_INFO, + data: i, + callback: a, + }); + }), + (e.chat.getChatMessage = function (t, a, i) { + var n = { channelId: t, msgId: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_CHAT, + operation: e.chat.OPERATION_GET_CHAT_MESSAGE, + data: n, + callback: i, + }); + }), + (e.chat.getRecentChatMessages = function (t, a, i) { + var n = { channelId: t, maxReturn: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_CHAT, + operation: e.chat.OPERATION_GET_RECENT_CHAT_MESSAGES, + data: n, + callback: i, + }); + }), + (e.chat.getSubscribedChannels = function (t, a) { + var i = { channelType: t }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_CHAT, + operation: e.chat.OPERATION_GET_SUBSCRIBED_CHANNELS, + data: i, + callback: a, + }); + }), + (e.chat.postChatMessage = function (t, a, i, n) { + var s = { channelId: t, content: a, recordInHistory: i }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_CHAT, + operation: e.chat.OPERATION_POST_CHAT_MESSAGE, + data: s, + callback: n, + }); + }), + (e.chat.postChatMessageSimple = function (t, a, i, n) { + var s = { + channelId: t, + content: { text: a }, + recordInHistory: i, + }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_CHAT, + operation: e.chat.OPERATION_POST_CHAT_MESSAGE, + data: s, + callback: n, + }); + }), + (e.chat.updateChatMessage = function (t, a, i, n, s) { + var o = { channelId: t, msgId: a, version: i, content: n }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_CHAT, + operation: e.chat.OPERATION_UPDATE_CHAT_MESSAGE, + data: o, + callback: s, + }); + })); + } + function u() { + var e = this; + ((e.customEntity = {}), + (e.SERVICE_CUSTOM_ENTITY = "customEntity"), + (e.customEntity.OPERATION_CREATE = "CREATE_ENTITY"), + (e.customEntity.OPERATION_GET_COUNT = "GET_COUNT"), + (e.customEntity.OPERATION_GET_PAGE = "GET_PAGE"), + (e.customEntity.OPERATION_GET_RANDOM_ENTITIES_MATCHING = + "GET_RANDOM_ENTITIES_MATCHING"), + (e.customEntity.OPERATION_GET_PAGE_OFFSET = "GET_PAGE_BY_OFFSET"), + (e.customEntity.OPERATION_GET_ENTITY_PAGE = "GET_ENTITY_PAGE"), + (e.customEntity.OPERATION_GET_ENTITY_PAGE_OFFSET = + "GET_ENTITY_PAGE_OFFSET"), + (e.customEntity.OPERATION_READ_ENTITY = "READ_ENTITY"), + (e.customEntity.OPERATION_UPDATE_ENTITY = "UPDATE_ENTITY"), + (e.customEntity.OPERATION_UPDATE_ENTITY_FIELDS = + "UPDATE_ENTITY_FIELDS"), + (e.customEntity.OPERATION_UPDATE_ENTITY_FIELDS_SHARDED = + "UPDATE_ENTITY_FIELDS_SHARDED"), + (e.customEntity.OPERATION_DELETE_ENTITY = "DELETE_ENTITY"), + (e.customEntity.OPERATION_DELETE_ENTITIES = "DELETE_ENTITIES"), + (e.customEntity.OPERATION_DELETE_SINGLETON = "DELETE_SINGLETON"), + (e.customEntity.OPERATION_READ_SINGLETON = "READ_SINGLETON"), + (e.customEntity.OPERATION_UPDATE_SINGLETON = "UPDATE_SINGLETON"), + (e.customEntity.OPERATION_UPDATE_SINGLETON_FIELDS = + "UPDATE_SINGLETON_FIELDS"), + (e.customEntity.createEntity = function (t, a, i, n, s, o) { + var r = { entityType: t, dataJson: a, timeToLive: n, isOwned: s }; + (i && (r.acl = i), e.brainCloudManager.sendRequest({ - service: e.SERVICE_CHAT, - operation: e.chat.OPERATION_CHANNEL_CONNECT, - data: n, - callback: i, - }); - }), - (e.chat.channelDisconnect = function (t, a) { - var i = { channelId: t }; + service: e.SERVICE_CUSTOM_ENTITY, + operation: e.customEntity.OPERATION_CREATE, + data: r, + callback: o, + })); + }), + (e.customEntity.getCount = function (t, a, i) { + var n = { entityType: t, whereJson: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_CUSTOM_ENTITY, + operation: e.customEntity.OPERATION_GET_COUNT, + data: n, + callback: i, + }); + }), + (e.customEntity.getRandomEntitiesMatching = function (t, a, i, n) { + var s = { entityType: t, whereJson: a, maxReturn: i }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_CUSTOM_ENTITY, + operation: + e.customEntity.OPERATION_GET_RANDOM_ENTITIES_MATCHING, + data: s, + callback: n, + }); + }), + (e.customEntity.getPage = function (t, a, i, n, s, o) { + var r = { entityType: t, rowsPerPage: a, doCount: s }; + (i && (r.searchJson = i), + n && (r.sortJson = n), e.brainCloudManager.sendRequest({ - service: e.SERVICE_CHAT, - operation: e.chat.OPERATION_CHANNEL_DISCONNECT, - data: i, - callback: a, - }); - }), - (e.chat.deleteChatMessage = function (t, a, i, n) { - var s = { channelId: t, msgId: a, version: i }; + service: e.SERVICE_CUSTOM_ENTITY, + operation: e.customEntity.OPERATION_GET_PAGE, + data: r, + callback: o, + })); + }), + (e.customEntity.getEntityPage = function (t, a, i) { + var n = { entityType: t, context: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_CUSTOM_ENTITY, + operation: e.customEntity.OPERATION_GET_ENTITY_PAGE, + data: n, + callback: i, + }); + }), + (e.customEntity.getPageOffset = function (t, a, i, n) { + var s = { entityType: t, context: a, pageOffset: i }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_CUSTOM_ENTITY, + operation: e.customEntity.OPERATION_GET_PAGE_OFFSET, + data: s, + callback: n, + }); + }), + (e.customEntity.getEntityPageOffset = function (t, a, i, n) { + var s = { entityType: t, context: a, pageOffset: i }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_CUSTOM_ENTITY, + operation: e.customEntity.OPERATION_GET_ENTITY_PAGE_OFFSET, + data: s, + callback: n, + }); + }), + (e.customEntity.readEntity = function (t, a, i) { + var n = { entityType: t, entityId: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_CUSTOM_ENTITY, + operation: e.customEntity.OPERATION_READ_ENTITY, + data: n, + callback: i, + }); + }), + (e.customEntity.updateEntity = function (t, a, i, n, s, o, r) { + var l = { entityType: t, entityId: a, version: i, timeToLive: o }; + (n && (l.dataJson = n), + s && (l.acl = s), e.brainCloudManager.sendRequest({ - service: e.SERVICE_CHAT, - operation: e.chat.OPERATION_DELETE_CHAT_MESSAGE, - data: s, - callback: n, - }); - }), - (e.chat.getChannelId = function (t, a, i) { - var n = { channelType: t, channelSubId: a }; + service: e.SERVICE_CUSTOM_ENTITY, + operation: e.customEntity.OPERATION_UPDATE_ENTITY, + data: l, + callback: r, + })); + }), + (e.customEntity.updateEntityFields = function (t, a, i, n, s) { + var o = { entityType: t, entityId: a, version: i }; + (n && (o.fieldsJson = n), e.brainCloudManager.sendRequest({ - service: e.SERVICE_CHAT, - operation: e.chat.OPERATION_GET_CHANNEL_ID, - data: n, - callback: i, - }); - }), - (e.chat.getChannelInfo = function (t, a) { - var i = { channelId: t }; + service: e.SERVICE_CUSTOM_ENTITY, + operation: e.customEntity.OPERATION_UPDATE_ENTITY_FIELDS, + data: o, + callback: s, + })); + }), + (e.customEntity.updateEntityFieldsSharded = function ( + t, + a, + i, + n, + s, + o, + ) { + var r = { entityType: t, entityId: a, version: i }; + (n && (r.fieldsJson = n), + s && (r.shardKeyJson = s), e.brainCloudManager.sendRequest({ - service: e.SERVICE_CHAT, - operation: e.chat.OPERATION_GET_CHANNEL_INFO, - data: i, - callback: a, - }); - }), - (e.chat.getChatMessage = function (t, a, i) { - var n = { channelId: t, msgId: a }; + service: e.SERVICE_CUSTOM_ENTITY, + operation: + e.customEntity.OPERATION_UPDATE_ENTITY_FIELDS_SHARDED, + data: r, + callback: o, + })); + }), + (e.customEntity.deleteEntities = function (t, a, i) { + var n = { entityType: t, deleteCriteria: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_CUSTOM_ENTITY, + operation: e.customEntity.OPERATION_DELETE_ENTITIES, + data: n, + callback: i, + }); + }), + (e.customEntity.deleteSingleton = function (t, a, i) { + var n = { entityType: t, version: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_CUSTOM_ENTITY, + operation: e.customEntity.OPERATION_DELETE_SINGLETON, + data: n, + callback: i, + }); + }), + (e.customEntity.readSingleton = function (t, a) { + var i = { entityType: t }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_CUSTOM_ENTITY, + operation: e.customEntity.OPERATION_READ_SINGLETON, + data: i, + callback: a, + }); + }), + (e.customEntity.updateSingleton = function (t, a, i, n, s, o) { + var r = { + entityType: t, + version: a, + dataJson: i, + acl: n, + timeToLive: s, + }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_CUSTOM_ENTITY, + operation: e.customEntity.OPERATION_UPDATE_SINGLETON, + data: r, + callback: o, + }); + }), + (e.customEntity.updateSingletonFields = function (t, a, i, n) { + var s = { entityType: t, version: a, fieldsJson: i }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_CUSTOM_ENTITY, + operation: e.customEntity.OPERATION_UPDATE_SINGLETON_FIELDS, + data: s, + callback: n, + }); + }), + (e.customEntity.incrementData = function (t, a, i, n) { + var s = { entityType: t, entityId: a, fieldsJson: i }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_CUSTOM_ENTITY, + operation: e.customEntity.OPERATION_INCREMENT_DATA, + data: s, + callback: n, + }); + }), + (e.customEntity.deleteEntity = function (t, a, i, n) { + var s = { entityType: t, entityId: a, version: i }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_CUSTOM_ENTITY, + operation: e.customEntity.OPERATION_DELETE_ENTITY, + data: s, + callback: n, + }); + })); + } + function h() { + var e = this; + ((e.dataStream = {}), + (e.SERVICE_DATA_STREAM = "dataStream"), + (e.dataStream.OPERATION_CUSTOM_PAGE_EVENT = "CUSTOM_PAGE_EVENT"), + (e.dataStream.OPERATION_CUSTOM_SCREEN_EVENT = + "CUSTOM_SCREEN_EVENT"), + (e.dataStream.OPERATION_CUSTOM_TRACK_EVENT = "CUSTOM_TRACK_EVENT"), + (e.dataStream.OPERATION_SUBMIT_CRASH_REPORT = "SEND_CRASH_REPORT"), + (e.dataStream.customPageEvent = function (t, a, i) { + var n = { eventName: t }; + (a && (n.eventProperties = a), e.brainCloudManager.sendRequest({ - service: e.SERVICE_CHAT, - operation: e.chat.OPERATION_GET_CHAT_MESSAGE, + service: e.SERVICE_DATA_STREAM, + operation: e.dataStream.OPERATION_CUSTOM_PAGE_EVENT, data: n, callback: i, - }); - }), - (e.chat.getRecentChatMessages = function (t, a, i) { - var n = { channelId: t, maxReturn: a }; + })); + }), + (e.dataStream.customScreenEvent = function (t, a, i) { + var n = { eventName: t }; + (a && (n.eventProperties = a), e.brainCloudManager.sendRequest({ - service: e.SERVICE_CHAT, - operation: e.chat.OPERATION_GET_RECENT_CHAT_MESSAGES, + service: e.SERVICE_DATA_STREAM, + operation: e.dataStream.OPERATION_CUSTOM_SCREEN_EVENT, data: n, callback: i, - }); - }), - (e.chat.getSubscribedChannels = function (t, a) { - var i = { channelType: t }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_CHAT, - operation: e.chat.OPERATION_GET_SUBSCRIBED_CHANNELS, - data: i, - callback: a, - }); - }), - (e.chat.postChatMessage = function (t, a, i, n) { - var s = { channelId: t, content: a, recordInHistory: i }; + })); + }), + (e.dataStream.customTrackEvent = function (t, a, i) { + var n = { eventName: t }; + (a && (n.eventProperties = a), e.brainCloudManager.sendRequest({ - service: e.SERVICE_CHAT, - operation: e.chat.OPERATION_POST_CHAT_MESSAGE, - data: s, - callback: n, - }); - }), - (e.chat.postChatMessageSimple = function (t, a, i, n) { - var s = { - channelId: t, - content: { text: a }, - recordInHistory: i, - }; + service: e.SERVICE_DATA_STREAM, + operation: e.dataStream.OPERATION_CUSTOM_TRACK_EVENT, + data: n, + callback: i, + })); + }), + (e.dataStream.submitCrashReport = function ( + t, + a, + i, + n, + s, + o, + r, + l, + c, + ) { + var d = { + crashType: t, + errorMsg: a, + crashJson: i, + crashLog: n, + userName: s, + userEmail: o, + userNotes: r, + userSubmitted: l, + }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_DATA_STREAM, + operation: e.dataStream.OPERATION_SUBMIT_CRASH_REPORT, + data: d, + callback: c, + }); + })); + } + function p() { + var e = this; + ((e.entity = {}), + (e.SERVICE_ENTITY = "entity"), + (e.entity.OPERATION_READ = "READ"), + (e.entity.OPERATION_CREATE = "CREATE"), + (e.entity.OPERATION_READ_BY_TYPE = "READ_BY_TYPE"), + (e.entity.OPERATION_READ_SHARED = "READ_SHARED"), + (e.entity.OPERATION_READ_SHARED_ENTITY = "READ_SHARED_ENTITY"), + (e.entity.OPERATION_READ_SINGLETON = "READ_SINGLETON"), + (e.entity.OPERATION_UPDATE = "UPDATE"), + (e.entity.OPERATION_UPDATE_SHARED = "UPDATE_SHARED"), + (e.entity.OPERATION_UPDATE_SINGLETON = "UPDATE_SINGLETON"), + (e.entity.OPERATION_UPDATE_PARTIAL = "UPDATE_PARTIAL"), + (e.entity.OPERATION_DELETE = "DELETE"), + (e.entity.OPERATION_DELETE_SINGLETON = "DELETE_SINGLETON"), + (e.entity.OPERATION_GET_LIST = "GET_LIST"), + (e.entity.OPERATION_GET_LIST_COUNT = "GET_LIST_COUNT"), + (e.entity.OPERATION_GET_PAGE = "GET_PAGE"), + (e.entity.OPERATION_GET_PAGE_BY_OFFSET = "GET_PAGE_BY_OFFSET"), + (e.entity.OPERATION_READ_SHARED_ENTITIES_LIST = + "READ_SHARED_ENTITIES_LIST"), + (e.entity.OPERATION_INCREMENT_USER_ENTITY_DATA = + "INCREMENT_USER_ENTITY_DATA"), + (e.entity.OPERATION_INCREMENT_SHARED_USER_ENTITY_DATA = + "INCREMENT_SHARED_USER_ENTITY_DATA"), + (e.entity.createEntity = function (t, a, i, n) { + var s = { entityType: t, data: a }; + (i && (s.acl = i), e.brainCloudManager.sendRequest({ - service: e.SERVICE_CHAT, - operation: e.chat.OPERATION_POST_CHAT_MESSAGE, + service: e.SERVICE_ENTITY, + operation: e.entity.OPERATION_CREATE, data: s, callback: n, - }); - }), - (e.chat.updateChatMessage = function (t, a, i, n, s) { - var o = { channelId: t, msgId: a, version: i, content: n }; + })); + }), + (e.entity.getEntity = function (t, a) { + var i = { entityId: t }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_ENTITY, + operation: e.entity.OPERATION_READ, + data: i, + callback: a, + }); + }), + (e.entity.getEntitiesByType = function (t, a) { + var i = { entityType: t }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_ENTITY, + operation: e.entity.OPERATION_READ_BY_TYPE, + data: i, + callback: a, + }); + }), + (e.entity.getSharedEntityForProfileId = function (t, a, i) { + var n = { targetPlayerId: t, entityId: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_ENTITY, + operation: e.entity.OPERATION_READ_SHARED_ENTITY, + data: n, + callback: i, + }); + }), + (e.entity.getSharedEntitiesForProfileId = function (t, a) { + var i = { targetPlayerId: t }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_ENTITY, + operation: e.entity.OPERATION_READ_SHARED, + data: i, + callback: a, + }); + }), + (e.entity.getSharedEntitiesListForProfileId = function ( + t, + a, + i, + n, + s, + ) { + var o = { targetPlayerId: t, maxReturn: n }; + (a && (o.where = a), + i && (o.orderBy = i), e.brainCloudManager.sendRequest({ - service: e.SERVICE_CHAT, - operation: e.chat.OPERATION_UPDATE_CHAT_MESSAGE, + service: e.SERVICE_ENTITY, + operation: e.entity.OPERATION_READ_SHARED_ENTITIES_LIST, data: o, callback: s, - }); - })); - } - function u() { - var e = this; - ((e.customEntity = {}), - (e.SERVICE_CUSTOM_ENTITY = "customEntity"), - (e.customEntity.OPERATION_CREATE = "CREATE_ENTITY"), - (e.customEntity.OPERATION_GET_COUNT = "GET_COUNT"), - (e.customEntity.OPERATION_GET_PAGE = "GET_PAGE"), - (e.customEntity.OPERATION_GET_RANDOM_ENTITIES_MATCHING = - "GET_RANDOM_ENTITIES_MATCHING"), - (e.customEntity.OPERATION_GET_PAGE_OFFSET = "GET_PAGE_BY_OFFSET"), - (e.customEntity.OPERATION_GET_ENTITY_PAGE = "GET_ENTITY_PAGE"), - (e.customEntity.OPERATION_GET_ENTITY_PAGE_OFFSET = - "GET_ENTITY_PAGE_OFFSET"), - (e.customEntity.OPERATION_READ_ENTITY = "READ_ENTITY"), - (e.customEntity.OPERATION_UPDATE_ENTITY = "UPDATE_ENTITY"), - (e.customEntity.OPERATION_UPDATE_ENTITY_FIELDS = - "UPDATE_ENTITY_FIELDS"), - (e.customEntity.OPERATION_UPDATE_ENTITY_FIELDS_SHARDED = - "UPDATE_ENTITY_FIELDS_SHARDED"), - (e.customEntity.OPERATION_DELETE_ENTITY = "DELETE_ENTITY"), - (e.customEntity.OPERATION_DELETE_ENTITIES = "DELETE_ENTITIES"), - (e.customEntity.OPERATION_DELETE_SINGLETON = "DELETE_SINGLETON"), - (e.customEntity.OPERATION_READ_SINGLETON = "READ_SINGLETON"), - (e.customEntity.OPERATION_UPDATE_SINGLETON = "UPDATE_SINGLETON"), - (e.customEntity.OPERATION_UPDATE_SINGLETON_FIELDS = - "UPDATE_SINGLETON_FIELDS"), - (e.customEntity.createEntity = function (t, a, i, n, s, o) { - var r = { entityType: t, dataJson: a, timeToLive: n, isOwned: s }; - (i && (r.acl = i), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_CUSTOM_ENTITY, - operation: e.customEntity.OPERATION_CREATE, - data: r, - callback: o, - })); - }), - (e.customEntity.getCount = function (t, a, i) { - var n = { entityType: t, whereJson: a }; + })); + }), + (e.entity.updateEntity = function (t, a, i, n, s, o) { + var r = { entityId: t, data: i, version: s }; + (a && (r.entityType = a), + n && (r.acl = n), e.brainCloudManager.sendRequest({ - service: e.SERVICE_CUSTOM_ENTITY, - operation: e.customEntity.OPERATION_GET_COUNT, - data: n, - callback: i, - }); - }), - (e.customEntity.getRandomEntitiesMatching = function (t, a, i, n) { - var s = { entityType: t, whereJson: a, maxReturn: i }; + service: e.SERVICE_ENTITY, + operation: e.entity.OPERATION_UPDATE, + data: r, + callback: o, + })); + }), + (e.entity.updateSharedEntity = function (t, a, i, n, s, o) { + var r = { targetPlayerId: a, entityId: t, data: n, version: s }; + (i && (r.entityType = i), e.brainCloudManager.sendRequest({ - service: e.SERVICE_CUSTOM_ENTITY, - operation: - e.customEntity.OPERATION_GET_RANDOM_ENTITIES_MATCHING, - data: s, - callback: n, - }); - }), - (e.customEntity.getPage = function (t, a, i, n, s, o) { - var r = { entityType: t, rowsPerPage: a, doCount: s }; - (i && (r.searchJson = i), - n && (r.sortJson = n), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_CUSTOM_ENTITY, - operation: e.customEntity.OPERATION_GET_PAGE, - data: r, - callback: o, - })); - }), - (e.customEntity.getEntityPage = function (t, a, i) { - var n = { entityType: t, context: a }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_CUSTOM_ENTITY, - operation: e.customEntity.OPERATION_GET_ENTITY_PAGE, - data: n, - callback: i, - }); - }), - (e.customEntity.getPageOffset = function (t, a, i, n) { - var s = { entityType: t, context: a, pageOffset: i }; + service: e.SERVICE_ENTITY, + operation: e.entity.OPERATION_UPDATE_SHARED, + data: r, + callback: o, + })); + }), + (e.entity.updateSingleton = function (t, a, i, n, s) { + var o = { entityType: t, data: a, version: n }; + (i && (o.acl = i), e.brainCloudManager.sendRequest({ - service: e.SERVICE_CUSTOM_ENTITY, - operation: e.customEntity.OPERATION_GET_PAGE_OFFSET, - data: s, - callback: n, - }); - }), - (e.customEntity.getEntityPageOffset = function (t, a, i, n) { - var s = { entityType: t, context: a, pageOffset: i }; + service: e.SERVICE_ENTITY, + operation: e.entity.OPERATION_UPDATE_SINGLETON, + data: o, + callback: s, + })); + }), + (e.entity.getSingleton = function (t, a) { + var i = { entityType: t }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_ENTITY, + operation: e.entity.OPERATION_READ_SINGLETON, + data: i, + callback: a, + }); + }), + (e.entity.deleteEntity = function (t, a, i) { + var n = { entityId: t, version: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_ENTITY, + operation: e.entity.OPERATION_DELETE, + data: n, + callback: i, + }); + }), + (e.entity.deleteSingleton = function (t, a, i) { + var n = { entityType: t, version: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_ENTITY, + operation: e.entity.OPERATION_DELETE_SINGLETON, + data: n, + callback: i, + }); + }), + (e.entity.getList = function (t, a, i, n) { + var s = { where: t, maxReturn: i }; + (a && (s.orderBy = a), e.brainCloudManager.sendRequest({ - service: e.SERVICE_CUSTOM_ENTITY, - operation: e.customEntity.OPERATION_GET_ENTITY_PAGE_OFFSET, + service: e.SERVICE_ENTITY, + operation: e.entity.OPERATION_GET_LIST, data: s, callback: n, - }); - }), - (e.customEntity.readEntity = function (t, a, i) { - var n = { entityType: t, entityId: a }; + })); + }), + (e.entity.getListCount = function (t, a) { + var i = { where: t }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_ENTITY, + operation: e.entity.OPERATION_GET_LIST_COUNT, + data: i, + callback: a, + }); + }), + (e.entity.getPage = function (t, a) { + var i = { context: t }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_ENTITY, + operation: e.entity.OPERATION_GET_PAGE, + data: i, + callback: a, + }); + }), + (e.entity.getPageOffset = function (t, a, i) { + var n = { context: t, pageOffset: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_ENTITY, + operation: e.entity.OPERATION_GET_PAGE_BY_OFFSET, + data: n, + callback: i, + }); + }), + (e.entity.incrementUserEntityData = function (t, a, i) { + var n = { entityId: t, data: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_ENTITY, + operation: e.entity.OPERATION_INCREMENT_USER_ENTITY_DATA, + data: n, + callback: i, + }); + }), + (e.entity.incrementSharedUserEntityData = function (t, a, i, n) { + var s = { entityId: t, targetPlayerId: a, data: i }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_ENTITY, + operation: e.entity.OPERATION_INCREMENT_SHARED_USER_ENTITY_DATA, + data: s, + callback: n, + }); + })); + } + function g() { + var e = this; + ((e.event = {}), + (e.SERVICE_EVENT = "event"), + (e.event.OPERATION_SEND = "SEND"), + (e.event.OPERATION_UPDATE_EVENT_DATA = "UPDATE_EVENT_DATA"), + (e.event.OPERATION_DELETE_INCOMING = "DELETE_INCOMING"), + (e.event.OPERATION_DELETE_SENT = "DELETE_SENT"), + (e.event.OPERATION_GET_EVENTS = "GET_EVENTS"), + (e.event.OPERATION_DELETE_INCOMING_EVENTS = + "DELETE_INCOMING_EVENTS"), + (e.event.OPERATION_DELETE_INCOMING_EVENTS_OLDER_THAN = + "DELETE_INCOMING_EVENTS_OLDER_THAN"), + (e.event.OPERATION_DELETE_INCOMING_EVENTS_BY_TYPE_OLDER_THAN = + "DELETE_INCOMING_EVENTS_BY_TYPE_OLDER_THAN"), + (e.event.sendEvent = function (t, a, i, n) { + var s = { toId: t, eventType: a, eventData: i }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_EVENT, + operation: e.event.OPERATION_SEND, + data: s, + callback: n, + }); + }), + (e.event.updateIncomingEventData = function (t, a, i) { + var n = { evId: t, eventData: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_EVENT, + operation: e.event.OPERATION_UPDATE_EVENT_DATA, + data: n, + callback: i, + }); + }), + (e.event.deleteIncomingEvent = function (t, a) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_EVENT, + operation: e.event.OPERATION_DELETE_INCOMING, + data: { evId: t }, + callback: a, + }); + }), + (e.event.getEvents = function (t) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_EVENT, + operation: e.event.OPERATION_GET_EVENTS, + data: null, + callback: t, + }); + }), + (e.event.deleteIncomingEvents = function (t, a) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_EVENT, + operation: e.event.OPERATION_DELETE_INCOMING_EVENTS, + data: { evIds: t }, + callback: a, + }); + }), + (e.event.DeleteIncomingEventsByTypeOlderThan = function (t, a, i) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_EVENT, + operation: e.event.OPERATION_DELETE_INCOMING_EVENTS_OLDER_THAN, + data: { eventType: t, dateMillis: a }, + callback: i, + }); + }), + (e.event.deleteIncomingEventsOlderThan = function (t, a) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_EVENT, + operation: e.event.OPERATION_DELETE_INCOMING_EVENTS_OLDER_THAN, + data: { dateMillis: t }, + callback: a, + }); + })); + } + function m() { + var e = this; + ((e.file = {}), + (e.SERVICE_FILE = "file"), + (e.file.OPERATION_PREPARE_USER_UPLOAD = "PREPARE_USER_UPLOAD"), + (e.file.OPERATION_LIST_USER_FILES = "LIST_USER_FILES"), + (e.file.OPERATION_DELETE_USER_FILES = "DELETE_USER_FILES"), + (e.file.OPERATION_GET_CDN_URL = "GET_CDN_URL"), + (e.file.prepareFileUpload = function (t, a, i, n, s, o) { + e.file.prepareUserUpload(t, a, i, n, s, o); + }), + (e.file.prepareUserUpload = function (t, a, i, n, s, o) { + var r = { + cloudPath: t, + cloudFilename: a, + shareable: i, + replaceIfExists: n, + fileSize: s, + }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_FILE, + operation: e.file.OPERATION_PREPARE_USER_UPLOAD, + data: r, + callback: o, + }); + }), + (e.file.uploadFile = function (t, a, i, n) { + return; + var s = e.brainCloudManager.getFileUploadUrl(), + o = new FormData(), + r = a.size; + (t.open("POST", s, true), + o.append("sessionId", e.brainCloudManager.getSessionId()), + void 0 !== n && o.append("peerCode", n), + o.append("uploadId", i), + o.append("fileSize", r), + o.append("uploadFile", a), + t.send(o)); + }), + (e.file.uploadFile = function (t, a, i, n) { + return; + var s = e.brainCloudManager.getFileUploadUrl(), + o = new FormData(), + r = a.size; + (t.open("POST", s, true), + o.append("sessionId", e.brainCloudManager.getSessionId()), + void 0 !== n && o.append("peerCode", n), + o.append("uploadId", i), + o.append("fileSize", r), + o.append("uploadFile", a), + t.send(o)); + }), + (e.file.uploadFileFromMemory = function (t, a, i, n, s, o) { + var r = s.length ? s.length : s.size, + l = { + cloudPath: t, + cloudFilename: a, + shareable: i, + replaceIfExists: n, + fileSize: r, + }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_FILE, + operation: e.file.OPERATION_PREPARE_USER_UPLOAD, + data: l, + callback: function (t) { + return o && o(result); + if (t.status && 200 == t.status) { + var i, + n = new FormData(); + (n.append("sessionId", e.brainCloudManager._sessionId), + n.append("uploadId", t.data.fileDetails.uploadId), + n.append("fileSize", r), + n.append("uploadFile", s, { filename: a }), + n.submit + ? n.submit( + e.brainCloudManager._fileUploadUrl, + function (e, a) { + (200 != a.statusCode + ? o && + o({ + reasonCode: a.statusCode, + errorMessage: a.statusMessage, + }) + : o && o(t), + a.resume()); + }, + ) + : (((i = window.XMLHttpRequest + ? new XMLHttpRequest() + : new ActiveXObject( + "Microsoft.XMLHTTP", + )).onreadystatechange = function () { + if (i.readyState == XMLHttpRequest.DONE) + if (200 == i.status) o && o(t); + else { + ((reasonCode = 0), (statusMessage = "")); + try { + var e = JSON.parse(i.responseText); + (e.reason_code && + (reasonCode = e.reason_code), + e.status_message + ? (statusMessage = e.status_message) + : (statusMessage = i.responseText)); + } catch (e) { + ((reasonCode = 0), + (statusMessage = i.responseText)); + } + o && + o({ + reasonCode, + errorMessage: statusMessage, + }); + } + }), + i.open( + "POST", + e.brainCloudManager._fileUploadUrl, + true, + ), + i.send(n))); + } else o && o(result); + }, + }); + }), + (e.file.listUserFiles = function (t, a, i) { + var n = {}; + (null != t && (n.cloudPath = t), + null != a && (n.recurse = a), e.brainCloudManager.sendRequest({ - service: e.SERVICE_CUSTOM_ENTITY, - operation: e.customEntity.OPERATION_READ_ENTITY, + service: e.SERVICE_FILE, + operation: e.file.OPERATION_LIST_USER_FILES, data: n, callback: i, - }); - }), - (e.customEntity.updateEntity = function (t, a, i, n, s, o, r) { - var l = { entityType: t, entityId: a, version: i, timeToLive: o }; - (n && (l.dataJson = n), - s && (l.acl = s), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_CUSTOM_ENTITY, - operation: e.customEntity.OPERATION_UPDATE_ENTITY, - data: l, - callback: r, - })); - }), - (e.customEntity.updateEntityFields = function (t, a, i, n, s) { - var o = { entityType: t, entityId: a, version: i }; - (n && (o.fieldsJson = n), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_CUSTOM_ENTITY, - operation: e.customEntity.OPERATION_UPDATE_ENTITY_FIELDS, - data: o, - callback: s, - })); - }), - (e.customEntity.updateEntityFieldsSharded = function ( - t, - a, - i, - n, - s, - o, - ) { - var r = { entityType: t, entityId: a, version: i }; - (n && (r.fieldsJson = n), - s && (r.shardKeyJson = s), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_CUSTOM_ENTITY, - operation: - e.customEntity.OPERATION_UPDATE_ENTITY_FIELDS_SHARDED, - data: r, - callback: o, - })); - }), - (e.customEntity.deleteEntities = function (t, a, i) { - var n = { entityType: t, deleteCriteria: a }; + })); + }), + (e.file.deleteUserFile = function (t, a, i) { + var n = { cloudPath: t, cloudFilename: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_FILE, + operation: e.file.OPERATION_DELETE_USER_FILES, + data: n, + callback: i, + }); + }), + (e.file.deleteUserFiles = function (t, a, i) { + var n = { cloudPath: t, recurse: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_FILE, + operation: e.file.OPERATION_DELETE_USER_FILES, + data: n, + callback: i, + }); + }), + (e.file.getCDNUrl = function (t, a, i) { + var n = { cloudPath: t, cloudFilename: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_FILE, + operation: e.file.OPERATION_GET_CDN_URL, + data: n, + callback: i, + }); + })); + } + function f() { + var e = this; + ((e.friend = {}), + (e.SERVICE_FRIEND = "friend"), + (e.friend.OPERATION_GET_FRIEND_PROFILE_INFO_FOR_EXTERNAL_ID = + "GET_FRIEND_PROFILE_INFO_FOR_EXTERNAL_ID"), + (e.friend.OPERATION_GET_PROFILE_INFO_FOR_CREDENTIAL = + "GET_PROFILE_INFO_FOR_CREDENTIAL"), + (e.friend.OPERATION_GET_PROFILE_INFO_FOR_EXTERNAL_AUTH_ID = + "GET_PROFILE_INFO_FOR_EXTERNAL_AUTH_ID"), + (e.friend.OPERATION_GET_EXTERNAL_ID_FOR_PROFILE_ID = + "GET_EXTERNAL_ID_FOR_PROFILE_ID"), + (e.friend.OPERATION_READ_FRIENDS = "READ_FRIENDS"), + (e.friend.OPERATION_READ_FRIEND_ENTITY = "READ_FRIEND_ENTITY"), + (e.friend.OPERATION_READ_FRIENDS_ENTITIES = + "READ_FRIENDS_ENTITIES"), + (e.friend.OPERATION_READ_FRIEND_PLAYER_STATE = + "READ_FRIEND_PLAYER_STATE"), + (e.friend.OPERATION_READ_FRIENDS_WITH_APPLICATION = + "READ_FRIENDS_WITH_APPLICATION"), + (e.friend.OPERATION_FIND_PLAYER_BY_NAME = "FIND_PLAYER_BY_NAME"), + (e.friend.OPERATION_FIND_PLAYER_BY_UNIVERSAL_ID = + "FIND_PLAYER_BY_UNIVERSAL_ID"), + (e.friend.OPERATION_LIST_FRIENDS = "LIST_FRIENDS"), + (e.friend.OPERATION_GET_MY_SOCIAL_INFO = "GET_MY_SOCIAL_INFO"), + (e.friend.OPERATION_ADD_FRIENDS = "ADD_FRIENDS"), + (e.friend.OPERATION_ADD_FRIENDS_FROM_PLATFORM = + "ADD_FRIENDS_FROM_PLATFORM"), + (e.friend.OPERATION_REMOVE_FRIENDS = "REMOVE_FRIENDS"), + (e.friend.OPERATION_GET_SUMMARY_DATA_FOR_PROFILE_ID = + "GET_SUMMARY_DATA_FOR_PROFILE_ID"), + (e.friend.OPERATION_GET_USERS_ONLINE_STATUS = + "GET_USERS_ONLINE_STATUS"), + (e.friend.OPERATION_FIND_USERS_BY_EXACT_NAME = + "FIND_USERS_BY_EXACT_NAME"), + (e.friend.OPERATION_FIND_USERS_BY_SUBSTR_NAME = + "FIND_USERS_BY_SUBSTR_NAME"), + (e.friend.OPERATION_FIND_USERS_BY_NAME_STARTING_WITH = + "FIND_USERS_BY_NAME_STARTING_WITH"), + (e.friend.OPERATION_FIND_USERS_BY_UNIVERSAL_ID_STARTING_WITH = + "FIND_USERS_BY_UNIVERSAL_ID_STARTING_WITH"), + (e.friend.OPERATION_FIND_USER_BY_EXACT_UNIVERSAL_ID = + "FIND_USER_BY_EXACT_UNIVERSAL_ID"), + (e.friend.friendPlatform = Object.freeze({ + All: "All", + BrainCloud: "brainCloud", + Facebook: "Facebook", + })), + (e.friend.getProfileInfoForCredential = function (t, a, i) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_FRIEND, + operation: e.friend.OPERATION_GET_PROFILE_INFO_FOR_CREDENTIAL, + data: { externalId: t, authenticationType: a }, + callback: i, + }); + }), + (e.friend.getProfileInfoForExternalAuthId = function (t, a, i) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_FRIEND, + operation: + e.friend.OPERATION_GET_PROFILE_INFO_FOR_EXTERNAL_AUTH_ID, + data: { externalId: t, externalAuthType: a }, + callback: i, + }); + }), + (e.friend.getExternalIdForProfileId = function (t, a, i) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_FRIEND, + operation: e.friend.OPERATION_GET_EXTERNAL_ID_FOR_PROFILE_ID, + data: { profileId: t, authenticationType: a }, + callback: i, + }); + }), + (e.friend.readFriendEntity = function (t, a, i) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_FRIEND, + operation: e.friend.OPERATION_READ_FRIEND_ENTITY, + data: { friendId: t, entityId: a }, + callback: i, + }); + }), + (e.friend.readFriendsEntities = function (t, a) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_FRIEND, + operation: e.friend.OPERATION_READ_FRIENDS_ENTITIES, + data: { entityType: t }, + callback: a, + }); + }), + (e.friend.readFriendPlayerState = function (t, a) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_FRIEND, + operation: e.friend.OPERATION_READ_FRIEND_PLAYER_STATE, + data: { friendId: t }, + callback: a, + }); + }), + (e.friend.readFriendUserState = function (t, a) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_FRIEND, + operation: e.friend.OPERATION_READ_FRIEND_PLAYER_STATE, + data: { friendId: t }, + callback: a, + }); + }), + (e.friend.findUsersByExactName = function (t, a, i) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_FRIEND, + operation: e.friend.OPERATION_FIND_USERS_BY_EXACT_NAME, + data: { searchText: t, maxResults: a }, + callback: i, + }); + }), + (e.friend.findUsersBySubstrName = function (t, a, i) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_FRIEND, + operation: e.friend.OPERATION_FIND_USERS_BY_SUBSTR_NAME, + data: { searchText: t, maxResults: a }, + callback: i, + }); + }), + (e.friend.findUserByExactUniversalId = function (t, a) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_FRIEND, + operation: e.friend.OPERATION_FIND_USER_BY_EXACT_UNIVERSAL_ID, + data: { searchText: t }, + callback: a, + }); + }), + (e.friend.listFriends = function (t, a, i) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_FRIEND, + operation: e.friend.OPERATION_LIST_FRIENDS, + data: { friendPlatform: t, includeSummaryData: a }, + callback: i, + }); + }), + (e.friend.getMySocialInfo = function (t, a, i) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_FRIEND, + operation: e.friend.OPERATION_GET_MY_SOCIAL_INFO, + data: { friendPlatform: t, includeSummaryData: a }, + callback: i, + }); + }), + (e.friend.addFriends = function (t, a) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_FRIEND, + operation: e.friend.OPERATION_ADD_FRIENDS, + data: { profileIds: t }, + callback: a, + }); + }), + (e.friend.addFriendsFromPlatform = function (t, a, i, n) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_FRIEND, + operation: e.friend.OPERATION_ADD_FRIENDS_FROM_PLATFORM, + data: { friendPlatform: t, mode: a, externalIds: i }, + callback: n, + }); + }), + (e.friend.removeFriends = function (t, a) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_FRIEND, + operation: e.friend.OPERATION_REMOVE_FRIENDS, + data: { profileIds: t }, + callback: a, + }); + }), + (e.friend.getSummaryDataForProfileId = function (t, a) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_FRIEND, + operation: e.friend.OPERATION_GET_SUMMARY_DATA_FOR_PROFILE_ID, + data: { profileId: t }, + callback: a, + }); + }), + (e.friend.getUsersOnlineStatus = function (t, a) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_FRIEND, + operation: e.friend.OPERATION_GET_USERS_ONLINE_STATUS, + data: { profileIds: t }, + callback: a, + }); + }), + (e.friend.findUsersByNameStartingWith = function (t, a, i) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_FRIEND, + operation: e.friend.OPERATION_FIND_USERS_BY_NAME_STARTING_WITH, + data: { searchText: t, maxResults: a }, + callback: i, + }); + }), + (e.friend.findUsersByUniversalIdStartingWith = function (t, a, i) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_FRIEND, + operation: + e.friend.OPERATION_FIND_USERS_BY_UNIVERSAL_ID_STARTING_WITH, + data: { searchText: t, maxResults: a }, + callback: i, + }); + })); + } + function y() { + var e = this; + ((e.gamification = {}), + (e.gamification.SERVICE_GAMIFICATION = "gamification"), + (e.gamification.OPERATION_READ = "READ"), + (e.gamification.OPERATION_READ_XP_LEVELS = "READ_XP_LEVELS"), + (e.gamification.OPERATION_READ_ACHIEVEMENTS = "READ_ACHIEVEMENTS"), + (e.gamification.OPERATION_READ_ACHIEVED_ACHIEVEMENTS = + "READ_ACHIEVED_ACHIEVEMENTS"), + (e.gamification.OPERATION_AWARD_ACHIEVEMENTS = + "AWARD_ACHIEVEMENTS"), + (e.gamification.OPERATION_READ_MILESTONES = "READ_MILESTONES"), + (e.gamification.OPERATION_READ_MILESTONES_BY_CATEGORY = + "READ_MILESTONES_BY_CATEGORY"), + (e.gamification.OPERATION_READ_COMPLETED_MILESTONES = + "READ_COMPLETED_MILESTONES"), + (e.gamification.OPERATION_READ_IN_PROGRESS_MILESTONES = + "READ_IN_PROGRESS_MILESTONES"), + (e.gamification.OPERATION_RESET_MILESTONES = "RESET_MILESTONES"), + (e.gamification.OPERATION_READ_QUESTS = "READ_QUESTS"), + (e.gamification.OPERATION_READ_QUESTS_BY_CATEGORY = + "READ_QUESTS_BY_CATEGORY"), + (e.gamification.OPERATION_READ_COMPLETED_QUESTS = + "READ_COMPLETED_QUESTS"), + (e.gamification.OPERATION_READ_IN_PROGRESS_QUESTS = + "READ_IN_PROGRESS_QUESTS"), + (e.gamification.OPERATION_READ_NOT_STARTED_QUESTS = + "READ_NOT_STARTED_QUESTS"), + (e.gamification.OPERATION_READ_QUESTS_WITH_STATUS = + "READ_QUESTS_WITH_STATUS"), + (e.gamification.OPERATION_READ_QUESTS_WITH_BASIC_PERCENTAGE = + "READ_QUESTS_WITH_BASIC_PERCENTAGE"), + (e.gamification.OPERATION_READ_QUESTS_WITH_COMPLEX_PERCENTAGE = + "READ_QUESTS_WITH_COMPLEX_PERCENTAGE"), + (e.gamification.readAllGamification = function (t, a) { + var i = {}; + (a && (i.includeMetaData = a), e.brainCloudManager.sendRequest({ - service: e.SERVICE_CUSTOM_ENTITY, - operation: e.customEntity.OPERATION_DELETE_ENTITIES, - data: n, - callback: i, - }); - }), - (e.customEntity.deleteSingleton = function (t, a, i) { - var n = { entityType: t, version: a }; + service: e.gamification.SERVICE_GAMIFICATION, + operation: e.gamification.OPERATION_READ, + data: i, + callback: t, + })); + }), + (e.gamification.awardAchievements = function (t, a, i) { + var n = {}; + ((n.achievements = t), + i && (n.includeMetaData = i), e.brainCloudManager.sendRequest({ - service: e.SERVICE_CUSTOM_ENTITY, - operation: e.customEntity.OPERATION_DELETE_SINGLETON, + service: e.gamification.SERVICE_GAMIFICATION, + operation: e.gamification.OPERATION_AWARD_ACHIEVEMENTS, data: n, - callback: i, - }); - }), - (e.customEntity.readSingleton = function (t, a) { - var i = { entityType: t }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_CUSTOM_ENTITY, - operation: e.customEntity.OPERATION_READ_SINGLETON, - data: i, callback: a, - }); - }), - (e.customEntity.updateSingleton = function (t, a, i, n, s, o) { - var r = { - entityType: t, - version: a, - dataJson: i, - acl: n, - timeToLive: s, - }; + })); + }), + (e.gamification.readAchievedAchievements = function (t, a) { + var i = {}; + (a && (i.includeMetaData = a), e.brainCloudManager.sendRequest({ - service: e.SERVICE_CUSTOM_ENTITY, - operation: e.customEntity.OPERATION_UPDATE_SINGLETON, - data: r, - callback: o, - }); - }), - (e.customEntity.updateSingletonFields = function (t, a, i, n) { - var s = { entityType: t, version: a, fieldsJson: i }; + service: e.gamification.SERVICE_GAMIFICATION, + operation: + e.gamification.OPERATION_READ_ACHIEVED_ACHIEVEMENTS, + data: i, + callback: t, + })); + }), + (e.gamification.readXPLevelsMetaData = function (t) { + e.brainCloudManager.sendRequest({ + service: e.gamification.SERVICE_GAMIFICATION, + operation: e.gamification.OPERATION_READ_XP_LEVELS, + callback: t, + }); + }), + (e.gamification.readAchievements = function (t, a) { + var i = {}; + (a && (i.includeMetaData = a), e.brainCloudManager.sendRequest({ - service: e.SERVICE_CUSTOM_ENTITY, - operation: e.customEntity.OPERATION_UPDATE_SINGLETON_FIELDS, - data: s, - callback: n, - }); - }), - (e.customEntity.incrementData = function (t, a, i, n) { - var s = { entityType: t, entityId: a, fieldsJson: i }; + service: e.gamification.SERVICE_GAMIFICATION, + operation: e.gamification.OPERATION_READ_ACHIEVEMENTS, + data: i, + callback: t, + })); + }), + (e.gamification.readMilestones = function (t, a) { + var i = {}; + (a && (i.includeMetaData = a), e.brainCloudManager.sendRequest({ - service: e.SERVICE_CUSTOM_ENTITY, - operation: e.customEntity.OPERATION_INCREMENT_DATA, - data: s, - callback: n, - }); - }), - (e.customEntity.deleteEntity = function (t, a, i, n) { - var s = { entityType: t, entityId: a, version: i }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_CUSTOM_ENTITY, - operation: e.customEntity.OPERATION_DELETE_ENTITY, - data: s, - callback: n, - }); - })); - } - function h() { - var e = this; - ((e.dataStream = {}), - (e.SERVICE_DATA_STREAM = "dataStream"), - (e.dataStream.OPERATION_CUSTOM_PAGE_EVENT = "CUSTOM_PAGE_EVENT"), - (e.dataStream.OPERATION_CUSTOM_SCREEN_EVENT = - "CUSTOM_SCREEN_EVENT"), - (e.dataStream.OPERATION_CUSTOM_TRACK_EVENT = "CUSTOM_TRACK_EVENT"), - (e.dataStream.OPERATION_SUBMIT_CRASH_REPORT = "SEND_CRASH_REPORT"), - (e.dataStream.customPageEvent = function (t, a, i) { - var n = { eventName: t }; - (a && (n.eventProperties = a), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_DATA_STREAM, - operation: e.dataStream.OPERATION_CUSTOM_PAGE_EVENT, - data: n, - callback: i, - })); - }), - (e.dataStream.customScreenEvent = function (t, a, i) { - var n = { eventName: t }; - (a && (n.eventProperties = a), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_DATA_STREAM, - operation: e.dataStream.OPERATION_CUSTOM_SCREEN_EVENT, - data: n, - callback: i, - })); - }), - (e.dataStream.customTrackEvent = function (t, a, i) { - var n = { eventName: t }; - (a && (n.eventProperties = a), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_DATA_STREAM, - operation: e.dataStream.OPERATION_CUSTOM_TRACK_EVENT, - data: n, - callback: i, - })); - }), - (e.dataStream.submitCrashReport = function ( - t, - a, - i, - n, - s, - o, - r, - l, - c, - ) { - var d = { - crashType: t, - errorMsg: a, - crashJson: i, - crashLog: n, - userName: s, - userEmail: o, - userNotes: r, - userSubmitted: l, - }; + service: e.gamification.SERVICE_GAMIFICATION, + operation: e.gamification.OPERATION_READ_MILESTONES, + data: i, + callback: t, + })); + }), + (e.gamification.readMilestonesByCategory = function (t, a, i) { + var n = {}; + ((n.category = t), + i && (n.includeMetaData = i), e.brainCloudManager.sendRequest({ - service: e.SERVICE_DATA_STREAM, - operation: e.dataStream.OPERATION_SUBMIT_CRASH_REPORT, - data: d, - callback: c, - }); - })); - } - function p() { - var e = this; - ((e.entity = {}), - (e.SERVICE_ENTITY = "entity"), - (e.entity.OPERATION_READ = "READ"), - (e.entity.OPERATION_CREATE = "CREATE"), - (e.entity.OPERATION_READ_BY_TYPE = "READ_BY_TYPE"), - (e.entity.OPERATION_READ_SHARED = "READ_SHARED"), - (e.entity.OPERATION_READ_SHARED_ENTITY = "READ_SHARED_ENTITY"), - (e.entity.OPERATION_READ_SINGLETON = "READ_SINGLETON"), - (e.entity.OPERATION_UPDATE = "UPDATE"), - (e.entity.OPERATION_UPDATE_SHARED = "UPDATE_SHARED"), - (e.entity.OPERATION_UPDATE_SINGLETON = "UPDATE_SINGLETON"), - (e.entity.OPERATION_UPDATE_PARTIAL = "UPDATE_PARTIAL"), - (e.entity.OPERATION_DELETE = "DELETE"), - (e.entity.OPERATION_DELETE_SINGLETON = "DELETE_SINGLETON"), - (e.entity.OPERATION_GET_LIST = "GET_LIST"), - (e.entity.OPERATION_GET_LIST_COUNT = "GET_LIST_COUNT"), - (e.entity.OPERATION_GET_PAGE = "GET_PAGE"), - (e.entity.OPERATION_GET_PAGE_BY_OFFSET = "GET_PAGE_BY_OFFSET"), - (e.entity.OPERATION_READ_SHARED_ENTITIES_LIST = - "READ_SHARED_ENTITIES_LIST"), - (e.entity.OPERATION_INCREMENT_USER_ENTITY_DATA = - "INCREMENT_USER_ENTITY_DATA"), - (e.entity.OPERATION_INCREMENT_SHARED_USER_ENTITY_DATA = - "INCREMENT_SHARED_USER_ENTITY_DATA"), - (e.entity.createEntity = function (t, a, i, n) { - var s = { entityType: t, data: a }; - (i && (s.acl = i), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_ENTITY, - operation: e.entity.OPERATION_CREATE, - data: s, - callback: n, - })); - }), - (e.entity.getEntity = function (t, a) { - var i = { entityId: t }; + service: e.gamification.SERVICE_GAMIFICATION, + operation: + e.gamification.OPERATION_READ_MILESTONES_BY_CATEGORY, + data: n, + callback: a, + })); + }), + (e.gamification.readCompletedMilestones = function (t, a) { + var i = {}; + (a && (i.includeMetaData = a), e.brainCloudManager.sendRequest({ - service: e.SERVICE_ENTITY, - operation: e.entity.OPERATION_READ, + service: e.gamification.SERVICE_GAMIFICATION, + operation: e.gamification.OPERATION_READ_COMPLETED_MILESTONES, data: i, - callback: a, - }); - }), - (e.entity.getEntitiesByType = function (t, a) { - var i = { entityType: t }; + callback: t, + })); + }), + (e.gamification.readInProgressMilestones = function (t, a) { + var i = {}; + (a && (i.includeMetaData = a), e.brainCloudManager.sendRequest({ - service: e.SERVICE_ENTITY, - operation: e.entity.OPERATION_READ_BY_TYPE, + service: e.gamification.SERVICE_GAMIFICATION, + operation: + e.gamification.OPERATION_READ_IN_PROGRESS_MILESTONES, data: i, - callback: a, - }); - }), - (e.entity.getSharedEntityForProfileId = function (t, a, i) { - var n = { targetPlayerId: t, entityId: a }; + callback: t, + })); + }), + (e.gamification.resetMilestones = function (t, a, i) { + var n = {}; + ((n.milestones = t), + i && (n.includeMetaData = i), e.brainCloudManager.sendRequest({ - service: e.SERVICE_ENTITY, - operation: e.entity.OPERATION_READ_SHARED_ENTITY, + service: e.gamification.SERVICE_GAMIFICATION, + operation: e.gamification.OPERATION_RESET_MILESTONES, data: n, - callback: i, - }); - }), - (e.entity.getSharedEntitiesForProfileId = function (t, a) { - var i = { targetPlayerId: t }; + callback: a, + })); + }), + (e.gamification.readQuests = function (t, a) { + var i = {}; + (a && (i.includeMetaData = a), e.brainCloudManager.sendRequest({ - service: e.SERVICE_ENTITY, - operation: e.entity.OPERATION_READ_SHARED, + service: e.gamification.SERVICE_GAMIFICATION, + operation: e.gamification.OPERATION_READ_QUESTS, data: i, + callback: t, + })); + }), + (e.gamification.readQuestsByCategory = function (t, a, i) { + var n = {}; + ((n.category = t), + i && (n.includeMetaData = i), + e.brainCloudManager.sendRequest({ + service: e.gamification.SERVICE_GAMIFICATION, + operation: e.gamification.OPERATION_READ_QUESTS_BY_CATEGORY, + data: n, callback: a, - }); - }), - (e.entity.getSharedEntitiesListForProfileId = function ( - t, - a, - i, - n, - s, - ) { - var o = { targetPlayerId: t, maxReturn: n }; - (a && (o.where = a), - i && (o.orderBy = i), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_ENTITY, - operation: e.entity.OPERATION_READ_SHARED_ENTITIES_LIST, - data: o, - callback: s, - })); - }), - (e.entity.updateEntity = function (t, a, i, n, s, o) { - var r = { entityId: t, data: i, version: s }; - (a && (r.entityType = a), - n && (r.acl = n), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_ENTITY, - operation: e.entity.OPERATION_UPDATE, - data: r, - callback: o, - })); - }), - (e.entity.updateSharedEntity = function (t, a, i, n, s, o) { - var r = { targetPlayerId: a, entityId: t, data: n, version: s }; - (i && (r.entityType = i), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_ENTITY, - operation: e.entity.OPERATION_UPDATE_SHARED, - data: r, - callback: o, - })); - }), - (e.entity.updateSingleton = function (t, a, i, n, s) { - var o = { entityType: t, data: a, version: n }; - (i && (o.acl = i), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_ENTITY, - operation: e.entity.OPERATION_UPDATE_SINGLETON, - data: o, - callback: s, - })); - }), - (e.entity.getSingleton = function (t, a) { - var i = { entityType: t }; + })); + }), + (e.gamification.readCompletedQuests = function (t, a) { + var i = {}; + (a && (i.includeMetaData = a), e.brainCloudManager.sendRequest({ - service: e.SERVICE_ENTITY, - operation: e.entity.OPERATION_READ_SINGLETON, + service: e.gamification.SERVICE_GAMIFICATION, + operation: e.gamification.OPERATION_READ_COMPLETED_QUESTS, data: i, - callback: a, - }); - }), - (e.entity.deleteEntity = function (t, a, i) { - var n = { entityId: t, version: a }; + callback: t, + })); + }), + (e.gamification.readInProgressQuests = function (t, a) { + var i = {}; + (a && (i.includeMetaData = a), e.brainCloudManager.sendRequest({ - service: e.SERVICE_ENTITY, - operation: e.entity.OPERATION_DELETE, - data: n, - callback: i, - }); - }), - (e.entity.deleteSingleton = function (t, a, i) { - var n = { entityType: t, version: a }; + service: e.gamification.SERVICE_GAMIFICATION, + operation: e.gamification.OPERATION_READ_IN_PROGRESS_QUESTS, + data: i, + callback: t, + })); + }), + (e.gamification.readNotStartedQuests = function (t, a) { + var i = {}; + (a && (i.includeMetaData = a), e.brainCloudManager.sendRequest({ - service: e.SERVICE_ENTITY, - operation: e.entity.OPERATION_DELETE_SINGLETON, - data: n, - callback: i, - }); - }), - (e.entity.getList = function (t, a, i, n) { - var s = { where: t, maxReturn: i }; - (a && (s.orderBy = a), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_ENTITY, - operation: e.entity.OPERATION_GET_LIST, - data: s, - callback: n, - })); - }), - (e.entity.getListCount = function (t, a) { - var i = { where: t }; + service: e.gamification.SERVICE_GAMIFICATION, + operation: e.gamification.OPERATION_READ_NOT_STARTED_QUESTS, + data: i, + callback: t, + })); + }), + (e.gamification.readQuestsWithStatus = function (t, a) { + var i = {}; + (a && (i.includeMetaData = a), e.brainCloudManager.sendRequest({ - service: e.SERVICE_ENTITY, - operation: e.entity.OPERATION_GET_LIST_COUNT, + service: e.gamification.SERVICE_GAMIFICATION, + operation: e.gamification.OPERATION_READ_QUESTS_WITH_STATUS, data: i, - callback: a, - }); - }), - (e.entity.getPage = function (t, a) { - var i = { context: t }; + callback: t, + })); + }), + (e.gamification.readQuestsWithBasicPercentage = function (t, a) { + var i = {}; + (a && (i.includeMetaData = a), e.brainCloudManager.sendRequest({ - service: e.SERVICE_ENTITY, - operation: e.entity.OPERATION_GET_PAGE, + service: e.gamification.SERVICE_GAMIFICATION, + operation: + e.gamification.OPERATION_READ_QUESTS_WITH_BASIC_PERCENTAGE, data: i, - callback: a, - }); - }), - (e.entity.getPageOffset = function (t, a, i) { - var n = { context: t, pageOffset: a }; + callback: t, + })); + }), + (e.gamification.readQuestsWithComplexPercentage = function (t, a) { + var i = {}; + (a && (i.includeMetaData = a), e.brainCloudManager.sendRequest({ - service: e.SERVICE_ENTITY, - operation: e.entity.OPERATION_GET_PAGE_BY_OFFSET, - data: n, - callback: i, - }); - }), - (e.entity.incrementUserEntityData = function (t, a, i) { - var n = { entityId: t, data: a }; + service: e.gamification.SERVICE_GAMIFICATION, + operation: + e.gamification + .OPERATION_READ_QUESTS_WITH_COMPLEX_PERCENTAGE, + data: i, + callback: t, + })); + })); + } + function E() { + var e = this; + ((e.globalApp = {}), + (e.SERVICE_GLOBAL_APP = "globalApp"), + (e.globalApp.OPERATION_READ_PROPERTIES = "READ_PROPERTIES"), + (e.globalApp.OPERATION_READ_SELECTED_PROPERTIES = + "READ_SELECTED_PROPERTIES"), + (e.globalApp.OPERATION_READ_PROPERTIES_IN_CATEGORIES = + "READ_PROPERTIES_IN_CATEGORIES"), + (e.globalApp.readProperties = function (t) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_GLOBAL_APP, + operation: e.globalApp.OPERATION_READ_PROPERTIES, + callback: t, + }); + }), + (e.globalApp.readSelectedProperties = function (t, a) { + var i = { propertyNames: t }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_GLOBAL_APP, + operation: e.globalApp.OPERATION_READ_SELECTED_PROPERTIES, + data: i, + callback: a, + }); + }), + (e.globalApp.readPropertiesInCategories = function (t, a) { + var i = { categories: t }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_GLOBAL_APP, + operation: e.globalApp.OPERATION_READ_PROPERTIES_IN_CATEGORIES, + data: i, + callback: a, + }); + })); + } + function b() { + var e = this; + ((e.globalFile = {}), + (e.SERVICE_GLOBAL_FILE = "globalFileV3"), + (e.globalFile.OPERATION_GET_FILE_INFO = "GET_FILE_INFO"), + (e.globalFile.OPERATION_GET_FILE_INFO_SIMPLE = + "GET_FILE_INFO_SIMPLE"), + (e.globalFile.OPERATION_GET_GLOBAL_CDN_URL = "GET_GLOBAL_CDN_URL"), + (e.globalFile.OPERATION_GET_GLOBAL_FILE_LIST = + "GET_GLOBAL_FILE_LIST"), + (e.globalFile.getFileInfo = function (t, a) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_GLOBAL_FILE, + operation: e.globalFile.OPERATION_GET_FILE_INFO, + data: { fileId: t }, + callback: a, + }); + }), + (e.globalFile.getFileInfoSimple = function (t, a, i) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_GLOBAL_FILE, + operation: e.globalFile.OPERATION_GET_FILE_INFO_SIMPLE, + data: { folderPath: t, filename: a }, + callback: i, + }); + }), + (e.globalFile.getGlobalCDNUrl = function (t, a) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_GLOBAL_FILE, + operation: e.globalFile.OPERATION_GET_GLOBAL_CDN_URL, + data: { fileId: t }, + callback: a, + }); + }), + (e.globalFile.getGlobalFileList = function (t, a, i) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_GLOBAL_FILE, + operation: e.globalFile.OPERATION_GET_GLOBAL_FILE_LIST, + data: { folderPath: t, recurse: a }, + callback: i, + }); + })); + } + function S() { + var e = this; + ((e.globalStatistics = {}), + (e.SERVICE_GLOBAL_GAME_STATISTICS = "globalGameStatistics"), + (e.globalStatistics.OPERATION_READ = "READ"), + (e.globalStatistics.OPERATION_READ_SUBSET = "READ_SUBSET"), + (e.globalStatistics.OPERATION_READ_FOR_CATEGORY = + "READ_FOR_CATEGORY"), + (e.globalStatistics.OPERATION_UPDATE_INCREMENT = + "UPDATE_INCREMENT"), + (e.globalStatistics.OPERATION_PROCESS_STATISTICS = + "PROCESS_STATISTICS"), + (e.globalStatistics.incrementGlobalStats = function (t, a) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_GLOBAL_GAME_STATISTICS, + operation: e.globalStatistics.OPERATION_UPDATE_INCREMENT, + data: { statistics: t }, + callback: a, + }); + }), + (e.globalStatistics.readAllGlobalStats = function (t) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_GLOBAL_GAME_STATISTICS, + operation: e.globalStatistics.OPERATION_READ, + callback: t, + }); + }), + (e.globalStatistics.readGlobalStatsSubset = function (t, a) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_GLOBAL_GAME_STATISTICS, + operation: e.globalStatistics.OPERATION_READ_SUBSET, + data: { statistics: t }, + callback: a, + }); + }), + (e.globalStatistics.readGlobalStatsForCategory = function (t, a) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_GLOBAL_GAME_STATISTICS, + operation: e.globalStatistics.OPERATION_READ_FOR_CATEGORY, + data: { category: t }, + callback: a, + }); + }), + (e.globalStatistics.processStatistics = function (t, a) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_GLOBAL_GAME_STATISTICS, + operation: e.globalStatistics.OPERATION_PROCESS_STATISTICS, + data: { statistics: t }, + callback: a, + }); + })); + } + function I() { + var e = this; + ((e.globalEntity = {}), + (e.SERVICE_GLOBAL_ENTITY = "globalEntity"), + (e.globalEntity.OPERATION_CREATE = "CREATE"), + (e.globalEntity.OPERATION_CREATE_WITH_INDEXED_ID = + "CREATE_WITH_INDEXED_ID"), + (e.globalEntity.OPERATION_READ = "READ"), + (e.globalEntity.OPERATION_UPDATE = "UPDATE"), + (e.globalEntity.OPERATION_UPDATE_ACL = "UPDATE_ACL"), + (e.globalEntity.OPERATION_UPDATE_TIME_TO_LIVE = + "UPDATE_TIME_TO_LIVE"), + (e.globalEntity.OPERATION_DELETE = "DELETE"), + (e.globalEntity.OPERATION_GET_LIST = "GET_LIST"), + (e.globalEntity.OPERATION_GET_LIST_BY_INDEXED_ID = + "GET_LIST_BY_INDEXED_ID"), + (e.globalEntity.OPERATION_GET_LIST_COUNT = "GET_LIST_COUNT"), + (e.globalEntity.OPERATION_GET_PAGE = "GET_PAGE"), + (e.globalEntity.OPERATION_GET_PAGE_BY_OFFSET = + "GET_PAGE_BY_OFFSET"), + (e.globalEntity.OPERATION_INCREMENT_GLOBAL_ENTITY_DATA = + "INCREMENT_GLOBAL_ENTITY_DATA"), + (e.globalEntity.OPERATION_GET_RANDOM_ENTITIES_MATCHING = + "GET_RANDOM_ENTITIES_MATCHING"), + (e.globalEntity.OPERATION_UPDATE_ENTITY_INDEXED_ID = + "UPDATE_INDEXED_ID"), + (e.globalEntity.OPERATION_UPDATE_ENTITY_OWNER_AND_ACL = + "UPDATE_ENTITY_OWNER_AND_ACL"), + (e.globalEntity.OPERATION_MAKE_SYSTEM_ENTITY = + "MAKE_SYSTEM_ENTITY"), + (e.globalEntity.createEntity = function (t, a, i, n, s) { + var o = { entityType: t, timeToLive: a, data: n }; + (i && (o.acl = i), e.brainCloudManager.sendRequest({ - service: e.SERVICE_ENTITY, - operation: e.entity.OPERATION_INCREMENT_USER_ENTITY_DATA, - data: n, - callback: i, - }); - }), - (e.entity.incrementSharedUserEntityData = function (t, a, i, n) { - var s = { entityId: t, targetPlayerId: a, data: i }; + service: e.SERVICE_GLOBAL_ENTITY, + operation: e.globalEntity.OPERATION_CREATE, + data: o, + callback: s, + })); + }), + (e.globalEntity.createEntityWithIndexedId = function ( + t, + a, + i, + n, + s, + o, + ) { + var r = { + entityType: t, + entityIndexedId: a, + timeToLive: i, + data: s, + }; + (n && (r.acl = n), e.brainCloudManager.sendRequest({ - service: e.SERVICE_ENTITY, - operation: e.entity.OPERATION_INCREMENT_SHARED_USER_ENTITY_DATA, - data: s, - callback: n, - }); - })); - } - function g() { - var e = this; - ((e.event = {}), - (e.SERVICE_EVENT = "event"), - (e.event.OPERATION_SEND = "SEND"), - (e.event.OPERATION_UPDATE_EVENT_DATA = "UPDATE_EVENT_DATA"), - (e.event.OPERATION_DELETE_INCOMING = "DELETE_INCOMING"), - (e.event.OPERATION_DELETE_SENT = "DELETE_SENT"), - (e.event.OPERATION_GET_EVENTS = "GET_EVENTS"), - (e.event.OPERATION_DELETE_INCOMING_EVENTS = - "DELETE_INCOMING_EVENTS"), - (e.event.OPERATION_DELETE_INCOMING_EVENTS_OLDER_THAN = - "DELETE_INCOMING_EVENTS_OLDER_THAN"), - (e.event.OPERATION_DELETE_INCOMING_EVENTS_BY_TYPE_OLDER_THAN = - "DELETE_INCOMING_EVENTS_BY_TYPE_OLDER_THAN"), - (e.event.sendEvent = function (t, a, i, n) { - var s = { toId: t, eventType: a, eventData: i }; + service: e.SERVICE_GLOBAL_ENTITY, + operation: e.globalEntity.OPERATION_CREATE_WITH_INDEXED_ID, + data: r, + callback: o, + })); + }), + (e.globalEntity.deleteEntity = function (t, a, i) { + var n = { entityId: t, version: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_GLOBAL_ENTITY, + operation: e.globalEntity.OPERATION_DELETE, + data: n, + callback: i, + }); + }), + (e.globalEntity.getList = function (t, a, i, n) { + var s = { where: t, maxReturn: i }; + (a && (s.orderBy = a), e.brainCloudManager.sendRequest({ - service: e.SERVICE_EVENT, - operation: e.event.OPERATION_SEND, + service: e.SERVICE_GLOBAL_ENTITY, + operation: e.globalEntity.OPERATION_GET_LIST, data: s, callback: n, - }); - }), - (e.event.updateIncomingEventData = function (t, a, i) { - var n = { evId: t, eventData: a }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_EVENT, - operation: e.event.OPERATION_UPDATE_EVENT_DATA, - data: n, - callback: i, - }); - }), - (e.event.deleteIncomingEvent = function (t, a) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_EVENT, - operation: e.event.OPERATION_DELETE_INCOMING, - data: { evId: t }, - callback: a, - }); - }), - (e.event.getEvents = function (t) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_EVENT, - operation: e.event.OPERATION_GET_EVENTS, - data: null, - callback: t, - }); - }), - (e.event.deleteIncomingEvents = function (t, a) { + })); + }), + (e.globalEntity.getListByIndexedId = function (t, a, i) { + var n = { entityIndexedId: t, maxReturn: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_GLOBAL_ENTITY, + operation: e.globalEntity.OPERATION_GET_LIST_BY_INDEXED_ID, + data: n, + callback: i, + }); + }), + (e.globalEntity.getListCount = function (t, a) { + var i = { where: t }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_GLOBAL_ENTITY, + operation: e.globalEntity.OPERATION_GET_LIST_COUNT, + data: i, + callback: a, + }); + }), + (e.globalEntity.readEntity = function (t, a) { + var i = { entityId: t }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_GLOBAL_ENTITY, + operation: e.globalEntity.OPERATION_READ, + data: i, + callback: a, + }); + }), + (e.globalEntity.updateEntity = function (t, a, i, n) { + var s = { entityId: t }; + ("number" == typeof a + ? ((s.version = a), (s.data = i)) + : ((s.version = i), (s.data = a)), e.brainCloudManager.sendRequest({ - service: e.SERVICE_EVENT, - operation: e.event.OPERATION_DELETE_INCOMING_EVENTS, - data: { evIds: t }, - callback: a, - }); - }), - (e.event.DeleteIncomingEventsByTypeOlderThan = function (t, a, i) { + service: e.SERVICE_GLOBAL_ENTITY, + operation: e.globalEntity.OPERATION_UPDATE, + data: s, + callback: n, + })); + }), + (e.globalEntity.updateEntityAcl = function (t, a, i, n) { + var s = { entityId: t, version: i, acl: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_GLOBAL_ENTITY, + operation: e.globalEntity.OPERATION_UPDATE_ACL, + data: s, + callback: n, + }); + }), + (e.globalEntity.updateEntityUpdateTimeToLive = function ( + t, + a, + i, + n, + ) { + var s = { entityId: t, version: i, timeToLive: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_GLOBAL_ENTITY, + operation: e.globalEntity.OPERATION_UPDATE_TIME_TO_LIVE, + data: s, + callback: n, + }); + }), + (e.globalEntity.updateEntityTimeToLive = function (t, a, i, n) { + var s = { entityId: t, version: i, timeToLive: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_GLOBAL_ENTITY, + operation: e.globalEntity.OPERATION_UPDATE_TIME_TO_LIVE, + data: s, + callback: n, + }); + }), + (e.globalEntity.getPage = function (t, a) { + var i = { context: t }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_GLOBAL_ENTITY, + operation: e.globalEntity.OPERATION_GET_PAGE, + data: i, + callback: a, + }); + }), + (e.globalEntity.getPageOffset = function (t, a, i) { + var n = { context: t, pageOffset: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_GLOBAL_ENTITY, + operation: e.globalEntity.OPERATION_GET_PAGE_BY_OFFSET, + data: n, + callback: i, + }); + }), + (e.globalEntity.incrementGlobalEntityData = function (t, a, i) { + var n = { entityId: t, data: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_GLOBAL_ENTITY, + operation: + e.globalEntity.OPERATION_INCREMENT_GLOBAL_ENTITY_DATA, + data: n, + callback: i, + }); + }), + (e.globalEntity.getRandomEntitiesMatching = function (t, a, i) { + var n = { where: t, maxReturn: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_GLOBAL_ENTITY, + operation: + e.globalEntity.OPERATION_GET_RANDOM_ENTITIES_MATCHING, + data: n, + callback: i, + }); + }), + (e.globalEntity.updateEntityIndexedId = function (t, a, i, n) { + var s = { entityId: t, version: a, entityIndexedId: i }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_GLOBAL_ENTITY, + operation: e.globalEntity.OPERATION_UPDATE_ENTITY_INDEXED_ID, + data: s, + callback: n, + }); + }), + (e.globalEntity.updateEntityOwnerAndAcl = function (t, a, i, n, s) { + var o = { entityId: t, version: a, ownerId: i, acl: n }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_GLOBAL_ENTITY, + operation: e.globalEntity.OPERATION_UPDATE_ENTITY_OWNER_AND_ACL, + data: o, + callback: s, + }); + }), + (e.globalEntity.makeSystemEntity = function (t, a, i, n) { + var s = { entityId: t, version: a, acl: i }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_GLOBAL_ENTITY, + operation: e.globalEntity.OPERATION_MAKE_SYSTEM_ENTITY, + data: s, + callback: n, + }); + })); + } + function _() { + var e = this; + ((e.group = {}), + (e.SERVICE_GROUP = "group"), + (e.group.OPERATION_ACCEPT_GROUP_INVITATION = + "ACCEPT_GROUP_INVITATION"), + (e.group.OPERATION_ADD_GROUP_MEMBER = "ADD_GROUP_MEMBER"), + (e.group.OPERATION_APPROVE_GROUP_JOIN_REQUEST = + "APPROVE_GROUP_JOIN_REQUEST"), + (e.group.OPERATION_AUTO_JOIN_GROUP = "AUTO_JOIN_GROUP"), + (e.group.OPERATION_AUTO_JOIN_GROUP_MULTI = "AUTO_JOIN_GROUP_MULTI"), + (e.group.OPERATION_CANCEL_GROUP_INVITATION = + "CANCEL_GROUP_INVITATION"), + (e.group.OPERATION_CREATE_GROUP = "CREATE_GROUP"), + (e.group.OPERATION_CREATE_GROUP_ENTITY = "CREATE_GROUP_ENTITY"), + (e.group.OPERATION_DELETE_GROUP = "DELETE_GROUP"), + (e.group.OPERATION_DELETE_GROUP_ENTITY = "DELETE_GROUP_ENTITY"), + (e.group.OPERATION_DELETE_MEMBER_FROM_GROUP = + "DELETE_MEMBER_FROM_GROUP"), + (e.group.OPERATION_GET_MY_GROUPS = "GET_MY_GROUPS"), + (e.group.OPERATION_INCREMENT_GROUP_DATA = "INCREMENT_GROUP_DATA"), + (e.group.OPERATION_INCREMENT_GROUP_ENTITY_DATA = + "INCREMENT_GROUP_ENTITY_DATA"), + (e.group.OPERATION_INVITE_GROUP_MEMBER = "INVITE_GROUP_MEMBER"), + (e.group.OPERATION_JOIN_GROUP = "JOIN_GROUP"), + (e.group.OPERATION_LEAVE_GROUP = "LEAVE_GROUP"), + (e.group.OPERATION_LIST_GROUPS_PAGE = "LIST_GROUPS_PAGE"), + (e.group.OPERATION_LIST_GROUPS_PAGE_BY_OFFSET = + "LIST_GROUPS_PAGE_BY_OFFSET"), + (e.group.OPERATION_LIST_GROUPS_WITH_MEMBER = + "LIST_GROUPS_WITH_MEMBER"), + (e.group.OPERATION_READ_GROUP = "READ_GROUP"), + (e.group.OPERATION_READ_GROUP_DATA = "READ_GROUP_DATA"), + (e.group.OPERATION_READ_GROUP_ENTITIES_PAGE = + "READ_GROUP_ENTITIES_PAGE"), + (e.group.OPERATION_READ_GROUP_ENTITIES_PAGE_BY_OFFSET = + "READ_GROUP_ENTITIES_PAGE_BY_OFFSET"), + (e.group.OPERATION_READ_GROUP_ENTITY = "READ_GROUP_ENTITY"), + (e.group.OPERATION_READ_GROUP_MEMBERS = "READ_GROUP_MEMBERS"), + (e.group.OPERATION_REJECT_GROUP_INVITATION = + "REJECT_GROUP_INVITATION"), + (e.group.OPERATION_REJECT_GROUP_JOIN_REQUEST = + "REJECT_GROUP_JOIN_REQUEST"), + (e.group.OPERATION_REMOVE_GROUP_MEMBER = "REMOVE_GROUP_MEMBER"), + (e.group.OPERATION_SET_GROUP_OPEN = "SET_GROUP_OPEN"), + (e.group.OPERATION_UPDATE_GROUP_ACL = "UPDATE_GROUP_ACL"), + (e.group.OPERATION_UPDATE_GROUP_DATA = "UPDATE_GROUP_DATA"), + (e.group.OPERATION_UPDATE_GROUP_ENTITY = + "UPDATE_GROUP_ENTITY_DATA"), + (e.group.OPERATION_UPDATE_GROUP_MEMBER = "UPDATE_GROUP_MEMBER"), + (e.group.OPERATION_UPDATE_GROUP_NAME = "UPDATE_GROUP_NAME"), + (e.group.OPERATION_UPDATE_GROUP_SUMMARY_DATA = + "UPDATE_GROUP_SUMMARY_DATA"), + (e.group.OPERATION_GET_RANDOM_GROUPS_MATCHING = + "GET_RANDOM_GROUPS_MATCHING"), + (e.group.role = Object.freeze({ + owner: "OWNER", + admin: "ADMIN", + member: "MEMBER", + other: "OTHER", + })), + (e.group.autoJoinStrategy = Object.freeze({ + joinFirstGroup: "JoinFirstGroup", + joinRandomGroup: "JoinRandomGroup", + })), + (e.group.acceptGroupInvitation = function (t, a) { + var i = { groupId: t }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_GROUP, + operation: e.group.OPERATION_ACCEPT_GROUP_INVITATION, + data: i, + callback: a, + }); + }), + (e.group.addGroupMember = function (t, a, i, n, s) { + var o = { groupId: t, profileId: a, role: i }; + (n && (o.attributes = n), e.brainCloudManager.sendRequest({ - service: e.SERVICE_EVENT, - operation: e.event.OPERATION_DELETE_INCOMING_EVENTS_OLDER_THAN, - data: { eventType: t, dateMillis: a }, - callback: i, - }); - }), - (e.event.deleteIncomingEventsOlderThan = function (t, a) { + service: e.SERVICE_GROUP, + operation: e.group.OPERATION_ADD_GROUP_MEMBER, + data: o, + callback: s, + })); + }), + (e.group.approveGroupJoinRequest = function (t, a, i, n, s) { + var o = { groupId: t, profileId: a }; + (i && (o.role = i), + n && (o.attributes = n), e.brainCloudManager.sendRequest({ - service: e.SERVICE_EVENT, - operation: e.event.OPERATION_DELETE_INCOMING_EVENTS_OLDER_THAN, - data: { dateMillis: t }, - callback: a, - }); - })); - } - function m() { - var e = this; - ((e.file = {}), - (e.SERVICE_FILE = "file"), - (e.file.OPERATION_PREPARE_USER_UPLOAD = "PREPARE_USER_UPLOAD"), - (e.file.OPERATION_LIST_USER_FILES = "LIST_USER_FILES"), - (e.file.OPERATION_DELETE_USER_FILES = "DELETE_USER_FILES"), - (e.file.OPERATION_GET_CDN_URL = "GET_CDN_URL"), - (e.file.prepareFileUpload = function (t, a, i, n, s, o) { - e.file.prepareUserUpload(t, a, i, n, s, o); - }), - (e.file.prepareUserUpload = function (t, a, i, n, s, o) { - var r = { - cloudPath: t, - cloudFilename: a, - shareable: i, - replaceIfExists: n, - fileSize: s, - }; + service: e.SERVICE_GROUP, + operation: e.group.OPERATION_APPROVE_GROUP_JOIN_REQUEST, + data: o, + callback: s, + })); + }), + (e.group.autoJoinGroup = function (t, a, i, n) { + var s = { groupType: t, autoJoinStrategy: a }; + (i && (s.dataQueryJson = i), e.brainCloudManager.sendRequest({ - service: e.SERVICE_FILE, - operation: e.file.OPERATION_PREPARE_USER_UPLOAD, - data: r, - callback: o, - }); - }), - (e.file.uploadFile = function (t, a, i, n) { - return; - var s = e.brainCloudManager.getFileUploadUrl(), - o = new FormData(), - r = a.size; - (t.open("POST", s, true), - o.append("sessionId", e.brainCloudManager.getSessionId()), - void 0 !== n && o.append("peerCode", n), - o.append("uploadId", i), - o.append("fileSize", r), - o.append("uploadFile", a), - t.send(o)); - }), - (e.file.uploadFile = function (t, a, i, n) { - return; - var s = e.brainCloudManager.getFileUploadUrl(), - o = new FormData(), - r = a.size; - (t.open("POST", s, true), - o.append("sessionId", e.brainCloudManager.getSessionId()), - void 0 !== n && o.append("peerCode", n), - o.append("uploadId", i), - o.append("fileSize", r), - o.append("uploadFile", a), - t.send(o)); - }), - (e.file.uploadFileFromMemory = function (t, a, i, n, s, o) { - var r = s.length ? s.length : s.size, - l = { - cloudPath: t, - cloudFilename: a, - shareable: i, - replaceIfExists: n, - fileSize: r, - }; + service: e.SERVICE_GROUP, + operation: e.group.OPERATION_AUTO_JOIN_GROUP, + data: s, + callback: n, + })); + }), + (e.group.autoJoinGroupMulti = function (t, a, i, n) { + var s = { groupTypes: t, autoJoinStrategy: a }; + (i && (s.where = i), e.brainCloudManager.sendRequest({ - service: e.SERVICE_FILE, - operation: e.file.OPERATION_PREPARE_USER_UPLOAD, - data: l, - callback: function (t) { - return o && o(result); - if (t.status && 200 == t.status) { - var i, - n = new FormData(); - (n.append("sessionId", e.brainCloudManager._sessionId), - n.append("uploadId", t.data.fileDetails.uploadId), - n.append("fileSize", r), - n.append("uploadFile", s, { filename: a }), - n.submit - ? n.submit( - e.brainCloudManager._fileUploadUrl, - function (e, a) { - (200 != a.statusCode - ? o && - o({ - reasonCode: a.statusCode, - errorMessage: a.statusMessage, - }) - : o && o(t), - a.resume()); - }, - ) - : (((i = window.XMLHttpRequest - ? new XMLHttpRequest() - : new ActiveXObject( - "Microsoft.XMLHTTP", - )).onreadystatechange = function () { - if (i.readyState == XMLHttpRequest.DONE) - if (200 == i.status) o && o(t); - else { - ((reasonCode = 0), (statusMessage = "")); - try { - var e = JSON.parse(i.responseText); - (e.reason_code && - (reasonCode = e.reason_code), - e.status_message - ? (statusMessage = e.status_message) - : (statusMessage = i.responseText)); - } catch (e) { - ((reasonCode = 0), - (statusMessage = i.responseText)); - } - o && - o({ - reasonCode, - errorMessage: statusMessage, - }); - } - }), - i.open( - "POST", - e.brainCloudManager._fileUploadUrl, - true, - ), - i.send(n))); - } else o && o(result); - }, - }); - }), - (e.file.listUserFiles = function (t, a, i) { - var n = {}; - (null != t && (n.cloudPath = t), - null != a && (n.recurse = a), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_FILE, - operation: e.file.OPERATION_LIST_USER_FILES, - data: n, - callback: i, - })); - }), - (e.file.deleteUserFile = function (t, a, i) { - var n = { cloudPath: t, cloudFilename: a }; + service: e.SERVICE_GROUP, + operation: e.group.OPERATION_AUTO_JOIN_GROUP_MULTI, + data: s, + callback: n, + })); + }), + (e.group.cancelGroupInvitation = function (t, a, i) { + var n = { groupId: t, profileId: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_GROUP, + operation: e.group.OPERATION_CANCEL_GROUP_INVITATION, + data: n, + callback: i, + }); + }), + (e.group.createGroup = function (t, a, i, n, s, o, r, l) { + var c = { groupType: a }; + (t && (c.name = t), + i && (c.isOpenGroup = i), + n && (c.acl = n), + s && (c.data = s), + o && (c.ownerAttributes = o), + r && (c.defaultMemberAttributes = r), e.brainCloudManager.sendRequest({ - service: e.SERVICE_FILE, - operation: e.file.OPERATION_DELETE_USER_FILES, - data: n, - callback: i, - }); - }), - (e.file.deleteUserFiles = function (t, a, i) { - var n = { cloudPath: t, recurse: a }; + service: e.SERVICE_GROUP, + operation: e.group.OPERATION_CREATE_GROUP, + data: c, + callback: l, + })); + }), + (e.group.createGroupWithSummaryData = function ( + t, + a, + i, + n, + s, + o, + r, + l, + c, + ) { + var d = { groupType: a }; + (t && (d.name = t), + i && (d.isOpenGroup = i), + n && (d.acl = n), + s && (d.data = s), + o && (d.ownerAttributes = o), + r && (d.defaultMemberAttributes = r), + l && (d.summaryData = l), e.brainCloudManager.sendRequest({ - service: e.SERVICE_FILE, - operation: e.file.OPERATION_DELETE_USER_FILES, - data: n, - callback: i, - }); - }), - (e.file.getCDNUrl = function (t, a, i) { - var n = { cloudPath: t, cloudFilename: a }; + service: e.SERVICE_GROUP, + operation: e.group.OPERATION_CREATE_GROUP, + data: d, + callback: c, + })); + }), + (e.group.createGroupEntity = function (t, a, i, n, s, o) { + var r = { groupId: t }; + (a && (r.entityType = a), + i && (r.isOwnedByGroupMember = i), + n && (r.acl = n), + s && (r.data = s), e.brainCloudManager.sendRequest({ - service: e.SERVICE_FILE, - operation: e.file.OPERATION_GET_CDN_URL, - data: n, - callback: i, - }); - })); - } - function f() { - var e = this; - ((e.friend = {}), - (e.SERVICE_FRIEND = "friend"), - (e.friend.OPERATION_GET_FRIEND_PROFILE_INFO_FOR_EXTERNAL_ID = - "GET_FRIEND_PROFILE_INFO_FOR_EXTERNAL_ID"), - (e.friend.OPERATION_GET_PROFILE_INFO_FOR_CREDENTIAL = - "GET_PROFILE_INFO_FOR_CREDENTIAL"), - (e.friend.OPERATION_GET_PROFILE_INFO_FOR_EXTERNAL_AUTH_ID = - "GET_PROFILE_INFO_FOR_EXTERNAL_AUTH_ID"), - (e.friend.OPERATION_GET_EXTERNAL_ID_FOR_PROFILE_ID = - "GET_EXTERNAL_ID_FOR_PROFILE_ID"), - (e.friend.OPERATION_READ_FRIENDS = "READ_FRIENDS"), - (e.friend.OPERATION_READ_FRIEND_ENTITY = "READ_FRIEND_ENTITY"), - (e.friend.OPERATION_READ_FRIENDS_ENTITIES = - "READ_FRIENDS_ENTITIES"), - (e.friend.OPERATION_READ_FRIEND_PLAYER_STATE = - "READ_FRIEND_PLAYER_STATE"), - (e.friend.OPERATION_READ_FRIENDS_WITH_APPLICATION = - "READ_FRIENDS_WITH_APPLICATION"), - (e.friend.OPERATION_FIND_PLAYER_BY_NAME = "FIND_PLAYER_BY_NAME"), - (e.friend.OPERATION_FIND_PLAYER_BY_UNIVERSAL_ID = - "FIND_PLAYER_BY_UNIVERSAL_ID"), - (e.friend.OPERATION_LIST_FRIENDS = "LIST_FRIENDS"), - (e.friend.OPERATION_GET_MY_SOCIAL_INFO = "GET_MY_SOCIAL_INFO"), - (e.friend.OPERATION_ADD_FRIENDS = "ADD_FRIENDS"), - (e.friend.OPERATION_ADD_FRIENDS_FROM_PLATFORM = - "ADD_FRIENDS_FROM_PLATFORM"), - (e.friend.OPERATION_REMOVE_FRIENDS = "REMOVE_FRIENDS"), - (e.friend.OPERATION_GET_SUMMARY_DATA_FOR_PROFILE_ID = - "GET_SUMMARY_DATA_FOR_PROFILE_ID"), - (e.friend.OPERATION_GET_USERS_ONLINE_STATUS = - "GET_USERS_ONLINE_STATUS"), - (e.friend.OPERATION_FIND_USERS_BY_EXACT_NAME = - "FIND_USERS_BY_EXACT_NAME"), - (e.friend.OPERATION_FIND_USERS_BY_SUBSTR_NAME = - "FIND_USERS_BY_SUBSTR_NAME"), - (e.friend.OPERATION_FIND_USERS_BY_NAME_STARTING_WITH = - "FIND_USERS_BY_NAME_STARTING_WITH"), - (e.friend.OPERATION_FIND_USERS_BY_UNIVERSAL_ID_STARTING_WITH = - "FIND_USERS_BY_UNIVERSAL_ID_STARTING_WITH"), - (e.friend.OPERATION_FIND_USER_BY_EXACT_UNIVERSAL_ID = - "FIND_USER_BY_EXACT_UNIVERSAL_ID"), - (e.friend.friendPlatform = Object.freeze({ - All: "All", - BrainCloud: "brainCloud", - Facebook: "Facebook", - })), - (e.friend.getProfileInfoForCredential = function (t, a, i) { + service: e.SERVICE_GROUP, + operation: e.group.OPERATION_CREATE_GROUP_ENTITY, + data: r, + callback: o, + })); + }), + (e.group.deleteGroup = function (t, a, i) { + var n = { groupId: t, version: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_GROUP, + operation: e.group.OPERATION_DELETE_GROUP, + data: n, + callback: i, + }); + }), + (e.group.deleteGroupEntity = function (t, a, i, n) { + var s = { groupId: t, entityId: a, version: i }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_GROUP, + operation: e.group.OPERATION_DELETE_GROUP_ENTITY, + data: s, + callback: n, + }); + }), + (e.group.getMyGroups = function (t) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_GROUP, + operation: e.group.OPERATION_GET_MY_GROUPS, + data: {}, + callback: t, + }); + }), + (e.group.incrementGroupData = function (t, a, i) { + var n = { groupId: t, data: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_GROUP, + operation: e.group.OPERATION_INCREMENT_GROUP_DATA, + data: n, + callback: i, + }); + }), + (e.group.incrementGroupEntityData = function (t, a, i, n) { + var s = { groupId: t, entityId: a, data: i }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_GROUP, + operation: e.group.OPERATION_INCREMENT_GROUP_ENTITY_DATA, + data: s, + callback: n, + }); + }), + (e.group.inviteGroupMember = function (t, a, i, n, s) { + var o = { groupId: t, profileId: a }; + (i && (o.role = i), + n && (o.attributes = n), e.brainCloudManager.sendRequest({ - service: e.SERVICE_FRIEND, - operation: e.friend.OPERATION_GET_PROFILE_INFO_FOR_CREDENTIAL, - data: { externalId: t, authenticationType: a }, - callback: i, - }); - }), - (e.friend.getProfileInfoForExternalAuthId = function (t, a, i) { + service: e.SERVICE_GROUP, + operation: e.group.OPERATION_INVITE_GROUP_MEMBER, + data: o, + callback: s, + })); + }), + (e.group.joinGroup = function (t, a) { + var i = { groupId: t }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_GROUP, + operation: e.group.OPERATION_JOIN_GROUP, + data: i, + callback: a, + }); + }), + (e.group.leaveGroup = function (t, a) { + var i = { groupId: t }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_GROUP, + operation: e.group.OPERATION_LEAVE_GROUP, + data: i, + callback: a, + }); + }), + (e.group.listGroupsPage = function (t, a) { + var i = { context: t }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_GROUP, + operation: e.group.OPERATION_LIST_GROUPS_PAGE, + data: i, + callback: a, + }); + }), + (e.group.listGroupsPageByOffset = function (t, a, i) { + var n = { context: t, pageOffset: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_GROUP, + operation: e.group.OPERATION_LIST_GROUPS_PAGE_BY_OFFSET, + data: n, + callback: i, + }); + }), + (e.group.listGroupsWithMember = function (t, a) { + var i = { profileId: t }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_GROUP, + operation: e.group.OPERATION_LIST_GROUPS_WITH_MEMBER, + data: i, + callback: a, + }); + }), + (e.group.readGroup = function (t, a) { + var i = { groupId: t }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_GROUP, + operation: e.group.OPERATION_READ_GROUP, + data: i, + callback: a, + }); + }), + (e.group.readGroupData = function (t, a) { + var i = { groupId: t }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_GROUP, + operation: e.group.OPERATION_READ_GROUP_DATA, + data: i, + callback: a, + }); + }), + (e.group.readGroupEntitiesPage = function (t, a) { + var i = { context: t }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_GROUP, + operation: e.group.OPERATION_READ_GROUP_ENTITIES_PAGE, + data: i, + callback: a, + }); + }), + (e.group.readGroupEntitiesPageByOffset = function (t, a, i) { + var n = { context: t, pageOffset: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_GROUP, + operation: e.group.OPERATION_READ_GROUP_ENTITIES_PAGE_BY_OFFSET, + data: n, + callback: i, + }); + }), + (e.group.readGroupEntity = function (t, a, i) { + var n = { groupId: t, entityId: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_GROUP, + operation: e.group.OPERATION_READ_GROUP_ENTITY, + data: n, + callback: i, + }); + }), + (e.group.readGroupMembers = function (t, a) { + var i = { groupId: t }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_GROUP, + operation: e.group.OPERATION_READ_GROUP_MEMBERS, + data: i, + callback: a, + }); + }), + (e.group.rejectGroupInvitation = function (t, a) { + var i = { groupId: t }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_GROUP, + operation: e.group.OPERATION_REJECT_GROUP_INVITATION, + data: i, + callback: a, + }); + }), + (e.group.rejectGroupJoinRequest = function (t, a, i) { + var n = { groupId: t, profileId: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_GROUP, + operation: e.group.OPERATION_REJECT_GROUP_JOIN_REQUEST, + data: n, + callback: i, + }); + }), + (e.group.removeGroupMember = function (t, a, i) { + var n = { groupId: t, profileId: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_GROUP, + operation: e.group.OPERATION_REMOVE_GROUP_MEMBER, + data: n, + callback: i, + }); + }), + (e.group.setGroupOpen = function (t, a, i) { + var n = { groupId: t, isOpenGroup: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_GROUP, + operation: e.group.OPERATION_SET_GROUP_OPEN, + data: n, + callback: i, + }); + }), + (e.group.updateGroupData = function (t, a, i, n) { + var s = { groupId: t, version: a, data: i }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_GROUP, + operation: e.group.OPERATION_UPDATE_GROUP_DATA, + data: s, + callback: n, + }); + }), + (e.group.updateGroupEntityData = function (t, a, i, n, s) { + var o = { groupId: t, entityId: a, version: i, data: n }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_GROUP, + operation: e.group.OPERATION_UPDATE_GROUP_ENTITY, + data: o, + callback: s, + }); + }), + (e.group.updateGroupMember = function (t, a, i, n, s) { + var o = { groupId: t, profileId: a }; + (i && (o.role = i), + n && (o.attributes = n), e.brainCloudManager.sendRequest({ - service: e.SERVICE_FRIEND, - operation: - e.friend.OPERATION_GET_PROFILE_INFO_FOR_EXTERNAL_AUTH_ID, - data: { externalId: t, externalAuthType: a }, - callback: i, - }); - }), - (e.friend.getExternalIdForProfileId = function (t, a, i) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_FRIEND, - operation: e.friend.OPERATION_GET_EXTERNAL_ID_FOR_PROFILE_ID, - data: { profileId: t, authenticationType: a }, - callback: i, - }); - }), - (e.friend.readFriendEntity = function (t, a, i) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_FRIEND, - operation: e.friend.OPERATION_READ_FRIEND_ENTITY, - data: { friendId: t, entityId: a }, - callback: i, - }); - }), - (e.friend.readFriendsEntities = function (t, a) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_FRIEND, - operation: e.friend.OPERATION_READ_FRIENDS_ENTITIES, - data: { entityType: t }, - callback: a, - }); - }), - (e.friend.readFriendPlayerState = function (t, a) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_FRIEND, - operation: e.friend.OPERATION_READ_FRIEND_PLAYER_STATE, - data: { friendId: t }, - callback: a, - }); - }), - (e.friend.readFriendUserState = function (t, a) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_FRIEND, - operation: e.friend.OPERATION_READ_FRIEND_PLAYER_STATE, - data: { friendId: t }, - callback: a, - }); - }), - (e.friend.findUsersByExactName = function (t, a, i) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_FRIEND, - operation: e.friend.OPERATION_FIND_USERS_BY_EXACT_NAME, - data: { searchText: t, maxResults: a }, - callback: i, - }); - }), - (e.friend.findUsersBySubstrName = function (t, a, i) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_FRIEND, - operation: e.friend.OPERATION_FIND_USERS_BY_SUBSTR_NAME, - data: { searchText: t, maxResults: a }, - callback: i, - }); - }), - (e.friend.findUserByExactUniversalId = function (t, a) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_FRIEND, - operation: e.friend.OPERATION_FIND_USER_BY_EXACT_UNIVERSAL_ID, - data: { searchText: t }, - callback: a, - }); - }), - (e.friend.listFriends = function (t, a, i) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_FRIEND, - operation: e.friend.OPERATION_LIST_FRIENDS, - data: { friendPlatform: t, includeSummaryData: a }, - callback: i, - }); - }), - (e.friend.getMySocialInfo = function (t, a, i) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_FRIEND, - operation: e.friend.OPERATION_GET_MY_SOCIAL_INFO, - data: { friendPlatform: t, includeSummaryData: a }, - callback: i, - }); - }), - (e.friend.addFriends = function (t, a) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_FRIEND, - operation: e.friend.OPERATION_ADD_FRIENDS, - data: { profileIds: t }, - callback: a, - }); - }), - (e.friend.addFriendsFromPlatform = function (t, a, i, n) { + service: e.SERVICE_GROUP, + operation: e.group.OPERATION_UPDATE_GROUP_MEMBER, + data: o, + callback: s, + })); + }), + (e.group.updateGroupName = function (t, a, i) { + var n = { groupId: t, name: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_GROUP, + operation: e.group.OPERATION_UPDATE_GROUP_NAME, + data: n, + callback: i, + }); + }), + (e.group.updateGroupSummaryData = function (t, a, i, n) { + var s = { groupId: t, version: a, summaryData: i }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_GROUP, + operation: e.group.OPERATION_UPDATE_GROUP_SUMMARY_DATA, + data: s, + callback: n, + }); + }), + (e.group.getRandomGroupsMatching = function (t, a, i) { + var n = { where: t, maxReturn: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_GROUP, + operation: e.group.OPERATION_GET_RANDOM_GROUPS_MATCHING, + data: n, + callback: i, + }); + })); + } + function v() { + var e = this; + ((e.identity = {}), + (e.SERVICE_IDENTITY = "identity"), + (e.identity.OPERATION_ATTACH = "ATTACH"), + (e.identity.OPERATION_ATTACH_BLOCKCHAIN_IDENTITY = + "ATTACH_BLOCKCHAIN_IDENTITY"), + (e.identity.OPERATION_DETACH_BLOCKCHAIN_IDENTITY = + "DETACH_BLOCKCHAIN_IDENTITY"), + (e.identity.OPERATION_MERGE = "MERGE"), + (e.identity.OPERATION_DETACH = "DETACH"), + (e.identity.OPERATION_SWITCH_TO_CHILD_PROFILE = + "SWITCH_TO_CHILD_PROFILE"), + (e.identity.OPERATION_SWITCH_TO_PARENT_PROFILE = + "SWITCH_TO_PARENT_PROFILE"), + (e.identity.OPERATION_GET_CHILD_PROFILES = "GET_CHILD_PROFILES"), + (e.identity.OPERATION_GET_IDENTITIES = "GET_IDENTITIES"), + (e.identity.OPERATION_GET_EXPIRED_IDENTITIES = + "GET_EXPIRED_IDENTITIES"), + (e.identity.OPERATION_REFRESH_IDENTITY = "REFRESH_IDENTITY"), + (e.identity.OPERATION_CHANGE_EMAIL_IDENTITY = + "CHANGE_EMAIL_IDENTITY"), + (e.identity.OPERATION_ATTACH_PARENT_WITH_IDENTITY = + "ATTACH_PARENT_WITH_IDENTITY"), + (e.identity.OPERATION_DETACH_PARENT = "DETACH_PARENT"), + (e.identity.OPERATION_ATTACH_PEER_PROFILE = "ATTACH_PEER_PROFILE"), + (e.identity.OPERATION_DETACH_PEER = "DETACH_PEER"), + (e.identity.OPERATION_GET_PEER_PROFILES = "GET_PEER_PROFILES"), + (e.identity.OPERATION_ATTACH_NONLOGIN_UNIVERSAL = + "ATTACH_NONLOGIN_UNIVERSAL"), + (e.identity.OPERATION_UPDATE_UNIVERSAL_LOGIN = + "UPDATE_UNIVERSAL_LOGIN"), + (e.identity.authenticationType = Object.freeze({ + anonymous: "Anonymous", + universal: "Universal", + email: "Email", + facebook: "Facebook", + gameCenter: "GameCenter", + steam: "Steam", + blockChain: "BlockChain", + google: "Google", + googleOpenId: "GoogleOpenId", + twitter: "Twitter", + twitter: "Apple", + parse: "Parse", + external: "External", + unknown: "UNKNOWN", + })), + (e.identity.attachFacebookIdentity = function (t, a, i) { + e.identity.attachIdentity( + t, + a, + e.authentication.AUTHENTICATION_TYPE_FACEBOOK, + i, + ); + }), + (e.identity.mergeFacebookIdentity = function (t, a, i) { + e.identity.mergeIdentity( + t, + a, + e.authentication.AUTHENTICATION_TYPE_FACEBOOK, + i, + ); + }), + (e.identity.detachFacebookIdentity = function (t, a, i) { + e.identity.detachIdentity( + t, + e.authentication.AUTHENTICATION_TYPE_FACEBOOK, + a, + i, + ); + }), + (e.identity.attachUltraIdentity = function (t, a, i) { + e.identity.attachIdentity( + t, + a, + e.authentication.AUTHENTICATION_TYPE_ULTRA, + i, + ); + }), + (e.identity.mergeUltraIdentity = function (t, a, i) { + e.identity.mergeIdentity( + t, + a, + e.authentication.AUTHENTICATION_TYPE_ULTRA, + i, + ); + }), + (e.identity.detachUltraIdentity = function (t, a, i) { + e.identity.detachIdentity( + t, + e.authentication.AUTHENTICATION_TYPE_ULTRA, + a, + i, + ); + }), + (e.identity.attachAdvancedIdentity = function (t, a, i, n) { + var s = { + externalId: a.externalId, + authenticationType: t, + authenticationToken: a.authenticationToken, + }; + (externalAuthName && (s.externalAuthName = externalAuthName), + i && (s.extraJson = i), e.brainCloudManager.sendRequest({ - service: e.SERVICE_FRIEND, - operation: e.friend.OPERATION_ADD_FRIENDS_FROM_PLATFORM, - data: { friendPlatform: t, mode: a, externalIds: i }, + service: e.SERVICE_IDENTITY, + operation: e.identity.OPERATION_ATTACH, + data: s, callback: n, - }); - }), - (e.friend.removeFriends = function (t, a) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_FRIEND, - operation: e.friend.OPERATION_REMOVE_FRIENDS, - data: { profileIds: t }, - callback: a, - }); - }), - (e.friend.getSummaryDataForProfileId = function (t, a) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_FRIEND, - operation: e.friend.OPERATION_GET_SUMMARY_DATA_FOR_PROFILE_ID, - data: { profileId: t }, - callback: a, - }); - }), - (e.friend.getUsersOnlineStatus = function (t, a) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_FRIEND, - operation: e.friend.OPERATION_GET_USERS_ONLINE_STATUS, - data: { profileIds: t }, - callback: a, - }); - }), - (e.friend.findUsersByNameStartingWith = function (t, a, i) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_FRIEND, - operation: e.friend.OPERATION_FIND_USERS_BY_NAME_STARTING_WITH, - data: { searchText: t, maxResults: a }, - callback: i, - }); - }), - (e.friend.findUsersByUniversalIdStartingWith = function (t, a, i) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_FRIEND, - operation: - e.friend.OPERATION_FIND_USERS_BY_UNIVERSAL_ID_STARTING_WITH, - data: { searchText: t, maxResults: a }, - callback: i, - }); - })); - } - function y() { - var e = this; - ((e.gamification = {}), - (e.gamification.SERVICE_GAMIFICATION = "gamification"), - (e.gamification.OPERATION_READ = "READ"), - (e.gamification.OPERATION_READ_XP_LEVELS = "READ_XP_LEVELS"), - (e.gamification.OPERATION_READ_ACHIEVEMENTS = "READ_ACHIEVEMENTS"), - (e.gamification.OPERATION_READ_ACHIEVED_ACHIEVEMENTS = - "READ_ACHIEVED_ACHIEVEMENTS"), - (e.gamification.OPERATION_AWARD_ACHIEVEMENTS = - "AWARD_ACHIEVEMENTS"), - (e.gamification.OPERATION_READ_MILESTONES = "READ_MILESTONES"), - (e.gamification.OPERATION_READ_MILESTONES_BY_CATEGORY = - "READ_MILESTONES_BY_CATEGORY"), - (e.gamification.OPERATION_READ_COMPLETED_MILESTONES = - "READ_COMPLETED_MILESTONES"), - (e.gamification.OPERATION_READ_IN_PROGRESS_MILESTONES = - "READ_IN_PROGRESS_MILESTONES"), - (e.gamification.OPERATION_RESET_MILESTONES = "RESET_MILESTONES"), - (e.gamification.OPERATION_READ_QUESTS = "READ_QUESTS"), - (e.gamification.OPERATION_READ_QUESTS_BY_CATEGORY = - "READ_QUESTS_BY_CATEGORY"), - (e.gamification.OPERATION_READ_COMPLETED_QUESTS = - "READ_COMPLETED_QUESTS"), - (e.gamification.OPERATION_READ_IN_PROGRESS_QUESTS = - "READ_IN_PROGRESS_QUESTS"), - (e.gamification.OPERATION_READ_NOT_STARTED_QUESTS = - "READ_NOT_STARTED_QUESTS"), - (e.gamification.OPERATION_READ_QUESTS_WITH_STATUS = - "READ_QUESTS_WITH_STATUS"), - (e.gamification.OPERATION_READ_QUESTS_WITH_BASIC_PERCENTAGE = - "READ_QUESTS_WITH_BASIC_PERCENTAGE"), - (e.gamification.OPERATION_READ_QUESTS_WITH_COMPLEX_PERCENTAGE = - "READ_QUESTS_WITH_COMPLEX_PERCENTAGE"), - (e.gamification.readAllGamification = function (t, a) { - var i = {}; - (a && (i.includeMetaData = a), - e.brainCloudManager.sendRequest({ - service: e.gamification.SERVICE_GAMIFICATION, - operation: e.gamification.OPERATION_READ, - data: i, - callback: t, - })); - }), - (e.gamification.awardAchievements = function (t, a, i) { - var n = {}; - ((n.achievements = t), - i && (n.includeMetaData = i), - e.brainCloudManager.sendRequest({ - service: e.gamification.SERVICE_GAMIFICATION, - operation: e.gamification.OPERATION_AWARD_ACHIEVEMENTS, - data: n, - callback: a, - })); - }), - (e.gamification.readAchievedAchievements = function (t, a) { - var i = {}; - (a && (i.includeMetaData = a), - e.brainCloudManager.sendRequest({ - service: e.gamification.SERVICE_GAMIFICATION, - operation: - e.gamification.OPERATION_READ_ACHIEVED_ACHIEVEMENTS, - data: i, - callback: t, - })); - }), - (e.gamification.readXPLevelsMetaData = function (t) { - e.brainCloudManager.sendRequest({ - service: e.gamification.SERVICE_GAMIFICATION, - operation: e.gamification.OPERATION_READ_XP_LEVELS, - callback: t, - }); - }), - (e.gamification.readAchievements = function (t, a) { - var i = {}; - (a && (i.includeMetaData = a), - e.brainCloudManager.sendRequest({ - service: e.gamification.SERVICE_GAMIFICATION, - operation: e.gamification.OPERATION_READ_ACHIEVEMENTS, - data: i, - callback: t, - })); - }), - (e.gamification.readMilestones = function (t, a) { - var i = {}; - (a && (i.includeMetaData = a), - e.brainCloudManager.sendRequest({ - service: e.gamification.SERVICE_GAMIFICATION, - operation: e.gamification.OPERATION_READ_MILESTONES, - data: i, - callback: t, - })); - }), - (e.gamification.readMilestonesByCategory = function (t, a, i) { - var n = {}; - ((n.category = t), - i && (n.includeMetaData = i), - e.brainCloudManager.sendRequest({ - service: e.gamification.SERVICE_GAMIFICATION, - operation: - e.gamification.OPERATION_READ_MILESTONES_BY_CATEGORY, - data: n, - callback: a, - })); - }), - (e.gamification.readCompletedMilestones = function (t, a) { - var i = {}; - (a && (i.includeMetaData = a), - e.brainCloudManager.sendRequest({ - service: e.gamification.SERVICE_GAMIFICATION, - operation: e.gamification.OPERATION_READ_COMPLETED_MILESTONES, - data: i, - callback: t, - })); - }), - (e.gamification.readInProgressMilestones = function (t, a) { - var i = {}; - (a && (i.includeMetaData = a), - e.brainCloudManager.sendRequest({ - service: e.gamification.SERVICE_GAMIFICATION, - operation: - e.gamification.OPERATION_READ_IN_PROGRESS_MILESTONES, - data: i, - callback: t, - })); - }), - (e.gamification.resetMilestones = function (t, a, i) { - var n = {}; - ((n.milestones = t), - i && (n.includeMetaData = i), - e.brainCloudManager.sendRequest({ - service: e.gamification.SERVICE_GAMIFICATION, - operation: e.gamification.OPERATION_RESET_MILESTONES, - data: n, - callback: a, - })); - }), - (e.gamification.readQuests = function (t, a) { - var i = {}; - (a && (i.includeMetaData = a), - e.brainCloudManager.sendRequest({ - service: e.gamification.SERVICE_GAMIFICATION, - operation: e.gamification.OPERATION_READ_QUESTS, - data: i, - callback: t, - })); - }), - (e.gamification.readQuestsByCategory = function (t, a, i) { - var n = {}; - ((n.category = t), - i && (n.includeMetaData = i), - e.brainCloudManager.sendRequest({ - service: e.gamification.SERVICE_GAMIFICATION, - operation: e.gamification.OPERATION_READ_QUESTS_BY_CATEGORY, - data: n, - callback: a, - })); - }), - (e.gamification.readCompletedQuests = function (t, a) { - var i = {}; - (a && (i.includeMetaData = a), - e.brainCloudManager.sendRequest({ - service: e.gamification.SERVICE_GAMIFICATION, - operation: e.gamification.OPERATION_READ_COMPLETED_QUESTS, - data: i, - callback: t, - })); - }), - (e.gamification.readInProgressQuests = function (t, a) { - var i = {}; - (a && (i.includeMetaData = a), - e.brainCloudManager.sendRequest({ - service: e.gamification.SERVICE_GAMIFICATION, - operation: e.gamification.OPERATION_READ_IN_PROGRESS_QUESTS, - data: i, - callback: t, - })); - }), - (e.gamification.readNotStartedQuests = function (t, a) { - var i = {}; - (a && (i.includeMetaData = a), - e.brainCloudManager.sendRequest({ - service: e.gamification.SERVICE_GAMIFICATION, - operation: e.gamification.OPERATION_READ_NOT_STARTED_QUESTS, - data: i, - callback: t, - })); - }), - (e.gamification.readQuestsWithStatus = function (t, a) { - var i = {}; - (a && (i.includeMetaData = a), - e.brainCloudManager.sendRequest({ - service: e.gamification.SERVICE_GAMIFICATION, - operation: e.gamification.OPERATION_READ_QUESTS_WITH_STATUS, - data: i, - callback: t, - })); - }), - (e.gamification.readQuestsWithBasicPercentage = function (t, a) { - var i = {}; - (a && (i.includeMetaData = a), - e.brainCloudManager.sendRequest({ - service: e.gamification.SERVICE_GAMIFICATION, - operation: - e.gamification.OPERATION_READ_QUESTS_WITH_BASIC_PERCENTAGE, - data: i, - callback: t, - })); - }), - (e.gamification.readQuestsWithComplexPercentage = function (t, a) { - var i = {}; - (a && (i.includeMetaData = a), - e.brainCloudManager.sendRequest({ - service: e.gamification.SERVICE_GAMIFICATION, - operation: - e.gamification - .OPERATION_READ_QUESTS_WITH_COMPLEX_PERCENTAGE, - data: i, - callback: t, - })); - })); - } - function E() { - var e = this; - ((e.globalApp = {}), - (e.SERVICE_GLOBAL_APP = "globalApp"), - (e.globalApp.OPERATION_READ_PROPERTIES = "READ_PROPERTIES"), - (e.globalApp.OPERATION_READ_SELECTED_PROPERTIES = - "READ_SELECTED_PROPERTIES"), - (e.globalApp.OPERATION_READ_PROPERTIES_IN_CATEGORIES = - "READ_PROPERTIES_IN_CATEGORIES"), - (e.globalApp.readProperties = function (t) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_GLOBAL_APP, - operation: e.globalApp.OPERATION_READ_PROPERTIES, - callback: t, - }); - }), - (e.globalApp.readSelectedProperties = function (t, a) { - var i = { propertyNames: t }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_GLOBAL_APP, - operation: e.globalApp.OPERATION_READ_SELECTED_PROPERTIES, - data: i, - callback: a, - }); - }), - (e.globalApp.readPropertiesInCategories = function (t, a) { - var i = { categories: t }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_GLOBAL_APP, - operation: e.globalApp.OPERATION_READ_PROPERTIES_IN_CATEGORIES, - data: i, - callback: a, - }); - })); - } - function b() { - var e = this; - ((e.globalFile = {}), - (e.SERVICE_GLOBAL_FILE = "globalFileV3"), - (e.globalFile.OPERATION_GET_FILE_INFO = "GET_FILE_INFO"), - (e.globalFile.OPERATION_GET_FILE_INFO_SIMPLE = - "GET_FILE_INFO_SIMPLE"), - (e.globalFile.OPERATION_GET_GLOBAL_CDN_URL = "GET_GLOBAL_CDN_URL"), - (e.globalFile.OPERATION_GET_GLOBAL_FILE_LIST = - "GET_GLOBAL_FILE_LIST"), - (e.globalFile.getFileInfo = function (t, a) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_GLOBAL_FILE, - operation: e.globalFile.OPERATION_GET_FILE_INFO, - data: { fileId: t }, - callback: a, - }); - }), - (e.globalFile.getFileInfoSimple = function (t, a, i) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_GLOBAL_FILE, - operation: e.globalFile.OPERATION_GET_FILE_INFO_SIMPLE, - data: { folderPath: t, filename: a }, - callback: i, - }); - }), - (e.globalFile.getGlobalCDNUrl = function (t, a) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_GLOBAL_FILE, - operation: e.globalFile.OPERATION_GET_GLOBAL_CDN_URL, - data: { fileId: t }, - callback: a, - }); - }), - (e.globalFile.getGlobalFileList = function (t, a, i) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_GLOBAL_FILE, - operation: e.globalFile.OPERATION_GET_GLOBAL_FILE_LIST, - data: { folderPath: t, recurse: a }, - callback: i, - }); - })); - } - function S() { - var e = this; - ((e.globalStatistics = {}), - (e.SERVICE_GLOBAL_GAME_STATISTICS = "globalGameStatistics"), - (e.globalStatistics.OPERATION_READ = "READ"), - (e.globalStatistics.OPERATION_READ_SUBSET = "READ_SUBSET"), - (e.globalStatistics.OPERATION_READ_FOR_CATEGORY = - "READ_FOR_CATEGORY"), - (e.globalStatistics.OPERATION_UPDATE_INCREMENT = - "UPDATE_INCREMENT"), - (e.globalStatistics.OPERATION_PROCESS_STATISTICS = - "PROCESS_STATISTICS"), - (e.globalStatistics.incrementGlobalStats = function (t, a) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_GLOBAL_GAME_STATISTICS, - operation: e.globalStatistics.OPERATION_UPDATE_INCREMENT, - data: { statistics: t }, - callback: a, - }); - }), - (e.globalStatistics.readAllGlobalStats = function (t) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_GLOBAL_GAME_STATISTICS, - operation: e.globalStatistics.OPERATION_READ, - callback: t, - }); - }), - (e.globalStatistics.readGlobalStatsSubset = function (t, a) { + })); + }), + (e.identity.mergeAdvancedIdentity = function (t, a, i, n) { + var s = { + externalId: a.externalId, + authenticationType: t, + authenticationToken: a.authenticationToken, + }; + (externalAuthName && (s.externalAuthName = externalAuthName), + i && (s.extraJson = i), e.brainCloudManager.sendRequest({ - service: e.SERVICE_GLOBAL_GAME_STATISTICS, - operation: e.globalStatistics.OPERATION_READ_SUBSET, - data: { statistics: t }, - callback: a, - }); - }), - (e.globalStatistics.readGlobalStatsForCategory = function (t, a) { + service: e.SERVICE_IDENTITY, + operation: e.identity.OPERATION_MERGE, + data: s, + callback: n, + })); + }), + (e.identity.detachAdvancedIdentity = function (t, a, i, n, s) { + var o = { + externalId: a, + authenticationType: t, + confirmAnonymous: i, + }; + (n && (o.extraJson = n), e.brainCloudManager.sendRequest({ - service: e.SERVICE_GLOBAL_GAME_STATISTICS, - operation: e.globalStatistics.OPERATION_READ_FOR_CATEGORY, - data: { category: t }, - callback: a, - }); - }), - (e.globalStatistics.processStatistics = function (t, a) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_GLOBAL_GAME_STATISTICS, - operation: e.globalStatistics.OPERATION_PROCESS_STATISTICS, - data: { statistics: t }, - callback: a, - }); - })); - } - function I() { - var e = this; - ((e.globalEntity = {}), - (e.SERVICE_GLOBAL_ENTITY = "globalEntity"), - (e.globalEntity.OPERATION_CREATE = "CREATE"), - (e.globalEntity.OPERATION_CREATE_WITH_INDEXED_ID = - "CREATE_WITH_INDEXED_ID"), - (e.globalEntity.OPERATION_READ = "READ"), - (e.globalEntity.OPERATION_UPDATE = "UPDATE"), - (e.globalEntity.OPERATION_UPDATE_ACL = "UPDATE_ACL"), - (e.globalEntity.OPERATION_UPDATE_TIME_TO_LIVE = - "UPDATE_TIME_TO_LIVE"), - (e.globalEntity.OPERATION_DELETE = "DELETE"), - (e.globalEntity.OPERATION_GET_LIST = "GET_LIST"), - (e.globalEntity.OPERATION_GET_LIST_BY_INDEXED_ID = - "GET_LIST_BY_INDEXED_ID"), - (e.globalEntity.OPERATION_GET_LIST_COUNT = "GET_LIST_COUNT"), - (e.globalEntity.OPERATION_GET_PAGE = "GET_PAGE"), - (e.globalEntity.OPERATION_GET_PAGE_BY_OFFSET = - "GET_PAGE_BY_OFFSET"), - (e.globalEntity.OPERATION_INCREMENT_GLOBAL_ENTITY_DATA = - "INCREMENT_GLOBAL_ENTITY_DATA"), - (e.globalEntity.OPERATION_GET_RANDOM_ENTITIES_MATCHING = - "GET_RANDOM_ENTITIES_MATCHING"), - (e.globalEntity.OPERATION_UPDATE_ENTITY_INDEXED_ID = - "UPDATE_INDEXED_ID"), - (e.globalEntity.OPERATION_UPDATE_ENTITY_OWNER_AND_ACL = - "UPDATE_ENTITY_OWNER_AND_ACL"), - (e.globalEntity.OPERATION_MAKE_SYSTEM_ENTITY = - "MAKE_SYSTEM_ENTITY"), - (e.globalEntity.createEntity = function (t, a, i, n, s) { - var o = { entityType: t, timeToLive: a, data: n }; - (i && (o.acl = i), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_GLOBAL_ENTITY, - operation: e.globalEntity.OPERATION_CREATE, - data: o, - callback: s, - })); - }), - (e.globalEntity.createEntityWithIndexedId = function ( + service: e.SERVICE_IDENTITY, + operation: e.identity.OPERATION_DETACH, + data: o, + callback: s, + })); + }), + (e.identity.attachFacebookLimitedIdentity = function (t, a, i) { + e.identity.attachIdentity( t, a, + e.authentication.AUTHENTICATION_TYPE_FACEBOOK_LIMITED, i, - n, - s, - o, - ) { - var r = { - entityType: t, - entityIndexedId: a, - timeToLive: i, - data: s, - }; - (n && (r.acl = n), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_GLOBAL_ENTITY, - operation: e.globalEntity.OPERATION_CREATE_WITH_INDEXED_ID, - data: r, - callback: o, - })); - }), - (e.globalEntity.deleteEntity = function (t, a, i) { - var n = { entityId: t, version: a }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_GLOBAL_ENTITY, - operation: e.globalEntity.OPERATION_DELETE, - data: n, - callback: i, - }); - }), - (e.globalEntity.getList = function (t, a, i, n) { - var s = { where: t, maxReturn: i }; - (a && (s.orderBy = a), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_GLOBAL_ENTITY, - operation: e.globalEntity.OPERATION_GET_LIST, - data: s, - callback: n, - })); - }), - (e.globalEntity.getListByIndexedId = function (t, a, i) { - var n = { entityIndexedId: t, maxReturn: a }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_GLOBAL_ENTITY, - operation: e.globalEntity.OPERATION_GET_LIST_BY_INDEXED_ID, - data: n, - callback: i, - }); - }), - (e.globalEntity.getListCount = function (t, a) { - var i = { where: t }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_GLOBAL_ENTITY, - operation: e.globalEntity.OPERATION_GET_LIST_COUNT, - data: i, - callback: a, - }); - }), - (e.globalEntity.readEntity = function (t, a) { - var i = { entityId: t }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_GLOBAL_ENTITY, - operation: e.globalEntity.OPERATION_READ, - data: i, - callback: a, - }); - }), - (e.globalEntity.updateEntity = function (t, a, i, n) { - var s = { entityId: t }; - ("number" == typeof a - ? ((s.version = a), (s.data = i)) - : ((s.version = i), (s.data = a)), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_GLOBAL_ENTITY, - operation: e.globalEntity.OPERATION_UPDATE, - data: s, - callback: n, - })); - }), - (e.globalEntity.updateEntityAcl = function (t, a, i, n) { - var s = { entityId: t, version: i, acl: a }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_GLOBAL_ENTITY, - operation: e.globalEntity.OPERATION_UPDATE_ACL, - data: s, - callback: n, - }); - }), - (e.globalEntity.updateEntityUpdateTimeToLive = function ( + ); + }), + (e.identity.mergeFacebookLimitedIdentity = function (t, a, i) { + e.identity.mergeIdentity( t, a, + e.authentication.AUTHENTICATION_TYPE_FACEBOOK_LIMITED, i, - n, - ) { - var s = { entityId: t, version: i, timeToLive: a }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_GLOBAL_ENTITY, - operation: e.globalEntity.OPERATION_UPDATE_TIME_TO_LIVE, - data: s, - callback: n, - }); - }), - (e.globalEntity.updateEntityTimeToLive = function (t, a, i, n) { - var s = { entityId: t, version: i, timeToLive: a }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_GLOBAL_ENTITY, - operation: e.globalEntity.OPERATION_UPDATE_TIME_TO_LIVE, - data: s, - callback: n, - }); - }), - (e.globalEntity.getPage = function (t, a) { - var i = { context: t }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_GLOBAL_ENTITY, - operation: e.globalEntity.OPERATION_GET_PAGE, - data: i, - callback: a, - }); - }), - (e.globalEntity.getPageOffset = function (t, a, i) { - var n = { context: t, pageOffset: a }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_GLOBAL_ENTITY, - operation: e.globalEntity.OPERATION_GET_PAGE_BY_OFFSET, - data: n, - callback: i, - }); - }), - (e.globalEntity.incrementGlobalEntityData = function (t, a, i) { - var n = { entityId: t, data: a }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_GLOBAL_ENTITY, - operation: - e.globalEntity.OPERATION_INCREMENT_GLOBAL_ENTITY_DATA, - data: n, - callback: i, - }); - }), - (e.globalEntity.getRandomEntitiesMatching = function (t, a, i) { - var n = { where: t, maxReturn: a }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_GLOBAL_ENTITY, - operation: - e.globalEntity.OPERATION_GET_RANDOM_ENTITIES_MATCHING, - data: n, - callback: i, - }); - }), - (e.globalEntity.updateEntityIndexedId = function (t, a, i, n) { - var s = { entityId: t, version: a, entityIndexedId: i }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_GLOBAL_ENTITY, - operation: e.globalEntity.OPERATION_UPDATE_ENTITY_INDEXED_ID, - data: s, - callback: n, - }); - }), - (e.globalEntity.updateEntityOwnerAndAcl = function (t, a, i, n, s) { - var o = { entityId: t, version: a, ownerId: i, acl: n }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_GLOBAL_ENTITY, - operation: e.globalEntity.OPERATION_UPDATE_ENTITY_OWNER_AND_ACL, - data: o, - callback: s, - }); - }), - (e.globalEntity.makeSystemEntity = function (t, a, i, n) { - var s = { entityId: t, version: a, acl: i }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_GLOBAL_ENTITY, - operation: e.globalEntity.OPERATION_MAKE_SYSTEM_ENTITY, - data: s, - callback: n, - }); - })); - } - function _() { - var e = this; - ((e.group = {}), - (e.SERVICE_GROUP = "group"), - (e.group.OPERATION_ACCEPT_GROUP_INVITATION = - "ACCEPT_GROUP_INVITATION"), - (e.group.OPERATION_ADD_GROUP_MEMBER = "ADD_GROUP_MEMBER"), - (e.group.OPERATION_APPROVE_GROUP_JOIN_REQUEST = - "APPROVE_GROUP_JOIN_REQUEST"), - (e.group.OPERATION_AUTO_JOIN_GROUP = "AUTO_JOIN_GROUP"), - (e.group.OPERATION_AUTO_JOIN_GROUP_MULTI = "AUTO_JOIN_GROUP_MULTI"), - (e.group.OPERATION_CANCEL_GROUP_INVITATION = - "CANCEL_GROUP_INVITATION"), - (e.group.OPERATION_CREATE_GROUP = "CREATE_GROUP"), - (e.group.OPERATION_CREATE_GROUP_ENTITY = "CREATE_GROUP_ENTITY"), - (e.group.OPERATION_DELETE_GROUP = "DELETE_GROUP"), - (e.group.OPERATION_DELETE_GROUP_ENTITY = "DELETE_GROUP_ENTITY"), - (e.group.OPERATION_DELETE_MEMBER_FROM_GROUP = - "DELETE_MEMBER_FROM_GROUP"), - (e.group.OPERATION_GET_MY_GROUPS = "GET_MY_GROUPS"), - (e.group.OPERATION_INCREMENT_GROUP_DATA = "INCREMENT_GROUP_DATA"), - (e.group.OPERATION_INCREMENT_GROUP_ENTITY_DATA = - "INCREMENT_GROUP_ENTITY_DATA"), - (e.group.OPERATION_INVITE_GROUP_MEMBER = "INVITE_GROUP_MEMBER"), - (e.group.OPERATION_JOIN_GROUP = "JOIN_GROUP"), - (e.group.OPERATION_LEAVE_GROUP = "LEAVE_GROUP"), - (e.group.OPERATION_LIST_GROUPS_PAGE = "LIST_GROUPS_PAGE"), - (e.group.OPERATION_LIST_GROUPS_PAGE_BY_OFFSET = - "LIST_GROUPS_PAGE_BY_OFFSET"), - (e.group.OPERATION_LIST_GROUPS_WITH_MEMBER = - "LIST_GROUPS_WITH_MEMBER"), - (e.group.OPERATION_READ_GROUP = "READ_GROUP"), - (e.group.OPERATION_READ_GROUP_DATA = "READ_GROUP_DATA"), - (e.group.OPERATION_READ_GROUP_ENTITIES_PAGE = - "READ_GROUP_ENTITIES_PAGE"), - (e.group.OPERATION_READ_GROUP_ENTITIES_PAGE_BY_OFFSET = - "READ_GROUP_ENTITIES_PAGE_BY_OFFSET"), - (e.group.OPERATION_READ_GROUP_ENTITY = "READ_GROUP_ENTITY"), - (e.group.OPERATION_READ_GROUP_MEMBERS = "READ_GROUP_MEMBERS"), - (e.group.OPERATION_REJECT_GROUP_INVITATION = - "REJECT_GROUP_INVITATION"), - (e.group.OPERATION_REJECT_GROUP_JOIN_REQUEST = - "REJECT_GROUP_JOIN_REQUEST"), - (e.group.OPERATION_REMOVE_GROUP_MEMBER = "REMOVE_GROUP_MEMBER"), - (e.group.OPERATION_SET_GROUP_OPEN = "SET_GROUP_OPEN"), - (e.group.OPERATION_UPDATE_GROUP_ACL = "UPDATE_GROUP_ACL"), - (e.group.OPERATION_UPDATE_GROUP_DATA = "UPDATE_GROUP_DATA"), - (e.group.OPERATION_UPDATE_GROUP_ENTITY = - "UPDATE_GROUP_ENTITY_DATA"), - (e.group.OPERATION_UPDATE_GROUP_MEMBER = "UPDATE_GROUP_MEMBER"), - (e.group.OPERATION_UPDATE_GROUP_NAME = "UPDATE_GROUP_NAME"), - (e.group.OPERATION_UPDATE_GROUP_SUMMARY_DATA = - "UPDATE_GROUP_SUMMARY_DATA"), - (e.group.OPERATION_GET_RANDOM_GROUPS_MATCHING = - "GET_RANDOM_GROUPS_MATCHING"), - (e.group.role = Object.freeze({ - owner: "OWNER", - admin: "ADMIN", - member: "MEMBER", - other: "OTHER", - })), - (e.group.autoJoinStrategy = Object.freeze({ - joinFirstGroup: "JoinFirstGroup", - joinRandomGroup: "JoinRandomGroup", - })), - (e.group.acceptGroupInvitation = function (t, a) { - var i = { groupId: t }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_GROUP, - operation: e.group.OPERATION_ACCEPT_GROUP_INVITATION, - data: i, - callback: a, - }); - }), - (e.group.addGroupMember = function (t, a, i, n, s) { - var o = { groupId: t, profileId: a, role: i }; - (n && (o.attributes = n), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_GROUP, - operation: e.group.OPERATION_ADD_GROUP_MEMBER, - data: o, - callback: s, - })); - }), - (e.group.approveGroupJoinRequest = function (t, a, i, n, s) { - var o = { groupId: t, profileId: a }; - (i && (o.role = i), - n && (o.attributes = n), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_GROUP, - operation: e.group.OPERATION_APPROVE_GROUP_JOIN_REQUEST, - data: o, - callback: s, - })); - }), - (e.group.autoJoinGroup = function (t, a, i, n) { - var s = { groupType: t, autoJoinStrategy: a }; - (i && (s.dataQueryJson = i), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_GROUP, - operation: e.group.OPERATION_AUTO_JOIN_GROUP, - data: s, - callback: n, - })); - }), - (e.group.autoJoinGroupMulti = function (t, a, i, n) { - var s = { groupTypes: t, autoJoinStrategy: a }; - (i && (s.where = i), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_GROUP, - operation: e.group.OPERATION_AUTO_JOIN_GROUP_MULTI, - data: s, - callback: n, - })); - }), - (e.group.cancelGroupInvitation = function (t, a, i) { - var n = { groupId: t, profileId: a }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_GROUP, - operation: e.group.OPERATION_CANCEL_GROUP_INVITATION, - data: n, - callback: i, - }); - }), - (e.group.createGroup = function (t, a, i, n, s, o, r, l) { - var c = { groupType: a }; - (t && (c.name = t), - i && (c.isOpenGroup = i), - n && (c.acl = n), - s && (c.data = s), - o && (c.ownerAttributes = o), - r && (c.defaultMemberAttributes = r), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_GROUP, - operation: e.group.OPERATION_CREATE_GROUP, - data: c, - callback: l, - })); - }), - (e.group.createGroupWithSummaryData = function ( + ); + }), + (e.identity.detachFacebookLimitedIdentity = function (t, a, i) { + e.identity.detachIdentity( + facebookLimitedId, + e.authentication.AUTHENTICATION_TYPE_FACEBOOK_LIMITED, + a, + i, + ); + }), + (e.identity.attachGameCenterIdentity = function (t, a) { + e.identity.detachIdentity( + t, + "", + authenticationToken, + e.authentication.AUTHENTICATION_TYPE_GAME_CENTER, + a, + ); + }), + (e.identity.mergeGameCenterIdentity = function (t, a) { + e.identity.detachIdentity( + t, + "", + authenticationToken, + e.authentication.AUTHENTICATION_TYPE_GAME_CENTER, + a, + ); + }), + (e.identity.detachGameCenterIdentity = function (t, a, i) { + e.identity.detachIdentity( t, + e.authentication.AUTHENTICATION_TYPE_GAME_CENTER, a, i, - n, - s, - o, - r, - l, - c, - ) { - var d = { groupType: a }; - (t && (d.name = t), - i && (d.isOpenGroup = i), - n && (d.acl = n), - s && (d.data = s), - o && (d.ownerAttributes = o), - r && (d.defaultMemberAttributes = r), - l && (d.summaryData = l), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_GROUP, - operation: e.group.OPERATION_CREATE_GROUP, - data: d, - callback: c, - })); - }), - (e.group.createGroupEntity = function (t, a, i, n, s, o) { - var r = { groupId: t }; - (a && (r.entityType = a), - i && (r.isOwnedByGroupMember = i), - n && (r.acl = n), - s && (r.data = s), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_GROUP, - operation: e.group.OPERATION_CREATE_GROUP_ENTITY, - data: r, - callback: o, - })); - }), - (e.group.deleteGroup = function (t, a, i) { - var n = { groupId: t, version: a }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_GROUP, - operation: e.group.OPERATION_DELETE_GROUP, - data: n, - callback: i, - }); - }), - (e.group.deleteGroupEntity = function (t, a, i, n) { - var s = { groupId: t, entityId: a, version: i }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_GROUP, - operation: e.group.OPERATION_DELETE_GROUP_ENTITY, - data: s, - callback: n, - }); - }), - (e.group.getMyGroups = function (t) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_GROUP, - operation: e.group.OPERATION_GET_MY_GROUPS, - data: {}, - callback: t, - }); - }), - (e.group.incrementGroupData = function (t, a, i) { - var n = { groupId: t, data: a }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_GROUP, - operation: e.group.OPERATION_INCREMENT_GROUP_DATA, - data: n, - callback: i, - }); - }), - (e.group.incrementGroupEntityData = function (t, a, i, n) { - var s = { groupId: t, entityId: a, data: i }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_GROUP, - operation: e.group.OPERATION_INCREMENT_GROUP_ENTITY_DATA, - data: s, - callback: n, - }); - }), - (e.group.inviteGroupMember = function (t, a, i, n, s) { - var o = { groupId: t, profileId: a }; - (i && (o.role = i), - n && (o.attributes = n), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_GROUP, - operation: e.group.OPERATION_INVITE_GROUP_MEMBER, - data: o, - callback: s, - })); - }), - (e.group.joinGroup = function (t, a) { - var i = { groupId: t }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_GROUP, - operation: e.group.OPERATION_JOIN_GROUP, - data: i, - callback: a, - }); - }), - (e.group.leaveGroup = function (t, a) { - var i = { groupId: t }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_GROUP, - operation: e.group.OPERATION_LEAVE_GROUP, - data: i, - callback: a, - }); - }), - (e.group.listGroupsPage = function (t, a) { - var i = { context: t }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_GROUP, - operation: e.group.OPERATION_LIST_GROUPS_PAGE, - data: i, - callback: a, - }); - }), - (e.group.listGroupsPageByOffset = function (t, a, i) { - var n = { context: t, pageOffset: a }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_GROUP, - operation: e.group.OPERATION_LIST_GROUPS_PAGE_BY_OFFSET, - data: n, - callback: i, - }); - }), - (e.group.listGroupsWithMember = function (t, a) { - var i = { profileId: t }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_GROUP, - operation: e.group.OPERATION_LIST_GROUPS_WITH_MEMBER, - data: i, - callback: a, - }); - }), - (e.group.readGroup = function (t, a) { - var i = { groupId: t }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_GROUP, - operation: e.group.OPERATION_READ_GROUP, - data: i, - callback: a, - }); - }), - (e.group.readGroupData = function (t, a) { - var i = { groupId: t }; + ); + }), + (e.identity.attachEmailIdentity = function (t, a, i) { + e.identity.attachIdentity( + t, + a, + e.authentication.AUTHENTICATION_TYPE_EMAIL, + i, + ); + }), + (e.identity.mergeEmailIdentity = function (t, a, i) { + e.identity.mergeIdentity( + t, + a, + e.authentication.AUTHENTICATION_TYPE_EMAIL, + i, + ); + }), + (e.identity.detachEmailIdentity = function (t, a, i) { + e.identity.detachIdentity( + t, + e.authentication.AUTHENTICATION_TYPE_EMAIL, + a, + i, + ); + }), + (e.identity.attachUniversalIdentity = function (t, a, i) { + e.identity.attachIdentity( + t, + a, + e.authentication.AUTHENTICATION_TYPE_UNIVERSAL, + i, + ); + }), + (e.identity.mergeUniversalIdentity = function (t, a, i) { + e.identity.mergeIdentity( + t, + a, + e.authentication.AUTHENTICATION_TYPE_UNIVERSAL, + i, + ); + }), + (e.identity.detachUniversalIdentity = function (t, a, i) { + e.identity.detachIdentity( + t, + e.authentication.AUTHENTICATION_TYPE_UNIVERSAL, + a, + i, + ); + }), + (e.identity.attachSteamIdentity = function (t, a, i) { + e.identity.attachIdentity( + t, + a, + e.authentication.AUTHENTICATION_TYPE_STEAM, + i, + ); + }), + (e.identity.mergeSteamIdentity = function (t, a, i) { + e.identity.mergeIdentity( + t, + a, + e.authentication.AUTHENTICATION_TYPE_STEAM, + i, + ); + }), + (e.identity.detachSteamIdentity = function (t, a, i) { + e.identity.detachIdentity( + t, + e.authentication.AUTHENTICATION_TYPE_STEAM, + a, + i, + ); + }), + (e.identity.attachGoogleIdentity = function (t, a, i) { + e.identity.attachIdentity( + t, + a, + e.authentication.AUTHENTICATION_TYPE_GOOGLE, + i, + ); + }), + (e.identity.mergeGoogleIdentity = function (t, a, i) { + e.identity.mergeIdentity( + t, + a, + e.authentication.AUTHENTICATION_TYPE_GOOGLE, + i, + ); + }), + (e.identity.detachGoogleIdentity = function (t, a, i) { + e.identity.detachIdentity( + t, + e.authentication.AUTHENTICATION_TYPE_GOOGLE, + a, + i, + ); + }), + (e.identity.attachGoogleOpenIdIdentity = function (t, a, i) { + e.identity.attachIdentity( + t, + a, + e.authentication.AUTHENTICATION_TYPE_GOOGLE_OPEN_ID, + i, + ); + }), + (e.identity.mergeGoogleOpenIdIdentity = function (t, a, i) { + e.identity.mergeIdentity( + t, + a, + e.authentication.AUTHENTICATION_TYPE_GOOGLE_OPEN_ID, + i, + ); + }), + (e.identity.detachGoogleOpenIdIdentity = function (t, a, i) { + e.identity.detachIdentity( + t, + e.authentication.AUTHENTICATION_TYPE_GOOGLE_OPEN_ID, + a, + i, + ); + }), + (e.identity.attachAppleIdentity = function (t, a, i) { + e.identity.attachIdentity( + t, + a, + e.authentication.AUTHENTICATION_TYPE_APPLE, + i, + ); + }), + (e.identity.mergeAppleIdentity = function (t, a, i) { + e.identity.mergeIdentity( + t, + a, + e.authentication.AUTHENTICATION_TYPE_APPLE, + i, + ); + }), + (e.identity.detachAppleIdentity = function (t, a, i) { + e.identity.detachIdentity( + t, + e.authentication.AUTHENTICATION_TYPE_APPLE, + a, + i, + ); + }), + (e.identity.attachTwitterIdentity = function (t, a, i, n) { + e.identity.attachIdentity( + t, + a + ":" + i, + e.authentication.AUTHENTICATION_TYPE_TWITTER, + n, + ); + }), + (e.identity.mergeTwitterIdentity = function (t, a, i, n) { + e.identity.mergeIdentity( + t, + a + ":" + i, + e.authentication.AUTHENTICATION_TYPE_TWITTER, + n, + ); + }), + (e.identity.detachTwitterIdentity = function (t, a, i) { + e.identity.detachIdentity( + t, + e.authentication.AUTHENTICATION_TYPE_TWITTER, + a, + i, + ); + }), + (e.identity.attachParseIdentity = function (t, a, i) { + e.identity.attachIdentity( + t, + a, + e.authentication.AUTHENTICATION_TYPE_PARSE, + i, + ); + }), + (e.identity.mergeParseIdentity = function (t, a, i) { + e.identity.mergeIdentity( + t, + a, + e.authentication.AUTHENTICATION_TYPE_PARSE, + i, + ); + }), + (e.identity.detachParseIdentity = function (t, a, i) { + e.identity.detachIdentity( + t, + e.authentication.AUTHENTICATION_TYPE_PARSE, + a, + i, + ); + }), + (e.identity.switchToChildProfile = function (t, a, i, n) { + e.identity.switchToChildProfileInternal(t, a, i, false, n); + }), + (e.identity.switchToSingletonChildProfile = function (t, a, i) { + e.identity.switchToChildProfileInternal(null, t, a, true, i); + }), + (e.identity.attachBlockchainIdentity = function (t, a, i) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_IDENTITY, + operation: e.identity.OPERATION_ATTACH_BLOCKCHAIN_IDENTITY, + data: { blockchainConfig: t, publicKey: a }, + callback: i, + }); + }), + (e.identity.detachBlockchainIdentity = function (t, a) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_IDENTITY, + operation: e.identity.OPERATION_DETACH_BLOCKCHAIN_IDENTITY, + data: { blockchainConfig: t }, + callback: a, + }); + }), + (e.identity.updateUniversalIdLogin = function (t, a) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_IDENTITY, + operation: e.identity.OPERATION_UPDATE_UNIVERSAL_LOGIN, + data: { externalId: t }, + callback: a, + }); + }), + (e.identity.attachNonLoginUniversalId = function (t, a) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_IDENTITY, + operation: e.identity.OPERATION_ATTACH_NONLOGIN_UNIVERSAL, + data: { externalId: t }, + callback: a, + }); + }), + (e.identity.switchToParentProfile = function (t, a) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_IDENTITY, + operation: e.identity.OPERATION_SWITCH_TO_PARENT_PROFILE, + data: { levelName: t }, + callback: a, + }); + }), + (e.identity.getChildProfiles = function (t, a) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_IDENTITY, + operation: e.identity.OPERATION_GET_CHILD_PROFILES, + data: { includePlayerSummaryData: t }, + callback: a, + }); + }), + (e.identity.getIdentities = function (t) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_IDENTITY, + operation: e.identity.OPERATION_GET_IDENTITIES, + data: {}, + callback: t, + }); + }), + (e.identity.getExpiredIdentities = function (t) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_IDENTITY, + operation: e.identity.OPERATION_GET_EXPIRED_IDENTITIES, + data: {}, + callback: t, + }); + }), + (e.identity.refreshIdentity = function (t, a, i, n) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_IDENTITY, + operation: e.identity.OPERATION_REFRESH_IDENTITY, + data: { + externalId: t, + authenticationType: i, + authenticationToken: a, + }, + callback: n, + }); + }), + (e.identity.changeEmailIdentity = function (t, a, i, n, s) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_IDENTITY, + operation: e.identity.OPERATION_CHANGE_EMAIL_IDENTITY, + data: { + oldEmailAddress: t, + authenticationToken: a, + newEmailAddress: i, + updateContactEmail: n, + }, + callback: s, + }); + }), + (e.identity.attachParentWithIdentity = function (t, a, i, n, s, o) { + var r = { + externalId: t, + authenticationToken: a, + authenticationType: i, + forceCreate: s, + }; + (n && (r.externalAuthName = n), e.brainCloudManager.sendRequest({ - service: e.SERVICE_GROUP, - operation: e.group.OPERATION_READ_GROUP_DATA, - data: i, - callback: a, - }); - }), - (e.group.readGroupEntitiesPage = function (t, a) { - var i = { context: t }; + service: e.SERVICE_IDENTITY, + operation: e.identity.OPERATION_ATTACH_PARENT_WITH_IDENTITY, + data: r, + callback: o, + })); + }), + (e.identity.detachParent = function (t) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_IDENTITY, + operation: e.identity.OPERATION_DETACH_PARENT, + data: null, + callback: t, + }); + }), + (e.identity.attachPeerProfile = function (t, a, i, n, s, o, r) { + var l = { + peer: t, + externalId: a, + authenticationToken: i, + authenticationType: n, + forceCreate: o, + }; + (s && (l.externalAuthName = s), e.brainCloudManager.sendRequest({ - service: e.SERVICE_GROUP, - operation: e.group.OPERATION_READ_GROUP_ENTITIES_PAGE, - data: i, - callback: a, - }); - }), - (e.group.readGroupEntitiesPageByOffset = function (t, a, i) { - var n = { context: t, pageOffset: a }; + service: e.SERVICE_IDENTITY, + operation: e.identity.OPERATION_ATTACH_PEER_PROFILE, + data: l, + callback: r, + })); + }), + (e.identity.detachPeer = function (t, a) { + var i = { peer: t }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_IDENTITY, + operation: e.identity.OPERATION_DETACH_PEER, + data: i, + callback: a, + }); + }), + (e.identity.getPeerProfiles = function (t) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_IDENTITY, + operation: e.identity.OPERATION_GET_PEER_PROFILES, + data: null, + callback: t, + }); + }), + (e.identity.attachIdentity = function (t, a, i, n) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_IDENTITY, + operation: e.identity.OPERATION_ATTACH, + data: { + externalId: t, + authenticationType: i, + authenticationToken: a, + }, + callback: n, + }); + }), + (e.identity.mergeIdentity = function (t, a, i, n) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_IDENTITY, + operation: e.identity.OPERATION_MERGE, + data: { + externalId: t, + authenticationType: i, + authenticationToken: a, + }, + callback: n, + }); + }), + (e.identity.detachIdentity = function (t, a, i, n) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_IDENTITY, + operation: e.identity.OPERATION_DETACH, + data: { + externalId: t, + authenticationType: a, + confirmAnonymous: i, + }, + callback: n, + }); + }), + (e.identity.switchToChildProfileInternal = function ( + t, + a, + i, + n, + s, + ) { + var o = + window.navigator.userLanguage || window.navigator.language, + r = (o = o.split("-"))[0], + l = o[1], + c = -new Date().getTimezoneOffset() / 60; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_IDENTITY, + operation: e.identity.OPERATION_SWITCH_TO_CHILD_PROFILE, + data: { + profileId: t, + gameId: a, + forceCreate: i, + forceSingleton: n, + releasePlatform: "WEB", + timeZoneOffset: c, + languageCode: r, + countryCode: l, + }, + callback: s, + }); + })); + } + function T() { + var e = this; + ((e.itemCatalog = {}), + (e.SERVICE_ITEMCATALOG = "itemCatalog"), + (e.itemCatalog.OPERATION_GET_CATALOG_ITEM_DEFINITION = + "GET_CATALOG_ITEM_DEFINITION"), + (e.itemCatalog.OPERATION_GET_CATALOG_ITEMS_PAGE = + "GET_CATALOG_ITEMS_PAGE"), + (e.itemCatalog.OPERATION_GET_CATALOG_ITEMS_PAGE_OFFSET = + "GET_CATALOG_ITEMS_PAGE_OFFSET"), + (e.itemCatalog.getCatalogItemDefinition = function (t, a) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_ITEMCATALOG, + operation: e.itemCatalog.OPERATION_GET_CATALOG_ITEM_DEFINITION, + data: { defId: t }, + callback: a, + }); + }), + (e.itemCatalog.getCatalogItemsPage = function (t, a) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_ITEMCATALOG, + operation: e.itemCatalog.OPERATION_GET_CATALOG_ITEMS_PAGE, + data: { context: t }, + callback: a, + }); + }), + (e.itemCatalog.getCatalogItemsPageOffset = function (t, a, i) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_ITEMCATALOG, + operation: + e.itemCatalog.OPERATION_GET_CATALOG_ITEMS_PAGE_OFFSET, + data: { context: t, pageOffset: a }, + callback: i, + }); + })); + } + function R() { + var e = this; + ((e.lobby = {}), + (e.SERVICE_LOBBY = "lobby"), + (e.lobby.OPERATION_CREATE_LOBBY = "CREATE_LOBBY"), + (e.lobby.OPERATION_CREATE_LOBBY_WITH_PING_DATA = + "CREATE_LOBBY_WITH_PING_DATA"), + (e.lobby.OPERATION_FIND_LOBBY = "FIND_LOBBY"), + (e.lobby.OPERATION_FIND_LOBBY_WITH_PING_DATA = + "FIND_LOBBY_WITH_PING_DATA"), + (e.lobby.OPERATION_FIND_OR_CREATE_LOBBY = "FIND_OR_CREATE_LOBBY"), + (e.lobby.OPERATION_FIND_OR_CREATE_LOBBY_WITH_PING_DATA = + "FIND_OR_CREATE_LOBBY_WITH_PING_DATA"), + (e.lobby.OPERATION_GET_LOBBY_DATA = "GET_LOBBY_DATA"), + (e.lobby.OPERATION_LEAVE_LOBBY = "LEAVE_LOBBY"), + (e.lobby.OPERATION_JOIN_LOBBY = "JOIN_LOBBY"), + (e.lobby.OPERATION_JOIN_LOBBY_WITH_PING_DATA = + "JOIN_LOBBY_WITH_PING_DATA"), + (e.lobby.OPERATION_REMOVE_MEMBER = "REMOVE_MEMBER"), + (e.lobby.OPERATION_SEND_SIGNAL = "SEND_SIGNAL"), + (e.lobby.OPERATION_SWITCH_TEAM = "SWITCH_TEAM"), + (e.lobby.OPERATION_UPDATE_READY = "UPDATE_READY"), + (e.lobby.OPERATION_UPDATE_SETTINGS = "UPDATE_SETTINGS"), + (e.lobby.OPERATION_CANCEL_FIND_REQUEST = "CANCEL_FIND_REQUEST"), + (e.lobby.OPERATION_GET_REGIONS_FOR_LOBBIES = + "GET_REGIONS_FOR_LOBBIES"), + (e.lobby.OPERATION_PING_REGIONS = "PING_REGIONS"), + (e.lobby.OPERATION_GET_LOBBY_INSTANCES = "GET_LOBBY_INSTANCES"), + (e.lobby.OPERATION_GET_LOBBY_INSTANCES_WITH_PING_DATA = + "GET_LOBBY_INSTANCES_WITH_PING_DATA")); + var t = null, + a = null, + i = [], + n = 0; + function s(e) { + e({ status: 200, data: t }); + } + function o(e, a, r) { + if (a.length >= 4) { + a.sort(function (e, t) { + return e - t; + }); + for (var l = 0, c = 0; c < a.length - 1; ++c) l += a[c]; + ((l /= a.length - 1), + (t[e.name] = Math.round(l)), + i.length > 0 + ? o((e = i.splice(0, 1)[0]), [], r) + : Object.keys(t).length == n && s(r)); + } else + !(function (e, t) { + var a, + i = false, + n = "http://" + e.url; + a = window.XMLHttpRequest + ? new XMLHttpRequest() + : new ActiveXObject("Microsoft.XMLHTTP"); + var s = false, + o = setTimeout(function () { + ((s = true), a.abort(), t(999)); + }, 2e3), + r = 0; + ((a.onreadystatechange = function () { + if (!s && a.readyState == XMLHttpRequest.DONE) { + (s || clearTimeout(o), 200 == a.status && (i = true)); + var e = new Date().getTime(), + n = Math.min(999, e - r); + ((n < 0 || !i) && (n = 999), t(n)); + } + }), + a.open("GET", n, true), + a.setRequestHeader("Access-Control-Allow-Origin", ":*"), + a.setRequestHeader("Access-Control-Allow-Headers", ":*"), + (r = new Date().getTime()), + a.send()); + })(e, function (t) { + (a.push(t), o(e, a, r)); + }); + } + function r(a, i, n) { + t && Object.keys(t).length > 0 + ? ((a.pingData = t), e.brainCloudManager.sendRequest({ - service: e.SERVICE_GROUP, - operation: e.group.OPERATION_READ_GROUP_ENTITIES_PAGE_BY_OFFSET, - data: n, - callback: i, + service: e.SERVICE_LOBBY, + operation: i, + data: a, + callback: n, + })) + : setTimeout(function () { + n({ + status: e.statusCodes.BAD_REQUEST, + reason_code: e.reasonCodes.MISSING_REQUIRED_PARAMETER, + status_message: + "Required Parameter 'pingData' is missing. Please ensure 'pingData' exists by first calling GetRegionsForLobbies and PingRegions, and waiting for response before proceeding.", + severity: "ERROR", }); - }), - (e.group.readGroupEntity = function (t, a, i) { - var n = { groupId: t, entityId: a }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_GROUP, - operation: e.group.OPERATION_READ_GROUP_ENTITY, - data: n, - callback: i, - }); - }), - (e.group.readGroupMembers = function (t, a) { - var i = { groupId: t }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_GROUP, - operation: e.group.OPERATION_READ_GROUP_MEMBERS, - data: i, - callback: a, - }); - }), - (e.group.rejectGroupInvitation = function (t, a) { - var i = { groupId: t }; + }, 0); + } + ((e.lobby.createLobby = function (t, a, i, n, s, o, r, l) { + var c = { + lobbyType: t, + rating: a, + otherUserCxIds: i, + isReady: n, + extraJson: s, + teamCode: o, + settings: r, + }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_LOBBY, + operation: e.lobby.OPERATION_CREATE_LOBBY, + data: c, + callback: l, + }); + }), + (e.lobby.createLobbyWithPingData = function ( + t, + a, + i, + n, + s, + o, + l, + c, + ) { + r( + { + lobbyType: t, + rating: a, + otherUserCxIds: i, + isReady: n, + extraJson: s, + teamCode: o, + settings: l, + }, + e.lobby.OPERATION_CREATE_LOBBY_WITH_PING_DATA, + c, + ); + }), + (e.lobby.findLobby = function (t, a, i, n, s, o, r, l, c, d) { + var u = { + lobbyType: t, + rating: a, + maxSteps: i, + algo: n, + filterJson: s, + otherUserCxIds: o, + isReady: r, + extraJson: l, + teamCode: c, + }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_LOBBY, + operation: e.lobby.OPERATION_FIND_LOBBY, + data: u, + callback: d, + }); + }), + (e.lobby.findLobbyWithPingData = function ( + t, + a, + i, + n, + s, + o, + l, + c, + d, + u, + ) { + r( + { + lobbyType: t, + rating: a, + maxSteps: i, + algo: n, + filterJson: s, + otherUserCxIds: o, + isReady: l, + extraJson: c, + teamCode: d, + }, + e.lobby.OPERATION_FIND_LOBBY_WITH_PING_DATA, + u, + ); + }), + (e.lobby.findOrCreateLobby = function ( + t, + a, + i, + n, + s, + o, + r, + l, + c, + d, + u, + ) { + var h = { + lobbyType: t, + rating: a, + maxSteps: i, + algo: n, + filterJson: s, + otherUserCxIds: o, + settings: r, + isReady: l, + extraJson: c, + teamCode: d, + }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_LOBBY, + operation: e.lobby.OPERATION_FIND_OR_CREATE_LOBBY, + data: h, + callback: u, + }); + }), + (e.lobby.findOrCreateLobbyWithPingData = function ( + t, + a, + i, + n, + s, + o, + l, + c, + d, + u, + h, + ) { + r( + { + lobbyType: t, + rating: a, + maxSteps: i, + algo: n, + filterJson: s, + otherUserCxIds: o, + settings: l, + isReady: c, + extraJson: d, + teamCode: u, + }, + e.lobby.OPERATION_FIND_OR_CREATE_LOBBY_WITH_PING_DATA, + h, + ); + }), + (e.lobby.getLobbyData = function (t, a) { + var i = { lobbyId: t }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_LOBBY, + operation: e.lobby.OPERATION_GET_LOBBY_DATA, + data: i, + callback: a, + }); + }), + (e.lobby.leaveLobby = function (t, a) { + var i = { lobbyId: t }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_LOBBY, + operation: e.lobby.OPERATION_LEAVE_LOBBY, + data: i, + callback: a, + }); + }), + (e.lobby.joinLobby = function (t, a, i, n, s, o) { + var r = { + lobbyId: t, + isReady: a, + extraJson: i, + teamCode: n, + otherUserCxIds: s, + }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_LOBBY, + operation: e.lobby.OPERATION_JOIN_LOBBY, + data: r, + callback: o, + }); + }), + (e.lobby.joinLobbyWithPingData = function (t, a, i, n, s, o) { + r( + { + lobbyId: t, + isReady: a, + extraJson: i, + teamCode: n, + otherUserCxIds: s, + }, + e.lobby.OPERATION_JOIN_LOBBY_WITH_PING_DATA, + o, + ); + }), + (e.lobby.removeMember = function (t, a, i) { + var n = { lobbyId: t, cxId: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_LOBBY, + operation: e.lobby.OPERATION_REMOVE_MEMBER, + data: n, + callback: i, + }); + }), + (e.lobby.sendSignal = function (t, a, i) { + var n = { lobbyId: t, signalData: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_LOBBY, + operation: e.lobby.OPERATION_SEND_SIGNAL, + data: n, + callback: i, + }); + }), + (e.lobby.switchTeam = function (t, a, i) { + var n = { lobbyId: t, toTeamCode: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_LOBBY, + operation: e.lobby.OPERATION_SWITCH_TEAM, + data: n, + callback: i, + }); + }), + (e.lobby.updateReady = function (t, a, i, n) { + var s = { lobbyId: t, isReady: a, extraJson: i }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_LOBBY, + operation: e.lobby.OPERATION_UPDATE_READY, + data: s, + callback: n, + }); + }), + (e.lobby.updateSettings = function (t, a, i) { + var n = { lobbyId: t, settings: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_LOBBY, + operation: e.lobby.OPERATION_UPDATE_SETTINGS, + data: n, + callback: i, + }); + }), + (e.lobby.cancelFindRequest = function (t, a) { + var i = { lobbyType: t, cxId: e.rttService.getRTTConnectionId() }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_LOBBY, + operation: e.lobby.OPERATION_CANCEL_FIND_REQUEST, + data: i, + callback: a, + }); + }), + (e.lobby.getRegionsForLobbies = function (t, i) { + var n = { lobbyTypes: t }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_LOBBY, + operation: e.lobby.OPERATION_GET_REGIONS_FOR_LOBBIES, + data: n, + callback: function (e) { + (200 == e.status && (a = e.data.regionPingData), i(e)); + }, + }); + }), + (e.lobby.getLobbyInstances = function (t, a, i) { + var n = { lobbyType: t, criteriaJson: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_LOBBY, + operation: e.lobby.OPERATION_GET_LOBBY_INSTANCES, + data: n, + callback: i, + }); + }), + (e.lobby.getLobbyInstancesWithPingData = function (t, a, i) { + r( + { lobbyType: t, criteriaJson: a }, + e.lobby.OPERATION_GET_LOBBY_INSTANCES_WITH_PING_DATA, + i, + ); + }), + (e.lobby.pingRegions = function (r) { + if (((t = {}), a)) { + i = []; + for (var l = Object.keys(a), c = 0; c < l.length; ++c) { + var d = l[c]; + (u = a[d]) && + u.target && + "PING" == u.type && + i.push({ name: d, url: u.target }); + } + if (0 == (n = i.length)) + setTimeout(function () { + s(r); + }, 0); + else + for (c = 0; c < 2; ++c) { + var u; + i.length > 0 && o((u = i.splice(0, 1)[0]), [], r); + } + } else + setTimeout(function () { + r({ + status: e.statusCodes.BAD_REQUEST, + reason_code: e.reasonCodes.MISSING_REQUIRED_PARAMETER, + status_message: + "No Regions to Ping. Please call GetRegionsForLobbies and await the response before calling PingRegions", + severity: "ERROR", + }); + }, 0); + })); + } + function O() { + var e = this; + ((e.mail = {}), + (e.SERVICE_MAIL = "mail"), + (e.mail.OPERATION_SEND_BASIC_EMAIL = "SEND_BASIC_EMAIL"), + (e.mail.OPERATION_SEND_ADVANCED_EMAIL = "SEND_ADVANCED_EMAIL"), + (e.mail.OPERATION_SEND_ADVANCED_EMAIL_BY_ADDRESS = + "SEND_ADVANCED_EMAIL_BY_ADDRESS"), + (e.mail.sendBasicEmail = function (t, a, i, n) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_MAIL, + operation: e.mail.OPERATION_SEND_BASIC_EMAIL, + data: { profileId: t, subject: a, body: i }, + callback: n, + }); + }), + (e.mail.sendAdvancedEmail = function (t, a, i) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_MAIL, + operation: e.mail.OPERATION_SEND_ADVANCED_EMAIL, + data: { profileId: t, serviceParams: a }, + callback: i, + }); + }), + (e.mail.sendAdvancedEmailByAddress = function (t, a, i) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_MAIL, + operation: e.mail.OPERATION_SEND_ADVANCED_EMAIL_BY_ADDRESS, + data: { emailAddress: t, serviceParams: a }, + callback: i, + }); + })); + } + function C() { + var e = this; + ((e.matchMaking = {}), + (e.SERVICE_MATCH_MAKING = "matchMaking"), + (e.matchMaking.OPERATION_READ = "READ"), + (e.matchMaking.OPERATION_SET_PLAYER_RATING = "SET_PLAYER_RATING"), + (e.matchMaking.OPERATION_RESET_PLAYER_RATING = + "RESET_PLAYER_RATING"), + (e.matchMaking.OPERATION_INCREMENT_PLAYER_RATING = + "INCREMENT_PLAYER_RATING"), + (e.matchMaking.OPERATION_DECREMENT_PLAYER_RATING = + "DECREMENT_PLAYER_RATING"), + (e.matchMaking.OPERATION_TURN_SHIELD_ON = "SHIELD_ON"), + (e.matchMaking.OPERATION_TURN_SHIELD_ON_FOR = "SHIELD_ON_FOR"), + (e.matchMaking.OPERATION_TURN_SHIELD_OFF = "SHIELD_OFF"), + (e.matchMaking.OPERATION_INCREMENT_SHIELD_ON_FOR = + "INCREMENT_SHIELD_ON_FOR"), + (e.matchMaking.OPERATION_GET_SHIELD_EXPIRY = "GET_SHIELD_EXPIRY"), + (e.matchMaking.OPERATION_FIND_PLAYERS = "FIND_PLAYERS"), + (e.matchMaking.OPERATION_FIND_PLAYERS_USING_FILTER = + "FIND_PLAYERS_USING_FILTER"), + (e.matchMaking.OPERATION_ENABLE_MATCH_MAKING = "ENABLE_FOR_MATCH"), + (e.matchMaking.OPERATION_DISABLE_MATCH_MAKING = + "DISABLE_FOR_MATCH"), + (e.matchMaking.read = function (t) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_MATCH_MAKING, + operation: e.matchMaking.OPERATION_READ, + data: {}, + callback: t, + }); + }), + (e.matchMaking.setPlayerRating = function (t, a) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_MATCH_MAKING, + operation: e.matchMaking.OPERATION_SET_PLAYER_RATING, + data: { playerRating: t }, + callback: a, + }); + }), + (e.matchMaking.resetPlayerRating = function (t) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_MATCH_MAKING, + operation: e.matchMaking.OPERATION_RESET_PLAYER_RATING, + data: {}, + callback: t, + }); + }), + (e.matchMaking.incrementPlayerRating = function (t, a) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_MATCH_MAKING, + operation: e.matchMaking.OPERATION_INCREMENT_PLAYER_RATING, + data: { playerRating: t }, + callback: a, + }); + }), + (e.matchMaking.decrementPlayerRating = function (t, a) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_MATCH_MAKING, + operation: e.matchMaking.OPERATION_DECREMENT_PLAYER_RATING, + data: { playerRating: t }, + callback: a, + }); + }), + (e.matchMaking.turnShieldOn = function (t) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_MATCH_MAKING, + operation: e.matchMaking.OPERATION_TURN_SHIELD_ON, + data: {}, + callback: t, + }); + }), + (e.matchMaking.turnShieldOnFor = function (t, a) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_MATCH_MAKING, + operation: e.matchMaking.OPERATION_TURN_SHIELD_ON_FOR, + data: { minutes: t }, + callback: a, + }); + }), + (e.matchMaking.turnShieldOff = function (t) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_MATCH_MAKING, + operation: e.matchMaking.OPERATION_TURN_SHIELD_OFF, + data: {}, + callback: t, + }); + }), + (e.matchMaking.incrementShieldOnFor = function (t, a) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_MATCH_MAKING, + operation: e.matchMaking.OPERATION_INCREMENT_SHIELD_ON_FOR, + data: { minutes: t }, + callback: a, + }); + }), + (e.matchMaking.getShieldExpiry = function (t, a) { + var i = {}; + (t && (i.playerId = t), e.brainCloudManager.sendRequest({ - service: e.SERVICE_GROUP, - operation: e.group.OPERATION_REJECT_GROUP_INVITATION, + service: e.SERVICE_MATCH_MAKING, + operation: e.matchMaking.OPERATION_GET_SHIELD_EXPIRY, data: i, callback: a, - }); - }), - (e.group.rejectGroupJoinRequest = function (t, a, i) { - var n = { groupId: t, profileId: a }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_GROUP, - operation: e.group.OPERATION_REJECT_GROUP_JOIN_REQUEST, - data: n, - callback: i, - }); - }), - (e.group.removeGroupMember = function (t, a, i) { - var n = { groupId: t, profileId: a }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_GROUP, - operation: e.group.OPERATION_REMOVE_GROUP_MEMBER, - data: n, - callback: i, - }); - }), - (e.group.setGroupOpen = function (t, a, i) { - var n = { groupId: t, isOpenGroup: a }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_GROUP, - operation: e.group.OPERATION_SET_GROUP_OPEN, - data: n, - callback: i, - }); - }), - (e.group.updateGroupData = function (t, a, i, n) { - var s = { groupId: t, version: a, data: i }; + })); + }), + (e.matchMaking.findPlayers = function (t, a, i) { + e.matchMaking.findPlayersWithAttributes(t, a, null, i); + }), + (e.matchMaking.findPlayersWithAttributes = function (t, a, i, n) { + var s = { rangeDelta: t, numMatches: a }; + (i && (s.attributes = i), e.brainCloudManager.sendRequest({ - service: e.SERVICE_GROUP, - operation: e.group.OPERATION_UPDATE_GROUP_DATA, + service: e.SERVICE_MATCH_MAKING, + operation: e.matchMaking.OPERATION_FIND_PLAYERS, data: s, callback: n, - }); - }), - (e.group.updateGroupEntityData = function (t, a, i, n, s) { - var o = { groupId: t, entityId: a, version: i, data: n }; + })); + }), + (e.matchMaking.findPlayersUsingFilter = function (t, a, i, n) { + e.matchMaking.findPlayersWithAttributesUsingFilter( + t, + a, + null, + i, + n, + ); + }), + (e.matchMaking.findPlayersWithAttributesUsingFilter = function ( + t, + a, + i, + n, + s, + ) { + var o = { rangeDelta: t, numMatches: a }; + (i && (o.attributes = i), + n && (o.extraParms = n), e.brainCloudManager.sendRequest({ - service: e.SERVICE_GROUP, - operation: e.group.OPERATION_UPDATE_GROUP_ENTITY, + service: e.SERVICE_MATCH_MAKING, + operation: e.matchMaking.OPERATION_FIND_PLAYERS_USING_FILTER, data: o, callback: s, - }); - }), - (e.group.updateGroupMember = function (t, a, i, n, s) { - var o = { groupId: t, profileId: a }; - (i && (o.role = i), - n && (o.attributes = n), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_GROUP, - operation: e.group.OPERATION_UPDATE_GROUP_MEMBER, - data: o, - callback: s, - })); - }), - (e.group.updateGroupName = function (t, a, i) { - var n = { groupId: t, name: a }; + })); + }), + (e.matchMaking.enableMatchMaking = function (t) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_MATCH_MAKING, + operation: e.matchMaking.OPERATION_ENABLE_MATCH_MAKING, + data: {}, + callback: t, + }); + }), + (e.matchMaking.disableMatchMaking = function (t) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_MATCH_MAKING, + operation: e.matchMaking.OPERATION_DISABLE_MATCH_MAKING, + data: {}, + callback: t, + }); + })); + } + function w() { + var e = this; + ((e.messaging = {}), + (e.SERVICE_MESSAGING = "messaging"), + (e.messaging.OPERATION_DELETE_MESSAGES = "DELETE_MESSAGES"), + (e.messaging.OPERATION_GET_MESSAGE_BOXES = "GET_MESSAGE_BOXES"), + (e.messaging.OPERATION_GET_MESSAGE_COUNTS = "GET_MESSAGE_COUNTS"), + (e.messaging.OPERATION_GET_MESSAGES = "GET_MESSAGES"), + (e.messaging.OPERATION_GET_MESSAGES_PAGE = "GET_MESSAGES_PAGE"), + (e.messaging.OPERATION_GET_MESSAGES_PAGE_OFFSET = + "GET_MESSAGES_PAGE_OFFSET"), + (e.messaging.OPERATION_MARK_MESSAGES_READ = "MARK_MESSAGES_READ"), + (e.messaging.OPERATION_SEND_MESSAGE = "SEND_MESSAGE"), + (e.messaging.OPERATION_SEND_MESSAGE_SIMPLE = "SEND_MESSAGE_SIMPLE"), + (e.messaging.deleteMessages = function (t, a, i) { + var n = { msgbox: t, msgIds: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_MESSAGING, + operation: e.messaging.OPERATION_DELETE_MESSAGES, + data: n, + callback: i, + }); + }), + (e.messaging.getMessageboxes = function (t) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_MESSAGING, + operation: e.messaging.OPERATION_GET_MESSAGE_BOXES, + data: {}, + callback: t, + }); + }), + (e.messaging.getMessageCounts = function (t) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_MESSAGING, + operation: e.messaging.OPERATION_GET_MESSAGE_COUNTS, + data: {}, + callback: t, + }); + }), + (e.messaging.getMessages = function (t, a, i, n) { + var s = { msgbox: t, msgIds: a, markMessageRead: i }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_MESSAGING, + operation: e.messaging.OPERATION_GET_MESSAGES, + data: s, + callback: n, + }); + }), + (e.messaging.getMessagesPage = function (t, a) { + var i = { context: t }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_MESSAGING, + operation: e.messaging.OPERATION_GET_MESSAGES_PAGE, + data: i, + callback: a, + }); + }), + (e.messaging.getMessagesPageOffset = function (t, a, i) { + var n = { context: t, pageOffset: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_MESSAGING, + operation: e.messaging.OPERATION_GET_MESSAGES_PAGE_OFFSET, + data: n, + callback: i, + }); + }), + (e.messaging.sendMessage = function (t, a, i) { + var n = { toProfileIds: t, contentJson: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_MESSAGING, + operation: e.messaging.OPERATION_SEND_MESSAGE, + data: n, + callback: i, + }); + }), + (e.messaging.sendMessageSimple = function (t, a, i) { + var n = { toProfileIds: t, text: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_MESSAGING, + operation: e.messaging.OPERATION_SEND_MESSAGE_SIMPLE, + data: n, + callback: i, + }); + }), + (e.messaging.markMessagesRead = function (t, a, i) { + var n = { msgbox: t, msgIds: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_MESSAGING, + operation: e.messaging.OPERATION_MARK_MESSAGES_READ, + data: n, + callback: i, + }); + })); + } + function A() { + var e = this; + ((e.oneWayMatch = {}), + (e.SERVICE_ONE_WAY_MATCH = "onewayMatch"), + (e.oneWayMatch.OPERATION_START_MATCH = "START_MATCH"), + (e.oneWayMatch.OPERATION_CANCEL_MATCH = "CANCEL_MATCH"), + (e.oneWayMatch.OPERATION_COMPLETE_MATCH = "COMPLETE_MATCH"), + (e.oneWayMatch.startMatch = function (t, a, i) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_ONE_WAY_MATCH, + operation: e.oneWayMatch.OPERATION_START_MATCH, + data: { playerId: t, rangeDelta: a }, + callback: i, + }); + }), + (e.oneWayMatch.cancelMatch = function (t, a) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_ONE_WAY_MATCH, + operation: e.oneWayMatch.OPERATION_CANCEL_MATCH, + data: { playbackStreamId: t }, + callback: a, + }); + }), + (e.oneWayMatch.completeMatch = function (t, a) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_ONE_WAY_MATCH, + operation: e.oneWayMatch.OPERATION_COMPLETE_MATCH, + data: { playbackStreamId: t }, + callback: a, + }); + })); + } + function k() { + var e = this; + ((e.playbackStream = {}), + (e.SERVICE_PLAYBACK_STREAM = "playbackStream"), + (e.playbackStream.OPERATION_START_STREAM = "START_STREAM"), + (e.playbackStream.OPERATION_READ_STREAM = "READ_STREAM"), + (e.playbackStream.OPERATION_END_STREAM = "END_STREAM"), + (e.playbackStream.OPERATION_DELETE_STREAM = "DELETE_STREAM"), + (e.playbackStream.OPERATION_ADD_EVENT = "ADD_EVENT"), + (e.playbackStream.OPERATION_GET_STREAM_SUMMARIES_FOR_INITIATING_PLAYER = + "GET_STREAM_SUMMARIES_FOR_INITIATING_PLAYER"), + (e.playbackStream.OPERATION_GET_STREAM_SUMMARIES_FOR_TARGET_PLAYER = + "GET_STREAM_SUMMARIES_FOR_TARGET_PLAYER"), + (e.playbackStream.OPERATION_GET_RECENT_STREAMS_FOR_INITIATING_PLAYER = + "GET_RECENT_STREAMS_FOR_INITIATING_PLAYER"), + (e.playbackStream.OPERATION_GET_RECENT_STREAMS_FOR_TARGET_PLAYER = + "GET_RECENT_STREAMS_FOR_TARGET_PLAYER"), + (e.playbackStream.startStream = function (t, a, i) { + var n = { targetPlayerId: t, includeSharedData: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_PLAYBACK_STREAM, + operation: e.playbackStream.OPERATION_START_STREAM, + data: n, + callback: i, + }); + }), + (e.playbackStream.readStream = function (t, a) { + var i = { playbackStreamId: t }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_PLAYBACK_STREAM, + operation: e.playbackStream.OPERATION_READ_STREAM, + data: i, + callback: a, + }); + }), + (e.playbackStream.endStream = function (t, a) { + var i = { playbackStreamId: t }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_PLAYBACK_STREAM, + operation: e.playbackStream.OPERATION_END_STREAM, + data: i, + callback: a, + }); + }), + (e.playbackStream.deleteStream = function (t, a) { + var i = { playbackStreamId: t }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_PLAYBACK_STREAM, + operation: e.playbackStream.OPERATION_DELETE_STREAM, + data: i, + callback: a, + }); + }), + (e.playbackStream.addEvent = function (t, a, i, n) { + var s = { playbackStreamId: t, eventData: a, summary: i }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_PLAYBACK_STREAM, + operation: e.playbackStream.OPERATION_ADD_EVENT, + data: s, + callback: n, + }); + }), + (e.playbackStream.getRecentStreamsForInitiatingPlayer = function ( + t, + a, + i, + ) { + var n = { initiatingPlayerId: t, maxNumStreams: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_PLAYBACK_STREAM, + operation: + e.playbackStream + .OPERATION_GET_RECENT_STREAMS_FOR_INITIATING_PLAYER, + data: n, + callback: i, + }); + }), + (e.playbackStream.getRecentStreamsForTargetPlayer = function ( + t, + a, + i, + ) { + var n = { targetPlayerId: t, maxNumStreams: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_PLAYBACK_STREAM, + operation: + e.playbackStream + .OPERATION_GET_RECENT_STREAMS_FOR_TARGET_PLAYER, + data: n, + callback: i, + }); + })); + } + function N() { + var e = this; + ((e.playerState = {}), + (e.SERVICE_PLAYERSTATE = "playerState"), + (e.playerState.OPERATION_SEND = "SEND"), + (e.playerState.OPERATION_UPDATE_EVENT_DATA = "UPDATE_EVENT_DATA"), + (e.playerState.OPERATION_DELETE_INCOMING = "DELETE_INCOMING"), + (e.playerState.OPERATION_DELETE_SENT = "DELETE_SENT"), + (e.playerState.OPERATION_FULL_PLAYER_RESET = "FULL_PLAYER_RESET"), + (e.playerState.OPERATION_GAME_DATA_RESET = "GAME_DATA_RESET"), + (e.playerState.OPERATION_UPDATE_SUMMARY = "UPDATE_SUMMARY"), + (e.playerState.OPERATION_READ_FRIENDS = "READ_FRIENDS"), + (e.playerState.OPERATION_READ_FRIEND_PLAYER_STATE = + "READ_FRIEND_PLAYER_STATE"), + (e.playerState.UPDATE_ATTRIBUTES = "UPDATE_ATTRIBUTES"), + (e.playerState.REMOVE_ATTRIBUTES = "REMOVE_ATTRIBUTES"), + (e.playerState.GET_ATTRIBUTES = "GET_ATTRIBUTES"), + (e.playerState.UPDATE_PICTURE_URL = "UPDATE_PICTURE_URL"), + (e.playerState.UPDATE_CONTACT_EMAIL = "UPDATE_CONTACT_EMAIL"), + (e.playerState.OPERATION_READ = "READ"), + (e.playerState.OPERATION_UPDATE_NAME = "UPDATE_NAME"), + (e.playerState.OPERATION_LOGOUT = "LOGOUT"), + (e.playerState.OPERATION_CLEAR_USER_STATUS = "CLEAR_USER_STATUS"), + (e.playerState.OPERATION_EXTEND_USER_STATUS = "EXTEND_USER_STATUS"), + (e.playerState.OPERATION_GET_USER_STATUS = "GET_USER_STATUS"), + (e.playerState.OPERATION_SET_USER_STATUS = "SET_USER_STATUS"), + (e.playerState.OPERATION_UPDATE_TIME_ZONE_OFFSET = + "UPDATE_TIMEZONE_OFFSET"), + (e.playerState.OPERATION_UPDATE_LANGUAGE_CODE = + "UPDATE_LANGUAGE_CODE"), + (e.playerState.userPlayer = function (t) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_PLAYERSTATE, + operation: e.playerState.OPERATION_FULL_PLAYER_RESET, + callback: t, + }); + }), + (e.playerState.deleteUser = function (t) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_PLAYERSTATE, + operation: e.playerState.OPERATION_FULL_PLAYER_RESET, + callback: t, + }); + }), + (e.playerState.getAttributes = function (t) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_PLAYERSTATE, + operation: e.playerState.GET_ATTRIBUTES, + callback: t, + }); + }), + (e.playerState.logout = function (t) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_PLAYERSTATE, + operation: e.playerState.OPERATION_LOGOUT, + callback: t, + }); + }), + (e.playerState.readUserState = function (t) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_PLAYERSTATE, + operation: e.playerState.OPERATION_READ, + callback: t, + }); + }), + (e.playerState.removeAttributes = function (t, a) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_PLAYERSTATE, + operation: e.playerState.REMOVE_ATTRIBUTES, + data: { attributes: t }, + callback: a, + }); + }), + (e.playerState.updateTimeZoneOffset = function (t, a) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_PLAYERSTATE, + operation: e.playerState.OPERATION_UPDATE_TIME_ZONE_OFFSET, + data: { timeZoneOffset: t }, + callback: a, + }); + }), + (e.playerState.updateLanguageCode = function (t, a) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_PLAYERSTATE, + operation: e.playerState.OPERATION_UPDATE_LANGUAGE_CODE, + data: { languageCode: t }, + callback: a, + }); + }), + (e.playerState.resetUser = function (t) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_PLAYERSTATE, + operation: e.playerState.OPERATION_GAME_DATA_RESET, + callback: t, + }); + }), + (e.playerState.updateAttributes = function (t, a, i) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_PLAYERSTATE, + operation: e.playerState.UPDATE_ATTRIBUTES, + data: { attributes: t, wipeExisting: a }, + callback: i, + }); + }), + (e.playerState.updateUserName = function (t, a) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_PLAYERSTATE, + operation: e.playerState.OPERATION_UPDATE_NAME, + data: { playerName: t }, + callback: a, + }); + }), + (e.playerState.updateName = function (t, a) { + e.playerState.updateUserName(t, a); + }), + (e.playerState.updateSummaryFriendData = function (t, a) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_PLAYERSTATE, + operation: e.playerState.OPERATION_UPDATE_SUMMARY, + data: { summaryFriendData: t }, + callback: a, + }); + }), + (e.playerState.updateUserPictureUrl = function (t, a) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_PLAYERSTATE, + operation: e.playerState.UPDATE_PICTURE_URL, + data: { playerPictureUrl: t }, + callback: a, + }); + }), + (e.playerState.updateContactEmail = function (t, a) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_PLAYERSTATE, + operation: e.playerState.UPDATE_CONTACT_EMAIL, + data: { contactEmail: t }, + callback: a, + }); + }), + (e.playerState.clearUserStatus = function (t, a) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_PLAYERSTATE, + operation: e.playerState.OPERATION_CLEAR_USER_STATUS, + data: { statusName: t }, + callback: a, + }); + }), + (e.playerState.extendUserStatus = function (t, a, i, n) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_PLAYERSTATE, + operation: e.playerState.OPERATION_EXTEND_USER_STATUS, + data: { statusName: t, additionalSecs: a, details: i }, + callback: n, + }); + }), + (e.playerState.getUserStatus = function (t, a) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_PLAYERSTATE, + operation: e.playerState.OPERATION_GET_USER_STATUS, + data: { statusName: t }, + callback: a, + }); + }), + (e.playerState.setUserStatus = function (t, a, i, n) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_PLAYERSTATE, + operation: e.playerState.OPERATION_SET_USER_STATUS, + data: { statusName: t, durationSecs: a, details: i }, + callback: n, + }); + })); + } + function x() { + var e = this; + ((e.playerStatisticsEvent = {}), + (e.SERVICE_PLAYER_STATISTICS_EVENT = "playerStatisticsEvent"), + (e.playerStatisticsEvent.OPERATION_TRIGGER = "TRIGGER"), + (e.playerStatisticsEvent.OPERATION_TRIGGER_MULTIPLE = + "TRIGGER_MULTIPLE"), + (e.playerStatisticsEvent.triggerUserStatsEvent = function ( + t, + a, + i, + ) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_PLAYER_STATISTICS_EVENT, + operation: e.playerStatisticsEvent.OPERATION_TRIGGER, + data: { eventName: t, eventMultiplier: a }, + callback: i, + }); + }), + (e.playerStatisticsEvent.triggerStatsEvent = function (t, a, i) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_PLAYER_STATISTICS_EVENT, + operation: e.playerStatisticsEvent.OPERATION_TRIGGER, + data: { eventName: t, eventMultiplier: a }, + callback: i, + }); + }), + (e.playerStatisticsEvent.triggerUserStatsEvents = function (t, a) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_PLAYER_STATISTICS_EVENT, + operation: e.playerStatisticsEvent.OPERATION_TRIGGER_MULTIPLE, + data: { events: t }, + callback: a, + }); + }), + (e.playerStatisticsEvent.triggerStatsEvents = function (t, a) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_PLAYER_STATISTICS_EVENT, + operation: e.playerStatisticsEvent.OPERATION_TRIGGER_MULTIPLE, + data: { events: t }, + callback: a, + }); + })); + } + function P() { + var e = this; + ((e.playerStatistics = {}), + (e.SERVICE_PLAYER_STATISTICS = "playerStatistics"), + (e.playerStatistics.READ = "READ"), + (e.playerStatistics.READ_SUBSET = "READ_SUBSET"), + (e.playerStatistics.READ_SHARED = "READ_SHARED"), + (e.playerStatistics.READ_FOR_CATEGORY = "READ_FOR_CATEGORY"), + (e.playerStatistics.RESET = "RESET"), + (e.playerStatistics.UPDATE = "UPDATE"), + (e.playerStatistics.UPDATE_INCREMENT = "UPDATE_INCREMENT"), + (e.playerStatistics.UPDATE_SET_MINIMUM = "UPDATE_SET_MINIMUM"), + (e.playerStatistics.UPDATE_INCREMENT_TO_MAXIMUM = + "UPDATE_INCREMENT_TO_MAXIMUM"), + (e.playerStatistics.OPERATION_PROCESS_STATISTICS = + "PROCESS_STATISTICS"), + (e.playerStatistics.OPERATION_READ_NEXT_XPLEVEL = + "READ_NEXT_XPLEVEL"), + (e.playerStatistics.OPERATION_SET_XPPOINTS = "SET_XPPOINTS"), + (e.playerStatistics.getNextExperienceLevel = function (t) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_PLAYER_STATISTICS, + operation: e.playerStatistics.OPERATION_READ_NEXT_XPLEVEL, + callback: t, + }); + }), + (e.playerStatistics.incrementExperiencePoints = function (t, a) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_PLAYER_STATISTICS, + operation: e.playerStatistics.UPDATE, + data: { xp_points: t }, + callback: a, + }); + }), + (e.playerStatistics.incrementUserStats = function (t, a, i) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_PLAYER_STATISTICS, + operation: e.playerStatistics.UPDATE, + data: { statistics: t, xp_points: a }, + callback: i, + }); + }), + (e.playerStatistics.readAllUserStats = function (t) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_PLAYER_STATISTICS, + operation: e.playerStatistics.READ, + callback: t, + }); + }), + (e.playerStatistics.readUserStatsSubset = function (t, a) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_PLAYER_STATISTICS, + operation: e.playerStatistics.READ_SUBSET, + data: { statistics: t }, + callback: a, + }); + }), + (e.playerStatistics.readUserStatsForCategory = function (t, a) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_PLAYER_STATISTICS, + operation: e.playerStatistics.READ_FOR_CATEGORY, + data: { category: t }, + callback: a, + }); + }), + (e.playerStatistics.resetAllUserStats = function (t) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_PLAYER_STATISTICS, + operation: e.playerStatistics.RESET, + callback: t, + }); + }), + (e.playerStatistics.setExperiencePoints = function (t, a) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_PLAYER_STATISTICS, + operation: e.playerStatistics.OPERATION_SET_XPPOINTS, + data: { xp_points: t }, + callback: a, + }); + }), + (e.playerStatistics.processStatistics = function (t, a) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_PLAYER_STATISTICS, + operation: e.globalStatistics.OPERATION_PROCESS_STATISTICS, + data: { statistics: t }, + callback: a, + }); + })); + } + function M() { + var e = this; + ((e.presence = {}), + (e.SERVICE_PRESENCE = "presence"), + (e.presence.OPERATION_FORCE_PUSH = "FORCE_PUSH"), + (e.presence.OPERATION_GET_PRESENCE_OF_FRIENDS = + "GET_PRESENCE_OF_FRIENDS"), + (e.presence.OPERATION_GET_PRESENCE_OF_GROUP = + "GET_PRESENCE_OF_GROUP"), + (e.presence.OPERATION_GET_PRESENCE_OF_USERS = + "GET_PRESENCE_OF_USERS"), + (e.presence.OPERATION_REGISTER_LISTENERS_FOR_FRIENDS = + "REGISTER_LISTENERS_FOR_FRIENDS"), + (e.presence.OPERATION_REGISTER_LISTENERS_FOR_GROUP = + "REGISTER_LISTENERS_FOR_GROUP"), + (e.presence.OPERATION_REGISTER_LISTENERS_FOR_PROFILES = + "REGISTER_LISTENERS_FOR_PROFILES"), + (e.presence.OPERATION_SET_VISIBILITY = "SET_VISIBILITY"), + (e.presence.OPERATION_STOP_LISTENING = "STOP_LISTENING"), + (e.presence.OPERATION_UPDATE_ACTIVITY = "UPDATE_ACTIVITY"), + (e.presence.forcePush = function (t) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_PRESENCE, + operation: e.presence.OPERATION_FORCE_PUSH, + data: null, + callback: t, + }); + }), + (e.presence.getPresenceOfFriends = function (t, a, i) { + var n = { platform: t, includeOffline: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_PRESENCE, + operation: e.presence.OPERATION_GET_PRESENCE_OF_FRIENDS, + data: n, + callback: i, + }); + }), + (e.presence.getPresenceOfGroup = function (t, a, i) { + var n = { groupId: t, includeOffline: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_PRESENCE, + operation: e.presence.OPERATION_GET_PRESENCE_OF_GROUP, + data: n, + callback: i, + }); + }), + (e.presence.getPresenceOfUsers = function (t, a, i) { + var n = { profileIds: t, includeOffline: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_PRESENCE, + operation: e.presence.OPERATION_GET_PRESENCE_OF_USERS, + data: n, + callback: i, + }); + }), + (e.presence.registerListenersForFriends = function (t, a, i) { + var n = { platform: t, bidirectional: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_PRESENCE, + operation: e.presence.OPERATION_REGISTER_LISTENERS_FOR_FRIENDS, + data: n, + callback: i, + }); + }), + (e.presence.registerListenersForGroup = function (t, a, i) { + var n = { groupId: t, bidirectional: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_PRESENCE, + operation: e.presence.OPERATION_REGISTER_LISTENERS_FOR_GROUP, + data: n, + callback: i, + }); + }), + (e.presence.registerListenersForProfiles = function (t, a, i) { + var n = { profileIds: t, bidriectional: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_PRESENCE, + operation: e.presence.OPERATION_REGISTER_LISTENERS_FOR_PROFILES, + data: n, + callback: i, + }); + }), + (e.presence.setVisibility = function (t, a) { + var i = { visible: t }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_PRESENCE, + operation: e.presence.OPERATION_SET_VISIBILITY, + data: i, + callback: a, + }); + }), + (e.presence.stopListening = function (t) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_PRESENCE, + operation: e.presence.OPERATION_STOP_LISTENING, + data: {}, + callback: t, + }); + }), + (e.presence.updateActivity = function (t, a) { + var i = { jsonActivity: t }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_PRESENCE, + operation: e.presence.OPERATION_UPDATE_ACTIVITY, + data: i, + callback: a, + }); + })); + } + function L() { + var e = this; + ((e.profanity = {}), + (e.SERVICE_PROFANITY = "profanity"), + (e.profanity.OPERATION_PROFANITY_CHECK = "PROFANITY_CHECK"), + (e.profanity.OPERATION_PROFANITY_REPLACE_TEXT = + "PROFANITY_REPLACE_TEXT"), + (e.profanity.OPERATION_PROFANITY_IDENTIFY_BAD_WORDS = + "PROFANITY_IDENTIFY_BAD_WORDS"), + (e.profanity.profanityCheck = function (t, a, i, n, s, o) { + var r = {}; + ((r.text = t), + null != a && (r.languages = a), + (r.flagEmail = i), + (r.flagPhone = n), + (r.flagUrls = s), e.brainCloudManager.sendRequest({ - service: e.SERVICE_GROUP, - operation: e.group.OPERATION_UPDATE_GROUP_NAME, - data: n, - callback: i, - }); - }), - (e.group.updateGroupSummaryData = function (t, a, i, n) { - var s = { groupId: t, version: a, summaryData: i }; + service: e.SERVICE_PROFANITY, + operation: e.profanity.OPERATION_PROFANITY_CHECK, + data: r, + callback: o, + })); + }), + (e.profanity.profanityReplaceText = function (t, a, i, n, s, o, r) { + var l = {}; + ((l.text = t), + (l.replaceSymbol = a), + null != i && (l.languages = i), + (l.flagEmail = n), + (l.flagPhone = s), + (l.flagUrls = o), e.brainCloudManager.sendRequest({ - service: e.SERVICE_GROUP, - operation: e.group.OPERATION_UPDATE_GROUP_SUMMARY_DATA, - data: s, - callback: n, + service: e.SERVICE_PROFANITY, + operation: e.profanity.OPERATION_PROFANITY_REPLACE_TEXT, + data: l, + callback: r, + })); + }), + (e.profanity.profanityIdentifyBadWords = function ( + t, + a, + i, + n, + s, + o, + ) { + var r = {}; + ((r.text = t), + null != a && (r.languages = a), + (r.flagEmail = i), + (r.flagPhone = n), + (r.flagUrls = s), + e.brainCloudManager.sendRequest({ + service: e.SERVICE_PROFANITY, + operation: e.profanity.OPERATION_PROFANITY_IDENTIFY_BAD_WORDS, + data: r, + callback: o, + })); + })); + } + function D() { + var e = this; + ((e.pushNotification = {}), + (e.SERVICE_PUSH_NOTIFICATION = "pushNotification"), + (e.pushNotification.OPERATION_DEREGISTER_ALL = "DEREGISTER_ALL"), + (e.pushNotification.OPERATION_DEREGISTER = "DEREGISTER"), + (e.pushNotification.OPERATION_SEND_SIMPLE = "SEND_SIMPLE"), + (e.pushNotification.OPERATION_SEND_RICH = "SEND_RICH"), + (e.pushNotification.OPERATION_SEND_RAW = "SEND_RAW"), + (e.pushNotification.OPERATION_SEND_RAW_TO_GROUP = + "SEND_RAW_TO_GROUP"), + (e.pushNotification.OPERATION_SEND_RAW_BATCH = "SEND_RAW_BATCH"), + (e.pushNotification.OPERATION_REGISTER = "REGISTER"), + (e.pushNotification.OPERATION_SEND_NORMALIZED_TO_GROUP = + "SEND_NORMALIZED_TO_GROUP"), + (e.pushNotification.OPERATION_SEND_TEMPLATED_TO_GROUP = + "SEND_TEMPLATED_TO_GROUP"), + (e.pushNotification.OPERATION_SEND_NORMALIZED = "SEND_NORMALIZED"), + (e.pushNotification.OPERATION_SEND_NORMALIZED_BATCH = + "SEND_NORMALIZED_BATCH"), + (e.pushNotification.OPERATION_SCHEDULED_RICH = + "SCHEDULE_RICH_NOTIFICATION"), + (e.pushNotification.OPERATION_SCHEDULED_NORMALIZED = + "SCHEDULE_NORMALIZED_NOTIFICATION"), + (e.pushNotification.OPERATION_SCHEDULED_RAW = + "SCHEDULE_RAW_NOTIFICATION"), + (e.pushNotification.deregisterAllPushNotificationDeviceTokens = + function (t) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_PUSH_NOTIFICATION, + operation: e.pushNotification.OPERATION_DEREGISTER_ALL, + data: {}, + callback: t, }); }), - (e.group.getRandomGroupsMatching = function (t, a, i) { - var n = { where: t, maxReturn: a }; + (e.pushNotification.deregisterPushNotificationDeviceToken = + function (t, a, i) { e.brainCloudManager.sendRequest({ - service: e.SERVICE_GROUP, - operation: e.group.OPERATION_GET_RANDOM_GROUPS_MATCHING, - data: n, + service: e.SERVICE_PUSH_NOTIFICATION, + operation: e.pushNotification.OPERATION_DEREGISTER, + data: { deviceType: t, deviceToken: a }, callback: i, }); - })); - } - function v() { - var e = this; - ((e.identity = {}), - (e.SERVICE_IDENTITY = "identity"), - (e.identity.OPERATION_ATTACH = "ATTACH"), - (e.identity.OPERATION_ATTACH_BLOCKCHAIN_IDENTITY = - "ATTACH_BLOCKCHAIN_IDENTITY"), - (e.identity.OPERATION_DETACH_BLOCKCHAIN_IDENTITY = - "DETACH_BLOCKCHAIN_IDENTITY"), - (e.identity.OPERATION_MERGE = "MERGE"), - (e.identity.OPERATION_DETACH = "DETACH"), - (e.identity.OPERATION_SWITCH_TO_CHILD_PROFILE = - "SWITCH_TO_CHILD_PROFILE"), - (e.identity.OPERATION_SWITCH_TO_PARENT_PROFILE = - "SWITCH_TO_PARENT_PROFILE"), - (e.identity.OPERATION_GET_CHILD_PROFILES = "GET_CHILD_PROFILES"), - (e.identity.OPERATION_GET_IDENTITIES = "GET_IDENTITIES"), - (e.identity.OPERATION_GET_EXPIRED_IDENTITIES = - "GET_EXPIRED_IDENTITIES"), - (e.identity.OPERATION_REFRESH_IDENTITY = "REFRESH_IDENTITY"), - (e.identity.OPERATION_CHANGE_EMAIL_IDENTITY = - "CHANGE_EMAIL_IDENTITY"), - (e.identity.OPERATION_ATTACH_PARENT_WITH_IDENTITY = - "ATTACH_PARENT_WITH_IDENTITY"), - (e.identity.OPERATION_DETACH_PARENT = "DETACH_PARENT"), - (e.identity.OPERATION_ATTACH_PEER_PROFILE = "ATTACH_PEER_PROFILE"), - (e.identity.OPERATION_DETACH_PEER = "DETACH_PEER"), - (e.identity.OPERATION_GET_PEER_PROFILES = "GET_PEER_PROFILES"), - (e.identity.OPERATION_ATTACH_NONLOGIN_UNIVERSAL = - "ATTACH_NONLOGIN_UNIVERSAL"), - (e.identity.OPERATION_UPDATE_UNIVERSAL_LOGIN = - "UPDATE_UNIVERSAL_LOGIN"), - (e.identity.authenticationType = Object.freeze({ - anonymous: "Anonymous", - universal: "Universal", - email: "Email", - facebook: "Facebook", - gameCenter: "GameCenter", - steam: "Steam", - blockChain: "BlockChain", - google: "Google", - googleOpenId: "GoogleOpenId", - twitter: "Twitter", - twitter: "Apple", - parse: "Parse", - external: "External", - unknown: "UNKNOWN", - })), - (e.identity.attachFacebookIdentity = function (t, a, i) { - e.identity.attachIdentity( - t, - a, - e.authentication.AUTHENTICATION_TYPE_FACEBOOK, - i, - ); - }), - (e.identity.mergeFacebookIdentity = function (t, a, i) { - e.identity.mergeIdentity( - t, - a, - e.authentication.AUTHENTICATION_TYPE_FACEBOOK, - i, - ); - }), - (e.identity.detachFacebookIdentity = function (t, a, i) { - e.identity.detachIdentity( - t, - e.authentication.AUTHENTICATION_TYPE_FACEBOOK, - a, - i, - ); }), - (e.identity.attachUltraIdentity = function (t, a, i) { - e.identity.attachIdentity( - t, - a, - e.authentication.AUTHENTICATION_TYPE_ULTRA, - i, - ); - }), - (e.identity.mergeUltraIdentity = function (t, a, i) { - e.identity.mergeIdentity( - t, - a, - e.authentication.AUTHENTICATION_TYPE_ULTRA, - i, - ); - }), - (e.identity.detachUltraIdentity = function (t, a, i) { - e.identity.detachIdentity( - t, - e.authentication.AUTHENTICATION_TYPE_ULTRA, - a, - i, - ); - }), - (e.identity.attachAdvancedIdentity = function (t, a, i, n) { - var s = { - externalId: a.externalId, - authenticationType: t, - authenticationToken: a.authenticationToken, - }; - (externalAuthName && (s.externalAuthName = externalAuthName), - i && (s.extraJson = i), + (e.pushNotification.registerPushNotificationDeviceToken = function ( + t, + a, + i, + ) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_PUSH_NOTIFICATION, + operation: e.pushNotification.OPERATION_REGISTER, + data: { deviceType: t, deviceToken: a }, + callback: i, + }); + }), + (e.pushNotification.sendSimplePushNotification = function ( + t, + a, + i, + ) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_PUSH_NOTIFICATION, + operation: e.pushNotification.OPERATION_SEND_SIMPLE, + data: { toPlayerId: t, message: a }, + callback: i, + }); + }), + (e.pushNotification.sendRichPushNotification = function (t, a, i) { + e.pushNotification.sendRichPushNotificationWithParams( + t, + a, + null, + i, + ); + }), + (e.pushNotification.sendRichPushNotificationWithParams = function ( + t, + a, + i, + n, + ) { + var s = { toPlayerId: t, notificationTemplateId: a }; + (i && (s.substitutions = i), + e.brainCloudManager.sendRequest({ + service: e.SERVICE_PUSH_NOTIFICATION, + operation: e.pushNotification.OPERATION_SEND_RICH, + data: s, + callback: n, + })); + }), + (e.pushNotification.sendTemplatedPushNotificationToGroup = + function (t, a, i, n) { + var s = { groupId: t, notificationTemplateId: a }; + (i && (s.substitutions = i), e.brainCloudManager.sendRequest({ - service: e.SERVICE_IDENTITY, - operation: e.identity.OPERATION_ATTACH, + service: e.SERVICE_PUSH_NOTIFICATION, + operation: + e.pushNotification.OPERATION_SEND_TEMPLATED_TO_GROUP, data: s, callback: n, })); }), - (e.identity.mergeAdvancedIdentity = function (t, a, i, n) { - var s = { - externalId: a.externalId, - authenticationType: t, - authenticationToken: a.authenticationToken, - }; - (externalAuthName && (s.externalAuthName = externalAuthName), - i && (s.extraJson = i), + (e.pushNotification.sendNormalizedPushNotificationToGroup = + function (t, a, i, n) { + var s = { groupId: t, alertContent: a }; + (i && (s.customData = i), e.brainCloudManager.sendRequest({ - service: e.SERVICE_IDENTITY, - operation: e.identity.OPERATION_MERGE, + service: e.SERVICE_PUSH_NOTIFICATION, + operation: + e.pushNotification.OPERATION_SEND_NORMALIZED_TO_GROUP, data: s, callback: n, })); }), - (e.identity.detachAdvancedIdentity = function (t, a, i, n, s) { - var o = { - externalId: a, - authenticationType: t, - confirmAnonymous: i, - }; - (n && (o.extraJson = n), + (e.pushNotification.scheduleRawPushNotificationUTC = function ( + t, + a, + i, + n, + s, + o, + ) { + var r = { profileId: t, startDateUTC: s }; + (a && (r.fcmContent = a), + i && (r.iosContent = i), + n && (r.facebookContent = n), + e.brainCloudManager.sendRequest({ + service: e.SERVICE_PUSH_NOTIFICATION, + operation: e.pushNotification.OPERATION_SCHEDULED_RAW, + data: r, + callback: o, + })); + }), + (e.pushNotification.scheduleRawPushNotificationMinutes = function ( + t, + a, + i, + n, + s, + o, + ) { + var r = { profileId: t, minutesFromNow: s }; + (a && (r.fcmContent = a), + i && (r.iosContent = i), + n && (r.facebookContent = n), + e.brainCloudManager.sendRequest({ + service: e.SERVICE_PUSH_NOTIFICATION, + operation: e.pushNotification.OPERATION_SCHEDULED_RAW, + data: r, + callback: o, + })); + }), + (e.pushNotification.sendRawPushNotification = function ( + t, + a, + i, + n, + s, + ) { + var o = { toPlayerId: t }; + (a && (o.fcmContent = a), + i && (o.iosContent = i), + n && (o.facebookContent = n), + e.brainCloudManager.sendRequest({ + service: e.SERVICE_PUSH_NOTIFICATION, + operation: e.pushNotification.OPERATION_SEND_RAW, + data: o, + callback: s, + })); + }), + (e.pushNotification.sendRawPushNotificationBatch = function ( + t, + a, + i, + n, + s, + ) { + var o = { profileIds: t }; + (a && (o.fcmContent = a), + i && (o.iosContent = i), + n && (o.facebookContent = n), + e.brainCloudManager.sendRequest({ + service: e.SERVICE_PUSH_NOTIFICATION, + operation: e.pushNotification.OPERATION_SEND_RAW_BATCH, + data: o, + callback: s, + })); + }), + (e.pushNotification.sendRawPushNotificationToGroup = function ( + t, + a, + i, + n, + s, + ) { + var o = { groupId: t }; + (a && (o.fcmContent = a), + i && (o.iosContent = i), + n && (o.facebookContent = n), + e.brainCloudManager.sendRequest({ + service: e.SERVICE_PUSH_NOTIFICATION, + operation: e.pushNotification.OPERATION_SEND_RAW_TO_GROUP, + data: o, + callback: s, + })); + }), + (e.pushNotification.scheduleNormalizedPushNotificationUTC = + function (t, a, i, n, s) { + var o = { profileId: t, alertContent: a, startDateUTC: n }; + (i && (o.customData = i), e.brainCloudManager.sendRequest({ - service: e.SERVICE_IDENTITY, - operation: e.identity.OPERATION_DETACH, + service: e.SERVICE_PUSH_NOTIFICATION, + operation: + e.pushNotification.OPERATION_SCHEDULED_NORMALIZED, data: o, callback: s, })); }), - (e.identity.attachFacebookLimitedIdentity = function (t, a, i) { - e.identity.attachIdentity( - t, - a, - e.authentication.AUTHENTICATION_TYPE_FACEBOOK_LIMITED, - i, - ); - }), - (e.identity.mergeFacebookLimitedIdentity = function (t, a, i) { - e.identity.mergeIdentity( - t, - a, - e.authentication.AUTHENTICATION_TYPE_FACEBOOK_LIMITED, - i, - ); - }), - (e.identity.detachFacebookLimitedIdentity = function (t, a, i) { - e.identity.detachIdentity( - facebookLimitedId, - e.authentication.AUTHENTICATION_TYPE_FACEBOOK_LIMITED, - a, - i, - ); - }), - (e.identity.attachGameCenterIdentity = function (t, a) { - e.identity.detachIdentity( - t, - "", - authenticationToken, - e.authentication.AUTHENTICATION_TYPE_GAME_CENTER, - a, - ); - }), - (e.identity.mergeGameCenterIdentity = function (t, a) { - e.identity.detachIdentity( - t, - "", - authenticationToken, - e.authentication.AUTHENTICATION_TYPE_GAME_CENTER, - a, - ); - }), - (e.identity.detachGameCenterIdentity = function (t, a, i) { - e.identity.detachIdentity( - t, - e.authentication.AUTHENTICATION_TYPE_GAME_CENTER, - a, - i, - ); - }), - (e.identity.attachEmailIdentity = function (t, a, i) { - e.identity.attachIdentity( - t, - a, - e.authentication.AUTHENTICATION_TYPE_EMAIL, - i, - ); - }), - (e.identity.mergeEmailIdentity = function (t, a, i) { - e.identity.mergeIdentity( - t, - a, - e.authentication.AUTHENTICATION_TYPE_EMAIL, - i, - ); - }), - (e.identity.detachEmailIdentity = function (t, a, i) { - e.identity.detachIdentity( - t, - e.authentication.AUTHENTICATION_TYPE_EMAIL, - a, - i, - ); - }), - (e.identity.attachUniversalIdentity = function (t, a, i) { - e.identity.attachIdentity( - t, - a, - e.authentication.AUTHENTICATION_TYPE_UNIVERSAL, - i, - ); - }), - (e.identity.mergeUniversalIdentity = function (t, a, i) { - e.identity.mergeIdentity( - t, - a, - e.authentication.AUTHENTICATION_TYPE_UNIVERSAL, - i, - ); - }), - (e.identity.detachUniversalIdentity = function (t, a, i) { - e.identity.detachIdentity( - t, - e.authentication.AUTHENTICATION_TYPE_UNIVERSAL, - a, - i, - ); - }), - (e.identity.attachSteamIdentity = function (t, a, i) { - e.identity.attachIdentity( - t, - a, - e.authentication.AUTHENTICATION_TYPE_STEAM, - i, - ); - }), - (e.identity.mergeSteamIdentity = function (t, a, i) { - e.identity.mergeIdentity( - t, - a, - e.authentication.AUTHENTICATION_TYPE_STEAM, - i, - ); - }), - (e.identity.detachSteamIdentity = function (t, a, i) { - e.identity.detachIdentity( - t, - e.authentication.AUTHENTICATION_TYPE_STEAM, - a, - i, - ); - }), - (e.identity.attachGoogleIdentity = function (t, a, i) { - e.identity.attachIdentity( - t, - a, - e.authentication.AUTHENTICATION_TYPE_GOOGLE, - i, - ); - }), - (e.identity.mergeGoogleIdentity = function (t, a, i) { - e.identity.mergeIdentity( - t, - a, - e.authentication.AUTHENTICATION_TYPE_GOOGLE, - i, - ); - }), - (e.identity.detachGoogleIdentity = function (t, a, i) { - e.identity.detachIdentity( - t, - e.authentication.AUTHENTICATION_TYPE_GOOGLE, - a, - i, - ); - }), - (e.identity.attachGoogleOpenIdIdentity = function (t, a, i) { - e.identity.attachIdentity( - t, - a, - e.authentication.AUTHENTICATION_TYPE_GOOGLE_OPEN_ID, - i, - ); - }), - (e.identity.mergeGoogleOpenIdIdentity = function (t, a, i) { - e.identity.mergeIdentity( - t, - a, - e.authentication.AUTHENTICATION_TYPE_GOOGLE_OPEN_ID, - i, - ); - }), - (e.identity.detachGoogleOpenIdIdentity = function (t, a, i) { - e.identity.detachIdentity( - t, - e.authentication.AUTHENTICATION_TYPE_GOOGLE_OPEN_ID, - a, - i, - ); - }), - (e.identity.attachAppleIdentity = function (t, a, i) { - e.identity.attachIdentity( - t, - a, - e.authentication.AUTHENTICATION_TYPE_APPLE, - i, - ); - }), - (e.identity.mergeAppleIdentity = function (t, a, i) { - e.identity.mergeIdentity( - t, - a, - e.authentication.AUTHENTICATION_TYPE_APPLE, - i, - ); + (e.pushNotification.scheduleNormalizedPushNotificationMinutes = + function (t, a, i, n, s) { + var o = { profileId: t, alertContent: a, minutesFromNow: n }; + (i && (o.customData = i), + e.brainCloudManager.sendRequest({ + service: e.SERVICE_PUSH_NOTIFICATION, + operation: + e.pushNotification.OPERATION_SCHEDULED_NORMALIZED, + data: o, + callback: s, + })); }), - (e.identity.detachAppleIdentity = function (t, a, i) { - e.identity.detachIdentity( - t, - e.authentication.AUTHENTICATION_TYPE_APPLE, - a, - i, - ); - }), - (e.identity.attachTwitterIdentity = function (t, a, i, n) { - e.identity.attachIdentity( - t, - a + ":" + i, - e.authentication.AUTHENTICATION_TYPE_TWITTER, - n, - ); - }), - (e.identity.mergeTwitterIdentity = function (t, a, i, n) { - e.identity.mergeIdentity( - t, - a + ":" + i, - e.authentication.AUTHENTICATION_TYPE_TWITTER, - n, - ); - }), - (e.identity.detachTwitterIdentity = function (t, a, i) { - e.identity.detachIdentity( - t, - e.authentication.AUTHENTICATION_TYPE_TWITTER, - a, - i, - ); - }), - (e.identity.attachParseIdentity = function (t, a, i) { - e.identity.attachIdentity( - t, - a, - e.authentication.AUTHENTICATION_TYPE_PARSE, - i, - ); - }), - (e.identity.mergeParseIdentity = function (t, a, i) { - e.identity.mergeIdentity( - t, - a, - e.authentication.AUTHENTICATION_TYPE_PARSE, - i, - ); - }), - (e.identity.detachParseIdentity = function (t, a, i) { - e.identity.detachIdentity( - t, - e.authentication.AUTHENTICATION_TYPE_PARSE, - a, - i, - ); - }), - (e.identity.switchToChildProfile = function (t, a, i, n) { - e.identity.switchToChildProfileInternal(t, a, i, false, n); - }), - (e.identity.switchToSingletonChildProfile = function (t, a, i) { - e.identity.switchToChildProfileInternal(null, t, a, true, i); - }), - (e.identity.attachBlockchainIdentity = function (t, a, i) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_IDENTITY, - operation: e.identity.OPERATION_ATTACH_BLOCKCHAIN_IDENTITY, - data: { blockchainConfig: t, publicKey: a }, - callback: i, - }); - }), - (e.identity.detachBlockchainIdentity = function (t, a) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_IDENTITY, - operation: e.identity.OPERATION_DETACH_BLOCKCHAIN_IDENTITY, - data: { blockchainConfig: t }, - callback: a, - }); - }), - (e.identity.updateUniversalIdLogin = function (t, a) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_IDENTITY, - operation: e.identity.OPERATION_UPDATE_UNIVERSAL_LOGIN, - data: { externalId: t }, - callback: a, - }); - }), - (e.identity.attachNonLoginUniversalId = function (t, a) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_IDENTITY, - operation: e.identity.OPERATION_ATTACH_NONLOGIN_UNIVERSAL, - data: { externalId: t }, - callback: a, - }); - }), - (e.identity.switchToParentProfile = function (t, a) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_IDENTITY, - operation: e.identity.OPERATION_SWITCH_TO_PARENT_PROFILE, - data: { levelName: t }, - callback: a, - }); - }), - (e.identity.getChildProfiles = function (t, a) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_IDENTITY, - operation: e.identity.OPERATION_GET_CHILD_PROFILES, - data: { includePlayerSummaryData: t }, - callback: a, - }); - }), - (e.identity.getIdentities = function (t) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_IDENTITY, - operation: e.identity.OPERATION_GET_IDENTITIES, - data: {}, - callback: t, - }); - }), - (e.identity.getExpiredIdentities = function (t) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_IDENTITY, - operation: e.identity.OPERATION_GET_EXPIRED_IDENTITIES, - data: {}, - callback: t, - }); - }), - (e.identity.refreshIdentity = function (t, a, i, n) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_IDENTITY, - operation: e.identity.OPERATION_REFRESH_IDENTITY, - data: { - externalId: t, - authenticationType: i, - authenticationToken: a, - }, - callback: n, - }); - }), - (e.identity.changeEmailIdentity = function (t, a, i, n, s) { + (e.pushNotification.scheduleRichPushNotificationUTC = function ( + t, + a, + i, + n, + s, + ) { + var o = { + profileId: t, + notificationTemplateId: a, + startDateUTC: n, + }; + (i && (o.substitutions = i), e.brainCloudManager.sendRequest({ - service: e.SERVICE_IDENTITY, - operation: e.identity.OPERATION_CHANGE_EMAIL_IDENTITY, - data: { - oldEmailAddress: t, - authenticationToken: a, - newEmailAddress: i, - updateContactEmail: n, - }, + service: e.SERVICE_PUSH_NOTIFICATION, + operation: e.pushNotification.OPERATION_SCHEDULED_RICH, + data: o, callback: s, - }); - }), - (e.identity.attachParentWithIdentity = function (t, a, i, n, s, o) { - var r = { - externalId: t, - authenticationToken: a, - authenticationType: i, - forceCreate: s, - }; - (n && (r.externalAuthName = n), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_IDENTITY, - operation: e.identity.OPERATION_ATTACH_PARENT_WITH_IDENTITY, - data: r, - callback: o, - })); - }), - (e.identity.detachParent = function (t) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_IDENTITY, - operation: e.identity.OPERATION_DETACH_PARENT, - data: null, - callback: t, - }); - }), - (e.identity.attachPeerProfile = function (t, a, i, n, s, o, r) { - var l = { - peer: t, - externalId: a, - authenticationToken: i, - authenticationType: n, - forceCreate: o, - }; - (s && (l.externalAuthName = s), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_IDENTITY, - operation: e.identity.OPERATION_ATTACH_PEER_PROFILE, - data: l, - callback: r, - })); - }), - (e.identity.detachPeer = function (t, a) { - var i = { peer: t }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_IDENTITY, - operation: e.identity.OPERATION_DETACH_PEER, - data: i, - callback: a, - }); - }), - (e.identity.getPeerProfiles = function (t) { + })); + }), + (e.pushNotification.scheduleRichPushNotificationMinutes = function ( + t, + a, + i, + n, + s, + ) { + var o = { + profileId: t, + notificationTemplateId: a, + minutesFromNow: n, + }; + (i && (o.substitutions = i), e.brainCloudManager.sendRequest({ - service: e.SERVICE_IDENTITY, - operation: e.identity.OPERATION_GET_PEER_PROFILES, - data: null, - callback: t, - }); - }), - (e.identity.attachIdentity = function (t, a, i, n) { + service: e.SERVICE_PUSH_NOTIFICATION, + operation: e.pushNotification.OPERATION_SCHEDULED_RICH, + data: o, + callback: s, + })); + }), + (e.pushNotification.sendNormalizedPushNotification = function ( + t, + a, + i, + n, + ) { + var s = { toPlayerId: t, alertContent: a }; + (i && (s.customData = i), e.brainCloudManager.sendRequest({ - service: e.SERVICE_IDENTITY, - operation: e.identity.OPERATION_ATTACH, - data: { - externalId: t, - authenticationType: i, - authenticationToken: a, - }, + service: e.SERVICE_PUSH_NOTIFICATION, + operation: e.pushNotification.OPERATION_SEND_NORMALIZED, + data: s, callback: n, - }); - }), - (e.identity.mergeIdentity = function (t, a, i, n) { + })); + }), + (e.pushNotification.sendNormalizedPushNotificationBatch = function ( + t, + a, + i, + n, + ) { + var s = { profileIds: t, alertContent: a }; + (i && (s.customData = i), e.brainCloudManager.sendRequest({ - service: e.SERVICE_IDENTITY, - operation: e.identity.OPERATION_MERGE, - data: { - externalId: t, - authenticationType: i, - authenticationToken: a, - }, + service: e.SERVICE_PUSH_NOTIFICATION, + operation: e.pushNotification.OPERATION_SEND_NORMALIZED_BATCH, + data: s, callback: n, - }); - }), - (e.identity.detachIdentity = function (t, a, i, n) { + })); + })); + } + function B() { + var e = this; + ((e.reasonCodes = {}), + (e.reasonCodes.NO_REASON_CODE = 0), + (e.reasonCodes.INVALID_NOTIFICATION = 20200), + (e.reasonCodes.INVALID_REQUEST = 40001), + (e.reasonCodes.CREATING_FACEBOOK_MEMORY = 40200), + (e.reasonCodes.SWITCHING_FACEBOOK_MEMORY = 40201), + (e.reasonCodes.MERGING_MEMORY = 40202), + (e.reasonCodes.RECREATING_ANONYMOUS_MEMORY = 40203), + (e.reasonCodes.MOVING_ANONYMOUS_MEMORY = 40204), + (e.reasonCodes.LOGIN_SECURITY_ERROR = 40205), + (e.reasonCodes.MISSING_IDENTITY_ERROR = 40206), + (e.reasonCodes.SWITCHING_PROFILES = 40207), + (e.reasonCodes.MISSING_PROFILE_ERROR = 40208), + (e.reasonCodes.SECURITY_ERROR = 40209), + (e.reasonCodes.DOWNGRADING_TO_ANONYMOUS_ERROR = 40210), + (e.reasonCodes.DUPLICATE_IDENTITY_TYPE = 40211), + (e.reasonCodes.MERGE_PROFILES = 40212), + (e.reasonCodes.INVALID_PROPERTY_NAME = 40213), + (e.reasonCodes.EMAIL_NOT_VALIDATED = 40214), + (e.reasonCodes.DATABASE_ERROR = 40215), + (e.reasonCodes.PROPERTY_NOT_OVERRIDEABLE = 40216), + (e.reasonCodes.UNKNOWN_AUTH_ERROR = 40217), + (e.reasonCodes.DATABASE_INPUT_TOO_LARGE_ERROR = 40218), + (e.reasonCodes.MISSING_APP_EMAIL_ACCOUNT = 40219), + (e.reasonCodes.DATABASE_DUP_KEY_ERROR = 40220), + (e.reasonCodes.EMAIL_NOT_VALID = 40221), + (e.reasonCodes.UNABLE_TO_GET_FRIENDS_FROM_FACEBOOK = 40300), + (e.reasonCodes.BAD_SIGNATURE = 40301), + (e.reasonCodes.UNABLE_TO_VALIDATE_PLAYER = 40302), + (e.reasonCodes.PLAYER_SESSION_EXPIRED = 40303), + (e.reasonCodes.NO_SESSION = 40304), + (e.reasonCodes.PLAYER_SESSION_MISMATCH = 40305), + (e.reasonCodes.OPERATION_REQUIRES_A_SESSION = 40306), + (e.reasonCodes.TOKEN_DOES_NOT_MATCH_USER = 40307), + (e.reasonCodes.MANUAL_REDIRECT = 40308), + (e.reasonCodes.EVENT_CAN_ONLY_SEND_TO_FRIEND_OR_SELF = 40309), + (e.reasonCodes.NOT_FRIENDS = 40310), + (e.reasonCodes.VC_BALANCE_CANNOT_BE_SPECIFIED = 40311), + (e.reasonCodes.VC_LIMIT_EXCEEDED = 40312), + (e.reasonCodes.UNABLE_TO_GET_MY_DATA_FROM_FACEBOOK = 40313), + (e.reasonCodes.TLS_VERSION_INVALID = 40314), + (e.reasonCodes.INVALID_AUTHENTICATION_TYPE = 40315), + (e.reasonCodes.INVALID_GAME_ID = 40316), + (e.reasonCodes.APPLE_TRANS_ID_ALREADY_CLAIMED = 40317), + (e.reasonCodes.CLIENT_VERSION_NOT_SUPPORTED = 40318), + (e.reasonCodes.BRAINCLOUD_VERSION_NOT_SUPPORTED = 40319), + (e.reasonCodes.PLATFORM_NOT_SUPPORTED = 40320), + (e.reasonCodes.INVALID_PLAYER_STATISTICS_EVENT_NAME = 40321), + (e.reasonCodes.GAME_VERSION_NOT_SUPPORTED = 40322), + (e.reasonCodes.BAD_REFERENCE_DATA = 40324), + (e.reasonCodes.MISSING_OAUTH_TOKEN = 40325), + (e.reasonCodes.MISSING_OAUTH_VERIFIER = 40326), + (e.reasonCodes.MISSING_OAUTH_TOKEN_SECRET = 40327), + (e.reasonCodes.MISSING_TWEET = 40328), + (e.reasonCodes.FACEBOOK_PAYMENT_ID_ALREADY_PROCESSED = 40329), + (e.reasonCodes.DISABLED_GAME = 40330), + (e.reasonCodes.MATCH_MAKING_DISABLED = 40331), + (e.reasonCodes.UPDATE_FAILED = 40332), + (e.reasonCodes.INVALID_OPERATION = 40333), + (e.reasonCodes.MATCH_RANGE_ERROR = 40334), + (e.reasonCodes.PLAYER_IN_MATCH = 40335), + (e.reasonCodes.MATCH_PLAYER_SHIELDED = 40336), + (e.reasonCodes.MATCH_PLAYER_MISSING = 40337), + (e.reasonCodes.MATCH_PLAYER_LOGGED_IN = 40338), + (e.reasonCodes.INVALID_ITEM_ID = 40339), + (e.reasonCodes.MISSING_PRICE = 40340), + (e.reasonCodes.MISSING_USER_INFO = 40341), + (e.reasonCodes.MISSING_STEAM_RESPONSE = 40342), + (e.reasonCodes.MISSING_STEAM_TRANSACTION = 40343), + (e.reasonCodes.ENTITY_VERSION_MISMATCH = 40344), + (e.reasonCodes.MISSING_RECORD = 40345), + (e.reasonCodes.INSUFFICIENT_PERMISSIONS = 40346), + (e.reasonCodes.MISSING_IN_QUERY = 40347), + (e.reasonCodes.INVALID_DATABASE_FIELD_NAME = 40347), + (e.reasonCodes.RECORD_EXPIRED = 40348), + (e.reasonCodes.INVALID_WHERE = 40349), + (e.reasonCodes.S3_ERROR = 40350), + (e.reasonCodes.INVALID_ATTRIBUTES = 40351), + (e.reasonCodes.IMPORT_MISSING_GAME_DATA = 40352), + (e.reasonCodes.IMPORT_SCHEMA_VERSION_TOO_OLD = 40353), + (e.reasonCodes.IMPORT_SCHEMA_VERSION_INVALID = 40355), + (e.reasonCodes.PLAYER_SESSION_LOGGED_OUT = 40356), + (e.reasonCodes.API_HOOK_SCRIPT_ERROR = 40357), + (e.reasonCodes.MISSING_REQUIRED_PARAMETER = 40358), + (e.reasonCodes.INVALID_PARAMETER_TYPE = 40359), + (e.reasonCodes.INVALID_IDENTITY_TYPE = 40360), + (e.reasonCodes.EMAIL_SEND_ERROR = 40361), + (e.reasonCodes.CHILD_ENTITY_PARTIAL_UPDATE_INVALID_DATA = 40362), + (e.reasonCodes.MISSING_SCRIPT = 40363), + (e.reasonCodes.SCRIPT_SECURITY_ERROR = 40364), + (e.reasonCodes.SERVER_SESSION_EXPIRED = 40365), + (e.reasonCodes.STREAM_DOES_NOT_EXIT = 40366), + (e.reasonCodes.STREAM_ACCESS_ERROR = 40367), + (e.reasonCodes.STREAM_COMPLETE = 40368), + (e.reasonCodes.INVALID_STATISTIC_NAME = 40369), + (e.reasonCodes.INVALID_HTTP_REQUEST = 40370), + (e.reasonCodes.GAME_LIMIT_REACHED = 40371), + (e.reasonCodes.GAME_RUNSTATE_DISABLED = 40372), + (e.reasonCodes.INVALID_COMPANY_ID = 40373), + (e.reasonCodes.INVALID_PLAYER_ID = 40374), + (e.reasonCodes.INVALID_TEMPLATE_ID = 40375), + (e.reasonCodes.MINIMUM_SEARCH_INPUT = 40376), + (e.reasonCodes.MISSING_GAME_PARENT = 40377), + (e.reasonCodes.GAME_PARENT_MISMATCH = 40378), + (e.reasonCodes.CHILD_PLAYER_MISSING = 40379), + (e.reasonCodes.MISSING_PLAYER_PARENT = 40380), + (e.reasonCodes.PLAYER_PARENT_MISMATCH = 40381), + (e.reasonCodes.MISSING_PLAYER_ID = 40382), + (e.reasonCodes.DECODE_CONTEXT = 40383), + (e.reasonCodes.INVALID_QUERY_CONTEXT = 40384), + (e.reasonCodes.INVALID_AMOUNT = 40385), + (e.reasonCodes.GROUP_MEMBER_NOT_FOUND = 40385), + (e.reasonCodes.INVALID_SORT = 40386), + (e.reasonCodes.GAME_NOT_FOUND = 40387), + (e.reasonCodes.GAMES_NOT_IN_SAME_COMPANY = 40388), + (e.reasonCodes.IMPORT_NO_PARENT_ASSIGNED = 40389), + (e.reasonCodes.IMPORT_PARENT_CURRENCIES_MISMATCH = 40390), + (e.reasonCodes.INVALID_SUBSTITUION_ENTRY = 40391), + (e.reasonCodes.INVALID_TEMPLATE_STRING = 40392), + (e.reasonCodes.TEMPLATE_SUBSTITUTION_ERROR = 40393), + (e.reasonCodes.INVALID_OPPONENTS = 40394), + (e.reasonCodes.REDEMPTION_CODE_NOT_FOUND = 40395), + (e.reasonCodes.REDEMPTION_CODE_VERSION_MISMATCH = 40396), + (e.reasonCodes.REDEMPTION_CODE_ACTIVE = 40397), + (e.reasonCodes.REDEMPTION_CODE_NOT_ACTIVE = 40398), + (e.reasonCodes.REDEMPTION_CODE_TYPE_NOT_FOUND = 40399), + (e.reasonCodes.REDEMPTION_CODE_INVALID = 40400), + (e.reasonCodes.REDEMPTION_CODE_REDEEMED = 40401), + (e.reasonCodes.REDEMPTION_CODE_REDEEMED_BY_SELF = 40402), + (e.reasonCodes.REDEMPTION_CODE_REDEEMED_BY_OTHER = 40403), + (e.reasonCodes.SCRIPT_EMPTY = 40404), + (e.reasonCodes.ITUNES_COMMUNICATION_ERROR = 40405), + (e.reasonCodes.ITUNES_NO_RESPONSE = 40406), + (e.reasonCodes.ITUNES_RESPONSE_NOT_OK = 40407), + (e.reasonCodes.JSON_PARSING_ERROR = 40408), + (e.reasonCodes.ITUNES_NULL_RESPONSE = 40409), + (e.reasonCodes.ITUNES_RESPONSE_WITH_NULL_STATUS = 40410), + (e.reasonCodes.ITUNES_STATUS_BAD_JSON_RECEIPT = 40411), + (e.reasonCodes.ITUNES_STATUS_BAD_RECEIPT = 40412), + (e.reasonCodes.ITUNES_STATUS_RECEIPT_NOT_AUTHENTICATED = 40413), + (e.reasonCodes.ITUNES_STATUS_BAD_SHARED_SECRET = 40414), + (e.reasonCodes.ITUNES_STATUS_RECEIPT_SERVER_UNAVAILABLE = 40415), + (e.reasonCodes.ITUNES_RECEIPT_MISSING_ITUNES_PRODUCT_ID = 40416), + (e.reasonCodes.PRODUCT_NOT_FOUND_FOR_ITUNES_PRODUCT_ID = 40417), + (e.reasonCodes.DATA_STREAM_EVENTS_NOT_ENABLED = 40418), + (e.reasonCodes.INVALID_DEVICE_TOKEN = 40419), + (e.reasonCodes.ERROR_DELETING_DEVICE_TOKEN = 40420), + (e.reasonCodes.WEBPURIFY_NOT_CONFIGURED = 40421), + (e.reasonCodes.WEBPURIFY_EXCEPTION = 40422), + (e.reasonCodes.WEBPURIFY_FAILURE = 40423), + (e.reasonCodes.WEBPURIFY_NOT_ENABLED = 40424), + (e.reasonCodes.NAME_CONTAINS_PROFANITY = 40425), + (e.reasonCodes.NULL_SESSION = 40426), + (e.reasonCodes.PURCHASE_ALREADY_VERIFIED = 40427), + (e.reasonCodes.GOOGLE_IAP_NOT_CONFIGURED = 40428), + (e.reasonCodes.UPLOAD_FILE_TOO_LARGE = 40429), + (e.reasonCodes.FILE_ALREADY_EXISTS = 40430), + (e.reasonCodes.CLOUD_STORAGE_SERVICE_ERROR = 40431), + (e.reasonCodes.FILE_DOES_NOT_EXIST = 40432), + (e.reasonCodes.UPLOAD_ID_MISSING = 40433), + (e.reasonCodes.UPLOAD_JOB_MISSING = 40434), + (e.reasonCodes.UPLOAD_JOB_EXPIRED = 40435), + (e.reasonCodes.UPLOADER_EXCEPTION = 40436), + (e.reasonCodes.UPLOADER_FILESIZE_MISMATCH = 40437), + (e.reasonCodes.PUSH_NOTIFICATIONS_NOT_CONFIGURED = 40438), + (e.reasonCodes.MATCHMAKING_FILTER_SCRIPT_FAILURE = 40439), + (e.reasonCodes.ACCOUNT_ALREADY_EXISTS = 40440), + (e.reasonCodes.PROFILE_ALREADY_EXISTS = 40441), + (e.reasonCodes.MISSING_NOTIFICATION_BODY = 40442), + (e.reasonCodes.INVALID_SERVICE_CODE = 40443), + (e.reasonCodes.IP_ADDRESS_BLOCKED = 40444), + (e.reasonCodes.UNAPPROVED_SERVICE_CODE = 40445), + (e.reasonCodes.PROFILE_NOT_FOUND = 40446), + (e.reasonCodes.ENTITY_NOT_SHARED = 40447), + (e.reasonCodes.SELF_FRIEND = 40448), + (e.reasonCodes.PARSE_NOT_CONFIGURED = 40449), + (e.reasonCodes.PARSE_NOT_ENABLED = 40450), + (e.reasonCodes.PARSE_REQUEST_ERROR = 40451), + (e.reasonCodes.GROUP_CANNOT_ADD_OWNER = 40452), + (e.reasonCodes.NOT_GROUP_MEMBER = 40453), + (e.reasonCodes.INVALID_GROUP_ROLE = 40454), + (e.reasonCodes.GROUP_OWNER_DELETE = 40455), + (e.reasonCodes.NOT_INVITED_GROUP_MEMBER = 40456), + (e.reasonCodes.GROUP_IS_FULL = 40457), + (e.reasonCodes.GROUP_OWNER_CANNOT_LEAVE = 40458), + (e.reasonCodes.INVALID_INCREMENT_VALUE = 40459), + (e.reasonCodes.GROUP_VERSION_MISMATCH = 40460), + (e.reasonCodes.GROUP_ENTITY_VERSION_MISMATCH = 40461), + (e.reasonCodes.INVALID_GROUP_ID = 40462), + (e.reasonCodes.INVALID_FIELD_NAME = 40463), + (e.reasonCodes.UNSUPPORTED_AUTH_TYPE = 40464), + (e.reasonCodes.CLOUDCODE_JOB_NOT_FOUND = 40465), + (e.reasonCodes.CLOUDCODE_JOB_NOT_SCHEDULED = 40466), + (e.reasonCodes.GROUP_TYPE_NOT_FOUND = 40467), + (e.reasonCodes.MATCHING_GROUPS_NOT_FOUND = 40468), + (e.reasonCodes.GENERATE_CDN_URL_ERROR = 40469), + (e.reasonCodes.INVALID_PROFILE_IDS = 40470), + (e.reasonCodes.MAX_PROFILE_IDS_EXCEEDED = 40471), + (e.reasonCodes.PROFILE_ID_MISMATCH = 40472), + (e.reasonCodes.LEADERBOARD_DOESNOT_EXIST = 40473), + (e.reasonCodes.APP_LICENSING_EXCEEDED = 40474), + (e.reasonCodes.SENDGRID_NOT_INSTALLED = 40475), + (e.reasonCodes.SENDGRID_EMAIL_SEND_ERROR = 40476), + (e.reasonCodes.SENDGRID_NOT_ENABLED_FOR_APP = 40477), + (e.reasonCodes.SENDGRID_GET_TEMPLATES_ERROR = 40478), + (e.reasonCodes.SENDGRID_INVALID_API_KEY = 40479), + (e.reasonCodes.EMAIL_SERVICE_NOT_CONFIGURED = 40480), + (e.reasonCodes.INVALID_EMAIL_TEMPLATE_TYPE = 40481), + (e.reasonCodes.SENDGRID_KEY_EMPTY_OR_NULL = 40482), + (e.reasonCodes.BODY_TEMPLATE_CANNOT_COEXIST = 40483), + (e.reasonCodes.SUBSTITUTION_BODY_CANNOT_COEXIST = 40484), + (e.reasonCodes.INVALID_FROM_ADDRESS = 40485), + (e.reasonCodes.INVALID_FROM_NAME = 40486), + (e.reasonCodes.INVALID_REPLY_TO_ADDRESS = 40487), + (e.reasonCodes.INVALID_REPLY_TO_NAME = 40488), + (e.reasonCodes.FROM_NAME_WITHOUT_FROM_ADDRESS = 40489), + (e.reasonCodes.REPLY_TO_NAME_WITHOUT_REPLY_TO_ADDRESS = 40490), + (e.reasonCodes.CURRENCY_SECURITY_ERROR = 40491), + (e.reasonCodes.INVALID_PEER_CODE = 40492), + (e.reasonCodes.PEER_NO_LONGER_EXISTS = 40493), + (e.reasonCodes.CANNOT_MODIFY_TOURNAMENT_WITH_LEADERBOARD_SERVICE = 40494), + (e.reasonCodes.NO_TOURNAMENT_ASSOCIATED_WITH_LEADERBOARD = 40495), + (e.reasonCodes.TOURNAMENT_NOT_ASSOCIATED_WITH_LEADERBOARD = 40496), + (e.reasonCodes.PLAYER_ALREADY_TOURNAMENT_FOR_LEADERBOARD = 40497), + (e.reasonCodes.PLAYER_EARLY_FOR_JOINING_TOURNAMENT = 40498), + (e.reasonCodes.NO_LEADERBOARD_FOUND = 40499), + (e.reasonCodes.PLAYER_NOT_IN_TIME_RANGE_FOR_POSTSCORE_TOURNAMENT = 40500), + (e.reasonCodes.LEADERBOARD_ID_BAD = 40501), + (e.reasonCodes.SCORE_INPUT_BAD = 40502), + (e.reasonCodes.ROUND_STARTED_EPOCH_INPUT_BAD = 40503), + (e.reasonCodes.TOURNAMENT_CODE_INPUT_BAD = 40504), + (e.reasonCodes.PLAYER_NOT_ENROLLED_IN_TOURNAMENT = 40505), + (e.reasonCodes.LEADERBOARD_VERSION_ID_INVALID = 40506), + (e.reasonCodes.NOT_ENOUGH_BALANCE_TO_JOIN_TOURNAMENT = 40507), + (e.reasonCodes.PARENT_ALREADY_ATTACHED = 40508), + (e.reasonCodes.PEER_ALREADY_ATTACHED = 40509), + (e.reasonCodes.IDENTITY_NOT_ATTACHED_WITH_PARENT = 40510), + (e.reasonCodes.IDENTITY_NOT_ATTACHED_WITH_PEER = 40511), + (e.reasonCodes.LEADERBOARD_SCORE_UPDATE_ERROR = 40512), + (e.reasonCodes.ERROR_CLAIMING_REWARD = 40513), + (e.reasonCodes.NOT_ENOUGH_PARENT_BALANCE_TO_JOIN_TOURNAMENT = 40514), + (e.reasonCodes.NOT_ENOUGH_PEER_BALANCE_TO_JOIN_TOURNAMENT = 40515), + (e.reasonCodes.PLAYER_LATE_FOR_JOINING_TOURNAMENT = 40516), + (e.reasonCodes.VIEWING_REWARD_FOR_NON_PROCESSED_TOURNAMENTS = 40517), + (e.reasonCodes.NO_REWARD_ASSOCIATED_WITH_LEADERBOARD = 40518), + (e.reasonCodes.PROFILE_PEER_NOT_FOUND = 40519), + (e.reasonCodes.LEADERBOARD_IN_ACTIVE_STATE = 40520), + (e.reasonCodes.LEADERBOARD_IN_CALCULATING_STATE = 40521), + (e.reasonCodes.TOURNAMENT_RESULT_PROCESSING_FAILED = 40522), + (e.reasonCodes.TOURNAMENT_REWARDS_ALREADY_CLAIMED = 40523), + (e.reasonCodes.NO_TOURNAMENT_FOUND = 40524), + (e.reasonCodes.UNEXPECTED_ERROR_RANK_ZERO_AFTER_PROCESSING = 40525), + (e.reasonCodes.UNEXPECTED_ERROR_DELETING_TOURNAMENT_LEADERBOARD_SCORE = 40526), + (e.reasonCodes.INVALID_RUN_STATE = 40527), + (e.reasonCodes.LEADERBOARD_SCORE_DOESNOT_EXIST = 40528), + (e.reasonCodes.INITIAL_SCORE_NULL = 40529), + (e.reasonCodes.TOURNAMENT_NOTIFICATIONS_PROCESSING_FAILED = 40530), + (e.reasonCodes.ACL_NOT_READABLE = 40531), + (e.reasonCodes.INVALID_OWNER_ID = 40532), + (e.reasonCodes.IMPORT_MISSING_PEERS_DATA = 40533), + (e.reasonCodes.INVALID_CREDENTIAL = 40534), + (e.reasonCodes.GLOBAL_ENTITY_SECURITY_ERROR = 40535), + (e.reasonCodes.LEADERBOARD_SECURITY_ERROR = 40536), + (e.reasonCodes.NOT_A_SYSTEM_ENTITY = 40537), + (e.reasonCodes.CONTROLLER_ERROR = 40538), + (e.reasonCodes.EVENT_MISSING = 40539), + (e.reasonCodes.INVALID_XP_LEVEL = 40540), + (e.reasonCodes.INVALID_ITUNES_ID = 40541), + (e.reasonCodes.IMPORT_ERROR = 40542), + (e.reasonCodes.INVALID_ENTITY_TYPE = 40543), + (e.reasonCodes.FORM_ERROR = 40544), + (e.reasonCodes.INVALID_PARENT = 40545), + (e.reasonCodes.INVALID_CURRENCY = 40546), + (e.reasonCodes.INVALID_THRESHHOLD = 40547), + (e.reasonCodes.MATCH_ALREADY_EXISTS = 40548), + (e.reasonCodes.FRIEND_NOT_FOUND = 40549), + (e.reasonCodes.MATCH_NOT_FOUND = 40550), + (e.reasonCodes.MATCH_COMPLETE = 40551), + (e.reasonCodes.MATCH_NOT_STARTED = 40552), + (e.reasonCodes.MATCH_EXPIRED = 40553), + (e.reasonCodes.PLAYER_NOT_IN_MATCH = 40554), + (e.reasonCodes.INVALID_MATCH_VERSION = 40555), + (e.reasonCodes.INVALID_TURN_VERSION = 40556), + (e.reasonCodes.INVALID_DEVICE_TYPE = 40557), + (e.reasonCodes.DUPLICATE_ENTITY = 40558), + (e.reasonCodes.DUPLICATE_EVENT = 40559), + (e.reasonCodes.INVALID_LEADERBOARD_COUNT = 40560), + (e.reasonCodes.DUPLICATE_LEADERBOARD = 40561), + (e.reasonCodes.MICROSOFT_ERROR = 40562), + (e.reasonCodes.DUPLICATE_TOURNAMENT = 40563), + (e.reasonCodes.CREATE_SYSTEM_ENTITY_FAILED = 40564), + (e.reasonCodes.INVALID_MAX_NUM_STREAMS = 40565), + (e.reasonCodes.INVALID_PACKET_ID = 40566), + (e.reasonCodes.HOOK_ERROR = 40567), + (e.reasonCodes.INVALID_STREAM_ID = 40568), + (e.reasonCodes.INVALID_SCAN_CODE = 40569), + (e.reasonCodes.NO_CUSTOM_ENTITY_CONFIG_FOUND = 40570), + (e.reasonCodes.NO_CUSTOM_ENTITY_FOUND = 40571), + (e.reasonCodes.CLOUD_STORAGE_ERROR = 40572), + (e.reasonCodes.NO_CUSTOM_FIELD_CONFIG_FOUND = 40573), + (e.reasonCodes.MISSING_CUSTOM_ENTITY_QUERY = 40574), + (e.reasonCodes.INVALID_CUSTOM_ENTITY_JSON_WHERE = 40575), + (e.reasonCodes.INVALID_CUSTOM_ENTITY_JSON_FIELDS = 40576), + (e.reasonCodes.ENTITY_ID_NOT_CONFIGURED = 40577), + (e.reasonCodes.UNCONFIGURED_CUSTOM_FIELD_ERROR = 40578), + (e.reasonCodes.CUSTOM_ENTITY_SECURITY_ERROR = 40579), + (e.reasonCodes.CUSTOM_ENTITY_PARTIAL_UPDATE_INVALID_DATA = 40580), + (e.reasonCodes.TOURNAMENT_PLAY_HAS_NOT_STARTED = 40581), + (e.reasonCodes.TOURNAMENT_PLAY_HAS_ENDED = 40582), + (e.reasonCodes.NEW_CREDENTIAL_IN_USE = 40583), + (e.reasonCodes.OLD_CREDENTIAL_NOT_OWNED = 40584), + (e.reasonCodes.CLOUD_CODE_SECURITY_ERROR = 40585), + (e.reasonCodes.RTT_SERVER_NOT_FOUND = 40586), + (e.reasonCodes.RTT_CLIENT_NOT_FOUND = 40587), + (e.reasonCodes.NO_RTT_SERVERS_AVAILABLE = 40588), + (e.reasonCodes.PROFILE_SESSION_MISMATCH = 40589), + (e.reasonCodes.WAITING_FOR_ON_DEMAND_TOURNAMENT_TO_START = 40590), + (e.reasonCodes.CDN_URLS_NOT_SUPPORTED = 40591), + (e.reasonCodes.CLOUD_CONTAINER_ERROR = 40592), + (e.reasonCodes.MESSAGING_FEATURE_NOT_CONFIGURED = 40593), + (e.reasonCodes.CHAT_FEATURE_NOT_CONFIGURED = 40594), + (e.reasonCodes.MESSAGE_NOT_FOUND = 40595), + (e.reasonCodes.COLLECTION_CREATE_DISABLED = 40596), + (e.reasonCodes.LEADERBAORD_COLLECTION_CREATE_DISABLED = 40597), + (e.reasonCodes.MESSAGE_VERSION_MISMATCH = 40598), + (e.reasonCodes.MESSAGEBOX_VERSION_MISMATCH = 40599), + (e.reasonCodes.MESSAGE_TOO_LARGE = 40600), + (e.reasonCodes.FEATURE_NOT_ENABLED = 40601), + (e.reasonCodes.CHANNEL_NOT_FOUND = 40603), + (e.reasonCodes.MALFORMED_FORM_DATA = 40604), + (e.reasonCodes.MISSING_LAST_PACKET_RESPONSE = 40605), + (e.reasonCodes.PACKET_IN_PROGRESS = 40606), + (e.reasonCodes.LOBBY_MEMBER_NOT_FOUND = 40607), + (e.reasonCodes.LOBBY_TEAM_NOT_FOUND = 40608), + (e.reasonCodes.LOBBY_ENTRY_QUEUE_MEMBER_NOT_FOUND = 40609), + (e.reasonCodes.INVALID_HEADER_APP_ID = 40610), + (e.reasonCodes.LOBBY_TYPE_NOT_FOUND = 40611), + (e.reasonCodes.LOBBY_TEAM_FULL = 40612), + (e.reasonCodes.LOBBY_NOT_FOUND = 40613), + (e.reasonCodes.MESSAGE_CONTENT_INVALID_JSON = 40614), + (e.reasonCodes.RTT_FEATURE_NOT_CONFIGURED = 40615), + (e.reasonCodes.CLOUD_CODE_ONLY_METHOD = 40616), + (e.reasonCodes.MESSAGE_FROM_JSON_ID_MUST_BE_NULL = 40617), + (e.reasonCodes.MESSAGE_FROM_JSON_NAME_MANDATORY = 40618), + (e.reasonCodes.INVALID_LOBBY_STEP_ALIGNMENT = 40619), + (e.reasonCodes.INVALID_LOBBY_STEP_STRATEGY = 40620), + (e.reasonCodes.MESSAGING_MAX_RECIPIENTS_EXCEEDED = 40621), + (e.reasonCodes.LOBBY_FEATURE_NOT_CONFIGURED = 40622), + (e.reasonCodes.TOO_MANY_USERS_FOR_TEAM = 40623), + (e.reasonCodes.TOO_MANY_USERS_FOR_LOBBY_TYPE = 40624), + (e.reasonCodes.DIVISION_SET_DOESNOT_EXIST = 40625), + (e.reasonCodes.LOBBY_CONFIG_NOT_FOUND = 40626), + (e.reasonCodes.PRESENCE_NOT_INITIALIZED = 40627), + (e.reasonCodes.PRESENCE_FEATURE_NOT_CONFIGURED = 40628), + (e.reasonCodes.PLAYER_ALREADY_IN_ACTIVE_DIVISION_SET = 40629), + (e.reasonCodes.TOURNAMENT_CODE_MISSING = 40630), + (e.reasonCodes.ERROR_ASSIGNING_DIVISION_SET_INSTANCE = 40631), + (e.reasonCodes.LEADERBOARD_NOT_DIVISION_SET_INSTANCE = 40632), + (e.reasonCodes.DIVISION_SET_SCHEDULING_TYPE_DOES_NOT_EXIST = 40633), + (e.reasonCodes.PRESENCE_ACTIVITY_NOT_ENABLED = 40634), + (e.reasonCodes.PRESENCE_REALTIME_NOT_ENABLED = 40635), + (e.reasonCodes.DIVISION_SET_MAX_SIZE_REACHED = 40636), + (e.reasonCodes.DIVISION_SET_INFO_ERROR = 40637), + (e.reasonCodes.DIVISION_SET_API_MUST_BE_USED = 40638), + (e.reasonCodes.API_CALL_REJECTED = 40639), + (e.reasonCodes.LEADERBOARD_TOURNAMENT_TEMPLATE_ONLY = 40640), + (e.reasonCodes.INVALID_TOURNAMENT_JOB_ID = 40641), + (e.reasonCodes.LEADERBOARD_ROTATION_ERROR = 40642), + (e.reasonCodes.CLOUD_COMPUTING_ERROR = 40643), + (e.reasonCodes.DOCKER_ERROR = 40644), + (e.reasonCodes.ROOM_SERVER_HOST_NOT_FOUND = 40645), + (e.reasonCodes.INVALID_ATTACHMENT_DATA = 40646), + (e.reasonCodes.SCRIPT_PARSING_ERROR = 40647), + (e.reasonCodes.INVALID_LOBBY_STEP_RANGES = 40648), + (e.reasonCodes.LOG_IN_LOG_ERROR = 40649), + (e.reasonCodes.CACHE_OBJECT_TOO_LARGE = 40650), + (e.reasonCodes.IDENTIFY_DORMANT_USERS_FEATURE_NOT_CONFIGURED = 40651), + (e.reasonCodes.USER_PURGE_NOTICE_NOT_CONFIGURED = 40652), + (e.reasonCodes.INVALID_CX_ID = 40653), + (e.reasonCodes.TOO_MANY_CACHE_OBJECTS = 40654), + (e.reasonCodes.HOSTING_NOT_ENABLED = 40655), + (e.reasonCodes.UNSUPPORTED_GROUP_LEADERBOARD_OPERATION = 40656), + (e.reasonCodes.INVALID_PLAYER = 40657), + (e.reasonCodes.TOO_MANY_LISTENERS = 40658), + (e.reasonCodes.CREATE_FAILED = 40659), + (e.reasonCodes.INVALID_PARAMETER_VALUE = 40660), + (e.reasonCodes.ITEM_VERSION_MISMATCH = 40661), + (e.reasonCodes.ITEM_PUBLISH_ERROR = 40662), + (e.reasonCodes.ITEM_NOT_FOUND = 40663), + (e.reasonCodes.ITEM_NO_USES = 40664), + (e.reasonCodes.ITEM_CREATE_ERROR = 40665), + (e.reasonCodes.ITEM_COOL_DOWN = 40666), + (e.reasonCodes.TASK_STATE_NOT_FOUND = 40667), + (e.reasonCodes.ITEM_UPDATE_ERROR = 40668), + (e.reasonCodes.ITEM_DELETE_ERROR = 40669), + (e.reasonCodes.ITEM_INVALID_VALUE = 40670), + (e.reasonCodes.ITEM_SELL_OR_PURCHASE_REVERSAL_ERROR = 40671), + (e.reasonCodes.ITEM_GIFTED = 40672), + (e.reasonCodes.MISSING_APP_CONTEXT = 40673), + (e.reasonCodes.PUBLIC_KEY_IN_USE = 40674), + (e.reasonCodes.CUSTOM_ENTITY_NOT_FOUND = 40675), + (e.reasonCodes.ITEM_GIFTING_ERROR = 40676), + (e.reasonCodes.ITEM_NOT_AVAILABLE_ON_BLOCKCHAIN = 40677), + (e.reasonCodes.MISSING_BLOCKCHAIN_INTEGRATION = 40678), + (e.reasonCodes.MISSING_BLOCKCHAIN_USER_IDENTITY = 40679), + (e.reasonCodes.STACKABLE_ITEMS_NOT_PERMITTED_ON_BLOCKCHAIN = 40680), + (e.reasonCodes.BLOCKCHAIN_PUBLISH_IN_PROGRESS = 40681), + (e.reasonCodes.JWT_VERIFY_ERROR = 40682), + (e.reasonCodes.USER_ALREADY_EXISTS = 40683), + (e.reasonCodes.INVALID_EXT_AUTH_TYPE = 40684), + (e.reasonCodes.CUSTOM_ENTITY_INDEX_ERROR = 40685), + (e.reasonCodes.CUSTOM_ENTITY_UPDATE_FIELDS_ERROR = 40686), + (e.reasonCodes.INVALID_LOBBY_STEP_ALGOS = 40687), + (e.reasonCodes.INVALID_COMPOUND_RANGES = 40688), + (e.reasonCodes.MISSING_COMPOUND_RANGES = 40689), + (e.reasonCodes.MISSING_PING_DATA = 40690), + (e.reasonCodes.INVALID_PING_STEP_ALGO = 40691), + (e.reasonCodes.GROUP_NOT_FOUND = 40692), + (e.reasonCodes.SCRIPT_UPDATE_FAILED = 40693), + (e.reasonCodes.CUSTOM_ENTITY_REPLACE_ERROR = 40694), + (e.reasonCodes.CUSTOM_ENTITY_TYPE_IMPORT_ERROR = 40695), + (e.reasonCodes.CUSTOM_ENTITY_IMPORT_WARNING = 40696), + (e.reasonCodes.IDENTIFY_DORMANT_USERS_FOR_EXPORT_NOT_CONFIGURED = 40697), + (e.reasonCodes.IDENTIFY_DORMANT_USERS_FOR_EXPORT_ERROR = 40698), + (e.reasonCodes.UPDATE_SINGLETON_FAILED = 40699), + (e.reasonCodes.INVALID_STORE_ID = 40700), + (e.reasonCodes.METHOD_DEPRECATED = 40701), + (e.reasonCodes.INVALID_BILLING_PROVIDER_ID = 40702), + (e.reasonCodes.INVALID_STORE_DATA = 40703), + (e.reasonCodes.USER_FILE_MISSING = 40704), + (e.reasonCodes.GLOBAL_FILE_EXISTS = 40705), + (e.reasonCodes.INVALID_FILE_NAME = 40706), + (e.reasonCodes.FILE_TREE_VERSION_MISMATCH = 40707), + (e.reasonCodes.FILE_TREE_FOLDER_MISSING = 40708), + (e.reasonCodes.FOLDER_ALREADY_EXISTS = 40709), + (e.reasonCodes.INVALID_TREE_ID = 40710), + (e.reasonCodes.FILE_VERSION_MISMATCH = 40711), + (e.reasonCodes.INVALID_FOLDER_PATH = 40712), + (e.reasonCodes.FILENAME_MISMATCH = 40713), + (e.reasonCodes.FOLDERPATH_MISMATCH = 40714), + (e.reasonCodes.INVALID_CHARS_IN_STRING = 40715), + (e.reasonCodes.FOLDER_NOT_EMPTY = 40716), + (e.reasonCodes.INVALID_IMAGE_URL = 40717), + (e.reasonCodes.UNABLE_TO_UPDATE_PRICE = 40718), + (e.reasonCodes.UNABLE_TO_DELETE_PRICE = 40718), + (e.reasonCodes.WRONG_JOB_TYPE = 40719), + (e.reasonCodes.CLOUDCODE_JOB_NOT_RUNNING = 40720), + (e.reasonCodes.SCRIPT_HAS_DEPENDENCIES = 40721), + (e.reasonCodes.PEER_SERVICE_NOT_PUBLISHED = 40722), + (e.reasonCodes.MISSING_FOLDER_NAME = 40723), + (e.reasonCodes.UPLOLAD_IN_PROGRESS = 40724), + (e.reasonCodes.REFRESH_IN_PROGRESS = 40725), + (e.reasonCodes.REFRESH_INTERRUPTED = 40726), + (e.reasonCodes.GAMELIFT_ERROR = 40727), + (e.reasonCodes.GAMELIFT_LAUNCH_ERROR = 40728), + (e.reasonCodes.MAX_HOSTED_SERVERS_REACHED = 40729), + (e.reasonCodes.DUPLICATE_PACKET_ID = 40730), + (e.reasonCodes.FEATURE_NOT_SUPPORTED_BY_BILLING_PLAN = 40731), + (e.reasonCodes.NO_FRIENDS_FOUND = 40740), + (e.reasonCodes.PRODUCT_TRANSACTION_NOT_FOUND = 40741), + (e.reasonCodes.ITEM_DEF_NOT_FOUND = 40742), + (e.reasonCodes.ITEM_DEF_HAS_DEPENDENCIES = 40743), + (e.reasonCodes.TRANSFER_JOB_IDLE_TIMEOUT = 40744), + (e.reasonCodes.GROUP_MEMBER_ACL_MORE_RESTRICTIVE_THAN_OTHER = 40745), + (e.reasonCodes.GROUP_MEMBER_ACL_MUST_BE_READ_WRITE_FOR_UNOWNED_ENTITY = 40746), + (e.reasonCodes.GROUP_MEMBER_ACL_REQUIRED = 40747), + (e.reasonCodes.GROUP_TYPE_MAX_MEMBERS_EXCEEDED = 40748), + (e.reasonCodes.REQUEST_FAILED = 40801), + (e.reasonCodes.RESET_QUESTS_FAILED = 40802), + (e.reasonCodes.RESET_ALL_QUESTS_AND_MILESTONES_FAILED = 40803), + (e.reasonCodes.MILESTONE_NOT_FOUND = 40804), + (e.reasonCodes.MILESTONE_CREATE_ERROR = 40805), + (e.reasonCodes.MILESTONE_UPDATE_ERROR = 40806), + (e.reasonCodes.MILESTONE_DELETE_ERROR = 40807), + (e.reasonCodes.MILESTONE_VERSION_ERROR = 40808), + (e.reasonCodes.QUEST_NOT_FOUND = 40809), + (e.reasonCodes.QUEST_CREATE_ERROR = 40810), + (e.reasonCodes.QUEST_UPDATE_ERROR = 40811), + (e.reasonCodes.QUEST_DELETE_ERROR = 40812), + (e.reasonCodes.QUEST_VERSION_ERROR = 40813), + (e.reasonCodes.QUEST_ADD_MILESTONE_ERROR = 40814), + (e.reasonCodes.QUEST_DELETE_MILESTONE_ERROR = 40815), + (e.reasonCodes.QUEST_REORDER_MILESTONES_ERROR = 40816), + (e.reasonCodes.PROMOTION_NOT_FOUND = 40820), + (e.reasonCodes.VERSION_MISMATCH = 40821), + (e.reasonCodes.UNSUPPORTED_CRITERIA_FOR_SHARDED_COLLECTIONS = 40822), + (e.reasonCodes.STEAM_ERROR = 40830), + (e.reasonCodes.INVALID_LEADERBOARD_TOURNAMENT_SETTING = 40840), + (e.reasonCodes.LEADERBOARD_EDIT_TOURNAMENT_SETTINGS_ERROR = 40841), + (e.reasonCodes.LEADERBOARD_SCORES_EXIST = 40842), + (e.reasonCodes.TOURNAMENT_SCORES_EXIST = 40843), + (e.reasonCodes.LEADERBOARD_DBVERSION_MISMATCH = 40844), + (e.reasonCodes.LEADERBOARD_API_DOES_NOT_APPLY = 40845), + (e.reasonCodes.MISSING_CONFIG = 40900), + (e.reasonCodes.INVALID_SAML_RESP = 40901), + (e.reasonCodes.MISSING_PAGE_NAME = 40902), + (e.reasonCodes.INVALID_PAGE_NAME = 40903), + (e.reasonCodes.MALFORMED_RELAY_STATE = 40904), + (e.reasonCodes.INVALID_RESPONSE_ID = 40905), + (e.reasonCodes.LOGOUT_ERROR = 40906), + (e.reasonCodes.SCRIPT_EXISTS = 40907), + (e.reasonCodes.SCRIPT_DUPLICATE_EXISTS = 40908), + (e.reasonCodes.INVALID_UPLOAD_EXTENSION = 40909), + (e.reasonCodes.NO_TWITTER_CONSUMER_KEY = 500001), + (e.reasonCodes.NO_TWITTER_CONSUMER_SECRET = 500002), + (e.reasonCodes.INVALID_CONFIGURATION = 500003), + (e.reasonCodes.ERROR_GETTING_REQUEST_TOKEN = 500004), + (e.reasonCodes.ERROR_GETTING_ACCESS_TOKEN = 500005), + (e.reasonCodes.TWITTER_AUTH_ERROR = 500006), + (e.reasonCodes.TWITTER_ERROR = 500007), + (e.reasonCodes.FACEBOOK_ERROR = 500010), + (e.reasonCodes.FACEBOOK_SECRET_MISMATCH = 500011), + (e.reasonCodes.FACEBOOK_AUTHENTICATION_ERROR = 500012), + (e.reasonCodes.FACEBOOK_APPLICATION_TOKEN_REQUEST_ERROR = 500013), + (e.reasonCodes.FACEBOOK_BAD_APPLICATION_TOKEN_SIGNATURE = 500014), + (e.reasonCodes.UNSUPPORTED_SOCIAL_PLATFORM_CODE = 500020), + (e.reasonCodes.NOT_TEAM_ADMIN = 55e4), + (e.reasonCodes.NO_TEAM_ACCESS = 550001), + (e.reasonCodes.MISSING_COMPANY_RECORD = 550002), + (e.reasonCodes.TEAM_MEMBER_NOT_FOUND = 550003), + (e.reasonCodes.TEAM_MEMBER_NOT_ENABLED = 550004), + (e.reasonCodes.TEAM_MEMBER_NOT_ACTIVE = 550005), + (e.reasonCodes.TEAM_MEMBER_LOCKED = 550006), + (e.reasonCodes.INVALID_PASSWORD = 550007), + (e.reasonCodes.TOKEN_INVALID = 550008), + (e.reasonCodes.TOKEN_EXPIRED = 550009), + (e.reasonCodes.APP_NOT_FOUND = 550010), + (e.reasonCodes.TEMPLATE_GAME_NOT_FOUND = 550011), + (e.reasonCodes.INVALID_TEMPLATE_GAME_TEAM = 550012), + (e.reasonCodes.BASIC_AUTH_FAILURE = 550013), + (e.reasonCodes.EMAIL_MISMATCH = 550014), + (e.reasonCodes.EMAIL_ID_NOT_FOUND = 550015), + (e.reasonCodes.MONGO_DB_EXCEPTION = 600001), + (e.reasonCodes.CONCURRENT_LOCK_ERROR = 600002), + (e.reasonCodes.USER_EXPORT_ERROR = 600003), + (e.reasonCodes.POST_SCORE_ON_BEHALF_OF_ERROR = 600004), + (e.reasonCodes.INVALID_USER_STATUS = 600005), + (e.reasonCodes.SLACK_WEBHOOK_SEND_ERROR = 600006), + (e.reasonCodes.SLACK_NOT_ENABLED_FOR_APP = 600007), + (e.reasonCodes.ERROR_AQUIRING_LOBBY_LOCK = 600008), + (e.reasonCodes.ERROR_SETTING_NEW_LOBBY_OWNER = 600009), + (e.reasonCodes.ERROR_SWITCHING_TEAMS = 600010), + (e.reasonCodes.DEPLOY_FAILED = 600011), + (e.reasonCodes.BUILDER_API_KEY_NOT_FOUND = 60100), + (e.reasonCodes.BUILDER_API_INVALID_KEY_SCOPE = 60101), + (e.reasonCodes.BUILDER_API_UPDATED_AT_MISMATCH = 60102), + (e.reasonCodes.BUILDER_API_TEAM_NAME_MISMATCH = 60103), + (e.reasonCodes.BUILDER_API_TEAM_HAS_APPS = 60104), + (e.reasonCodes.BUILDER_API_UNEXPECTED_EXCEPTION = 60105), + (e.reasonCodes.BUILDER_API_PARTIAL_TEAM_DELETION = 60106), + (e.reasonCodes.BUILDER_API_APP_DELETED = 60107), + (e.reasonCodes.BUILDER_API_APP_DISABLED = 60108), + (e.reasonCodes.BUILDER_API_APP_IS_LIVE = 60109), + (e.reasonCodes.BUILDER_API_APP_SUSPENDED = 60110), + (e.reasonCodes.BUILDER_API_CREATED_AT_MISMATCH = 60111), + (e.reasonCodes.PLAYSTATION_NETWORK_ERROR = 60200), + (e.reasonCodes.RTT_LEFT_BY_CHOICE = 8e4), + (e.reasonCodes.RTT_EVICTED = 80001), + (e.reasonCodes.RTT_LOST_CONNECTION = 80002), + (e.reasonCodes.RTT_TIMEOUT = 80100), + (e.reasonCodes.RTT_ROOM_READY = 80101), + (e.reasonCodes.RTT_ROOM_CANCELLED = 80102), + (e.reasonCodes.RTT_ERROR_ASSIGNING_ROOM = 80103), + (e.reasonCodes.RTT_ERROR_LAUNCHING_ROOM = 80104), + (e.reasonCodes.RTT_BY_REQUEST = 80105), + (e.reasonCodes.RTT_NO_LOBBIES_FOUND = 80200), + (e.reasonCodes.RTT_FIND_REQUEST_CANCELLED = 80201), + (e.reasonCodes.CLIENT_NETWORK_ERROR_TIMEOUT = 90001), + (e.reasonCodes.CLIENT_UPLOAD_FILE_CANCELLED = 90100), + (e.reasonCodes.CLIENT_UPLOAD_FILE_TIMED_OUT = 90101), + (e.reasonCodes.CLIENT_UPLOAD_FILE_UNKNOWN = 90102), + (e.reasonCodes.CLIENT_DISABLED = 90200)); + } + function F() { + var e = this; + ((e.redemptionCode = {}), + (e.SERVICE_REDEMPTION_CODE = "redemptionCode"), + (e.redemptionCode.OPERATION_REDEEM_CODE = "REDEEM_CODE"), + (e.redemptionCode.OPERATION_GET_REDEEMED_CODES = + "GET_REDEEMED_CODES"), + (e.redemptionCode.redeemCode = function (t, a, i, n) { + var s = { scanCode: t, codeType: a }; + (i && (s.customRedemptionInfo = i), e.brainCloudManager.sendRequest({ - service: e.SERVICE_IDENTITY, - operation: e.identity.OPERATION_DETACH, - data: { - externalId: t, - authenticationType: a, - confirmAnonymous: i, - }, + service: e.SERVICE_REDEMPTION_CODE, + operation: e.redemptionCode.OPERATION_REDEEM_CODE, + data: s, callback: n, - }); - }), - (e.identity.switchToChildProfileInternal = function ( - t, - a, - i, - n, - s, - ) { - var o = - window.navigator.userLanguage || window.navigator.language, - r = (o = o.split("-"))[0], - l = o[1], - c = -new Date().getTimezoneOffset() / 60; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_IDENTITY, - operation: e.identity.OPERATION_SWITCH_TO_CHILD_PROFILE, - data: { - profileId: t, - gameId: a, - forceCreate: i, - forceSingleton: n, - releasePlatform: "WEB", - timeZoneOffset: c, - languageCode: r, - countryCode: l, - }, - callback: s, - }); - })); - } - function T() { - var e = this; - ((e.itemCatalog = {}), - (e.SERVICE_ITEMCATALOG = "itemCatalog"), - (e.itemCatalog.OPERATION_GET_CATALOG_ITEM_DEFINITION = - "GET_CATALOG_ITEM_DEFINITION"), - (e.itemCatalog.OPERATION_GET_CATALOG_ITEMS_PAGE = - "GET_CATALOG_ITEMS_PAGE"), - (e.itemCatalog.OPERATION_GET_CATALOG_ITEMS_PAGE_OFFSET = - "GET_CATALOG_ITEMS_PAGE_OFFSET"), - (e.itemCatalog.getCatalogItemDefinition = function (t, a) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_ITEMCATALOG, - operation: e.itemCatalog.OPERATION_GET_CATALOG_ITEM_DEFINITION, - data: { defId: t }, - callback: a, - }); - }), - (e.itemCatalog.getCatalogItemsPage = function (t, a) { + })); + }), + (e.redemptionCode.getRedeemedCodes = function (t, a) { + var i = {}; + (t && (i.codeType = t), e.brainCloudManager.sendRequest({ - service: e.SERVICE_ITEMCATALOG, - operation: e.itemCatalog.OPERATION_GET_CATALOG_ITEMS_PAGE, - data: { context: t }, + service: e.SERVICE_REDEMPTION_CODE, + operation: e.redemptionCode.OPERATION_GET_REDEEMED_CODES, + data: i, callback: a, - }); - }), - (e.itemCatalog.getCatalogItemsPageOffset = function (t, a, i) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_ITEMCATALOG, - operation: - e.itemCatalog.OPERATION_GET_CATALOG_ITEMS_PAGE_OFFSET, - data: { context: t, pageOffset: a }, - callback: i, - }); - })); - } - function R() { - var e = this; - ((e.lobby = {}), - (e.SERVICE_LOBBY = "lobby"), - (e.lobby.OPERATION_CREATE_LOBBY = "CREATE_LOBBY"), - (e.lobby.OPERATION_CREATE_LOBBY_WITH_PING_DATA = - "CREATE_LOBBY_WITH_PING_DATA"), - (e.lobby.OPERATION_FIND_LOBBY = "FIND_LOBBY"), - (e.lobby.OPERATION_FIND_LOBBY_WITH_PING_DATA = - "FIND_LOBBY_WITH_PING_DATA"), - (e.lobby.OPERATION_FIND_OR_CREATE_LOBBY = "FIND_OR_CREATE_LOBBY"), - (e.lobby.OPERATION_FIND_OR_CREATE_LOBBY_WITH_PING_DATA = - "FIND_OR_CREATE_LOBBY_WITH_PING_DATA"), - (e.lobby.OPERATION_GET_LOBBY_DATA = "GET_LOBBY_DATA"), - (e.lobby.OPERATION_LEAVE_LOBBY = "LEAVE_LOBBY"), - (e.lobby.OPERATION_JOIN_LOBBY = "JOIN_LOBBY"), - (e.lobby.OPERATION_JOIN_LOBBY_WITH_PING_DATA = - "JOIN_LOBBY_WITH_PING_DATA"), - (e.lobby.OPERATION_REMOVE_MEMBER = "REMOVE_MEMBER"), - (e.lobby.OPERATION_SEND_SIGNAL = "SEND_SIGNAL"), - (e.lobby.OPERATION_SWITCH_TEAM = "SWITCH_TEAM"), - (e.lobby.OPERATION_UPDATE_READY = "UPDATE_READY"), - (e.lobby.OPERATION_UPDATE_SETTINGS = "UPDATE_SETTINGS"), - (e.lobby.OPERATION_CANCEL_FIND_REQUEST = "CANCEL_FIND_REQUEST"), - (e.lobby.OPERATION_GET_REGIONS_FOR_LOBBIES = - "GET_REGIONS_FOR_LOBBIES"), - (e.lobby.OPERATION_PING_REGIONS = "PING_REGIONS"), - (e.lobby.OPERATION_GET_LOBBY_INSTANCES = "GET_LOBBY_INSTANCES"), - (e.lobby.OPERATION_GET_LOBBY_INSTANCES_WITH_PING_DATA = - "GET_LOBBY_INSTANCES_WITH_PING_DATA")); - var t = null, - a = null, - i = [], - n = 0; - function s(e) { - e({ status: 200, data: t }); - } - function o(e, a, r) { - if (a.length >= 4) { - a.sort(function (e, t) { - return e - t; - }); - for (var l = 0, c = 0; c < a.length - 1; ++c) l += a[c]; - ((l /= a.length - 1), - (t[e.name] = Math.round(l)), - i.length > 0 - ? o((e = i.splice(0, 1)[0]), [], r) - : Object.keys(t).length == n && s(r)); - } else - !(function (e, t) { - var a, - i = false, - n = "http://" + e.url; - a = window.XMLHttpRequest - ? new XMLHttpRequest() - : new ActiveXObject("Microsoft.XMLHTTP"); - var s = false, - o = setTimeout(function () { - ((s = true), a.abort(), t(999)); - }, 2e3), - r = 0; - ((a.onreadystatechange = function () { - if (!s && a.readyState == XMLHttpRequest.DONE) { - (s || clearTimeout(o), 200 == a.status && (i = true)); - var e = new Date().getTime(), - n = Math.min(999, e - r); - ((n < 0 || !i) && (n = 999), t(n)); - } - }), - a.open("GET", n, true), - a.setRequestHeader("Access-Control-Allow-Origin", ":*"), - a.setRequestHeader("Access-Control-Allow-Headers", ":*"), - (r = new Date().getTime()), - a.send()); - })(e, function (t) { - (a.push(t), o(e, a, r)); - }); - } - function r(a, i, n) { - t && Object.keys(t).length > 0 - ? ((a.pingData = t), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_LOBBY, - operation: i, - data: a, - callback: n, - })) - : setTimeout(function () { - n({ - status: e.statusCodes.BAD_REQUEST, - reason_code: e.reasonCodes.MISSING_REQUIRED_PARAMETER, - status_message: - "Required Parameter 'pingData' is missing. Please ensure 'pingData' exists by first calling GetRegionsForLobbies and PingRegions, and waiting for response before proceeding.", - severity: "ERROR", - }); - }, 0); - } - ((e.lobby.createLobby = function (t, a, i, n, s, o, r, l) { - var c = { - lobbyType: t, - rating: a, - otherUserCxIds: i, - isReady: n, - extraJson: s, - teamCode: o, - settings: r, - }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_LOBBY, - operation: e.lobby.OPERATION_CREATE_LOBBY, - data: c, - callback: l, - }); + })); + })); + } + function Y() { + var e = this; + ((e.relay = {}), + (e.SERVICE_RELAY = "relay"), + (e.relay.TO_ALL_PLAYERS = 0xffffffffff), + (e.relay.CHANNEL_HIGH_PRIORITY_1 = 0), + (e.relay.CHANNEL_HIGH_PRIORITY_2 = 1), + (e.relay.CHANNEL_NORMAL_PRIORITY = 2), + (e.relay.CHANNEL_LOW_PRIORITY = 3), + (e.relay.connect = function (t, a, i) { + e.brainCloudRelayComms.connect(t, a, i); }), - (e.lobby.createLobbyWithPingData = function ( - t, - a, - i, - n, - s, - o, - l, - c, - ) { - r( - { - lobbyType: t, - rating: a, - otherUserCxIds: i, - isReady: n, - extraJson: s, - teamCode: o, - settings: l, - }, - e.lobby.OPERATION_CREATE_LOBBY_WITH_PING_DATA, - c, - ); - }), - (e.lobby.findLobby = function (t, a, i, n, s, o, r, l, c, d) { - var u = { - lobbyType: t, - rating: a, - maxSteps: i, - algo: n, - filterJson: s, - otherUserCxIds: o, - isReady: r, - extraJson: l, - teamCode: c, - }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_LOBBY, - operation: e.lobby.OPERATION_FIND_LOBBY, - data: u, - callback: d, - }); - }), - (e.lobby.findLobbyWithPingData = function ( + (e.relay.disconnect = function () { + e.brainCloudRelayComms.disconnect(); + }), + (e.relay.isConnected = function () { + return e.brainCloudRelayComms.isConnected; + }), + (e.relay.getPing = function () { + return e.brainCloudRelayComms.ping; + }), + (e.relay.setPingInterval = function (t) { + e.brainCloudRelayComms.setPingInterval(t); + }), + (e.relay.getOwnerProfileId = function () { + return e.brainCloudRelayComms.getOwnerProfileId(); + }), + (e.relay.getOwnerCxId = function () { + return e.brainCloudRelayComms.getOwnerCxId(); + }), + (e.relay.getProfileIdForNetId = function (t) { + return e.brainCloudRelayComms.getProfileIdForNetId(t); + }), + (e.relay.getCxIdForNetId = function (t) { + return e.brainCloudRelayComms.getCxIdForNetId(t); + }), + (e.relay.getNetIdForProfileId = function (t) { + return e.brainCloudRelayComms.getNetIdForProfileId(t); + }), + (e.relay.getNetIdForCxId = function (t) { + return e.brainCloudRelayComms.getNetIdForCxId(t); + }), + (e.relay.registerRelayCallback = function (t) { + e.brainCloudRelayComms.registerRelayCallback(t); + }), + (e.relay.deregisterRelayCallback = function () { + e.brainCloudRelayComms.deregisterRelayCallback(); + }), + (e.relay.registerSystemCallback = function (t) { + e.brainCloudRelayComms.registerSystemCallback(t); + }), + (e.relay.deregisterSystemCallback = function () { + e.brainCloudRelayComms.deregisterSystemCallback(); + }), + (e.relay.send = function (t, a, i, n, s) { + if (a == e.relay.TO_ALL_PLAYERS) e.relay.sendToAll(t, i, n, s); + else { + var o = Math.pow(2, a); + e.brainCloudRelayComms.sendRelay(t, o, i, n, s); + } + }), + (e.relay.sendToPlayers = function (t, a, i, n, s) { + e.brainCloudRelayComms.sendRelay(t, a, i, n, s); + }), + (e.relay.sendToAll = function (t, a, i, n) { + var s = e.authentication.profileId, + o = e.relay.getNetIdForProfileId(s), + r = Math.pow(2, o), + l = e.relay.TO_ALL_PLAYERS - r; + e.brainCloudRelayComms.sendRelay(t, l, a, i, n); + })); + } + function U() { + var e = this; + ((e.rttService = {}), + (e.SERVICE_RTT = "rttRegistration"), + (e.rttService.OPERATION_REQUEST_CLIENT_CONNECTION = + "REQUEST_CLIENT_CONNECTION"), + (e.rttService.SERVICE_EVENT = "event"), + (e.rttService.SERVICE_CHAT = "chat"), + (e.rttService.SERVICE_LOBBY = "lobby"), + (e.rttService.SERVICE_MESSAGING = "messaging"), + (e.rttService.SERVICE_PRESENCE = "presence"), + (e.rttService.SERVICE_USER_ITEMS = "userItems"), + (e.rttService.enableRTT = function (t, a) { + e.brainCloudRttComms.enableRTT(t, a); + }), + (e.rttService.disableRTT = function () { + e.brainCloudRttComms.disableRTT(); + }), + (e.rttService.getRTTEnabled = function () { + return e.brainCloudRttComms.isRTTEnabled(); + }), + (e.rttService.isRTTEnabled = function () { + return e.brainCloudRttComms.isRTTEnabled(); + }), + (e.rttService.getConnectionStatus = function () { + return e.brainCloudRttComms.getConnectionStatus(); + }), + (e.rttService.getRTTConnectionId = function () { + return e.brainCloudRttComms.getRTTConnectionId(); + }), + (e.rttService.registerRTTEventCallback = function (t) { + e.brainCloudRttComms.registerRTTCallback( + e.rttService.SERVICE_EVENT, t, - a, - i, - n, - s, - o, - l, - c, - d, - u, - ) { - r( - { - lobbyType: t, - rating: a, - maxSteps: i, - algo: n, - filterJson: s, - otherUserCxIds: o, - isReady: l, - extraJson: c, - teamCode: d, - }, - e.lobby.OPERATION_FIND_LOBBY_WITH_PING_DATA, - u, - ); - }), - (e.lobby.findOrCreateLobby = function ( + ); + }), + (e.rttService.deregisterRTTEventCallback = function () { + e.brainCloudRttComms.deregisterRTTCallback( + e.rttService.SERVICE_EVENT, + ); + }), + (e.rttService.registerRTTChatCallback = function (t) { + e.brainCloudRttComms.registerRTTCallback( + e.rttService.SERVICE_CHAT, t, - a, - i, - n, - s, - o, - r, - l, - c, - d, - u, - ) { - var h = { - lobbyType: t, - rating: a, - maxSteps: i, - algo: n, - filterJson: s, - otherUserCxIds: o, - settings: r, - isReady: l, - extraJson: c, - teamCode: d, - }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_LOBBY, - operation: e.lobby.OPERATION_FIND_OR_CREATE_LOBBY, - data: h, - callback: u, - }); - }), - (e.lobby.findOrCreateLobbyWithPingData = function ( + ); + }), + (e.rttService.deregisterRTTChatCallback = function () { + e.brainCloudRttComms.deregisterRTTCallback( + e.rttService.SERVICE_CHAT, + ); + }), + (e.rttService.registerRTTMessagingCallback = function (t) { + e.brainCloudRttComms.registerRTTCallback( + e.rttService.SERVICE_MESSAGING, t, - a, - i, - n, - s, - o, - l, - c, - d, - u, - h, - ) { - r( - { - lobbyType: t, - rating: a, - maxSteps: i, - algo: n, - filterJson: s, - otherUserCxIds: o, - settings: l, - isReady: c, - extraJson: d, - teamCode: u, - }, - e.lobby.OPERATION_FIND_OR_CREATE_LOBBY_WITH_PING_DATA, - h, - ); - }), - (e.lobby.getLobbyData = function (t, a) { - var i = { lobbyId: t }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_LOBBY, - operation: e.lobby.OPERATION_GET_LOBBY_DATA, - data: i, - callback: a, - }); - }), - (e.lobby.leaveLobby = function (t, a) { - var i = { lobbyId: t }; + ); + }), + (e.rttService.deregisterRTTMessagingCallback = function () { + e.brainCloudRttComms.deregisterRTTCallback( + e.rttService.SERVICE_MESSAGING, + ); + }), + (e.rttService.registerRTTLobbyCallback = function (t) { + e.brainCloudRttComms.registerRTTCallback( + e.rttService.SERVICE_LOBBY, + t, + ); + }), + (e.rttService.deregisterRTTLobbyCallback = function () { + e.brainCloudRttComms.deregisterRTTCallback( + e.rttService.SERVICE_LOBBY, + ); + }), + (e.rttService.registerRTTPresenceCallback = function (t) { + e.brainCloudRttComms.registerRTTCallback( + e.rttService.SERVICE_PRESENCE, + t, + ); + }), + (e.rttService.deregisterRTTPresenceCallback = function () { + e.brainCloudRttComms.deregisterRTTCallback( + e.rttService.SERVICE_PRESENCE, + ); + }), + (e.rttService.registerRTTBlockchainRefresh = function (t) { + e.brainCloudRttComms.registerRTTCallback( + e.rttService.SERVICE_USER_INVENTORY_MANAGEMENT, + t, + ); + }), + (e.rttService.deregisterRTTBlockchainCallback = function () { + e.brainCloudRttComms.deregisterRTTCallback( + e.rttService.SERVICE_USER_INVENTORY_MANAGEMENT, + ); + }), + (e.rttService.deregisterAllRTTCallbacks = function () { + e.brainCloudRttComms.deregisterAllRTTCallbacks(); + }), + (e.rttService.requestClientConnection = function (t) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_RTT, + operation: e.rttService.OPERATION_REQUEST_CLIENT_CONNECTION, + data: {}, + callback: t, + }); + })); + } + function j() { + var e = this; + ((e.s3Handling = {}), + (e.SERVICE_S3HANDLING = "s3Handling"), + (e.s3Handling.OPERATION_GET_FILE_LIST = "GET_FILE_LIST"), + (e.s3Handling.OPERATION_GET_UPDATED_FILES = "GET_UPDATED_FILES"), + (e.s3Handling.OPERATION_GET_CDN_URL = "GET_CDN_URL"), + (e.s3Handling.getUpdatedFiles = function (t, a, i) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_S3HANDLING, + operation: e.s3Handling.OPERATION_GET_UPDATED_FILES, + data: { category: t, fileDetails: a }, + callback: i, + }); + }), + (e.s3Handling.getFileList = function (t, a) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_S3HANDLING, + operation: e.s3Handling.OPERATION_GET_FILE_LIST, + data: { category: t }, + callback: a, + }); + }), + (e.s3Handling.getCDNUrl = function (t, a) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_S3HANDLING, + operation: e.s3Handling.OPERATION_GET_CDN_URL, + data: { fileId: t }, + callback: a, + }); + })); + } + function G() { + var e = this; + ((e.script = {}), + (e.SERVICE_SCRIPT = "script"), + (e.script.OPERATION_RUN = "RUN"), + (e.script.OPERATION_SCHEDULE_CLOUD_SCRIPT = + "SCHEDULE_CLOUD_SCRIPT"), + (e.script.OPERATION_RUN_PARENT_SCRIPT = "RUN_PARENT_SCRIPT"), + (e.script.OPERATION_CANCEL_SCHEDULED_SCRIPT = + "CANCEL_SCHEDULED_SCRIPT"), + (e.script.OPERATION_GET_SCHEDULED_CLOUD_SCRIPTS = + "GET_SCHEDULED_CLOUD_SCRIPTS"), + (e.script.OPERATION_GET_RUNNING_OR_QUEUED_CLOUD_SCRIPTS = + "GET_RUNNING_OR_QUEUED_CLOUD_SCRIPTS"), + (e.script.OPERATION_RUN_PEER_SCRIPT = "RUN_PEER_SCRIPT"), + (e.script.OPERATION_RUN_PEER_SCRIPT_ASYNC = + "RUN_PEER_SCRIPT_ASYNC"), + (e.script.runScript = function (t, a, i) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_SCRIPT, + operation: e.script.OPERATION_RUN, + data: { scriptName: t, scriptData: a }, + callback: i, + }); + }), + (e.script.scheduleRunScriptUTC = function (t, a, i, n) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_SCRIPT, + operation: e.script.OPERATION_SCHEDULE_CLOUD_SCRIPT, + data: { + scriptName: t, + scriptData: a, + startDateUTC: i.getTime(), + }, + callback: n, + }); + }), + (e.script.scheduleRunScriptMillisUTC = function (t, a, i, n) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_SCRIPT, + operation: e.script.OPERATION_SCHEDULE_CLOUD_SCRIPT, + data: { scriptName: t, scriptData: a, startDateUTC: i }, + callback: n, + }); + }), + (e.script.scheduleRunScriptMinutes = function (t, a, i, n) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_SCRIPT, + operation: e.script.OPERATION_SCHEDULE_CLOUD_SCRIPT, + data: { scriptName: t, scriptData: a, minutesFromNow: i }, + callback: n, + }); + }), + (e.script.runParentScript = function (t, a, i, n) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_SCRIPT, + operation: e.script.OPERATION_RUN_PARENT_SCRIPT, + data: { scriptName: t, scriptData: a, parentLevel: i }, + callback: n, + }); + }), + (e.script.cancelScheduledScript = function (t, a) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_SCRIPT, + operation: e.script.OPERATION_CANCEL_SCHEDULED_SCRIPT, + data: { jobId: t }, + callback: a, + }); + }), + (e.script.getRunningOrQueuedCloudScripts = function (t) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_SCRIPT, + operation: + e.script.OPERATION_GET_RUNNING_OR_QUEUED_CLOUD_SCRIPTS, + callback: t, + }); + }), + (e.script.getScheduledCloudScripts = function (t, a) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_SCRIPT, + operation: e.script.OPERATION_GET_SCHEDULED_CLOUD_SCRIPTS, + data: { startDateUTC: t.getTime() }, + callback: a, + }); + }), + (e.script.runPeerScript = function (t, a, i, n) { + var s = { scriptName: t, peer: i }; + (a && (s.scriptData = a), e.brainCloudManager.sendRequest({ - service: e.SERVICE_LOBBY, - operation: e.lobby.OPERATION_LEAVE_LOBBY, - data: i, - callback: a, - }); - }), - (e.lobby.joinLobby = function (t, a, i, n, s, o) { - var r = { - lobbyId: t, - isReady: a, - extraJson: i, - teamCode: n, - otherUserCxIds: s, - }; + service: e.SERVICE_SCRIPT, + operation: e.script.OPERATION_RUN_PEER_SCRIPT, + data: s, + callback: n, + })); + }), + (e.script.runPeerScriptAsync = function (t, a, i, n) { + var s = { scriptName: t, peer: i }; + (a && (s.scriptData = a), e.brainCloudManager.sendRequest({ - service: e.SERVICE_LOBBY, - operation: e.lobby.OPERATION_JOIN_LOBBY, - data: r, - callback: o, - }); - }), - (e.lobby.joinLobbyWithPingData = function (t, a, i, n, s, o) { - r( - { - lobbyId: t, - isReady: a, - extraJson: i, - teamCode: n, - otherUserCxIds: s, - }, - e.lobby.OPERATION_JOIN_LOBBY_WITH_PING_DATA, - o, - ); - }), - (e.lobby.removeMember = function (t, a, i) { - var n = { lobbyId: t, cxId: a }; + service: e.SERVICE_SCRIPT, + operation: e.script.OPERATION_RUN_PEER_SCRIPT_ASYNC, + data: s, + callback: n, + })); + })); + } + function V() { + var e = this; + ((e.socialLeaderboard = {}), + (e.SERVICE_LEADERBOARD = "leaderboard"), + (e.socialLeaderboard.OPERATION_POST_SCORE = "POST_SCORE"), + (e.socialLeaderboard.OPERATION_POST_SCORE_DYNAMIC = + "POST_SCORE_DYNAMIC"), + (e.socialLeaderboard.OPERATION_RESET = "RESET"), + (e.socialLeaderboard.OPERATION_GET_SOCIAL_LEADERBOARD = + "GET_SOCIAL_LEADERBOARD"), + (e.socialLeaderboard.OPERATION_GET_SOCIAL_LEADERBOARD_BY_VERSION = + "GET_SOCIAL_LEADERBOARD_BY_VERSION"), + (e.socialLeaderboard.OPERATION_GET_MULTI_SOCIAL_LEADERBOARD = + "GET_MULTI_SOCIAL_LEADERBOARD"), + (e.socialLeaderboard.OPERATION_GET_GLOBAL_LEADERBOARD_PAGE = + "GET_GLOBAL_LEADERBOARD_PAGE"), + (e.socialLeaderboard.OPERATION_GET_GLOBAL_LEADERBOARD_VIEW = + "GET_GLOBAL_LEADERBOARD_VIEW"), + (e.socialLeaderboard.OPERATION_GET_GLOBAL_LEADERBOARD_VERSIONS = + "GET_GLOBAL_LEADERBOARD_VERSIONS"), + (e.socialLeaderboard.OPERATION_GET_GROUP_SOCIAL_LEADERBOARD = + "GET_GROUP_SOCIAL_LEADERBOARD"), + (e.socialLeaderboard.OPERATION_GET_GROUP_SOCIAL_LEADERBOARD_BY_VERSION = + "GET_GROUP_SOCIAL_LEADERBOARD_BY_VERSION"), + (e.socialLeaderboard.OPERATION_GET_PLAYERS_SOCIAL_LEADERBOARD = + "GET_PLAYERS_SOCIAL_LEADERBOARD"), + (e.socialLeaderboard.OPERATION_GET_PLAYERS_SOCIAL_LEADERBOARD_BY_VERSION = + "GET_PLAYERS_SOCIAL_LEADERBOARD_BY_VERSION"), + (e.socialLeaderboard.OPERATION_LIST_ALL_LEADERBOARDS = + "LIST_ALL_LEADERBOARDS"), + (e.socialLeaderboard.OPERATION_GET_GLOBAL_LEADERBOARD_ENTRY_COUNT = + "GET_GLOBAL_LEADERBOARD_ENTRY_COUNT"), + (e.socialLeaderboard.OPERATION_REMOVE_PLAYER_SCORE = + "REMOVE_PLAYER_SCORE"), + (e.socialLeaderboard.OPERATION_GET_PLAYER_SCORE = + "GET_PLAYER_SCORE"), + (e.socialLeaderboard.OPERATION_GET_PLAYER_SCORES = + "GET_PLAYER_SCORES"), + (e.socialLeaderboard.OPERATION_GET_PLAYER_SCORES_FROM_LEADERBOARDS = + "GET_PLAYER_SCORES_FROM_LEADERBOARDS"), + (e.socialLeaderboard.OPERATION_POST_GROUP_SCORE = + "POST_GROUP_SCORE"), + (e.socialLeaderboard.OPERATION_REMOVE_GROUP_SCORE = + "REMOVE_GROUP_SCORE"), + (e.socialLeaderboard.OPERATION_GET_GROUP_LEADERBOARD_VIEW = + "GET_GROUP_LEADERBOARD_VIEW"), + (e.socialLeaderboard.OPERATION_GET_GROUP_LEADERBOARD_VIEW_BY_VERSION = + "GET_GROUP_LEADERBOARD_VIEW_BY_VERSION"), + (e.socialLeaderboard.OPERATION_POST_SCORE_TO_DYNAMIC_GROUP_LEADERBOARD = + "POST_GROUP_SCORE_DYNAMIC"), + (e.socialLeaderboard.leaderboardType = Object.freeze({ + HIGH_VALUE: "HIGH_VALUE", + CUMULATIVE: "CUMULATIVE", + LAST_VALUE: "LAST_VALUE", + LOW_VALUE: "LOW_VALUE", + })), + (e.socialLeaderboard.rotationType = Object.freeze({ + NEVER: "NEVER", + DAILY: "DAILY", + WEEKLY: "WEEKLY", + MONTHLY: "MONTHLY", + YEARLY: "YEARLY", + })), + (e.socialLeaderboard.fetchType = Object.freeze({ + HIGHEST_RANKED: "HIGHEST_RANKED", + })), + (e.socialLeaderboard.sortOrder = Object.freeze({ + HIGH_TO_LOW: "HIGH_TO_LOW", + LOW_TO_HIGH: "LOW_TO_HIGH", + })), + (e.socialLeaderboard.getGlobalLeaderboardPage = function ( + t, + a, + i, + n, + s, + ) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_LEADERBOARD, + operation: + e.socialLeaderboard.OPERATION_GET_GLOBAL_LEADERBOARD_PAGE, + data: { leaderboardId: t, sort: a, startIndex: i, endIndex: n }, + callback: s, + }); + }), + (e.socialLeaderboard.getGlobalLeaderboardPageByVersion = function ( + t, + a, + i, + n, + s, + o, + ) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_LEADERBOARD, + operation: + e.socialLeaderboard.OPERATION_GET_GLOBAL_LEADERBOARD_PAGE, + data: { + leaderboardId: t, + sort: a, + startIndex: i, + endIndex: n, + versionId: s, + }, + callback: o, + }); + }), + (e.socialLeaderboard.getGlobalLeaderboardView = function ( + t, + a, + i, + n, + s, + ) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_LEADERBOARD, + operation: + e.socialLeaderboard.OPERATION_GET_GLOBAL_LEADERBOARD_VIEW, + data: { + leaderboardId: t, + sort: a, + beforeCount: i, + afterCount: n, + }, + callback: s, + }); + }), + (e.socialLeaderboard.getGlobalLeaderboardViewByVersion = function ( + t, + a, + i, + n, + s, + o, + ) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_LEADERBOARD, + operation: + e.socialLeaderboard.OPERATION_GET_GLOBAL_LEADERBOARD_VIEW, + data: { + leaderboardId: t, + sort: a, + beforeCount: i, + afterCount: n, + versionId: s, + }, + callback: o, + }); + }), + (e.socialLeaderboard.getGlobalLeaderboardEntryCount = function ( + t, + a, + ) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_LEADERBOARD, + operation: + e.socialLeaderboard + .OPERATION_GET_GLOBAL_LEADERBOARD_ENTRY_COUNT, + data: { leaderboardId: t }, + callback: a, + }); + }), + (e.socialLeaderboard.getGlobalLeaderboardEntryCountByVersion = + function (t, a, i) { e.brainCloudManager.sendRequest({ - service: e.SERVICE_LOBBY, - operation: e.lobby.OPERATION_REMOVE_MEMBER, - data: n, + service: e.SERVICE_LEADERBOARD, + operation: + e.socialLeaderboard + .OPERATION_GET_GLOBAL_LEADERBOARD_ENTRY_COUNT, + data: { leaderboardId: t, versionId: a }, callback: i, }); }), - (e.lobby.sendSignal = function (t, a, i) { - var n = { lobbyId: t, signalData: a }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_LOBBY, - operation: e.lobby.OPERATION_SEND_SIGNAL, - data: n, - callback: i, - }); - }), - (e.lobby.switchTeam = function (t, a, i) { - var n = { lobbyId: t, toTeamCode: a }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_LOBBY, - operation: e.lobby.OPERATION_SWITCH_TEAM, - data: n, - callback: i, - }); - }), - (e.lobby.updateReady = function (t, a, i, n) { - var s = { lobbyId: t, isReady: a, extraJson: i }; + (e.socialLeaderboard.getSocialLeaderboard = function (t, a, i) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_LEADERBOARD, + operation: e.socialLeaderboard.OPERATION_GET_SOCIAL_LEADERBOARD, + data: { leaderboardId: t, replaceName: a }, + callback: i, + }); + }), + (e.socialLeaderboard.getSocialLeaderboardByVersion = function ( + t, + a, + i, + n, + ) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_LEADERBOARD, + operation: + e.socialLeaderboard + .OPERATION_GET_SOCIAL_LEADERBOARD_BY_VERSION, + data: { leaderboardId: t, replaceName: a, versionId: i }, + callback: n, + }); + }), + (e.socialLeaderboard.getMultiSocialLeaderboard = function ( + t, + a, + i, + n, + ) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_LEADERBOARD, + operation: + e.socialLeaderboard.OPERATION_GET_MULTI_SOCIAL_LEADERBOARD, + data: { + leaderboardIds: t, + leaderboardResultCount: a, + replaceName: i, + }, + callback: n, + }); + }), + (e.socialLeaderboard.getGlobalLeaderboardVersions = function ( + t, + a, + ) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_LEADERBOARD, + operation: + e.socialLeaderboard.OPERATION_GET_GLOBAL_LEADERBOARD_VERSIONS, + data: { leaderboardId: t }, + callback: a, + }); + }), + (e.socialLeaderboard.postScoreToLeaderboard = function ( + t, + a, + i, + n, + ) { + var s = { leaderboardId: t, score: a }; + (i && (s.data = i), e.brainCloudManager.sendRequest({ - service: e.SERVICE_LOBBY, - operation: e.lobby.OPERATION_UPDATE_READY, + service: e.SERVICE_LEADERBOARD, + operation: e.socialLeaderboard.OPERATION_POST_SCORE, data: s, callback: n, - }); - }), - (e.lobby.updateSettings = function (t, a, i) { - var n = { lobbyId: t, settings: a }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_LOBBY, - operation: e.lobby.OPERATION_UPDATE_SETTINGS, - data: n, - callback: i, - }); - }), - (e.lobby.cancelFindRequest = function (t, a) { - var i = { lobbyType: t, cxId: e.rttService.getRTTConnectionId() }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_LOBBY, - operation: e.lobby.OPERATION_CANCEL_FIND_REQUEST, + })); + }), + (e.socialLeaderboard.postScoreToDynamicLeaderboard = function ( + t, + a, + i, + n, + s, + o, + r, + l, + ) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_LEADERBOARD, + operation: e.socialLeaderboard.OPERATION_POST_SCORE_DYNAMIC, + data: { + leaderboardId: t, + score: a, data: i, - callback: a, - }); - }), - (e.lobby.getRegionsForLobbies = function (t, i) { - var n = { lobbyTypes: t }; + leaderboardType: n, + rotationType: s, + rotationResetTime: o.getTime().toFixed(0), + retainedCount: r, + }, + callback: l, + }); + }), + (e.socialLeaderboard.postScoreToDynamicLeaderboardUTC = function ( + t, + a, + i, + n, + s, + o, + r, + l, + ) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_LEADERBOARD, + operation: e.socialLeaderboard.OPERATION_POST_SCORE_DYNAMIC, + data: { + leaderboardId: t, + score: a, + data: i, + leaderboardType: n, + rotationType: s, + rotationResetTime: o.getTime().toFixed(0), + retainedCount: r, + }, + callback: l, + }); + }), + (e.socialLeaderboard.postScoreToDynamicLeaderboardDays = function ( + t, + a, + i, + n, + s, + o, + r, + l, + ) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_LEADERBOARD, + operation: e.socialLeaderboard.OPERATION_POST_SCORE_DYNAMIC, + data: { + leaderboardId: t, + score: a, + data: i, + leaderboardType: n, + rotationType: "DAYS", + rotationResetTime: s.getTime().toFixed(0), + retainedCount: o, + numDaysToRotate: r, + }, + callback: l, + }); + }), + (e.socialLeaderboard.postScoreToDynamicLeaderboardDaysUTC = + function (t, a, i, n, s, o, r, l) { e.brainCloudManager.sendRequest({ - service: e.SERVICE_LOBBY, - operation: e.lobby.OPERATION_GET_REGIONS_FOR_LOBBIES, - data: n, - callback: function (e) { - (200 == e.status && (a = e.data.regionPingData), i(e)); + service: e.SERVICE_LEADERBOARD, + operation: e.socialLeaderboard.OPERATION_POST_SCORE_DYNAMIC, + data: { + leaderboardId: t, + score: a, + data: i, + leaderboardType: n, + rotationType: "DAYS", + rotationResetTime: s.getTime().toFixed(0), + retainedCount: o, + numDaysToRotate: r, }, + callback: l, }); }), - (e.lobby.getLobbyInstances = function (t, a, i) { - var n = { lobbyType: t, criteriaJson: a }; + (e.socialLeaderboard.postScoreToDynamicGroupLeaderboardDaysUTC = + function (t, a, i, n, s, o, r, l, c) { e.brainCloudManager.sendRequest({ - service: e.SERVICE_LOBBY, - operation: e.lobby.OPERATION_GET_LOBBY_INSTANCES, - data: n, - callback: i, + service: e.SERVICE_LEADERBOARD, + operation: + e.socialLeaderboard + .OPERATION_POST_SCORE_TO_DYNAMIC_GROUP_LEADERBOARD, + data: { + leaderboardId: t, + groupId: a, + score: i, + data: n, + leaderboardType: s, + rotationType: "DAYS", + rotationResetTime: o.getTime().toFixed(0), + retainedCount: r, + numDaysToRotate: l, + }, + callback: c, }); }), - (e.lobby.getLobbyInstancesWithPingData = function (t, a, i) { - r( - { lobbyType: t, criteriaJson: a }, - e.lobby.OPERATION_GET_LOBBY_INSTANCES_WITH_PING_DATA, - i, - ); - }), - (e.lobby.pingRegions = function (r) { - if (((t = {}), a)) { - i = []; - for (var l = Object.keys(a), c = 0; c < l.length; ++c) { - var d = l[c]; - (u = a[d]) && - u.target && - "PING" == u.type && - i.push({ name: d, url: u.target }); - } - if (0 == (n = i.length)) - setTimeout(function () { - s(r); - }, 0); - else - for (c = 0; c < 2; ++c) { - var u; - i.length > 0 && o((u = i.splice(0, 1)[0]), [], r); - } - } else - setTimeout(function () { - r({ - status: e.statusCodes.BAD_REQUEST, - reason_code: e.reasonCodes.MISSING_REQUIRED_PARAMETER, - status_message: - "No Regions to Ping. Please call GetRegionsForLobbies and await the response before calling PingRegions", - severity: "ERROR", - }); - }, 0); - })); - } - function O() { - var e = this; - ((e.mail = {}), - (e.SERVICE_MAIL = "mail"), - (e.mail.OPERATION_SEND_BASIC_EMAIL = "SEND_BASIC_EMAIL"), - (e.mail.OPERATION_SEND_ADVANCED_EMAIL = "SEND_ADVANCED_EMAIL"), - (e.mail.OPERATION_SEND_ADVANCED_EMAIL_BY_ADDRESS = - "SEND_ADVANCED_EMAIL_BY_ADDRESS"), - (e.mail.sendBasicEmail = function (t, a, i, n) { + (e.socialLeaderboard.getGroupSocialLeaderboard = function ( + t, + a, + i, + ) { + var n = { leaderboardId: t, groupId: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_LEADERBOARD, + operation: + e.socialLeaderboard.OPERATION_GET_GROUP_SOCIAL_LEADERBOARD, + data: n, + callback: i, + }); + }), + (e.socialLeaderboard.getGroupSocialLeaderboardByVersion = function ( + t, + a, + i, + n, + ) { + var s = { leaderboardId: t, groupId: a, versionId: i }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_LEADERBOARD, + operation: + e.socialLeaderboard + .OPERATION_GET_GROUP_SOCIAL_LEADERBOARD_BY_VERSION, + data: s, + callback: n, + }); + }), + (e.socialLeaderboard.getPlayersSocialLeaderboard = function ( + t, + a, + i, + ) { + var n = { leaderboardId: t, profileIds: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_LEADERBOARD, + operation: + e.socialLeaderboard.OPERATION_GET_PLAYERS_SOCIAL_LEADERBOARD, + data: n, + callback: i, + }); + }), + (e.socialLeaderboard.getPlayersSocialLeaderboardByVersion = + function (t, a, i, n) { + var s = { leaderboardId: t, profileIds: a, versionId: i }; e.brainCloudManager.sendRequest({ - service: e.SERVICE_MAIL, - operation: e.mail.OPERATION_SEND_BASIC_EMAIL, - data: { profileId: t, subject: a, body: i }, + service: e.SERVICE_LEADERBOARD, + operation: + e.socialLeaderboard + .OPERATION_GET_PLAYERS_SOCIAL_LEADERBOARD_BY_VERSION, + data: s, callback: n, }); }), - (e.mail.sendAdvancedEmail = function (t, a, i) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_MAIL, - operation: e.mail.OPERATION_SEND_ADVANCED_EMAIL, - data: { profileId: t, serviceParams: a }, - callback: i, - }); - }), - (e.mail.sendAdvancedEmailByAddress = function (t, a, i) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_MAIL, - operation: e.mail.OPERATION_SEND_ADVANCED_EMAIL_BY_ADDRESS, - data: { emailAddress: t, serviceParams: a }, - callback: i, - }); - })); - } - function C() { - var e = this; - ((e.matchMaking = {}), - (e.SERVICE_MATCH_MAKING = "matchMaking"), - (e.matchMaking.OPERATION_READ = "READ"), - (e.matchMaking.OPERATION_SET_PLAYER_RATING = "SET_PLAYER_RATING"), - (e.matchMaking.OPERATION_RESET_PLAYER_RATING = - "RESET_PLAYER_RATING"), - (e.matchMaking.OPERATION_INCREMENT_PLAYER_RATING = - "INCREMENT_PLAYER_RATING"), - (e.matchMaking.OPERATION_DECREMENT_PLAYER_RATING = - "DECREMENT_PLAYER_RATING"), - (e.matchMaking.OPERATION_TURN_SHIELD_ON = "SHIELD_ON"), - (e.matchMaking.OPERATION_TURN_SHIELD_ON_FOR = "SHIELD_ON_FOR"), - (e.matchMaking.OPERATION_TURN_SHIELD_OFF = "SHIELD_OFF"), - (e.matchMaking.OPERATION_INCREMENT_SHIELD_ON_FOR = - "INCREMENT_SHIELD_ON_FOR"), - (e.matchMaking.OPERATION_GET_SHIELD_EXPIRY = "GET_SHIELD_EXPIRY"), - (e.matchMaking.OPERATION_FIND_PLAYERS = "FIND_PLAYERS"), - (e.matchMaking.OPERATION_FIND_PLAYERS_USING_FILTER = - "FIND_PLAYERS_USING_FILTER"), - (e.matchMaking.OPERATION_ENABLE_MATCH_MAKING = "ENABLE_FOR_MATCH"), - (e.matchMaking.OPERATION_DISABLE_MATCH_MAKING = - "DISABLE_FOR_MATCH"), - (e.matchMaking.read = function (t) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_MATCH_MAKING, - operation: e.matchMaking.OPERATION_READ, - data: {}, - callback: t, - }); - }), - (e.matchMaking.setPlayerRating = function (t, a) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_MATCH_MAKING, - operation: e.matchMaking.OPERATION_SET_PLAYER_RATING, - data: { playerRating: t }, - callback: a, - }); - }), - (e.matchMaking.resetPlayerRating = function (t) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_MATCH_MAKING, - operation: e.matchMaking.OPERATION_RESET_PLAYER_RATING, - data: {}, - callback: t, - }); - }), - (e.matchMaking.incrementPlayerRating = function (t, a) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_MATCH_MAKING, - operation: e.matchMaking.OPERATION_INCREMENT_PLAYER_RATING, - data: { playerRating: t }, - callback: a, - }); - }), - (e.matchMaking.decrementPlayerRating = function (t, a) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_MATCH_MAKING, - operation: e.matchMaking.OPERATION_DECREMENT_PLAYER_RATING, - data: { playerRating: t }, - callback: a, - }); - }), - (e.matchMaking.turnShieldOn = function (t) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_MATCH_MAKING, - operation: e.matchMaking.OPERATION_TURN_SHIELD_ON, - data: {}, - callback: t, - }); - }), - (e.matchMaking.turnShieldOnFor = function (t, a) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_MATCH_MAKING, - operation: e.matchMaking.OPERATION_TURN_SHIELD_ON_FOR, - data: { minutes: t }, - callback: a, - }); - }), - (e.matchMaking.turnShieldOff = function (t) { + (e.socialLeaderboard.listAllLeaderboards = function (t) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_LEADERBOARD, + operation: e.socialLeaderboard.OPERATION_LIST_ALL_LEADERBOARDS, + data: null, + callback: t, + }); + }), + (e.socialLeaderboard.removePlayerScore = function (t, a, i) { + var n = { leaderboardId: t, versionId: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_LEADERBOARD, + operation: e.socialLeaderboard.OPERATION_REMOVE_PLAYER_SCORE, + data: n, + callback: i, + }); + }), + (e.socialLeaderboard.getPlayerScore = function (t, a, i) { + var n = { leaderboardId: t, versionId: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_LEADERBOARD, + operation: e.socialLeaderboard.OPERATION_GET_PLAYER_SCORE, + data: n, + callback: i, + }); + }), + (e.socialLeaderboard.getPlayerScores = function (t, a, i, n) { + var s = { leaderboardId: t, versionId: a, maxResults: i }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_LEADERBOARD, + operation: e.socialLeaderboard.OPERATION_GET_PLAYER_SCORES, + data: s, + callback: n, + }); + }), + (e.socialLeaderboard.getPlayerScoresFromLeaderboards = function ( + t, + a, + ) { + var i = { leaderboardIds: t }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_LEADERBOARD, + operation: + e.socialLeaderboard + .OPERATION_GET_PLAYER_SCORES_FROM_LEADERBOARDS, + data: i, + callback: a, + }); + }), + (e.socialLeaderboard.postScoreToGroupLeaderboard = function ( + t, + a, + i, + n, + s, + ) { + var o = { leaderboardId: t, groupId: a, score: i }; + (n && (o.data = n), e.brainCloudManager.sendRequest({ - service: e.SERVICE_MATCH_MAKING, - operation: e.matchMaking.OPERATION_TURN_SHIELD_OFF, - data: {}, - callback: t, - }); - }), - (e.matchMaking.incrementShieldOnFor = function (t, a) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_MATCH_MAKING, - operation: e.matchMaking.OPERATION_INCREMENT_SHIELD_ON_FOR, - data: { minutes: t }, - callback: a, - }); - }), - (e.matchMaking.getShieldExpiry = function (t, a) { - var i = {}; - (t && (i.playerId = t), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_MATCH_MAKING, - operation: e.matchMaking.OPERATION_GET_SHIELD_EXPIRY, - data: i, - callback: a, - })); - }), - (e.matchMaking.findPlayers = function (t, a, i) { - e.matchMaking.findPlayersWithAttributes(t, a, null, i); - }), - (e.matchMaking.findPlayersWithAttributes = function (t, a, i, n) { - var s = { rangeDelta: t, numMatches: a }; - (i && (s.attributes = i), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_MATCH_MAKING, - operation: e.matchMaking.OPERATION_FIND_PLAYERS, - data: s, - callback: n, - })); - }), - (e.matchMaking.findPlayersUsingFilter = function (t, a, i, n) { - e.matchMaking.findPlayersWithAttributesUsingFilter( - t, - a, - null, - i, - n, - ); - }), - (e.matchMaking.findPlayersWithAttributesUsingFilter = function ( - t, - a, - i, - n, - s, - ) { - var o = { rangeDelta: t, numMatches: a }; - (i && (o.attributes = i), - n && (o.extraParms = n), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_MATCH_MAKING, - operation: e.matchMaking.OPERATION_FIND_PLAYERS_USING_FILTER, - data: o, - callback: s, - })); - }), - (e.matchMaking.enableMatchMaking = function (t) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_MATCH_MAKING, - operation: e.matchMaking.OPERATION_ENABLE_MATCH_MAKING, - data: {}, - callback: t, - }); - }), - (e.matchMaking.disableMatchMaking = function (t) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_MATCH_MAKING, - operation: e.matchMaking.OPERATION_DISABLE_MATCH_MAKING, - data: {}, - callback: t, - }); - })); - } - function w() { - var e = this; - ((e.messaging = {}), - (e.SERVICE_MESSAGING = "messaging"), - (e.messaging.OPERATION_DELETE_MESSAGES = "DELETE_MESSAGES"), - (e.messaging.OPERATION_GET_MESSAGE_BOXES = "GET_MESSAGE_BOXES"), - (e.messaging.OPERATION_GET_MESSAGE_COUNTS = "GET_MESSAGE_COUNTS"), - (e.messaging.OPERATION_GET_MESSAGES = "GET_MESSAGES"), - (e.messaging.OPERATION_GET_MESSAGES_PAGE = "GET_MESSAGES_PAGE"), - (e.messaging.OPERATION_GET_MESSAGES_PAGE_OFFSET = - "GET_MESSAGES_PAGE_OFFSET"), - (e.messaging.OPERATION_MARK_MESSAGES_READ = "MARK_MESSAGES_READ"), - (e.messaging.OPERATION_SEND_MESSAGE = "SEND_MESSAGE"), - (e.messaging.OPERATION_SEND_MESSAGE_SIMPLE = "SEND_MESSAGE_SIMPLE"), - (e.messaging.deleteMessages = function (t, a, i) { - var n = { msgbox: t, msgIds: a }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_MESSAGING, - operation: e.messaging.OPERATION_DELETE_MESSAGES, - data: n, - callback: i, - }); - }), - (e.messaging.getMessageboxes = function (t) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_MESSAGING, - operation: e.messaging.OPERATION_GET_MESSAGE_BOXES, - data: {}, - callback: t, - }); - }), - (e.messaging.getMessageCounts = function (t) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_MESSAGING, - operation: e.messaging.OPERATION_GET_MESSAGE_COUNTS, - data: {}, - callback: t, - }); - }), - (e.messaging.getMessages = function (t, a, i, n) { - var s = { msgbox: t, msgIds: a, markMessageRead: i }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_MESSAGING, - operation: e.messaging.OPERATION_GET_MESSAGES, - data: s, - callback: n, - }); - }), - (e.messaging.getMessagesPage = function (t, a) { - var i = { context: t }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_MESSAGING, - operation: e.messaging.OPERATION_GET_MESSAGES_PAGE, - data: i, - callback: a, - }); - }), - (e.messaging.getMessagesPageOffset = function (t, a, i) { - var n = { context: t, pageOffset: a }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_MESSAGING, - operation: e.messaging.OPERATION_GET_MESSAGES_PAGE_OFFSET, - data: n, - callback: i, - }); - }), - (e.messaging.sendMessage = function (t, a, i) { - var n = { toProfileIds: t, contentJson: a }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_MESSAGING, - operation: e.messaging.OPERATION_SEND_MESSAGE, - data: n, - callback: i, - }); - }), - (e.messaging.sendMessageSimple = function (t, a, i) { - var n = { toProfileIds: t, text: a }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_MESSAGING, - operation: e.messaging.OPERATION_SEND_MESSAGE_SIMPLE, - data: n, - callback: i, - }); - }), - (e.messaging.markMessagesRead = function (t, a, i) { - var n = { msgbox: t, msgIds: a }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_MESSAGING, - operation: e.messaging.OPERATION_MARK_MESSAGES_READ, + service: e.SERVICE_LEADERBOARD, + operation: e.socialLeaderboard.OPERATION_POST_GROUP_SCORE, + data: o, + callback: s, + })); + }), + (e.socialLeaderboard.removeGroupScore = function (t, a, i, n) { + var s = { leaderboardId: t, groupId: a, versionId: i }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_LEADERBOARD, + operation: e.socialLeaderboard.OPERATION_REMOVE_GROUP_SCORE, + data: s, + callback: n, + }); + }), + (e.socialLeaderboard.getGroupLeaderboardView = function ( + t, + a, + i, + n, + s, + o, + ) { + var r = { + leaderboardId: t, + groupId: a, + sort: i, + beforeCount: n, + afterCount: s, + }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_LEADERBOARD, + operation: + e.socialLeaderboard.OPERATION_GET_GROUP_LEADERBOARD_VIEW, + data: r, + callback: o, + }); + }), + (e.socialLeaderboard.getGroupLeaderboardViewByVersion = function ( + t, + a, + i, + n, + s, + o, + r, + ) { + var l = { + leaderboardId: t, + groupId: a, + versionId: i, + sort: n, + beforeCount: s, + afterCount: o, + }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_LEADERBOARD, + operation: + e.socialLeaderboard.OPERATION_GET_GROUP_LEADERBOARD_VIEW, + data: l, + callback: r, + }); + }), + (e.socialLeaderboard.postScoreToDynamicGroupLeaderboard = function ( + t, + a, + i, + n, + s, + o, + r, + l, + c, + ) { + var d = { + leaderboardId: t, + groupId: a, + score: i, + data: n, + leaderboardType: s, + rotationType: o, + rotationResetTime: r, + retainedCount: l, + }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_LEADERBOARD, + operation: + e.socialLeaderboard + .OPERATION_POST_SCORE_TO_DYNAMIC_GROUP_LEADERBOARD, + data: d, + callback: c, + }); + }), + (e.socialLeaderboard.postScoreToDynamicGroupLeaderboardUTC = + function (t, a, i, n, s, o, r, l, c) { + var d = { + leaderboardId: t, + groupId: a, + score: i, data: n, - callback: i, - }); - })); - } - function A() { - var e = this; - ((e.oneWayMatch = {}), - (e.SERVICE_ONE_WAY_MATCH = "onewayMatch"), - (e.oneWayMatch.OPERATION_START_MATCH = "START_MATCH"), - (e.oneWayMatch.OPERATION_CANCEL_MATCH = "CANCEL_MATCH"), - (e.oneWayMatch.OPERATION_COMPLETE_MATCH = "COMPLETE_MATCH"), - (e.oneWayMatch.startMatch = function (t, a, i) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_ONE_WAY_MATCH, - operation: e.oneWayMatch.OPERATION_START_MATCH, - data: { playerId: t, rangeDelta: a }, - callback: i, - }); - }), - (e.oneWayMatch.cancelMatch = function (t, a) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_ONE_WAY_MATCH, - operation: e.oneWayMatch.OPERATION_CANCEL_MATCH, - data: { playbackStreamId: t }, - callback: a, - }); - }), - (e.oneWayMatch.completeMatch = function (t, a) { + leaderboardType: s, + rotationType: o, + rotationResetTime: r, + retainedCount: l, + }; e.brainCloudManager.sendRequest({ - service: e.SERVICE_ONE_WAY_MATCH, - operation: e.oneWayMatch.OPERATION_COMPLETE_MATCH, - data: { playbackStreamId: t }, - callback: a, + service: e.SERVICE_LEADERBOARD, + operation: + e.socialLeaderboard + .OPERATION_POST_SCORE_TO_DYNAMIC_GROUP_LEADERBOARD, + data: d, + callback: c, }); })); - } - function k() { - var e = this; - ((e.playbackStream = {}), - (e.SERVICE_PLAYBACK_STREAM = "playbackStream"), - (e.playbackStream.OPERATION_START_STREAM = "START_STREAM"), - (e.playbackStream.OPERATION_READ_STREAM = "READ_STREAM"), - (e.playbackStream.OPERATION_END_STREAM = "END_STREAM"), - (e.playbackStream.OPERATION_DELETE_STREAM = "DELETE_STREAM"), - (e.playbackStream.OPERATION_ADD_EVENT = "ADD_EVENT"), - (e.playbackStream.OPERATION_GET_STREAM_SUMMARIES_FOR_INITIATING_PLAYER = - "GET_STREAM_SUMMARIES_FOR_INITIATING_PLAYER"), - (e.playbackStream.OPERATION_GET_STREAM_SUMMARIES_FOR_TARGET_PLAYER = - "GET_STREAM_SUMMARIES_FOR_TARGET_PLAYER"), - (e.playbackStream.OPERATION_GET_RECENT_STREAMS_FOR_INITIATING_PLAYER = - "GET_RECENT_STREAMS_FOR_INITIATING_PLAYER"), - (e.playbackStream.OPERATION_GET_RECENT_STREAMS_FOR_TARGET_PLAYER = - "GET_RECENT_STREAMS_FOR_TARGET_PLAYER"), - (e.playbackStream.startStream = function (t, a, i) { - var n = { targetPlayerId: t, includeSharedData: a }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PLAYBACK_STREAM, - operation: e.playbackStream.OPERATION_START_STREAM, - data: n, - callback: i, - }); - }), - (e.playbackStream.readStream = function (t, a) { - var i = { playbackStreamId: t }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PLAYBACK_STREAM, - operation: e.playbackStream.OPERATION_READ_STREAM, - data: i, - callback: a, - }); - }), - (e.playbackStream.endStream = function (t, a) { - var i = { playbackStreamId: t }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PLAYBACK_STREAM, - operation: e.playbackStream.OPERATION_END_STREAM, - data: i, - callback: a, - }); - }), - (e.playbackStream.deleteStream = function (t, a) { - var i = { playbackStreamId: t }; + } + function H() { + var e = this; + ((e.statusCodes = {}), + (e.statusCodes.OK = 200), + (e.statusCodes.BAD_REQUEST = 400), + (e.statusCodes.FORBIDDEN = 403), + (e.statusCodes.INTERNAL_SERVER_ERROR = 500), + (e.statusCodes.CLIENT_NETWORK_ERROR = 900)); + } + function X() { + var e = this; + ((e.timeUtils = {}), + (e.timeUtils.UTCDateTimeToUTCMillis = function (e) { + return e.getTime(); + }), + (e.timeUtils.UTCMillisToUTCDateTime = function (e) { + return new Date(e); + })); + } + function z() { + var e = this; + ((e.time = {}), + (e.SERVICE_TIME = "time"), + (e.time.OPERATION_READ = "READ"), + (e.time.readServerTime = function (t) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_TIME, + operation: e.time.OPERATION_READ, + data: {}, + callback: t, + }); + })); + } + function W() { + var e = this; + ((e.tournament = {}), + (e.SERVICE_TOURNAMENT = "tournament"), + (e.tournament.OPERATION_CLAIM_TOURNAMENT_REWARD = + "CLAIM_TOURNAMENT_REWARD"), + (e.tournament.OPERATION_GET_DIVISION_INFO = "GET_DIVISION_INFO"), + (e.tournament.OPERATION_GET_MY_DIVISIONS = "GET_MY_DIVISIONS"), + (e.tournament.OPERATION_GET_TOURNAMENT_STATUS = + "GET_TOURNAMENT_STATUS"), + (e.tournament.OPERATION_JOIN_DIVISION = "JOIN_DIVISION"), + (e.tournament.OPERATION_JOIN_TOURNAMENT = "JOIN_TOURNAMENT"), + (e.tournament.OPERATION_LEAVE_DIVISION_INSTANCE = + "LEAVE_DIVISION_INSTANCE"), + (e.tournament.OPERATION_LEAVE_TOURNAMENT = "LEAVE_TOURNAMENT"), + (e.tournament.OPERATION_POST_TOURNAMENT_SCORE = + "POST_TOURNAMENT_SCORE"), + (e.tournament.OPERATION_POST_TOURNAMENT_SCORE_WITH_RESULTS = + "POST_TOURNAMENT_SCORE_WITH_RESULTS"), + (e.tournament.OPERATION_VIEW_CURRENT_REWARD = + "VIEW_CURRENT_REWARD"), + (e.tournament.OPERATION_VIEW_REWARD = "VIEW_REWARD"), + (e.tournament.claimTournamentReward = function (t, a, i) { + var n = { leaderboardId: t, versionId: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_TOURNAMENT, + operation: e.tournament.OPERATION_CLAIM_TOURNAMENT_REWARD, + data: n, + callback: i, + }); + }), + (e.tournament.getDivisionInfo = function (t, a) { + var i = { divSetId: t }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_TOURNAMENT, + operation: e.tournament.OPERATION_GET_DIVISION_INFO, + data: i, + callback: a, + }); + }), + (e.tournament.getMyDivisions = function (t) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_TOURNAMENT, + operation: e.tournament.OPERATION_GET_MY_DIVISIONS, + data: null, + callback: t, + }); + }), + (e.tournament.getTournamentStatus = function (t, a, i) { + var n = { leaderboardId: t, versionId: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_TOURNAMENT, + operation: e.tournament.OPERATION_GET_TOURNAMENT_STATUS, + data: n, + callback: i, + }); + }), + (e.tournament.joinDivision = function (t, a, i, n) { + var s = { divSetId: t, tournamentCode: a, initialScore: i }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_TOURNAMENT, + operation: e.tournament.OPERATION_JOIN_DIVISION, + data: s, + callback: n, + }); + }), + (e.tournament.joinTournament = function (t, a, i, n) { + var s = { leaderboardId: t, tournamentCode: a, initialScore: i }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_TOURNAMENT, + operation: e.tournament.OPERATION_JOIN_TOURNAMENT, + data: s, + callback: n, + }); + }), + (e.tournament.leaveDivisionInstance = function (t, a) { + var i = { leaderboardId: t }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_TOURNAMENT, + operation: e.tournament.OPERATION_LEAVE_DIVISION_INSTANCE, + data: i, + callback: a, + }); + }), + (e.tournament.leaveTournament = function (t, a) { + var i = { leaderboardId: t }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_TOURNAMENT, + operation: e.tournament.OPERATION_LEAVE_TOURNAMENT, + data: i, + callback: a, + }); + }), + (e.tournament.postTournamentScore = function (t, a, i, n, s) { + var o = { + leaderboardId: t, + score: a, + roundStartedEpoch: n.getTime(), + }; + (i && (o.data = i), e.brainCloudManager.sendRequest({ - service: e.SERVICE_PLAYBACK_STREAM, - operation: e.playbackStream.OPERATION_DELETE_STREAM, - data: i, - callback: a, - }); - }), - (e.playbackStream.addEvent = function (t, a, i, n) { - var s = { playbackStreamId: t, eventData: a, summary: i }; + service: e.SERVICE_TOURNAMENT, + operation: e.tournament.OPERATION_POST_TOURNAMENT_SCORE, + data: o, + callback: s, + })); + }), + (e.tournament.postTournamentScoreUTC = function (t, a, i, n, s) { + var o = { + leaderboardId: t, + score: a, + roundStartedEpoch: n.getTime(), + }; + (i && (o.data = i), e.brainCloudManager.sendRequest({ - service: e.SERVICE_PLAYBACK_STREAM, - operation: e.playbackStream.OPERATION_ADD_EVENT, - data: s, - callback: n, - }); - }), - (e.playbackStream.getRecentStreamsForInitiatingPlayer = function ( - t, - a, - i, - ) { - var n = { initiatingPlayerId: t, maxNumStreams: a }; + service: e.SERVICE_TOURNAMENT, + operation: e.tournament.OPERATION_POST_TOURNAMENT_SCORE, + data: o, + callback: s, + })); + }), + (e.tournament.postTournamentScoreWithResults = function ( + t, + a, + i, + n, + s, + o, + r, + l, + c, + ) { + var d = { + leaderboardId: t, + score: a, + roundStartedEpoch: n.getTime(), + sort: s, + beforeCount: o, + afterCount: r, + initialScore: l, + }; + (i && (d.data = i), e.brainCloudManager.sendRequest({ - service: e.SERVICE_PLAYBACK_STREAM, + service: e.SERVICE_TOURNAMENT, operation: - e.playbackStream - .OPERATION_GET_RECENT_STREAMS_FOR_INITIATING_PLAYER, - data: n, - callback: i, - }); - }), - (e.playbackStream.getRecentStreamsForTargetPlayer = function ( - t, - a, - i, - ) { - var n = { targetPlayerId: t, maxNumStreams: a }; + e.tournament.OPERATION_POST_TOURNAMENT_SCORE_WITH_RESULTS, + data: d, + callback: c, + })); + }), + (e.tournament.postTournamentScoreWithResultsUTC = function ( + t, + a, + i, + n, + s, + o, + r, + l, + c, + ) { + var d = { + leaderboardId: t, + score: a, + roundStartedEpoch: n.getTime(), + sort: s, + beforeCount: o, + afterCount: r, + initialScore: l, + }; + (i && (d.data = i), e.brainCloudManager.sendRequest({ - service: e.SERVICE_PLAYBACK_STREAM, + service: e.SERVICE_TOURNAMENT, operation: - e.playbackStream - .OPERATION_GET_RECENT_STREAMS_FOR_TARGET_PLAYER, - data: n, - callback: i, - }); - })); - } - function N() { - var e = this; - ((e.playerState = {}), - (e.SERVICE_PLAYERSTATE = "playerState"), - (e.playerState.OPERATION_SEND = "SEND"), - (e.playerState.OPERATION_UPDATE_EVENT_DATA = "UPDATE_EVENT_DATA"), - (e.playerState.OPERATION_DELETE_INCOMING = "DELETE_INCOMING"), - (e.playerState.OPERATION_DELETE_SENT = "DELETE_SENT"), - (e.playerState.OPERATION_FULL_PLAYER_RESET = "FULL_PLAYER_RESET"), - (e.playerState.OPERATION_GAME_DATA_RESET = "GAME_DATA_RESET"), - (e.playerState.OPERATION_UPDATE_SUMMARY = "UPDATE_SUMMARY"), - (e.playerState.OPERATION_READ_FRIENDS = "READ_FRIENDS"), - (e.playerState.OPERATION_READ_FRIEND_PLAYER_STATE = - "READ_FRIEND_PLAYER_STATE"), - (e.playerState.UPDATE_ATTRIBUTES = "UPDATE_ATTRIBUTES"), - (e.playerState.REMOVE_ATTRIBUTES = "REMOVE_ATTRIBUTES"), - (e.playerState.GET_ATTRIBUTES = "GET_ATTRIBUTES"), - (e.playerState.UPDATE_PICTURE_URL = "UPDATE_PICTURE_URL"), - (e.playerState.UPDATE_CONTACT_EMAIL = "UPDATE_CONTACT_EMAIL"), - (e.playerState.OPERATION_READ = "READ"), - (e.playerState.OPERATION_UPDATE_NAME = "UPDATE_NAME"), - (e.playerState.OPERATION_LOGOUT = "LOGOUT"), - (e.playerState.OPERATION_CLEAR_USER_STATUS = "CLEAR_USER_STATUS"), - (e.playerState.OPERATION_EXTEND_USER_STATUS = "EXTEND_USER_STATUS"), - (e.playerState.OPERATION_GET_USER_STATUS = "GET_USER_STATUS"), - (e.playerState.OPERATION_SET_USER_STATUS = "SET_USER_STATUS"), - (e.playerState.OPERATION_UPDATE_TIME_ZONE_OFFSET = - "UPDATE_TIMEZONE_OFFSET"), - (e.playerState.OPERATION_UPDATE_LANGUAGE_CODE = - "UPDATE_LANGUAGE_CODE"), - (e.playerState.userPlayer = function (t) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PLAYERSTATE, - operation: e.playerState.OPERATION_FULL_PLAYER_RESET, - callback: t, - }); - }), - (e.playerState.deleteUser = function (t) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PLAYERSTATE, - operation: e.playerState.OPERATION_FULL_PLAYER_RESET, - callback: t, - }); - }), - (e.playerState.getAttributes = function (t) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PLAYERSTATE, - operation: e.playerState.GET_ATTRIBUTES, - callback: t, - }); - }), - (e.playerState.logout = function (t) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PLAYERSTATE, - operation: e.playerState.OPERATION_LOGOUT, - callback: t, - }); - }), - (e.playerState.readUserState = function (t) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PLAYERSTATE, - operation: e.playerState.OPERATION_READ, - callback: t, - }); - }), - (e.playerState.removeAttributes = function (t, a) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PLAYERSTATE, - operation: e.playerState.REMOVE_ATTRIBUTES, - data: { attributes: t }, - callback: a, - }); - }), - (e.playerState.updateTimeZoneOffset = function (t, a) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PLAYERSTATE, - operation: e.playerState.OPERATION_UPDATE_TIME_ZONE_OFFSET, - data: { timeZoneOffset: t }, - callback: a, - }); - }), - (e.playerState.updateLanguageCode = function (t, a) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PLAYERSTATE, - operation: e.playerState.OPERATION_UPDATE_LANGUAGE_CODE, - data: { languageCode: t }, - callback: a, - }); - }), - (e.playerState.resetUser = function (t) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PLAYERSTATE, - operation: e.playerState.OPERATION_GAME_DATA_RESET, - callback: t, - }); - }), - (e.playerState.updateAttributes = function (t, a, i) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PLAYERSTATE, - operation: e.playerState.UPDATE_ATTRIBUTES, - data: { attributes: t, wipeExisting: a }, - callback: i, - }); - }), - (e.playerState.updateUserName = function (t, a) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PLAYERSTATE, - operation: e.playerState.OPERATION_UPDATE_NAME, - data: { playerName: t }, - callback: a, - }); - }), - (e.playerState.updateName = function (t, a) { - e.playerState.updateUserName(t, a); - }), - (e.playerState.updateSummaryFriendData = function (t, a) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PLAYERSTATE, - operation: e.playerState.OPERATION_UPDATE_SUMMARY, - data: { summaryFriendData: t }, - callback: a, - }); - }), - (e.playerState.updateUserPictureUrl = function (t, a) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PLAYERSTATE, - operation: e.playerState.UPDATE_PICTURE_URL, - data: { playerPictureUrl: t }, - callback: a, - }); - }), - (e.playerState.updateContactEmail = function (t, a) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PLAYERSTATE, - operation: e.playerState.UPDATE_CONTACT_EMAIL, - data: { contactEmail: t }, - callback: a, - }); - }), - (e.playerState.clearUserStatus = function (t, a) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PLAYERSTATE, - operation: e.playerState.OPERATION_CLEAR_USER_STATUS, - data: { statusName: t }, - callback: a, - }); - }), - (e.playerState.extendUserStatus = function (t, a, i, n) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PLAYERSTATE, - operation: e.playerState.OPERATION_EXTEND_USER_STATUS, - data: { statusName: t, additionalSecs: a, details: i }, - callback: n, - }); - }), - (e.playerState.getUserStatus = function (t, a) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PLAYERSTATE, - operation: e.playerState.OPERATION_GET_USER_STATUS, - data: { statusName: t }, - callback: a, - }); - }), - (e.playerState.setUserStatus = function (t, a, i, n) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PLAYERSTATE, - operation: e.playerState.OPERATION_SET_USER_STATUS, - data: { statusName: t, durationSecs: a, details: i }, - callback: n, - }); - })); - } - function x() { - var e = this; - ((e.playerStatisticsEvent = {}), - (e.SERVICE_PLAYER_STATISTICS_EVENT = "playerStatisticsEvent"), - (e.playerStatisticsEvent.OPERATION_TRIGGER = "TRIGGER"), - (e.playerStatisticsEvent.OPERATION_TRIGGER_MULTIPLE = - "TRIGGER_MULTIPLE"), - (e.playerStatisticsEvent.triggerUserStatsEvent = function ( - t, - a, - i, + e.tournament.OPERATION_POST_TOURNAMENT_SCORE_WITH_RESULTS, + data: d, + callback: c, + })); + }), + (e.tournament.viewCurrentReward = function (t, a) { + var i = { leaderboardId: t }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_TOURNAMENT, + operation: e.tournament.OPERATION_VIEW_CURRENT_REWARD, + data: i, + callback: a, + }); + }), + (e.tournament.viewReward = function (t, a, i) { + var n = { leaderboardId: t, versionId: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_TOURNAMENT, + operation: e.tournament.OPERATION_VIEW_REWARD, + data: n, + callback: i, + }); + })); + } + function q() { + var e = this; + ((e.userItems = {}), + (e.SERVICE_USER_ITEMS = "userItems"), + (e.userItems.OPERATION_AWARD_USER_ITEM = "AWARD_USER_ITEM"), + (e.userItems.OPERATION_DROP_USER_ITEM = "DROP_USER_ITEM"), + (e.userItems.OPERATION_GET_USER_INVENTORY_PAGE = + "GET_USER_ITEMS_PAGE"), + (e.userItems.OPERATION_GET_USER_INVENTORY_PAGE_OFFSET = + "GET_USER_ITEMS_PAGE_OFFSET"), + (e.userItems.OPERATION_GET_USER_ITEM = "GET_USER_ITEM"), + (e.userItems.OPERATION_GIVE_USER_ITEM_TO = "GIVE_USER_ITEM_TO"), + (e.userItems.OPERATION_PURCHASE_USER_ITEM = "PURCHASE_USER_ITEM"), + (e.userItems.OPERATION_RECEIVE_USER_ITEM_FROM = + "RECEIVE_USER_ITEM_FROM"), + (e.userItems.OPERATION_SELL_USER_ITEM = "SELL_USER_ITEM"), + (e.userItems.OPERATION_UPDATE_USER_ITEM_DATA = + "UPDATE_USER_ITEM_DATA"), + (e.userItems.OPERATION_USE_USER_ITEM = "USE_USER_ITEM"), + (e.userItems.OPERATION_PUBLISH_USER_ITEM_TO_BLOCKCHAIN = + "PUBLISH_USER_ITEM_TO_BLOCKCHAIN"), + (e.userItems.OPERATION_REFRESH_BLOCKCHAIN_USER_ITEMS = + "REFRESH_BLOCKCHAIN_USER_ITEMS"), + (e.userItems.OPERATION_REMOVE_USER_ITEM_FROM_BLOCKCHAIN = + "REMOVE_USER_ITEM_FROM_BLOCKCHAIN"), + (e.userItems.awardUserItem = function (t, a, i, n) { + var s = { defId: t, quantity: a, includeDef: i }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_USER_ITEMS, + operation: e.userItems.OPERATION_AWARD_USER_ITEM, + data: s, + callback: n, + }); + }), + (e.userItems.dropUserItem = function (t, a, i, n) { + var s = { itemId: t, quantity: a, includeDef: i }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_USER_ITEMS, + operation: e.userItems.OPERATION_DROP_USER_ITEM, + data: s, + callback: n, + }); + }), + (e.userItems.getUserInventoryPage = function (t, a, i) { + var n = { context: t, includeDef: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_USER_ITEMS, + operation: e.userItems.OPERATION_GET_USER_INVENTORY_PAGE, + data: n, + callback: i, + }); + }), + (e.userItems.getUserItemsPage = function (t, a, i) { + var n = { context: t, includeDef: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_USER_ITEMS, + operation: e.userItems.OPERATION_GET_USER_INVENTORY_PAGE, + data: n, + callback: i, + }); + }), + (e.userItems.getUserInventoryPageOffset = function (t, a, i, n) { + var s = { context: t, pageOffset: a, includeDef: i }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_USER_ITEMS, + operation: e.userItems.OPERATION_GET_USER_INVENTORY_PAGE_OFFSET, + data: s, + callback: n, + }); + }), + (e.userItems.getUserItemsPageOffset = function (t, a, i, n) { + var s = { context: t, pageOffset: a, includeDef: i }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_USER_ITEMS, + operation: e.userItems.OPERATION_GET_USER_INVENTORY_PAGE_OFFSET, + data: s, + callback: n, + }); + }), + (e.userItems.getUserItem = function (t, a, i) { + var n = { itemId: t, includeDef: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_USER_ITEMS, + operation: e.userItems.OPERATION_GET_USER_ITEM, + data: n, + callback: i, + }); + }), + (e.userItems.giveUserItemTo = function (t, a, i, n, s, o) { + var r = { + profileId: t, + itemId: a, + version: i, + quantity: n, + immediate: s, + }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_USER_ITEMS, + operation: e.userItems.OPERATION_GIVE_USER_ITEM_TO, + data: r, + callback: o, + }); + }), + (e.userItems.purchaseUserItem = function (t, a, i, n, s) { + var o = { defId: t, quantity: a, shopId: i, includeDef: n }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_USER_ITEMS, + operation: e.userItems.OPERATION_PURCHASE_USER_ITEM, + data: o, + callback: s, + }); + }), + (e.userItems.receiveUserItemFrom = function (t, a, i) { + var n = { profileId: t, itemId: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_USER_ITEMS, + operation: e.userItems.OPERATION_RECEIVE_USER_ITEM_FROM, + data: n, + callback: i, + }); + }), + (e.userItems.sellUserItem = function (t, a, i, n, s, o) { + var r = { + itemId: t, + version: a, + quantity: i, + shopId: n, + includeDef: s, + }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_USER_ITEMS, + operation: e.userItems.OPERATION_SELL_USER_ITEM, + data: r, + callback: o, + }); + }), + (e.userItems.updateUserItemData = function (t, a, i, n) { + var s = { itemId: t, version: a, newItemData: i }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_USER_ITEMS, + operation: e.userItems.OPERATION_UPDATE_USER_ITEM_DATA, + data: s, + callback: n, + }); + }), + (e.userItems.useUserItem = function (t, a, i, n, s) { + var o = { itemId: t, version: a, newItemData: i, includeDef: n }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_USER_ITEMS, + operation: e.userItems.OPERATION_USE_USER_ITEM, + data: o, + callback: s, + }); + }), + (e.userItems.publishUserItemToBlockchain = function (t, a, i) { + var n = { itemId: t, version: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_USER_ITEMS, + operation: + e.userItems.OPERATION_PUBLISH_USER_ITEM_TO_BLOCKCHAIN, + data: n, + callback: i, + }); + }), + (e.userItems.refreshBlockchainUserItems = function (t) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_USER_ITEMS, + operation: e.userItems.OPERATION_REFRESH_BLOCKCHAIN_USER_ITEMS, + data: {}, + callback: t, + }); + }), + (e.userItems.removeUserItemFromBlockchain = function (t, a, i) { + var n = { itemId: t, version: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_USER_ITEMS, + operation: + e.userItems.OPERATION_REMOVE_USER_ITEM_FROM_BLOCKCHAIN, + data: n, + callback: i, + }); + })); + } + function $() { + var e = this; + ((e.virtualCurrency = {}), + (e.SERVICE_VIRTUAL_CURRENCY = "virtualCurrency"), + (e.virtualCurrency.OPERATION_GET_CURRENCY = "GET_PLAYER_VC"), + (e.virtualCurrency.OPERATION_GET_PARENT_CURRENCY = "GET_PARENT_VC"), + (e.virtualCurrency.OPERATION_GET_PEER_CURRENCY = "GET_PEER_VC"), + (e.virtualCurrency.OPERATION_RESET_PLAYER_VC = "RESET_PLAYER_VC"), + (e.virtualCurrency.OPERATION_AWARD_VC = "AWARD_VC"), + (e.virtualCurrency.OPERATION_CONSUME_PLAYER_VC = "CONSUME_VC"), + (e.virtualCurrency.getCurrency = function (t, a) { + var i = { vcId: t }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_VIRTUAL_CURRENCY, + operation: e.virtualCurrency.OPERATION_GET_CURRENCY, + data: i, + callback: a, + }); + }), + (e.virtualCurrency.getParentCurrency = function (t, a, i) { + var n = { vcId: t, levelName: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_VIRTUAL_CURRENCY, + operation: e.virtualCurrency.OPERATION_GET_PARENT_CURRENCY, + data: n, + callback: i, + }); + }), + (e.virtualCurrency.getPeerCurrency = function (t, a, i) { + var n = { vcId: t, peerCode: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_VIRTUAL_CURRENCY, + operation: e.virtualCurrency.OPERATION_GET_PEER_CURRENCY, + data: n, + callback: i, + }); + }), + (e.virtualCurrency.awardCurrency = function (t, a, i) { + var n = { vcId: t, vcAmount: a }; + e.brainCloudManager.sendRequest({ + service: e.SERVICE_VIRTUAL_CURRENCY, + operation: e.virtualCurrency.OPERATION_AWARD_VC, + data: n, + callback: i, + }); + }), + (e.virtualCurrency.consumeCurrency = function (t, a, i) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_VIRTUAL_CURRENCY, + operation: e.virtualCurrency.OPERATION_CONSUME_PLAYER_VC, + data: { vcId: t, vcAmount: a }, + callback: i, + }); + }), + (e.virtualCurrency.resetCurrency = function (t) { + e.brainCloudManager.sendRequest({ + service: e.SERVICE_VIRTUAL_CURRENCY, + operation: e.virtualCurrency.OPERATION_RESET_PLAYER_VC, + callback: t, + }); + })); + } + function J() { + var e = this; + ((e.name = "BrainCloudClient"), + (e.appVersion = "1.0"), + window.brainCloudClient !== e + ? (o.apply(e), + l.apply(e), + c.apply(e), + d.apply(e), + h.apply(e), + p.apply(e), + g.apply(e), + m.apply(e), + f.apply(e), + y.apply(e), + E.apply(e), + S.apply(e), + I.apply(e), + _.apply(e), + v.apply(e), + T.apply(e), + q.apply(e), + R.apply(e), + O.apply(e), + C.apply(e), + w.apply(e), + A.apply(e), + k.apply(e), + N.apply(e), + P.apply(e), + x.apply(e), + M.apply(e), + $.apply(e), + r.apply(e), + L.apply(e), + D.apply(e), + B.apply(e), + F.apply(e), + Y.apply(e), + U.apply(e), + j.apply(e), + G.apply(e), + V.apply(e), + H.apply(e), + z.apply(e), + W.apply(e), + b.apply(e), + u.apply(e), + X.apply(e), + (e.brainCloudManager = new s()), + (e.brainCloudRttComms = new te(this)), + (e.brainCloudRelayComms = new K(this)), + (e.brainCloudManager.abtests = e.abtests), + (e.brainCloudManager.asyncMatch = e.asyncMatch), + (e.brainCloudManager.authentication = e.authentication), + (e.brainCloudManager.chat = e.chat), + (e.brainCloudManager.dataStream = e.dataStream), + (e.brainCloudManager.entity = e.entity), + (e.brainCloudManager.event = e.event), + (e.brainCloudManager.file = e.file), + (e.brainCloudManager.friend = e.friend), + (e.brainCloudManager.gamification = e.gamification), + (e.brainCloudManager.globalApp = e.globalApp), + (e.brainCloudManager.globalStatistics = e.globalStatistics), + (e.brainCloudManager.globalEntity = e.globalEntity), + (e.brainCloudManager.group = e.group), + (e.brainCloudManager.identity = e.identity), + (e.brainCloudManager.lobby = e.lobby), + (e.brainCloudManager.mail = e.mail), + (e.brainCloudManager.matchMaking = e.matchMaking), + (e.brainCloudManager.messaging = e.messaging), + (e.brainCloudManager.oneWayMatch = e.oneWayMatch), + (e.brainCloudManager.playbackStream = e.playbackStream), + (e.brainCloudManager.playerState = e.playerState), + (e.brainCloudManager.playerStatistics = e.playerStatistics), + (e.brainCloudManager.playerStatisticsEvent = + e.playerStatisticsEvent), + (e.brainCloudManager.presence = e.precense), + (e.brainCloudManager.virtualCurrency = e.virtualCurrency), + (e.brainCloudManager.appStore = e.appStore), + (e.brainCloudManager.profanity = e.profanity), + (e.brainCloudManager.pushNotification = e.pushNotification), + (e.brainCloudManager.reasonCodes = e.reasonCodes), + (e.brainCloudManager.redemptionCode = e.redemptionCode), + (e.brainCloudManager.relay = e.relay), + (e.brainCloudManager.rttService = e.rttService), + (e.brainCloudManager.s3Handling = e.s3Handling), + (e.brainCloudManager.script = e.script), + (e.brainCloudManager.socialLeaderboard = e.socialLeaderboard), + (e.brainCloudManager.statusCodes = e.statusCodes), + (e.brainCloudManager.time = e.time), + (e.brainCloudManager.tournament = e.tournament), + (e.brainCloudManager.globalFile = e.globalFile), + (e.brainCloudManager.itemCatalog = e.itemCatalog), + (e.brainCloudManager.userItems = e.userItems), + (e.brainCloudManager.customEntity = e.customEntity), + (e.brainCloudManager.timeUtils = e.timeUtils), + (e.brainCloudRttComms.rtt = e.rtt), + (e.brainCloudRttComms.brainCloudClient = e), + (e.brainCloudRelayComms.brainCloudClient = e)) + : ((e.brainCloudManager = window.brainCloudManager = + window.brainCloudManager || {}), + (e.brainCloudRttComms = window.brainCloudRttComms = + window.brainCloudRttComms || {}), + (e.brainCloudRelayComms = window.brainCloudRelayComms = + window.brainCloudRelayComms || {}), + (e.brainCloudClient = window.brainCloudClient = + window.brainCloudClient || {}), + (e.brainCloudManager.abtests = e.brainCloudClient.abtests = + e.brainCloudClient.abtests || {}), + (e.brainCloudManager.asyncMatch = + e.brainCloudClient.asyncMatch = + e.brainCloudClient.asyncMatch || {}), + (e.brainCloudManager.authentication = + e.brainCloudClient.authentication = + e.brainCloudClient.authentication || {}), + (e.brainCloudManager.chat = e.brainCloudClient.chat = + e.brainCloudClient.chat || {}), + (e.brainCloudManager.dataStream = + e.brainCloudClient.dataStream = + e.brainCloudClient.dataStream || {}), + (e.brainCloudManager.entity = e.brainCloudClient.entity = + e.brainCloudClient.entity || {}), + (e.brainCloudManager.event = e.brainCloudClient.event = + e.brainCloudClient.event || {}), + (e.brainCloudManager.file = e.brainCloudClient.file = + e.brainCloudClient.file || {}), + (e.brainCloudManager.friend = e.brainCloudClient.friend = + e.brainCloudClient.friend || {}), + (e.brainCloudManager.gamification = + e.brainCloudClient.gamification = + e.brainCloudClient.gamification || {}), + (e.brainCloudManager.globalApp = e.brainCloudClient.globalApp = + e.brainCloudClient.globalApp || {}), + (e.brainCloudManager.globalStatistics = + e.brainCloudClient.globalStatistics = + e.brainCloudClient.globalStatistics || {}), + (e.brainCloudManager.globalEntity = + e.brainCloudClient.globalEntity = + e.brainCloudClient.globalEntity || {}), + (e.brainCloudManager.group = e.brainCloudClient.group = + e.brainCloudClient.group || {}), + (e.brainCloudManager.identity = e.brainCloudClient.identity = + e.brainCloudClient.identity || {}), + (e.brainCloudManager.lobby = e.brainCloudClient.lobby = + e.brainCloudClient.lobby || {}), + (e.brainCloudManager.mail = e.brainCloudClient.mail = + e.brainCloudClient.mail || {}), + (e.brainCloudManager.matchMaking = + e.brainCloudClient.matchMaking = + e.brainCloudClient.matchMaking || {}), + (e.brainCloudManager.messaging = e.brainCloudClient.messaging = + e.brainCloudClient.messaging || {}), + (e.brainCloudManager.oneWayMatch = + e.brainCloudClient.oneWayMatch = + e.brainCloudClient.oneWayMatch || {}), + (e.brainCloudManager.playbackStream = + e.brainCloudClient.playbackStream = + e.brainCloudClient.playbackStream || {}), + (e.brainCloudManager.playerState = + e.brainCloudClient.playerState = + e.brainCloudClient.playerState || {}), + (e.brainCloudManager.playerStatistics = + e.brainCloudClient.playerStatistics = + e.brainCloudClient.playerStatistics || {}), + (e.brainCloudManager.playerStatisticsEvent = + e.brainCloudClient.playerStatisticsEvent = + e.brainCloudClient.playerStatisticsEvent || {}), + (e.brainCloudManager.presence = e.brainCloudClient.presence = + e.brainCloudClient.presence || {}), + (e.brainCloudManager.virtualCurrency = + e.brainCloudClient.virtualCurrency = + e.brainCloudClient.virtualCurrency || {}), + (e.brainCloudManager.appStore = e.brainCloudClient.appStore = + e.brainCloudClient.appStore || {}), + (e.brainCloudManager.profanity = e.brainCloudClient.profanity = + e.brainCloudClient.profanity || {}), + (e.brainCloudManager.pushNotification = + e.brainCloudClient.pushNotification = + e.brainCloudClient.pushNotification || {}), + (e.brainCloudManager.reasonCodes = + e.brainCloudClient.reasonCodes = + e.brainCloudClient.reasonCodes || {}), + (e.brainCloudManager.redemptionCode = + e.brainCloudClient.redemptionCode = + e.brainCloudClient.redemptionCode || {}), + (e.brainCloudManager.relay = e.brainCloudClient.relay = + e.brainCloudClient.relay || {}), + (e.brainCloudManager.rttService = + e.brainCloudClient.rttService = + e.brainCloudClient.rttService || {}), + (e.brainCloudManager.s3Handling = + e.brainCloudClient.s3Handling = + e.brainCloudClient.s3Handling || {}), + (e.brainCloudManager.script = e.brainCloudClient.script = + e.brainCloudClient.script || {}), + (e.brainCloudManager.socialLeaderboard = + e.brainCloudClient.socialLeaderboard = + e.brainCloudClient.socialLeaderboard || {}), + (e.brainCloudManager.leaderboard = + e.brainCloudManager.socialLeaderboard), + (e.brainCloudManager.statusCodes = + e.brainCloudClient.statusCodes = + e.brainCloudClient.statusCodes || {}), + (e.brainCloudManager.time = e.brainCloudClient.time = + e.brainCloudClient.time || {}), + (e.brainCloudManager.tournament = + e.brainCloudClient.tournament = + e.brainCloudClient.tournament || {}), + (e.brainCloudManager.globalFile = + e.brainCloudClient.globalFile = + e.brainCloudClient.globalFile || {}), + (e.brainCloudManager.itemCatalog = + e.brainCloudClient.itemCatalog = + e.brainCloudClient.itemCatalog || {}), + (e.brainCloudManager.userItems = e.brainCloudClient.userItems = + e.brainCloudClient.userItems || {}), + (e.brainCloudManager.customEntity = + e.brainCloudClient.customEntity = + e.brainCloudClient.customEntity || {}), + (e.brainCloudManager.timeUtils = e.brainCloudClient.timeUtils = + e.brainCloudClient.timeUtils || {}), + (e.brainCloudRttComms.rtt = e.brainCloudClient.rtt = + e.brainCloudClient.rtt || {}), + (e.brainCloudRttComms.brainCloudClient = e), + (e.brainCloudRelayComms.brainCloudClient = e)), + (e.version = "4.10.0"), + e.countryCode, + e.languageCode, + (e.initialize = function (t, a, i) { + function n(e) { + return !e || /^\s*$/.test(e); + } + e.resetCommunication(); + var s = null; + (n(a) + ? (s = "secret was null or empty") + : n(t) + ? (s = "appId was null or empty") + : n(i) && (s = "appVersion was null or empty"), + null == s + ? ((e.appVersion = i), + e.brainCloudManager.initialize(t, a, i)) + : console.log( + "ERROR | Failed to initialize brainCloud - " + s, + )); + }), + (e.initializeWithApps = function (t, a, i) { + function n(e) { + return !e || /^\s*$/.test(e); + } + e.resetCommunication(); + var s = t, + o = null; + (n(a[s]) + ? (o = "secret was null or empty") + : n(s) + ? (o = "appId was null or empty") + : n(i) && (o = "appVersion was null or empty"), + null == o + ? ((e.appVersion = i), + e.brainCloudManager.initializeWithApps(t, a, i)) + : console.log( + "ERROR | Failed to initialize brainCloud - " + o, + )); + }), + (e.initializeIdentity = function (t, a) { + e.authentication.initialize(t, a); + }), + (e.setServerUrl = function (t) { + e.brainCloudManager.setServerUrl(t); + }), + (e.getAppId = function () { + return e.brainCloudManager.getAppId(); + }), + (e.getAppVersion = function () { + return e.appVersion; + }), + (e.getProfileId = function () { + return e.authentication.profileId; + }), + (e.getSessionId = function () { + return e.brainCloudManager.getSessionId(); + }), + (e.getRTTConnectionId = function () { + return e.brainCloudRttComms.getRTTConnectionId(); + }), + (e.registerEventCallback = function (t) { + e.brainCloudManager.registerEventCallback(t); + }), + (e.deregisterEventCallback = function () { + e.brainCloudManager.deregisterEventCallback(); + }), + (e.registerRewardCallback = function (t) { + e.brainCloudManager.registerRewardCallback(t); + }), + (e.deregisterRewardCallback = function () { + e.brainCloudManager.deregisterRewardCallback(); + }), + (e.setErrorCallback = function (t) { + e.brainCloudManager.setErrorCallback(t); + }), + (e.registerGlobalErrorCallback = function (t) { + e.brainCloudManager.setErrorCallback(t); + }), + (e.enableLogging = function (t) { + (e.brainCloudManager.setDebugEnabled(t), + e.brainCloudRttComms.setDebugEnabled(t), + e.brainCloudRelayComms.setDebugEnabled(t)); + }), + (e.setDebugEnabled = function (t) { + (e.brainCloudManager.setDebugEnabled(t), + e.brainCloudRttComms.setDebugEnabled(t), + e.brainCloudRelayComms.setDebugEnabled(t)); + }), + (e.isInitialized = function () { + return e.brainCloudManager.isInitialized(); + }), + (e.isAuthenticated = function () { + return e.brainCloudManager.isAuthenticated(); + }), + (e.resetCommunication = function () { + ((e.authentication.profileId = ""), + e.brainCloudManager.resetCommunication(), + e.brainCloudRttComms.disableRTT(), + e.brainCloudRelayComms.disconnect()); + }), + (e.insertEndOfMessageBundleMarker = function () { + e.brainCloudManager.sendRequest({ + operation: "END_BUNDLE_MARKER", + }); + }), + (e.overrideCountryCode = function (t) { + e.countryCode = t; + }), + (e.overrideLanguageCode = function (e) { + brainCloudClient.languageCode = e; + }), + (e.heartbeat = function (t) { + e.brainCloudManager.sendRequest({ + service: "heartbeat", + operation: "READ", + callback: t, + }); + }), + (e.stopHeartBeat = function () { + e.brainCloudManager.stopHeartBeat(); + }), + (e.startHeartBeat = function () { + e.brainCloudManager.startHeartBeat(); + })); + } + function K(e) { + var t = this; + ((t.CONTROL_BYTES_SIZE = 1), + (t.MAX_PLAYERS = 40), + (t.INVALID_NET_ID = t.MAX_PLAYERS), + (t.CL2RS_CONNECT = 0), + (t.CL2RS_DISCONNECT = 1), + (t.CL2RS_RELAY = 2), + (t.CL2RS_ACK = 3), + (t.CL2RS_PING = 4), + (t.CL2RS_RSMG_ACK = 5), + (t.RS2CL_RSMG = 0), + (t.RS2CL_DISCONNECT = 1), + (t.RS2CL_RELAY = 2), + (t.RS2CL_ACK = 3), + (t.RS2CL_PONG = 4), + (t.RELIABLE_BIT = 32768), + (t.ORDERED_BIT = 16384), + (t.m_client = e), + (t.name = "BrainCloudRelayComms"), + (t.isConnected = false), + (t._cxId = null), + (t._ownerCxId = null), + (t._netIdToCxId = {}), + (t._cxIdToNetId = {}), + (t._debugEnabled = false), + (t._netId = t.INVALID_NET_ID), + (t._systemCallback = null), + (t._relayCallback = null), + (t._pingIntervalMS = 1000), + (t._pingIntervalId = null), + (t._pingInFlight = false), + (t._pingTime = null), + (t._sendPacketId = {}), + (t.ping = 999), + (t.setDebugEnabled = function (e) { + t._debugEnabled = e; + }), + (t.getOwnerCxId = function () { + return t._ownerCxId; + }), + (t.getCxIdForNetId = function (e) { + return t._netIdToCxId.hasOwnProperty(e) + ? t._netIdToCxId[e] + : null; + }), + (t.getNetIdForCxId = function (e) { + return t._cxIdToNetId.hasOwnProperty(e) + ? t._cxIdToNetId[e] + : t.INVALID_NET_ID; + }), + (t.getProfileIdForNetId = function (e) { + var a = t.getCxIdForNetId(e); + return null == a ? null : a.split(":")[1]; + }), + (t.getNetIdForProfileId = function (e) { + for (var a in t._cxIdToNetId) + if (e === a.split(":")[1]) return t.getNetIdForCxId(a); + return t.INVALID_NET_ID; + }), + (t.connect = function (e, a, i) { + t.isConnected && t.disconnect(); + var n = !!e.ssl && e.ssl, + s = e.host, + o = e.port, + r = e.passcode, + l = e.lobbyId; + if ( + ((t.isConnected = false), + (t.connectCallback = { success: a, failure: i }), + (t.connectInfo = { passcode: r, lobbyId: l }), + s && o && r && l) ) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PLAYER_STATISTICS_EVENT, - operation: e.playerStatisticsEvent.OPERATION_TRIGGER, - data: { eventName: t, eventMultiplier: a }, - callback: i, - }); - }), - (e.playerStatisticsEvent.triggerStatsEvent = function (t, a, i) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PLAYER_STATISTICS_EVENT, - operation: e.playerStatisticsEvent.OPERATION_TRIGGER, - data: { eventName: t, eventMultiplier: a }, - callback: i, - }); - }), - (e.playerStatisticsEvent.triggerUserStatsEvents = function (t, a) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PLAYER_STATISTICS_EVENT, - operation: e.playerStatisticsEvent.OPERATION_TRIGGER_MULTIPLE, - data: { events: t }, - callback: a, - }); - }), - (e.playerStatisticsEvent.triggerStatsEvents = function (t, a) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PLAYER_STATISTICS_EVENT, - operation: e.playerStatisticsEvent.OPERATION_TRIGGER_MULTIPLE, - data: { events: t }, - callback: a, - }); - })); - } - function P() { - var e = this; - ((e.playerStatistics = {}), - (e.SERVICE_PLAYER_STATISTICS = "playerStatistics"), - (e.playerStatistics.READ = "READ"), - (e.playerStatistics.READ_SUBSET = "READ_SUBSET"), - (e.playerStatistics.READ_SHARED = "READ_SHARED"), - (e.playerStatistics.READ_FOR_CATEGORY = "READ_FOR_CATEGORY"), - (e.playerStatistics.RESET = "RESET"), - (e.playerStatistics.UPDATE = "UPDATE"), - (e.playerStatistics.UPDATE_INCREMENT = "UPDATE_INCREMENT"), - (e.playerStatistics.UPDATE_SET_MINIMUM = "UPDATE_SET_MINIMUM"), - (e.playerStatistics.UPDATE_INCREMENT_TO_MAXIMUM = - "UPDATE_INCREMENT_TO_MAXIMUM"), - (e.playerStatistics.OPERATION_PROCESS_STATISTICS = - "PROCESS_STATISTICS"), - (e.playerStatistics.OPERATION_READ_NEXT_XPLEVEL = - "READ_NEXT_XPLEVEL"), - (e.playerStatistics.OPERATION_SET_XPPOINTS = "SET_XPPOINTS"), - (e.playerStatistics.getNextExperienceLevel = function (t) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PLAYER_STATISTICS, - operation: e.playerStatistics.OPERATION_READ_NEXT_XPLEVEL, - callback: t, - }); - }), - (e.playerStatistics.incrementExperiencePoints = function (t, a) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PLAYER_STATISTICS, - operation: e.playerStatistics.UPDATE, - data: { xp_points: t }, - callback: a, - }); - }), - (e.playerStatistics.incrementUserStats = function (t, a, i) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PLAYER_STATISTICS, - operation: e.playerStatistics.UPDATE, - data: { statistics: t, xp_points: a }, - callback: i, - }); - }), - (e.playerStatistics.readAllUserStats = function (t) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PLAYER_STATISTICS, - operation: e.playerStatistics.READ, - callback: t, - }); - }), - (e.playerStatistics.readUserStatsSubset = function (t, a) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PLAYER_STATISTICS, - operation: e.playerStatistics.READ_SUBSET, - data: { statistics: t }, - callback: a, - }); - }), - (e.playerStatistics.readUserStatsForCategory = function (t, a) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PLAYER_STATISTICS, - operation: e.playerStatistics.READ_FOR_CATEGORY, - data: { category: t }, - callback: a, - }); - }), - (e.playerStatistics.resetAllUserStats = function (t) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PLAYER_STATISTICS, - operation: e.playerStatistics.RESET, - callback: t, - }); - }), - (e.playerStatistics.setExperiencePoints = function (t, a) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PLAYER_STATISTICS, - operation: e.playerStatistics.OPERATION_SET_XPPOINTS, - data: { xp_points: t }, - callback: a, - }); - }), - (e.playerStatistics.processStatistics = function (t, a) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PLAYER_STATISTICS, - operation: e.globalStatistics.OPERATION_PROCESS_STATISTICS, - data: { statistics: t }, - callback: a, - }); - })); - } - function M() { - var e = this; - ((e.presence = {}), - (e.SERVICE_PRESENCE = "presence"), - (e.presence.OPERATION_FORCE_PUSH = "FORCE_PUSH"), - (e.presence.OPERATION_GET_PRESENCE_OF_FRIENDS = - "GET_PRESENCE_OF_FRIENDS"), - (e.presence.OPERATION_GET_PRESENCE_OF_GROUP = - "GET_PRESENCE_OF_GROUP"), - (e.presence.OPERATION_GET_PRESENCE_OF_USERS = - "GET_PRESENCE_OF_USERS"), - (e.presence.OPERATION_REGISTER_LISTENERS_FOR_FRIENDS = - "REGISTER_LISTENERS_FOR_FRIENDS"), - (e.presence.OPERATION_REGISTER_LISTENERS_FOR_GROUP = - "REGISTER_LISTENERS_FOR_GROUP"), - (e.presence.OPERATION_REGISTER_LISTENERS_FOR_PROFILES = - "REGISTER_LISTENERS_FOR_PROFILES"), - (e.presence.OPERATION_SET_VISIBILITY = "SET_VISIBILITY"), - (e.presence.OPERATION_STOP_LISTENING = "STOP_LISTENING"), - (e.presence.OPERATION_UPDATE_ACTIVITY = "UPDATE_ACTIVITY"), - (e.presence.forcePush = function (t) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PRESENCE, - operation: e.presence.OPERATION_FORCE_PUSH, - data: null, - callback: t, - }); - }), - (e.presence.getPresenceOfFriends = function (t, a, i) { - var n = { platform: t, includeOffline: a }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PRESENCE, - operation: e.presence.OPERATION_GET_PRESENCE_OF_FRIENDS, - data: n, - callback: i, - }); - }), - (e.presence.getPresenceOfGroup = function (t, a, i) { - var n = { groupId: t, includeOffline: a }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PRESENCE, - operation: e.presence.OPERATION_GET_PRESENCE_OF_GROUP, - data: n, - callback: i, - }); - }), - (e.presence.getPresenceOfUsers = function (t, a, i) { - var n = { profileIds: t, includeOffline: a }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PRESENCE, - operation: e.presence.OPERATION_GET_PRESENCE_OF_USERS, - data: n, - callback: i, - }); - }), - (e.presence.registerListenersForFriends = function (t, a, i) { - var n = { platform: t, bidirectional: a }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PRESENCE, - operation: e.presence.OPERATION_REGISTER_LISTENERS_FOR_FRIENDS, - data: n, - callback: i, - }); - }), - (e.presence.registerListenersForGroup = function (t, a, i) { - var n = { groupId: t, bidirectional: a }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PRESENCE, - operation: e.presence.OPERATION_REGISTER_LISTENERS_FOR_GROUP, - data: n, - callback: i, - }); - }), - (e.presence.registerListenersForProfiles = function (t, a, i) { - var n = { profileIds: t, bidriectional: a }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PRESENCE, - operation: e.presence.OPERATION_REGISTER_LISTENERS_FOR_PROFILES, - data: n, - callback: i, - }); - }), - (e.presence.setVisibility = function (t, a) { - var i = { visible: t }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PRESENCE, - operation: e.presence.OPERATION_SET_VISIBILITY, - data: i, - callback: a, - }); - }), - (e.presence.stopListening = function (t) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PRESENCE, - operation: e.presence.OPERATION_STOP_LISTENING, - data: {}, - callback: t, - }); - }), - (e.presence.updateActivity = function (t, a) { - var i = { jsonActivity: t }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PRESENCE, - operation: e.presence.OPERATION_UPDATE_ACTIVITY, - data: i, - callback: a, - }); - })); - } - function L() { - var e = this; - ((e.profanity = {}), - (e.SERVICE_PROFANITY = "profanity"), - (e.profanity.OPERATION_PROFANITY_CHECK = "PROFANITY_CHECK"), - (e.profanity.OPERATION_PROFANITY_REPLACE_TEXT = - "PROFANITY_REPLACE_TEXT"), - (e.profanity.OPERATION_PROFANITY_IDENTIFY_BAD_WORDS = - "PROFANITY_IDENTIFY_BAD_WORDS"), - (e.profanity.profanityCheck = function (t, a, i, n, s, o) { - var r = {}; - ((r.text = t), - null != a && (r.languages = a), - (r.flagEmail = i), - (r.flagPhone = n), - (r.flagUrls = s), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PROFANITY, - operation: e.profanity.OPERATION_PROFANITY_CHECK, - data: r, - callback: o, - })); - }), - (e.profanity.profanityReplaceText = function (t, a, i, n, s, o, r) { - var l = {}; - ((l.text = t), - (l.replaceSymbol = a), - null != i && (l.languages = i), - (l.flagEmail = n), - (l.flagPhone = s), - (l.flagUrls = o), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PROFANITY, - operation: e.profanity.OPERATION_PROFANITY_REPLACE_TEXT, - data: l, - callback: r, - })); - }), - (e.profanity.profanityIdentifyBadWords = function ( - t, - a, - i, - n, - s, - o, - ) { - var r = {}; - ((r.text = t), - null != a && (r.languages = a), - (r.flagEmail = i), - (r.flagPhone = n), - (r.flagUrls = s), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PROFANITY, - operation: e.profanity.OPERATION_PROFANITY_IDENTIFY_BAD_WORDS, - data: r, - callback: o, - })); - })); - } - function D() { - var e = this; - ((e.pushNotification = {}), - (e.SERVICE_PUSH_NOTIFICATION = "pushNotification"), - (e.pushNotification.OPERATION_DEREGISTER_ALL = "DEREGISTER_ALL"), - (e.pushNotification.OPERATION_DEREGISTER = "DEREGISTER"), - (e.pushNotification.OPERATION_SEND_SIMPLE = "SEND_SIMPLE"), - (e.pushNotification.OPERATION_SEND_RICH = "SEND_RICH"), - (e.pushNotification.OPERATION_SEND_RAW = "SEND_RAW"), - (e.pushNotification.OPERATION_SEND_RAW_TO_GROUP = - "SEND_RAW_TO_GROUP"), - (e.pushNotification.OPERATION_SEND_RAW_BATCH = "SEND_RAW_BATCH"), - (e.pushNotification.OPERATION_REGISTER = "REGISTER"), - (e.pushNotification.OPERATION_SEND_NORMALIZED_TO_GROUP = - "SEND_NORMALIZED_TO_GROUP"), - (e.pushNotification.OPERATION_SEND_TEMPLATED_TO_GROUP = - "SEND_TEMPLATED_TO_GROUP"), - (e.pushNotification.OPERATION_SEND_NORMALIZED = "SEND_NORMALIZED"), - (e.pushNotification.OPERATION_SEND_NORMALIZED_BATCH = - "SEND_NORMALIZED_BATCH"), - (e.pushNotification.OPERATION_SCHEDULED_RICH = - "SCHEDULE_RICH_NOTIFICATION"), - (e.pushNotification.OPERATION_SCHEDULED_NORMALIZED = - "SCHEDULE_NORMALIZED_NOTIFICATION"), - (e.pushNotification.OPERATION_SCHEDULED_RAW = - "SCHEDULE_RAW_NOTIFICATION"), - (e.pushNotification.deregisterAllPushNotificationDeviceTokens = - function (t) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PUSH_NOTIFICATION, - operation: e.pushNotification.OPERATION_DEREGISTER_ALL, - data: {}, - callback: t, - }); - }), - (e.pushNotification.deregisterPushNotificationDeviceToken = - function (t, a, i) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PUSH_NOTIFICATION, - operation: e.pushNotification.OPERATION_DEREGISTER, - data: { deviceType: t, deviceToken: a }, - callback: i, - }); - }), - (e.pushNotification.registerPushNotificationDeviceToken = function ( - t, - a, - i, - ) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PUSH_NOTIFICATION, - operation: e.pushNotification.OPERATION_REGISTER, - data: { deviceType: t, deviceToken: a }, - callback: i, - }); - }), - (e.pushNotification.sendSimplePushNotification = function ( - t, - a, - i, - ) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PUSH_NOTIFICATION, - operation: e.pushNotification.OPERATION_SEND_SIMPLE, - data: { toPlayerId: t, message: a }, - callback: i, - }); - }), - (e.pushNotification.sendRichPushNotification = function (t, a, i) { - e.pushNotification.sendRichPushNotificationWithParams( - t, - a, - null, - i, - ); - }), - (e.pushNotification.sendRichPushNotificationWithParams = function ( - t, - a, - i, - n, - ) { - var s = { toPlayerId: t, notificationTemplateId: a }; - (i && (s.substitutions = i), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PUSH_NOTIFICATION, - operation: e.pushNotification.OPERATION_SEND_RICH, - data: s, - callback: n, - })); - }), - (e.pushNotification.sendTemplatedPushNotificationToGroup = - function (t, a, i, n) { - var s = { groupId: t, notificationTemplateId: a }; - (i && (s.substitutions = i), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PUSH_NOTIFICATION, - operation: - e.pushNotification.OPERATION_SEND_TEMPLATED_TO_GROUP, - data: s, - callback: n, - })); - }), - (e.pushNotification.sendNormalizedPushNotificationToGroup = - function (t, a, i, n) { - var s = { groupId: t, alertContent: a }; - (i && (s.customData = i), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PUSH_NOTIFICATION, - operation: - e.pushNotification.OPERATION_SEND_NORMALIZED_TO_GROUP, - data: s, - callback: n, - })); - }), - (e.pushNotification.scheduleRawPushNotificationUTC = function ( - t, - a, - i, - n, - s, - o, - ) { - var r = { profileId: t, startDateUTC: s }; - (a && (r.fcmContent = a), - i && (r.iosContent = i), - n && (r.facebookContent = n), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PUSH_NOTIFICATION, - operation: e.pushNotification.OPERATION_SCHEDULED_RAW, - data: r, - callback: o, - })); - }), - (e.pushNotification.scheduleRawPushNotificationMinutes = function ( - t, - a, - i, - n, - s, - o, - ) { - var r = { profileId: t, minutesFromNow: s }; - (a && (r.fcmContent = a), - i && (r.iosContent = i), - n && (r.facebookContent = n), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PUSH_NOTIFICATION, - operation: e.pushNotification.OPERATION_SCHEDULED_RAW, - data: r, - callback: o, - })); - }), - (e.pushNotification.sendRawPushNotification = function ( - t, - a, - i, - n, - s, - ) { - var o = { toPlayerId: t }; - (a && (o.fcmContent = a), - i && (o.iosContent = i), - n && (o.facebookContent = n), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PUSH_NOTIFICATION, - operation: e.pushNotification.OPERATION_SEND_RAW, - data: o, - callback: s, - })); - }), - (e.pushNotification.sendRawPushNotificationBatch = function ( - t, - a, - i, - n, - s, - ) { - var o = { profileIds: t }; - (a && (o.fcmContent = a), - i && (o.iosContent = i), - n && (o.facebookContent = n), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PUSH_NOTIFICATION, - operation: e.pushNotification.OPERATION_SEND_RAW_BATCH, - data: o, - callback: s, - })); - }), - (e.pushNotification.sendRawPushNotificationToGroup = function ( - t, - a, - i, - n, - s, - ) { - var o = { groupId: t }; - (a && (o.fcmContent = a), - i && (o.iosContent = i), - n && (o.facebookContent = n), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PUSH_NOTIFICATION, - operation: e.pushNotification.OPERATION_SEND_RAW_TO_GROUP, - data: o, - callback: s, - })); - }), - (e.pushNotification.scheduleNormalizedPushNotificationUTC = - function (t, a, i, n, s) { - var o = { profileId: t, alertContent: a, startDateUTC: n }; - (i && (o.customData = i), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PUSH_NOTIFICATION, - operation: - e.pushNotification.OPERATION_SCHEDULED_NORMALIZED, - data: o, - callback: s, - })); - }), - (e.pushNotification.scheduleNormalizedPushNotificationMinutes = - function (t, a, i, n, s) { - var o = { profileId: t, alertContent: a, minutesFromNow: n }; - (i && (o.customData = i), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PUSH_NOTIFICATION, - operation: - e.pushNotification.OPERATION_SCHEDULED_NORMALIZED, - data: o, - callback: s, - })); + var c = (n ? "wss://" : "ws://") + s + ":" + o; + ((t.socket = new WebSocket(c)), + t.socket.addEventListener("error", t.onSocketError), + t.socket.addEventListener("close", t.onSocketClose), + t.socket.addEventListener("open", t.onSocketOpen), + t.socket.addEventListener("message", t.onSocketMessage)); + } else + setTimeout(function () { + t.connectCallback.failure && + t.connectCallback.failure("Invalid arguments"); + }, 0); + }), + (t.disconnect = function () { + (t.stopPing(), + t.socket && + (t.socket.removeEventListener("error", t.onSocketError), + t.socket.removeEventListener("close", t.onSocketClose), + t.socket.removeEventListener("open", t.onSocketOpen), + t.socket.removeEventListener("message", t.onSocketMessage), + t.socket.close(), + (t.socket = null)), + (t.isConnected = false), + (t._sendPacketId = {}), + (t._netIdToProfileId = {}), + (t._profileIdToNetId = {}), + (t.ping = 999)); + }), + (t.registerRelayCallback = function (e) { + t._relayCallback = e; + }), + (t.deregisterRelayCallback = function () { + t._relayCallback = null; + }), + (t.registerSystemCallback = function (e) { + t._systemCallback = e; + }), + (t.deregisterSystemCallback = function () { + t._systemCallback = null; + }), + (t.setPingInterval = function (e) { + ((t._pingIntervalMS = Math.max(1000, e)), + t.isConnected && (t.stopPing(), t.startPing())); + }), + (t.getOwnerProfileId = function () { + return t._ownerCxId.spit(":")[1]; + }), + (t.stopPing = function () { + (t._pingIntervalId && + (clearInterval(t._pingIntervalId), (t._pingIntervalId = null)), + (t._pingInFlight = false)); + }), + (t.startPing = function () { + (t.stopPing(), + (t._pingIntervalId = setInterval(function () { + t._pingInFlight || t.sendPing(); + }, t._pingIntervalMS))); + }), + (t.onSocketError = function (e) { + (t.disconnect(), + t.connectCallback.failure && + t.connectCallback.failure("Relay error: " + e.toString())); + }), + (t.onSocketClose = function (e) { + (t.disconnect(), + t.connectCallback.failure && + t.connectCallback.failure("Relay Connection closed")); + }), + (t.onSocketOpen = function (e) { + console.log("Relay WebSocket connection established"); + var a = { + lobbyId: t.connectInfo.lobbyId, + cxId: t.m_client.rttService.getRTTConnectionId(), + passcode: t.connectInfo.passcode, + version: t.m_client.version, + }; + t.sendJson(t.CL2RS_CONNECT, a); + }), + (t.onSocketMessage = function (e) { + var a = function (e) { + console.log("Typeof data = " + typeof e); + var a = new Buffer(e); + if (e.length < 3) + return ( + t.disconnect(), + void ( + t.connectCallback.failure && + t.connectCallback.failure( + "Relay Recv Error: packet cannot be smaller than 3 bytes", + ) + ) + ); + t.onRecv(a); + }; + if ("undefined" != typeof FileReader) { + var i = new FileReader(); + ((i.onload = function () { + a(i.result); }), - (e.pushNotification.scheduleRichPushNotificationUTC = function ( - t, - a, - i, - n, - s, - ) { - var o = { - profileId: t, - notificationTemplateId: a, - startDateUTC: n, - }; - (i && (o.substitutions = i), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PUSH_NOTIFICATION, - operation: e.pushNotification.OPERATION_SCHEDULED_RICH, - data: o, - callback: s, - })); - }), - (e.pushNotification.scheduleRichPushNotificationMinutes = function ( - t, - a, - i, - n, - s, - ) { - var o = { - profileId: t, - notificationTemplateId: a, - minutesFromNow: n, - }; - (i && (o.substitutions = i), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PUSH_NOTIFICATION, - operation: e.pushNotification.OPERATION_SCHEDULED_RICH, - data: o, - callback: s, - })); - }), - (e.pushNotification.sendNormalizedPushNotification = function ( - t, - a, - i, - n, - ) { - var s = { toPlayerId: t, alertContent: a }; - (i && (s.customData = i), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PUSH_NOTIFICATION, - operation: e.pushNotification.OPERATION_SEND_NORMALIZED, - data: s, - callback: n, - })); - }), - (e.pushNotification.sendNormalizedPushNotificationBatch = function ( - t, - a, - i, - n, - ) { - var s = { profileIds: t, alertContent: a }; - (i && (s.customData = i), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_PUSH_NOTIFICATION, - operation: e.pushNotification.OPERATION_SEND_NORMALIZED_BATCH, - data: s, - callback: n, - })); - })); - } - function B() { - var e = this; - ((e.reasonCodes = {}), - (e.reasonCodes.NO_REASON_CODE = 0), - (e.reasonCodes.INVALID_NOTIFICATION = 20200), - (e.reasonCodes.INVALID_REQUEST = 40001), - (e.reasonCodes.CREATING_FACEBOOK_MEMORY = 40200), - (e.reasonCodes.SWITCHING_FACEBOOK_MEMORY = 40201), - (e.reasonCodes.MERGING_MEMORY = 40202), - (e.reasonCodes.RECREATING_ANONYMOUS_MEMORY = 40203), - (e.reasonCodes.MOVING_ANONYMOUS_MEMORY = 40204), - (e.reasonCodes.LOGIN_SECURITY_ERROR = 40205), - (e.reasonCodes.MISSING_IDENTITY_ERROR = 40206), - (e.reasonCodes.SWITCHING_PROFILES = 40207), - (e.reasonCodes.MISSING_PROFILE_ERROR = 40208), - (e.reasonCodes.SECURITY_ERROR = 40209), - (e.reasonCodes.DOWNGRADING_TO_ANONYMOUS_ERROR = 40210), - (e.reasonCodes.DUPLICATE_IDENTITY_TYPE = 40211), - (e.reasonCodes.MERGE_PROFILES = 40212), - (e.reasonCodes.INVALID_PROPERTY_NAME = 40213), - (e.reasonCodes.EMAIL_NOT_VALIDATED = 40214), - (e.reasonCodes.DATABASE_ERROR = 40215), - (e.reasonCodes.PROPERTY_NOT_OVERRIDEABLE = 40216), - (e.reasonCodes.UNKNOWN_AUTH_ERROR = 40217), - (e.reasonCodes.DATABASE_INPUT_TOO_LARGE_ERROR = 40218), - (e.reasonCodes.MISSING_APP_EMAIL_ACCOUNT = 40219), - (e.reasonCodes.DATABASE_DUP_KEY_ERROR = 40220), - (e.reasonCodes.EMAIL_NOT_VALID = 40221), - (e.reasonCodes.UNABLE_TO_GET_FRIENDS_FROM_FACEBOOK = 40300), - (e.reasonCodes.BAD_SIGNATURE = 40301), - (e.reasonCodes.UNABLE_TO_VALIDATE_PLAYER = 40302), - (e.reasonCodes.PLAYER_SESSION_EXPIRED = 40303), - (e.reasonCodes.NO_SESSION = 40304), - (e.reasonCodes.PLAYER_SESSION_MISMATCH = 40305), - (e.reasonCodes.OPERATION_REQUIRES_A_SESSION = 40306), - (e.reasonCodes.TOKEN_DOES_NOT_MATCH_USER = 40307), - (e.reasonCodes.MANUAL_REDIRECT = 40308), - (e.reasonCodes.EVENT_CAN_ONLY_SEND_TO_FRIEND_OR_SELF = 40309), - (e.reasonCodes.NOT_FRIENDS = 40310), - (e.reasonCodes.VC_BALANCE_CANNOT_BE_SPECIFIED = 40311), - (e.reasonCodes.VC_LIMIT_EXCEEDED = 40312), - (e.reasonCodes.UNABLE_TO_GET_MY_DATA_FROM_FACEBOOK = 40313), - (e.reasonCodes.TLS_VERSION_INVALID = 40314), - (e.reasonCodes.INVALID_AUTHENTICATION_TYPE = 40315), - (e.reasonCodes.INVALID_GAME_ID = 40316), - (e.reasonCodes.APPLE_TRANS_ID_ALREADY_CLAIMED = 40317), - (e.reasonCodes.CLIENT_VERSION_NOT_SUPPORTED = 40318), - (e.reasonCodes.BRAINCLOUD_VERSION_NOT_SUPPORTED = 40319), - (e.reasonCodes.PLATFORM_NOT_SUPPORTED = 40320), - (e.reasonCodes.INVALID_PLAYER_STATISTICS_EVENT_NAME = 40321), - (e.reasonCodes.GAME_VERSION_NOT_SUPPORTED = 40322), - (e.reasonCodes.BAD_REFERENCE_DATA = 40324), - (e.reasonCodes.MISSING_OAUTH_TOKEN = 40325), - (e.reasonCodes.MISSING_OAUTH_VERIFIER = 40326), - (e.reasonCodes.MISSING_OAUTH_TOKEN_SECRET = 40327), - (e.reasonCodes.MISSING_TWEET = 40328), - (e.reasonCodes.FACEBOOK_PAYMENT_ID_ALREADY_PROCESSED = 40329), - (e.reasonCodes.DISABLED_GAME = 40330), - (e.reasonCodes.MATCH_MAKING_DISABLED = 40331), - (e.reasonCodes.UPDATE_FAILED = 40332), - (e.reasonCodes.INVALID_OPERATION = 40333), - (e.reasonCodes.MATCH_RANGE_ERROR = 40334), - (e.reasonCodes.PLAYER_IN_MATCH = 40335), - (e.reasonCodes.MATCH_PLAYER_SHIELDED = 40336), - (e.reasonCodes.MATCH_PLAYER_MISSING = 40337), - (e.reasonCodes.MATCH_PLAYER_LOGGED_IN = 40338), - (e.reasonCodes.INVALID_ITEM_ID = 40339), - (e.reasonCodes.MISSING_PRICE = 40340), - (e.reasonCodes.MISSING_USER_INFO = 40341), - (e.reasonCodes.MISSING_STEAM_RESPONSE = 40342), - (e.reasonCodes.MISSING_STEAM_TRANSACTION = 40343), - (e.reasonCodes.ENTITY_VERSION_MISMATCH = 40344), - (e.reasonCodes.MISSING_RECORD = 40345), - (e.reasonCodes.INSUFFICIENT_PERMISSIONS = 40346), - (e.reasonCodes.MISSING_IN_QUERY = 40347), - (e.reasonCodes.INVALID_DATABASE_FIELD_NAME = 40347), - (e.reasonCodes.RECORD_EXPIRED = 40348), - (e.reasonCodes.INVALID_WHERE = 40349), - (e.reasonCodes.S3_ERROR = 40350), - (e.reasonCodes.INVALID_ATTRIBUTES = 40351), - (e.reasonCodes.IMPORT_MISSING_GAME_DATA = 40352), - (e.reasonCodes.IMPORT_SCHEMA_VERSION_TOO_OLD = 40353), - (e.reasonCodes.IMPORT_SCHEMA_VERSION_INVALID = 40355), - (e.reasonCodes.PLAYER_SESSION_LOGGED_OUT = 40356), - (e.reasonCodes.API_HOOK_SCRIPT_ERROR = 40357), - (e.reasonCodes.MISSING_REQUIRED_PARAMETER = 40358), - (e.reasonCodes.INVALID_PARAMETER_TYPE = 40359), - (e.reasonCodes.INVALID_IDENTITY_TYPE = 40360), - (e.reasonCodes.EMAIL_SEND_ERROR = 40361), - (e.reasonCodes.CHILD_ENTITY_PARTIAL_UPDATE_INVALID_DATA = 40362), - (e.reasonCodes.MISSING_SCRIPT = 40363), - (e.reasonCodes.SCRIPT_SECURITY_ERROR = 40364), - (e.reasonCodes.SERVER_SESSION_EXPIRED = 40365), - (e.reasonCodes.STREAM_DOES_NOT_EXIT = 40366), - (e.reasonCodes.STREAM_ACCESS_ERROR = 40367), - (e.reasonCodes.STREAM_COMPLETE = 40368), - (e.reasonCodes.INVALID_STATISTIC_NAME = 40369), - (e.reasonCodes.INVALID_HTTP_REQUEST = 40370), - (e.reasonCodes.GAME_LIMIT_REACHED = 40371), - (e.reasonCodes.GAME_RUNSTATE_DISABLED = 40372), - (e.reasonCodes.INVALID_COMPANY_ID = 40373), - (e.reasonCodes.INVALID_PLAYER_ID = 40374), - (e.reasonCodes.INVALID_TEMPLATE_ID = 40375), - (e.reasonCodes.MINIMUM_SEARCH_INPUT = 40376), - (e.reasonCodes.MISSING_GAME_PARENT = 40377), - (e.reasonCodes.GAME_PARENT_MISMATCH = 40378), - (e.reasonCodes.CHILD_PLAYER_MISSING = 40379), - (e.reasonCodes.MISSING_PLAYER_PARENT = 40380), - (e.reasonCodes.PLAYER_PARENT_MISMATCH = 40381), - (e.reasonCodes.MISSING_PLAYER_ID = 40382), - (e.reasonCodes.DECODE_CONTEXT = 40383), - (e.reasonCodes.INVALID_QUERY_CONTEXT = 40384), - (e.reasonCodes.INVALID_AMOUNT = 40385), - (e.reasonCodes.GROUP_MEMBER_NOT_FOUND = 40385), - (e.reasonCodes.INVALID_SORT = 40386), - (e.reasonCodes.GAME_NOT_FOUND = 40387), - (e.reasonCodes.GAMES_NOT_IN_SAME_COMPANY = 40388), - (e.reasonCodes.IMPORT_NO_PARENT_ASSIGNED = 40389), - (e.reasonCodes.IMPORT_PARENT_CURRENCIES_MISMATCH = 40390), - (e.reasonCodes.INVALID_SUBSTITUION_ENTRY = 40391), - (e.reasonCodes.INVALID_TEMPLATE_STRING = 40392), - (e.reasonCodes.TEMPLATE_SUBSTITUTION_ERROR = 40393), - (e.reasonCodes.INVALID_OPPONENTS = 40394), - (e.reasonCodes.REDEMPTION_CODE_NOT_FOUND = 40395), - (e.reasonCodes.REDEMPTION_CODE_VERSION_MISMATCH = 40396), - (e.reasonCodes.REDEMPTION_CODE_ACTIVE = 40397), - (e.reasonCodes.REDEMPTION_CODE_NOT_ACTIVE = 40398), - (e.reasonCodes.REDEMPTION_CODE_TYPE_NOT_FOUND = 40399), - (e.reasonCodes.REDEMPTION_CODE_INVALID = 40400), - (e.reasonCodes.REDEMPTION_CODE_REDEEMED = 40401), - (e.reasonCodes.REDEMPTION_CODE_REDEEMED_BY_SELF = 40402), - (e.reasonCodes.REDEMPTION_CODE_REDEEMED_BY_OTHER = 40403), - (e.reasonCodes.SCRIPT_EMPTY = 40404), - (e.reasonCodes.ITUNES_COMMUNICATION_ERROR = 40405), - (e.reasonCodes.ITUNES_NO_RESPONSE = 40406), - (e.reasonCodes.ITUNES_RESPONSE_NOT_OK = 40407), - (e.reasonCodes.JSON_PARSING_ERROR = 40408), - (e.reasonCodes.ITUNES_NULL_RESPONSE = 40409), - (e.reasonCodes.ITUNES_RESPONSE_WITH_NULL_STATUS = 40410), - (e.reasonCodes.ITUNES_STATUS_BAD_JSON_RECEIPT = 40411), - (e.reasonCodes.ITUNES_STATUS_BAD_RECEIPT = 40412), - (e.reasonCodes.ITUNES_STATUS_RECEIPT_NOT_AUTHENTICATED = 40413), - (e.reasonCodes.ITUNES_STATUS_BAD_SHARED_SECRET = 40414), - (e.reasonCodes.ITUNES_STATUS_RECEIPT_SERVER_UNAVAILABLE = 40415), - (e.reasonCodes.ITUNES_RECEIPT_MISSING_ITUNES_PRODUCT_ID = 40416), - (e.reasonCodes.PRODUCT_NOT_FOUND_FOR_ITUNES_PRODUCT_ID = 40417), - (e.reasonCodes.DATA_STREAM_EVENTS_NOT_ENABLED = 40418), - (e.reasonCodes.INVALID_DEVICE_TOKEN = 40419), - (e.reasonCodes.ERROR_DELETING_DEVICE_TOKEN = 40420), - (e.reasonCodes.WEBPURIFY_NOT_CONFIGURED = 40421), - (e.reasonCodes.WEBPURIFY_EXCEPTION = 40422), - (e.reasonCodes.WEBPURIFY_FAILURE = 40423), - (e.reasonCodes.WEBPURIFY_NOT_ENABLED = 40424), - (e.reasonCodes.NAME_CONTAINS_PROFANITY = 40425), - (e.reasonCodes.NULL_SESSION = 40426), - (e.reasonCodes.PURCHASE_ALREADY_VERIFIED = 40427), - (e.reasonCodes.GOOGLE_IAP_NOT_CONFIGURED = 40428), - (e.reasonCodes.UPLOAD_FILE_TOO_LARGE = 40429), - (e.reasonCodes.FILE_ALREADY_EXISTS = 40430), - (e.reasonCodes.CLOUD_STORAGE_SERVICE_ERROR = 40431), - (e.reasonCodes.FILE_DOES_NOT_EXIST = 40432), - (e.reasonCodes.UPLOAD_ID_MISSING = 40433), - (e.reasonCodes.UPLOAD_JOB_MISSING = 40434), - (e.reasonCodes.UPLOAD_JOB_EXPIRED = 40435), - (e.reasonCodes.UPLOADER_EXCEPTION = 40436), - (e.reasonCodes.UPLOADER_FILESIZE_MISMATCH = 40437), - (e.reasonCodes.PUSH_NOTIFICATIONS_NOT_CONFIGURED = 40438), - (e.reasonCodes.MATCHMAKING_FILTER_SCRIPT_FAILURE = 40439), - (e.reasonCodes.ACCOUNT_ALREADY_EXISTS = 40440), - (e.reasonCodes.PROFILE_ALREADY_EXISTS = 40441), - (e.reasonCodes.MISSING_NOTIFICATION_BODY = 40442), - (e.reasonCodes.INVALID_SERVICE_CODE = 40443), - (e.reasonCodes.IP_ADDRESS_BLOCKED = 40444), - (e.reasonCodes.UNAPPROVED_SERVICE_CODE = 40445), - (e.reasonCodes.PROFILE_NOT_FOUND = 40446), - (e.reasonCodes.ENTITY_NOT_SHARED = 40447), - (e.reasonCodes.SELF_FRIEND = 40448), - (e.reasonCodes.PARSE_NOT_CONFIGURED = 40449), - (e.reasonCodes.PARSE_NOT_ENABLED = 40450), - (e.reasonCodes.PARSE_REQUEST_ERROR = 40451), - (e.reasonCodes.GROUP_CANNOT_ADD_OWNER = 40452), - (e.reasonCodes.NOT_GROUP_MEMBER = 40453), - (e.reasonCodes.INVALID_GROUP_ROLE = 40454), - (e.reasonCodes.GROUP_OWNER_DELETE = 40455), - (e.reasonCodes.NOT_INVITED_GROUP_MEMBER = 40456), - (e.reasonCodes.GROUP_IS_FULL = 40457), - (e.reasonCodes.GROUP_OWNER_CANNOT_LEAVE = 40458), - (e.reasonCodes.INVALID_INCREMENT_VALUE = 40459), - (e.reasonCodes.GROUP_VERSION_MISMATCH = 40460), - (e.reasonCodes.GROUP_ENTITY_VERSION_MISMATCH = 40461), - (e.reasonCodes.INVALID_GROUP_ID = 40462), - (e.reasonCodes.INVALID_FIELD_NAME = 40463), - (e.reasonCodes.UNSUPPORTED_AUTH_TYPE = 40464), - (e.reasonCodes.CLOUDCODE_JOB_NOT_FOUND = 40465), - (e.reasonCodes.CLOUDCODE_JOB_NOT_SCHEDULED = 40466), - (e.reasonCodes.GROUP_TYPE_NOT_FOUND = 40467), - (e.reasonCodes.MATCHING_GROUPS_NOT_FOUND = 40468), - (e.reasonCodes.GENERATE_CDN_URL_ERROR = 40469), - (e.reasonCodes.INVALID_PROFILE_IDS = 40470), - (e.reasonCodes.MAX_PROFILE_IDS_EXCEEDED = 40471), - (e.reasonCodes.PROFILE_ID_MISMATCH = 40472), - (e.reasonCodes.LEADERBOARD_DOESNOT_EXIST = 40473), - (e.reasonCodes.APP_LICENSING_EXCEEDED = 40474), - (e.reasonCodes.SENDGRID_NOT_INSTALLED = 40475), - (e.reasonCodes.SENDGRID_EMAIL_SEND_ERROR = 40476), - (e.reasonCodes.SENDGRID_NOT_ENABLED_FOR_APP = 40477), - (e.reasonCodes.SENDGRID_GET_TEMPLATES_ERROR = 40478), - (e.reasonCodes.SENDGRID_INVALID_API_KEY = 40479), - (e.reasonCodes.EMAIL_SERVICE_NOT_CONFIGURED = 40480), - (e.reasonCodes.INVALID_EMAIL_TEMPLATE_TYPE = 40481), - (e.reasonCodes.SENDGRID_KEY_EMPTY_OR_NULL = 40482), - (e.reasonCodes.BODY_TEMPLATE_CANNOT_COEXIST = 40483), - (e.reasonCodes.SUBSTITUTION_BODY_CANNOT_COEXIST = 40484), - (e.reasonCodes.INVALID_FROM_ADDRESS = 40485), - (e.reasonCodes.INVALID_FROM_NAME = 40486), - (e.reasonCodes.INVALID_REPLY_TO_ADDRESS = 40487), - (e.reasonCodes.INVALID_REPLY_TO_NAME = 40488), - (e.reasonCodes.FROM_NAME_WITHOUT_FROM_ADDRESS = 40489), - (e.reasonCodes.REPLY_TO_NAME_WITHOUT_REPLY_TO_ADDRESS = 40490), - (e.reasonCodes.CURRENCY_SECURITY_ERROR = 40491), - (e.reasonCodes.INVALID_PEER_CODE = 40492), - (e.reasonCodes.PEER_NO_LONGER_EXISTS = 40493), - (e.reasonCodes.CANNOT_MODIFY_TOURNAMENT_WITH_LEADERBOARD_SERVICE = 40494), - (e.reasonCodes.NO_TOURNAMENT_ASSOCIATED_WITH_LEADERBOARD = 40495), - (e.reasonCodes.TOURNAMENT_NOT_ASSOCIATED_WITH_LEADERBOARD = 40496), - (e.reasonCodes.PLAYER_ALREADY_TOURNAMENT_FOR_LEADERBOARD = 40497), - (e.reasonCodes.PLAYER_EARLY_FOR_JOINING_TOURNAMENT = 40498), - (e.reasonCodes.NO_LEADERBOARD_FOUND = 40499), - (e.reasonCodes.PLAYER_NOT_IN_TIME_RANGE_FOR_POSTSCORE_TOURNAMENT = 40500), - (e.reasonCodes.LEADERBOARD_ID_BAD = 40501), - (e.reasonCodes.SCORE_INPUT_BAD = 40502), - (e.reasonCodes.ROUND_STARTED_EPOCH_INPUT_BAD = 40503), - (e.reasonCodes.TOURNAMENT_CODE_INPUT_BAD = 40504), - (e.reasonCodes.PLAYER_NOT_ENROLLED_IN_TOURNAMENT = 40505), - (e.reasonCodes.LEADERBOARD_VERSION_ID_INVALID = 40506), - (e.reasonCodes.NOT_ENOUGH_BALANCE_TO_JOIN_TOURNAMENT = 40507), - (e.reasonCodes.PARENT_ALREADY_ATTACHED = 40508), - (e.reasonCodes.PEER_ALREADY_ATTACHED = 40509), - (e.reasonCodes.IDENTITY_NOT_ATTACHED_WITH_PARENT = 40510), - (e.reasonCodes.IDENTITY_NOT_ATTACHED_WITH_PEER = 40511), - (e.reasonCodes.LEADERBOARD_SCORE_UPDATE_ERROR = 40512), - (e.reasonCodes.ERROR_CLAIMING_REWARD = 40513), - (e.reasonCodes.NOT_ENOUGH_PARENT_BALANCE_TO_JOIN_TOURNAMENT = 40514), - (e.reasonCodes.NOT_ENOUGH_PEER_BALANCE_TO_JOIN_TOURNAMENT = 40515), - (e.reasonCodes.PLAYER_LATE_FOR_JOINING_TOURNAMENT = 40516), - (e.reasonCodes.VIEWING_REWARD_FOR_NON_PROCESSED_TOURNAMENTS = 40517), - (e.reasonCodes.NO_REWARD_ASSOCIATED_WITH_LEADERBOARD = 40518), - (e.reasonCodes.PROFILE_PEER_NOT_FOUND = 40519), - (e.reasonCodes.LEADERBOARD_IN_ACTIVE_STATE = 40520), - (e.reasonCodes.LEADERBOARD_IN_CALCULATING_STATE = 40521), - (e.reasonCodes.TOURNAMENT_RESULT_PROCESSING_FAILED = 40522), - (e.reasonCodes.TOURNAMENT_REWARDS_ALREADY_CLAIMED = 40523), - (e.reasonCodes.NO_TOURNAMENT_FOUND = 40524), - (e.reasonCodes.UNEXPECTED_ERROR_RANK_ZERO_AFTER_PROCESSING = 40525), - (e.reasonCodes.UNEXPECTED_ERROR_DELETING_TOURNAMENT_LEADERBOARD_SCORE = 40526), - (e.reasonCodes.INVALID_RUN_STATE = 40527), - (e.reasonCodes.LEADERBOARD_SCORE_DOESNOT_EXIST = 40528), - (e.reasonCodes.INITIAL_SCORE_NULL = 40529), - (e.reasonCodes.TOURNAMENT_NOTIFICATIONS_PROCESSING_FAILED = 40530), - (e.reasonCodes.ACL_NOT_READABLE = 40531), - (e.reasonCodes.INVALID_OWNER_ID = 40532), - (e.reasonCodes.IMPORT_MISSING_PEERS_DATA = 40533), - (e.reasonCodes.INVALID_CREDENTIAL = 40534), - (e.reasonCodes.GLOBAL_ENTITY_SECURITY_ERROR = 40535), - (e.reasonCodes.LEADERBOARD_SECURITY_ERROR = 40536), - (e.reasonCodes.NOT_A_SYSTEM_ENTITY = 40537), - (e.reasonCodes.CONTROLLER_ERROR = 40538), - (e.reasonCodes.EVENT_MISSING = 40539), - (e.reasonCodes.INVALID_XP_LEVEL = 40540), - (e.reasonCodes.INVALID_ITUNES_ID = 40541), - (e.reasonCodes.IMPORT_ERROR = 40542), - (e.reasonCodes.INVALID_ENTITY_TYPE = 40543), - (e.reasonCodes.FORM_ERROR = 40544), - (e.reasonCodes.INVALID_PARENT = 40545), - (e.reasonCodes.INVALID_CURRENCY = 40546), - (e.reasonCodes.INVALID_THRESHHOLD = 40547), - (e.reasonCodes.MATCH_ALREADY_EXISTS = 40548), - (e.reasonCodes.FRIEND_NOT_FOUND = 40549), - (e.reasonCodes.MATCH_NOT_FOUND = 40550), - (e.reasonCodes.MATCH_COMPLETE = 40551), - (e.reasonCodes.MATCH_NOT_STARTED = 40552), - (e.reasonCodes.MATCH_EXPIRED = 40553), - (e.reasonCodes.PLAYER_NOT_IN_MATCH = 40554), - (e.reasonCodes.INVALID_MATCH_VERSION = 40555), - (e.reasonCodes.INVALID_TURN_VERSION = 40556), - (e.reasonCodes.INVALID_DEVICE_TYPE = 40557), - (e.reasonCodes.DUPLICATE_ENTITY = 40558), - (e.reasonCodes.DUPLICATE_EVENT = 40559), - (e.reasonCodes.INVALID_LEADERBOARD_COUNT = 40560), - (e.reasonCodes.DUPLICATE_LEADERBOARD = 40561), - (e.reasonCodes.MICROSOFT_ERROR = 40562), - (e.reasonCodes.DUPLICATE_TOURNAMENT = 40563), - (e.reasonCodes.CREATE_SYSTEM_ENTITY_FAILED = 40564), - (e.reasonCodes.INVALID_MAX_NUM_STREAMS = 40565), - (e.reasonCodes.INVALID_PACKET_ID = 40566), - (e.reasonCodes.HOOK_ERROR = 40567), - (e.reasonCodes.INVALID_STREAM_ID = 40568), - (e.reasonCodes.INVALID_SCAN_CODE = 40569), - (e.reasonCodes.NO_CUSTOM_ENTITY_CONFIG_FOUND = 40570), - (e.reasonCodes.NO_CUSTOM_ENTITY_FOUND = 40571), - (e.reasonCodes.CLOUD_STORAGE_ERROR = 40572), - (e.reasonCodes.NO_CUSTOM_FIELD_CONFIG_FOUND = 40573), - (e.reasonCodes.MISSING_CUSTOM_ENTITY_QUERY = 40574), - (e.reasonCodes.INVALID_CUSTOM_ENTITY_JSON_WHERE = 40575), - (e.reasonCodes.INVALID_CUSTOM_ENTITY_JSON_FIELDS = 40576), - (e.reasonCodes.ENTITY_ID_NOT_CONFIGURED = 40577), - (e.reasonCodes.UNCONFIGURED_CUSTOM_FIELD_ERROR = 40578), - (e.reasonCodes.CUSTOM_ENTITY_SECURITY_ERROR = 40579), - (e.reasonCodes.CUSTOM_ENTITY_PARTIAL_UPDATE_INVALID_DATA = 40580), - (e.reasonCodes.TOURNAMENT_PLAY_HAS_NOT_STARTED = 40581), - (e.reasonCodes.TOURNAMENT_PLAY_HAS_ENDED = 40582), - (e.reasonCodes.NEW_CREDENTIAL_IN_USE = 40583), - (e.reasonCodes.OLD_CREDENTIAL_NOT_OWNED = 40584), - (e.reasonCodes.CLOUD_CODE_SECURITY_ERROR = 40585), - (e.reasonCodes.RTT_SERVER_NOT_FOUND = 40586), - (e.reasonCodes.RTT_CLIENT_NOT_FOUND = 40587), - (e.reasonCodes.NO_RTT_SERVERS_AVAILABLE = 40588), - (e.reasonCodes.PROFILE_SESSION_MISMATCH = 40589), - (e.reasonCodes.WAITING_FOR_ON_DEMAND_TOURNAMENT_TO_START = 40590), - (e.reasonCodes.CDN_URLS_NOT_SUPPORTED = 40591), - (e.reasonCodes.CLOUD_CONTAINER_ERROR = 40592), - (e.reasonCodes.MESSAGING_FEATURE_NOT_CONFIGURED = 40593), - (e.reasonCodes.CHAT_FEATURE_NOT_CONFIGURED = 40594), - (e.reasonCodes.MESSAGE_NOT_FOUND = 40595), - (e.reasonCodes.COLLECTION_CREATE_DISABLED = 40596), - (e.reasonCodes.LEADERBAORD_COLLECTION_CREATE_DISABLED = 40597), - (e.reasonCodes.MESSAGE_VERSION_MISMATCH = 40598), - (e.reasonCodes.MESSAGEBOX_VERSION_MISMATCH = 40599), - (e.reasonCodes.MESSAGE_TOO_LARGE = 40600), - (e.reasonCodes.FEATURE_NOT_ENABLED = 40601), - (e.reasonCodes.CHANNEL_NOT_FOUND = 40603), - (e.reasonCodes.MALFORMED_FORM_DATA = 40604), - (e.reasonCodes.MISSING_LAST_PACKET_RESPONSE = 40605), - (e.reasonCodes.PACKET_IN_PROGRESS = 40606), - (e.reasonCodes.LOBBY_MEMBER_NOT_FOUND = 40607), - (e.reasonCodes.LOBBY_TEAM_NOT_FOUND = 40608), - (e.reasonCodes.LOBBY_ENTRY_QUEUE_MEMBER_NOT_FOUND = 40609), - (e.reasonCodes.INVALID_HEADER_APP_ID = 40610), - (e.reasonCodes.LOBBY_TYPE_NOT_FOUND = 40611), - (e.reasonCodes.LOBBY_TEAM_FULL = 40612), - (e.reasonCodes.LOBBY_NOT_FOUND = 40613), - (e.reasonCodes.MESSAGE_CONTENT_INVALID_JSON = 40614), - (e.reasonCodes.RTT_FEATURE_NOT_CONFIGURED = 40615), - (e.reasonCodes.CLOUD_CODE_ONLY_METHOD = 40616), - (e.reasonCodes.MESSAGE_FROM_JSON_ID_MUST_BE_NULL = 40617), - (e.reasonCodes.MESSAGE_FROM_JSON_NAME_MANDATORY = 40618), - (e.reasonCodes.INVALID_LOBBY_STEP_ALIGNMENT = 40619), - (e.reasonCodes.INVALID_LOBBY_STEP_STRATEGY = 40620), - (e.reasonCodes.MESSAGING_MAX_RECIPIENTS_EXCEEDED = 40621), - (e.reasonCodes.LOBBY_FEATURE_NOT_CONFIGURED = 40622), - (e.reasonCodes.TOO_MANY_USERS_FOR_TEAM = 40623), - (e.reasonCodes.TOO_MANY_USERS_FOR_LOBBY_TYPE = 40624), - (e.reasonCodes.DIVISION_SET_DOESNOT_EXIST = 40625), - (e.reasonCodes.LOBBY_CONFIG_NOT_FOUND = 40626), - (e.reasonCodes.PRESENCE_NOT_INITIALIZED = 40627), - (e.reasonCodes.PRESENCE_FEATURE_NOT_CONFIGURED = 40628), - (e.reasonCodes.PLAYER_ALREADY_IN_ACTIVE_DIVISION_SET = 40629), - (e.reasonCodes.TOURNAMENT_CODE_MISSING = 40630), - (e.reasonCodes.ERROR_ASSIGNING_DIVISION_SET_INSTANCE = 40631), - (e.reasonCodes.LEADERBOARD_NOT_DIVISION_SET_INSTANCE = 40632), - (e.reasonCodes.DIVISION_SET_SCHEDULING_TYPE_DOES_NOT_EXIST = 40633), - (e.reasonCodes.PRESENCE_ACTIVITY_NOT_ENABLED = 40634), - (e.reasonCodes.PRESENCE_REALTIME_NOT_ENABLED = 40635), - (e.reasonCodes.DIVISION_SET_MAX_SIZE_REACHED = 40636), - (e.reasonCodes.DIVISION_SET_INFO_ERROR = 40637), - (e.reasonCodes.DIVISION_SET_API_MUST_BE_USED = 40638), - (e.reasonCodes.API_CALL_REJECTED = 40639), - (e.reasonCodes.LEADERBOARD_TOURNAMENT_TEMPLATE_ONLY = 40640), - (e.reasonCodes.INVALID_TOURNAMENT_JOB_ID = 40641), - (e.reasonCodes.LEADERBOARD_ROTATION_ERROR = 40642), - (e.reasonCodes.CLOUD_COMPUTING_ERROR = 40643), - (e.reasonCodes.DOCKER_ERROR = 40644), - (e.reasonCodes.ROOM_SERVER_HOST_NOT_FOUND = 40645), - (e.reasonCodes.INVALID_ATTACHMENT_DATA = 40646), - (e.reasonCodes.SCRIPT_PARSING_ERROR = 40647), - (e.reasonCodes.INVALID_LOBBY_STEP_RANGES = 40648), - (e.reasonCodes.LOG_IN_LOG_ERROR = 40649), - (e.reasonCodes.CACHE_OBJECT_TOO_LARGE = 40650), - (e.reasonCodes.IDENTIFY_DORMANT_USERS_FEATURE_NOT_CONFIGURED = 40651), - (e.reasonCodes.USER_PURGE_NOTICE_NOT_CONFIGURED = 40652), - (e.reasonCodes.INVALID_CX_ID = 40653), - (e.reasonCodes.TOO_MANY_CACHE_OBJECTS = 40654), - (e.reasonCodes.HOSTING_NOT_ENABLED = 40655), - (e.reasonCodes.UNSUPPORTED_GROUP_LEADERBOARD_OPERATION = 40656), - (e.reasonCodes.INVALID_PLAYER = 40657), - (e.reasonCodes.TOO_MANY_LISTENERS = 40658), - (e.reasonCodes.CREATE_FAILED = 40659), - (e.reasonCodes.INVALID_PARAMETER_VALUE = 40660), - (e.reasonCodes.ITEM_VERSION_MISMATCH = 40661), - (e.reasonCodes.ITEM_PUBLISH_ERROR = 40662), - (e.reasonCodes.ITEM_NOT_FOUND = 40663), - (e.reasonCodes.ITEM_NO_USES = 40664), - (e.reasonCodes.ITEM_CREATE_ERROR = 40665), - (e.reasonCodes.ITEM_COOL_DOWN = 40666), - (e.reasonCodes.TASK_STATE_NOT_FOUND = 40667), - (e.reasonCodes.ITEM_UPDATE_ERROR = 40668), - (e.reasonCodes.ITEM_DELETE_ERROR = 40669), - (e.reasonCodes.ITEM_INVALID_VALUE = 40670), - (e.reasonCodes.ITEM_SELL_OR_PURCHASE_REVERSAL_ERROR = 40671), - (e.reasonCodes.ITEM_GIFTED = 40672), - (e.reasonCodes.MISSING_APP_CONTEXT = 40673), - (e.reasonCodes.PUBLIC_KEY_IN_USE = 40674), - (e.reasonCodes.CUSTOM_ENTITY_NOT_FOUND = 40675), - (e.reasonCodes.ITEM_GIFTING_ERROR = 40676), - (e.reasonCodes.ITEM_NOT_AVAILABLE_ON_BLOCKCHAIN = 40677), - (e.reasonCodes.MISSING_BLOCKCHAIN_INTEGRATION = 40678), - (e.reasonCodes.MISSING_BLOCKCHAIN_USER_IDENTITY = 40679), - (e.reasonCodes.STACKABLE_ITEMS_NOT_PERMITTED_ON_BLOCKCHAIN = 40680), - (e.reasonCodes.BLOCKCHAIN_PUBLISH_IN_PROGRESS = 40681), - (e.reasonCodes.JWT_VERIFY_ERROR = 40682), - (e.reasonCodes.USER_ALREADY_EXISTS = 40683), - (e.reasonCodes.INVALID_EXT_AUTH_TYPE = 40684), - (e.reasonCodes.CUSTOM_ENTITY_INDEX_ERROR = 40685), - (e.reasonCodes.CUSTOM_ENTITY_UPDATE_FIELDS_ERROR = 40686), - (e.reasonCodes.INVALID_LOBBY_STEP_ALGOS = 40687), - (e.reasonCodes.INVALID_COMPOUND_RANGES = 40688), - (e.reasonCodes.MISSING_COMPOUND_RANGES = 40689), - (e.reasonCodes.MISSING_PING_DATA = 40690), - (e.reasonCodes.INVALID_PING_STEP_ALGO = 40691), - (e.reasonCodes.GROUP_NOT_FOUND = 40692), - (e.reasonCodes.SCRIPT_UPDATE_FAILED = 40693), - (e.reasonCodes.CUSTOM_ENTITY_REPLACE_ERROR = 40694), - (e.reasonCodes.CUSTOM_ENTITY_TYPE_IMPORT_ERROR = 40695), - (e.reasonCodes.CUSTOM_ENTITY_IMPORT_WARNING = 40696), - (e.reasonCodes.IDENTIFY_DORMANT_USERS_FOR_EXPORT_NOT_CONFIGURED = 40697), - (e.reasonCodes.IDENTIFY_DORMANT_USERS_FOR_EXPORT_ERROR = 40698), - (e.reasonCodes.UPDATE_SINGLETON_FAILED = 40699), - (e.reasonCodes.INVALID_STORE_ID = 40700), - (e.reasonCodes.METHOD_DEPRECATED = 40701), - (e.reasonCodes.INVALID_BILLING_PROVIDER_ID = 40702), - (e.reasonCodes.INVALID_STORE_DATA = 40703), - (e.reasonCodes.USER_FILE_MISSING = 40704), - (e.reasonCodes.GLOBAL_FILE_EXISTS = 40705), - (e.reasonCodes.INVALID_FILE_NAME = 40706), - (e.reasonCodes.FILE_TREE_VERSION_MISMATCH = 40707), - (e.reasonCodes.FILE_TREE_FOLDER_MISSING = 40708), - (e.reasonCodes.FOLDER_ALREADY_EXISTS = 40709), - (e.reasonCodes.INVALID_TREE_ID = 40710), - (e.reasonCodes.FILE_VERSION_MISMATCH = 40711), - (e.reasonCodes.INVALID_FOLDER_PATH = 40712), - (e.reasonCodes.FILENAME_MISMATCH = 40713), - (e.reasonCodes.FOLDERPATH_MISMATCH = 40714), - (e.reasonCodes.INVALID_CHARS_IN_STRING = 40715), - (e.reasonCodes.FOLDER_NOT_EMPTY = 40716), - (e.reasonCodes.INVALID_IMAGE_URL = 40717), - (e.reasonCodes.UNABLE_TO_UPDATE_PRICE = 40718), - (e.reasonCodes.UNABLE_TO_DELETE_PRICE = 40718), - (e.reasonCodes.WRONG_JOB_TYPE = 40719), - (e.reasonCodes.CLOUDCODE_JOB_NOT_RUNNING = 40720), - (e.reasonCodes.SCRIPT_HAS_DEPENDENCIES = 40721), - (e.reasonCodes.PEER_SERVICE_NOT_PUBLISHED = 40722), - (e.reasonCodes.MISSING_FOLDER_NAME = 40723), - (e.reasonCodes.UPLOLAD_IN_PROGRESS = 40724), - (e.reasonCodes.REFRESH_IN_PROGRESS = 40725), - (e.reasonCodes.REFRESH_INTERRUPTED = 40726), - (e.reasonCodes.GAMELIFT_ERROR = 40727), - (e.reasonCodes.GAMELIFT_LAUNCH_ERROR = 40728), - (e.reasonCodes.MAX_HOSTED_SERVERS_REACHED = 40729), - (e.reasonCodes.DUPLICATE_PACKET_ID = 40730), - (e.reasonCodes.FEATURE_NOT_SUPPORTED_BY_BILLING_PLAN = 40731), - (e.reasonCodes.NO_FRIENDS_FOUND = 40740), - (e.reasonCodes.PRODUCT_TRANSACTION_NOT_FOUND = 40741), - (e.reasonCodes.ITEM_DEF_NOT_FOUND = 40742), - (e.reasonCodes.ITEM_DEF_HAS_DEPENDENCIES = 40743), - (e.reasonCodes.TRANSFER_JOB_IDLE_TIMEOUT = 40744), - (e.reasonCodes.GROUP_MEMBER_ACL_MORE_RESTRICTIVE_THAN_OTHER = 40745), - (e.reasonCodes.GROUP_MEMBER_ACL_MUST_BE_READ_WRITE_FOR_UNOWNED_ENTITY = 40746), - (e.reasonCodes.GROUP_MEMBER_ACL_REQUIRED = 40747), - (e.reasonCodes.GROUP_TYPE_MAX_MEMBERS_EXCEEDED = 40748), - (e.reasonCodes.REQUEST_FAILED = 40801), - (e.reasonCodes.RESET_QUESTS_FAILED = 40802), - (e.reasonCodes.RESET_ALL_QUESTS_AND_MILESTONES_FAILED = 40803), - (e.reasonCodes.MILESTONE_NOT_FOUND = 40804), - (e.reasonCodes.MILESTONE_CREATE_ERROR = 40805), - (e.reasonCodes.MILESTONE_UPDATE_ERROR = 40806), - (e.reasonCodes.MILESTONE_DELETE_ERROR = 40807), - (e.reasonCodes.MILESTONE_VERSION_ERROR = 40808), - (e.reasonCodes.QUEST_NOT_FOUND = 40809), - (e.reasonCodes.QUEST_CREATE_ERROR = 40810), - (e.reasonCodes.QUEST_UPDATE_ERROR = 40811), - (e.reasonCodes.QUEST_DELETE_ERROR = 40812), - (e.reasonCodes.QUEST_VERSION_ERROR = 40813), - (e.reasonCodes.QUEST_ADD_MILESTONE_ERROR = 40814), - (e.reasonCodes.QUEST_DELETE_MILESTONE_ERROR = 40815), - (e.reasonCodes.QUEST_REORDER_MILESTONES_ERROR = 40816), - (e.reasonCodes.PROMOTION_NOT_FOUND = 40820), - (e.reasonCodes.VERSION_MISMATCH = 40821), - (e.reasonCodes.UNSUPPORTED_CRITERIA_FOR_SHARDED_COLLECTIONS = 40822), - (e.reasonCodes.STEAM_ERROR = 40830), - (e.reasonCodes.INVALID_LEADERBOARD_TOURNAMENT_SETTING = 40840), - (e.reasonCodes.LEADERBOARD_EDIT_TOURNAMENT_SETTINGS_ERROR = 40841), - (e.reasonCodes.LEADERBOARD_SCORES_EXIST = 40842), - (e.reasonCodes.TOURNAMENT_SCORES_EXIST = 40843), - (e.reasonCodes.LEADERBOARD_DBVERSION_MISMATCH = 40844), - (e.reasonCodes.LEADERBOARD_API_DOES_NOT_APPLY = 40845), - (e.reasonCodes.MISSING_CONFIG = 40900), - (e.reasonCodes.INVALID_SAML_RESP = 40901), - (e.reasonCodes.MISSING_PAGE_NAME = 40902), - (e.reasonCodes.INVALID_PAGE_NAME = 40903), - (e.reasonCodes.MALFORMED_RELAY_STATE = 40904), - (e.reasonCodes.INVALID_RESPONSE_ID = 40905), - (e.reasonCodes.LOGOUT_ERROR = 40906), - (e.reasonCodes.SCRIPT_EXISTS = 40907), - (e.reasonCodes.SCRIPT_DUPLICATE_EXISTS = 40908), - (e.reasonCodes.INVALID_UPLOAD_EXTENSION = 40909), - (e.reasonCodes.NO_TWITTER_CONSUMER_KEY = 500001), - (e.reasonCodes.NO_TWITTER_CONSUMER_SECRET = 500002), - (e.reasonCodes.INVALID_CONFIGURATION = 500003), - (e.reasonCodes.ERROR_GETTING_REQUEST_TOKEN = 500004), - (e.reasonCodes.ERROR_GETTING_ACCESS_TOKEN = 500005), - (e.reasonCodes.TWITTER_AUTH_ERROR = 500006), - (e.reasonCodes.TWITTER_ERROR = 500007), - (e.reasonCodes.FACEBOOK_ERROR = 500010), - (e.reasonCodes.FACEBOOK_SECRET_MISMATCH = 500011), - (e.reasonCodes.FACEBOOK_AUTHENTICATION_ERROR = 500012), - (e.reasonCodes.FACEBOOK_APPLICATION_TOKEN_REQUEST_ERROR = 500013), - (e.reasonCodes.FACEBOOK_BAD_APPLICATION_TOKEN_SIGNATURE = 500014), - (e.reasonCodes.UNSUPPORTED_SOCIAL_PLATFORM_CODE = 500020), - (e.reasonCodes.NOT_TEAM_ADMIN = 55e4), - (e.reasonCodes.NO_TEAM_ACCESS = 550001), - (e.reasonCodes.MISSING_COMPANY_RECORD = 550002), - (e.reasonCodes.TEAM_MEMBER_NOT_FOUND = 550003), - (e.reasonCodes.TEAM_MEMBER_NOT_ENABLED = 550004), - (e.reasonCodes.TEAM_MEMBER_NOT_ACTIVE = 550005), - (e.reasonCodes.TEAM_MEMBER_LOCKED = 550006), - (e.reasonCodes.INVALID_PASSWORD = 550007), - (e.reasonCodes.TOKEN_INVALID = 550008), - (e.reasonCodes.TOKEN_EXPIRED = 550009), - (e.reasonCodes.APP_NOT_FOUND = 550010), - (e.reasonCodes.TEMPLATE_GAME_NOT_FOUND = 550011), - (e.reasonCodes.INVALID_TEMPLATE_GAME_TEAM = 550012), - (e.reasonCodes.BASIC_AUTH_FAILURE = 550013), - (e.reasonCodes.EMAIL_MISMATCH = 550014), - (e.reasonCodes.EMAIL_ID_NOT_FOUND = 550015), - (e.reasonCodes.MONGO_DB_EXCEPTION = 600001), - (e.reasonCodes.CONCURRENT_LOCK_ERROR = 600002), - (e.reasonCodes.USER_EXPORT_ERROR = 600003), - (e.reasonCodes.POST_SCORE_ON_BEHALF_OF_ERROR = 600004), - (e.reasonCodes.INVALID_USER_STATUS = 600005), - (e.reasonCodes.SLACK_WEBHOOK_SEND_ERROR = 600006), - (e.reasonCodes.SLACK_NOT_ENABLED_FOR_APP = 600007), - (e.reasonCodes.ERROR_AQUIRING_LOBBY_LOCK = 600008), - (e.reasonCodes.ERROR_SETTING_NEW_LOBBY_OWNER = 600009), - (e.reasonCodes.ERROR_SWITCHING_TEAMS = 600010), - (e.reasonCodes.DEPLOY_FAILED = 600011), - (e.reasonCodes.BUILDER_API_KEY_NOT_FOUND = 60100), - (e.reasonCodes.BUILDER_API_INVALID_KEY_SCOPE = 60101), - (e.reasonCodes.BUILDER_API_UPDATED_AT_MISMATCH = 60102), - (e.reasonCodes.BUILDER_API_TEAM_NAME_MISMATCH = 60103), - (e.reasonCodes.BUILDER_API_TEAM_HAS_APPS = 60104), - (e.reasonCodes.BUILDER_API_UNEXPECTED_EXCEPTION = 60105), - (e.reasonCodes.BUILDER_API_PARTIAL_TEAM_DELETION = 60106), - (e.reasonCodes.BUILDER_API_APP_DELETED = 60107), - (e.reasonCodes.BUILDER_API_APP_DISABLED = 60108), - (e.reasonCodes.BUILDER_API_APP_IS_LIVE = 60109), - (e.reasonCodes.BUILDER_API_APP_SUSPENDED = 60110), - (e.reasonCodes.BUILDER_API_CREATED_AT_MISMATCH = 60111), - (e.reasonCodes.PLAYSTATION_NETWORK_ERROR = 60200), - (e.reasonCodes.RTT_LEFT_BY_CHOICE = 8e4), - (e.reasonCodes.RTT_EVICTED = 80001), - (e.reasonCodes.RTT_LOST_CONNECTION = 80002), - (e.reasonCodes.RTT_TIMEOUT = 80100), - (e.reasonCodes.RTT_ROOM_READY = 80101), - (e.reasonCodes.RTT_ROOM_CANCELLED = 80102), - (e.reasonCodes.RTT_ERROR_ASSIGNING_ROOM = 80103), - (e.reasonCodes.RTT_ERROR_LAUNCHING_ROOM = 80104), - (e.reasonCodes.RTT_BY_REQUEST = 80105), - (e.reasonCodes.RTT_NO_LOBBIES_FOUND = 80200), - (e.reasonCodes.RTT_FIND_REQUEST_CANCELLED = 80201), - (e.reasonCodes.CLIENT_NETWORK_ERROR_TIMEOUT = 90001), - (e.reasonCodes.CLIENT_UPLOAD_FILE_CANCELLED = 90100), - (e.reasonCodes.CLIENT_UPLOAD_FILE_TIMED_OUT = 90101), - (e.reasonCodes.CLIENT_UPLOAD_FILE_UNKNOWN = 90102), - (e.reasonCodes.CLIENT_DISABLED = 90200)); - } - function F() { - var e = this; - ((e.redemptionCode = {}), - (e.SERVICE_REDEMPTION_CODE = "redemptionCode"), - (e.redemptionCode.OPERATION_REDEEM_CODE = "REDEEM_CODE"), - (e.redemptionCode.OPERATION_GET_REDEEMED_CODES = - "GET_REDEEMED_CODES"), - (e.redemptionCode.redeemCode = function (t, a, i, n) { - var s = { scanCode: t, codeType: a }; - (i && (s.customRedemptionInfo = i), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_REDEMPTION_CODE, - operation: e.redemptionCode.OPERATION_REDEEM_CODE, - data: s, - callback: n, - })); - }), - (e.redemptionCode.getRedeemedCodes = function (t, a) { - var i = {}; - (t && (i.codeType = t), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_REDEMPTION_CODE, - operation: e.redemptionCode.OPERATION_GET_REDEEMED_CODES, - data: i, - callback: a, - })); - })); - } - function Y() { - var e = this; - ((e.relay = {}), - (e.SERVICE_RELAY = "relay"), - (e.relay.TO_ALL_PLAYERS = 0xffffffffff), - (e.relay.CHANNEL_HIGH_PRIORITY_1 = 0), - (e.relay.CHANNEL_HIGH_PRIORITY_2 = 1), - (e.relay.CHANNEL_NORMAL_PRIORITY = 2), - (e.relay.CHANNEL_LOW_PRIORITY = 3), - (e.relay.connect = function (t, a, i) { - e.brainCloudRelayComms.connect(t, a, i); - }), - (e.relay.disconnect = function () { - e.brainCloudRelayComms.disconnect(); - }), - (e.relay.isConnected = function () { - return e.brainCloudRelayComms.isConnected; - }), - (e.relay.getPing = function () { - return e.brainCloudRelayComms.ping; - }), - (e.relay.setPingInterval = function (t) { - e.brainCloudRelayComms.setPingInterval(t); - }), - (e.relay.getOwnerProfileId = function () { - return e.brainCloudRelayComms.getOwnerProfileId(); - }), - (e.relay.getOwnerCxId = function () { - return e.brainCloudRelayComms.getOwnerCxId(); - }), - (e.relay.getProfileIdForNetId = function (t) { - return e.brainCloudRelayComms.getProfileIdForNetId(t); - }), - (e.relay.getCxIdForNetId = function (t) { - return e.brainCloudRelayComms.getCxIdForNetId(t); - }), - (e.relay.getNetIdForProfileId = function (t) { - return e.brainCloudRelayComms.getNetIdForProfileId(t); - }), - (e.relay.getNetIdForCxId = function (t) { - return e.brainCloudRelayComms.getNetIdForCxId(t); - }), - (e.relay.registerRelayCallback = function (t) { - e.brainCloudRelayComms.registerRelayCallback(t); - }), - (e.relay.deregisterRelayCallback = function () { - e.brainCloudRelayComms.deregisterRelayCallback(); - }), - (e.relay.registerSystemCallback = function (t) { - e.brainCloudRelayComms.registerSystemCallback(t); - }), - (e.relay.deregisterSystemCallback = function () { - e.brainCloudRelayComms.deregisterSystemCallback(); - }), - (e.relay.send = function (t, a, i, n, s) { - if (a == e.relay.TO_ALL_PLAYERS) e.relay.sendToAll(t, i, n, s); + i.readAsArrayBuffer(e.data)); + } else a(e.data); + }), + (t.sendJson = function (e, a) { + t.sendText(e, JSON.stringify(a)); + }), + (t.sendText = function (e, a) { + var i = new Buffer(a.length + 3); + (i.writeUInt16BE(a.length + 3, 0), + i.writeUInt8(e, 2), + i.write(a, 3, a.length), + t.socket.send(i), + t._debugEnabled && console.log("RELAY SEND: " + a)); + }), + (t.sendRelay = function (e, a, i, n, s) { + if (t.isConnected) { + var o = 0; + (i && (o += t.RELIABLE_BIT), + n && (o += t.ORDERED_BIT), + (o += 4096 * s)); + for ( + var r = 0, + l = 1, + c = (a / 4294967296) & 4294967295, + d = 4294967295 & a, + u = 0; + u < 40; + ++u + ) { + var h = Math.pow(2, 40 - u - 1); + ((0 == (c & (l / 4294967296) & 4294967295) && + 0 == (4294967295 & d & l)) || + (r += h), + (l *= 2)); + } + var p = o, + g = 65535 & (c = ((256 * r) / 4294967296) & 65535), + m = ((d = (256 * r) & 4294967040) / 65536) & 65535, + f = 65535 & d; + (t._sendPacketId.hasOwnProperty(p) || (t._sendPacketId[p] = {}), + t._sendPacketId[p].hasOwnProperty(g) || + (t._sendPacketId[p][g] = {}), + t._sendPacketId[p][g].hasOwnProperty(m) || + (t._sendPacketId[p][g][m] = {}), + t._sendPacketId[p][g][m].hasOwnProperty(f) || + (t._sendPacketId[p][g][m][f] = 0)); + var y = t._sendPacketId[p][g][m][f]; + o += y; + var E = new Buffer(e.length + 11); + (E.writeUInt16BE(e.length + 11, 0), + E.writeUInt8(t.CL2RS_RELAY, 2), + E.writeUInt16BE(o, 3), + E.writeUInt16BE(g, 5), + E.writeUInt16BE(m, 7), + E.writeUInt16BE(f, 9), + E.set(e, 11), + t.socket.send(E), + (y = (y + 1) & 4095), + (t._sendPacketId[p][g][m][f] = y)); + } + }), + (t.sendPing = function () { + (t._debugEnabled && console.log("RELAY SEND PING: " + t.ping), + (t._pingInFlight = true), + (t._pingTime = new Date().getTime())); + var e = new Buffer(5); + (e.writeUInt16BE(5, 0), + e.writeUInt8(t.CL2RS_PING, 2), + e.writeUInt16BE(t.ping, 3), + t.socket.send(e)); + }), + (t.send = function (e, a) { + if ((e < MAX_PLAYERS && e >= 0) || e == bc.relay.TO_ALL_PLAYERS) + if (a.length > 1024) + t.connectCallback.failure && + t.connectCallback.failure( + "Relay Error: Packet too big " + a.length + " > max 1024", + ); else { - var o = Math.pow(2, a); - e.brainCloudRelayComms.sendRelay(t, o, i, n, s); + var i = new Buffer(a.length + 3); + (i.writeUInt16BE(a.length + 3, 0), + i.writeUInt8(e, 2), + i.set(a, 3), + t.socket.send(i)); } - }), - (e.relay.sendToPlayers = function (t, a, i, n, s) { - e.brainCloudRelayComms.sendRelay(t, a, i, n, s); - }), - (e.relay.sendToAll = function (t, a, i, n) { - var s = e.authentication.profileId, - o = e.relay.getNetIdForProfileId(s), - r = Math.pow(2, o), - l = e.relay.TO_ALL_PLAYERS - r; - e.brainCloudRelayComms.sendRelay(t, l, a, i, n); - })); - } - function U() { - var e = this; - ((e.rttService = {}), - (e.SERVICE_RTT = "rttRegistration"), - (e.rttService.OPERATION_REQUEST_CLIENT_CONNECTION = - "REQUEST_CLIENT_CONNECTION"), - (e.rttService.SERVICE_EVENT = "event"), - (e.rttService.SERVICE_CHAT = "chat"), - (e.rttService.SERVICE_LOBBY = "lobby"), - (e.rttService.SERVICE_MESSAGING = "messaging"), - (e.rttService.SERVICE_PRESENCE = "presence"), - (e.rttService.SERVICE_USER_ITEMS = "userItems"), - (e.rttService.enableRTT = function (t, a) { - e.brainCloudRttComms.enableRTT(t, a); - }), - (e.rttService.disableRTT = function () { - e.brainCloudRttComms.disableRTT(); - }), - (e.rttService.getRTTEnabled = function () { - return e.brainCloudRttComms.isRTTEnabled(); - }), - (e.rttService.isRTTEnabled = function () { - return e.brainCloudRttComms.isRTTEnabled(); - }), - (e.rttService.getConnectionStatus = function () { - return e.brainCloudRttComms.getConnectionStatus(); - }), - (e.rttService.getRTTConnectionId = function () { - return e.brainCloudRttComms.getRTTConnectionId(); - }), - (e.rttService.registerRTTEventCallback = function (t) { - e.brainCloudRttComms.registerRTTCallback( - e.rttService.SERVICE_EVENT, - t, - ); - }), - (e.rttService.deregisterRTTEventCallback = function () { - e.brainCloudRttComms.deregisterRTTCallback( - e.rttService.SERVICE_EVENT, - ); - }), - (e.rttService.registerRTTChatCallback = function (t) { - e.brainCloudRttComms.registerRTTCallback( - e.rttService.SERVICE_CHAT, - t, - ); - }), - (e.rttService.deregisterRTTChatCallback = function () { - e.brainCloudRttComms.deregisterRTTCallback( - e.rttService.SERVICE_CHAT, - ); - }), - (e.rttService.registerRTTMessagingCallback = function (t) { - e.brainCloudRttComms.registerRTTCallback( - e.rttService.SERVICE_MESSAGING, - t, - ); - }), - (e.rttService.deregisterRTTMessagingCallback = function () { - e.brainCloudRttComms.deregisterRTTCallback( - e.rttService.SERVICE_MESSAGING, - ); - }), - (e.rttService.registerRTTLobbyCallback = function (t) { - e.brainCloudRttComms.registerRTTCallback( - e.rttService.SERVICE_LOBBY, - t, - ); - }), - (e.rttService.deregisterRTTLobbyCallback = function () { - e.brainCloudRttComms.deregisterRTTCallback( - e.rttService.SERVICE_LOBBY, - ); - }), - (e.rttService.registerRTTPresenceCallback = function (t) { - e.brainCloudRttComms.registerRTTCallback( - e.rttService.SERVICE_PRESENCE, - t, - ); - }), - (e.rttService.deregisterRTTPresenceCallback = function () { - e.brainCloudRttComms.deregisterRTTCallback( - e.rttService.SERVICE_PRESENCE, - ); - }), - (e.rttService.registerRTTBlockchainRefresh = function (t) { - e.brainCloudRttComms.registerRTTCallback( - e.rttService.SERVICE_USER_INVENTORY_MANAGEMENT, - t, - ); - }), - (e.rttService.deregisterRTTBlockchainCallback = function () { - e.brainCloudRttComms.deregisterRTTCallback( - e.rttService.SERVICE_USER_INVENTORY_MANAGEMENT, - ); - }), - (e.rttService.deregisterAllRTTCallbacks = function () { - e.brainCloudRttComms.deregisterAllRTTCallbacks(); - }), - (e.rttService.requestClientConnection = function (t) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_RTT, - operation: e.rttService.OPERATION_REQUEST_CLIENT_CONNECTION, - data: {}, - callback: t, - }); - })); - } - function j() { - var e = this; - ((e.s3Handling = {}), - (e.SERVICE_S3HANDLING = "s3Handling"), - (e.s3Handling.OPERATION_GET_FILE_LIST = "GET_FILE_LIST"), - (e.s3Handling.OPERATION_GET_UPDATED_FILES = "GET_UPDATED_FILES"), - (e.s3Handling.OPERATION_GET_CDN_URL = "GET_CDN_URL"), - (e.s3Handling.getUpdatedFiles = function (t, a, i) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_S3HANDLING, - operation: e.s3Handling.OPERATION_GET_UPDATED_FILES, - data: { category: t, fileDetails: a }, - callback: i, - }); - }), - (e.s3Handling.getFileList = function (t, a) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_S3HANDLING, - operation: e.s3Handling.OPERATION_GET_FILE_LIST, - data: { category: t }, - callback: a, - }); - }), - (e.s3Handling.getCDNUrl = function (t, a) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_S3HANDLING, - operation: e.s3Handling.OPERATION_GET_CDN_URL, - data: { fileId: t }, - callback: a, - }); - })); - } - function G() { - var e = this; - ((e.script = {}), - (e.SERVICE_SCRIPT = "script"), - (e.script.OPERATION_RUN = "RUN"), - (e.script.OPERATION_SCHEDULE_CLOUD_SCRIPT = - "SCHEDULE_CLOUD_SCRIPT"), - (e.script.OPERATION_RUN_PARENT_SCRIPT = "RUN_PARENT_SCRIPT"), - (e.script.OPERATION_CANCEL_SCHEDULED_SCRIPT = - "CANCEL_SCHEDULED_SCRIPT"), - (e.script.OPERATION_GET_SCHEDULED_CLOUD_SCRIPTS = - "GET_SCHEDULED_CLOUD_SCRIPTS"), - (e.script.OPERATION_GET_RUNNING_OR_QUEUED_CLOUD_SCRIPTS = - "GET_RUNNING_OR_QUEUED_CLOUD_SCRIPTS"), - (e.script.OPERATION_RUN_PEER_SCRIPT = "RUN_PEER_SCRIPT"), - (e.script.OPERATION_RUN_PEER_SCRIPT_ASYNC = - "RUN_PEER_SCRIPT_ASYNC"), - (e.script.runScript = function (t, a, i) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_SCRIPT, - operation: e.script.OPERATION_RUN, - data: { scriptName: t, scriptData: a }, - callback: i, - }); - }), - (e.script.scheduleRunScriptUTC = function (t, a, i, n) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_SCRIPT, - operation: e.script.OPERATION_SCHEDULE_CLOUD_SCRIPT, - data: { - scriptName: t, - scriptData: a, - startDateUTC: i.getTime(), - }, - callback: n, - }); - }), - (e.script.scheduleRunScriptMillisUTC = function (t, a, i, n) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_SCRIPT, - operation: e.script.OPERATION_SCHEDULE_CLOUD_SCRIPT, - data: { scriptName: t, scriptData: a, startDateUTC: i }, - callback: n, - }); - }), - (e.script.scheduleRunScriptMinutes = function (t, a, i, n) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_SCRIPT, - operation: e.script.OPERATION_SCHEDULE_CLOUD_SCRIPT, - data: { scriptName: t, scriptData: a, minutesFromNow: i }, - callback: n, - }); - }), - (e.script.runParentScript = function (t, a, i, n) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_SCRIPT, - operation: e.script.OPERATION_RUN_PARENT_SCRIPT, - data: { scriptName: t, scriptData: a, parentLevel: i }, - callback: n, - }); - }), - (e.script.cancelScheduledScript = function (t, a) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_SCRIPT, - operation: e.script.OPERATION_CANCEL_SCHEDULED_SCRIPT, - data: { jobId: t }, - callback: a, - }); - }), - (e.script.getRunningOrQueuedCloudScripts = function (t) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_SCRIPT, - operation: - e.script.OPERATION_GET_RUNNING_OR_QUEUED_CLOUD_SCRIPTS, - callback: t, - }); - }), - (e.script.getScheduledCloudScripts = function (t, a) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_SCRIPT, - operation: e.script.OPERATION_GET_SCHEDULED_CLOUD_SCRIPTS, - data: { startDateUTC: t.getTime() }, - callback: a, - }); - }), - (e.script.runPeerScript = function (t, a, i, n) { - var s = { scriptName: t, peer: i }; - (a && (s.scriptData = a), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_SCRIPT, - operation: e.script.OPERATION_RUN_PEER_SCRIPT, - data: s, - callback: n, - })); - }), - (e.script.runPeerScriptAsync = function (t, a, i, n) { - var s = { scriptName: t, peer: i }; - (a && (s.scriptData = a), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_SCRIPT, - operation: e.script.OPERATION_RUN_PEER_SCRIPT_ASYNC, - data: s, - callback: n, - })); - })); - } - function V() { - var e = this; - ((e.socialLeaderboard = {}), - (e.SERVICE_LEADERBOARD = "leaderboard"), - (e.socialLeaderboard.OPERATION_POST_SCORE = "POST_SCORE"), - (e.socialLeaderboard.OPERATION_POST_SCORE_DYNAMIC = - "POST_SCORE_DYNAMIC"), - (e.socialLeaderboard.OPERATION_RESET = "RESET"), - (e.socialLeaderboard.OPERATION_GET_SOCIAL_LEADERBOARD = - "GET_SOCIAL_LEADERBOARD"), - (e.socialLeaderboard.OPERATION_GET_SOCIAL_LEADERBOARD_BY_VERSION = - "GET_SOCIAL_LEADERBOARD_BY_VERSION"), - (e.socialLeaderboard.OPERATION_GET_MULTI_SOCIAL_LEADERBOARD = - "GET_MULTI_SOCIAL_LEADERBOARD"), - (e.socialLeaderboard.OPERATION_GET_GLOBAL_LEADERBOARD_PAGE = - "GET_GLOBAL_LEADERBOARD_PAGE"), - (e.socialLeaderboard.OPERATION_GET_GLOBAL_LEADERBOARD_VIEW = - "GET_GLOBAL_LEADERBOARD_VIEW"), - (e.socialLeaderboard.OPERATION_GET_GLOBAL_LEADERBOARD_VERSIONS = - "GET_GLOBAL_LEADERBOARD_VERSIONS"), - (e.socialLeaderboard.OPERATION_GET_GROUP_SOCIAL_LEADERBOARD = - "GET_GROUP_SOCIAL_LEADERBOARD"), - (e.socialLeaderboard.OPERATION_GET_GROUP_SOCIAL_LEADERBOARD_BY_VERSION = - "GET_GROUP_SOCIAL_LEADERBOARD_BY_VERSION"), - (e.socialLeaderboard.OPERATION_GET_PLAYERS_SOCIAL_LEADERBOARD = - "GET_PLAYERS_SOCIAL_LEADERBOARD"), - (e.socialLeaderboard.OPERATION_GET_PLAYERS_SOCIAL_LEADERBOARD_BY_VERSION = - "GET_PLAYERS_SOCIAL_LEADERBOARD_BY_VERSION"), - (e.socialLeaderboard.OPERATION_LIST_ALL_LEADERBOARDS = - "LIST_ALL_LEADERBOARDS"), - (e.socialLeaderboard.OPERATION_GET_GLOBAL_LEADERBOARD_ENTRY_COUNT = - "GET_GLOBAL_LEADERBOARD_ENTRY_COUNT"), - (e.socialLeaderboard.OPERATION_REMOVE_PLAYER_SCORE = - "REMOVE_PLAYER_SCORE"), - (e.socialLeaderboard.OPERATION_GET_PLAYER_SCORE = - "GET_PLAYER_SCORE"), - (e.socialLeaderboard.OPERATION_GET_PLAYER_SCORES = - "GET_PLAYER_SCORES"), - (e.socialLeaderboard.OPERATION_GET_PLAYER_SCORES_FROM_LEADERBOARDS = - "GET_PLAYER_SCORES_FROM_LEADERBOARDS"), - (e.socialLeaderboard.OPERATION_POST_GROUP_SCORE = - "POST_GROUP_SCORE"), - (e.socialLeaderboard.OPERATION_REMOVE_GROUP_SCORE = - "REMOVE_GROUP_SCORE"), - (e.socialLeaderboard.OPERATION_GET_GROUP_LEADERBOARD_VIEW = - "GET_GROUP_LEADERBOARD_VIEW"), - (e.socialLeaderboard.OPERATION_GET_GROUP_LEADERBOARD_VIEW_BY_VERSION = - "GET_GROUP_LEADERBOARD_VIEW_BY_VERSION"), - (e.socialLeaderboard.OPERATION_POST_SCORE_TO_DYNAMIC_GROUP_LEADERBOARD = - "POST_GROUP_SCORE_DYNAMIC"), - (e.socialLeaderboard.leaderboardType = Object.freeze({ - HIGH_VALUE: "HIGH_VALUE", - CUMULATIVE: "CUMULATIVE", - LAST_VALUE: "LAST_VALUE", - LOW_VALUE: "LOW_VALUE", - })), - (e.socialLeaderboard.rotationType = Object.freeze({ - NEVER: "NEVER", - DAILY: "DAILY", - WEEKLY: "WEEKLY", - MONTHLY: "MONTHLY", - YEARLY: "YEARLY", - })), - (e.socialLeaderboard.fetchType = Object.freeze({ - HIGHEST_RANKED: "HIGHEST_RANKED", - })), - (e.socialLeaderboard.sortOrder = Object.freeze({ - HIGH_TO_LOW: "HIGH_TO_LOW", - LOW_TO_HIGH: "LOW_TO_HIGH", - })), - (e.socialLeaderboard.getGlobalLeaderboardPage = function ( - t, - a, - i, - n, - s, - ) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_LEADERBOARD, - operation: - e.socialLeaderboard.OPERATION_GET_GLOBAL_LEADERBOARD_PAGE, - data: { leaderboardId: t, sort: a, startIndex: i, endIndex: n }, - callback: s, - }); - }), - (e.socialLeaderboard.getGlobalLeaderboardPageByVersion = function ( - t, - a, - i, - n, - s, - o, - ) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_LEADERBOARD, - operation: - e.socialLeaderboard.OPERATION_GET_GLOBAL_LEADERBOARD_PAGE, - data: { - leaderboardId: t, - sort: a, - startIndex: i, - endIndex: n, - versionId: s, - }, - callback: o, - }); - }), - (e.socialLeaderboard.getGlobalLeaderboardView = function ( - t, - a, - i, - n, - s, - ) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_LEADERBOARD, - operation: - e.socialLeaderboard.OPERATION_GET_GLOBAL_LEADERBOARD_VIEW, + else + t.connectCallback.failure && + t.connectCallback.failure("Relay Error: Invalid NetId " + e); + }), + (t.onRecv = function (e) { + var a = e.readUInt16BE(0), + i = e.readUInt8(2); + if (i == t.RS2CL_RSMG) t.onRSMG(e); + else if (i == t.RS2CL_PONG) + (t._pingInFlight && + ((t._pingInFlight = false), + (t.ping = Math.min(999, new Date().getTime() - t._pingTime))), + t._debugEnabled && console.log("RELAY RECV PONG: " + t.ping)); + else if (i == t.RS2CL_ACK); + else if (i == t.RS2CL_RELAY) { + var n = e.readUInt8(10); + (t._debugEnabled && + console.log("RELAY RECV from netId: " + n + " size: " + a), + t._relayCallback && t._relayCallback(n, e.slice(11))); + } else + (t.disconnect(), + t.connectCallback.failure && + t.connectCallback.failure( + "Relay Recv Error: Unknown controlByte: " + i, + )); + }), + (t.onRSMG = function (a) { + var i = a.slice(5).toString("utf8"); + t._debugEnabled && console.log("RELAY RECV RSMG: " + i); + var n = JSON.parse(i); + switch (n.op) { + case "CONNECT": + ((t._netIdToCxId[n.netId] = n.cxId), + (t._cxIdToNetId[n.cxId] = n.netId), + n.cxId == e.rttService.getRTTConnectionId() && + (t.isConnected || + ((t._netId = n.netId), + (t._ownerCxId = n.ownerCxId), + (t.isConnected = true), + t.startPing(), + t.connectCallback.success && + t.connectCallback.success(n)))); + break; + case "NET_ID": + ((t._netIdToCxId[n.netId] = n.cxId), + (t._cxIdToNetId[n.cxId] = n.netId)); + break; + case "MIGRATE_OWNER": + t._ownerId = n.cxId; + } + t._systemCallback && t._systemCallback(n); + })); + } + var Q; + (s.apply((window.brainCloudManager = window.brainCloudManager || {})), + o.apply((window.brainCloudClient = window.brainCloudClient || {})), + r.apply((window.brainCloudClient = window.brainCloudClient || {})), + l.apply((window.brainCloudClient = window.brainCloudClient || {})), + ("undefined" != typeof window && null !== window) || (window = {}), + window.navigator || (window.navigator = {}), + window.navigator.userLanguage || + window.navigator.language || + (window.navigator.userLanguage = a(5781).Xu()), + c.apply((window.brainCloudClient = window.brainCloudClient || {})), + d.apply((window.brainCloudClient = window.brainCloudClient || {})), + u.apply((window.brainCloudClient = window.brainCloudClient || {})), + h.apply((window.brainCloudClient = window.brainCloudClient || {})), + p.apply((window.brainCloudClient = window.brainCloudClient || {})), + g.apply((window.brainCloudClient = window.brainCloudClient || {})), + ("undefined" != typeof window && null !== window) || (window = {}), + window.FormData || + ((window.FormData = a(6230)), (FormData = window.FormData)), + m.apply((window.brainCloudClient = window.brainCloudClient || {})), + f.apply((window.brainCloudClient = window.brainCloudClient || {})), + y.apply((window.brainCloudClient = window.brainCloudClient || {})), + E.apply((window.brainCloudClient = window.brainCloudClient || {})), + b.apply((window.brainCloudClient = window.brainCloudClient || {})), + S.apply((window.brainCloudClient = window.brainCloudClient || {})), + I.apply((window.brainCloudClient = window.brainCloudClient || {})), + _.apply((window.brainCloudClient = window.brainCloudClient || {})), + ("undefined" != typeof window && null !== window) || (window = {}), + window.navigator || (window.navigator = {}), + window.navigator.userLanguage || + window.navigator.language || + (window.navigator.userLanguage = a(5781).Xu()), + v.apply((window.brainCloudClient = window.brainCloudClient || {})), + T.apply((window.brainCloudClient = window.brainCloudClient || {})), + R.apply((window.brainCloudClient = window.brainCloudClient || {})), + O.apply((window.brainCloudClient = window.brainCloudClient || {})), + C.apply((window.brainCloudClient = window.brainCloudClient || {})), + w.apply((window.brainCloudClient = window.brainCloudClient || {})), + A.apply((window.brainCloudClient = window.brainCloudClient || {})), + k.apply((window.brainCloudClient = window.brainCloudClient || {})), + N.apply((window.brainCloudClient = window.brainCloudClient || {})), + x.apply((window.brainCloudClient = window.brainCloudClient || {})), + P.apply((window.brainCloudClient = window.brainCloudClient || {})), + M.apply((window.brainCloudClient = window.brainCloudClient || {})), + L.apply((window.brainCloudClient = window.brainCloudClient || {})), + D.apply((window.brainCloudClient = window.brainCloudClient || {})), + B.apply((window.brainCloudClient = window.brainCloudClient || {})), + F.apply((window.brainCloudClient = window.brainCloudClient || {})), + Y.apply((window.brainCloudClient = window.brainCloudClient || {})), + U.apply((window.brainCloudClient = window.brainCloudClient || {})), + j.apply((window.brainCloudClient = window.brainCloudClient || {})), + G.apply((window.brainCloudClient = window.brainCloudClient || {})), + V.apply((window.brainCloudClient = window.brainCloudClient || {})), + H.apply((window.brainCloudClient = window.brainCloudClient || {})), + X.apply((window.brainCloudClient = window.brainCloudClient || {})), + z.apply((window.brainCloudClient = window.brainCloudClient || {})), + W.apply((window.brainCloudClient = window.brainCloudClient || {})), + q.apply((window.brainCloudClient = window.brainCloudClient || {})), + $.apply((window.brainCloudClient = window.brainCloudClient || {})), + J.apply((window.brainCloudClient = window.brainCloudClient || {})), + K.apply( + (window.brainCloudRelayComms = window.brainCloudRelayComms || {}), + )); + var Z = false, + ee = null; + function te(e) { + var t = this; + ((t.RTTConnectionStatus = { + CONNECTED: "Connected", + DISCONNECTED: "Disconnected", + CONNECTING: "Connecting", + DISCONNECTING: "Disconnecting", + }), + (t.m_client = e), + (t.name = "BrainCloudRttComms"), + (t.socket = null), + (t.heartbeatId = null), + (t._rttConnectionStatus = t.RTTConnectionStatus.DISCONNECTED), + (t.auth = {}), + (t.callbacks = {}), + (t._debugEnabled = false), + (t.connectionId = null), + (t.setDebugEnabled = function (e) { + t._debugEnabled = e; + }), + (t.getRTTConnectionId = function () { + return t.connectionId; + }), + (t.getConnectionStatus = function () { + return t._rttConnectionStatus; + }), + (t.connect = function (e, a, i, n) { + ((t._rttConnectionStatus = t.RTTConnectionStatus.CONNECTING), + (t.auth = i)); + var s = (n ? "wss://" : "ws://") + e + ":" + a; + if (t.auth) { + s += "?"; + var o = 0; + for (var r in t.auth) + (o > 0 && (s += "&"), (s += r + "=" + t.auth[r]), ++o); + } + ((t.socket = new WebSocket(s)), + t.socket.addEventListener("error", t.onSocketError), + t.socket.addEventListener("close", t.onSocketClose), + t.socket.addEventListener("open", t.onSocketOpen), + t.socket.addEventListener("message", t.onSocketMessage)); + }), + (t.onSocketError = function (e) { + (t.isRTTEnabled() && t.connectCallback.failure("error"), + t.disableRTT()); + }), + (t.onSocketClose = function (e) { + (t.isRTTEnabled() && t.connectCallback.failure("close"), + t.disableRTT(), + 1 == Z && console.log("RTT:Disconnect" + JSON.stringify(ee))); + }), + (t.onSocketOpen = function (e) { + if (t.isRTTEnabled()) { + console.log("WebSocket connection established"); + var a = { + operation: "CONNECT", + service: "rtt", data: { - leaderboardId: t, - sort: a, - beforeCount: i, - afterCount: n, + appId: t.brainCloudClient.getAppId(), + profileId: t.brainCloudClient.getProfileId(), + sessionId: t.brainCloudClient.getSessionId(), + system: { protocol: "ws", platform: "WEB" }, }, - callback: s, - }); - }), - (e.socialLeaderboard.getGlobalLeaderboardViewByVersion = function ( - t, - a, - i, - n, - s, - o, - ) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_LEADERBOARD, - operation: - e.socialLeaderboard.OPERATION_GET_GLOBAL_LEADERBOARD_VIEW, - data: { - leaderboardId: t, - sort: a, - beforeCount: i, - afterCount: n, - versionId: s, + }, + i = + ((n = + (!!window.opr && !!opr.addons) || + !!window.opera || + ("undefined" != typeof navigator && + navigator.userAgent.indexOf(" OPR/") >= 0)), + (s = "undefined" != typeof InstallTrigger), + (o = + /constructor/i.test(window.HTMLElement) || + "[object SafariRemoteNotification]" === + ( + !window.safari || + ("undefined" != typeof safari && + safari.pushNotification) + ).toString()), + (l = + !(r = + "undefined" != typeof document && + !!document.documentMode) && !!window.StyleMedia), + (d = + ((c = !!window.chrome && !!window.chrome.webstore) || + n) && + !!window.CSS), + n + ? "opera" + : s + ? "firefox" + : o + ? "safari" + : r + ? "ie" + : l + ? "edge" + : c + ? "chrome" + : d + ? "blink" + : null); + (i && (a.data.system.browser = i), + (a.data.auth = t.auth), + t._debugEnabled && + console.log("WS SEND: " + JSON.stringify(a)), + t.socket.send(JSON.stringify(a))); + } + var n, s, o, r, l, c, d; + }), + (t.onSocketMessage = function (e) { + if (t.isRTTEnabled()) { + var a = function (e) { + "rtt" == e.service + ? (t._debugEnabled && + console.log("WS RECV: " + JSON.stringify(e)), + "CONNECT" == e.operation + ? ((t.connectionId = e.data.cxId), + (Q = e.data.heartbeatSeconds), + t.startHeartbeat(), + t.connectCallback.success(e)) + : "DISCONNECT" == e.operation && + ((Z = true), + (ee = { + severity: "ERROR", + reason: e.data.reason, + reasonCode: e.data.reasonCode, + data: null, + }))) + : t.onRecv(e); + }; + if ("string" == typeof e.data) a(e.data); + else if ("undefined" != typeof FileReader) { + var i = new FileReader(); + ((i.onload = function () { + var e = {}; + try { + e = JSON.parse(i.result); + } catch (t) { + (console.log("WS RECV: " + i.result), + (e = JSON.parse(i.result))); + } + a(e); + }), + i.readAsText(e.data)); + } else { + var n = {}; + try { + n = JSON.parse(e.data); + } catch (e) { + (console.log("WS RECV: " + e.data), + (n = JSON.parse(e.data))); + } + a(n); + } + } + }), + (t.startHeartbeat = function () { + t.heartbeatId || + (t.heartbeatId = setInterval(function () { + var e = { + operation: "HEARTBEAT", + service: "rtt", + data: null, + }; + (t._debugEnabled && + console.log("WS SEND: " + JSON.stringify(e)), + t.socket.send(JSON.stringify(e))); + }, 1000 * Q)); + }), + (t.onRecv = function (e) { + (t._debugEnabled && console.log("WS RECV: " + JSON.stringify(e)), + t.callbacks[e.service] && t.callbacks[e.service](e)); + }), + (t.enableRTT = function (a, i) { + ((Z = false), + t.isRTTEnabled() || + t._rttConnectionStatus == t.RTTConnectionStatus.CONNECTING || + ((t.connectCallback = { success: a, failure: i }), + (t._rttConnectionStatus = t.RTTConnectionStatus.CONNECTING), + e.rttService.requestClientConnection(function (e) { + if ((t._debugEnabled && console.log(e), 200 == e.status)) { + for (var a = 0; a < e.data.endpoints.length; ++a) { + var i = e.data.endpoints[a]; + if ("ws" === i.protocol) + return ( + t.connect(i.host, i.port, e.data.auth, i.ssl), + void (t._rttConnectionStatus = + t.RTTConnectionStatus.CONNECTED) + ); + } + ((e.status = 0), + (e.status_message = "WebSocket endpoint missing"), + (t._rttConnectionStatus = + t.RTTConnectionStatus.DISCONNECTED), + t.connectCallback.failure(e)); + } else + ((t._rttConnectionStatus = + t.RTTConnectionStatus.DISCONNECTED), + t.connectCallback.failure(e)); + }))); + }), + (t.disableRTT = function () { + t.isRTTEnabled() && + t._rttConnectionStatus != t.RTTConnectionStatus.DISCONNECTING && + ((t._rttConnectionStatus = t.RTTConnectionStatus.DISCONNECTING), + t.heartbeatId && + (clearInterval(t.heartbeatId), (t.heartbeatId = null)), + t.socket && + (t.socket.removeEventListener("error", t.onSocketError), + t.socket.removeEventListener("close", t.onSocketClose), + t.socket.removeEventListener("open", t.onSocketOpen), + t.socket.removeEventListener("message", t.onSocketMessage), + t.socket.close(), + (t.socket = null)), + (t._rttConnectionStatus = t.RTTConnectionStatus.DISCONNECTED)); + }), + (t.isRTTEnabled = function () { + return t._rttConnectionStatus == t.RTTConnectionStatus.CONNECTED; + }), + (t.registerRTTCallback = function (e, a) { + t.callbacks[e] = a; + }), + (t.deregisterRTTCallback = function (e) { + t.callbacks[e] = null; + }), + (t.deregisterAllRTTCallbacks = function () { + t.callbacks = {}; + })); + } + te.apply((window.brainCloudRttComms = window.brainCloudRttComms || {})); + var ae = null; + function ie(e) { + var t = this; + ((t.name = "BrainCloudWrapper"), + window.brainCloudWrapper !== t + ? ((t.brainCloudClient = new J(e)), + (t.abtests = t.brainCloudClient.abtests), + (t.asyncMatch = t.brainCloudClient.asyncMatch), + (t.chat = t.brainCloudClient.chat), + (t.dataStream = t.brainCloudClient.dataStream), + (t.entity = t.brainCloudClient.entity), + (t.event = t.brainCloudClient.event), + (t.file = t.brainCloudClient.file), + (t.friend = t.brainCloudClient.friend), + (t.gamification = t.brainCloudClient.gamification), + (t.globalApp = t.brainCloudClient.globalApp), + (t.globalStatistics = t.brainCloudClient.globalStatistics), + (t.globalEntity = t.brainCloudClient.globalEntity), + (t.group = t.brainCloudClient.group), + (t.identity = t.brainCloudClient.identity), + (t.lobby = t.brainCloudClient.lobby), + (t.mail = t.brainCloudClient.mail), + (t.matchMaking = t.brainCloudClient.matchMaking), + (t.messaging = t.brainCloudClient.messaging), + (t.oneWayMatch = t.brainCloudClient.oneWayMatch), + (t.playbackStream = t.brainCloudClient.playbackStream), + (t.playerState = t.brainCloudClient.playerState), + (t.playerStatistics = t.brainCloudClient.playerStatistics), + (t.playerStatisticsEvent = + t.brainCloudClient.playerStatisticsEvent), + (t.presence = t.brainCloudClient.presence), + (t.virtualCurrency = t.brainCloudClient.virtualCurrency), + (t.appStore = t.brainCloudClient.appStore), + (t.profanity = t.brainCloudClient.profanity), + (t.pushNotification = t.brainCloudClient.pushNotification), + (t.reasonCodes = t.brainCloudClient.reasonCodes), + (t.redemptionCode = t.brainCloudClient.redemptionCode), + (t.relay = t.brainCloudClient.relay), + (t.rttService = t.brainCloudClient.rttService), + (t.s3Handling = t.brainCloudClient.s3Handling), + (t.script = t.brainCloudClient.script), + (t.socialLeaderboard = t.brainCloudClient.socialLeaderboard), + (t.leaderboard = t.socialLeaderboard), + (t.statusCodes = t.brainCloudClient.statusCodes), + (t.time = t.brainCloudClient.time), + (t.tournament = t.brainCloudClient.tournament), + (t.globalFile = t.brainCloudClient.globalFile), + (t.itemCatalog = t.brainCloudClient.itemCatalog), + (t.userItems = t.brainCloudClient.userItems), + (t.customEntity = t.brainCloudClient.customEntity), + (t.timeUtils = t.brainCloudClient.timeUtils), + (t.brainCloudManager = t.brainCloudClient.brainCloudManager = + t.brainCloudClient.brainCloudManager || {})) + : ((t.brainCloudManager = window.brainCloudManager = + window.brainCloudManager || {}), + (t.brainCloudClient = window.brainCloudClient = + window.brainCloudClient || {})), + (t.wrapperName = void 0 === e ? "" : e), + (t._alwaysAllowProfileSwitch = true), + (t._initializeIdentity = function (e) { + var a = t.getStoredProfileId(), + i = t.getStoredAnonymousId(); + (null == a && (a = ""), + null == i && (i = ""), + ("" != i && "" != a) || + ((i = + t.brainCloudClient.authentication.generateAnonymousId()), + (a = ""), + t.setStoredAnonymousId(i), + t.setStoredProfileId(a))); + var n = a; + (!e && t._alwaysAllowProfileSwitch && (n = ""), + t.brainCloudClient.initializeIdentity(n, i)); + }), + (t._authResponseHandler = function (e) { + if (200 == e.status) { + var a = e.data.profileId; + t.setStoredProfileId(a); + var i = e.data.sessionId; + t.setStoredSessionId(i); + } + console.log("Updated saved profileId to " + a); + }), + (t.initialize = function (e, a, i) { + t.brainCloudClient.initialize(e, a, i); + }), + (t.initializeWithApps = function (e, a, i) { + t.brainCloudClient.initializeWithApps(e, a, i); + }), + (t.getStoredAnonymousId = function () { + var t = "" === e ? "" : e + "."; + return localStorage.getItem(t + "anonymousId"); + }), + (t.setStoredAnonymousId = function (t) { + var a = "" === e ? "" : e + "."; + localStorage.setItem(a + "anonymousId", t); + }), + (t.resetStoredAnonymousId = function () { + t.setStoredAnonymousId(""); + }), + (t.getStoredProfileId = function () { + var t = "" === e ? "" : e + "."; + return localStorage.getItem(t + "profileId"); + }), + (t.setStoredProfileId = function (t) { + var a = "" === e ? "" : e + "."; + localStorage.setItem(a + "profileId", t); + }), + (t.resetStoredProfileId = function () { + t.setStoredProfileId(""); + }), + (t.getStoredSessionId = function () { + var t = "" === e ? "" : e + "."; + return localStorage.getItem(t + "sessionId"); + }), + (t.setStoredSessionId = function (t) { + var a = "" === e ? "" : e + "."; + localStorage.setItem(a + "sessionId", t); + }), + (t.resetStoredSessionId = function () { + t.setStoredSessionId(""); + }), + (t.getAlwaysAllowProfileSwitch = function () { + return t._alwaysAllowProfileSwitch; + }), + (t.setAlwaysAllowProfileSwitch = function (e) { + t._alwaysAllowProfileSwitch = e; + }), + (t.authenticateAnonymous = function (e) { + (t._initializeIdentity(true), + t.brainCloudClient.authentication.authenticateAnonymous( + true, + function (a) { + (t._authResponseHandler(a), e(a)); }, - callback: o, - }); - }), - (e.socialLeaderboard.getGlobalLeaderboardEntryCount = function ( - t, - a, - ) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_LEADERBOARD, - operation: - e.socialLeaderboard - .OPERATION_GET_GLOBAL_LEADERBOARD_ENTRY_COUNT, - data: { leaderboardId: t }, - callback: a, - }); - }), - (e.socialLeaderboard.getGlobalLeaderboardEntryCountByVersion = - function (t, a, i) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_LEADERBOARD, - operation: - e.socialLeaderboard - .OPERATION_GET_GLOBAL_LEADERBOARD_ENTRY_COUNT, - data: { leaderboardId: t, versionId: a }, - callback: i, - }); - }), - (e.socialLeaderboard.getSocialLeaderboard = function (t, a, i) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_LEADERBOARD, - operation: e.socialLeaderboard.OPERATION_GET_SOCIAL_LEADERBOARD, - data: { leaderboardId: t, replaceName: a }, - callback: i, - }); - }), - (e.socialLeaderboard.getSocialLeaderboardByVersion = function ( - t, - a, - i, - n, - ) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_LEADERBOARD, - operation: - e.socialLeaderboard - .OPERATION_GET_SOCIAL_LEADERBOARD_BY_VERSION, - data: { leaderboardId: t, replaceName: a, versionId: i }, - callback: n, - }); - }), - (e.socialLeaderboard.getMultiSocialLeaderboard = function ( - t, - a, - i, - n, - ) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_LEADERBOARD, - operation: - e.socialLeaderboard.OPERATION_GET_MULTI_SOCIAL_LEADERBOARD, - data: { - leaderboardIds: t, - leaderboardResultCount: a, - replaceName: i, + )); + }), + (t.authenticateEmailPassword = function (e, a, i, n) { + (t._initializeIdentity(false), + t.brainCloudClient.authentication.authenticateEmailPassword( + e, + a, + i, + function (e) { + (t._authResponseHandler(e), n(e)); }, - callback: n, - }); - }), - (e.socialLeaderboard.getGlobalLeaderboardVersions = function ( - t, - a, - ) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_LEADERBOARD, - operation: - e.socialLeaderboard.OPERATION_GET_GLOBAL_LEADERBOARD_VERSIONS, - data: { leaderboardId: t }, - callback: a, - }); - }), - (e.socialLeaderboard.postScoreToLeaderboard = function ( - t, - a, - i, - n, - ) { - var s = { leaderboardId: t, score: a }; - (i && (s.data = i), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_LEADERBOARD, - operation: e.socialLeaderboard.OPERATION_POST_SCORE, - data: s, - callback: n, - })); - }), - (e.socialLeaderboard.postScoreToDynamicLeaderboard = function ( - t, - a, - i, - n, - s, - o, - r, - l, - ) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_LEADERBOARD, - operation: e.socialLeaderboard.OPERATION_POST_SCORE_DYNAMIC, - data: { - leaderboardId: t, - score: a, - data: i, - leaderboardType: n, - rotationType: s, - rotationResetTime: o.getTime().toFixed(0), - retainedCount: r, + )); + }), + (t.authenticateExternal = function (e, a, i, n, s) { + (t._initializeIdentity(false), + t.brainCloudClient.authentication.authenticateExternal( + e, + a, + i, + n, + function (e) { + (t._authResponseHandler(e), s(e)); }, - callback: l, - }); - }), - (e.socialLeaderboard.postScoreToDynamicLeaderboardUTC = function ( - t, - a, - i, - n, - s, - o, - r, - l, - ) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_LEADERBOARD, - operation: e.socialLeaderboard.OPERATION_POST_SCORE_DYNAMIC, - data: { - leaderboardId: t, - score: a, - data: i, - leaderboardType: n, - rotationType: s, - rotationResetTime: o.getTime().toFixed(0), - retainedCount: r, + )); + }), + (t.authenticateFacebook = function (e, a, i, n) { + (t._initializeIdentity(false), + t.brainCloudClient.authentication.authenticateFacebook( + e, + a, + i, + function (e) { + (t._authResponseHandler(e), n(e)); }, - callback: l, - }); - }), - (e.socialLeaderboard.postScoreToDynamicLeaderboardDays = function ( - t, - a, - i, - n, - s, - o, - r, - l, - ) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_LEADERBOARD, - operation: e.socialLeaderboard.OPERATION_POST_SCORE_DYNAMIC, - data: { - leaderboardId: t, - score: a, - data: i, - leaderboardType: n, - rotationType: "DAYS", - rotationResetTime: s.getTime().toFixed(0), - retainedCount: o, - numDaysToRotate: r, + )); + }), + (t.authenticateFacebookLimited = function (e, a, i, n) { + (t._initializeIdentity(false), + t.brainCloudClient.authentication.authenticateFacebookLimited( + e, + a, + i, + function (e) { + (t._authResponseHandler(e), n(e)); }, - callback: l, - }); - }), - (e.socialLeaderboard.postScoreToDynamicLeaderboardDaysUTC = - function (t, a, i, n, s, o, r, l) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_LEADERBOARD, - operation: e.socialLeaderboard.OPERATION_POST_SCORE_DYNAMIC, - data: { - leaderboardId: t, - score: a, - data: i, - leaderboardType: n, - rotationType: "DAYS", - rotationResetTime: s.getTime().toFixed(0), - retainedCount: o, - numDaysToRotate: r, - }, - callback: l, - }); - }), - (e.socialLeaderboard.postScoreToDynamicGroupLeaderboardDaysUTC = - function (t, a, i, n, s, o, r, l, c) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_LEADERBOARD, - operation: - e.socialLeaderboard - .OPERATION_POST_SCORE_TO_DYNAMIC_GROUP_LEADERBOARD, - data: { - leaderboardId: t, - groupId: a, - score: i, - data: n, - leaderboardType: s, - rotationType: "DAYS", - rotationResetTime: o.getTime().toFixed(0), - retainedCount: r, - numDaysToRotate: l, + )); + }), + (t.authenticateGameCenter = function (e, a, i) { + (t._initializeIdentity(false), + t.brainCloudClient.authentication.authenticateGameCenter( + e, + a, + function (e) { + (t._authResponseHandler(e), i(e)); + }, + )); + }), + (t.authenticateApple = function (e, a, i, n) { + (t._initializeIdentity(false), + t.brainCloudClient.authentication.authenticateApple( + e, + a, + i, + function (e) { + (t._authResponseHandler(e), n(e)); + }, + )); + }), + (t.authenticateUltra = function (e, a, i, n) { + (t._initializeIdentity(false), + t.brainCloudClient.authentication.authenticateUltra( + e, + a, + i, + function (e) { + (t._authResponseHandler(e), n(e)); + }, + )); + }), + (t.authenticateGoogle = function (e, a, i, n) { + (t._initializeIdentity(false), + t.brainCloudClient.authentication.authenticateGoogle( + e, + a, + i, + function (e) { + (t._authResponseHandler(e), n(e)); + }, + )); + }), + (t.authenticateGoogleOpenId = function (e, a, i, n) { + (t._initializeIdentity(false), + t.brainCloudClient.authentication.authenticateGoogleOpenId( + e, + a, + i, + function (e) { + (t._authResponseHandler(e), n(e)); + }, + )); + }), + (t.authenticateSteam = function (e, a, i, n) { + (t._initializeIdentity(false), + t.brainCloudClient.authentication.authenticateSteam( + e, + a, + i, + function (e) { + (t._authResponseHandler(e), n(e)); + }, + )); + }), + (t.authenticateTwitter = function (e, a, i, n, s) { + (t._initializeIdentity(false), + t.brainCloudClient.authentication.authenticateTwitter( + e, + a, + i, + n, + function (e) { + (t._authResponseHandler(e), s(e)); + }, + )); + }), + (t.authenticateUniversal = function (e, a, i, n) { + (t._initializeIdentity(false), + t.brainCloudClient.authentication.authenticateUniversal( + e, + a, + i, + function (e) { + (t._authResponseHandler(e), n(e)); + }, + )); + }), + (t.authenticateAdvanced = function (e, a, i, n, s) { + (t._initializeIdentity(false), + t.brainCloudClient.authentication.authenticateAdvanced( + e, + a, + i, + n, + function (e) { + (t._authResponseHandler(e), s(e)); + }, + )); + }), + (t.authenticateHandoff = function (e, a, i) { + t.brainCloudClient.authentication.authenticateHandoff( + e, + a, + bc.authentication.AUTHENTICATION_TYPE_HANDOFF, + null, + false, + i, + ); + }), + (t.authenticateSettopHandoff = function (e, a) { + t.brainCloudClient.authentication.authenticateSettopHandoff( + e, + "", + bc.authentication.AUTHENTICATION_TYPE_SETTOP_HANDOFF, + null, + false, + a, + ); + }), + (t.smartSwitchAuthenticateEmailPassword = function (e, a, i, n) { + (t._initializeIdentity(false), + (authenticationCallback = function () { + t.brainCloudClient.authentication.authenticateEmailPassword( + e, + a, + i, + function (e) { + (t._authResponseHandler(e), n(e)); }, - callback: c, - }); + ); }), - (e.socialLeaderboard.getGroupSocialLeaderboard = function ( - t, + t.brainCloudClient.identity.getIdentities( + ae(authenticationCallback), + )); + }), + (t.smartSwitchAuthenticateExternal = function (e, a, i, n, s) { + (t._initializeIdentity(false), + (authenticationCallback = function () { + t.brainCloudClient.authentication.authenticateExternal( + e, + a, + n, + function (e) { + (t._authResponseHandler(e), s(e)); + }, + ); + }), + t.brainCloudClient.identity.getIdentities( + ae(authenticationCallback), + )); + }), + (t.smartSwitchAuthenticateFacebook = function (e, a, i, n) { + (t._initializeIdentity(false), + (authenticationCallback = function () { + t.brainCloudClient.authentication.authenticateFacebook( + e, + a, + i, + function (e) { + (t._authResponseHandler(e), n(e)); + }, + ); + }), + t.brainCloudClient.identity.getIdentities( + ae(authenticationCallback), + )); + }), + (t.smartSwitchAuthenticateFacebookLimited = function (e, a, i, n) { + (t._initializeIdentity(false), + (authenticationCallback = function () { + t.brainCloudClient.authentication.authenticateFacebookLimited( + e, + a, + i, + function (e) { + (t._authResponseHandler(e), n(e)); + }, + ); + }), + t.brainCloudClient.identity.getIdentities( + ae(authenticationCallback), + )); + }), + (t.smartSwitchAuthenticateGameCenter = function (e, a, i) { + (t._initializeIdentity(false), + (authenticationCallback = function () { + t.brainCloudClient.authentication.authenticateGameCenter( + e, + a, + function (e) { + (t._authResponseHandler(e), i(e)); + }, + ); + }), + t.brainCloudClient.identity.getIdentities( + ae(authenticationCallback), + )); + }), + (t.smartSwitchAuthenticateGoogle = function (e, a, i, n) { + (t._initializeIdentity(false), + (authenticationCallback = function () { + t.brainCloudClient.authentication.authenticateGoogle( + e, + a, + i, + function (e) { + (t._authResponseHandler(e), n(e)); + }, + ); + }), + t.brainCloudClient.identity.getIdentities( + ae(authenticationCallback), + )); + }), + (t.smartSwitchAuthenticateUltra = function (e, a, i, n) { + (t._initializeIdentity(false), + (authenticationCallback = function () { + t.brainCloudClient.authentication.authenticateUltra( + e, + a, + i, + function (e) { + (t._authResponseHandler(e), n(e)); + }, + ); + }), + t.brainCloudClient.identity.getIdentities( + ae(authenticationCallback), + )); + }), + (t.smartSwitchAuthenticateSteam = function (e, a, i, n) { + (t._initializeIdentity(false), + (authenticationCallback = function () { + t.brainCloudClient.authentication.authenticateSteam( + e, + a, + i, + function (e) { + (t._authResponseHandler(e), n(e)); + }, + ); + }), + t.brainCloudClient.identity.getIdentities( + ae(authenticationCallback), + )); + }), + (t.smartSwitchAuthenticateTwitter = function (e, a, i, n, s) { + (t._initializeIdentity(false), + (authenticationCallback = function () { + t.brainCloudClient.authentication.authenticateTwitter( + e, + a, + i, + n, + function (e) { + (t._authResponseHandler(e), s(e)); + }, + ); + }), + t.brainCloudClient.identity.getIdentities( + ae(authenticationCallback), + )); + }), + (t.smartSwitchAuthenticateUniversal = function (e, a, i, n) { + (t._initializeIdentity(false), + (authenticationCallback = function () { + t.brainCloudClient.authentication.authenticateUniversal( + e, + a, + i, + function (e) { + (t._authResponseHandler(e), n(e)); + }, + ); + }), + t.brainCloudClient.identity.getIdentities( + ae(authenticationCallback), + )); + }), + (t.smartSwitchAuthenticateAdvanced = function (e, a, i, n, s) { + (t._initializeIdentity(false), + (authenticationCallback = function () { + t.brainCloudClient.authentication.authenticateAdvanced( + e, + a, + i, + n, + function (e) { + (t._authResponseHandler(e), s(e)); + }, + ); + }), + t.brainCloudClient.identity.getIdentities( + ae(authenticationCallback), + )); + }), + (ae = function (e) { + return ( + (identitiesCallback = function (a) { + if (t.brainCloudClient.isAuthenticated()) + try { + var i = JSON.stringify(a.data.identities); + "{}" === i || "" === i + ? t.brainCloudClient.playerState.deleteUser(e) + : t.brainCloudClient.playerState.logout(e); + } catch (a) { + t.brainCloudClient.playerState.logout(e); + } + else e(); + }), + identitiesCallback + ); + }), + (t.resetEmailPassword = function (e, a) { + t.brainCloudClient.authentication.resetEmailPassword(e, a); + }), + (t.resetEmailPasswordAdvanced = function (e, a, i) { + t.brainCloudClient.authentication.resetEmailPasswordAdvanced( + e, a, i, - ) { - var n = { leaderboardId: t, groupId: a }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_LEADERBOARD, - operation: - e.socialLeaderboard.OPERATION_GET_GROUP_SOCIAL_LEADERBOARD, - data: n, - callback: i, - }); - }), - (e.socialLeaderboard.getGroupSocialLeaderboardByVersion = function ( - t, + ); + }), + (t.resetEmailPasswordWithExpiry = function (e, a, i) { + t.brainCloudClient.authentication.resetEmailPasswordWithExpiry( + e, + a, + i, + ); + }), + (t.resetEmailPasswordAdvancedWithExpiry = function (e, a, i, n) { + t.brainCloudClient.authentication.resetEmailPasswordAdvancedWithExpiry( + e, a, i, n, - ) { - var s = { leaderboardId: t, groupId: a, versionId: i }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_LEADERBOARD, - operation: - e.socialLeaderboard - .OPERATION_GET_GROUP_SOCIAL_LEADERBOARD_BY_VERSION, - data: s, - callback: n, - }); - }), - (e.socialLeaderboard.getPlayersSocialLeaderboard = function ( - t, + ); + }), + (t.reconnect = function (e) { + t.authenticateAnonymous(e); + }), + (t.resetUniversalIdPassword = function (e, a) { + t.brainCloudClient.authentication.resetUniversalIdPassword(e, a); + }), + (t.resetUniversalIdPasswordAdvanced = function (e, a, i) { + t.brainCloudClient.authentication.resetUniversalIdPasswordAdvanced( + e, a, i, - ) { - var n = { leaderboardId: t, profileIds: a }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_LEADERBOARD, - operation: - e.socialLeaderboard.OPERATION_GET_PLAYERS_SOCIAL_LEADERBOARD, - data: n, - callback: i, - }); - }), - (e.socialLeaderboard.getPlayersSocialLeaderboardByVersion = - function (t, a, i, n) { - var s = { leaderboardId: t, profileIds: a, versionId: i }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_LEADERBOARD, - operation: - e.socialLeaderboard - .OPERATION_GET_PLAYERS_SOCIAL_LEADERBOARD_BY_VERSION, - data: s, - callback: n, - }); - }), - (e.socialLeaderboard.listAllLeaderboards = function (t) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_LEADERBOARD, - operation: e.socialLeaderboard.OPERATION_LIST_ALL_LEADERBOARDS, - data: null, - callback: t, - }); - }), - (e.socialLeaderboard.removePlayerScore = function (t, a, i) { - var n = { leaderboardId: t, versionId: a }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_LEADERBOARD, - operation: e.socialLeaderboard.OPERATION_REMOVE_PLAYER_SCORE, - data: n, - callback: i, - }); - }), - (e.socialLeaderboard.getPlayerScore = function (t, a, i) { - var n = { leaderboardId: t, versionId: a }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_LEADERBOARD, - operation: e.socialLeaderboard.OPERATION_GET_PLAYER_SCORE, - data: n, - callback: i, - }); - }), - (e.socialLeaderboard.getPlayerScores = function (t, a, i, n) { - var s = { leaderboardId: t, versionId: a, maxResults: i }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_LEADERBOARD, - operation: e.socialLeaderboard.OPERATION_GET_PLAYER_SCORES, - data: s, - callback: n, - }); - }), - (e.socialLeaderboard.getPlayerScoresFromLeaderboards = function ( - t, - a, - ) { - var i = { leaderboardIds: t }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_LEADERBOARD, - operation: - e.socialLeaderboard - .OPERATION_GET_PLAYER_SCORES_FROM_LEADERBOARDS, - data: i, - callback: a, - }); - }), - (e.socialLeaderboard.postScoreToGroupLeaderboard = function ( - t, - a, - i, - n, - s, - ) { - var o = { leaderboardId: t, groupId: a, score: i }; - (n && (o.data = n), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_LEADERBOARD, - operation: e.socialLeaderboard.OPERATION_POST_GROUP_SCORE, - data: o, - callback: s, - })); - }), - (e.socialLeaderboard.removeGroupScore = function (t, a, i, n) { - var s = { leaderboardId: t, groupId: a, versionId: i }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_LEADERBOARD, - operation: e.socialLeaderboard.OPERATION_REMOVE_GROUP_SCORE, - data: s, - callback: n, - }); - }), - (e.socialLeaderboard.getGroupLeaderboardView = function ( - t, - a, - i, - n, - s, - o, - ) { - var r = { - leaderboardId: t, - groupId: a, - sort: i, - beforeCount: n, - afterCount: s, - }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_LEADERBOARD, - operation: - e.socialLeaderboard.OPERATION_GET_GROUP_LEADERBOARD_VIEW, - data: r, - callback: o, - }); - }), - (e.socialLeaderboard.getGroupLeaderboardViewByVersion = function ( - t, + ); + }), + (t.resetUniversalIdPasswordWithExpiry = function (e, a, i) { + t.brainCloudClient.authentication.resetUniversalIdPasswordWithExpiry( + e, a, i, - n, - s, - o, - r, - ) { - var l = { - leaderboardId: t, - groupId: a, - versionId: i, - sort: n, - beforeCount: s, - afterCount: o, - }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_LEADERBOARD, - operation: - e.socialLeaderboard.OPERATION_GET_GROUP_LEADERBOARD_VIEW, - data: l, - callback: r, - }); - }), - (e.socialLeaderboard.postScoreToDynamicGroupLeaderboard = function ( - t, + ); + }), + (t.resetUniversalIdPasswordAdvancedWithExpiry = function ( + e, + a, + i, + n, + ) { + t.brainCloudClient.authentication.resetUniversalIdPasswordAdvancedWithExpiry( + e, a, i, n, - s, - o, - r, - l, - c, - ) { - var d = { - leaderboardId: t, - groupId: a, - score: i, - data: n, - leaderboardType: s, - rotationType: o, - rotationResetTime: r, - retainedCount: l, - }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_LEADERBOARD, - operation: - e.socialLeaderboard - .OPERATION_POST_SCORE_TO_DYNAMIC_GROUP_LEADERBOARD, - data: d, - callback: c, - }); - }), - (e.socialLeaderboard.postScoreToDynamicGroupLeaderboardUTC = - function (t, a, i, n, s, o, r, l, c) { - var d = { - leaderboardId: t, - groupId: a, - score: i, - data: n, - leaderboardType: s, - rotationType: o, - rotationResetTime: r, - retainedCount: l, - }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_LEADERBOARD, - operation: - e.socialLeaderboard - .OPERATION_POST_SCORE_TO_DYNAMIC_GROUP_LEADERBOARD, - data: d, - callback: c, - }); + ); + }), + (t.reconnect = function (e) { + t.authenticateAnonymous(e); + }), + (t.restoreSession = function (e) { + console.log("Attempting restoring session with id: " + n); + var a = t.getStoredProfileId(), + i = t.getStoredAnonymousId(); + (t.brainCloudClient.initializeIdentity(a, i), + (t.brainCloudClient.brainCloudManager._isAuthenticated = true), + (t.brainCloudClient.brainCloudManager._packetId = + localStorage.getItem("lastPacketId"))); + var n = t.getStoredSessionId(); + (t.brainCloudClient.brainCloudManager.setSessionId(n), + t.brainCloudClient.time.readServerTime(function (a) { + 200 === a.status + ? t.brainCloudClient.playerState.readUserState(e) + : e(a); })); - } - function H() { - var e = this; - ((e.statusCodes = {}), - (e.statusCodes.OK = 200), - (e.statusCodes.BAD_REQUEST = 400), - (e.statusCodes.FORBIDDEN = 403), - (e.statusCodes.INTERNAL_SERVER_ERROR = 500), - (e.statusCodes.CLIENT_NETWORK_ERROR = 900)); - } - function X() { - var e = this; - ((e.timeUtils = {}), - (e.timeUtils.UTCDateTimeToUTCMillis = function (e) { - return e.getTime(); - }), - (e.timeUtils.UTCMillisToUTCDateTime = function (e) { - return new Date(e); - })); - } - function z() { - var e = this; - ((e.time = {}), - (e.SERVICE_TIME = "time"), - (e.time.OPERATION_READ = "READ"), - (e.time.readServerTime = function (t) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_TIME, - operation: e.time.OPERATION_READ, - data: {}, - callback: t, - }); - })); - } - function W() { - var e = this; - ((e.tournament = {}), - (e.SERVICE_TOURNAMENT = "tournament"), - (e.tournament.OPERATION_CLAIM_TOURNAMENT_REWARD = - "CLAIM_TOURNAMENT_REWARD"), - (e.tournament.OPERATION_GET_DIVISION_INFO = "GET_DIVISION_INFO"), - (e.tournament.OPERATION_GET_MY_DIVISIONS = "GET_MY_DIVISIONS"), - (e.tournament.OPERATION_GET_TOURNAMENT_STATUS = - "GET_TOURNAMENT_STATUS"), - (e.tournament.OPERATION_JOIN_DIVISION = "JOIN_DIVISION"), - (e.tournament.OPERATION_JOIN_TOURNAMENT = "JOIN_TOURNAMENT"), - (e.tournament.OPERATION_LEAVE_DIVISION_INSTANCE = - "LEAVE_DIVISION_INSTANCE"), - (e.tournament.OPERATION_LEAVE_TOURNAMENT = "LEAVE_TOURNAMENT"), - (e.tournament.OPERATION_POST_TOURNAMENT_SCORE = - "POST_TOURNAMENT_SCORE"), - (e.tournament.OPERATION_POST_TOURNAMENT_SCORE_WITH_RESULTS = - "POST_TOURNAMENT_SCORE_WITH_RESULTS"), - (e.tournament.OPERATION_VIEW_CURRENT_REWARD = - "VIEW_CURRENT_REWARD"), - (e.tournament.OPERATION_VIEW_REWARD = "VIEW_REWARD"), - (e.tournament.claimTournamentReward = function (t, a, i) { - var n = { leaderboardId: t, versionId: a }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_TOURNAMENT, - operation: e.tournament.OPERATION_CLAIM_TOURNAMENT_REWARD, - data: n, - callback: i, - }); - }), - (e.tournament.getDivisionInfo = function (t, a) { - var i = { divSetId: t }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_TOURNAMENT, - operation: e.tournament.OPERATION_GET_DIVISION_INFO, - data: i, - callback: a, - }); - }), - (e.tournament.getMyDivisions = function (t) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_TOURNAMENT, - operation: e.tournament.OPERATION_GET_MY_DIVISIONS, - data: null, - callback: t, - }); - }), - (e.tournament.getTournamentStatus = function (t, a, i) { - var n = { leaderboardId: t, versionId: a }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_TOURNAMENT, - operation: e.tournament.OPERATION_GET_TOURNAMENT_STATUS, - data: n, - callback: i, - }); - }), - (e.tournament.joinDivision = function (t, a, i, n) { - var s = { divSetId: t, tournamentCode: a, initialScore: i }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_TOURNAMENT, - operation: e.tournament.OPERATION_JOIN_DIVISION, - data: s, - callback: n, - }); - }), - (e.tournament.joinTournament = function (t, a, i, n) { - var s = { leaderboardId: t, tournamentCode: a, initialScore: i }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_TOURNAMENT, - operation: e.tournament.OPERATION_JOIN_TOURNAMENT, - data: s, - callback: n, - }); - }), - (e.tournament.leaveDivisionInstance = function (t, a) { - var i = { leaderboardId: t }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_TOURNAMENT, - operation: e.tournament.OPERATION_LEAVE_DIVISION_INSTANCE, - data: i, - callback: a, - }); - }), - (e.tournament.leaveTournament = function (t, a) { - var i = { leaderboardId: t }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_TOURNAMENT, - operation: e.tournament.OPERATION_LEAVE_TOURNAMENT, - data: i, - callback: a, - }); - }), - (e.tournament.postTournamentScore = function (t, a, i, n, s) { - var o = { - leaderboardId: t, - score: a, - roundStartedEpoch: n.getTime(), - }; - (i && (o.data = i), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_TOURNAMENT, - operation: e.tournament.OPERATION_POST_TOURNAMENT_SCORE, - data: o, - callback: s, - })); - }), - (e.tournament.postTournamentScoreUTC = function (t, a, i, n, s) { - var o = { - leaderboardId: t, - score: a, - roundStartedEpoch: n.getTime(), - }; - (i && (o.data = i), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_TOURNAMENT, - operation: e.tournament.OPERATION_POST_TOURNAMENT_SCORE, - data: o, - callback: s, - })); - }), - (e.tournament.postTournamentScoreWithResults = function ( - t, - a, - i, - n, - s, - o, - r, - l, - c, - ) { - var d = { - leaderboardId: t, - score: a, - roundStartedEpoch: n.getTime(), - sort: s, - beforeCount: o, - afterCount: r, - initialScore: l, - }; - (i && (d.data = i), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_TOURNAMENT, - operation: - e.tournament.OPERATION_POST_TOURNAMENT_SCORE_WITH_RESULTS, - data: d, - callback: c, - })); - }), - (e.tournament.postTournamentScoreWithResultsUTC = function ( - t, - a, - i, - n, - s, - o, - r, - l, - c, - ) { - var d = { - leaderboardId: t, - score: a, - roundStartedEpoch: n.getTime(), - sort: s, - beforeCount: o, - afterCount: r, - initialScore: l, - }; - (i && (d.data = i), - e.brainCloudManager.sendRequest({ - service: e.SERVICE_TOURNAMENT, - operation: - e.tournament.OPERATION_POST_TOURNAMENT_SCORE_WITH_RESULTS, - data: d, - callback: c, - })); - }), - (e.tournament.viewCurrentReward = function (t, a) { - var i = { leaderboardId: t }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_TOURNAMENT, - operation: e.tournament.OPERATION_VIEW_CURRENT_REWARD, - data: i, - callback: a, - }); - }), - (e.tournament.viewReward = function (t, a, i) { - var n = { leaderboardId: t, versionId: a }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_TOURNAMENT, - operation: e.tournament.OPERATION_VIEW_REWARD, - data: n, - callback: i, - }); - })); - } - function q() { - var e = this; - ((e.userItems = {}), - (e.SERVICE_USER_ITEMS = "userItems"), - (e.userItems.OPERATION_AWARD_USER_ITEM = "AWARD_USER_ITEM"), - (e.userItems.OPERATION_DROP_USER_ITEM = "DROP_USER_ITEM"), - (e.userItems.OPERATION_GET_USER_INVENTORY_PAGE = - "GET_USER_ITEMS_PAGE"), - (e.userItems.OPERATION_GET_USER_INVENTORY_PAGE_OFFSET = - "GET_USER_ITEMS_PAGE_OFFSET"), - (e.userItems.OPERATION_GET_USER_ITEM = "GET_USER_ITEM"), - (e.userItems.OPERATION_GIVE_USER_ITEM_TO = "GIVE_USER_ITEM_TO"), - (e.userItems.OPERATION_PURCHASE_USER_ITEM = "PURCHASE_USER_ITEM"), - (e.userItems.OPERATION_RECEIVE_USER_ITEM_FROM = - "RECEIVE_USER_ITEM_FROM"), - (e.userItems.OPERATION_SELL_USER_ITEM = "SELL_USER_ITEM"), - (e.userItems.OPERATION_UPDATE_USER_ITEM_DATA = - "UPDATE_USER_ITEM_DATA"), - (e.userItems.OPERATION_USE_USER_ITEM = "USE_USER_ITEM"), - (e.userItems.OPERATION_PUBLISH_USER_ITEM_TO_BLOCKCHAIN = - "PUBLISH_USER_ITEM_TO_BLOCKCHAIN"), - (e.userItems.OPERATION_REFRESH_BLOCKCHAIN_USER_ITEMS = - "REFRESH_BLOCKCHAIN_USER_ITEMS"), - (e.userItems.OPERATION_REMOVE_USER_ITEM_FROM_BLOCKCHAIN = - "REMOVE_USER_ITEM_FROM_BLOCKCHAIN"), - (e.userItems.awardUserItem = function (t, a, i, n) { - var s = { defId: t, quantity: a, includeDef: i }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_USER_ITEMS, - operation: e.userItems.OPERATION_AWARD_USER_ITEM, - data: s, - callback: n, - }); - }), - (e.userItems.dropUserItem = function (t, a, i, n) { - var s = { itemId: t, quantity: a, includeDef: i }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_USER_ITEMS, - operation: e.userItems.OPERATION_DROP_USER_ITEM, - data: s, - callback: n, - }); - }), - (e.userItems.getUserInventoryPage = function (t, a, i) { - var n = { context: t, includeDef: a }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_USER_ITEMS, - operation: e.userItems.OPERATION_GET_USER_INVENTORY_PAGE, - data: n, - callback: i, - }); - }), - (e.userItems.getUserItemsPage = function (t, a, i) { - var n = { context: t, includeDef: a }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_USER_ITEMS, - operation: e.userItems.OPERATION_GET_USER_INVENTORY_PAGE, - data: n, - callback: i, - }); - }), - (e.userItems.getUserInventoryPageOffset = function (t, a, i, n) { - var s = { context: t, pageOffset: a, includeDef: i }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_USER_ITEMS, - operation: e.userItems.OPERATION_GET_USER_INVENTORY_PAGE_OFFSET, - data: s, - callback: n, - }); - }), - (e.userItems.getUserItemsPageOffset = function (t, a, i, n) { - var s = { context: t, pageOffset: a, includeDef: i }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_USER_ITEMS, - operation: e.userItems.OPERATION_GET_USER_INVENTORY_PAGE_OFFSET, - data: s, - callback: n, - }); - }), - (e.userItems.getUserItem = function (t, a, i) { - var n = { itemId: t, includeDef: a }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_USER_ITEMS, - operation: e.userItems.OPERATION_GET_USER_ITEM, - data: n, - callback: i, - }); - }), - (e.userItems.giveUserItemTo = function (t, a, i, n, s, o) { - var r = { - profileId: t, - itemId: a, - version: i, - quantity: n, - immediate: s, - }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_USER_ITEMS, - operation: e.userItems.OPERATION_GIVE_USER_ITEM_TO, - data: r, - callback: o, - }); - }), - (e.userItems.purchaseUserItem = function (t, a, i, n, s) { - var o = { defId: t, quantity: a, shopId: i, includeDef: n }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_USER_ITEMS, - operation: e.userItems.OPERATION_PURCHASE_USER_ITEM, - data: o, - callback: s, - }); - }), - (e.userItems.receiveUserItemFrom = function (t, a, i) { - var n = { profileId: t, itemId: a }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_USER_ITEMS, - operation: e.userItems.OPERATION_RECEIVE_USER_ITEM_FROM, - data: n, - callback: i, - }); - }), - (e.userItems.sellUserItem = function (t, a, i, n, s, o) { - var r = { - itemId: t, - version: a, - quantity: i, - shopId: n, - includeDef: s, - }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_USER_ITEMS, - operation: e.userItems.OPERATION_SELL_USER_ITEM, - data: r, - callback: o, - }); - }), - (e.userItems.updateUserItemData = function (t, a, i, n) { - var s = { itemId: t, version: a, newItemData: i }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_USER_ITEMS, - operation: e.userItems.OPERATION_UPDATE_USER_ITEM_DATA, - data: s, - callback: n, - }); - }), - (e.userItems.useUserItem = function (t, a, i, n, s) { - var o = { itemId: t, version: a, newItemData: i, includeDef: n }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_USER_ITEMS, - operation: e.userItems.OPERATION_USE_USER_ITEM, - data: o, - callback: s, - }); - }), - (e.userItems.publishUserItemToBlockchain = function (t, a, i) { - var n = { itemId: t, version: a }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_USER_ITEMS, - operation: - e.userItems.OPERATION_PUBLISH_USER_ITEM_TO_BLOCKCHAIN, - data: n, - callback: i, - }); - }), - (e.userItems.refreshBlockchainUserItems = function (t) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_USER_ITEMS, - operation: e.userItems.OPERATION_REFRESH_BLOCKCHAIN_USER_ITEMS, - data: {}, - callback: t, - }); - }), - (e.userItems.removeUserItemFromBlockchain = function (t, a, i) { - var n = { itemId: t, version: a }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_USER_ITEMS, - operation: - e.userItems.OPERATION_REMOVE_USER_ITEM_FROM_BLOCKCHAIN, - data: n, - callback: i, - }); - })); - } - function $() { - var e = this; - ((e.virtualCurrency = {}), - (e.SERVICE_VIRTUAL_CURRENCY = "virtualCurrency"), - (e.virtualCurrency.OPERATION_GET_CURRENCY = "GET_PLAYER_VC"), - (e.virtualCurrency.OPERATION_GET_PARENT_CURRENCY = "GET_PARENT_VC"), - (e.virtualCurrency.OPERATION_GET_PEER_CURRENCY = "GET_PEER_VC"), - (e.virtualCurrency.OPERATION_RESET_PLAYER_VC = "RESET_PLAYER_VC"), - (e.virtualCurrency.OPERATION_AWARD_VC = "AWARD_VC"), - (e.virtualCurrency.OPERATION_CONSUME_PLAYER_VC = "CONSUME_VC"), - (e.virtualCurrency.getCurrency = function (t, a) { - var i = { vcId: t }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_VIRTUAL_CURRENCY, - operation: e.virtualCurrency.OPERATION_GET_CURRENCY, - data: i, - callback: a, - }); - }), - (e.virtualCurrency.getParentCurrency = function (t, a, i) { - var n = { vcId: t, levelName: a }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_VIRTUAL_CURRENCY, - operation: e.virtualCurrency.OPERATION_GET_PARENT_CURRENCY, - data: n, - callback: i, - }); - }), - (e.virtualCurrency.getPeerCurrency = function (t, a, i) { - var n = { vcId: t, peerCode: a }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_VIRTUAL_CURRENCY, - operation: e.virtualCurrency.OPERATION_GET_PEER_CURRENCY, - data: n, - callback: i, - }); - }), - (e.virtualCurrency.awardCurrency = function (t, a, i) { - var n = { vcId: t, vcAmount: a }; - e.brainCloudManager.sendRequest({ - service: e.SERVICE_VIRTUAL_CURRENCY, - operation: e.virtualCurrency.OPERATION_AWARD_VC, - data: n, - callback: i, - }); - }), - (e.virtualCurrency.consumeCurrency = function (t, a, i) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_VIRTUAL_CURRENCY, - operation: e.virtualCurrency.OPERATION_CONSUME_PLAYER_VC, - data: { vcId: t, vcAmount: a }, - callback: i, - }); - }), - (e.virtualCurrency.resetCurrency = function (t) { - e.brainCloudManager.sendRequest({ - service: e.SERVICE_VIRTUAL_CURRENCY, - operation: e.virtualCurrency.OPERATION_RESET_PLAYER_VC, - callback: t, - }); - })); - } - function J() { - var e = this; - ((e.name = "BrainCloudClient"), - (e.appVersion = "1.0"), - window.brainCloudClient !== e - ? (o.apply(e), - l.apply(e), - c.apply(e), - d.apply(e), - h.apply(e), - p.apply(e), - g.apply(e), - m.apply(e), - f.apply(e), - y.apply(e), - E.apply(e), - S.apply(e), - I.apply(e), - _.apply(e), - v.apply(e), - T.apply(e), - q.apply(e), - R.apply(e), - O.apply(e), - C.apply(e), - w.apply(e), - A.apply(e), - k.apply(e), - N.apply(e), - P.apply(e), - x.apply(e), - M.apply(e), - $.apply(e), - r.apply(e), - L.apply(e), - D.apply(e), - B.apply(e), - F.apply(e), - Y.apply(e), - U.apply(e), - j.apply(e), - G.apply(e), - V.apply(e), - H.apply(e), - z.apply(e), - W.apply(e), - b.apply(e), - u.apply(e), - X.apply(e), - (e.brainCloudManager = new s()), - (e.brainCloudRttComms = new te(this)), - (e.brainCloudRelayComms = new K(this)), - (e.brainCloudManager.abtests = e.abtests), - (e.brainCloudManager.asyncMatch = e.asyncMatch), - (e.brainCloudManager.authentication = e.authentication), - (e.brainCloudManager.chat = e.chat), - (e.brainCloudManager.dataStream = e.dataStream), - (e.brainCloudManager.entity = e.entity), - (e.brainCloudManager.event = e.event), - (e.brainCloudManager.file = e.file), - (e.brainCloudManager.friend = e.friend), - (e.brainCloudManager.gamification = e.gamification), - (e.brainCloudManager.globalApp = e.globalApp), - (e.brainCloudManager.globalStatistics = e.globalStatistics), - (e.brainCloudManager.globalEntity = e.globalEntity), - (e.brainCloudManager.group = e.group), - (e.brainCloudManager.identity = e.identity), - (e.brainCloudManager.lobby = e.lobby), - (e.brainCloudManager.mail = e.mail), - (e.brainCloudManager.matchMaking = e.matchMaking), - (e.brainCloudManager.messaging = e.messaging), - (e.brainCloudManager.oneWayMatch = e.oneWayMatch), - (e.brainCloudManager.playbackStream = e.playbackStream), - (e.brainCloudManager.playerState = e.playerState), - (e.brainCloudManager.playerStatistics = e.playerStatistics), - (e.brainCloudManager.playerStatisticsEvent = - e.playerStatisticsEvent), - (e.brainCloudManager.presence = e.precense), - (e.brainCloudManager.virtualCurrency = e.virtualCurrency), - (e.brainCloudManager.appStore = e.appStore), - (e.brainCloudManager.profanity = e.profanity), - (e.brainCloudManager.pushNotification = e.pushNotification), - (e.brainCloudManager.reasonCodes = e.reasonCodes), - (e.brainCloudManager.redemptionCode = e.redemptionCode), - (e.brainCloudManager.relay = e.relay), - (e.brainCloudManager.rttService = e.rttService), - (e.brainCloudManager.s3Handling = e.s3Handling), - (e.brainCloudManager.script = e.script), - (e.brainCloudManager.socialLeaderboard = e.socialLeaderboard), - (e.brainCloudManager.statusCodes = e.statusCodes), - (e.brainCloudManager.time = e.time), - (e.brainCloudManager.tournament = e.tournament), - (e.brainCloudManager.globalFile = e.globalFile), - (e.brainCloudManager.itemCatalog = e.itemCatalog), - (e.brainCloudManager.userItems = e.userItems), - (e.brainCloudManager.customEntity = e.customEntity), - (e.brainCloudManager.timeUtils = e.timeUtils), - (e.brainCloudRttComms.rtt = e.rtt), - (e.brainCloudRttComms.brainCloudClient = e), - (e.brainCloudRelayComms.brainCloudClient = e)) - : ((e.brainCloudManager = window.brainCloudManager = - window.brainCloudManager || {}), - (e.brainCloudRttComms = window.brainCloudRttComms = - window.brainCloudRttComms || {}), - (e.brainCloudRelayComms = window.brainCloudRelayComms = - window.brainCloudRelayComms || {}), - (e.brainCloudClient = window.brainCloudClient = - window.brainCloudClient || {}), - (e.brainCloudManager.abtests = e.brainCloudClient.abtests = - e.brainCloudClient.abtests || {}), - (e.brainCloudManager.asyncMatch = - e.brainCloudClient.asyncMatch = - e.brainCloudClient.asyncMatch || {}), - (e.brainCloudManager.authentication = - e.brainCloudClient.authentication = - e.brainCloudClient.authentication || {}), - (e.brainCloudManager.chat = e.brainCloudClient.chat = - e.brainCloudClient.chat || {}), - (e.brainCloudManager.dataStream = - e.brainCloudClient.dataStream = - e.brainCloudClient.dataStream || {}), - (e.brainCloudManager.entity = e.brainCloudClient.entity = - e.brainCloudClient.entity || {}), - (e.brainCloudManager.event = e.brainCloudClient.event = - e.brainCloudClient.event || {}), - (e.brainCloudManager.file = e.brainCloudClient.file = - e.brainCloudClient.file || {}), - (e.brainCloudManager.friend = e.brainCloudClient.friend = - e.brainCloudClient.friend || {}), - (e.brainCloudManager.gamification = - e.brainCloudClient.gamification = - e.brainCloudClient.gamification || {}), - (e.brainCloudManager.globalApp = e.brainCloudClient.globalApp = - e.brainCloudClient.globalApp || {}), - (e.brainCloudManager.globalStatistics = - e.brainCloudClient.globalStatistics = - e.brainCloudClient.globalStatistics || {}), - (e.brainCloudManager.globalEntity = - e.brainCloudClient.globalEntity = - e.brainCloudClient.globalEntity || {}), - (e.brainCloudManager.group = e.brainCloudClient.group = - e.brainCloudClient.group || {}), - (e.brainCloudManager.identity = e.brainCloudClient.identity = - e.brainCloudClient.identity || {}), - (e.brainCloudManager.lobby = e.brainCloudClient.lobby = - e.brainCloudClient.lobby || {}), - (e.brainCloudManager.mail = e.brainCloudClient.mail = - e.brainCloudClient.mail || {}), - (e.brainCloudManager.matchMaking = - e.brainCloudClient.matchMaking = - e.brainCloudClient.matchMaking || {}), - (e.brainCloudManager.messaging = e.brainCloudClient.messaging = - e.brainCloudClient.messaging || {}), - (e.brainCloudManager.oneWayMatch = - e.brainCloudClient.oneWayMatch = - e.brainCloudClient.oneWayMatch || {}), - (e.brainCloudManager.playbackStream = - e.brainCloudClient.playbackStream = - e.brainCloudClient.playbackStream || {}), - (e.brainCloudManager.playerState = - e.brainCloudClient.playerState = - e.brainCloudClient.playerState || {}), - (e.brainCloudManager.playerStatistics = - e.brainCloudClient.playerStatistics = - e.brainCloudClient.playerStatistics || {}), - (e.brainCloudManager.playerStatisticsEvent = - e.brainCloudClient.playerStatisticsEvent = - e.brainCloudClient.playerStatisticsEvent || {}), - (e.brainCloudManager.presence = e.brainCloudClient.presence = - e.brainCloudClient.presence || {}), - (e.brainCloudManager.virtualCurrency = - e.brainCloudClient.virtualCurrency = - e.brainCloudClient.virtualCurrency || {}), - (e.brainCloudManager.appStore = e.brainCloudClient.appStore = - e.brainCloudClient.appStore || {}), - (e.brainCloudManager.profanity = e.brainCloudClient.profanity = - e.brainCloudClient.profanity || {}), - (e.brainCloudManager.pushNotification = - e.brainCloudClient.pushNotification = - e.brainCloudClient.pushNotification || {}), - (e.brainCloudManager.reasonCodes = - e.brainCloudClient.reasonCodes = - e.brainCloudClient.reasonCodes || {}), - (e.brainCloudManager.redemptionCode = - e.brainCloudClient.redemptionCode = - e.brainCloudClient.redemptionCode || {}), - (e.brainCloudManager.relay = e.brainCloudClient.relay = - e.brainCloudClient.relay || {}), - (e.brainCloudManager.rttService = - e.brainCloudClient.rttService = - e.brainCloudClient.rttService || {}), - (e.brainCloudManager.s3Handling = - e.brainCloudClient.s3Handling = - e.brainCloudClient.s3Handling || {}), - (e.brainCloudManager.script = e.brainCloudClient.script = - e.brainCloudClient.script || {}), - (e.brainCloudManager.socialLeaderboard = - e.brainCloudClient.socialLeaderboard = - e.brainCloudClient.socialLeaderboard || {}), - (e.brainCloudManager.leaderboard = - e.brainCloudManager.socialLeaderboard), - (e.brainCloudManager.statusCodes = - e.brainCloudClient.statusCodes = - e.brainCloudClient.statusCodes || {}), - (e.brainCloudManager.time = e.brainCloudClient.time = - e.brainCloudClient.time || {}), - (e.brainCloudManager.tournament = - e.brainCloudClient.tournament = - e.brainCloudClient.tournament || {}), - (e.brainCloudManager.globalFile = - e.brainCloudClient.globalFile = - e.brainCloudClient.globalFile || {}), - (e.brainCloudManager.itemCatalog = - e.brainCloudClient.itemCatalog = - e.brainCloudClient.itemCatalog || {}), - (e.brainCloudManager.userItems = e.brainCloudClient.userItems = - e.brainCloudClient.userItems || {}), - (e.brainCloudManager.customEntity = - e.brainCloudClient.customEntity = - e.brainCloudClient.customEntity || {}), - (e.brainCloudManager.timeUtils = e.brainCloudClient.timeUtils = - e.brainCloudClient.timeUtils || {}), - (e.brainCloudRttComms.rtt = e.brainCloudClient.rtt = - e.brainCloudClient.rtt || {}), - (e.brainCloudRttComms.brainCloudClient = e), - (e.brainCloudRelayComms.brainCloudClient = e)), - (e.version = "4.10.0"), - e.countryCode, - e.languageCode, - (e.initialize = function (t, a, i) { - function n(e) { - return !e || /^\s*$/.test(e); - } - e.resetCommunication(); - var s = null; - (n(a) - ? (s = "secret was null or empty") - : n(t) - ? (s = "appId was null or empty") - : n(i) && (s = "appVersion was null or empty"), - null == s - ? ((e.appVersion = i), - e.brainCloudManager.initialize(t, a, i)) - : console.log( - "ERROR | Failed to initialize brainCloud - " + s, - )); - }), - (e.initializeWithApps = function (t, a, i) { - function n(e) { - return !e || /^\s*$/.test(e); + })); + } + (ie.apply((window.brainCloudWrapper = window.brainCloudWrapper || {})), + (t.BrainCloudWrapper = ie), + (t.BrainCloudClient = J)); + }, + 452: function (e, t, a) { + var i; + e.exports = + ((i = a(8249)), + a(8269), + a(8214), + a(888), + a(5109), + (function () { + var e = i, + t = e.lib.BlockCipher, + a = e.algo, + n = [], + s = [], + o = [], + r = [], + l = [], + c = [], + d = [], + u = [], + h = [], + p = []; + !(function () { + for (var e = [], t = 0; t < 256; t++) + e[t] = t < 128 ? t << 1 : (t << 1) ^ 283; + var a = 0, + i = 0; + for (t = 0; t < 256; t++) { + var g = i ^ (i << 1) ^ (i << 2) ^ (i << 3) ^ (i << 4); + ((g = (g >>> 8) ^ (255 & g) ^ 99), (n[a] = g), (s[g] = a)); + var m = e[a], + f = e[m], + y = e[f], + E = (257 * e[g]) ^ (16843008 * g); + ((o[a] = (E << 24) | (E >>> 8)), + (r[a] = (E << 16) | (E >>> 16)), + (l[a] = (E << 8) | (E >>> 24)), + (c[a] = E), + (E = + (16843009 * y) ^ (65537 * f) ^ (257 * m) ^ (16843008 * a)), + (d[g] = (E << 24) | (E >>> 8)), + (u[g] = (E << 16) | (E >>> 16)), + (h[g] = (E << 8) | (E >>> 24)), + (p[g] = E), + a ? ((a = m ^ e[e[e[y ^ m]]]), (i ^= e[e[i]])) : (a = i = 1)); } - e.resetCommunication(); - var s = t, - o = null; - (n(a[s]) - ? (o = "secret was null or empty") - : n(s) - ? (o = "appId was null or empty") - : n(i) && (o = "appVersion was null or empty"), - null == o - ? ((e.appVersion = i), - e.brainCloudManager.initializeWithApps(t, a, i)) - : console.log( - "ERROR | Failed to initialize brainCloud - " + o, - )); - }), - (e.initializeIdentity = function (t, a) { - e.authentication.initialize(t, a); - }), - (e.setServerUrl = function (t) { - e.brainCloudManager.setServerUrl(t); - }), - (e.getAppId = function () { - return e.brainCloudManager.getAppId(); - }), - (e.getAppVersion = function () { - return e.appVersion; - }), - (e.getProfileId = function () { - return e.authentication.profileId; - }), - (e.getSessionId = function () { - return e.brainCloudManager.getSessionId(); - }), - (e.getRTTConnectionId = function () { - return e.brainCloudRttComms.getRTTConnectionId(); - }), - (e.registerEventCallback = function (t) { - e.brainCloudManager.registerEventCallback(t); - }), - (e.deregisterEventCallback = function () { - e.brainCloudManager.deregisterEventCallback(); - }), - (e.registerRewardCallback = function (t) { - e.brainCloudManager.registerRewardCallback(t); - }), - (e.deregisterRewardCallback = function () { - e.brainCloudManager.deregisterRewardCallback(); - }), - (e.setErrorCallback = function (t) { - e.brainCloudManager.setErrorCallback(t); - }), - (e.registerGlobalErrorCallback = function (t) { - e.brainCloudManager.setErrorCallback(t); - }), - (e.enableLogging = function (t) { - (e.brainCloudManager.setDebugEnabled(t), - e.brainCloudRttComms.setDebugEnabled(t), - e.brainCloudRelayComms.setDebugEnabled(t)); - }), - (e.setDebugEnabled = function (t) { - (e.brainCloudManager.setDebugEnabled(t), - e.brainCloudRttComms.setDebugEnabled(t), - e.brainCloudRelayComms.setDebugEnabled(t)); - }), - (e.isInitialized = function () { - return e.brainCloudManager.isInitialized(); - }), - (e.isAuthenticated = function () { - return e.brainCloudManager.isAuthenticated(); - }), - (e.resetCommunication = function () { - ((e.authentication.profileId = ""), - e.brainCloudManager.resetCommunication(), - e.brainCloudRttComms.disableRTT(), - e.brainCloudRelayComms.disconnect()); - }), - (e.insertEndOfMessageBundleMarker = function () { - e.brainCloudManager.sendRequest({ - operation: "END_BUNDLE_MARKER", - }); - }), - (e.overrideCountryCode = function (t) { - e.countryCode = t; - }), - (e.overrideLanguageCode = function (e) { - brainCloudClient.languageCode = e; - }), - (e.heartbeat = function (t) { - e.brainCloudManager.sendRequest({ - service: "heartbeat", - operation: "READ", - callback: t, - }); - }), - (e.stopHeartBeat = function () { - e.brainCloudManager.stopHeartBeat(); - }), - (e.startHeartBeat = function () { - e.brainCloudManager.startHeartBeat(); - })); - } - function K(e) { - var t = this; - ((t.CONTROL_BYTES_SIZE = 1), - (t.MAX_PLAYERS = 40), - (t.INVALID_NET_ID = t.MAX_PLAYERS), - (t.CL2RS_CONNECT = 0), - (t.CL2RS_DISCONNECT = 1), - (t.CL2RS_RELAY = 2), - (t.CL2RS_ACK = 3), - (t.CL2RS_PING = 4), - (t.CL2RS_RSMG_ACK = 5), - (t.RS2CL_RSMG = 0), - (t.RS2CL_DISCONNECT = 1), - (t.RS2CL_RELAY = 2), - (t.RS2CL_ACK = 3), - (t.RS2CL_PONG = 4), - (t.RELIABLE_BIT = 32768), - (t.ORDERED_BIT = 16384), - (t.m_client = e), - (t.name = "BrainCloudRelayComms"), - (t.isConnected = false), - (t._cxId = null), - (t._ownerCxId = null), - (t._netIdToCxId = {}), - (t._cxIdToNetId = {}), - (t._debugEnabled = false), - (t._netId = t.INVALID_NET_ID), - (t._systemCallback = null), - (t._relayCallback = null), - (t._pingIntervalMS = 1000), - (t._pingIntervalId = null), - (t._pingInFlight = false), - (t._pingTime = null), - (t._sendPacketId = {}), - (t.ping = 999), - (t.setDebugEnabled = function (e) { - t._debugEnabled = e; - }), - (t.getOwnerCxId = function () { - return t._ownerCxId; - }), - (t.getCxIdForNetId = function (e) { - return t._netIdToCxId.hasOwnProperty(e) - ? t._netIdToCxId[e] - : null; - }), - (t.getNetIdForCxId = function (e) { - return t._cxIdToNetId.hasOwnProperty(e) - ? t._cxIdToNetId[e] - : t.INVALID_NET_ID; - }), - (t.getProfileIdForNetId = function (e) { - var a = t.getCxIdForNetId(e); - return null == a ? null : a.split(":")[1]; - }), - (t.getNetIdForProfileId = function (e) { - for (var a in t._cxIdToNetId) - if (e === a.split(":")[1]) return t.getNetIdForCxId(a); - return t.INVALID_NET_ID; - }), - (t.connect = function (e, a, i) { - t.isConnected && t.disconnect(); - var n = !!e.ssl && e.ssl, - s = e.host, - o = e.port, - r = e.passcode, - l = e.lobbyId; - if ( - ((t.isConnected = false), - (t.connectCallback = { success: a, failure: i }), - (t.connectInfo = { passcode: r, lobbyId: l }), - s && o && r && l) - ) { - var c = (n ? "wss://" : "ws://") + s + ":" + o; - ((t.socket = new WebSocket(c)), - t.socket.addEventListener("error", t.onSocketError), - t.socket.addEventListener("close", t.onSocketClose), - t.socket.addEventListener("open", t.onSocketOpen), - t.socket.addEventListener("message", t.onSocketMessage)); - } else - setTimeout(function () { - t.connectCallback.failure && - t.connectCallback.failure("Invalid arguments"); - }, 0); - }), - (t.disconnect = function () { - (t.stopPing(), - t.socket && - (t.socket.removeEventListener("error", t.onSocketError), - t.socket.removeEventListener("close", t.onSocketClose), - t.socket.removeEventListener("open", t.onSocketOpen), - t.socket.removeEventListener("message", t.onSocketMessage), - t.socket.close(), - (t.socket = null)), - (t.isConnected = false), - (t._sendPacketId = {}), - (t._netIdToProfileId = {}), - (t._profileIdToNetId = {}), - (t.ping = 999)); - }), - (t.registerRelayCallback = function (e) { - t._relayCallback = e; - }), - (t.deregisterRelayCallback = function () { - t._relayCallback = null; - }), - (t.registerSystemCallback = function (e) { - t._systemCallback = e; - }), - (t.deregisterSystemCallback = function () { - t._systemCallback = null; - }), - (t.setPingInterval = function (e) { - ((t._pingIntervalMS = Math.max(1000, e)), - t.isConnected && (t.stopPing(), t.startPing())); - }), - (t.getOwnerProfileId = function () { - return t._ownerCxId.spit(":")[1]; - }), - (t.stopPing = function () { - (t._pingIntervalId && - (clearInterval(t._pingIntervalId), (t._pingIntervalId = null)), - (t._pingInFlight = false)); - }), - (t.startPing = function () { - (t.stopPing(), - (t._pingIntervalId = setInterval(function () { - t._pingInFlight || t.sendPing(); - }, t._pingIntervalMS))); - }), - (t.onSocketError = function (e) { - (t.disconnect(), - t.connectCallback.failure && - t.connectCallback.failure("Relay error: " + e.toString())); - }), - (t.onSocketClose = function (e) { - (t.disconnect(), - t.connectCallback.failure && - t.connectCallback.failure("Relay Connection closed")); - }), - (t.onSocketOpen = function (e) { - console.log("Relay WebSocket connection established"); - var a = { - lobbyId: t.connectInfo.lobbyId, - cxId: t.m_client.rttService.getRTTConnectionId(), - passcode: t.connectInfo.passcode, - version: t.m_client.version, - }; - t.sendJson(t.CL2RS_CONNECT, a); - }), - (t.onSocketMessage = function (e) { - var a = function (e) { - console.log("Typeof data = " + typeof e); - var a = new Buffer(e); - if (e.length < 3) - return ( - t.disconnect(), - void ( - t.connectCallback.failure && - t.connectCallback.failure( - "Relay Recv Error: packet cannot be smaller than 3 bytes", - ) + })(); + var g = [0, 1, 2, 4, 8, 16, 32, 64, 128, 27, 54], + m = (a.AES = t.extend({ + _doReset: function () { + if (!this._nRounds || this._keyPriorReset !== this._key) { + for ( + var e = (this._keyPriorReset = this._key), + t = e.words, + a = e.sigBytes / 4, + i = 4 * ((this._nRounds = a + 6) + 1), + s = (this._keySchedule = []), + o = 0; + o < i; + o++ ) - ); - t.onRecv(a); - }; - if ("undefined" != typeof FileReader) { - var i = new FileReader(); - ((i.onload = function () { - a(i.result); - }), - i.readAsArrayBuffer(e.data)); - } else a(e.data); - }), - (t.sendJson = function (e, a) { - t.sendText(e, JSON.stringify(a)); - }), - (t.sendText = function (e, a) { - var i = new Buffer(a.length + 3); - (i.writeUInt16BE(a.length + 3, 0), - i.writeUInt8(e, 2), - i.write(a, 3, a.length), - t.socket.send(i), - t._debugEnabled && console.log("RELAY SEND: " + a)); - }), - (t.sendRelay = function (e, a, i, n, s) { - if (t.isConnected) { - var o = 0; - (i && (o += t.RELIABLE_BIT), - n && (o += t.ORDERED_BIT), - (o += 4096 * s)); - for ( - var r = 0, - l = 1, - c = (a / 4294967296) & 4294967295, - d = 4294967295 & a, - u = 0; - u < 40; - ++u - ) { - var h = Math.pow(2, 40 - u - 1); - ((0 == (c & (l / 4294967296) & 4294967295) && - 0 == (4294967295 & d & l)) || - (r += h), - (l *= 2)); - } - var p = o, - g = 65535 & (c = ((256 * r) / 4294967296) & 65535), - m = ((d = (256 * r) & 4294967040) / 65536) & 65535, - f = 65535 & d; - (t._sendPacketId.hasOwnProperty(p) || (t._sendPacketId[p] = {}), - t._sendPacketId[p].hasOwnProperty(g) || - (t._sendPacketId[p][g] = {}), - t._sendPacketId[p][g].hasOwnProperty(m) || - (t._sendPacketId[p][g][m] = {}), - t._sendPacketId[p][g][m].hasOwnProperty(f) || - (t._sendPacketId[p][g][m][f] = 0)); - var y = t._sendPacketId[p][g][m][f]; - o += y; - var E = new Buffer(e.length + 11); - (E.writeUInt16BE(e.length + 11, 0), - E.writeUInt8(t.CL2RS_RELAY, 2), - E.writeUInt16BE(o, 3), - E.writeUInt16BE(g, 5), - E.writeUInt16BE(m, 7), - E.writeUInt16BE(f, 9), - E.set(e, 11), - t.socket.send(E), - (y = (y + 1) & 4095), - (t._sendPacketId[p][g][m][f] = y)); - } - }), - (t.sendPing = function () { - (t._debugEnabled && console.log("RELAY SEND PING: " + t.ping), - (t._pingInFlight = true), - (t._pingTime = new Date().getTime())); - var e = new Buffer(5); - (e.writeUInt16BE(5, 0), - e.writeUInt8(t.CL2RS_PING, 2), - e.writeUInt16BE(t.ping, 3), - t.socket.send(e)); - }), - (t.send = function (e, a) { - if ((e < MAX_PLAYERS && e >= 0) || e == bc.relay.TO_ALL_PLAYERS) - if (a.length > 1024) - t.connectCallback.failure && - t.connectCallback.failure( - "Relay Error: Packet too big " + a.length + " > max 1024", - ); - else { - var i = new Buffer(a.length + 3); - (i.writeUInt16BE(a.length + 3, 0), - i.writeUInt8(e, 2), - i.set(a, 3), - t.socket.send(i)); - } - else - t.connectCallback.failure && - t.connectCallback.failure("Relay Error: Invalid NetId " + e); - }), - (t.onRecv = function (e) { - var a = e.readUInt16BE(0), - i = e.readUInt8(2); - if (i == t.RS2CL_RSMG) t.onRSMG(e); - else if (i == t.RS2CL_PONG) - (t._pingInFlight && - ((t._pingInFlight = false), - (t.ping = Math.min(999, new Date().getTime() - t._pingTime))), - t._debugEnabled && console.log("RELAY RECV PONG: " + t.ping)); - else if (i == t.RS2CL_ACK); - else if (i == t.RS2CL_RELAY) { - var n = e.readUInt8(10); - (t._debugEnabled && - console.log("RELAY RECV from netId: " + n + " size: " + a), - t._relayCallback && t._relayCallback(n, e.slice(11))); - } else - (t.disconnect(), - t.connectCallback.failure && - t.connectCallback.failure( - "Relay Recv Error: Unknown controlByte: " + i, - )); - }), - (t.onRSMG = function (a) { - var i = a.slice(5).toString("utf8"); - t._debugEnabled && console.log("RELAY RECV RSMG: " + i); - var n = JSON.parse(i); - switch (n.op) { - case "CONNECT": - ((t._netIdToCxId[n.netId] = n.cxId), - (t._cxIdToNetId[n.cxId] = n.netId), - n.cxId == e.rttService.getRTTConnectionId() && - (t.isConnected || - ((t._netId = n.netId), - (t._ownerCxId = n.ownerCxId), - (t.isConnected = true), - t.startPing(), - t.connectCallback.success && - t.connectCallback.success(n)))); - break; - case "NET_ID": - ((t._netIdToCxId[n.netId] = n.cxId), - (t._cxIdToNetId[n.cxId] = n.netId)); - break; - case "MIGRATE_OWNER": - t._ownerId = n.cxId; - } - t._systemCallback && t._systemCallback(n); - })); - } - var Q; - (s.apply((window.brainCloudManager = window.brainCloudManager || {})), - o.apply((window.brainCloudClient = window.brainCloudClient || {})), - r.apply((window.brainCloudClient = window.brainCloudClient || {})), - l.apply((window.brainCloudClient = window.brainCloudClient || {})), - ("undefined" != typeof window && null !== window) || (window = {}), - window.navigator || (window.navigator = {}), - window.navigator.userLanguage || - window.navigator.language || - (window.navigator.userLanguage = a(5781).Xu()), - c.apply((window.brainCloudClient = window.brainCloudClient || {})), - d.apply((window.brainCloudClient = window.brainCloudClient || {})), - u.apply((window.brainCloudClient = window.brainCloudClient || {})), - h.apply((window.brainCloudClient = window.brainCloudClient || {})), - p.apply((window.brainCloudClient = window.brainCloudClient || {})), - g.apply((window.brainCloudClient = window.brainCloudClient || {})), - ("undefined" != typeof window && null !== window) || (window = {}), - window.FormData || - ((window.FormData = a(6230)), (FormData = window.FormData)), - m.apply((window.brainCloudClient = window.brainCloudClient || {})), - f.apply((window.brainCloudClient = window.brainCloudClient || {})), - y.apply((window.brainCloudClient = window.brainCloudClient || {})), - E.apply((window.brainCloudClient = window.brainCloudClient || {})), - b.apply((window.brainCloudClient = window.brainCloudClient || {})), - S.apply((window.brainCloudClient = window.brainCloudClient || {})), - I.apply((window.brainCloudClient = window.brainCloudClient || {})), - _.apply((window.brainCloudClient = window.brainCloudClient || {})), - ("undefined" != typeof window && null !== window) || (window = {}), - window.navigator || (window.navigator = {}), - window.navigator.userLanguage || - window.navigator.language || - (window.navigator.userLanguage = a(5781).Xu()), - v.apply((window.brainCloudClient = window.brainCloudClient || {})), - T.apply((window.brainCloudClient = window.brainCloudClient || {})), - R.apply((window.brainCloudClient = window.brainCloudClient || {})), - O.apply((window.brainCloudClient = window.brainCloudClient || {})), - C.apply((window.brainCloudClient = window.brainCloudClient || {})), - w.apply((window.brainCloudClient = window.brainCloudClient || {})), - A.apply((window.brainCloudClient = window.brainCloudClient || {})), - k.apply((window.brainCloudClient = window.brainCloudClient || {})), - N.apply((window.brainCloudClient = window.brainCloudClient || {})), - x.apply((window.brainCloudClient = window.brainCloudClient || {})), - P.apply((window.brainCloudClient = window.brainCloudClient || {})), - M.apply((window.brainCloudClient = window.brainCloudClient || {})), - L.apply((window.brainCloudClient = window.brainCloudClient || {})), - D.apply((window.brainCloudClient = window.brainCloudClient || {})), - B.apply((window.brainCloudClient = window.brainCloudClient || {})), - F.apply((window.brainCloudClient = window.brainCloudClient || {})), - Y.apply((window.brainCloudClient = window.brainCloudClient || {})), - U.apply((window.brainCloudClient = window.brainCloudClient || {})), - j.apply((window.brainCloudClient = window.brainCloudClient || {})), - G.apply((window.brainCloudClient = window.brainCloudClient || {})), - V.apply((window.brainCloudClient = window.brainCloudClient || {})), - H.apply((window.brainCloudClient = window.brainCloudClient || {})), - X.apply((window.brainCloudClient = window.brainCloudClient || {})), - z.apply((window.brainCloudClient = window.brainCloudClient || {})), - W.apply((window.brainCloudClient = window.brainCloudClient || {})), - q.apply((window.brainCloudClient = window.brainCloudClient || {})), - $.apply((window.brainCloudClient = window.brainCloudClient || {})), - J.apply((window.brainCloudClient = window.brainCloudClient || {})), - K.apply( - (window.brainCloudRelayComms = window.brainCloudRelayComms || {}), - )); - var Z = false, - ee = null; - function te(e) { - var t = this; - ((t.RTTConnectionStatus = { - CONNECTED: "Connected", - DISCONNECTED: "Disconnected", - CONNECTING: "Connecting", - DISCONNECTING: "Disconnecting", - }), - (t.m_client = e), - (t.name = "BrainCloudRttComms"), - (t.socket = null), - (t.heartbeatId = null), - (t._rttConnectionStatus = t.RTTConnectionStatus.DISCONNECTED), - (t.auth = {}), - (t.callbacks = {}), - (t._debugEnabled = false), - (t.connectionId = null), - (t.setDebugEnabled = function (e) { - t._debugEnabled = e; - }), - (t.getRTTConnectionId = function () { - return t.connectionId; - }), - (t.getConnectionStatus = function () { - return t._rttConnectionStatus; - }), - (t.connect = function (e, a, i, n) { - ((t._rttConnectionStatus = t.RTTConnectionStatus.CONNECTING), - (t.auth = i)); - var s = (n ? "wss://" : "ws://") + e + ":" + a; - if (t.auth) { - s += "?"; - var o = 0; - for (var r in t.auth) - (o > 0 && (s += "&"), (s += r + "=" + t.auth[r]), ++o); - } - ((t.socket = new WebSocket(s)), - t.socket.addEventListener("error", t.onSocketError), - t.socket.addEventListener("close", t.onSocketClose), - t.socket.addEventListener("open", t.onSocketOpen), - t.socket.addEventListener("message", t.onSocketMessage)); - }), - (t.onSocketError = function (e) { - (t.isRTTEnabled() && t.connectCallback.failure("error"), - t.disableRTT()); - }), - (t.onSocketClose = function (e) { - (t.isRTTEnabled() && t.connectCallback.failure("close"), - t.disableRTT(), - 1 == Z && console.log("RTT:Disconnect" + JSON.stringify(ee))); - }), - (t.onSocketOpen = function (e) { - if (t.isRTTEnabled()) { - console.log("WebSocket connection established"); - var a = { - operation: "CONNECT", - service: "rtt", - data: { - appId: t.brainCloudClient.getAppId(), - profileId: t.brainCloudClient.getProfileId(), - sessionId: t.brainCloudClient.getSessionId(), - system: { protocol: "ws", platform: "WEB" }, - }, - }, - i = - ((n = - (!!window.opr && !!opr.addons) || - !!window.opera || - ("undefined" != typeof navigator && - navigator.userAgent.indexOf(" OPR/") >= 0)), - (s = "undefined" != typeof InstallTrigger), - (o = - /constructor/i.test(window.HTMLElement) || - "[object SafariRemoteNotification]" === - ( - !window.safari || - ("undefined" != typeof safari && - safari.pushNotification) - ).toString()), - (l = - !(r = - "undefined" != typeof document && - !!document.documentMode) && !!window.StyleMedia), - (d = - ((c = !!window.chrome && !!window.chrome.webstore) || - n) && - !!window.CSS), - n - ? "opera" - : s - ? "firefox" - : o - ? "safari" - : r - ? "ie" - : l - ? "edge" - : c - ? "chrome" - : d - ? "blink" - : null); - (i && (a.data.system.browser = i), - (a.data.auth = t.auth), - t._debugEnabled && - console.log("WS SEND: " + JSON.stringify(a)), - t.socket.send(JSON.stringify(a))); - } - var n, s, o, r, l, c, d; - }), - (t.onSocketMessage = function (e) { - if (t.isRTTEnabled()) { - var a = function (e) { - "rtt" == e.service - ? (t._debugEnabled && - console.log("WS RECV: " + JSON.stringify(e)), - "CONNECT" == e.operation - ? ((t.connectionId = e.data.cxId), - (Q = e.data.heartbeatSeconds), - t.startHeartbeat(), - t.connectCallback.success(e)) - : "DISCONNECT" == e.operation && - ((Z = true), - (ee = { - severity: "ERROR", - reason: e.data.reason, - reasonCode: e.data.reasonCode, - data: null, - }))) - : t.onRecv(e); - }; - if ("string" == typeof e.data) a(e.data); - else if ("undefined" != typeof FileReader) { - var i = new FileReader(); - ((i.onload = function () { - var e = {}; - try { - e = JSON.parse(i.result); - } catch (t) { - (console.log("WS RECV: " + i.result), - (e = JSON.parse(i.result))); + o < a + ? (s[o] = t[o]) + : ((c = s[o - 1]), + o % a + ? a > 6 && + o % a == 4 && + (c = + (n[c >>> 24] << 24) | + (n[(c >>> 16) & 255] << 16) | + (n[(c >>> 8) & 255] << 8) | + n[255 & c]) + : ((c = + (n[(c = (c << 8) | (c >>> 24)) >>> 24] << 24) | + (n[(c >>> 16) & 255] << 16) | + (n[(c >>> 8) & 255] << 8) | + n[255 & c]), + (c ^= g[(o / a) | 0] << 24)), + (s[o] = s[o - a] ^ c)); + for ( + var r = (this._invKeySchedule = []), l = 0; + l < i; + l++ + ) { + if (((o = i - l), l % 4)) var c = s[o]; + else c = s[o - 4]; + r[l] = + l < 4 || o <= 4 + ? c + : d[n[c >>> 24]] ^ + u[n[(c >>> 16) & 255]] ^ + h[n[(c >>> 8) & 255]] ^ + p[n[255 & c]]; } - a(e); - }), - i.readAsText(e.data)); - } else { - var n = {}; - try { - n = JSON.parse(e.data); - } catch (e) { - (console.log("WS RECV: " + e.data), - (n = JSON.parse(e.data))); } - a(n); - } - } - }), - (t.startHeartbeat = function () { - t.heartbeatId || - (t.heartbeatId = setInterval(function () { - var e = { - operation: "HEARTBEAT", - service: "rtt", - data: null, - }; - (t._debugEnabled && - console.log("WS SEND: " + JSON.stringify(e)), - t.socket.send(JSON.stringify(e))); - }, 1000 * Q)); - }), - (t.onRecv = function (e) { - (t._debugEnabled && console.log("WS RECV: " + JSON.stringify(e)), - t.callbacks[e.service] && t.callbacks[e.service](e)); - }), - (t.enableRTT = function (a, i) { - ((Z = false), - t.isRTTEnabled() || - t._rttConnectionStatus == t.RTTConnectionStatus.CONNECTING || - ((t.connectCallback = { success: a, failure: i }), - (t._rttConnectionStatus = t.RTTConnectionStatus.CONNECTING), - e.rttService.requestClientConnection(function (e) { - if ((t._debugEnabled && console.log(e), 200 == e.status)) { - for (var a = 0; a < e.data.endpoints.length; ++a) { - var i = e.data.endpoints[a]; - if ("ws" === i.protocol) - return ( - t.connect(i.host, i.port, e.data.auth, i.ssl), - void (t._rttConnectionStatus = - t.RTTConnectionStatus.CONNECTED) - ); - } - ((e.status = 0), - (e.status_message = "WebSocket endpoint missing"), - (t._rttConnectionStatus = - t.RTTConnectionStatus.DISCONNECTED), - t.connectCallback.failure(e)); - } else - ((t._rttConnectionStatus = - t.RTTConnectionStatus.DISCONNECTED), - t.connectCallback.failure(e)); - }))); - }), - (t.disableRTT = function () { - t.isRTTEnabled() && - t._rttConnectionStatus != t.RTTConnectionStatus.DISCONNECTING && - ((t._rttConnectionStatus = t.RTTConnectionStatus.DISCONNECTING), - t.heartbeatId && - (clearInterval(t.heartbeatId), (t.heartbeatId = null)), - t.socket && - (t.socket.removeEventListener("error", t.onSocketError), - t.socket.removeEventListener("close", t.onSocketClose), - t.socket.removeEventListener("open", t.onSocketOpen), - t.socket.removeEventListener("message", t.onSocketMessage), - t.socket.close(), - (t.socket = null)), - (t._rttConnectionStatus = t.RTTConnectionStatus.DISCONNECTED)); - }), - (t.isRTTEnabled = function () { - return t._rttConnectionStatus == t.RTTConnectionStatus.CONNECTED; - }), - (t.registerRTTCallback = function (e, a) { - t.callbacks[e] = a; - }), - (t.deregisterRTTCallback = function (e) { - t.callbacks[e] = null; - }), - (t.deregisterAllRTTCallbacks = function () { - t.callbacks = {}; - })); - } - te.apply((window.brainCloudRttComms = window.brainCloudRttComms || {})); - var ae = null; - function ie(e) { - var t = this; - ((t.name = "BrainCloudWrapper"), - window.brainCloudWrapper !== t - ? ((t.brainCloudClient = new J(e)), - (t.abtests = t.brainCloudClient.abtests), - (t.asyncMatch = t.brainCloudClient.asyncMatch), - (t.chat = t.brainCloudClient.chat), - (t.dataStream = t.brainCloudClient.dataStream), - (t.entity = t.brainCloudClient.entity), - (t.event = t.brainCloudClient.event), - (t.file = t.brainCloudClient.file), - (t.friend = t.brainCloudClient.friend), - (t.gamification = t.brainCloudClient.gamification), - (t.globalApp = t.brainCloudClient.globalApp), - (t.globalStatistics = t.brainCloudClient.globalStatistics), - (t.globalEntity = t.brainCloudClient.globalEntity), - (t.group = t.brainCloudClient.group), - (t.identity = t.brainCloudClient.identity), - (t.lobby = t.brainCloudClient.lobby), - (t.mail = t.brainCloudClient.mail), - (t.matchMaking = t.brainCloudClient.matchMaking), - (t.messaging = t.brainCloudClient.messaging), - (t.oneWayMatch = t.brainCloudClient.oneWayMatch), - (t.playbackStream = t.brainCloudClient.playbackStream), - (t.playerState = t.brainCloudClient.playerState), - (t.playerStatistics = t.brainCloudClient.playerStatistics), - (t.playerStatisticsEvent = - t.brainCloudClient.playerStatisticsEvent), - (t.presence = t.brainCloudClient.presence), - (t.virtualCurrency = t.brainCloudClient.virtualCurrency), - (t.appStore = t.brainCloudClient.appStore), - (t.profanity = t.brainCloudClient.profanity), - (t.pushNotification = t.brainCloudClient.pushNotification), - (t.reasonCodes = t.brainCloudClient.reasonCodes), - (t.redemptionCode = t.brainCloudClient.redemptionCode), - (t.relay = t.brainCloudClient.relay), - (t.rttService = t.brainCloudClient.rttService), - (t.s3Handling = t.brainCloudClient.s3Handling), - (t.script = t.brainCloudClient.script), - (t.socialLeaderboard = t.brainCloudClient.socialLeaderboard), - (t.leaderboard = t.socialLeaderboard), - (t.statusCodes = t.brainCloudClient.statusCodes), - (t.time = t.brainCloudClient.time), - (t.tournament = t.brainCloudClient.tournament), - (t.globalFile = t.brainCloudClient.globalFile), - (t.itemCatalog = t.brainCloudClient.itemCatalog), - (t.userItems = t.brainCloudClient.userItems), - (t.customEntity = t.brainCloudClient.customEntity), - (t.timeUtils = t.brainCloudClient.timeUtils), - (t.brainCloudManager = t.brainCloudClient.brainCloudManager = - t.brainCloudClient.brainCloudManager || {})) - : ((t.brainCloudManager = window.brainCloudManager = - window.brainCloudManager || {}), - (t.brainCloudClient = window.brainCloudClient = - window.brainCloudClient || {})), - (t.wrapperName = void 0 === e ? "" : e), - (t._alwaysAllowProfileSwitch = true), - (t._initializeIdentity = function (e) { - var a = t.getStoredProfileId(), - i = t.getStoredAnonymousId(); - (null == a && (a = ""), - null == i && (i = ""), - ("" != i && "" != a) || - ((i = - t.brainCloudClient.authentication.generateAnonymousId()), - (a = ""), - t.setStoredAnonymousId(i), - t.setStoredProfileId(a))); - var n = a; - (!e && t._alwaysAllowProfileSwitch && (n = ""), - t.brainCloudClient.initializeIdentity(n, i)); - }), - (t._authResponseHandler = function (e) { - if (200 == e.status) { - var a = e.data.profileId; - t.setStoredProfileId(a); - var i = e.data.sessionId; - t.setStoredSessionId(i); - } - console.log("Updated saved profileId to " + a); - }), - (t.initialize = function (e, a, i) { - t.brainCloudClient.initialize(e, a, i); - }), - (t.initializeWithApps = function (e, a, i) { - t.brainCloudClient.initializeWithApps(e, a, i); - }), - (t.getStoredAnonymousId = function () { - var t = "" === e ? "" : e + "."; - return localStorage.getItem(t + "anonymousId"); - }), - (t.setStoredAnonymousId = function (t) { - var a = "" === e ? "" : e + "."; - localStorage.setItem(a + "anonymousId", t); - }), - (t.resetStoredAnonymousId = function () { - t.setStoredAnonymousId(""); - }), - (t.getStoredProfileId = function () { - var t = "" === e ? "" : e + "."; - return localStorage.getItem(t + "profileId"); - }), - (t.setStoredProfileId = function (t) { - var a = "" === e ? "" : e + "."; - localStorage.setItem(a + "profileId", t); - }), - (t.resetStoredProfileId = function () { - t.setStoredProfileId(""); - }), - (t.getStoredSessionId = function () { - var t = "" === e ? "" : e + "."; - return localStorage.getItem(t + "sessionId"); - }), - (t.setStoredSessionId = function (t) { - var a = "" === e ? "" : e + "."; - localStorage.setItem(a + "sessionId", t); - }), - (t.resetStoredSessionId = function () { - t.setStoredSessionId(""); - }), - (t.getAlwaysAllowProfileSwitch = function () { - return t._alwaysAllowProfileSwitch; - }), - (t.setAlwaysAllowProfileSwitch = function (e) { - t._alwaysAllowProfileSwitch = e; - }), - (t.authenticateAnonymous = function (e) { - (t._initializeIdentity(true), - t.brainCloudClient.authentication.authenticateAnonymous( - true, - function (a) { - (t._authResponseHandler(a), e(a)); + }, + encryptBlock: function (e, t) { + this._doCryptBlock(e, t, this._keySchedule, o, r, l, c, n); + }, + decryptBlock: function (e, t) { + var a = e[t + 1]; + ((e[t + 1] = e[t + 3]), + (e[t + 3] = a), + this._doCryptBlock( + e, + t, + this._invKeySchedule, + d, + u, + h, + p, + s, + ), + (a = e[t + 1]), + (e[t + 1] = e[t + 3]), + (e[t + 3] = a)); + }, + _doCryptBlock: function (e, t, a, i, n, s, o, r) { + for ( + var l = this._nRounds, + c = e[t] ^ a[0], + d = e[t + 1] ^ a[1], + u = e[t + 2] ^ a[2], + h = e[t + 3] ^ a[3], + p = 4, + g = 1; + g < l; + g++ + ) { + var m = + i[c >>> 24] ^ + n[(d >>> 16) & 255] ^ + s[(u >>> 8) & 255] ^ + o[255 & h] ^ + a[p++], + f = + i[d >>> 24] ^ + n[(u >>> 16) & 255] ^ + s[(h >>> 8) & 255] ^ + o[255 & c] ^ + a[p++], + y = + i[u >>> 24] ^ + n[(h >>> 16) & 255] ^ + s[(c >>> 8) & 255] ^ + o[255 & d] ^ + a[p++], + E = + i[h >>> 24] ^ + n[(c >>> 16) & 255] ^ + s[(d >>> 8) & 255] ^ + o[255 & u] ^ + a[p++]; + ((c = m), (d = f), (u = y), (h = E)); + } + ((m = + ((r[c >>> 24] << 24) | + (r[(d >>> 16) & 255] << 16) | + (r[(u >>> 8) & 255] << 8) | + r[255 & h]) ^ + a[p++]), + (f = + ((r[d >>> 24] << 24) | + (r[(u >>> 16) & 255] << 16) | + (r[(h >>> 8) & 255] << 8) | + r[255 & c]) ^ + a[p++]), + (y = + ((r[u >>> 24] << 24) | + (r[(h >>> 16) & 255] << 16) | + (r[(c >>> 8) & 255] << 8) | + r[255 & d]) ^ + a[p++]), + (E = + ((r[h >>> 24] << 24) | + (r[(c >>> 16) & 255] << 16) | + (r[(d >>> 8) & 255] << 8) | + r[255 & u]) ^ + a[p++]), + (e[t] = m), + (e[t + 1] = f), + (e[t + 2] = y), + (e[t + 3] = E)); + }, + keySize: 8, + })); + e.AES = t._createHelper(m); + })(), + i.AES); + }, + 5109: function (e, t, a) { + var i, n, s, o, r, l, c, d, u, h, p, g, m, f, y, E, b, S, I; + e.exports = + ((i = a(8249)), + a(888), + void ( + i.lib.Cipher || + ((n = i), + (s = n.lib), + (o = s.Base), + (r = s.WordArray), + (l = s.BufferedBlockAlgorithm), + (c = n.enc), + c.Utf8, + (d = c.Base64), + (u = n.algo.EvpKDF), + (h = s.Cipher = + l.extend({ + cfg: o.extend(), + createEncryptor: function (e, t) { + return this.create(this._ENC_XFORM_MODE, e, t); }, - )); - }), - (t.authenticateEmailPassword = function (e, a, i, n) { - (t._initializeIdentity(false), - t.brainCloudClient.authentication.authenticateEmailPassword( - e, - a, - i, - function (e) { - (t._authResponseHandler(e), n(e)); + createDecryptor: function (e, t) { + return this.create(this._DEC_XFORM_MODE, e, t); }, - )); - }), - (t.authenticateExternal = function (e, a, i, n, s) { - (t._initializeIdentity(false), - t.brainCloudClient.authentication.authenticateExternal( - e, - a, - i, - n, - function (e) { - (t._authResponseHandler(e), s(e)); + init: function (e, t, a) { + ((this.cfg = this.cfg.extend(a)), + (this._xformMode = e), + (this._key = t), + this.reset()); }, - )); - }), - (t.authenticateFacebook = function (e, a, i, n) { - (t._initializeIdentity(false), - t.brainCloudClient.authentication.authenticateFacebook( - e, - a, - i, - function (e) { - (t._authResponseHandler(e), n(e)); + reset: function () { + (l.reset.call(this), this._doReset()); }, - )); - }), - (t.authenticateFacebookLimited = function (e, a, i, n) { - (t._initializeIdentity(false), - t.brainCloudClient.authentication.authenticateFacebookLimited( - e, - a, - i, - function (e) { - (t._authResponseHandler(e), n(e)); + process: function (e) { + return (this._append(e), this._process()); }, - )); - }), - (t.authenticateGameCenter = function (e, a, i) { - (t._initializeIdentity(false), - t.brainCloudClient.authentication.authenticateGameCenter( - e, - a, - function (e) { - (t._authResponseHandler(e), i(e)); + finalize: function (e) { + return (e && this._append(e), this._doFinalize()); }, - )); - }), - (t.authenticateApple = function (e, a, i, n) { - (t._initializeIdentity(false), - t.brainCloudClient.authentication.authenticateApple( - e, - a, - i, - function (e) { - (t._authResponseHandler(e), n(e)); + keySize: 4, + ivSize: 4, + _ENC_XFORM_MODE: 1, + _DEC_XFORM_MODE: 2, + _createHelper: (function () { + function e(e) { + return "string" == typeof e ? I : b; + } + return function (t) { + return { + encrypt: function (a, i, n) { + return e(i).encrypt(t, a, i, n); + }, + decrypt: function (a, i, n) { + return e(i).decrypt(t, a, i, n); + }, + }; + }; + })(), + })), + (s.StreamCipher = h.extend({ + _doFinalize: function () { + return this._process(true); + }, + blockSize: 1, + })), + (p = n.mode = {}), + (g = s.BlockCipherMode = + o.extend({ + createEncryptor: function (e, t) { + return this.Encryptor.create(e, t); }, - )); - }), - (t.authenticateUltra = function (e, a, i, n) { - (t._initializeIdentity(false), - t.brainCloudClient.authentication.authenticateUltra( - e, - a, - i, - function (e) { - (t._authResponseHandler(e), n(e)); + createDecryptor: function (e, t) { + return this.Decryptor.create(e, t); }, - )); - }), - (t.authenticateGoogle = function (e, a, i, n) { - (t._initializeIdentity(false), - t.brainCloudClient.authentication.authenticateGoogle( - e, - a, - i, - function (e) { - (t._authResponseHandler(e), n(e)); + init: function (e, t) { + ((this._cipher = e), (this._iv = t)); }, - )); - }), - (t.authenticateGoogleOpenId = function (e, a, i, n) { - (t._initializeIdentity(false), - t.brainCloudClient.authentication.authenticateGoogleOpenId( - e, - a, - i, - function (e) { - (t._authResponseHandler(e), n(e)); + })), + (m = p.CBC = + (function () { + var e = g.extend(); + function t(e, t, a) { + var i, + n = this._iv; + n ? ((i = n), (this._iv = void 0)) : (i = this._prevBlock); + for (var s = 0; s < a; s++) e[t + s] ^= i[s]; + } + return ( + (e.Encryptor = e.extend({ + processBlock: function (e, a) { + var i = this._cipher, + n = i.blockSize; + (t.call(this, e, a, n), + i.encryptBlock(e, a), + (this._prevBlock = e.slice(a, a + n))); + }, + })), + (e.Decryptor = e.extend({ + processBlock: function (e, a) { + var i = this._cipher, + n = i.blockSize, + s = e.slice(a, a + n); + (i.decryptBlock(e, a), + t.call(this, e, a, n), + (this._prevBlock = s)); + }, + })), + e + ); + })()), + (f = (n.pad = {}).Pkcs7 = + { + pad: function (e, t) { + for ( + var a = 4 * t, + i = a - (e.sigBytes % a), + n = (i << 24) | (i << 16) | (i << 8) | i, + s = [], + o = 0; + o < i; + o += 4 + ) + s.push(n); + var l = r.create(s, i); + e.concat(l); + }, + unpad: function (e) { + var t = 255 & e.words[(e.sigBytes - 1) >>> 2]; + e.sigBytes -= t; + }, + }), + (s.BlockCipher = h.extend({ + cfg: h.cfg.extend({ mode: m, padding: f }), + reset: function () { + var e; + h.reset.call(this); + var t = this.cfg, + a = t.iv, + i = t.mode; + (this._xformMode == this._ENC_XFORM_MODE + ? (e = i.createEncryptor) + : ((e = i.createDecryptor), (this._minBufferSize = 1)), + this._mode && this._mode.__creator == e + ? this._mode.init(this, a && a.words) + : ((this._mode = e.call(i, this, a && a.words)), + (this._mode.__creator = e))); + }, + _doProcessBlock: function (e, t) { + this._mode.processBlock(e, t); + }, + _doFinalize: function () { + var e, + t = this.cfg.padding; + return ( + this._xformMode == this._ENC_XFORM_MODE + ? (t.pad(this._data, this.blockSize), + (e = this._process(true))) + : ((e = this._process(true)), t.unpad(e)), + e + ); + }, + blockSize: 4, + })), + (y = s.CipherParams = + o.extend({ + init: function (e) { + this.mixIn(e); }, - )); - }), - (t.authenticateSteam = function (e, a, i, n) { - (t._initializeIdentity(false), - t.brainCloudClient.authentication.authenticateSteam( - e, - a, - i, - function (e) { - (t._authResponseHandler(e), n(e)); + toString: function (e) { + return (e || this.formatter).stringify(this); }, - )); - }), - (t.authenticateTwitter = function (e, a, i, n, s) { - (t._initializeIdentity(false), - t.brainCloudClient.authentication.authenticateTwitter( - e, - a, - i, - n, - function (e) { - (t._authResponseHandler(e), s(e)); + })), + (E = (n.format = {}).OpenSSL = + { + stringify: function (e) { + var t = e.ciphertext, + a = e.salt; + return ( + a + ? r.create([1398893684, 1701076831]).concat(a).concat(t) + : t + ).toString(d); + }, + parse: function (e) { + var t, + a = d.parse(e), + i = a.words; + return ( + 1398893684 == i[0] && + 1701076831 == i[1] && + ((t = r.create(i.slice(2, 4))), + i.splice(0, 4), + (a.sigBytes -= 16)), + y.create({ ciphertext: a, salt: t }) + ); + }, + }), + (b = s.SerializableCipher = + o.extend({ + cfg: o.extend({ format: E }), + encrypt: function (e, t, a, i) { + i = this.cfg.extend(i); + var n = e.createEncryptor(a, i), + s = n.finalize(t), + o = n.cfg; + return y.create({ + ciphertext: s, + key: a, + iv: o.iv, + algorithm: e, + mode: o.mode, + padding: o.padding, + blockSize: e.blockSize, + formatter: i.format, + }); }, - )); - }), - (t.authenticateUniversal = function (e, a, i, n) { - (t._initializeIdentity(false), - t.brainCloudClient.authentication.authenticateUniversal( - e, - a, - i, - function (e) { - (t._authResponseHandler(e), n(e)); + decrypt: function (e, t, a, i) { + return ( + (i = this.cfg.extend(i)), + (t = this._parse(t, i.format)), + e.createDecryptor(a, i).finalize(t.ciphertext) + ); }, - )); - }), - (t.authenticateAdvanced = function (e, a, i, n, s) { - (t._initializeIdentity(false), - t.brainCloudClient.authentication.authenticateAdvanced( - e, - a, - i, - n, - function (e) { - (t._authResponseHandler(e), s(e)); + _parse: function (e, t) { + return "string" == typeof e ? t.parse(e, this) : e; }, - )); - }), - (t.authenticateHandoff = function (e, a, i) { - t.brainCloudClient.authentication.authenticateHandoff( - e, - a, - bc.authentication.AUTHENTICATION_TYPE_HANDOFF, - null, - false, - i, - ); - }), - (t.authenticateSettopHandoff = function (e, a) { - t.brainCloudClient.authentication.authenticateSettopHandoff( - e, - "", - bc.authentication.AUTHENTICATION_TYPE_SETTOP_HANDOFF, - null, - false, - a, - ); - }), - (t.smartSwitchAuthenticateEmailPassword = function (e, a, i, n) { - (t._initializeIdentity(false), - (authenticationCallback = function () { - t.brainCloudClient.authentication.authenticateEmailPassword( - e, - a, - i, - function (e) { - (t._authResponseHandler(e), n(e)); - }, - ); - }), - t.brainCloudClient.identity.getIdentities( - ae(authenticationCallback), - )); - }), - (t.smartSwitchAuthenticateExternal = function (e, a, i, n, s) { - (t._initializeIdentity(false), - (authenticationCallback = function () { - t.brainCloudClient.authentication.authenticateExternal( - e, - a, - n, - function (e) { - (t._authResponseHandler(e), s(e)); - }, - ); - }), - t.brainCloudClient.identity.getIdentities( - ae(authenticationCallback), - )); - }), - (t.smartSwitchAuthenticateFacebook = function (e, a, i, n) { - (t._initializeIdentity(false), - (authenticationCallback = function () { - t.brainCloudClient.authentication.authenticateFacebook( - e, - a, - i, - function (e) { - (t._authResponseHandler(e), n(e)); - }, - ); - }), - t.brainCloudClient.identity.getIdentities( - ae(authenticationCallback), - )); - }), - (t.smartSwitchAuthenticateFacebookLimited = function (e, a, i, n) { - (t._initializeIdentity(false), - (authenticationCallback = function () { - t.brainCloudClient.authentication.authenticateFacebookLimited( - e, - a, - i, - function (e) { - (t._authResponseHandler(e), n(e)); - }, - ); - }), - t.brainCloudClient.identity.getIdentities( - ae(authenticationCallback), - )); - }), - (t.smartSwitchAuthenticateGameCenter = function (e, a, i) { - (t._initializeIdentity(false), - (authenticationCallback = function () { - t.brainCloudClient.authentication.authenticateGameCenter( - e, - a, - function (e) { - (t._authResponseHandler(e), i(e)); - }, + })), + (S = (n.kdf = {}).OpenSSL = + { + execute: function (e, t, a, i) { + i || (i = r.random(8)); + var n = u.create({ keySize: t + a }).compute(e, i), + s = r.create(n.words.slice(t), 4 * a); + return ( + (n.sigBytes = 4 * t), + y.create({ key: n, iv: s, salt: i }) ); - }), - t.brainCloudClient.identity.getIdentities( - ae(authenticationCallback), - )); - }), - (t.smartSwitchAuthenticateGoogle = function (e, a, i, n) { - (t._initializeIdentity(false), - (authenticationCallback = function () { - t.brainCloudClient.authentication.authenticateGoogle( - e, - a, - i, - function (e) { - (t._authResponseHandler(e), n(e)); - }, + }, + }), + (I = s.PasswordBasedCipher = + b.extend({ + cfg: b.cfg.extend({ kdf: S }), + encrypt: function (e, t, a, i) { + var n = (i = this.cfg.extend(i)).kdf.execute( + a, + e.keySize, + e.ivSize, + ); + i.iv = n.iv; + var s = b.encrypt.call(this, e, t, n.key, i); + return (s.mixIn(n), s); + }, + decrypt: function (e, t, a, i) { + ((i = this.cfg.extend(i)), (t = this._parse(t, i.format))); + var n = i.kdf.execute(a, e.keySize, e.ivSize, t.salt); + return ((i.iv = n.iv), b.decrypt.call(this, e, t, n.key, i)); + }, + }))) + )); + }, + 8249: function (e, t, a) { + var i; + e.exports = + ((i = + i || + (function (e, t) { + var i; + if ( + ("undefined" != typeof window && + window.crypto && + (i = window.crypto), + "undefined" != typeof self && self.crypto && (i = self.crypto), + "undefined" != typeof globalThis && + globalThis.crypto && + (i = globalThis.crypto), + !i && + "undefined" != typeof window && + window.msCrypto && + (i = window.msCrypto), + !i && void 0 !== a.g && a.g.crypto && (i = a.g.crypto), + !i) + ) + try { + i = a(2480); + } catch (e) { } + var n = function () { + if (i) { + if ("function" == typeof i.getRandomValues) + try { + return i.getRandomValues(new Uint32Array(1))[0]; + } catch (e) { } + if ("function" == typeof i.randomBytes) + try { + return i.randomBytes(4).readInt32LE(); + } catch (e) { } + } + throw new Error( + "Native crypto module could not be used to get secure random number.", + ); + }, + s = + Object.create || + (function () { + function e() { } + return function (t) { + var a; + return ( + (e.prototype = t), + (a = new e()), + (e.prototype = null), + a + ); + }; + })(), + o = {}, + r = (o.lib = {}), + l = (r.Base = { + extend: function (e) { + var t = s(this); + return ( + e && t.mixIn(e), + (t.hasOwnProperty("init") && this.init !== t.init) || + (t.init = function () { + t.$super.init.apply(this, arguments); + }), + (t.init.prototype = t), + (t.$super = this), + t ); - }), - t.brainCloudClient.identity.getIdentities( - ae(authenticationCallback), - )); - }), - (t.smartSwitchAuthenticateUltra = function (e, a, i, n) { - (t._initializeIdentity(false), - (authenticationCallback = function () { - t.brainCloudClient.authentication.authenticateUltra( - e, - a, - i, - function (e) { - (t._authResponseHandler(e), n(e)); - }, - ); - }), - t.brainCloudClient.identity.getIdentities( - ae(authenticationCallback), - )); - }), - (t.smartSwitchAuthenticateSteam = function (e, a, i, n) { - (t._initializeIdentity(false), - (authenticationCallback = function () { - t.brainCloudClient.authentication.authenticateSteam( - e, - a, - i, - function (e) { - (t._authResponseHandler(e), n(e)); - }, - ); - }), - t.brainCloudClient.identity.getIdentities( - ae(authenticationCallback), - )); - }), - (t.smartSwitchAuthenticateTwitter = function (e, a, i, n, s) { - (t._initializeIdentity(false), - (authenticationCallback = function () { - t.brainCloudClient.authentication.authenticateTwitter( - e, - a, - i, - n, - function (e) { - (t._authResponseHandler(e), s(e)); - }, - ); - }), - t.brainCloudClient.identity.getIdentities( - ae(authenticationCallback), - )); - }), - (t.smartSwitchAuthenticateUniversal = function (e, a, i, n) { - (t._initializeIdentity(false), - (authenticationCallback = function () { - t.brainCloudClient.authentication.authenticateUniversal( - e, - a, - i, - function (e) { - (t._authResponseHandler(e), n(e)); - }, - ); - }), - t.brainCloudClient.identity.getIdentities( - ae(authenticationCallback), - )); - }), - (t.smartSwitchAuthenticateAdvanced = function (e, a, i, n, s) { - (t._initializeIdentity(false), - (authenticationCallback = function () { - t.brainCloudClient.authentication.authenticateAdvanced( - e, - a, - i, - n, - function (e) { - (t._authResponseHandler(e), s(e)); - }, - ); - }), - t.brainCloudClient.identity.getIdentities( - ae(authenticationCallback), - )); - }), - (ae = function (e) { - return ( - (identitiesCallback = function (a) { - if (t.brainCloudClient.isAuthenticated()) - try { - var i = JSON.stringify(a.data.identities); - "{}" === i || "" === i - ? t.brainCloudClient.playerState.deleteUser(e) - : t.brainCloudClient.playerState.logout(e); - } catch (a) { - t.brainCloudClient.playerState.logout(e); - } - else e(); - }), - identitiesCallback - ); - }), - (t.resetEmailPassword = function (e, a) { - t.brainCloudClient.authentication.resetEmailPassword(e, a); - }), - (t.resetEmailPasswordAdvanced = function (e, a, i) { - t.brainCloudClient.authentication.resetEmailPasswordAdvanced( - e, - a, - i, - ); - }), - (t.resetEmailPasswordWithExpiry = function (e, a, i) { - t.brainCloudClient.authentication.resetEmailPasswordWithExpiry( - e, - a, - i, - ); - }), - (t.resetEmailPasswordAdvancedWithExpiry = function (e, a, i, n) { - t.brainCloudClient.authentication.resetEmailPasswordAdvancedWithExpiry( - e, - a, - i, - n, - ); - }), - (t.reconnect = function (e) { - t.authenticateAnonymous(e); - }), - (t.resetUniversalIdPassword = function (e, a) { - t.brainCloudClient.authentication.resetUniversalIdPassword(e, a); - }), - (t.resetUniversalIdPasswordAdvanced = function (e, a, i) { - t.brainCloudClient.authentication.resetUniversalIdPasswordAdvanced( - e, - a, - i, - ); - }), - (t.resetUniversalIdPasswordWithExpiry = function (e, a, i) { - t.brainCloudClient.authentication.resetUniversalIdPasswordWithExpiry( - e, - a, - i, - ); - }), - (t.resetUniversalIdPasswordAdvancedWithExpiry = function ( - e, - a, - i, - n, - ) { - t.brainCloudClient.authentication.resetUniversalIdPasswordAdvancedWithExpiry( - e, - a, - i, - n, - ); - }), - (t.reconnect = function (e) { - t.authenticateAnonymous(e); - }), - (t.restoreSession = function (e) { - console.log("Attempting restoring session with id: " + n); - var a = t.getStoredProfileId(), - i = t.getStoredAnonymousId(); - (t.brainCloudClient.initializeIdentity(a, i), - (t.brainCloudClient.brainCloudManager._isAuthenticated = true), - (t.brainCloudClient.brainCloudManager._packetId = - localStorage.getItem("lastPacketId"))); - var n = t.getStoredSessionId(); - (t.brainCloudClient.brainCloudManager.setSessionId(n), - t.brainCloudClient.time.readServerTime(function (a) { - 200 === a.status - ? t.brainCloudClient.playerState.readUserState(e) - : e(a); - })); - })); - } - (ie.apply((window.brainCloudWrapper = window.brainCloudWrapper || {})), - (t.BrainCloudWrapper = ie), - (t.BrainCloudClient = J)); - }, - 452: function (e, t, a) { - var i; - e.exports = - ((i = a(8249)), - a(8269), - a(8214), - a(888), - a(5109), - (function () { - var e = i, - t = e.lib.BlockCipher, - a = e.algo, - n = [], - s = [], - o = [], - r = [], - l = [], - c = [], - d = [], - u = [], - h = [], - p = []; - !(function () { - for (var e = [], t = 0; t < 256; t++) - e[t] = t < 128 ? t << 1 : (t << 1) ^ 283; - var a = 0, - i = 0; - for (t = 0; t < 256; t++) { - var g = i ^ (i << 1) ^ (i << 2) ^ (i << 3) ^ (i << 4); - ((g = (g >>> 8) ^ (255 & g) ^ 99), (n[a] = g), (s[g] = a)); - var m = e[a], - f = e[m], - y = e[f], - E = (257 * e[g]) ^ (16843008 * g); - ((o[a] = (E << 24) | (E >>> 8)), - (r[a] = (E << 16) | (E >>> 16)), - (l[a] = (E << 8) | (E >>> 24)), - (c[a] = E), - (E = - (16843009 * y) ^ (65537 * f) ^ (257 * m) ^ (16843008 * a)), - (d[g] = (E << 24) | (E >>> 8)), - (u[g] = (E << 16) | (E >>> 16)), - (h[g] = (E << 8) | (E >>> 24)), - (p[g] = E), - a ? ((a = m ^ e[e[e[y ^ m]]]), (i ^= e[e[i]])) : (a = i = 1)); - } - })(); - var g = [0, 1, 2, 4, 8, 16, 32, 64, 128, 27, 54], - m = (a.AES = t.extend({ - _doReset: function () { - if (!this._nRounds || this._keyPriorReset !== this._key) { - for ( - var e = (this._keyPriorReset = this._key), - t = e.words, - a = e.sigBytes / 4, - i = 4 * ((this._nRounds = a + 6) + 1), - s = (this._keySchedule = []), - o = 0; - o < i; - o++ - ) - o < a - ? (s[o] = t[o]) - : ((c = s[o - 1]), - o % a - ? a > 6 && - o % a == 4 && - (c = - (n[c >>> 24] << 24) | - (n[(c >>> 16) & 255] << 16) | - (n[(c >>> 8) & 255] << 8) | - n[255 & c]) - : ((c = - (n[(c = (c << 8) | (c >>> 24)) >>> 24] << 24) | - (n[(c >>> 16) & 255] << 16) | - (n[(c >>> 8) & 255] << 8) | - n[255 & c]), - (c ^= g[(o / a) | 0] << 24)), - (s[o] = s[o - a] ^ c)); - for ( - var r = (this._invKeySchedule = []), l = 0; - l < i; - l++ - ) { - if (((o = i - l), l % 4)) var c = s[o]; - else c = s[o - 4]; - r[l] = - l < 4 || o <= 4 - ? c - : d[n[c >>> 24]] ^ - u[n[(c >>> 16) & 255]] ^ - h[n[(c >>> 8) & 255]] ^ - p[n[255 & c]]; + }, + create: function () { + var e = this.extend(); + return (e.init.apply(e, arguments), e); + }, + init: function () { }, + mixIn: function (e) { + for (var t in e) e.hasOwnProperty(t) && (this[t] = e[t]); + e.hasOwnProperty("toString") && + (this.toString = e.toString); + }, + clone: function () { + return this.init.prototype.extend(this); + }, + }), + c = (r.WordArray = l.extend({ + init: function (e, t) { + ((e = this.words = e || []), + (this.sigBytes = null != t ? t : 4 * e.length)); + }, + toString: function (e) { + return (e || u).stringify(this); + }, + concat: function (e) { + var t = this.words, + a = e.words, + i = this.sigBytes, + n = e.sigBytes; + if ((this.clamp(), i % 4)) + for (var s = 0; s < n; s++) { + var o = (a[s >>> 2] >>> (24 - (s % 4) * 8)) & 255; + t[(i + s) >>> 2] |= o << (24 - ((i + s) % 4) * 8); } - } + else + for (var r = 0; r < n; r += 4) + t[(i + r) >>> 2] = a[r >>> 2]; + return ((this.sigBytes += n), this); }, - encryptBlock: function (e, t) { - this._doCryptBlock(e, t, this._keySchedule, o, r, l, c, n); + clamp: function () { + var t = this.words, + a = this.sigBytes; + ((t[a >>> 2] &= 4294967295 << (32 - (a % 4) * 8)), + (t.length = e.ceil(a / 4))); }, - decryptBlock: function (e, t) { - var a = e[t + 1]; - ((e[t + 1] = e[t + 3]), - (e[t + 3] = a), - this._doCryptBlock( - e, - t, - this._invKeySchedule, - d, - u, - h, - p, - s, - ), - (a = e[t + 1]), - (e[t + 1] = e[t + 3]), - (e[t + 3] = a)); + clone: function () { + var e = l.clone.call(this); + return ((e.words = this.words.slice(0)), e); }, - _doCryptBlock: function (e, t, a, i, n, s, o, r) { + random: function (e) { + for (var t = [], a = 0; a < e; a += 4) t.push(n()); + return new c.init(t, e); + }, + })), + d = (o.enc = {}), + u = (d.Hex = { + stringify: function (e) { for ( - var l = this._nRounds, - c = e[t] ^ a[0], - d = e[t + 1] ^ a[1], - u = e[t + 2] ^ a[2], - h = e[t + 3] ^ a[3], - p = 4, - g = 1; - g < l; - g++ + var t = e.words, a = e.sigBytes, i = [], n = 0; + n < a; + n++ ) { - var m = - i[c >>> 24] ^ - n[(d >>> 16) & 255] ^ - s[(u >>> 8) & 255] ^ - o[255 & h] ^ - a[p++], - f = - i[d >>> 24] ^ - n[(u >>> 16) & 255] ^ - s[(h >>> 8) & 255] ^ - o[255 & c] ^ - a[p++], - y = - i[u >>> 24] ^ - n[(h >>> 16) & 255] ^ - s[(c >>> 8) & 255] ^ - o[255 & d] ^ - a[p++], - E = - i[h >>> 24] ^ - n[(c >>> 16) & 255] ^ - s[(d >>> 8) & 255] ^ - o[255 & u] ^ - a[p++]; - ((c = m), (d = f), (u = y), (h = E)); + var s = (t[n >>> 2] >>> (24 - (n % 4) * 8)) & 255; + (i.push((s >>> 4).toString(16)), + i.push((15 & s).toString(16))); } - ((m = - ((r[c >>> 24] << 24) | - (r[(d >>> 16) & 255] << 16) | - (r[(u >>> 8) & 255] << 8) | - r[255 & h]) ^ - a[p++]), - (f = - ((r[d >>> 24] << 24) | - (r[(u >>> 16) & 255] << 16) | - (r[(h >>> 8) & 255] << 8) | - r[255 & c]) ^ - a[p++]), - (y = - ((r[u >>> 24] << 24) | - (r[(h >>> 16) & 255] << 16) | - (r[(c >>> 8) & 255] << 8) | - r[255 & d]) ^ - a[p++]), - (E = - ((r[h >>> 24] << 24) | - (r[(c >>> 16) & 255] << 16) | - (r[(d >>> 8) & 255] << 8) | - r[255 & u]) ^ - a[p++]), - (e[t] = m), - (e[t + 1] = f), - (e[t + 2] = y), - (e[t + 3] = E)); - }, - keySize: 8, - })); - e.AES = t._createHelper(m); - })(), - i.AES); - }, - 5109: function (e, t, a) { - var i, n, s, o, r, l, c, d, u, h, p, g, m, f, y, E, b, S, I; - e.exports = - ((i = a(8249)), - a(888), - void ( - i.lib.Cipher || - ((n = i), - (s = n.lib), - (o = s.Base), - (r = s.WordArray), - (l = s.BufferedBlockAlgorithm), - (c = n.enc), - c.Utf8, - (d = c.Base64), - (u = n.algo.EvpKDF), - (h = s.Cipher = - l.extend({ - cfg: o.extend(), - createEncryptor: function (e, t) { - return this.create(this._ENC_XFORM_MODE, e, t); - }, - createDecryptor: function (e, t) { - return this.create(this._DEC_XFORM_MODE, e, t); - }, - init: function (e, t, a) { - ((this.cfg = this.cfg.extend(a)), - (this._xformMode = e), - (this._key = t), - this.reset()); - }, - reset: function () { - (l.reset.call(this), this._doReset()); - }, - process: function (e) { - return (this._append(e), this._process()); - }, - finalize: function (e) { - return (e && this._append(e), this._doFinalize()); - }, - keySize: 4, - ivSize: 4, - _ENC_XFORM_MODE: 1, - _DEC_XFORM_MODE: 2, - _createHelper: (function () { - function e(e) { - return "string" == typeof e ? I : b; - } - return function (t) { - return { - encrypt: function (a, i, n) { - return e(i).encrypt(t, a, i, n); - }, - decrypt: function (a, i, n) { - return e(i).decrypt(t, a, i, n); - }, - }; - }; - })(), - })), - (s.StreamCipher = h.extend({ - _doFinalize: function () { - return this._process(true); - }, - blockSize: 1, - })), - (p = n.mode = {}), - (g = s.BlockCipherMode = - o.extend({ - createEncryptor: function (e, t) { - return this.Encryptor.create(e, t); - }, - createDecryptor: function (e, t) { - return this.Decryptor.create(e, t); - }, - init: function (e, t) { - ((this._cipher = e), (this._iv = t)); - }, - })), - (m = p.CBC = - (function () { - var e = g.extend(); - function t(e, t, a) { - var i, - n = this._iv; - n ? ((i = n), (this._iv = void 0)) : (i = this._prevBlock); - for (var s = 0; s < a; s++) e[t + s] ^= i[s]; - } - return ( - (e.Encryptor = e.extend({ - processBlock: function (e, a) { - var i = this._cipher, - n = i.blockSize; - (t.call(this, e, a, n), - i.encryptBlock(e, a), - (this._prevBlock = e.slice(a, a + n))); - }, - })), - (e.Decryptor = e.extend({ - processBlock: function (e, a) { - var i = this._cipher, - n = i.blockSize, - s = e.slice(a, a + n); - (i.decryptBlock(e, a), - t.call(this, e, a, n), - (this._prevBlock = s)); - }, - })), - e - ); - })()), - (f = (n.pad = {}).Pkcs7 = - { - pad: function (e, t) { - for ( - var a = 4 * t, - i = a - (e.sigBytes % a), - n = (i << 24) | (i << 16) | (i << 8) | i, - s = [], - o = 0; - o < i; - o += 4 - ) - s.push(n); - var l = r.create(s, i); - e.concat(l); + return i.join(""); }, - unpad: function (e) { - var t = 255 & e.words[(e.sigBytes - 1) >>> 2]; - e.sigBytes -= t; + parse: function (e) { + for (var t = e.length, a = [], i = 0; i < t; i += 2) + a[i >>> 3] |= + parseInt(e.substr(i, 2), 16) << (24 - (i % 8) * 4); + return new c.init(a, t / 2); }, }), - (s.BlockCipher = h.extend({ - cfg: h.cfg.extend({ mode: m, padding: f }), - reset: function () { - var e; - h.reset.call(this); - var t = this.cfg, - a = t.iv, - i = t.mode; - (this._xformMode == this._ENC_XFORM_MODE - ? (e = i.createEncryptor) - : ((e = i.createDecryptor), (this._minBufferSize = 1)), - this._mode && this._mode.__creator == e - ? this._mode.init(this, a && a.words) - : ((this._mode = e.call(i, this, a && a.words)), - (this._mode.__creator = e))); - }, - _doProcessBlock: function (e, t) { - this._mode.processBlock(e, t); - }, - _doFinalize: function () { - var e, - t = this.cfg.padding; - return ( - this._xformMode == this._ENC_XFORM_MODE - ? (t.pad(this._data, this.blockSize), - (e = this._process(true))) - : ((e = this._process(true)), t.unpad(e)), - e - ); - }, - blockSize: 4, - })), - (y = s.CipherParams = - o.extend({ - init: function (e) { - this.mixIn(e); - }, - toString: function (e) { - return (e || this.formatter).stringify(this); - }, - })), - (E = (n.format = {}).OpenSSL = - { + h = (d.Latin1 = { stringify: function (e) { - var t = e.ciphertext, - a = e.salt; - return ( - a - ? r.create([1398893684, 1701076831]).concat(a).concat(t) - : t - ).toString(d); + for ( + var t = e.words, a = e.sigBytes, i = [], n = 0; + n < a; + n++ + ) { + var s = (t[n >>> 2] >>> (24 - (n % 4) * 8)) & 255; + i.push(String.fromCharCode(s)); + } + return i.join(""); }, parse: function (e) { - var t, - a = d.parse(e), - i = a.words; - return ( - 1398893684 == i[0] && - 1701076831 == i[1] && - ((t = r.create(i.slice(2, 4))), - i.splice(0, 4), - (a.sigBytes -= 16)), - y.create({ ciphertext: a, salt: t }) - ); + for (var t = e.length, a = [], i = 0; i < t; i++) + a[i >>> 2] |= + (255 & e.charCodeAt(i)) << (24 - (i % 4) * 8); + return new c.init(a, t); }, }), - (b = s.SerializableCipher = - o.extend({ - cfg: o.extend({ format: E }), - encrypt: function (e, t, a, i) { - i = this.cfg.extend(i); - var n = e.createEncryptor(a, i), - s = n.finalize(t), - o = n.cfg; - return y.create({ - ciphertext: s, - key: a, - iv: o.iv, - algorithm: e, - mode: o.mode, - padding: o.padding, - blockSize: e.blockSize, - formatter: i.format, - }); - }, - decrypt: function (e, t, a, i) { - return ( - (i = this.cfg.extend(i)), - (t = this._parse(t, i.format)), - e.createDecryptor(a, i).finalize(t.ciphertext) - ); - }, - _parse: function (e, t) { - return "string" == typeof e ? t.parse(e, this) : e; + p = (d.Utf8 = { + stringify: function (e) { + try { + return decodeURIComponent(escape(h.stringify(e))); + } catch (e) { + throw new Error("Malformed UTF-8 data"); + } }, - })), - (S = (n.kdf = {}).OpenSSL = - { - execute: function (e, t, a, i) { - i || (i = r.random(8)); - var n = u.create({ keySize: t + a }).compute(e, i), - s = r.create(n.words.slice(t), 4 * a); - return ( - (n.sigBytes = 4 * t), - y.create({ key: n, iv: s, salt: i }) - ); + parse: function (e) { + return h.parse(unescape(encodeURIComponent(e))); }, }), - (I = s.PasswordBasedCipher = - b.extend({ - cfg: b.cfg.extend({ kdf: S }), - encrypt: function (e, t, a, i) { - var n = (i = this.cfg.extend(i)).kdf.execute( - a, - e.keySize, - e.ivSize, - ); - i.iv = n.iv; - var s = b.encrypt.call(this, e, t, n.key, i); - return (s.mixIn(n), s); + g = (r.BufferedBlockAlgorithm = l.extend({ + reset: function () { + ((this._data = new c.init()), (this._nDataBytes = 0)); }, - decrypt: function (e, t, a, i) { - ((i = this.cfg.extend(i)), (t = this._parse(t, i.format))); - var n = i.kdf.execute(a, e.keySize, e.ivSize, t.salt); - return ((i.iv = n.iv), b.decrypt.call(this, e, t, n.key, i)); + _append: function (e) { + ("string" == typeof e && (e = p.parse(e)), + this._data.concat(e), + (this._nDataBytes += e.sigBytes)); }, - }))) - )); - }, - 8249: function (e, t, a) { - var i; - e.exports = - ((i = - i || - (function (e, t) { - var i; - if ( - ("undefined" != typeof window && - window.crypto && - (i = window.crypto), - "undefined" != typeof self && self.crypto && (i = self.crypto), - "undefined" != typeof globalThis && - globalThis.crypto && - (i = globalThis.crypto), - !i && - "undefined" != typeof window && - window.msCrypto && - (i = window.msCrypto), - !i && void 0 !== a.g && a.g.crypto && (i = a.g.crypto), - !i) - ) - try { - i = a(2480); - } catch (e) {} - var n = function () { - if (i) { - if ("function" == typeof i.getRandomValues) - try { - return i.getRandomValues(new Uint32Array(1))[0]; - } catch (e) {} - if ("function" == typeof i.randomBytes) - try { - return i.randomBytes(4).readInt32LE(); - } catch (e) {} + _process: function (t) { + var a, + i = this._data, + n = i.words, + s = i.sigBytes, + o = this.blockSize, + r = s / (4 * o), + l = + (r = t + ? e.ceil(r) + : e.max((0 | r) - this._minBufferSize, 0)) * o, + d = e.min(4 * l, s); + if (l) { + for (var u = 0; u < l; u += o) this._doProcessBlock(n, u); + ((a = n.splice(0, l)), (i.sigBytes -= d)); } - throw new Error( - "Native crypto module could not be used to get secure random number.", - ); + return new c.init(a, d); }, - s = - Object.create || - (function () { - function e() {} - return function (t) { - var a; - return ( - (e.prototype = t), - (a = new e()), - (e.prototype = null), - a - ); - }; - })(), - o = {}, - r = (o.lib = {}), - l = (r.Base = { - extend: function (e) { - var t = s(this); - return ( - e && t.mixIn(e), - (t.hasOwnProperty("init") && this.init !== t.init) || - (t.init = function () { - t.$super.init.apply(this, arguments); - }), - (t.init.prototype = t), - (t.$super = this), - t - ); - }, - create: function () { - var e = this.extend(); - return (e.init.apply(e, arguments), e); - }, - init: function () {}, - mixIn: function (e) { - for (var t in e) e.hasOwnProperty(t) && (this[t] = e[t]); - e.hasOwnProperty("toString") && - (this.toString = e.toString); - }, - clone: function () { - return this.init.prototype.extend(this); - }, - }), - c = (r.WordArray = l.extend({ - init: function (e, t) { - ((e = this.words = e || []), - (this.sigBytes = null != t ? t : 4 * e.length)); - }, - toString: function (e) { - return (e || u).stringify(this); - }, - concat: function (e) { - var t = this.words, - a = e.words, - i = this.sigBytes, - n = e.sigBytes; - if ((this.clamp(), i % 4)) - for (var s = 0; s < n; s++) { - var o = (a[s >>> 2] >>> (24 - (s % 4) * 8)) & 255; - t[(i + s) >>> 2] |= o << (24 - ((i + s) % 4) * 8); - } - else - for (var r = 0; r < n; r += 4) - t[(i + r) >>> 2] = a[r >>> 2]; - return ((this.sigBytes += n), this); - }, - clamp: function () { - var t = this.words, - a = this.sigBytes; - ((t[a >>> 2] &= 4294967295 << (32 - (a % 4) * 8)), - (t.length = e.ceil(a / 4))); - }, - clone: function () { - var e = l.clone.call(this); - return ((e.words = this.words.slice(0)), e); - }, - random: function (e) { - for (var t = [], a = 0; a < e; a += 4) t.push(n()); - return new c.init(t, e); - }, - })), - d = (o.enc = {}), - u = (d.Hex = { - stringify: function (e) { - for ( - var t = e.words, a = e.sigBytes, i = [], n = 0; - n < a; - n++ - ) { - var s = (t[n >>> 2] >>> (24 - (n % 4) * 8)) & 255; - (i.push((s >>> 4).toString(16)), - i.push((15 & s).toString(16))); - } - return i.join(""); - }, - parse: function (e) { - for (var t = e.length, a = [], i = 0; i < t; i += 2) - a[i >>> 3] |= - parseInt(e.substr(i, 2), 16) << (24 - (i % 8) * 4); - return new c.init(a, t / 2); - }, - }), - h = (d.Latin1 = { - stringify: function (e) { - for ( - var t = e.words, a = e.sigBytes, i = [], n = 0; - n < a; - n++ - ) { - var s = (t[n >>> 2] >>> (24 - (n % 4) * 8)) & 255; - i.push(String.fromCharCode(s)); - } - return i.join(""); - }, - parse: function (e) { - for (var t = e.length, a = [], i = 0; i < t; i++) - a[i >>> 2] |= - (255 & e.charCodeAt(i)) << (24 - (i % 4) * 8); - return new c.init(a, t); - }, - }), - p = (d.Utf8 = { - stringify: function (e) { - try { - return decodeURIComponent(escape(h.stringify(e))); - } catch (e) { - throw new Error("Malformed UTF-8 data"); - } - }, - parse: function (e) { - return h.parse(unescape(encodeURIComponent(e))); + clone: function () { + var e = l.clone.call(this); + return ((e._data = this._data.clone()), e); + }, + _minBufferSize: 0, + })), + m = + ((r.Hasher = g.extend({ + cfg: l.extend(), + init: function (e) { + ((this.cfg = this.cfg.extend(e)), this.reset()); }, - }), - g = (r.BufferedBlockAlgorithm = l.extend({ reset: function () { - ((this._data = new c.init()), (this._nDataBytes = 0)); + (g.reset.call(this), this._doReset()); }, - _append: function (e) { - ("string" == typeof e && (e = p.parse(e)), - this._data.concat(e), - (this._nDataBytes += e.sigBytes)); + update: function (e) { + return (this._append(e), this._process(), this); }, - _process: function (t) { - var a, - i = this._data, - n = i.words, - s = i.sigBytes, - o = this.blockSize, - r = s / (4 * o), - l = - (r = t - ? e.ceil(r) - : e.max((0 | r) - this._minBufferSize, 0)) * o, - d = e.min(4 * l, s); - if (l) { - for (var u = 0; u < l; u += o) this._doProcessBlock(n, u); - ((a = n.splice(0, l)), (i.sigBytes -= d)); - } - return new c.init(a, d); + finalize: function (e) { + return (e && this._append(e), this._doFinalize()); }, - clone: function () { - var e = l.clone.call(this); - return ((e._data = this._data.clone()), e); + blockSize: 16, + _createHelper: function (e) { + return function (t, a) { + return new e.init(a).finalize(t); + }; + }, + _createHmacHelper: function (e) { + return function (t, a) { + return new m.HMAC.init(e, a).finalize(t); + }; }, - _minBufferSize: 0, })), - m = - ((r.Hasher = g.extend({ - cfg: l.extend(), - init: function (e) { - ((this.cfg = this.cfg.extend(e)), this.reset()); - }, - reset: function () { - (g.reset.call(this), this._doReset()); - }, - update: function (e) { - return (this._append(e), this._process(), this); - }, - finalize: function (e) { - return (e && this._append(e), this._doFinalize()); - }, - blockSize: 16, - _createHelper: function (e) { - return function (t, a) { - return new e.init(a).finalize(t); - }; - }, - _createHmacHelper: function (e) { - return function (t, a) { - return new m.HMAC.init(e, a).finalize(t); - }; - }, - })), (o.algo = {})); - return o; - })(Math)), + return o; + })(Math)), i); - }, - 8269: function (e, t, a) { - var i, n, s; - e.exports = - ((i = a(8249)), + }, + 8269: function (e, t, a) { + var i, n, s; + e.exports = + ((i = a(8249)), (s = (n = i).lib.WordArray), (n.enc.Base64 = { stringify: function (e) { @@ -9827,18 +9827,18 @@ var version = "v1.17.2"; for (var n = [], s = 0; s < a; s += 3) for ( var o = - (((t[s >>> 2] >>> (24 - (s % 4) * 8)) & 255) << 16) | - (((t[(s + 1) >>> 2] >>> (24 - ((s + 1) % 4) * 8)) & - 255) << - 8) | - ((t[(s + 2) >>> 2] >>> (24 - ((s + 2) % 4) * 8)) & 255), - r = 0; + (((t[s >>> 2] >>> (24 - (s % 4) * 8)) & 255) << 16) | + (((t[(s + 1) >>> 2] >>> (24 - ((s + 1) % 4) * 8)) & + 255) << + 8) | + ((t[(s + 2) >>> 2] >>> (24 - ((s + 2) % 4) * 8)) & 255), + r = 0; r < 4 && s + 0.75 * r < a; r++ ) n.push(i.charAt((o >>> (6 * (3 - r))) & 63)); var l = i.charAt(64); - if (l) for (; n.length % 4; ) n.push(l); + if (l) for (; n.length % 4;) n.push(l); return n.join(""); }, parse: function (e) { @@ -9868,11 +9868,11 @@ var version = "v1.17.2"; _map: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", }), i.enc.Base64); - }, - 3786: function (e, t, a) { - var i, n, s; - e.exports = - ((i = a(8249)), + }, + 3786: function (e, t, a) { + var i, n, s; + e.exports = + ((i = a(8249)), (s = (n = i).lib.WordArray), (n.enc.Base64url = { stringify: function (e, t = true) { @@ -9883,18 +9883,18 @@ var version = "v1.17.2"; for (var s = [], o = 0; o < i; o += 3) for ( var r = - (((a[o >>> 2] >>> (24 - (o % 4) * 8)) & 255) << 16) | - (((a[(o + 1) >>> 2] >>> (24 - ((o + 1) % 4) * 8)) & - 255) << - 8) | - ((a[(o + 2) >>> 2] >>> (24 - ((o + 2) % 4) * 8)) & 255), - l = 0; + (((a[o >>> 2] >>> (24 - (o % 4) * 8)) & 255) << 16) | + (((a[(o + 1) >>> 2] >>> (24 - ((o + 1) % 4) * 8)) & + 255) << + 8) | + ((a[(o + 2) >>> 2] >>> (24 - ((o + 2) % 4) * 8)) & 255), + l = 0; l < 4 && o + 0.75 * l < i; l++ ) s.push(n.charAt((r >>> (6 * (3 - l))) & 63)); var c = n.charAt(64); - if (c) for (; s.length % 4; ) s.push(c); + if (c) for (; s.length % 4;) s.push(c); return s.join(""); }, parse: function (e, t = true) { @@ -9926,11 +9926,11 @@ var version = "v1.17.2"; "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_", }), i.enc.Base64url); - }, - 298: function (e, t, a) { - var i; - e.exports = - ((i = a(8249)), + }, + 298: function (e, t, a) { + var i; + e.exports = + ((i = a(8249)), (function () { var e = i, t = e.lib.WordArray, @@ -9939,24 +9939,24 @@ var version = "v1.17.2"; return ((e << 8) & 4278255360) | ((e >>> 8) & 16711935); } ((a.Utf16 = a.Utf16BE = - { - stringify: function (e) { - for ( - var t = e.words, a = e.sigBytes, i = [], n = 0; - n < a; - n += 2 - ) { - var s = (t[n >>> 2] >>> (16 - (n % 4) * 8)) & 65535; - i.push(String.fromCharCode(s)); - } - return i.join(""); - }, - parse: function (e) { - for (var a = e.length, i = [], n = 0; n < a; n++) - i[n >>> 1] |= e.charCodeAt(n) << (16 - (n % 2) * 16); - return t.create(i, 2 * a); - }, - }), + { + stringify: function (e) { + for ( + var t = e.words, a = e.sigBytes, i = [], n = 0; + n < a; + n += 2 + ) { + var s = (t[n >>> 2] >>> (16 - (n % 4) * 8)) & 65535; + i.push(String.fromCharCode(s)); + } + return i.join(""); + }, + parse: function (e) { + for (var a = e.length, i = [], n = 0; n < a; n++) + i[n >>> 1] |= e.charCodeAt(n) << (16 - (n % 2) * 16); + return t.create(i, 2 * a); + }, + }), (a.Utf16LE = { stringify: function (e) { for ( @@ -9977,11 +9977,11 @@ var version = "v1.17.2"; })); })(), i.enc.Utf16); - }, - 888: function (e, t, a) { - var i, n, s, o, r, l, c, d; - e.exports = - ((d = a(8249)), + }, + 888: function (e, t, a) { + var i, n, s, o, r, l, c, d; + e.exports = + ((d = a(8249)), a(2783), a(9824), (s = (n = (i = d).lib).Base), @@ -9996,12 +9996,12 @@ var version = "v1.17.2"; compute: function (e, t) { for ( var a, - i = this.cfg, - n = i.hasher.create(), - s = o.create(), - r = s.words, - l = i.keySize, - c = i.iterations; + i = this.cfg, + n = i.hasher.create(), + s = o.create(), + r = s.words, + l = i.keySize, + c = i.iterations; r.length < l; ) { (a && n.update(a), (a = n.update(e).finalize(t)), n.reset()); @@ -10015,11 +10015,11 @@ var version = "v1.17.2"; return c.create(a).compute(e, t); }), d.EvpKDF); - }, - 2209: function (e, t, a) { - var i, n, s, o; - e.exports = - ((o = a(8249)), + }, + 2209: function (e, t, a) { + var i, n, s, o; + e.exports = + ((o = a(8249)), a(5109), (n = (i = o).lib.CipherParams), (s = i.enc.Hex), @@ -10033,11 +10033,11 @@ var version = "v1.17.2"; }, }), o.format.Hex); - }, - 9824: function (e, t, a) { - var i, n, s; - e.exports = - ((n = (i = a(8249)).lib.Base), + }, + 9824: function (e, t, a) { + var i, n, s; + e.exports = + ((n = (i = a(8249)).lib.Base), (s = i.enc.Utf8), void (i.algo.HMAC = n.extend({ init: function (e, t) { @@ -10048,10 +10048,10 @@ var version = "v1.17.2"; (t.sigBytes > i && (t = e.finalize(t)), t.clamp()); for ( var n = (this._oKey = t.clone()), - o = (this._iKey = t.clone()), - r = n.words, - l = o.words, - c = 0; + o = (this._iKey = t.clone()), + r = n.words, + l = o.words, + c = 0; c < a; c++ ) @@ -10071,11 +10071,11 @@ var version = "v1.17.2"; return (t.reset(), t.finalize(this._oKey.clone().concat(a))); }, }))); - }, - 1354: function (e, t, a) { - var i; - e.exports = - ((i = a(8249)), + }, + 1354: function (e, t, a) { + var i; + e.exports = + ((i = a(8249)), a(4938), a(4433), a(298), @@ -10110,11 +10110,11 @@ var version = "v1.17.2"; a(4454), a(3974), i); - }, - 4433: function (e, t, a) { - var i; - e.exports = - ((i = a(8249)), + }, + 4433: function (e, t, a) { + var i; + e.exports = + ((i = a(8249)), (function () { if ("function" == typeof ArrayBuffer) { var e = i.lib.WordArray, @@ -10122,21 +10122,21 @@ var version = "v1.17.2"; a = (e.init = function (e) { if ( (e instanceof ArrayBuffer && (e = new Uint8Array(e)), - (e instanceof Int8Array || - ("undefined" != typeof Uint8ClampedArray && - e instanceof Uint8ClampedArray) || - e instanceof Int16Array || - e instanceof Uint16Array || - e instanceof Int32Array || - e instanceof Uint32Array || - e instanceof Float32Array || - e instanceof Float64Array) && + (e instanceof Int8Array || + ("undefined" != typeof Uint8ClampedArray && + e instanceof Uint8ClampedArray) || + e instanceof Int16Array || + e instanceof Uint16Array || + e instanceof Int32Array || + e instanceof Uint32Array || + e instanceof Float32Array || + e instanceof Float64Array) && (e = new Uint8Array( e.buffer, e.byteOffset, e.byteLength, )), - e instanceof Uint8Array) + e instanceof Uint8Array) ) { for (var a = e.byteLength, i = [], n = 0; n < a; n++) i[n >>> 2] |= e[n] << (24 - (n % 4) * 8); @@ -10147,11 +10147,11 @@ var version = "v1.17.2"; } })(), i.lib.WordArray); - }, - 8214: function (e, t, a) { - var i; - e.exports = - ((i = a(8249)), + }, + 8214: function (e, t, a) { + var i; + e.exports = + ((i = a(8249)), (function (e) { var t = i, a = t.lib, @@ -10337,11 +10337,11 @@ var version = "v1.17.2"; (t.HmacMD5 = s._createHmacHelper(l))); })(Math), i.MD5); - }, - 8568: function (e, t, a) { - var i; - e.exports = - ((i = a(8249)), + }, + 8568: function (e, t, a) { + var i; + e.exports = + ((i = a(8249)), a(5109), (i.mode.CFB = (function () { var e = i.lib.BlockCipherMode.extend(); @@ -10375,11 +10375,11 @@ var version = "v1.17.2"; ); })()), i.mode.CFB); - }, - 9968: function (e, t, a) { - var i; - e.exports = - ((i = a(8249)), + }, + 9968: function (e, t, a) { + var i; + e.exports = + ((i = a(8249)), a(5109), (i.mode.CTRGladman = (function () { var e = i.lib.BlockCipherMode.extend(); @@ -10417,11 +10417,11 @@ var version = "v1.17.2"; return ((e.Decryptor = a), e); })()), i.mode.CTRGladman); - }, - 4242: function (e, t, a) { - var i, n, s; - e.exports = - ((s = a(8249)), + }, + 4242: function (e, t, a) { + var i, n, s; + e.exports = + ((s = a(8249)), a(5109), (s.mode.CTR = ((n = (i = s.lib.BlockCipherMode.extend()).Encryptor = @@ -10437,14 +10437,14 @@ var version = "v1.17.2"; for (var r = 0; r < i; r++) e[t + r] ^= o[r]; }, })), - (i.Decryptor = n), - i)), + (i.Decryptor = n), + i)), s.mode.CTR); - }, - 1148: function (e, t, a) { - var i, n; - e.exports = - ((n = a(8249)), + }, + 1148: function (e, t, a) { + var i, n; + e.exports = + ((n = a(8249)), a(5109), (n.mode.ECB = (((i = n.lib.BlockCipherMode.extend()).Encryptor = i.extend({ @@ -10452,18 +10452,18 @@ var version = "v1.17.2"; this._cipher.encryptBlock(e, t); }, })), - (i.Decryptor = i.extend({ - processBlock: function (e, t) { - this._cipher.decryptBlock(e, t); - }, - })), - i)), + (i.Decryptor = i.extend({ + processBlock: function (e, t) { + this._cipher.decryptBlock(e, t); + }, + })), + i)), n.mode.ECB); - }, - 7660: function (e, t, a) { - var i, n, s; - e.exports = - ((s = a(8249)), + }, + 7660: function (e, t, a) { + var i, n, s; + e.exports = + ((s = a(8249)), a(5109), (s.mode.OFB = ((n = (i = s.lib.BlockCipherMode.extend()).Encryptor = @@ -10479,14 +10479,14 @@ var version = "v1.17.2"; for (var o = 0; o < i; o++) e[t + o] ^= s[o]; }, })), - (i.Decryptor = n), - i)), + (i.Decryptor = n), + i)), s.mode.OFB); - }, - 3615: function (e, t, a) { - var i; - e.exports = - ((i = a(8249)), + }, + 3615: function (e, t, a) { + var i; + e.exports = + ((i = a(8249)), a(5109), (i.pad.AnsiX923 = { pad: function (e, t) { @@ -10504,11 +10504,11 @@ var version = "v1.17.2"; }, }), i.pad.Ansix923); - }, - 2807: function (e, t, a) { - var i; - e.exports = - ((i = a(8249)), + }, + 2807: function (e, t, a) { + var i; + e.exports = + ((i = a(8249)), a(5109), (i.pad.Iso10126 = { pad: function (e, t) { @@ -10524,11 +10524,11 @@ var version = "v1.17.2"; }, }), i.pad.Iso10126); - }, - 1077: function (e, t, a) { - var i; - e.exports = - ((i = a(8249)), + }, + 1077: function (e, t, a) { + var i; + e.exports = + ((i = a(8249)), a(5109), (i.pad.Iso97971 = { pad: function (e, t) { @@ -10540,19 +10540,19 @@ var version = "v1.17.2"; }, }), i.pad.Iso97971); - }, - 6991: function (e, t, a) { - var i; - e.exports = - ((i = a(8249)), + }, + 6991: function (e, t, a) { + var i; + e.exports = + ((i = a(8249)), a(5109), - (i.pad.NoPadding = { pad: function () {}, unpad: function () {} }), + (i.pad.NoPadding = { pad: function () { }, unpad: function () { } }), i.pad.NoPadding); - }, - 6475: function (e, t, a) { - var i; - e.exports = - ((i = a(8249)), + }, + 6475: function (e, t, a) { + var i; + e.exports = + ((i = a(8249)), a(5109), (i.pad.ZeroPadding = { pad: function (e, t) { @@ -10570,11 +10570,11 @@ var version = "v1.17.2"; }, }), i.pad.ZeroPadding); - }, - 2112: function (e, t, a) { - var i, n, s, o, r, l, c, d, u; - e.exports = - ((u = a(8249)), + }, + 2112: function (e, t, a) { + var i, n, s, o, r, l, c, d, u; + e.exports = + ((u = a(8249)), a(2783), a(9824), (s = (n = (i = u).lib).Base), @@ -10590,13 +10590,13 @@ var version = "v1.17.2"; compute: function (e, t) { for ( var a = this.cfg, - i = c.create(a.hasher, e), - n = o.create(), - s = o.create([1]), - r = n.words, - l = s.words, - d = a.keySize, - u = a.iterations; + i = c.create(a.hasher, e), + n = o.create(), + s = o.create([1]), + r = n.words, + l = s.words, + d = a.keySize, + u = a.iterations; r.length < d; ) { var h = i.update(t).finalize(s); @@ -10618,11 +10618,11 @@ var version = "v1.17.2"; return d.create(a).compute(e, t); }), u.PBKDF2); - }, - 3974: function (e, t, a) { - var i; - e.exports = - ((i = a(8249)), + }, + 3974: function (e, t, a) { + var i; + e.exports = + ((i = a(8249)), a(8269), a(8214), a(888), @@ -10675,14 +10675,14 @@ var version = "v1.17.2"; h = (d << 16) | (65535 & c); for ( i[0] ^= c, - i[1] ^= u, - i[2] ^= d, - i[3] ^= h, - i[4] ^= c, - i[5] ^= u, - i[6] ^= d, - i[7] ^= h, - n = 0; + i[1] ^= u, + i[2] ^= d, + i[3] ^= h, + i[4] ^= c, + i[5] ^= u, + i[6] ^= d, + i[7] ^= h, + n = 0; n < 4; n++ ) @@ -10709,22 +10709,22 @@ var version = "v1.17.2"; for (var e = this._X, t = this._C, a = 0; a < 8; a++) s[a] = t[a]; for ( t[0] = (t[0] + 1295307597 + this._b) | 0, - t[1] = - (t[1] + 3545052371 + (t[0] >>> 0 < s[0] >>> 0 ? 1 : 0)) | 0, - t[2] = - (t[2] + 886263092 + (t[1] >>> 0 < s[1] >>> 0 ? 1 : 0)) | 0, - t[3] = - (t[3] + 1295307597 + (t[2] >>> 0 < s[2] >>> 0 ? 1 : 0)) | 0, - t[4] = - (t[4] + 3545052371 + (t[3] >>> 0 < s[3] >>> 0 ? 1 : 0)) | 0, - t[5] = - (t[5] + 886263092 + (t[4] >>> 0 < s[4] >>> 0 ? 1 : 0)) | 0, - t[6] = - (t[6] + 1295307597 + (t[5] >>> 0 < s[5] >>> 0 ? 1 : 0)) | 0, - t[7] = - (t[7] + 3545052371 + (t[6] >>> 0 < s[6] >>> 0 ? 1 : 0)) | 0, - this._b = t[7] >>> 0 < s[7] >>> 0 ? 1 : 0, - a = 0; + t[1] = + (t[1] + 3545052371 + (t[0] >>> 0 < s[0] >>> 0 ? 1 : 0)) | 0, + t[2] = + (t[2] + 886263092 + (t[1] >>> 0 < s[1] >>> 0 ? 1 : 0)) | 0, + t[3] = + (t[3] + 1295307597 + (t[2] >>> 0 < s[2] >>> 0 ? 1 : 0)) | 0, + t[4] = + (t[4] + 3545052371 + (t[3] >>> 0 < s[3] >>> 0 ? 1 : 0)) | 0, + t[5] = + (t[5] + 886263092 + (t[4] >>> 0 < s[4] >>> 0 ? 1 : 0)) | 0, + t[6] = + (t[6] + 1295307597 + (t[5] >>> 0 < s[5] >>> 0 ? 1 : 0)) | 0, + t[7] = + (t[7] + 3545052371 + (t[6] >>> 0 < s[6] >>> 0 ? 1 : 0)) | 0, + this._b = t[7] >>> 0 < s[7] >>> 0 ? 1 : 0, + a = 0; a < 8; a++ ) { @@ -10763,11 +10763,11 @@ var version = "v1.17.2"; e.RabbitLegacy = t._createHelper(r); })(), i.RabbitLegacy); - }, - 4454: function (e, t, a) { - var i; - e.exports = - ((i = a(8249)), + }, + 4454: function (e, t, a) { + var i; + e.exports = + ((i = a(8249)), a(8269), a(8214), a(888), @@ -10790,15 +10790,15 @@ var version = "v1.17.2"; (16711935 & ((e[a] << 8) | (e[a] >>> 24))) | (4278255360 & ((e[a] << 24) | (e[a] >>> 8))); var i = (this._X = [ - e[0], - (e[3] << 16) | (e[2] >>> 16), - e[1], - (e[0] << 16) | (e[3] >>> 16), - e[2], - (e[1] << 16) | (e[0] >>> 16), - e[3], - (e[2] << 16) | (e[1] >>> 16), - ]), + e[0], + (e[3] << 16) | (e[2] >>> 16), + e[1], + (e[0] << 16) | (e[3] >>> 16), + e[2], + (e[1] << 16) | (e[0] >>> 16), + e[3], + (e[2] << 16) | (e[1] >>> 16), + ]), n = (this._C = [ (e[2] << 16) | (e[2] >>> 16), (4294901760 & e[0]) | (65535 & e[1]), @@ -10825,14 +10825,14 @@ var version = "v1.17.2"; h = (d << 16) | (65535 & c); for ( n[0] ^= c, - n[1] ^= u, - n[2] ^= d, - n[3] ^= h, - n[4] ^= c, - n[5] ^= u, - n[6] ^= d, - n[7] ^= h, - a = 0; + n[1] ^= u, + n[2] ^= d, + n[3] ^= h, + n[4] ^= c, + n[5] ^= u, + n[6] ^= d, + n[7] ^= h, + a = 0; a < 4; a++ ) @@ -10859,22 +10859,22 @@ var version = "v1.17.2"; for (var e = this._X, t = this._C, a = 0; a < 8; a++) s[a] = t[a]; for ( t[0] = (t[0] + 1295307597 + this._b) | 0, - t[1] = - (t[1] + 3545052371 + (t[0] >>> 0 < s[0] >>> 0 ? 1 : 0)) | 0, - t[2] = - (t[2] + 886263092 + (t[1] >>> 0 < s[1] >>> 0 ? 1 : 0)) | 0, - t[3] = - (t[3] + 1295307597 + (t[2] >>> 0 < s[2] >>> 0 ? 1 : 0)) | 0, - t[4] = - (t[4] + 3545052371 + (t[3] >>> 0 < s[3] >>> 0 ? 1 : 0)) | 0, - t[5] = - (t[5] + 886263092 + (t[4] >>> 0 < s[4] >>> 0 ? 1 : 0)) | 0, - t[6] = - (t[6] + 1295307597 + (t[5] >>> 0 < s[5] >>> 0 ? 1 : 0)) | 0, - t[7] = - (t[7] + 3545052371 + (t[6] >>> 0 < s[6] >>> 0 ? 1 : 0)) | 0, - this._b = t[7] >>> 0 < s[7] >>> 0 ? 1 : 0, - a = 0; + t[1] = + (t[1] + 3545052371 + (t[0] >>> 0 < s[0] >>> 0 ? 1 : 0)) | 0, + t[2] = + (t[2] + 886263092 + (t[1] >>> 0 < s[1] >>> 0 ? 1 : 0)) | 0, + t[3] = + (t[3] + 1295307597 + (t[2] >>> 0 < s[2] >>> 0 ? 1 : 0)) | 0, + t[4] = + (t[4] + 3545052371 + (t[3] >>> 0 < s[3] >>> 0 ? 1 : 0)) | 0, + t[5] = + (t[5] + 886263092 + (t[4] >>> 0 < s[4] >>> 0 ? 1 : 0)) | 0, + t[6] = + (t[6] + 1295307597 + (t[5] >>> 0 < s[5] >>> 0 ? 1 : 0)) | 0, + t[7] = + (t[7] + 3545052371 + (t[6] >>> 0 < s[6] >>> 0 ? 1 : 0)) | 0, + this._b = t[7] >>> 0 < s[7] >>> 0 ? 1 : 0, + a = 0; a < 8; a++ ) { @@ -10913,11 +10913,11 @@ var version = "v1.17.2"; e.Rabbit = t._createHelper(r); })(), i.Rabbit); - }, - 1857: function (e, t, a) { - var i; - e.exports = - ((i = a(8249)), + }, + 1857: function (e, t, a) { + var i; + e.exports = + ((i = a(8249)), a(8269), a(8214), a(888), @@ -10930,10 +10930,10 @@ var version = "v1.17.2"; _doReset: function () { for ( var e = this._key, - t = e.words, - a = e.sigBytes, - i = (this._S = []), - n = 0; + t = e.words, + a = e.sigBytes, + i = (this._S = []), + n = 0; n < 256; n++ ) @@ -10979,11 +10979,11 @@ var version = "v1.17.2"; e.RC4Drop = t._createHelper(o); })(), i.RC4); - }, - 706: function (e, t, a) { - var i; - e.exports = - ((i = a(8249)), + }, + 706: function (e, t, a) { + var i; + e.exports = + ((i = a(8249)), (function (e) { var t = i, a = t.lib, @@ -11054,11 +11054,11 @@ var version = "v1.17.2"; M = d.words; for ( _ = s = w[0], - v = o = w[1], - T = p = w[2], - R = S = w[3], - O = I = w[4], - a = 0; + v = o = w[1], + T = p = w[2], + R = S = w[3], + O = I = w[4], + a = 0; a < 80; a += 1 ) @@ -11149,11 +11149,11 @@ var version = "v1.17.2"; (t.HmacRIPEMD160 = s._createHmacHelper(p))); })(Math), i.RIPEMD160); - }, - 2783: function (e, t, a) { - var i, n, s, o, r, l, c, d; - e.exports = - ((n = (i = d = a(8249)).lib), + }, + 2783: function (e, t, a) { + var i, n, s, o, r, l, c, d; + e.exports = + ((n = (i = d = a(8249)).lib), (s = n.WordArray), (o = n.Hasher), (r = i.algo), @@ -11168,12 +11168,12 @@ var version = "v1.17.2"; _doProcessBlock: function (e, t) { for ( var a = this._hash.words, - i = a[0], - n = a[1], - s = a[2], - o = a[3], - r = a[4], - c = 0; + i = a[0], + n = a[1], + s = a[2], + o = a[3], + r = a[4], + c = 0; c < 80; c++ ) { @@ -11227,11 +11227,11 @@ var version = "v1.17.2"; (i.SHA1 = o._createHelper(c)), (i.HmacSHA1 = o._createHmacHelper(c)), d.SHA1); - }, - 7792: function (e, t, a) { - var i, n, s, o, r, l; - e.exports = - ((l = a(8249)), + }, + 7792: function (e, t, a) { + var i, n, s, o, r, l; + e.exports = + ((l = a(8249)), a(2153), (n = (i = l).lib.WordArray), (s = i.algo), @@ -11252,11 +11252,11 @@ var version = "v1.17.2"; (i.SHA224 = o._createHelper(r)), (i.HmacSHA224 = o._createHmacHelper(r)), l.SHA224); - }, - 2153: function (e, t, a) { - var i; - e.exports = - ((i = a(8249)), + }, + 2153: function (e, t, a) { + var i; + e.exports = + ((i = a(8249)), (function (e) { var t = i, a = t.lib, @@ -11274,11 +11274,11 @@ var version = "v1.17.2"; function a(e) { return (4294967296 * (e - (0 | e))) | 0; } - for (var i = 2, n = 0; n < 64; ) + for (var i = 2, n = 0; n < 64;) (t(i) && (n < 8 && (r[n] = a(e.pow(i, 0.5))), - (l[n] = a(e.pow(i, 1 / 3))), - n++), + (l[n] = a(e.pow(i, 1 / 3))), + n++), i++); })(); var c = [], @@ -11289,15 +11289,15 @@ var version = "v1.17.2"; _doProcessBlock: function (e, t) { for ( var a = this._hash.words, - i = a[0], - n = a[1], - s = a[2], - o = a[3], - r = a[4], - d = a[5], - u = a[6], - h = a[7], - p = 0; + i = a[0], + n = a[1], + s = a[2], + o = a[3], + r = a[4], + d = a[5], + u = a[6], + h = a[7], + p = 0; p < 64; p++ ) { @@ -11369,11 +11369,11 @@ var version = "v1.17.2"; (t.HmacSHA256 = s._createHmacHelper(d))); })(Math), i.SHA256); - }, - 3327: function (e, t, a) { - var i; - e.exports = - ((i = a(8249)), + }, + 3327: function (e, t, a) { + var i; + e.exports = + ((i = a(8249)), a(4938), (function (e) { var t = i, @@ -11447,8 +11447,8 @@ var version = "v1.17.2"; S = E.low; for ( p = y.high ^ ((b << 1) | (S >>> 31)), - g = y.low ^ ((S << 1) | (b >>> 31)), - m = 0; + g = y.low ^ ((S << 1) | (b >>> 31)), + m = 0; m < 5; m++ ) @@ -11493,10 +11493,10 @@ var version = "v1.17.2"; this._process()); for ( var o = this._state, - r = this.cfg.outputLength / 8, - l = r / 8, - c = [], - d = 0; + r = this.cfg.outputLength / 8, + l = r / 8, + c = [], + d = 0; d < l; d++ ) { @@ -11517,8 +11517,8 @@ var version = "v1.17.2"; clone: function () { for ( var e = s.clone.call(this), - t = (e._state = this._state.slice(0)), - a = 0; + t = (e._state = this._state.slice(0)), + a = 0; a < 25; a++ ) @@ -11530,11 +11530,11 @@ var version = "v1.17.2"; (t.HmacSHA3 = s._createHmacHelper(h))); })(Math), i.SHA3); - }, - 7460: function (e, t, a) { - var i, n, s, o, r, l, c, d; - e.exports = - ((d = a(8249)), + }, + 7460: function (e, t, a) { + var i, n, s, o, r, l, c, d; + e.exports = + ((d = a(8249)), a(4938), a(34), (n = (i = d).x64), @@ -11564,11 +11564,11 @@ var version = "v1.17.2"; (i.SHA384 = l._createHelper(c)), (i.HmacSHA384 = l._createHmacHelper(c)), d.SHA384); - }, - 34: function (e, t, a) { - var i; - e.exports = - ((i = a(8249)), + }, + 34: function (e, t, a) { + var i; + e.exports = + ((i = a(8249)), a(4938), (function () { var e = i, @@ -11581,87 +11581,87 @@ var version = "v1.17.2"; return n.create.apply(n, arguments); } var l = [ - r(1116352408, 3609767458), - r(1899447441, 602891725), - r(3049323471, 3964484399), - r(3921009573, 2173295548), - r(961987163, 4081628472), - r(1508970993, 3053834265), - r(2453635748, 2937671579), - r(2870763221, 3664609560), - r(3624381080, 2734883394), - r(310598401, 1164996542), - r(607225278, 1323610764), - r(1426881987, 3590304994), - r(1925078388, 4068182383), - r(2162078206, 991336113), - r(2614888103, 633803317), - r(3248222580, 3479774868), - r(3835390401, 2666613458), - r(4022224774, 944711139), - r(264347078, 2341262773), - r(604807628, 2007800933), - r(770255983, 1495990901), - r(1249150122, 1856431235), - r(1555081692, 3175218132), - r(1996064986, 2198950837), - r(2554220882, 3999719339), - r(2821834349, 766784016), - r(2952996808, 2566594879), - r(3210313671, 3203337956), - r(3336571891, 1034457026), - r(3584528711, 2466948901), - r(113926993, 3758326383), - r(338241895, 168717936), - r(666307205, 1188179964), - r(773529912, 1546045734), - r(1294757372, 1522805485), - r(1396182291, 2643833823), - r(1695183700, 2343527390), - r(1986661051, 1014477480), - r(2177026350, 1206759142), - r(2456956037, 344077627), - r(2730485921, 1290863460), - r(2820302411, 3158454273), - r(3259730800, 3505952657), - r(3345764771, 106217008), - r(3516065817, 3606008344), - r(3600352804, 1432725776), - r(4094571909, 1467031594), - r(275423344, 851169720), - r(430227734, 3100823752), - r(506948616, 1363258195), - r(659060556, 3750685593), - r(883997877, 3785050280), - r(958139571, 3318307427), - r(1322822218, 3812723403), - r(1537002063, 2003034995), - r(1747873779, 3602036899), - r(1955562222, 1575990012), - r(2024104815, 1125592928), - r(2227730452, 2716904306), - r(2361852424, 442776044), - r(2428436474, 593698344), - r(2756734187, 3733110249), - r(3204031479, 2999351573), - r(3329325298, 3815920427), - r(3391569614, 3928383900), - r(3515267271, 566280711), - r(3940187606, 3454069534), - r(4118630271, 4000239992), - r(116418474, 1914138554), - r(174292421, 2731055270), - r(289380356, 3203993006), - r(460393269, 320620315), - r(685471733, 587496836), - r(852142971, 1086792851), - r(1017036298, 365543100), - r(1126000580, 2618297676), - r(1288033470, 3409855158), - r(1501505948, 4234509866), - r(1607167915, 987167468), - r(1816402316, 1246189591), - ], + r(1116352408, 3609767458), + r(1899447441, 602891725), + r(3049323471, 3964484399), + r(3921009573, 2173295548), + r(961987163, 4081628472), + r(1508970993, 3053834265), + r(2453635748, 2937671579), + r(2870763221, 3664609560), + r(3624381080, 2734883394), + r(310598401, 1164996542), + r(607225278, 1323610764), + r(1426881987, 3590304994), + r(1925078388, 4068182383), + r(2162078206, 991336113), + r(2614888103, 633803317), + r(3248222580, 3479774868), + r(3835390401, 2666613458), + r(4022224774, 944711139), + r(264347078, 2341262773), + r(604807628, 2007800933), + r(770255983, 1495990901), + r(1249150122, 1856431235), + r(1555081692, 3175218132), + r(1996064986, 2198950837), + r(2554220882, 3999719339), + r(2821834349, 766784016), + r(2952996808, 2566594879), + r(3210313671, 3203337956), + r(3336571891, 1034457026), + r(3584528711, 2466948901), + r(113926993, 3758326383), + r(338241895, 168717936), + r(666307205, 1188179964), + r(773529912, 1546045734), + r(1294757372, 1522805485), + r(1396182291, 2643833823), + r(1695183700, 2343527390), + r(1986661051, 1014477480), + r(2177026350, 1206759142), + r(2456956037, 344077627), + r(2730485921, 1290863460), + r(2820302411, 3158454273), + r(3259730800, 3505952657), + r(3345764771, 106217008), + r(3516065817, 3606008344), + r(3600352804, 1432725776), + r(4094571909, 1467031594), + r(275423344, 851169720), + r(430227734, 3100823752), + r(506948616, 1363258195), + r(659060556, 3750685593), + r(883997877, 3785050280), + r(958139571, 3318307427), + r(1322822218, 3812723403), + r(1537002063, 2003034995), + r(1747873779, 3602036899), + r(1955562222, 1575990012), + r(2024104815, 1125592928), + r(2227730452, 2716904306), + r(2361852424, 442776044), + r(2428436474, 593698344), + r(2756734187, 3733110249), + r(3204031479, 2999351573), + r(3329325298, 3815920427), + r(3391569614, 3928383900), + r(3515267271, 566280711), + r(3940187606, 3454069534), + r(4118630271, 4000239992), + r(116418474, 1914138554), + r(174292421, 2731055270), + r(289380356, 3203993006), + r(460393269, 320620315), + r(685471733, 587496836), + r(852142971, 1086792851), + r(1017036298, 365543100), + r(1126000580, 2618297676), + r(1288033470, 3409855158), + r(1501505948, 4234509866), + r(1607167915, 987167468), + r(1816402316, 1246189591), + ], c = []; !(function () { for (var e = 0; e < 80; e++) c[e] = r(); @@ -11682,47 +11682,47 @@ var version = "v1.17.2"; _doProcessBlock: function (e, t) { for ( var a = this._hash.words, - i = a[0], - n = a[1], - s = a[2], - o = a[3], - r = a[4], - d = a[5], - u = a[6], - h = a[7], - p = i.high, - g = i.low, - m = n.high, - f = n.low, - y = s.high, - E = s.low, - b = o.high, - S = o.low, - I = r.high, - _ = r.low, - v = d.high, - T = d.low, - R = u.high, - O = u.low, - C = h.high, - w = h.low, - A = p, - k = g, - N = m, - x = f, - P = y, - M = E, - L = b, - D = S, - B = I, - F = _, - Y = v, - U = T, - j = R, - G = O, - V = C, - H = w, - X = 0; + i = a[0], + n = a[1], + s = a[2], + o = a[3], + r = a[4], + d = a[5], + u = a[6], + h = a[7], + p = i.high, + g = i.low, + m = n.high, + f = n.low, + y = s.high, + E = s.low, + b = o.high, + S = o.low, + I = r.high, + _ = r.low, + v = d.high, + T = d.low, + R = u.high, + O = u.low, + C = h.high, + w = h.low, + A = p, + k = g, + N = m, + x = f, + P = y, + M = E, + L = b, + D = S, + B = I, + F = _, + Y = v, + U = T, + j = R, + G = O, + V = C, + H = w, + X = 0; X < 80; X++ ) { @@ -11870,11 +11870,11 @@ var version = "v1.17.2"; (e.HmacSHA512 = t._createHmacHelper(d))); })(), i.SHA512); - }, - 4253: function (e, t, a) { - var i; - e.exports = - ((i = a(8249)), + }, + 4253: function (e, t, a) { + var i; + e.exports = + ((i = a(8249)), a(8269), a(8214), a(888), @@ -12470,10 +12470,10 @@ var version = "v1.17.2"; for (var i = 0; i < 16; i++) { for ( var n = a[i], - s = this._lBlock, - o = this._rBlock, - r = 0, - l = 0; + s = this._lBlock, + o = this._rBlock, + r = 0, + l = 0; l < 8; l++ ) @@ -12535,11 +12535,11 @@ var version = "v1.17.2"; e.TripleDES = n._createHelper(g); })(), i.TripleDES); - }, - 4938: function (e, t, a) { - var i, n, s, o, r, l; - e.exports = - ((i = a(8249)), + }, + 4938: function (e, t, a) { + var i, n, s, o, r, l; + e.exports = + ((i = a(8249)), (s = (n = i).lib), (o = s.Base), (r = s.WordArray), @@ -12567,9 +12567,9 @@ var version = "v1.17.2"; clone: function () { for ( var e = o.clone.call(this), - t = (e.words = this.words.slice(0)), - a = t.length, - i = 0; + t = (e.words = this.words.slice(0)), + a = t.length, + i = 0; i < a; i++ ) @@ -12578,12238 +12578,12211 @@ var version = "v1.17.2"; }, })), i); - }, - 6230: (e) => { - e.exports = "object" == typeof self ? self.FormData : window.FormData; - }, - 5781: (e, t, a) => { + }, + 6230: (e) => { + e.exports = "object" == typeof self ? self.FormData : window.FormData; + }, + 5781: (e, t, a) => { + "use strict"; + a.d(t, { Xu: () => o }); + var i = a(8917), + n = a.n(i), + s = n()(function () { + var e = []; + return ( + "undefined" != typeof window && + (window.navigator.languages && + (e = e.concat(window.navigator.languages)), + window.navigator.language && e.push(window.navigator.language), + window.navigator.userLanguage && + e.push(window.navigator.userLanguage), + window.navigator.browserLanguage && + e.push(window.navigator.browserLanguage), + window.navigator.systemLanguage && + e.push(window.navigator.systemLanguage)), + e.push("en-US"), + e + .filter(function (e, t, a) { + return a.indexOf(e) === t; + }) + .map(function (e) { + if (!e || -1 === e.indexOf("-") || e.toLowerCase() !== e) + return e; + var t = e.split("-"); + return "".concat(t[0], "-").concat(t[1].toUpperCase()); + }) + ); + }), + o = n()(function () { + return s()[0]; + }); + }, + 840: (e, t, a) => { + var i; + !(function (n, s, o, r) { "use strict"; - a.d(t, { Xu: () => o }); - var i = a(8917), - n = a.n(i), - s = n()(function () { - var e = []; - return ( - "undefined" != typeof window && - (window.navigator.languages && - (e = e.concat(window.navigator.languages)), - window.navigator.language && e.push(window.navigator.language), - window.navigator.userLanguage && - e.push(window.navigator.userLanguage), - window.navigator.browserLanguage && - e.push(window.navigator.browserLanguage), - window.navigator.systemLanguage && - e.push(window.navigator.systemLanguage)), - e.push("en-US"), - e - .filter(function (e, t, a) { - return a.indexOf(e) === t; - }) - .map(function (e) { - if (!e || -1 === e.indexOf("-") || e.toLowerCase() !== e) - return e; - var t = e.split("-"); - return "".concat(t[0], "-").concat(t[1].toUpperCase()); - }) - ); - }), - o = n()(function () { - return s()[0]; - }); - }, - 840: (e, t, a) => { - var i; - !(function (n, s, o, r) { - "use strict"; - var l, - c = ["", "webkit", "Moz", "MS", "ms", "o"], - d = s.createElement("div"), - u = Math.round, - h = Math.abs, - p = Date.now; - function g(e, t, a) { - return setTimeout(I(e, a), t); - } - function m(e, t, a) { - return !!Array.isArray(e) && (f(e, a[t], a), true); - } - function f(e, t, a) { - var i; - if (e) - if (e.forEach) e.forEach(t, a); - else if (e.length !== r) - for (i = 0; i < e.length; ) (t.call(a, e[i], i, e), i++); - else for (i in e) e.hasOwnProperty(i) && t.call(a, e[i], i, e); - } - function y(e, t, a) { - var i = "DEPRECATED METHOD: " + t + "\n" + a + " AT \n"; - return function () { - var t = new Error("get-stack-trace"), - a = - t && t.stack - ? t.stack - .replace(/^[^\(]+?[\n$]/gm, "") - .replace(/^\s+at\s+/gm, "") - .replace(/^Object.\s*\(/gm, "{anonymous}()@") - : "Unknown Stack Trace", - s = n.console && (n.console.warn || n.console.log); - return (s && s.call(n.console, i, a), e.apply(this, arguments)); - }; - } - l = - "function" != typeof Object.assign - ? function (e) { - if (e === r || null === e) - throw new TypeError( - "Cannot convert undefined or null to object", - ); - for (var t = Object(e), a = 1; a < arguments.length; a++) { - var i = arguments[a]; - if (i !== r && null !== i) - for (var n in i) i.hasOwnProperty(n) && (t[n] = i[n]); - } - return t; - } - : Object.assign; - var E = y( - function (e, t, a) { - for (var i = Object.keys(t), n = 0; n < i.length; ) - ((!a || (a && e[i[n]] === r)) && (e[i[n]] = t[i[n]]), n++); - return e; - }, - "extend", - "Use `assign`.", - ), - b = y( - function (e, t) { - return E(e, t, true); - }, - "merge", - "Use `assign`.", - ); - function S(e, t, a) { - var i, - n = t.prototype; - (((i = e.prototype = Object.create(n)).constructor = e), - (i._super = n), - a && l(i, a)); - } - function I(e, t) { - return function () { - return e.apply(t, arguments); - }; - } - function _(e, t) { - return "function" == typeof e ? e.apply((t && t[0]) || r, t) : e; - } - function v(e, t) { - return e === r ? t : e; - } - function T(e, t, a) { - f(w(t), function (t) { - e.addEventListener(t, a, false); - }); - } - function R(e, t, a) { - f(w(t), function (t) { - e.removeEventListener(t, a, false); - }); - } - function O(e, t) { - for (; e; ) { - if (e == t) return true; - e = e.parentNode; - } - return false; - } - function C(e, t) { - return e.indexOf(t) > -1; - } - function w(e) { - return e.trim().split(/\s+/g); - } - function A(e, t, a) { - if (e.indexOf && !a) return e.indexOf(t); - for (var i = 0; i < e.length; ) { - if ((a && e[i][a] == t) || (!a && e[i] === t)) return i; - i++; - } - return -1; - } - function k(e) { - return Array.prototype.slice.call(e, 0); - } - function N(e, t, a) { - for (var i = [], n = [], s = 0; s < e.length; ) { - var o = t ? e[s][t] : e[s]; - (A(n, o) < 0 && i.push(e[s]), (n[s] = o), s++); - } - return ( - a && - (i = t - ? i.sort(function (e, a) { - return e[t] > a[t]; - }) - : i.sort()), - i - ); - } - function x(e, t) { - for ( - var a, i, n = t[0].toUpperCase() + t.slice(1), s = 0; - s < c.length; - ) { - if ((i = (a = c[s]) ? a + n : t) in e) return i; - s++; + var l, + c = ["", "webkit", "Moz", "MS", "ms", "o"], + d = s.createElement("div"), + u = Math.round, + h = Math.abs, + p = Date.now; + function g(e, t, a) { + return setTimeout(I(e, a), t); + } + function m(e, t, a) { + return !!Array.isArray(e) && (f(e, a[t], a), true); + } + function f(e, t, a) { + var i; + if (e) + if (e.forEach) e.forEach(t, a); + else if (e.length !== r) + for (i = 0; i < e.length;) (t.call(a, e[i], i, e), i++); + else for (i in e) e.hasOwnProperty(i) && t.call(a, e[i], i, e); + } + function y(e, t, a) { + var i = "DEPRECATED METHOD: " + t + "\n" + a + " AT \n"; + return function () { + var t = new Error("get-stack-trace"), + a = + t && t.stack + ? t.stack + .replace(/^[^\(]+?[\n$]/gm, "") + .replace(/^\s+at\s+/gm, "") + .replace(/^Object.\s*\(/gm, "{anonymous}()@") + : "Unknown Stack Trace", + s = n.console && (n.console.warn || n.console.log); + return (s && s.call(n.console, i, a), e.apply(this, arguments)); + }; + } + l = + "function" != typeof Object.assign + ? function (e) { + if (e === r || null === e) + throw new TypeError( + "Cannot convert undefined or null to object", + ); + for (var t = Object(e), a = 1; a < arguments.length; a++) { + var i = arguments[a]; + if (i !== r && null !== i) + for (var n in i) i.hasOwnProperty(n) && (t[n] = i[n]); + } + return t; } - return r; - } - var P = 1; - function M(e) { - var t = e.ownerDocument || e; - return t.defaultView || t.parentWindow || n; - } - var L = "ontouchstart" in n, - D = x(n, "PointerEvent") !== r, - B = - L && - /mobile|tablet|ip(ad|hone|od)|android/i.test(navigator.userAgent), - F = "touch", - Y = "mouse", - U = ["x", "y"], - j = ["clientX", "clientY"]; - function G(e, t) { - var a = this; - ((this.manager = e), - (this.callback = t), - (this.element = e.element), - (this.target = e.options.inputTarget), - (this.domHandler = function (t) { - _(e.options.enable, [e]) && a.handler(t); - }), - this.init()); - } - function V(e, t, a) { - var i = a.pointers.length, - n = a.changedPointers.length, - s = 1 & t && i - n == 0, - o = 12 & t && i - n == 0; - ((a.isFirst = !!s), - (a.isFinal = !!o), - s && (e.session = {}), - (a.eventType = t), - (function (e, t) { - var a = e.session, - i = t.pointers, - n = i.length; - (a.firstInput || (a.firstInput = H(t)), - n > 1 && !a.firstMultiple - ? (a.firstMultiple = H(t)) - : 1 === n && (a.firstMultiple = false)); - var s = a.firstInput, - o = a.firstMultiple, - l = o ? o.center : s.center, - c = (t.center = X(i)); - ((t.timeStamp = p()), - (t.deltaTime = t.timeStamp - s.timeStamp), - (t.angle = $(l, c)), - (t.distance = q(l, c)), - (function (e, t) { - var a = t.center, - i = e.offsetDelta || {}, - n = e.prevDelta || {}, - s = e.prevInput || {}; - ((1 !== t.eventType && 4 !== s.eventType) || - ((n = e.prevDelta = - { x: s.deltaX || 0, y: s.deltaY || 0 }), - (i = e.offsetDelta = { x: a.x, y: a.y })), - (t.deltaX = n.x + (a.x - i.x)), - (t.deltaY = n.y + (a.y - i.y))); - })(a, t), - (t.offsetDirection = W(t.deltaX, t.deltaY))); - var d, - u, - g = z(t.deltaTime, t.deltaX, t.deltaY); - ((t.overallVelocityX = g.x), - (t.overallVelocityY = g.y), - (t.overallVelocity = h(g.x) > h(g.y) ? g.x : g.y), - (t.scale = o - ? ((d = o.pointers), - q((u = i)[0], u[1], j) / q(d[0], d[1], j)) - : 1), - (t.rotation = o - ? (function (e, t) { - return $(t[1], t[0], j) + $(e[1], e[0], j); - })(o.pointers, i) - : 0), - (t.maxPointers = a.prevInput - ? t.pointers.length > a.prevInput.maxPointers - ? t.pointers.length - : a.prevInput.maxPointers - : t.pointers.length), - (function (e, t) { - var a, - i, - n, - s, - o = e.lastInterval || t, - l = t.timeStamp - o.timeStamp; - if (8 != t.eventType && (l > 25 || o.velocity === r)) { - var c = t.deltaX - o.deltaX, - d = t.deltaY - o.deltaY, - u = z(l, c, d); - ((i = u.x), - (n = u.y), - (a = h(u.x) > h(u.y) ? u.x : u.y), - (s = W(c, d)), - (e.lastInterval = t)); - } else - ((a = o.velocity), - (i = o.velocityX), - (n = o.velocityY), - (s = o.direction)); - ((t.velocity = a), - (t.velocityX = i), - (t.velocityY = n), - (t.direction = s)); - })(a, t)); - var m = e.element; - (O(t.srcEvent.target, m) && (m = t.srcEvent.target), - (t.target = m)); - })(e, a), - e.emit("hammer.input", a), - e.recognize(a), - (e.session.prevInput = a)); - } - function H(e) { - for (var t = [], a = 0; a < e.pointers.length; ) - ((t[a] = { - clientX: u(e.pointers[a].clientX), - clientY: u(e.pointers[a].clientY), - }), - a++); - return { - timeStamp: p(), - pointers: t, - center: X(t), - deltaX: e.deltaX, - deltaY: e.deltaY, - }; - } - function X(e) { - var t = e.length; - if (1 === t) return { x: u(e[0].clientX), y: u(e[0].clientY) }; - for (var a = 0, i = 0, n = 0; n < t; ) - ((a += e[n].clientX), (i += e[n].clientY), n++); - return { x: u(a / t), y: u(i / t) }; - } - function z(e, t, a) { - return { x: t / e || 0, y: a / e || 0 }; - } - function W(e, t) { - return e === t - ? 1 - : h(e) >= h(t) - ? e < 0 - ? 2 - : 4 - : t < 0 - ? 8 - : 16; - } - function q(e, t, a) { - a || (a = U); - var i = t[a[0]] - e[a[0]], - n = t[a[1]] - e[a[1]]; - return Math.sqrt(i * i + n * n); - } - function $(e, t, a) { - a || (a = U); - var i = t[a[0]] - e[a[0]], - n = t[a[1]] - e[a[1]]; - return (180 * Math.atan2(n, i)) / Math.PI; - } - G.prototype = { - handler: function () {}, - init: function () { - (this.evEl && T(this.element, this.evEl, this.domHandler), - this.evTarget && T(this.target, this.evTarget, this.domHandler), - this.evWin && T(M(this.element), this.evWin, this.domHandler)); - }, - destroy: function () { - (this.evEl && R(this.element, this.evEl, this.domHandler), - this.evTarget && R(this.target, this.evTarget, this.domHandler), - this.evWin && R(M(this.element), this.evWin, this.domHandler)); + : Object.assign; + var E = y( + function (e, t, a) { + for (var i = Object.keys(t), n = 0; n < i.length;) + ((!a || (a && e[i[n]] === r)) && (e[i[n]] = t[i[n]]), n++); + return e; + }, + "extend", + "Use `assign`.", + ), + b = y( + function (e, t) { + return E(e, t, true); }, + "merge", + "Use `assign`.", + ); + function S(e, t, a) { + var i, + n = t.prototype; + (((i = e.prototype = Object.create(n)).constructor = e), + (i._super = n), + a && l(i, a)); + } + function I(e, t) { + return function () { + return e.apply(t, arguments); }; - var J = { mousedown: 1, mousemove: 2, mouseup: 4 }, - K = "mousedown", - Q = "mousemove mouseup"; - function Z() { - ((this.evEl = K), - (this.evWin = Q), - (this.pressed = false), - G.apply(this, arguments)); - } - S(Z, G, { - handler: function (e) { - var t = J[e.type]; - (1 & t && 0 === e.button && (this.pressed = true), - 2 & t && 1 !== e.which && (t = 4), - this.pressed && - (4 & t && (this.pressed = false), - this.callback(this.manager, t, { - pointers: [e], - changedPointers: [e], - pointerType: Y, - srcEvent: e, - }))); - }, + } + function _(e, t) { + return "function" == typeof e ? e.apply((t && t[0]) || r, t) : e; + } + function v(e, t) { + return e === r ? t : e; + } + function T(e, t, a) { + f(w(t), function (t) { + e.addEventListener(t, a, false); }); - var ee = { - pointerdown: 1, - pointermove: 2, - pointerup: 4, - pointercancel: 8, - pointerout: 8, - }, - te = { 2: F, 3: "pen", 4: Y, 5: "kinect" }, - ae = "pointerdown", - ie = "pointermove pointerup pointercancel"; - function ne() { - ((this.evEl = ae), - (this.evWin = ie), - G.apply(this, arguments), - (this.store = this.manager.session.pointerEvents = [])); + } + function R(e, t, a) { + f(w(t), function (t) { + e.removeEventListener(t, a, false); + }); + } + function O(e, t) { + for (; e;) { + if (e == t) return true; + e = e.parentNode; } - (n.MSPointerEvent && - !n.PointerEvent && - ((ae = "MSPointerDown"), - (ie = "MSPointerMove MSPointerUp MSPointerCancel")), - S(ne, G, { - handler: function (e) { - var t = this.store, - a = false, - i = e.type.toLowerCase().replace("ms", ""), - n = ee[i], - s = te[e.pointerType] || e.pointerType, - o = s == F, - r = A(t, e.pointerId, "pointerId"); - (1 & n && (0 === e.button || o) - ? r < 0 && (t.push(e), (r = t.length - 1)) - : 12 & n && (a = true), - r < 0 || - ((t[r] = e), - this.callback(this.manager, n, { - pointers: t, - changedPointers: [e], - pointerType: s, - srcEvent: e, - }), - a && t.splice(r, 1))); - }, - })); - var se = { touchstart: 1, touchmove: 2, touchend: 4, touchcancel: 8 }, - oe = "touchstart", - re = "touchstart touchmove touchend touchcancel"; - function le() { - ((this.evTarget = oe), - (this.evWin = re), - (this.started = false), - G.apply(this, arguments)); + return false; + } + function C(e, t) { + return e.indexOf(t) > -1; + } + function w(e) { + return e.trim().split(/\s+/g); + } + function A(e, t, a) { + if (e.indexOf && !a) return e.indexOf(t); + for (var i = 0; i < e.length;) { + if ((a && e[i][a] == t) || (!a && e[i] === t)) return i; + i++; } - function ce(e, t) { - var a = k(e.touches), - i = k(e.changedTouches); - return (12 & t && (a = N(a.concat(i), "identifier", true)), [a, i]); + return -1; + } + function k(e) { + return Array.prototype.slice.call(e, 0); + } + function N(e, t, a) { + for (var i = [], n = [], s = 0; s < e.length;) { + var o = t ? e[s][t] : e[s]; + (A(n, o) < 0 && i.push(e[s]), (n[s] = o), s++); } - S(le, G, { - handler: function (e) { - var t = se[e.type]; - if ((1 === t && (this.started = true), this.started)) { - var a = ce.call(this, e, t); - (12 & t && - a[0].length - a[1].length == 0 && - (this.started = false), - this.callback(this.manager, t, { - pointers: a[0], - changedPointers: a[1], - pointerType: F, - srcEvent: e, - })); - } - }, - }); - var de = { touchstart: 1, touchmove: 2, touchend: 4, touchcancel: 8 }, - ue = "touchstart touchmove touchend touchcancel"; - function he() { - ((this.evTarget = ue), - (this.targetIds = {}), - G.apply(this, arguments)); + return ( + a && + (i = t + ? i.sort(function (e, a) { + return e[t] > a[t]; + }) + : i.sort()), + i + ); + } + function x(e, t) { + for ( + var a, i, n = t[0].toUpperCase() + t.slice(1), s = 0; + s < c.length; + ) { + if ((i = (a = c[s]) ? a + n : t) in e) return i; + s++; } - function pe(e, t) { - var a = k(e.touches), - i = this.targetIds; - if (3 & t && 1 === a.length) - return ((i[a[0].identifier] = true), [a, a]); - var n, - s, - o = k(e.changedTouches), - r = [], - l = this.target; - if ( - ((s = a.filter(function (e) { - return O(e.target, l); - })), - 1 === t) - ) - for (n = 0; n < s.length; ) ((i[s[n].identifier] = true), n++); - for (n = 0; n < o.length; ) - (i[o[n].identifier] && r.push(o[n]), - 12 & t && delete i[o[n].identifier], - n++); - return r.length ? [N(s.concat(r), "identifier", true), r] : void 0; - } - function ge() { - G.apply(this, arguments); - var e = I(this.handler, this); - ((this.touch = new he(this.manager, e)), - (this.mouse = new Z(this.manager, e)), - (this.primaryTouch = null), - (this.lastTouches = [])); - } - function me(e, t) { - 1 & e - ? ((this.primaryTouch = t.changedPointers[0].identifier), - fe.call(this, t)) - : 12 & e && fe.call(this, t); - } - function fe(e) { - var t = e.changedPointers[0]; - if (t.identifier === this.primaryTouch) { - var a = { x: t.clientX, y: t.clientY }; - this.lastTouches.push(a); - var i = this.lastTouches; - setTimeout(function () { - var e = i.indexOf(a); - e > -1 && i.splice(e, 1); - }, 2500); - } - } - function ye(e) { - for ( - var t = e.srcEvent.clientX, a = e.srcEvent.clientY, i = 0; - i < this.lastTouches.length; - i++ - ) { - var n = this.lastTouches[i], - s = Math.abs(t - n.x), - o = Math.abs(a - n.y); - if (s <= 25 && o <= 25) return true; - } - return false; - } - (S(he, G, { + return r; + } + var P = 1; + function M(e) { + var t = e.ownerDocument || e; + return t.defaultView || t.parentWindow || n; + } + var L = "ontouchstart" in n, + D = x(n, "PointerEvent") !== r, + B = + L && + /mobile|tablet|ip(ad|hone|od)|android/i.test(navigator.userAgent), + F = "touch", + Y = "mouse", + U = ["x", "y"], + j = ["clientX", "clientY"]; + function G(e, t) { + var a = this; + ((this.manager = e), + (this.callback = t), + (this.element = e.element), + (this.target = e.options.inputTarget), + (this.domHandler = function (t) { + _(e.options.enable, [e]) && a.handler(t); + }), + this.init()); + } + function V(e, t, a) { + var i = a.pointers.length, + n = a.changedPointers.length, + s = 1 & t && i - n == 0, + o = 12 & t && i - n == 0; + ((a.isFirst = !!s), + (a.isFinal = !!o), + s && (e.session = {}), + (a.eventType = t), + (function (e, t) { + var a = e.session, + i = t.pointers, + n = i.length; + (a.firstInput || (a.firstInput = H(t)), + n > 1 && !a.firstMultiple + ? (a.firstMultiple = H(t)) + : 1 === n && (a.firstMultiple = false)); + var s = a.firstInput, + o = a.firstMultiple, + l = o ? o.center : s.center, + c = (t.center = X(i)); + ((t.timeStamp = p()), + (t.deltaTime = t.timeStamp - s.timeStamp), + (t.angle = $(l, c)), + (t.distance = q(l, c)), + (function (e, t) { + var a = t.center, + i = e.offsetDelta || {}, + n = e.prevDelta || {}, + s = e.prevInput || {}; + ((1 !== t.eventType && 4 !== s.eventType) || + ((n = e.prevDelta = + { x: s.deltaX || 0, y: s.deltaY || 0 }), + (i = e.offsetDelta = { x: a.x, y: a.y })), + (t.deltaX = n.x + (a.x - i.x)), + (t.deltaY = n.y + (a.y - i.y))); + })(a, t), + (t.offsetDirection = W(t.deltaX, t.deltaY))); + var d, + u, + g = z(t.deltaTime, t.deltaX, t.deltaY); + ((t.overallVelocityX = g.x), + (t.overallVelocityY = g.y), + (t.overallVelocity = h(g.x) > h(g.y) ? g.x : g.y), + (t.scale = o + ? ((d = o.pointers), + q((u = i)[0], u[1], j) / q(d[0], d[1], j)) + : 1), + (t.rotation = o + ? (function (e, t) { + return $(t[1], t[0], j) + $(e[1], e[0], j); + })(o.pointers, i) + : 0), + (t.maxPointers = a.prevInput + ? t.pointers.length > a.prevInput.maxPointers + ? t.pointers.length + : a.prevInput.maxPointers + : t.pointers.length), + (function (e, t) { + var a, + i, + n, + s, + o = e.lastInterval || t, + l = t.timeStamp - o.timeStamp; + if (8 != t.eventType && (l > 25 || o.velocity === r)) { + var c = t.deltaX - o.deltaX, + d = t.deltaY - o.deltaY, + u = z(l, c, d); + ((i = u.x), + (n = u.y), + (a = h(u.x) > h(u.y) ? u.x : u.y), + (s = W(c, d)), + (e.lastInterval = t)); + } else + ((a = o.velocity), + (i = o.velocityX), + (n = o.velocityY), + (s = o.direction)); + ((t.velocity = a), + (t.velocityX = i), + (t.velocityY = n), + (t.direction = s)); + })(a, t)); + var m = e.element; + (O(t.srcEvent.target, m) && (m = t.srcEvent.target), + (t.target = m)); + })(e, a), + e.emit("hammer.input", a), + e.recognize(a), + (e.session.prevInput = a)); + } + function H(e) { + for (var t = [], a = 0; a < e.pointers.length;) + ((t[a] = { + clientX: u(e.pointers[a].clientX), + clientY: u(e.pointers[a].clientY), + }), + a++); + return { + timeStamp: p(), + pointers: t, + center: X(t), + deltaX: e.deltaX, + deltaY: e.deltaY, + }; + } + function X(e) { + var t = e.length; + if (1 === t) return { x: u(e[0].clientX), y: u(e[0].clientY) }; + for (var a = 0, i = 0, n = 0; n < t;) + ((a += e[n].clientX), (i += e[n].clientY), n++); + return { x: u(a / t), y: u(i / t) }; + } + function z(e, t, a) { + return { x: t / e || 0, y: a / e || 0 }; + } + function W(e, t) { + return e === t + ? 1 + : h(e) >= h(t) + ? e < 0 + ? 2 + : 4 + : t < 0 + ? 8 + : 16; + } + function q(e, t, a) { + a || (a = U); + var i = t[a[0]] - e[a[0]], + n = t[a[1]] - e[a[1]]; + return Math.sqrt(i * i + n * n); + } + function $(e, t, a) { + a || (a = U); + var i = t[a[0]] - e[a[0]], + n = t[a[1]] - e[a[1]]; + return (180 * Math.atan2(n, i)) / Math.PI; + } + G.prototype = { + handler: function () { }, + init: function () { + (this.evEl && T(this.element, this.evEl, this.domHandler), + this.evTarget && T(this.target, this.evTarget, this.domHandler), + this.evWin && T(M(this.element), this.evWin, this.domHandler)); + }, + destroy: function () { + (this.evEl && R(this.element, this.evEl, this.domHandler), + this.evTarget && R(this.target, this.evTarget, this.domHandler), + this.evWin && R(M(this.element), this.evWin, this.domHandler)); + }, + }; + var J = { mousedown: 1, mousemove: 2, mouseup: 4 }, + K = "mousedown", + Q = "mousemove mouseup"; + function Z() { + ((this.evEl = K), + (this.evWin = Q), + (this.pressed = false), + G.apply(this, arguments)); + } + S(Z, G, { + handler: function (e) { + var t = J[e.type]; + (1 & t && 0 === e.button && (this.pressed = true), + 2 & t && 1 !== e.which && (t = 4), + this.pressed && + (4 & t && (this.pressed = false), + this.callback(this.manager, t, { + pointers: [e], + changedPointers: [e], + pointerType: Y, + srcEvent: e, + }))); + }, + }); + var ee = { + pointerdown: 1, + pointermove: 2, + pointerup: 4, + pointercancel: 8, + pointerout: 8, + }, + te = { 2: F, 3: "pen", 4: Y, 5: "kinect" }, + ae = "pointerdown", + ie = "pointermove pointerup pointercancel"; + function ne() { + ((this.evEl = ae), + (this.evWin = ie), + G.apply(this, arguments), + (this.store = this.manager.session.pointerEvents = [])); + } + (n.MSPointerEvent && + !n.PointerEvent && + ((ae = "MSPointerDown"), + (ie = "MSPointerMove MSPointerUp MSPointerCancel")), + S(ne, G, { handler: function (e) { - var t = de[e.type], - a = pe.call(this, e, t); - a && + var t = this.store, + a = false, + i = e.type.toLowerCase().replace("ms", ""), + n = ee[i], + s = te[e.pointerType] || e.pointerType, + o = s == F, + r = A(t, e.pointerId, "pointerId"); + (1 & n && (0 === e.button || o) + ? r < 0 && (t.push(e), (r = t.length - 1)) + : 12 & n && (a = true), + r < 0 || + ((t[r] = e), + this.callback(this.manager, n, { + pointers: t, + changedPointers: [e], + pointerType: s, + srcEvent: e, + }), + a && t.splice(r, 1))); + }, + })); + var se = { touchstart: 1, touchmove: 2, touchend: 4, touchcancel: 8 }, + oe = "touchstart", + re = "touchstart touchmove touchend touchcancel"; + function le() { + ((this.evTarget = oe), + (this.evWin = re), + (this.started = false), + G.apply(this, arguments)); + } + function ce(e, t) { + var a = k(e.touches), + i = k(e.changedTouches); + return (12 & t && (a = N(a.concat(i), "identifier", true)), [a, i]); + } + S(le, G, { + handler: function (e) { + var t = se[e.type]; + if ((1 === t && (this.started = true), this.started)) { + var a = ce.call(this, e, t); + (12 & t && + a[0].length - a[1].length == 0 && + (this.started = false), this.callback(this.manager, t, { pointers: a[0], changedPointers: a[1], pointerType: F, srcEvent: e, - }); - }, - }), - S(ge, G, { - handler: function (e, t, a) { - var i = a.pointerType == F, - n = a.pointerType == Y; - if ( - !( - n && - a.sourceCapabilities && - a.sourceCapabilities.firesTouchEvents - ) - ) { - if (i) me.call(this, t, a); - else if (n && ye.call(this, a)) return; - this.callback(e, t, a); - } - }, - destroy: function () { - (this.touch.destroy(), this.mouse.destroy()); - }, - })); - var Ee = x(d.style, "touchAction"), - be = Ee !== r, - Se = "compute", - Ie = "auto", - _e = "manipulation", - ve = "none", - Te = "pan-x", - Re = "pan-y", - Oe = (function () { - if (!be) return false; - var e = {}, - t = n.CSS && n.CSS.supports; - return ( - [ - "auto", - "manipulation", - "pan-y", - "pan-x", - "pan-x pan-y", - "none", - ].forEach(function (a) { - e[a] = !t || n.CSS.supports("touch-action", a); - }), - e - ); - })(); - function Ce(e, t) { - ((this.manager = e), this.set(t)); + })); + } + }, + }); + var de = { touchstart: 1, touchmove: 2, touchend: 4, touchcancel: 8 }, + ue = "touchstart touchmove touchend touchcancel"; + function he() { + ((this.evTarget = ue), + (this.targetIds = {}), + G.apply(this, arguments)); + } + function pe(e, t) { + var a = k(e.touches), + i = this.targetIds; + if (3 & t && 1 === a.length) + return ((i[a[0].identifier] = true), [a, a]); + var n, + s, + o = k(e.changedTouches), + r = [], + l = this.target; + if ( + ((s = a.filter(function (e) { + return O(e.target, l); + })), + 1 === t) + ) + for (n = 0; n < s.length;) ((i[s[n].identifier] = true), n++); + for (n = 0; n < o.length;) + (i[o[n].identifier] && r.push(o[n]), + 12 & t && delete i[o[n].identifier], + n++); + return r.length ? [N(s.concat(r), "identifier", true), r] : void 0; + } + function ge() { + G.apply(this, arguments); + var e = I(this.handler, this); + ((this.touch = new he(this.manager, e)), + (this.mouse = new Z(this.manager, e)), + (this.primaryTouch = null), + (this.lastTouches = [])); + } + function me(e, t) { + 1 & e + ? ((this.primaryTouch = t.changedPointers[0].identifier), + fe.call(this, t)) + : 12 & e && fe.call(this, t); + } + function fe(e) { + var t = e.changedPointers[0]; + if (t.identifier === this.primaryTouch) { + var a = { x: t.clientX, y: t.clientY }; + this.lastTouches.push(a); + var i = this.lastTouches; + setTimeout(function () { + var e = i.indexOf(a); + e > -1 && i.splice(e, 1); + }, 2500); } - Ce.prototype = { - set: function (e) { - (e == Se && (e = this.compute()), - be && - this.manager.element.style && - Oe[e] && - (this.manager.element.style[Ee] = e), - (this.actions = e.toLowerCase().trim())); - }, - update: function () { - this.set(this.manager.options.touchAction); - }, - compute: function () { - var e = []; - return ( - f(this.manager.recognizers, function (t) { - _(t.options.enable, [t]) && - (e = e.concat(t.getTouchAction())); - }), - (function (e) { - if (C(e, ve)) return ve; - var t = C(e, Te), - a = C(e, Re); - return t && a - ? ve - : t || a - ? t - ? Te - : Re - : C(e, _e) - ? _e - : Ie; - })(e.join(" ")) - ); - }, - preventDefaults: function (e) { - var t = e.srcEvent, - a = e.offsetDirection; - if (this.manager.session.prevented) t.preventDefault(); - else { - var i = this.actions, - n = C(i, ve) && !Oe.none, - s = C(i, Re) && !Oe["pan-y"], - o = C(i, Te) && !Oe["pan-x"]; - if (n) { - var r = 1 === e.pointers.length, - l = e.distance < 2, - c = e.deltaTime < 250; - if (r && l && c) return; - } - if (!o || !s) - return n || (s && 6 & a) || (o && 24 & a) - ? this.preventSrc(t) - : void 0; + } + function ye(e) { + for ( + var t = e.srcEvent.clientX, a = e.srcEvent.clientY, i = 0; + i < this.lastTouches.length; + i++ + ) { + var n = this.lastTouches[i], + s = Math.abs(t - n.x), + o = Math.abs(a - n.y); + if (s <= 25 && o <= 25) return true; + } + return false; + } + (S(he, G, { + handler: function (e) { + var t = de[e.type], + a = pe.call(this, e, t); + a && + this.callback(this.manager, t, { + pointers: a[0], + changedPointers: a[1], + pointerType: F, + srcEvent: e, + }); + }, + }), + S(ge, G, { + handler: function (e, t, a) { + var i = a.pointerType == F, + n = a.pointerType == Y; + if ( + !( + n && + a.sourceCapabilities && + a.sourceCapabilities.firesTouchEvents + ) + ) { + if (i) me.call(this, t, a); + else if (n && ye.call(this, a)) return; + this.callback(e, t, a); } }, - preventSrc: function (e) { - ((this.manager.session.prevented = true), e.preventDefault()); + destroy: function () { + (this.touch.destroy(), this.mouse.destroy()); }, - }; - var we = 32; - function Ae(e) { - ((this.options = l({}, this.defaults, e || {})), - (this.id = P++), - (this.manager = null), - (this.options.enable = v(this.options.enable, true)), - (this.state = 1), - (this.simultaneous = {}), - (this.requireFail = [])); - } - function ke(e) { - return 16 & e - ? "cancel" - : 8 & e - ? "end" - : 4 & e - ? "move" - : 2 & e - ? "start" - : ""; - } - function Ne(e) { - return 16 == e - ? "down" - : 8 == e - ? "up" - : 2 == e - ? "left" - : 4 == e - ? "right" - : ""; - } - function xe(e, t) { - var a = t.manager; - return a ? a.get(e) : e; - } - function Pe() { - Ae.apply(this, arguments); - } - function Me() { - (Pe.apply(this, arguments), (this.pX = null), (this.pY = null)); - } - function Le() { - Pe.apply(this, arguments); - } - function De() { - (Ae.apply(this, arguments), - (this._timer = null), - (this._input = null)); - } - function Be() { - Pe.apply(this, arguments); - } - function Fe() { - Pe.apply(this, arguments); - } - function Ye() { - (Ae.apply(this, arguments), - (this.pTime = false), - (this.pCenter = false), - (this._timer = null), - (this._input = null), - (this.count = 0)); - } - function Ue(e, t) { + })); + var Ee = x(d.style, "touchAction"), + be = Ee !== r, + Se = "compute", + Ie = "auto", + _e = "manipulation", + ve = "none", + Te = "pan-x", + Re = "pan-y", + Oe = (function () { + if (!be) return false; + var e = {}, + t = n.CSS && n.CSS.supports; return ( - ((t = t || {}).recognizers = v( - t.recognizers, - Ue.defaults.preset, - )), - new je(e, t) + [ + "auto", + "manipulation", + "pan-y", + "pan-x", + "pan-x pan-y", + "none", + ].forEach(function (a) { + e[a] = !t || n.CSS.supports("touch-action", a); + }), + e ); - } - function je(e, t) { - ((this.options = l({}, Ue.defaults, t || {})), - (this.options.inputTarget = this.options.inputTarget || e), - (this.handlers = {}), - (this.session = {}), - (this.recognizers = []), - (this.oldCssProps = {}), - (this.element = e), - (this.input = new ( - this.options.inputClass || (D ? ne : B ? he : L ? ge : Z) - )(this, V)), - (this.touchAction = new Ce(this, this.options.touchAction)), - Ge(this, true), - f( - this.options.recognizers, - function (e) { - var t = this.add(new e[0](e[1])); - (e[2] && t.recognizeWith(e[2]), - e[3] && t.requireFailure(e[3])); - }, - this, - )); - } - function Ge(e, t) { - var a, - i = e.element; - i.style && - (f(e.options.cssProps, function (n, s) { - ((a = x(i.style, s)), - t - ? ((e.oldCssProps[a] = i.style[a]), (i.style[a] = n)) - : (i.style[a] = e.oldCssProps[a] || "")); + })(); + function Ce(e, t) { + ((this.manager = e), this.set(t)); + } + Ce.prototype = { + set: function (e) { + (e == Se && (e = this.compute()), + be && + this.manager.element.style && + Oe[e] && + (this.manager.element.style[Ee] = e), + (this.actions = e.toLowerCase().trim())); + }, + update: function () { + this.set(this.manager.options.touchAction); + }, + compute: function () { + var e = []; + return ( + f(this.manager.recognizers, function (t) { + _(t.options.enable, [t]) && + (e = e.concat(t.getTouchAction())); }), + (function (e) { + if (C(e, ve)) return ve; + var t = C(e, Te), + a = C(e, Re); + return t && a + ? ve + : t || a + ? t + ? Te + : Re + : C(e, _e) + ? _e + : Ie; + })(e.join(" ")) + ); + }, + preventDefaults: function (e) { + var t = e.srcEvent, + a = e.offsetDirection; + if (this.manager.session.prevented) t.preventDefault(); + else { + var i = this.actions, + n = C(i, ve) && !Oe.none, + s = C(i, Re) && !Oe["pan-y"], + o = C(i, Te) && !Oe["pan-x"]; + if (n) { + var r = 1 === e.pointers.length, + l = e.distance < 2, + c = e.deltaTime < 250; + if (r && l && c) return; + } + if (!o || !s) + return n || (s && 6 & a) || (o && 24 & a) + ? this.preventSrc(t) + : void 0; + } + }, + preventSrc: function (e) { + ((this.manager.session.prevented = true), e.preventDefault()); + }, + }; + var we = 32; + function Ae(e) { + ((this.options = l({}, this.defaults, e || {})), + (this.id = P++), + (this.manager = null), + (this.options.enable = v(this.options.enable, true)), + (this.state = 1), + (this.simultaneous = {}), + (this.requireFail = [])); + } + function ke(e) { + return 16 & e + ? "cancel" + : 8 & e + ? "end" + : 4 & e + ? "move" + : 2 & e + ? "start" + : ""; + } + function Ne(e) { + return 16 == e + ? "down" + : 8 == e + ? "up" + : 2 == e + ? "left" + : 4 == e + ? "right" + : ""; + } + function xe(e, t) { + var a = t.manager; + return a ? a.get(e) : e; + } + function Pe() { + Ae.apply(this, arguments); + } + function Me() { + (Pe.apply(this, arguments), (this.pX = null), (this.pY = null)); + } + function Le() { + Pe.apply(this, arguments); + } + function De() { + (Ae.apply(this, arguments), + (this._timer = null), + (this._input = null)); + } + function Be() { + Pe.apply(this, arguments); + } + function Fe() { + Pe.apply(this, arguments); + } + function Ye() { + (Ae.apply(this, arguments), + (this.pTime = false), + (this.pCenter = false), + (this._timer = null), + (this._input = null), + (this.count = 0)); + } + function Ue(e, t) { + return ( + ((t = t || {}).recognizers = v( + t.recognizers, + Ue.defaults.preset, + )), + new je(e, t) + ); + } + function je(e, t) { + ((this.options = l({}, Ue.defaults, t || {})), + (this.options.inputTarget = this.options.inputTarget || e), + (this.handlers = {}), + (this.session = {}), + (this.recognizers = []), + (this.oldCssProps = {}), + (this.element = e), + (this.input = new ( + this.options.inputClass || (D ? ne : B ? he : L ? ge : Z) + )(this, V)), + (this.touchAction = new Ce(this, this.options.touchAction)), + Ge(this, true), + f( + this.options.recognizers, + function (e) { + var t = this.add(new e[0](e[1])); + (e[2] && t.recognizeWith(e[2]), + e[3] && t.requireFailure(e[3])); + }, + this, + )); + } + function Ge(e, t) { + var a, + i = e.element; + i.style && + (f(e.options.cssProps, function (n, s) { + ((a = x(i.style, s)), + t + ? ((e.oldCssProps[a] = i.style[a]), (i.style[a] = n)) + : (i.style[a] = e.oldCssProps[a] || "")); + }), t || (e.oldCssProps = {})); - } - ((Ae.prototype = { - defaults: {}, - set: function (e) { - return ( - l(this.options, e), - this.manager && this.manager.touchAction.update(), - this - ); + } + ((Ae.prototype = { + defaults: {}, + set: function (e) { + return ( + l(this.options, e), + this.manager && this.manager.touchAction.update(), + this + ); + }, + recognizeWith: function (e) { + if (m(e, "recognizeWith", this)) return this; + var t = this.simultaneous; + return ( + t[(e = xe(e, this)).id] || + ((t[e.id] = e), e.recognizeWith(this)), + this + ); + }, + dropRecognizeWith: function (e) { + return ( + m(e, "dropRecognizeWith", this) || + ((e = xe(e, this)), delete this.simultaneous[e.id]), + this + ); + }, + requireFailure: function (e) { + if (m(e, "requireFailure", this)) return this; + var t = this.requireFail; + return ( + -1 === A(t, (e = xe(e, this))) && + (t.push(e), e.requireFailure(this)), + this + ); + }, + dropRequireFailure: function (e) { + if (m(e, "dropRequireFailure", this)) return this; + e = xe(e, this); + var t = A(this.requireFail, e); + return (t > -1 && this.requireFail.splice(t, 1), this); + }, + hasRequireFailures: function () { + return this.requireFail.length > 0; + }, + canRecognizeWith: function (e) { + return !!this.simultaneous[e.id]; + }, + emit: function (e) { + var t = this, + a = this.state; + function i(a) { + t.manager.emit(a, e); + } + (a < 8 && i(t.options.event + ke(a)), + i(t.options.event), + e.additionalEvent && i(e.additionalEvent), + a >= 8 && i(t.options.event + ke(a))); + }, + tryEmit: function (e) { + if (this.canEmit()) return this.emit(e); + this.state = we; + }, + canEmit: function () { + for (var e = 0; e < this.requireFail.length;) { + if (!(33 & this.requireFail[e].state)) return false; + e++; + } + return true; + }, + recognize: function (e) { + var t = l({}, e); + if (!_(this.options.enable, [this, t])) + return (this.reset(), void (this.state = we)); + (56 & this.state && (this.state = 1), + (this.state = this.process(t)), + 30 & this.state && this.tryEmit(t)); + }, + process: function (e) { }, + getTouchAction: function () { }, + reset: function () { }, + }), + S(Pe, Ae, { + defaults: { pointers: 1 }, + attrTest: function (e) { + var t = this.options.pointers; + return 0 === t || e.pointers.length === t; + }, + process: function (e) { + var t = this.state, + a = e.eventType, + i = 6 & t, + n = this.attrTest(e); + return i && (8 & a || !n) + ? 16 | t + : i || n + ? 4 & a + ? 8 | t + : 2 & t + ? 4 | t + : 2 + : we; }, - recognizeWith: function (e) { - if (m(e, "recognizeWith", this)) return this; - var t = this.simultaneous; + }), + S(Me, Pe, { + defaults: { + event: "pan", + threshold: 10, + pointers: 1, + direction: 30, + }, + getTouchAction: function () { + var e = this.options.direction, + t = []; + return (6 & e && t.push(Re), 24 & e && t.push(Te), t); + }, + directionTest: function (e) { + var t = this.options, + a = true, + i = e.distance, + n = e.direction, + s = e.deltaX, + o = e.deltaY; return ( - t[(e = xe(e, this)).id] || - ((t[e.id] = e), e.recognizeWith(this)), - this + n & t.direction || + (6 & t.direction + ? ((n = 0 === s ? 1 : s < 0 ? 2 : 4), + (a = s != this.pX), + (i = Math.abs(e.deltaX))) + : ((n = 0 === o ? 1 : o < 0 ? 8 : 16), + (a = o != this.pY), + (i = Math.abs(e.deltaY)))), + (e.direction = n), + a && i > t.threshold && n & t.direction ); }, - dropRecognizeWith: function (e) { + attrTest: function (e) { return ( - m(e, "dropRecognizeWith", this) || - ((e = xe(e, this)), delete this.simultaneous[e.id]), - this + Pe.prototype.attrTest.call(this, e) && + (2 & this.state || + (!(2 & this.state) && this.directionTest(e))) ); }, - requireFailure: function (e) { - if (m(e, "requireFailure", this)) return this; - var t = this.requireFail; + emit: function (e) { + ((this.pX = e.deltaX), (this.pY = e.deltaY)); + var t = Ne(e.direction); + (t && (e.additionalEvent = this.options.event + t), + this._super.emit.call(this, e)); + }, + }), + S(Le, Pe, { + defaults: { event: "pinch", threshold: 0, pointers: 2 }, + getTouchAction: function () { + return [ve]; + }, + attrTest: function (e) { return ( - -1 === A(t, (e = xe(e, this))) && - (t.push(e), e.requireFailure(this)), - this + this._super.attrTest.call(this, e) && + (Math.abs(e.scale - 1) > this.options.threshold || + 2 & this.state) ); }, - dropRequireFailure: function (e) { - if (m(e, "dropRequireFailure", this)) return this; - e = xe(e, this); - var t = A(this.requireFail, e); - return (t > -1 && this.requireFail.splice(t, 1), this); + emit: function (e) { + if (1 !== e.scale) { + var t = e.scale < 1 ? "in" : "out"; + e.additionalEvent = this.options.event + t; + } + this._super.emit.call(this, e); }, - hasRequireFailures: function () { - return this.requireFail.length > 0; + }), + S(De, Ae, { + defaults: { + event: "press", + pointers: 1, + time: 251, + threshold: 9, + }, + getTouchAction: function () { + return [Ie]; + }, + process: function (e) { + var t = this.options, + a = e.pointers.length === t.pointers, + i = e.distance < t.threshold, + n = e.deltaTime > t.time; + if (((this._input = e), !i || !a || (12 & e.eventType && !n))) + this.reset(); + else if (1 & e.eventType) + (this.reset(), + (this._timer = g( + function () { + ((this.state = 8), this.tryEmit()); + }, + t.time, + this, + ))); + else if (4 & e.eventType) return 8; + return we; }, - canRecognizeWith: function (e) { - return !!this.simultaneous[e.id]; + reset: function () { + clearTimeout(this._timer); }, emit: function (e) { - var t = this, - a = this.state; - function i(a) { - t.manager.emit(a, e); - } - (a < 8 && i(t.options.event + ke(a)), - i(t.options.event), - e.additionalEvent && i(e.additionalEvent), - a >= 8 && i(t.options.event + ke(a))); + 8 === this.state && + (e && 4 & e.eventType + ? this.manager.emit(this.options.event + "up", e) + : ((this._input.timeStamp = p()), + this.manager.emit(this.options.event, this._input))); }, - tryEmit: function (e) { - if (this.canEmit()) return this.emit(e); - this.state = we; + }), + S(Be, Pe, { + defaults: { event: "rotate", threshold: 0, pointers: 2 }, + getTouchAction: function () { + return [ve]; + }, + attrTest: function (e) { + return ( + this._super.attrTest.call(this, e) && + (Math.abs(e.rotation) > this.options.threshold || + 2 & this.state) + ); + }, + }), + S(Fe, Pe, { + defaults: { + event: "swipe", + threshold: 10, + velocity: 0.3, + direction: 30, + pointers: 1, + }, + getTouchAction: function () { + return Me.prototype.getTouchAction.call(this); + }, + attrTest: function (e) { + var t, + a = this.options.direction; + return ( + 30 & a + ? (t = e.overallVelocity) + : 6 & a + ? (t = e.overallVelocityX) + : 24 & a && (t = e.overallVelocityY), + this._super.attrTest.call(this, e) && + a & e.offsetDirection && + e.distance > this.options.threshold && + e.maxPointers == this.options.pointers && + h(t) > this.options.velocity && + 4 & e.eventType + ); + }, + emit: function (e) { + var t = Ne(e.offsetDirection); + (t && this.manager.emit(this.options.event + t, e), + this.manager.emit(this.options.event, e)); }, - canEmit: function () { - for (var e = 0; e < this.requireFail.length; ) { - if (!(33 & this.requireFail[e].state)) return false; - e++; + }), + S(Ye, Ae, { + defaults: { + event: "tap", + pointers: 1, + taps: 1, + interval: 300, + time: 250, + threshold: 9, + posThreshold: 10, + }, + getTouchAction: function () { + return [_e]; + }, + process: function (e) { + var t = this.options, + a = e.pointers.length === t.pointers, + i = e.distance < t.threshold, + n = e.deltaTime < t.time; + if ((this.reset(), 1 & e.eventType && 0 === this.count)) + return this.failTimeout(); + if (i && n && a) { + if (4 != e.eventType) return this.failTimeout(); + var s = !this.pTime || e.timeStamp - this.pTime < t.interval, + o = + !this.pCenter || + q(this.pCenter, e.center) < t.posThreshold; + if ( + ((this.pTime = e.timeStamp), + (this.pCenter = e.center), + o && s ? (this.count += 1) : (this.count = 1), + (this._input = e), + 0 == this.count % t.taps) + ) + return this.hasRequireFailures() + ? ((this._timer = g( + function () { + ((this.state = 8), this.tryEmit()); + }, + t.interval, + this, + )), + 2) + : 8; } - return true; + return we; }, - recognize: function (e) { - var t = l({}, e); - if (!_(this.options.enable, [this, t])) - return (this.reset(), void (this.state = we)); - (56 & this.state && (this.state = 1), - (this.state = this.process(t)), - 30 & this.state && this.tryEmit(t)); + failTimeout: function () { + return ( + (this._timer = g( + function () { + this.state = we; + }, + this.options.interval, + this, + )), + we + ); }, - process: function (e) {}, - getTouchAction: function () {}, - reset: function () {}, - }), - S(Pe, Ae, { - defaults: { pointers: 1 }, - attrTest: function (e) { - var t = this.options.pointers; - return 0 === t || e.pointers.length === t; - }, - process: function (e) { - var t = this.state, - a = e.eventType, - i = 6 & t, - n = this.attrTest(e); - return i && (8 & a || !n) - ? 16 | t - : i || n - ? 4 & a - ? 8 | t - : 2 & t - ? 4 | t - : 2 - : we; - }, - }), - S(Me, Pe, { - defaults: { - event: "pan", - threshold: 10, - pointers: 1, - direction: 30, - }, - getTouchAction: function () { - var e = this.options.direction, - t = []; - return (6 & e && t.push(Re), 24 & e && t.push(Te), t); - }, - directionTest: function (e) { - var t = this.options, - a = true, - i = e.distance, - n = e.direction, - s = e.deltaX, - o = e.deltaY; - return ( - n & t.direction || - (6 & t.direction - ? ((n = 0 === s ? 1 : s < 0 ? 2 : 4), - (a = s != this.pX), - (i = Math.abs(e.deltaX))) - : ((n = 0 === o ? 1 : o < 0 ? 8 : 16), - (a = o != this.pY), - (i = Math.abs(e.deltaY)))), - (e.direction = n), - a && i > t.threshold && n & t.direction - ); - }, - attrTest: function (e) { - return ( - Pe.prototype.attrTest.call(this, e) && - (2 & this.state || - (!(2 & this.state) && this.directionTest(e))) - ); - }, - emit: function (e) { - ((this.pX = e.deltaX), (this.pY = e.deltaY)); - var t = Ne(e.direction); - (t && (e.additionalEvent = this.options.event + t), - this._super.emit.call(this, e)); - }, - }), - S(Le, Pe, { - defaults: { event: "pinch", threshold: 0, pointers: 2 }, - getTouchAction: function () { - return [ve]; - }, - attrTest: function (e) { - return ( - this._super.attrTest.call(this, e) && - (Math.abs(e.scale - 1) > this.options.threshold || - 2 & this.state) - ); - }, - emit: function (e) { - if (1 !== e.scale) { - var t = e.scale < 1 ? "in" : "out"; - e.additionalEvent = this.options.event + t; - } - this._super.emit.call(this, e); - }, - }), - S(De, Ae, { - defaults: { - event: "press", - pointers: 1, - time: 251, - threshold: 9, - }, - getTouchAction: function () { - return [Ie]; - }, - process: function (e) { - var t = this.options, - a = e.pointers.length === t.pointers, - i = e.distance < t.threshold, - n = e.deltaTime > t.time; - if (((this._input = e), !i || !a || (12 & e.eventType && !n))) - this.reset(); - else if (1 & e.eventType) - (this.reset(), - (this._timer = g( - function () { - ((this.state = 8), this.tryEmit()); - }, - t.time, - this, - ))); - else if (4 & e.eventType) return 8; - return we; - }, - reset: function () { - clearTimeout(this._timer); - }, - emit: function (e) { - 8 === this.state && - (e && 4 & e.eventType - ? this.manager.emit(this.options.event + "up", e) - : ((this._input.timeStamp = p()), - this.manager.emit(this.options.event, this._input))); - }, - }), - S(Be, Pe, { - defaults: { event: "rotate", threshold: 0, pointers: 2 }, - getTouchAction: function () { - return [ve]; - }, - attrTest: function (e) { - return ( - this._super.attrTest.call(this, e) && - (Math.abs(e.rotation) > this.options.threshold || - 2 & this.state) - ); - }, - }), - S(Fe, Pe, { - defaults: { - event: "swipe", - threshold: 10, - velocity: 0.3, - direction: 30, - pointers: 1, - }, - getTouchAction: function () { - return Me.prototype.getTouchAction.call(this); - }, - attrTest: function (e) { - var t, - a = this.options.direction; - return ( - 30 & a - ? (t = e.overallVelocity) - : 6 & a - ? (t = e.overallVelocityX) - : 24 & a && (t = e.overallVelocityY), - this._super.attrTest.call(this, e) && - a & e.offsetDirection && - e.distance > this.options.threshold && - e.maxPointers == this.options.pointers && - h(t) > this.options.velocity && - 4 & e.eventType - ); - }, - emit: function (e) { - var t = Ne(e.offsetDirection); - (t && this.manager.emit(this.options.event + t, e), - this.manager.emit(this.options.event, e)); - }, - }), - S(Ye, Ae, { - defaults: { - event: "tap", - pointers: 1, - taps: 1, - interval: 300, - time: 250, - threshold: 9, - posThreshold: 10, - }, - getTouchAction: function () { - return [_e]; - }, - process: function (e) { - var t = this.options, - a = e.pointers.length === t.pointers, - i = e.distance < t.threshold, - n = e.deltaTime < t.time; - if ((this.reset(), 1 & e.eventType && 0 === this.count)) - return this.failTimeout(); - if (i && n && a) { - if (4 != e.eventType) return this.failTimeout(); - var s = !this.pTime || e.timeStamp - this.pTime < t.interval, - o = - !this.pCenter || - q(this.pCenter, e.center) < t.posThreshold; - if ( - ((this.pTime = e.timeStamp), - (this.pCenter = e.center), - o && s ? (this.count += 1) : (this.count = 1), - (this._input = e), - 0 == this.count % t.taps) - ) - return this.hasRequireFailures() - ? ((this._timer = g( - function () { - ((this.state = 8), this.tryEmit()); - }, - t.interval, - this, - )), - 2) - : 8; - } - return we; - }, - failTimeout: function () { - return ( - (this._timer = g( - function () { - this.state = we; - }, - this.options.interval, - this, - )), - we - ); - }, - reset: function () { - clearTimeout(this._timer); - }, - emit: function () { - 8 == this.state && - ((this._input.tapCount = this.count), + reset: function () { + clearTimeout(this._timer); + }, + emit: function () { + 8 == this.state && + ((this._input.tapCount = this.count), this.manager.emit(this.options.event, this._input)); - }, - }), - (Ue.VERSION = "2.0.7"), - (Ue.defaults = { - domEvents: false, - touchAction: Se, - enable: true, - inputTarget: null, - inputClass: null, - preset: [ - [Be, { enable: false }], - [Le, { enable: false }, ["rotate"]], - [Fe, { direction: 6 }], - [Me, { direction: 6 }, ["swipe"]], - [Ye], - [Ye, { event: "doubletap", taps: 2 }, ["tap"]], - [De], - ], - cssProps: { - userSelect: "none", - touchSelect: "none", - touchCallout: "none", - contentZooming: "none", - userDrag: "none", - tapHighlightColor: "rgba(0,0,0,0)", - }, - }), - (je.prototype = { - set: function (e) { + }, + }), + (Ue.VERSION = "2.0.7"), + (Ue.defaults = { + domEvents: false, + touchAction: Se, + enable: true, + inputTarget: null, + inputClass: null, + preset: [ + [Be, { enable: false }], + [Le, { enable: false }, ["rotate"]], + [Fe, { direction: 6 }], + [Me, { direction: 6 }, ["swipe"]], + [Ye], + [Ye, { event: "doubletap", taps: 2 }, ["tap"]], + [De], + ], + cssProps: { + userSelect: "none", + touchSelect: "none", + touchCallout: "none", + contentZooming: "none", + userDrag: "none", + tapHighlightColor: "rgba(0,0,0,0)", + }, + }), + (je.prototype = { + set: function (e) { + return ( + l(this.options, e), + e.touchAction && this.touchAction.update(), + e.inputTarget && + (this.input.destroy(), + (this.input.target = e.inputTarget), + this.input.init()), + this + ); + }, + stop: function (e) { + this.session.stopped = e ? 2 : 1; + }, + recognize: function (e) { + var t = this.session; + if (!t.stopped) { + var a; + this.touchAction.preventDefaults(e); + var i = this.recognizers, + n = t.curRecognizer; + (!n || (n && 8 & n.state)) && (n = t.curRecognizer = null); + for (var s = 0; s < i.length;) + ((a = i[s]), + 2 === t.stopped || (n && a != n && !a.canRecognizeWith(n)) + ? a.reset() + : a.recognize(e), + !n && 14 & a.state && (n = t.curRecognizer = a), + s++); + } + }, + get: function (e) { + if (e instanceof Ae) return e; + for (var t = this.recognizers, a = 0; a < t.length; a++) + if (t[a].options.event == e) return t[a]; + return null; + }, + add: function (e) { + if (m(e, "add", this)) return this; + var t = this.get(e.options.event); + return ( + t && this.remove(t), + this.recognizers.push(e), + (e.manager = this), + this.touchAction.update(), + e + ); + }, + remove: function (e) { + if (m(e, "remove", this)) return this; + if ((e = this.get(e))) { + var t = this.recognizers, + a = A(t, e); + -1 !== a && (t.splice(a, 1), this.touchAction.update()); + } + return this; + }, + on: function (e, t) { + if (e !== r && t !== r) { + var a = this.handlers; return ( - l(this.options, e), - e.touchAction && this.touchAction.update(), - e.inputTarget && - (this.input.destroy(), - (this.input.target = e.inputTarget), - this.input.init()), + f(w(e), function (e) { + ((a[e] = a[e] || []), a[e].push(t)); + }), this ); - }, - stop: function (e) { - this.session.stopped = e ? 2 : 1; - }, - recognize: function (e) { - var t = this.session; - if (!t.stopped) { - var a; - this.touchAction.preventDefaults(e); - var i = this.recognizers, - n = t.curRecognizer; - (!n || (n && 8 & n.state)) && (n = t.curRecognizer = null); - for (var s = 0; s < i.length; ) - ((a = i[s]), - 2 === t.stopped || (n && a != n && !a.canRecognizeWith(n)) - ? a.reset() - : a.recognize(e), - !n && 14 & a.state && (n = t.curRecognizer = a), - s++); - } - }, - get: function (e) { - if (e instanceof Ae) return e; - for (var t = this.recognizers, a = 0; a < t.length; a++) - if (t[a].options.event == e) return t[a]; - return null; - }, - add: function (e) { - if (m(e, "add", this)) return this; - var t = this.get(e.options.event); - return ( - t && this.remove(t), - this.recognizers.push(e), - (e.manager = this), - this.touchAction.update(), - e - ); - }, - remove: function (e) { - if (m(e, "remove", this)) return this; - if ((e = this.get(e))) { - var t = this.recognizers, - a = A(t, e); - -1 !== a && (t.splice(a, 1), this.touchAction.update()); - } - return this; - }, - on: function (e, t) { - if (e !== r && t !== r) { - var a = this.handlers; - return ( - f(w(e), function (e) { - ((a[e] = a[e] || []), a[e].push(t)); - }), - this - ); - } - }, - off: function (e, t) { - if (e !== r) { - var a = this.handlers; - return ( - f(w(e), function (e) { - t ? a[e] && a[e].splice(A(a[e], t), 1) : delete a[e]; - }), - this - ); - } - }, - emit: function (e, t) { - this.options.domEvents && - (function (e, t) { - var a = s.createEvent("Event"); - (a.initEvent(e, true, true), - (a.gesture = t), - t.target.dispatchEvent(a)); - })(e, t); - var a = this.handlers[e] && this.handlers[e].slice(); - if (a && a.length) { - ((t.type = e), - (t.preventDefault = function () { - t.srcEvent.preventDefault(); - })); - for (var i = 0; i < a.length; ) (a[i](t), i++); - } - }, - destroy: function () { - (this.element && Ge(this, false), - (this.handlers = {}), - (this.session = {}), - this.input.destroy(), - (this.element = null)); - }, - }), - l(Ue, { - INPUT_START: 1, - INPUT_MOVE: 2, - INPUT_END: 4, - INPUT_CANCEL: 8, - STATE_POSSIBLE: 1, - STATE_BEGAN: 2, - STATE_CHANGED: 4, - STATE_ENDED: 8, - STATE_RECOGNIZED: 8, - STATE_CANCELLED: 16, - STATE_FAILED: we, - DIRECTION_NONE: 1, - DIRECTION_LEFT: 2, - DIRECTION_RIGHT: 4, - DIRECTION_UP: 8, - DIRECTION_DOWN: 16, - DIRECTION_HORIZONTAL: 6, - DIRECTION_VERTICAL: 24, - DIRECTION_ALL: 30, - Manager: je, - Input: G, - TouchAction: Ce, - TouchInput: he, - MouseInput: Z, - PointerEventInput: ne, - TouchMouseInput: ge, - SingleTouchInput: le, - Recognizer: Ae, - AttrRecognizer: Pe, - Tap: Ye, - Pan: Me, - Swipe: Fe, - Pinch: Le, - Rotate: Be, - Press: De, - on: T, - off: R, - each: f, - merge: b, - extend: E, - assign: l, - inherit: S, - bindFn: I, - prefixed: x, - }), - ((void 0 !== n - ? n - : "undefined" != typeof self - ? self - : {} - ).Hammer = Ue), - (i = function () { - return Ue; - }.call(t, a, t, e)) === r || (e.exports = i)); - })(window, document); - }, - 8917: (e) => { - var t = /^\s+|\s+$/g, - a = /^[-+]0x[0-9a-f]+$/i, - i = /^0b[01]+$/i, - n = /^0o[0-7]+$/i, - s = parseInt, - o = Object.prototype.toString; - function r(e) { - var t = typeof e; - return !!e && ("object" == t || "function" == t); - } - e.exports = function (e) { - return (function (e, l) { - var c; - if ("function" != typeof l) - throw new TypeError("Expected a function"); - return ( - (e = (function (e) { - var l = (function (e) { - return e - ? 1 / 0 === - (e = (function (e) { - if ("number" == typeof e) return e; - if ( - (function (e) { - return ( - "symbol" == typeof e || - ((function (e) { - return !!e && "object" == typeof e; - })(e) && - "[object Symbol]" == o.call(e)) - ); - })(e) - ) - return NaN; - if (r(e)) { - var l = - "function" == typeof e.valueOf - ? e.valueOf() - : e; - e = r(l) ? l + "" : l; - } - if ("string" != typeof e) return 0 === e ? e : +e; - e = e.replace(t, ""); - var c = i.test(e); - return c || n.test(e) - ? s(e.slice(2), c ? 2 : 8) - : a.test(e) - ? NaN - : +e; - })(e)) || e === -1 / 0 - ? 17976931348623157e292 * (e < 0 ? -1 : 1) - : e == e - ? e - : 0 - : 0 === e - ? e - : 0; - })(e), - c = l % 1; - return l == l ? (c ? l - c : l) : 0; - })(e)), - function () { + } + }, + off: function (e, t) { + if (e !== r) { + var a = this.handlers; return ( - --e > 0 && (c = l.apply(this, arguments)), - e <= 1 && (l = void 0), - c + f(w(e), function (e) { + t ? a[e] && a[e].splice(A(a[e], t), 1) : delete a[e]; + }), + this ); } - ); - })(2, e); - }; - }, - 1670: function (e, t, a) { - !(function (e) { - "use strict"; - var t = - "undefined" != typeof window - ? window - : void 0 !== a.g - ? a.g - : "undefined" != typeof self - ? self - : {}, - i = function (e, t) { - if (((t = t.split(":")[0]), !(e = +e))) return false; - switch (t) { - case "http": - case "ws": - return 80 !== e; - case "https": - case "wss": - return 443 !== e; - case "ftp": - return 21 !== e; - case "gopher": - return 70 !== e; - case "file": - return false; + }, + emit: function (e, t) { + this.options.domEvents && + (function (e, t) { + var a = s.createEvent("Event"); + (a.initEvent(e, true, true), + (a.gesture = t), + t.target.dispatchEvent(a)); + })(e, t); + var a = this.handlers[e] && this.handlers[e].slice(); + if (a && a.length) { + ((t.type = e), + (t.preventDefault = function () { + t.srcEvent.preventDefault(); + })); + for (var i = 0; i < a.length;) (a[i](t), i++); } - return 0 !== e; }, - n = Object.prototype.hasOwnProperty; - function s(e) { - try { - return decodeURIComponent(e.replace(/\+/g, " ")); - } catch (e) { - return null; + destroy: function () { + (this.element && Ge(this, false), + (this.handlers = {}), + (this.session = {}), + this.input.destroy(), + (this.element = null)); + }, + }), + l(Ue, { + INPUT_START: 1, + INPUT_MOVE: 2, + INPUT_END: 4, + INPUT_CANCEL: 8, + STATE_POSSIBLE: 1, + STATE_BEGAN: 2, + STATE_CHANGED: 4, + STATE_ENDED: 8, + STATE_RECOGNIZED: 8, + STATE_CANCELLED: 16, + STATE_FAILED: we, + DIRECTION_NONE: 1, + DIRECTION_LEFT: 2, + DIRECTION_RIGHT: 4, + DIRECTION_UP: 8, + DIRECTION_DOWN: 16, + DIRECTION_HORIZONTAL: 6, + DIRECTION_VERTICAL: 24, + DIRECTION_ALL: 30, + Manager: je, + Input: G, + TouchAction: Ce, + TouchInput: he, + MouseInput: Z, + PointerEventInput: ne, + TouchMouseInput: ge, + SingleTouchInput: le, + Recognizer: Ae, + AttrRecognizer: Pe, + Tap: Ye, + Pan: Me, + Swipe: Fe, + Pinch: Le, + Rotate: Be, + Press: De, + on: T, + off: R, + each: f, + merge: b, + extend: E, + assign: l, + inherit: S, + bindFn: I, + prefixed: x, + }), + ((void 0 !== n + ? n + : "undefined" != typeof self + ? self + : {} + ).Hammer = Ue), + (i = function () { + return Ue; + }.call(t, a, t, e)) === r || (e.exports = i)); + })(window, document); + }, + 8917: (e) => { + var t = /^\s+|\s+$/g, + a = /^[-+]0x[0-9a-f]+$/i, + i = /^0b[01]+$/i, + n = /^0o[0-7]+$/i, + s = parseInt, + o = Object.prototype.toString; + function r(e) { + var t = typeof e; + return !!e && ("object" == t || "function" == t); + } + e.exports = function (e) { + return (function (e, l) { + var c; + if ("function" != typeof l) + throw new TypeError("Expected a function"); + return ( + (e = (function (e) { + var l = (function (e) { + return e + ? 1 / 0 === + (e = (function (e) { + if ("number" == typeof e) return e; + if ( + (function (e) { + return ( + "symbol" == typeof e || + ((function (e) { + return !!e && "object" == typeof e; + })(e) && + "[object Symbol]" == o.call(e)) + ); + })(e) + ) + return NaN; + if (r(e)) { + var l = + "function" == typeof e.valueOf + ? e.valueOf() + : e; + e = r(l) ? l + "" : l; + } + if ("string" != typeof e) return 0 === e ? e : +e; + e = e.replace(t, ""); + var c = i.test(e); + return c || n.test(e) + ? s(e.slice(2), c ? 2 : 8) + : a.test(e) + ? NaN + : +e; + })(e)) || e === -1 / 0 + ? 17976931348623157e292 * (e < 0 ? -1 : 1) + : e == e + ? e + : 0 + : 0 === e + ? e + : 0; + })(e), + c = l % 1; + return l == l ? (c ? l - c : l) : 0; + })(e)), + function () { + return ( + --e > 0 && (c = l.apply(this, arguments)), + e <= 1 && (l = void 0), + c + ); } - } - function o(e) { - try { - return encodeURIComponent(e); - } catch (e) { - return null; + ); + })(2, e); + }; + }, + 1670: function (e, t, a) { + !(function (e) { + "use strict"; + var t = + "undefined" != typeof window + ? window + : void 0 !== a.g + ? a.g + : "undefined" != typeof self + ? self + : {}, + i = function (e, t) { + if (((t = t.split(":")[0]), !(e = +e))) return false; + switch (t) { + case "http": + case "ws": + return 80 !== e; + case "https": + case "wss": + return 443 !== e; + case "ftp": + return 21 !== e; + case "gopher": + return 70 !== e; + case "file": + return false; } + return 0 !== e; + }, + n = Object.prototype.hasOwnProperty; + function s(e) { + try { + return decodeURIComponent(e.replace(/\+/g, " ")); + } catch (e) { + return null; } - var r = { - stringify: function (e, t) { - t = t || ""; - var a, - i, - s = []; - for (i in ("string" != typeof t && (t = "?"), e)) - if (n.call(e, i)) { - if ( - ((a = e[i]) || (null != a && !isNaN(a)) || (a = ""), - (i = o(i)), - (a = o(a)), - null === i || null === a) - ) - continue; - s.push(i + "=" + a); - } - return s.length ? t + s.join("&") : ""; - }, - parse: function (e) { - for ( - var t, a = /([^=?#&]+)=?([^&]*)/g, i = {}; - (t = a.exec(e)); - ) { - var n = s(t[1]), - o = s(t[2]); - null === n || null === o || n in i || (i[n] = o); - } - return i; - }, - }, - l = /^[A-Za-z][A-Za-z0-9+-.]*:\/\//, - c = /^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i, - d = new RegExp( - "^[\\x09\\x0A\\x0B\\x0C\\x0D\\x20\\xA0\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000\\u2028\\u2029\\uFEFF]+", - ); - function u(e) { - return (e || "").toString().replace(d, ""); + } + function o(e) { + try { + return encodeURIComponent(e); + } catch (e) { + return null; } - var h = [ - ["#", "hash"], - ["?", "query"], - function (e, t) { - return m(t.protocol) ? e.replace(/\\/g, "/") : e; - }, - ["/", "pathname"], - ["@", "auth", 1], - [NaN, "host", void 0, 1, 1], - [/:(\d+)$/, "port", void 0, 1], - [NaN, "hostname", void 0, 1, 1], - ], - p = { hash: 1, query: 1 }; - function g(e) { + } + var r = { + stringify: function (e, t) { + t = t || ""; var a, - i = - ("undefined" != typeof window - ? window - : void 0 !== t - ? t - : "undefined" != typeof self - ? self - : {} - ).location || {}, - n = {}, - s = typeof (e = e || i); - if ("blob:" === e.protocol) n = new y(unescape(e.pathname), {}); - else if ("string" === s) - for (a in ((n = new y(e, {})), p)) delete n[a]; - else if ("object" === s) { - for (a in e) a in p || (n[a] = e[a]); - void 0 === n.slashes && (n.slashes = l.test(e.href)); + i, + s = []; + for (i in ("string" != typeof t && (t = "?"), e)) + if (n.call(e, i)) { + if ( + ((a = e[i]) || (null != a && !isNaN(a)) || (a = ""), + (i = o(i)), + (a = o(a)), + null === i || null === a) + ) + continue; + s.push(i + "=" + a); + } + return s.length ? t + s.join("&") : ""; + }, + parse: function (e) { + for ( + var t, a = /([^=?#&]+)=?([^&]*)/g, i = {}; + (t = a.exec(e)); + ) { + var n = s(t[1]), + o = s(t[2]); + null === n || null === o || n in i || (i[n] = o); + } + return i; + }, + }, + l = /^[A-Za-z][A-Za-z0-9+-.]*:\/\//, + c = /^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i, + d = new RegExp( + "^[\\x09\\x0A\\x0B\\x0C\\x0D\\x20\\xA0\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000\\u2028\\u2029\\uFEFF]+", + ); + function u(e) { + return (e || "").toString().replace(d, ""); + } + var h = [ + ["#", "hash"], + ["?", "query"], + function (e, t) { + return m(t.protocol) ? e.replace(/\\/g, "/") : e; + }, + ["/", "pathname"], + ["@", "auth", 1], + [NaN, "host", void 0, 1, 1], + [/:(\d+)$/, "port", void 0, 1], + [NaN, "hostname", void 0, 1, 1], + ], + p = { hash: 1, query: 1 }; + function g(e) { + var a, + i = + ("undefined" != typeof window + ? window + : void 0 !== t + ? t + : "undefined" != typeof self + ? self + : {} + ).location || {}, + n = {}, + s = typeof (e = e || i); + if ("blob:" === e.protocol) n = new y(unescape(e.pathname), {}); + else if ("string" === s) + for (a in ((n = new y(e, {})), p)) delete n[a]; + else if ("object" === s) { + for (a in e) a in p || (n[a] = e[a]); + void 0 === n.slashes && (n.slashes = l.test(e.href)); + } + return n; + } + function m(e) { + return ( + "file:" === e || + "ftp:" === e || + "http:" === e || + "https:" === e || + "ws:" === e || + "wss:" === e + ); + } + function f(e, t) { + ((e = u(e)), (t = t || {})); + var a, + i = c.exec(e), + n = i[1] ? i[1].toLowerCase() : "", + s = !!i[2], + o = !!i[3], + r = 0; + return ( + s + ? o + ? ((a = i[2] + i[3] + i[4]), (r = i[2].length + i[3].length)) + : ((a = i[2] + i[4]), (r = i[2].length)) + : o + ? ((a = i[3] + i[4]), (r = i[3].length)) + : (a = i[4]), + "file:" === n + ? r >= 2 && (a = a.slice(2)) + : m(n) + ? (a = i[4]) + : n + ? s && (a = a.slice(2)) + : r >= 2 && m(t.protocol) && (a = i[4]), + { protocol: n, slashes: s || m(n), slashesCount: r, rest: a } + ); + } + function y(e, t, a) { + if (((e = u(e)), !(this instanceof y))) return new y(e, t, a); + var n, + s, + o, + l, + c, + d, + p = h.slice(), + E = typeof t, + b = this, + S = 0; + for ( + "object" !== E && "string" !== E && ((a = t), (t = null)), + a && "function" != typeof a && (a = r.parse), + n = !(s = f(e || "", (t = g(t)))).protocol && !s.slashes, + b.slashes = s.slashes || (n && t.slashes), + b.protocol = s.protocol || t.protocol || "", + e = s.rest, + ("file:" === b.protocol || + (!s.slashes && + (s.protocol || s.slashesCount < 2 || !m(b.protocol)))) && + (p[3] = [/(.*)/, "pathname"]); + S < p.length; + S++ + ) + "function" != typeof (l = p[S]) + ? ((o = l[0]), + (d = l[1]), + o != o + ? (b[d] = e) + : "string" == typeof o + ? ~(c = e.indexOf(o)) && + ("number" == typeof l[2] + ? ((b[d] = e.slice(0, c)), (e = e.slice(c + l[2]))) + : ((b[d] = e.slice(c)), (e = e.slice(0, c)))) + : (c = o.exec(e)) && + ((b[d] = c[1]), (e = e.slice(0, c.index))), + (b[d] = b[d] || (n && l[3] && t[d]) || ""), + l[4] && (b[d] = b[d].toLowerCase())) + : (e = l(e, b)); + (a && (b.query = a(b.query)), + n && + t.slashes && + "/" !== b.pathname.charAt(0) && + ("" !== b.pathname || "" !== t.pathname) && + (b.pathname = (function (e, t) { + if ("" === e) return t; + for ( + var a = (t || "/") + .split("/") + .slice(0, -1) + .concat(e.split("/")), + i = a.length, + n = a[i - 1], + s = false, + o = 0; + i--; + ) + "." === a[i] + ? a.splice(i, 1) + : ".." === a[i] + ? (a.splice(i, 1), o++) + : o && (0 === i && (s = true), a.splice(i, 1), o--); + return ( + s && a.unshift(""), + ("." !== n && ".." !== n) || a.push(""), + a.join("/") + ); + })(b.pathname, t.pathname)), + "/" !== b.pathname.charAt(0) && + m(b.protocol) && + (b.pathname = "/" + b.pathname), + i(b.port, b.protocol) || ((b.host = b.hostname), (b.port = "")), + (b.username = b.password = ""), + b.auth && + ((l = b.auth.split(":")), + (b.username = l[0] || ""), + (b.password = l[1] || "")), + (b.origin = + "file:" !== b.protocol && m(b.protocol) && b.host + ? b.protocol + "//" + b.host + : "null"), + (b.href = b.toString())); + } + ((y.prototype = { + set: function (e, t, a) { + var n = this; + switch (e) { + case "query": + ("string" == typeof t && t.length && (t = (a || r.parse)(t)), + (n[e] = t)); + break; + case "port": + ((n[e] = t), + i(t, n.protocol) + ? t && (n.host = n.hostname + ":" + t) + : ((n.host = n.hostname), (n[e] = ""))); + break; + case "hostname": + ((n[e] = t), n.port && (t += ":" + n.port), (n.host = t)); + break; + case "host": + ((n[e] = t), + /:\d+$/.test(t) + ? ((t = t.split(":")), + (n.port = t.pop()), + (n.hostname = t.join(":"))) + : ((n.hostname = t), (n.port = ""))); + break; + case "protocol": + ((n.protocol = t.toLowerCase()), (n.slashes = !a)); + break; + case "pathname": + case "hash": + if (t) { + var s = "pathname" === e ? "/" : "#"; + n[e] = t.charAt(0) !== s ? s + t : t; + } else n[e] = t; + break; + default: + n[e] = t; + } + for (var o = 0; o < h.length; o++) { + var l = h[o]; + l[4] && (n[l[1]] = n[l[1]].toLowerCase()); } - return n; - } - function m(e) { return ( - "file:" === e || - "ftp:" === e || - "http:" === e || - "https:" === e || - "ws:" === e || - "wss:" === e + (n.origin = + "file:" !== n.protocol && m(n.protocol) && n.host + ? n.protocol + "//" + n.host + : "null"), + (n.href = n.toString()), + n ); - } - function f(e, t) { - ((e = u(e)), (t = t || {})); - var a, - i = c.exec(e), - n = i[1] ? i[1].toLowerCase() : "", - s = !!i[2], - o = !!i[3], - r = 0; + }, + toString: function (e) { + (e && "function" == typeof e) || (e = r.stringify); + var t, + a = this, + i = a.protocol; + i && ":" !== i.charAt(i.length - 1) && (i += ":"); + var n = i + (a.slashes || m(a.protocol) ? "//" : ""); return ( - s - ? o - ? ((a = i[2] + i[3] + i[4]), (r = i[2].length + i[3].length)) - : ((a = i[2] + i[4]), (r = i[2].length)) - : o - ? ((a = i[3] + i[4]), (r = i[3].length)) - : (a = i[4]), - "file:" === n - ? r >= 2 && (a = a.slice(2)) - : m(n) - ? (a = i[4]) - : n - ? s && (a = a.slice(2)) - : r >= 2 && m(t.protocol) && (a = i[4]), - { protocol: n, slashes: s || m(n), slashesCount: r, rest: a } + a.username && + ((n += a.username), + a.password && (n += ":" + a.password), + (n += "@")), + (n += a.host + a.pathname), + (t = "object" == typeof a.query ? e(a.query) : a.query) && + (n += "?" !== t.charAt(0) ? "?" + t : t), + a.hash && (n += a.hash), + n ); - } - function y(e, t, a) { - if (((e = u(e)), !(this instanceof y))) return new y(e, t, a); - var n, - s, - o, - l, - c, - d, - p = h.slice(), - E = typeof t, - b = this, - S = 0; - for ( - "object" !== E && "string" !== E && ((a = t), (t = null)), - a && "function" != typeof a && (a = r.parse), - n = !(s = f(e || "", (t = g(t)))).protocol && !s.slashes, - b.slashes = s.slashes || (n && t.slashes), - b.protocol = s.protocol || t.protocol || "", - e = s.rest, - ("file:" === b.protocol || - (!s.slashes && - (s.protocol || s.slashesCount < 2 || !m(b.protocol)))) && - (p[3] = [/(.*)/, "pathname"]); - S < p.length; - S++ - ) - "function" != typeof (l = p[S]) - ? ((o = l[0]), - (d = l[1]), - o != o - ? (b[d] = e) - : "string" == typeof o - ? ~(c = e.indexOf(o)) && - ("number" == typeof l[2] - ? ((b[d] = e.slice(0, c)), (e = e.slice(c + l[2]))) - : ((b[d] = e.slice(c)), (e = e.slice(0, c)))) - : (c = o.exec(e)) && - ((b[d] = c[1]), (e = e.slice(0, c.index))), - (b[d] = b[d] || (n && l[3] && t[d]) || ""), - l[4] && (b[d] = b[d].toLowerCase())) - : (e = l(e, b)); - (a && (b.query = a(b.query)), - n && - t.slashes && - "/" !== b.pathname.charAt(0) && - ("" !== b.pathname || "" !== t.pathname) && - (b.pathname = (function (e, t) { - if ("" === e) return t; - for ( - var a = (t || "/") - .split("/") - .slice(0, -1) - .concat(e.split("/")), - i = a.length, - n = a[i - 1], - s = false, - o = 0; - i--; - ) - "." === a[i] - ? a.splice(i, 1) - : ".." === a[i] - ? (a.splice(i, 1), o++) - : o && (0 === i && (s = true), a.splice(i, 1), o--); - return ( - s && a.unshift(""), - ("." !== n && ".." !== n) || a.push(""), - a.join("/") - ); - })(b.pathname, t.pathname)), - "/" !== b.pathname.charAt(0) && - m(b.protocol) && - (b.pathname = "/" + b.pathname), - i(b.port, b.protocol) || ((b.host = b.hostname), (b.port = "")), - (b.username = b.password = ""), - b.auth && - ((l = b.auth.split(":")), - (b.username = l[0] || ""), - (b.password = l[1] || "")), - (b.origin = - "file:" !== b.protocol && m(b.protocol) && b.host - ? b.protocol + "//" + b.host - : "null"), - (b.href = b.toString())); - } - ((y.prototype = { - set: function (e, t, a) { - var n = this; - switch (e) { - case "query": - ("string" == typeof t && t.length && (t = (a || r.parse)(t)), - (n[e] = t)); - break; - case "port": - ((n[e] = t), - i(t, n.protocol) - ? t && (n.host = n.hostname + ":" + t) - : ((n.host = n.hostname), (n[e] = ""))); - break; - case "hostname": - ((n[e] = t), n.port && (t += ":" + n.port), (n.host = t)); - break; - case "host": - ((n[e] = t), - /:\d+$/.test(t) - ? ((t = t.split(":")), - (n.port = t.pop()), - (n.hostname = t.join(":"))) - : ((n.hostname = t), (n.port = ""))); - break; - case "protocol": - ((n.protocol = t.toLowerCase()), (n.slashes = !a)); - break; - case "pathname": - case "hash": - if (t) { - var s = "pathname" === e ? "/" : "#"; - n[e] = t.charAt(0) !== s ? s + t : t; - } else n[e] = t; - break; - default: - n[e] = t; - } - for (var o = 0; o < h.length; o++) { - var l = h[o]; - l[4] && (n[l[1]] = n[l[1]].toLowerCase()); - } - return ( - (n.origin = - "file:" !== n.protocol && m(n.protocol) && n.host - ? n.protocol + "//" + n.host - : "null"), - (n.href = n.toString()), - n - ); - }, - toString: function (e) { - (e && "function" == typeof e) || (e = r.stringify); - var t, - a = this, - i = a.protocol; - i && ":" !== i.charAt(i.length - 1) && (i += ":"); - var n = i + (a.slashes || m(a.protocol) ? "//" : ""); - return ( - a.username && - ((n += a.username), - a.password && (n += ":" + a.password), - (n += "@")), - (n += a.host + a.pathname), - (t = "object" == typeof a.query ? e(a.query) : a.query) && - (n += "?" !== t.charAt(0) ? "?" + t : t), - a.hash && (n += a.hash), - n - ); + }, + }), + (y.extractProtocol = f), + (y.location = g), + (y.trimLeft = u), + (y.qs = r)); + var E = y; + function b(e, t) { + setTimeout( + function (t) { + return e.call(t); }, + 4, + t, + ); + } + function S(e, t) { + "undefined" != typeof process && console[e].call(null, t); + } + function I(e, t) { + void 0 === e && (e = []); + var a = []; + return ( + e.forEach(function (e) { + t(e) || a.push(e); + }), + a + ); + } + var _ = function () { + this.listeners = {}; + }; + function v(e) { + var t = e.indexOf("?"); + return t >= 0 ? e.slice(0, t) : e; + } + ((_.prototype.addEventListener = function (e, t) { + "function" == typeof t && + (Array.isArray(this.listeners[e]) || (this.listeners[e] = []), + 0 === + (function (e, t) { + void 0 === e && (e = []); + var a = []; + return ( + e.forEach(function (e) { + t(e) && a.push(e); + }), + a + ); + })(this.listeners[e], function (e) { + return e === t; + }).length && this.listeners[e].push(t)); + }), + (_.prototype.removeEventListener = function (e, t) { + var a = this.listeners[e]; + this.listeners[e] = I(a, function (e) { + return e === t; + }); }), - (y.extractProtocol = f), - (y.location = g), - (y.trimLeft = u), - (y.qs = r)); - var E = y; - function b(e, t) { - setTimeout( - function (t) { - return e.call(t); - }, - 4, - t, - ); - } - function S(e, t) { - "undefined" != typeof process && console[e].call(null, t); - } - function I(e, t) { - void 0 === e && (e = []); - var a = []; + (_.prototype.dispatchEvent = function (e) { + for (var t = this, a = [], i = arguments.length - 1; i-- > 0;) + a[i] = arguments[i + 1]; + var n = e.type, + s = this.listeners[n]; return ( - e.forEach(function (e) { - t(e) || a.push(e); + !!Array.isArray(s) && + (s.forEach(function (i) { + a.length > 0 ? i.apply(t, a) : i.call(t, e); }), - a + true) ); - } - var _ = function () { - this.listeners = {}; - }; - function v(e) { - var t = e.indexOf("?"); - return t >= 0 ? e.slice(0, t) : e; - } - ((_.prototype.addEventListener = function (e, t) { - "function" == typeof t && - (Array.isArray(this.listeners[e]) || (this.listeners[e] = []), - 0 === - (function (e, t) { - void 0 === e && (e = []); - var a = []; - return ( - e.forEach(function (e) { - t(e) && a.push(e); - }), - a - ); - })(this.listeners[e], function (e) { - return e === t; - }).length && this.listeners[e].push(t)); + })); + var T = function () { + this.urlMap = {}; + }; + ((T.prototype.attachWebSocket = function (e, t) { + var a = v(t), + i = this.urlMap[a]; + if (i && i.server && -1 === i.websockets.indexOf(e)) + return (i.websockets.push(e), i.server); + }), + (T.prototype.addMembershipToRoom = function (e, t) { + var a = this.urlMap[v(e.url)]; + a && + a.server && + -1 !== a.websockets.indexOf(e) && + (a.roomMemberships[t] || (a.roomMemberships[t] = []), + a.roomMemberships[t].push(e)); }), - (_.prototype.removeEventListener = function (e, t) { - var a = this.listeners[e]; - this.listeners[e] = I(a, function (e) { - return e === t; - }); - }), - (_.prototype.dispatchEvent = function (e) { - for (var t = this, a = [], i = arguments.length - 1; i-- > 0; ) - a[i] = arguments[i + 1]; - var n = e.type, - s = this.listeners[n]; + (T.prototype.attachServer = function (e, t) { + var a = v(t); + if (!this.urlMap[a]) return ( - !!Array.isArray(s) && - (s.forEach(function (i) { - a.length > 0 ? i.apply(t, a) : i.call(t, e); + (this.urlMap[a] = { + server: e, + websockets: [], + roomMemberships: {}, }), - true) + e ); - })); - var T = function () { - this.urlMap = {}; - }; - ((T.prototype.attachWebSocket = function (e, t) { + }), + (T.prototype.serverLookup = function (e) { + var t = v(e), + a = this.urlMap[t]; + if (a) return a.server; + }), + (T.prototype.websocketsLookup = function (e, t, a) { + var i, + n = v(e), + s = this.urlMap[n]; + return ( + (i = s ? s.websockets : []), + t && (i = s.roomMemberships[t] || []), + a + ? i.filter(function (e) { + return e !== a; + }) + : i + ); + }), + (T.prototype.removeServer = function (e) { + delete this.urlMap[v(e)]; + }), + (T.prototype.removeWebSocket = function (e, t) { var a = v(t), i = this.urlMap[a]; - if (i && i.server && -1 === i.websockets.indexOf(e)) - return (i.websockets.push(e), i.server); + i && + (i.websockets = I(i.websockets, function (t) { + return t === e; + })); }), - (T.prototype.addMembershipToRoom = function (e, t) { - var a = this.urlMap[v(e.url)]; - a && - a.server && - -1 !== a.websockets.indexOf(e) && - (a.roomMemberships[t] || (a.roomMemberships[t] = []), - a.roomMemberships[t].push(e)); - }), - (T.prototype.attachServer = function (e, t) { - var a = v(t); - if (!this.urlMap[a]) - return ( - (this.urlMap[a] = { - server: e, - websockets: [], - roomMemberships: {}, - }), - e - ); - }), - (T.prototype.serverLookup = function (e) { - var t = v(e), - a = this.urlMap[t]; - if (a) return a.server; - }), - (T.prototype.websocketsLookup = function (e, t, a) { - var i, - n = v(e), - s = this.urlMap[n]; - return ( - (i = s ? s.websockets : []), - t && (i = s.roomMemberships[t] || []), - a - ? i.filter(function (e) { - return e !== a; - }) - : i - ); - }), - (T.prototype.removeServer = function (e) { - delete this.urlMap[v(e)]; - }), - (T.prototype.removeWebSocket = function (e, t) { - var a = v(t), - i = this.urlMap[a]; - i && - (i.websockets = I(i.websockets, function (t) { - return t === e; - })); - }), - (T.prototype.removeMembershipFromRoom = function (e, t) { - var a = this.urlMap[v(e.url)], - i = a.roomMemberships[t]; - a && - null !== i && - (a.roomMemberships[t] = I(i, function (t) { - return t === e; - })); - })); - var R = new T(), - O = 1000, - C = 1005, - w = 1006, - A = { - CONSTRUCTOR_ERROR: "Failed to construct 'WebSocket':", - CLOSE_ERROR: "Failed to execute 'close' on 'WebSocket':", - EVENT: { - CONSTRUCT: "Failed to construct 'Event':", - MESSAGE: "Failed to construct 'MessageEvent':", - CLOSE: "Failed to construct 'CloseEvent':", - }, + (T.prototype.removeMembershipFromRoom = function (e, t) { + var a = this.urlMap[v(e.url)], + i = a.roomMemberships[t]; + a && + null !== i && + (a.roomMemberships[t] = I(i, function (t) { + return t === e; + })); + })); + var R = new T(), + O = 1000, + C = 1005, + w = 1006, + A = { + CONSTRUCTOR_ERROR: "Failed to construct 'WebSocket':", + CLOSE_ERROR: "Failed to execute 'close' on 'WebSocket':", + EVENT: { + CONSTRUCT: "Failed to construct 'Event':", + MESSAGE: "Failed to construct 'MessageEvent':", + CLOSE: "Failed to construct 'CloseEvent':", }, - k = function () {}; - ((k.prototype.stopPropagation = function () {}), - (k.prototype.stopImmediatePropagation = function () {}), - (k.prototype.initEvent = function (e, t, a) { - (void 0 === e && (e = "undefined"), - void 0 === t && (t = false), - void 0 === a && (a = false), - (this.type = "" + e), - (this.bubbles = Boolean(t)), - (this.cancelable = Boolean(a))); - })); - var N = (function (e) { - function t(t, a) { - if ((void 0 === a && (a = {}), e.call(this), !t)) - throw new TypeError( - A.EVENT_ERROR + " 1 argument required, but only 0 present.", - ); - if ("object" != typeof a) - throw new TypeError( - A.EVENT_ERROR + - " parameter 2 ('eventInitDict') is not an object.", - ); - var i = a.bubbles, - n = a.cancelable; - ((this.type = "" + t), - (this.timeStamp = Date.now()), - (this.target = null), - (this.srcElement = null), - (this.returnValue = true), - (this.isTrusted = false), - (this.eventPhase = 0), - (this.defaultPrevented = false), - (this.currentTarget = null), - (this.cancelable = !!n && Boolean(n)), - (this.canncelBubble = false), - (this.bubbles = !!i && Boolean(i))); - } - return ( - e && (t.__proto__ = e), - (t.prototype = Object.create(e && e.prototype)), - (t.prototype.constructor = t), - t - ); - })(k), - x = (function (e) { - function t(t, a) { - if ((void 0 === a && (a = {}), e.call(this), !t)) - throw new TypeError( - A.EVENT.MESSAGE + - " 1 argument required, but only 0 present.", - ); - if ("object" != typeof a) - throw new TypeError( - A.EVENT.MESSAGE + - " parameter 2 ('eventInitDict') is not an object", - ); - var i = a.bubbles, - n = a.cancelable, - s = a.data, - o = a.origin, - r = a.lastEventId, - l = a.ports; - ((this.type = "" + t), - (this.timeStamp = Date.now()), - (this.target = null), - (this.srcElement = null), - (this.returnValue = true), - (this.isTrusted = false), - (this.eventPhase = 0), - (this.defaultPrevented = false), - (this.currentTarget = null), - (this.cancelable = !!n && Boolean(n)), - (this.canncelBubble = false), - (this.bubbles = !!i && Boolean(i)), - (this.origin = "" + o), - (this.ports = void 0 === l ? null : l), - (this.data = void 0 === s ? null : s), - (this.lastEventId = "" + (r || ""))); - } - return ( - e && (t.__proto__ = e), - (t.prototype = Object.create(e && e.prototype)), - (t.prototype.constructor = t), - t + }, + k = function () { }; + ((k.prototype.stopPropagation = function () { }), + (k.prototype.stopImmediatePropagation = function () { }), + (k.prototype.initEvent = function (e, t, a) { + (void 0 === e && (e = "undefined"), + void 0 === t && (t = false), + void 0 === a && (a = false), + (this.type = "" + e), + (this.bubbles = Boolean(t)), + (this.cancelable = Boolean(a))); + })); + var N = (function (e) { + function t(t, a) { + if ((void 0 === a && (a = {}), e.call(this), !t)) + throw new TypeError( + A.EVENT_ERROR + " 1 argument required, but only 0 present.", ); - })(k), - P = (function (e) { - function t(t, a) { - if ((void 0 === a && (a = {}), e.call(this), !t)) - throw new TypeError( - A.EVENT.CLOSE + " 1 argument required, but only 0 present.", - ); - if ("object" != typeof a) - throw new TypeError( - A.EVENT.CLOSE + - " parameter 2 ('eventInitDict') is not an object", - ); - var i = a.bubbles, - n = a.cancelable, - s = a.code, - o = a.reason, - r = a.wasClean; - ((this.type = "" + t), - (this.timeStamp = Date.now()), - (this.target = null), - (this.srcElement = null), - (this.returnValue = true), - (this.isTrusted = false), - (this.eventPhase = 0), - (this.defaultPrevented = false), - (this.currentTarget = null), - (this.cancelable = !!n && Boolean(n)), - (this.cancelBubble = false), - (this.bubbles = !!i && Boolean(i)), - (this.code = "number" == typeof s ? parseInt(s, 10) : 0), - (this.reason = "" + (o || "")), - (this.wasClean = !!r && Boolean(r))); - } - return ( - e && (t.__proto__ = e), - (t.prototype = Object.create(e && e.prototype)), - (t.prototype.constructor = t), - t + if ("object" != typeof a) + throw new TypeError( + A.EVENT_ERROR + + " parameter 2 ('eventInitDict') is not an object.", ); - })(k); - function M(e) { - var t = e.type, - a = e.target, - i = new N(t); - return ( - a && ((i.target = a), (i.srcElement = a), (i.currentTarget = a)), - i - ); + var i = a.bubbles, + n = a.cancelable; + ((this.type = "" + t), + (this.timeStamp = Date.now()), + (this.target = null), + (this.srcElement = null), + (this.returnValue = true), + (this.isTrusted = false), + (this.eventPhase = 0), + (this.defaultPrevented = false), + (this.currentTarget = null), + (this.cancelable = !!n && Boolean(n)), + (this.canncelBubble = false), + (this.bubbles = !!i && Boolean(i))); } - function L(e) { - var t = e.type, - a = e.origin, - i = e.data, - n = e.target, - s = new x(t, { data: i, origin: a }); - return ( - n && ((s.target = n), (s.srcElement = n), (s.currentTarget = n)), - s - ); - } - function D(e) { - var t = e.code, - a = e.reason, - i = e.type, - n = e.target, - s = e.wasClean; - s || (s = t === O || t === C); - var o = new P(i, { code: t, reason: a, wasClean: s }); + return ( + e && (t.__proto__ = e), + (t.prototype = Object.create(e && e.prototype)), + (t.prototype.constructor = t), + t + ); + })(k), + x = (function (e) { + function t(t, a) { + if ((void 0 === a && (a = {}), e.call(this), !t)) + throw new TypeError( + A.EVENT.MESSAGE + + " 1 argument required, but only 0 present.", + ); + if ("object" != typeof a) + throw new TypeError( + A.EVENT.MESSAGE + + " parameter 2 ('eventInitDict') is not an object", + ); + var i = a.bubbles, + n = a.cancelable, + s = a.data, + o = a.origin, + r = a.lastEventId, + l = a.ports; + ((this.type = "" + t), + (this.timeStamp = Date.now()), + (this.target = null), + (this.srcElement = null), + (this.returnValue = true), + (this.isTrusted = false), + (this.eventPhase = 0), + (this.defaultPrevented = false), + (this.currentTarget = null), + (this.cancelable = !!n && Boolean(n)), + (this.canncelBubble = false), + (this.bubbles = !!i && Boolean(i)), + (this.origin = "" + o), + (this.ports = void 0 === l ? null : l), + (this.data = void 0 === s ? null : s), + (this.lastEventId = "" + (r || ""))); + } return ( - n && ((o.target = n), (o.srcElement = n), (o.currentTarget = n)), - o + e && (t.__proto__ = e), + (t.prototype = Object.create(e && e.prototype)), + (t.prototype.constructor = t), + t ); - } - function B(e, t, a) { - e.readyState = j.CLOSING; - var i = R.serverLookup(e.url), - n = D({ type: "close", target: e.target, code: t, reason: a }); - b(function () { - (R.removeWebSocket(e, e.url), - (e.readyState = j.CLOSED), - e.dispatchEvent(n), - i && i.dispatchEvent(n, i)); - }, e); - } - function F(e) { + })(k), + P = (function (e) { + function t(t, a) { + if ((void 0 === a && (a = {}), e.call(this), !t)) + throw new TypeError( + A.EVENT.CLOSE + " 1 argument required, but only 0 present.", + ); + if ("object" != typeof a) + throw new TypeError( + A.EVENT.CLOSE + + " parameter 2 ('eventInitDict') is not an object", + ); + var i = a.bubbles, + n = a.cancelable, + s = a.code, + o = a.reason, + r = a.wasClean; + ((this.type = "" + t), + (this.timeStamp = Date.now()), + (this.target = null), + (this.srcElement = null), + (this.returnValue = true), + (this.isTrusted = false), + (this.eventPhase = 0), + (this.defaultPrevented = false), + (this.currentTarget = null), + (this.cancelable = !!n && Boolean(n)), + (this.cancelBubble = false), + (this.bubbles = !!i && Boolean(i)), + (this.code = "number" == typeof s ? parseInt(s, 10) : 0), + (this.reason = "" + (o || "")), + (this.wasClean = !!r && Boolean(r))); + } return ( - "[object Blob]" === Object.prototype.toString.call(e) || - e instanceof ArrayBuffer || - (e = String(e)), - e + e && (t.__proto__ = e), + (t.prototype = Object.create(e && e.prototype)), + (t.prototype.constructor = t), + t ); - } - var Y = new WeakMap(); - function U(e) { - if (Y.has(e)) return Y.get(e); - var t = new Proxy(e, { - get: function (a, i) { - return "close" === i - ? function (e) { - void 0 === e && (e = {}); - var a = e.code || O, - i = e.reason || ""; - B(t, a, i); + })(k); + function M(e) { + var t = e.type, + a = e.target, + i = new N(t); + return ( + a && ((i.target = a), (i.srcElement = a), (i.currentTarget = a)), + i + ); + } + function L(e) { + var t = e.type, + a = e.origin, + i = e.data, + n = e.target, + s = new x(t, { data: i, origin: a }); + return ( + n && ((s.target = n), (s.srcElement = n), (s.currentTarget = n)), + s + ); + } + function D(e) { + var t = e.code, + a = e.reason, + i = e.type, + n = e.target, + s = e.wasClean; + s || (s = t === O || t === C); + var o = new P(i, { code: t, reason: a, wasClean: s }); + return ( + n && ((o.target = n), (o.srcElement = n), (o.currentTarget = n)), + o + ); + } + function B(e, t, a) { + e.readyState = j.CLOSING; + var i = R.serverLookup(e.url), + n = D({ type: "close", target: e.target, code: t, reason: a }); + b(function () { + (R.removeWebSocket(e, e.url), + (e.readyState = j.CLOSED), + e.dispatchEvent(n), + i && i.dispatchEvent(n, i)); + }, e); + } + function F(e) { + return ( + "[object Blob]" === Object.prototype.toString.call(e) || + e instanceof ArrayBuffer || + (e = String(e)), + e + ); + } + var Y = new WeakMap(); + function U(e) { + if (Y.has(e)) return Y.get(e); + var t = new Proxy(e, { + get: function (a, i) { + return "close" === i + ? function (e) { + void 0 === e && (e = {}); + var a = e.code || O, + i = e.reason || ""; + B(t, a, i); + } + : "send" === i + ? function (t) { + ((t = F(t)), + e.dispatchEvent( + L({ + type: "message", + data: t, + origin: this.url, + target: e, + }), + )); + } + : "on" === i + ? function (t, a) { + e.addEventListener("server::" + t, a); } - : "send" === i - ? function (t) { - ((t = F(t)), - e.dispatchEvent( - L({ - type: "message", - data: t, - origin: this.url, - target: e, - }), - )); - } - : "on" === i - ? function (t, a) { - e.addEventListener("server::" + t, a); - } - : "target" === i - ? e - : a[i]; - }, - }); - return (Y.set(e, t), t); - } - var j = (function (e) { - function t(a, i) { - (e.call(this), - (this.url = (function (e) { - var t = new E(e), - a = t.pathname, - i = t.protocol, - n = t.hash; - if (!e) - throw new TypeError( - A.CONSTRUCTOR_ERROR + - " 1 argument required, but only 0 present.", - ); - if ((a || (t.pathname = "/"), "" === i)) - throw new SyntaxError( - A.CONSTRUCTOR_ERROR + - " The URL '" + - t.toString() + - "' is invalid.", - ); - if ("ws:" !== i && "wss:" !== i) - throw new SyntaxError( - A.CONSTRUCTOR_ERROR + - " The URL's scheme must be either 'ws' or 'wss'. '" + - i + - "' is not allowed.", - ); - if ("" !== n) - throw new SyntaxError( - A.CONSTRUCTOR_ERROR + - " The URL contains a fragment identifier ('" + - n + - "'). Fragment identifiers are not allowed in WebSocket URLs.", - ); - return t.toString(); - })(a)), - (i = (function (e) { - if ( - (void 0 === e && (e = []), + : "target" === i + ? e + : a[i]; + }, + }); + return (Y.set(e, t), t); + } + var j = (function (e) { + function t(a, i) { + (e.call(this), + (this.url = (function (e) { + var t = new E(e), + a = t.pathname, + i = t.protocol, + n = t.hash; + if (!e) + throw new TypeError( + A.CONSTRUCTOR_ERROR + + " 1 argument required, but only 0 present.", + ); + if ((a || (t.pathname = "/"), "" === i)) + throw new SyntaxError( + A.CONSTRUCTOR_ERROR + + " The URL '" + + t.toString() + + "' is invalid.", + ); + if ("ws:" !== i && "wss:" !== i) + throw new SyntaxError( + A.CONSTRUCTOR_ERROR + + " The URL's scheme must be either 'ws' or 'wss'. '" + + i + + "' is not allowed.", + ); + if ("" !== n) + throw new SyntaxError( + A.CONSTRUCTOR_ERROR + + " The URL contains a fragment identifier ('" + + n + + "'). Fragment identifiers are not allowed in WebSocket URLs.", + ); + return t.toString(); + })(a)), + (i = (function (e) { + if ( + (void 0 === e && (e = []), !Array.isArray(e) && "string" != typeof e) - ) - throw new SyntaxError( - A.CONSTRUCTOR_ERROR + - " The subprotocol '" + - e.toString() + - "' is invalid.", - ); - "string" == typeof e && (e = [e]); - var t = e - .map(function (e) { - return { count: 1, protocol: e }; - }) - .reduce(function (e, t) { - return ( - (e[t.protocol] = (e[t.protocol] || 0) + t.count), - e - ); - }, {}), - a = Object.keys(t).filter(function (e) { - return t[e] > 1; - }); - if (a.length > 0) - throw new SyntaxError( - A.CONSTRUCTOR_ERROR + - " The subprotocol '" + - a[0] + - "' is duplicated.", + ) + throw new SyntaxError( + A.CONSTRUCTOR_ERROR + + " The subprotocol '" + + e.toString() + + "' is invalid.", + ); + "string" == typeof e && (e = [e]); + var t = e + .map(function (e) { + return { count: 1, protocol: e }; + }) + .reduce(function (e, t) { + return ( + (e[t.protocol] = (e[t.protocol] || 0) + t.count), + e ); - return e; - })(i)), - (this.protocol = i[0] || ""), - (this.binaryType = "blob"), - (this.readyState = t.CONNECTING)); - var n = U(this), - s = R.attachWebSocket(n, this.url); - b(function () { - if (s) - if ( - s.options.verifyClient && - "function" == typeof s.options.verifyClient && - !s.options.verifyClient() - ) - ((this.readyState = t.CLOSED), - S( - "error", - "WebSocket connection to '" + - this.url + - "' failed: HTTP Authentication failed; no valid credentials available", - ), - R.removeWebSocket(n, this.url), - this.dispatchEvent(M({ type: "error", target: this })), - this.dispatchEvent( - D({ type: "close", target: this, code: O }), - )); - else { - if ( - s.options.selectProtocol && - "function" == typeof s.options.selectProtocol - ) { - var e = s.options.selectProtocol(i), - a = "" !== e, - o = -1 !== i.indexOf(e); - if (a && !o) - return ( - (this.readyState = t.CLOSED), - S( - "error", - "WebSocket connection to '" + - this.url + - "' failed: Invalid Sub-Protocol", - ), - R.removeWebSocket(n, this.url), - this.dispatchEvent( - M({ type: "error", target: this }), - ), - void this.dispatchEvent( - D({ type: "close", target: this, code: O }), - ) - ); - this.protocol = e; - } - ((this.readyState = t.OPEN), - this.dispatchEvent(M({ type: "open", target: this })), - s.dispatchEvent(M({ type: "connection" }), n)); - } - else + }, {}), + a = Object.keys(t).filter(function (e) { + return t[e] > 1; + }); + if (a.length > 0) + throw new SyntaxError( + A.CONSTRUCTOR_ERROR + + " The subprotocol '" + + a[0] + + "' is duplicated.", + ); + return e; + })(i)), + (this.protocol = i[0] || ""), + (this.binaryType = "blob"), + (this.readyState = t.CONNECTING)); + var n = U(this), + s = R.attachWebSocket(n, this.url); + b(function () { + if (s) + if ( + s.options.verifyClient && + "function" == typeof s.options.verifyClient && + !s.options.verifyClient() + ) ((this.readyState = t.CLOSED), + S( + "error", + "WebSocket connection to '" + + this.url + + "' failed: HTTP Authentication failed; no valid credentials available", + ), + R.removeWebSocket(n, this.url), this.dispatchEvent(M({ type: "error", target: this })), this.dispatchEvent( D({ type: "close", target: this, code: O }), - ), - S( - "error", - "WebSocket connection to '" + this.url + "' failed", )); - }, this); - } - (e && (t.__proto__ = e), - (t.prototype = Object.create(e && e.prototype)), - (t.prototype.constructor = t)); - var a = { onopen: {}, onmessage: {}, onclose: {}, onerror: {} }; - return ( - (a.onopen.get = function () { - return this.listeners.open; - }), - (a.onmessage.get = function () { - return this.listeners.message; - }), - (a.onclose.get = function () { - return this.listeners.close; - }), - (a.onerror.get = function () { - return this.listeners.error; - }), - (a.onopen.set = function (e) { - (delete this.listeners.open, this.addEventListener("open", e)); - }), - (a.onmessage.set = function (e) { - (delete this.listeners.message, - this.addEventListener("message", e)); - }), - (a.onclose.set = function (e) { - (delete this.listeners.close, - this.addEventListener("close", e)); - }), - (a.onerror.set = function (e) { - (delete this.listeners.error, - this.addEventListener("error", e)); - }), - (t.prototype.send = function (e) { - var a = this; - if ( - this.readyState === t.CLOSING || - this.readyState === t.CLOSED - ) - throw new Error( - "WebSocket is already in CLOSING or CLOSED state", - ); - var i = L({ - type: "server::message", - origin: this.url, - data: F(e), - }), - n = R.serverLookup(this.url); - n && - b(function () { - a.dispatchEvent(i, e); - }, n); + else { + if ( + s.options.selectProtocol && + "function" == typeof s.options.selectProtocol + ) { + var e = s.options.selectProtocol(i), + a = "" !== e, + o = -1 !== i.indexOf(e); + if (a && !o) + return ( + (this.readyState = t.CLOSED), + S( + "error", + "WebSocket connection to '" + + this.url + + "' failed: Invalid Sub-Protocol", + ), + R.removeWebSocket(n, this.url), + this.dispatchEvent( + M({ type: "error", target: this }), + ), + void this.dispatchEvent( + D({ type: "close", target: this, code: O }), + ) + ); + this.protocol = e; + } + ((this.readyState = t.OPEN), + this.dispatchEvent(M({ type: "open", target: this })), + s.dispatchEvent(M({ type: "connection" }), n)); + } + else + ((this.readyState = t.CLOSED), + this.dispatchEvent(M({ type: "error", target: this })), + this.dispatchEvent( + D({ type: "close", target: this, code: O }), + ), + S( + "error", + "WebSocket connection to '" + this.url + "' failed", + )); + }, this); + } + (e && (t.__proto__ = e), + (t.prototype = Object.create(e && e.prototype)), + (t.prototype.constructor = t)); + var a = { onopen: {}, onmessage: {}, onclose: {}, onerror: {} }; + return ( + (a.onopen.get = function () { + return this.listeners.open; + }), + (a.onmessage.get = function () { + return this.listeners.message; + }), + (a.onclose.get = function () { + return this.listeners.close; + }), + (a.onerror.get = function () { + return this.listeners.error; + }), + (a.onopen.set = function (e) { + (delete this.listeners.open, this.addEventListener("open", e)); + }), + (a.onmessage.set = function (e) { + (delete this.listeners.message, + this.addEventListener("message", e)); + }), + (a.onclose.set = function (e) { + (delete this.listeners.close, + this.addEventListener("close", e)); + }), + (a.onerror.set = function (e) { + (delete this.listeners.error, + this.addEventListener("error", e)); + }), + (t.prototype.send = function (e) { + var a = this; + if ( + this.readyState === t.CLOSING || + this.readyState === t.CLOSED + ) + throw new Error( + "WebSocket is already in CLOSING or CLOSED state", + ); + var i = L({ + type: "server::message", + origin: this.url, + data: F(e), }), - (t.prototype.close = function (e, a) { - if ( - void 0 !== e && - ("number" != typeof e || - (1000 !== e && (e < 3e3 || e > 4999))) - ) - throw new TypeError( - A.CLOSE_ERROR + - " The code must be either 1000, or between 3000 and 4999. " + - e + - " is neither.", - ); - if ( - void 0 !== a && - ((i = a), + n = R.serverLookup(this.url); + n && + b(function () { + a.dispatchEvent(i, e); + }, n); + }), + (t.prototype.close = function (e, a) { + if ( + void 0 !== e && + ("number" != typeof e || + (1000 !== e && (e < 3e3 || e > 4999))) + ) + throw new TypeError( + A.CLOSE_ERROR + + " The code must be either 1000, or between 3000 and 4999. " + + e + + " is neither.", + ); + if ( + void 0 !== a && + ((i = a), (n = encodeURIComponent(i).match(/%[89ABab]/g)), i.length + (n ? n.length : 0) > 123) - ) - throw new SyntaxError( - A.CLOSE_ERROR + - " The message must not be greater than 123 bytes.", - ); - var i, n; - if ( - this.readyState !== t.CLOSING && - this.readyState !== t.CLOSED - ) { - var s = U(this); - this.readyState === t.CONNECTING - ? (function (e, t, a) { - e.readyState = j.CLOSING; - var i = R.serverLookup(e.url), - n = D({ - type: "close", - target: e.target, - code: t, - reason: a, - wasClean: false, - }), - s = M({ type: "error", target: e.target }); - b(function () { - (R.removeWebSocket(e, e.url), - (e.readyState = j.CLOSED), - e.dispatchEvent(s), - e.dispatchEvent(n), - i && i.dispatchEvent(n, i)); - }, e); - })(s, e || w, a) - : B(s, e || C, a); - } - }), - Object.defineProperties(t.prototype, a), - t - ); - })(_); - ((j.CONNECTING = 0), - (j.prototype.CONNECTING = j.CONNECTING), - (j.OPEN = 1), - (j.prototype.OPEN = j.OPEN), - (j.CLOSING = 2), - (j.prototype.CLOSING = j.CLOSING), - (j.CLOSED = 3), - (j.prototype.CLOSED = j.CLOSED)); - function G() { - return "undefined" != typeof window - ? window - : "object" == typeof process && "object" == typeof a.g - ? a.g - : this; - } - var V = (function (e) { - function t(t, a) { - (void 0 === a && (a = {}), e.call(this)); - var i = new E(t); + ) + throw new SyntaxError( + A.CLOSE_ERROR + + " The message must not be greater than 123 bytes.", + ); + var i, n; if ( - (i.pathname || (i.pathname = "/"), + this.readyState !== t.CLOSING && + this.readyState !== t.CLOSED + ) { + var s = U(this); + this.readyState === t.CONNECTING + ? (function (e, t, a) { + e.readyState = j.CLOSING; + var i = R.serverLookup(e.url), + n = D({ + type: "close", + target: e.target, + code: t, + reason: a, + wasClean: false, + }), + s = M({ type: "error", target: e.target }); + b(function () { + (R.removeWebSocket(e, e.url), + (e.readyState = j.CLOSED), + e.dispatchEvent(s), + e.dispatchEvent(n), + i && i.dispatchEvent(n, i)); + }, e); + })(s, e || w, a) + : B(s, e || C, a); + } + }), + Object.defineProperties(t.prototype, a), + t + ); + })(_); + ((j.CONNECTING = 0), + (j.prototype.CONNECTING = j.CONNECTING), + (j.OPEN = 1), + (j.prototype.OPEN = j.OPEN), + (j.CLOSING = 2), + (j.prototype.CLOSING = j.CLOSING), + (j.CLOSED = 3), + (j.prototype.CLOSED = j.CLOSED)); + function G() { + return "undefined" != typeof window + ? window + : "object" == typeof process && "object" == typeof a.g + ? a.g + : this; + } + var V = (function (e) { + function t(t, a) { + (void 0 === a && (a = {}), e.call(this)); + var i = new E(t); + if ( + (i.pathname || (i.pathname = "/"), (this.url = i.toString()), (this.originalWebSocket = null), !R.attachServer(this, this.url)) - ) - throw ( - this.dispatchEvent(M({ type: "error" })), - new Error("A mock server is already listening on this url") - ); - (void 0 === a.verifyClient && (a.verifyClient = null), - void 0 === a.selectProtocol && (a.selectProtocol = null), - (this.options = a), - this.start()); - } - return ( - e && (t.__proto__ = e), - (t.prototype = Object.create(e && e.prototype)), - (t.prototype.constructor = t), - (t.prototype.start = function () { - var e = G(); - (e.WebSocket && (this.originalWebSocket = e.WebSocket), - (e.WebSocket = j)); - }), - (t.prototype.stop = function (e) { - void 0 === e && (e = function () {}); - var t = G(); - (this.originalWebSocket - ? (t.WebSocket = this.originalWebSocket) - : delete t.WebSocket, - (this.originalWebSocket = null), - R.removeServer(this.url), - "function" == typeof e && e()); - }), - (t.prototype.on = function (e, t) { - this.addEventListener(e, t); - }), - (t.prototype.close = function (e) { - void 0 === e && (e = {}); - var t = e.code, - a = e.reason, - i = e.wasClean, - n = R.websocketsLookup(this.url); - (R.removeServer(this.url), - n.forEach(function (e) { - ((e.readyState = j.CLOSED), - e.dispatchEvent( - D({ - type: "close", - target: e.target, - code: t || O, - reason: a || "", - wasClean: i, - }), - )); - }), - this.dispatchEvent(D({ type: "close" }), this)); - }), - (t.prototype.emit = function (e, t, a) { - var i = this; - void 0 === a && (a = {}); - var n = a.websockets; - (n || (n = R.websocketsLookup(this.url)), - (t = - "object" != typeof a || arguments.length > 3 - ? (t = Array.prototype.slice.call( - arguments, - 1, - arguments.length, - )).map(function (e) { - return F(e); - }) - : F(t)), - n.forEach(function (a) { - Array.isArray(t) - ? a.dispatchEvent.apply( - a, - [ - L({ - type: e, - data: t, - origin: i.url, - target: a.target, - }), - ].concat(t), - ) - : a.dispatchEvent( - L({ - type: e, - data: t, - origin: i.url, - target: a.target, - }), - ); - })); - }), - (t.prototype.clients = function () { - return R.websocketsLookup(this.url); - }), - (t.prototype.to = function (e, t, a) { - var i = this; - void 0 === a && (a = []); - var n = this, - s = a - .concat(R.websocketsLookup(this.url, e, t)) - .reduce(function (e, t) { - return e.indexOf(t) > -1 ? e : e.concat(t); - }, []); - return { - to: function (e, t) { - return i.to.call(i, e, t, s); - }, - emit: function (e, t) { - n.emit(e, t, { websockets: s }); - }, - }; - }), - (t.prototype.in = function () { - for (var e = [], t = arguments.length; t--; ) - e[t] = arguments[t]; - return this.to.apply(null, e); - }), - (t.prototype.simulate = function (e) { - var t = R.websocketsLookup(this.url); - "error" === e && - t.forEach(function (e) { - ((e.readyState = j.CLOSED), - e.dispatchEvent(M({ type: "error" }))); - }); - }), - t - ); - })(_); - V.of = function (e) { - return new V(e); - }; - var H = (function (e) { - function t(a, i) { - var n = this; - (void 0 === a && (a = "socket.io"), - void 0 === i && (i = ""), - e.call(this), - (this.binaryType = "blob")); - var s = new E(a); - (s.pathname || (s.pathname = "/"), - (this.url = s.toString()), - (this.readyState = t.CONNECTING), - (this.protocol = ""), - (this.target = this), - "string" == typeof i || ("object" == typeof i && null !== i) - ? (this.protocol = i) - : Array.isArray(i) && i.length > 0 && (this.protocol = i[0])); - var o = R.attachWebSocket(this, this.url); - (b(function () { - o - ? ((this.readyState = t.OPEN), - o.dispatchEvent(M({ type: "connection" }), o, this), - o.dispatchEvent(M({ type: "connect" }), o, this), - this.dispatchEvent(M({ type: "connect", target: this }))) - : ((this.readyState = t.CLOSED), - this.dispatchEvent(M({ type: "error", target: this })), - this.dispatchEvent( - D({ type: "close", target: this, code: O }), - ), - S( - "error", - "Socket.io connection to '" + this.url + "' failed", + ) + throw ( + this.dispatchEvent(M({ type: "error" })), + new Error("A mock server is already listening on this url") + ); + (void 0 === a.verifyClient && (a.verifyClient = null), + void 0 === a.selectProtocol && (a.selectProtocol = null), + (this.options = a), + this.start()); + } + return ( + e && (t.__proto__ = e), + (t.prototype = Object.create(e && e.prototype)), + (t.prototype.constructor = t), + (t.prototype.start = function () { + var e = G(); + (e.WebSocket && (this.originalWebSocket = e.WebSocket), + (e.WebSocket = j)); + }), + (t.prototype.stop = function (e) { + void 0 === e && (e = function () { }); + var t = G(); + (this.originalWebSocket + ? (t.WebSocket = this.originalWebSocket) + : delete t.WebSocket, + (this.originalWebSocket = null), + R.removeServer(this.url), + "function" == typeof e && e()); + }), + (t.prototype.on = function (e, t) { + this.addEventListener(e, t); + }), + (t.prototype.close = function (e) { + void 0 === e && (e = {}); + var t = e.code, + a = e.reason, + i = e.wasClean, + n = R.websocketsLookup(this.url); + (R.removeServer(this.url), + n.forEach(function (e) { + ((e.readyState = j.CLOSED), + e.dispatchEvent( + D({ + type: "close", + target: e.target, + code: t || O, + reason: a || "", + wasClean: i, + }), )); - }, this), - this.addEventListener("close", function (e) { - n.dispatchEvent( - D({ type: "disconnect", target: e.target, code: e.code }), - ); - })); - } - (e && (t.__proto__ = e), - (t.prototype = Object.create(e && e.prototype)), - (t.prototype.constructor = t)); - var a = { broadcast: {} }; - return ( - (t.prototype.close = function () { - if (this.readyState === t.OPEN) { - var e = R.serverLookup(this.url); - return ( - R.removeWebSocket(this, this.url), - (this.readyState = t.CLOSED), - this.dispatchEvent( - D({ type: "close", target: this, code: O }), - ), - e && - e.dispatchEvent( - D({ type: "disconnect", target: this, code: O }), - e, - ), - this - ); - } - }), - (t.prototype.disconnect = function () { - return this.close(); - }), - (t.prototype.emit = function (e) { - for (var a = [], i = arguments.length - 1; i-- > 0; ) - a[i] = arguments[i + 1]; - if (this.readyState !== t.OPEN) - throw new Error( - "SocketIO is already in CLOSING or CLOSED state", - ); - var n = L({ type: e, origin: this.url, data: a }), - s = R.serverLookup(this.url); - return (s && s.dispatchEvent.apply(s, [n].concat(a)), this); - }), - (t.prototype.send = function (e) { - return (this.emit("message", e), this); - }), - (a.broadcast.get = function () { - if (this.readyState !== t.OPEN) - throw new Error( - "SocketIO is already in CLOSING or CLOSED state", - ); - var e = this, - a = R.serverLookup(this.url); - if (!a) - throw new Error( - "SocketIO can not find a server at the specified URL (" + - this.url + - ")", - ); - return { - emit: function (t, i) { - return ( - a.emit(t, i, { - websockets: R.websocketsLookup(e.url, null, e), + }), + this.dispatchEvent(D({ type: "close" }), this)); + }), + (t.prototype.emit = function (e, t, a) { + var i = this; + void 0 === a && (a = {}); + var n = a.websockets; + (n || (n = R.websocketsLookup(this.url)), + (t = + "object" != typeof a || arguments.length > 3 + ? (t = Array.prototype.slice.call( + arguments, + 1, + arguments.length, + )).map(function (e) { + return F(e); + }) + : F(t)), + n.forEach(function (a) { + Array.isArray(t) + ? a.dispatchEvent.apply( + a, + [ + L({ + type: e, + data: t, + origin: i.url, + target: a.target, + }), + ].concat(t), + ) + : a.dispatchEvent( + L({ + type: e, + data: t, + origin: i.url, + target: a.target, }), - e ); - }, - to: function (t) { - return a.to(t, e); - }, - in: function (t) { - return a.in(t, e); - }, - }; - }), - (t.prototype.on = function (e, t) { - return (this.addEventListener(e, t), this); - }), - (t.prototype.off = function (e, t) { - this.removeEventListener(e, t); - }), - (t.prototype.hasListeners = function (e) { - var t = this.listeners[e]; - return !!Array.isArray(t) && !!t.length; - }), - (t.prototype.join = function (e) { - R.addMembershipToRoom(this, e); - }), - (t.prototype.leave = function (e) { - R.removeMembershipFromRoom(this, e); - }), - (t.prototype.to = function (e) { - return this.broadcast.to(e); - }), - (t.prototype.in = function () { - return this.to.apply(null, arguments); - }), - (t.prototype.dispatchEvent = function (e) { - for (var t = this, a = [], i = arguments.length - 1; i-- > 0; ) - a[i] = arguments[i + 1]; - var n = e.type, - s = this.listeners[n]; - if (!Array.isArray(s)) return false; - s.forEach(function (i) { - a.length > 0 ? i.apply(t, a) : i.call(t, e.data ? e.data : e); + })); + }), + (t.prototype.clients = function () { + return R.websocketsLookup(this.url); + }), + (t.prototype.to = function (e, t, a) { + var i = this; + void 0 === a && (a = []); + var n = this, + s = a + .concat(R.websocketsLookup(this.url, e, t)) + .reduce(function (e, t) { + return e.indexOf(t) > -1 ? e : e.concat(t); + }, []); + return { + to: function (e, t) { + return i.to.call(i, e, t, s); + }, + emit: function (e, t) { + n.emit(e, t, { websockets: s }); + }, + }; + }), + (t.prototype.in = function () { + for (var e = [], t = arguments.length; t--;) + e[t] = arguments[t]; + return this.to.apply(null, e); + }), + (t.prototype.simulate = function (e) { + var t = R.websocketsLookup(this.url); + "error" === e && + t.forEach(function (e) { + ((e.readyState = j.CLOSED), + e.dispatchEvent(M({ type: "error" }))); }); - }), - Object.defineProperties(t.prototype, a), - t - ); - })(_); - ((H.CONNECTING = 0), (H.OPEN = 1), (H.CLOSING = 2), (H.CLOSED = 3)); - var X = function (e, t) { - return new H(e, t); - }; - X.connect = function (e, t) { - return X(e, t); - }; - var z = V, - W = j, - q = X; - ((e.Server = z), - (e.WebSocket = W), - (e.SocketIO = q), - Object.defineProperty(e, "__esModule", { value: true })); - })(t); - }, - 6154: (e, t, a) => { - "use strict"; - function i(e, t) { - var a, i, n, s; - const o = e; - return ( - (o.x = t.x || 0), - (o.y = t.y || 0), - (o.rotation = t.rotation || 0), - (o.opacity = Math.min( - 1, - Math.max(0, null !== (a = t.opacity) && void 0 !== a ? a : 1), - )), - (o.scaleX = null !== (i = t.scaleX) && void 0 !== i ? i : 1), - (o.scaleY = null !== (n = t.scaleY) && void 0 !== n ? n : 1), - (o.anchorX = t.anchorX || 0), - (o.anchorY = t.anchorY || 0), - (o.mask = t.mask || null), - (o.show = null === (s = t.show) || void 0 === s || s), - o + }), + t ); - } - (a.r(t), - a.d(t, { Game: () => VE, gameProps: () => jE, options: () => UE })); - const n = (e) => ({ - type: "text", - props: i( - { - testId: e.testId, - font: e.font, - text: e.text, - color: e.color, - gradient: e.gradient, - strokeColor: e.strokeColor, - strokeThickness: e.strokeThickness, - }, - e, - ), - }), - s = (e) => ({ - type: "circle", - props: i({ testId: e.testId, radius: e.radius, color: e.color }, e), - }), - o = (e) => ({ - type: "rectangle", - props: i( - { - testId: e.testId, - width: e.width, - height: e.height, - color: e.color, - gradient: e.gradient, - }, - e, - ), - }), - r = (e) => { - var t; - return { - type: "line", - props: i( - { - testId: e.testId, - color: e.color, - fillColor: e.fillColor, - thickness: null !== (t = e.thickness) && void 0 !== t ? t : 1, - lineCap: e.lineCap || "butt", - path: e.path, - fillGradient: e.fillGradient, - }, - e, - ), - }; - }, - l = (e) => ({ - type: "image", - props: i( - { - testId: e.testId, - fileName: e.fileName, - width: e.width, - height: e.height, - }, - e, - ), - }), - c = (e, t) => ({ - type: "text", - props: i( - { - testId: e.testId, - font: e.font, - text: e.text || "", - color: e.color || "black", - gradient: e.gradient, - strokeColor: e.strokeColor, - strokeThickness: e.strokeThickness, - }, - e, - ), - update: t, - isMut: true, - }), - d = ({ props: e, mask: t, update: a, array: i, testId: n }) => ({ - type: "textArray", - mask: t || null, - props: [], - newProps: e, - update: a, - testId: n, - array: i, - isMut: true, - }), - u = (e, t) => ({ - type: "circle", - props: i( - { - testId: e.testId, - radius: e.radius || 10, - color: e.color || "black", - gradient: e.gradient, - }, - e, - ), - update: t, - isMut: true, - }), - circleArray = ({ - props: e, - mask: t, - update: a, - array: i, - testId: n, - }) => ({ - type: "circleArray", - mask: t || null, - props: [], - newProps: e, - update: a, - testId: n, - array: i, - isMut: true, - }), - p = (e, t) => ({ - type: "rectangle", - props: i( - { - testId: e.testId, - width: e.width || 10, - height: e.height || 10, - color: e.color || "black", - gradient: e.gradient, - }, - e, - ), - update: t, - isMut: true, - }), - g = ({ props: e, mask: t, update: a, array: i, testId: n }) => ({ - type: "rectangleArray", - mask: t || null, - props: [], - newProps: e, - update: a, - testId: n, - array: i, - isMut: true, - }), - m = (e, t) => { - var a; - return { - type: "line", - props: i( - { - testId: e.testId, - color: e.color, - fillColor: e.fillColor, - thickness: null !== (a = e.thickness) && void 0 !== a ? a : 1, - lineCap: e.lineCap || "butt", - path: e.path || [], - gradient: e.gradient, - fillGradient: e.fillGradient, + })(_); + V.of = function (e) { + return new V(e); + }; + var H = (function (e) { + function t(a, i) { + var n = this; + (void 0 === a && (a = "socket.io"), + void 0 === i && (i = ""), + e.call(this), + (this.binaryType = "blob")); + var s = new E(a); + (s.pathname || (s.pathname = "/"), + (this.url = s.toString()), + (this.readyState = t.CONNECTING), + (this.protocol = ""), + (this.target = this), + "string" == typeof i || ("object" == typeof i && null !== i) + ? (this.protocol = i) + : Array.isArray(i) && i.length > 0 && (this.protocol = i[0])); + var o = R.attachWebSocket(this, this.url); + (b(function () { + o + ? ((this.readyState = t.OPEN), + o.dispatchEvent(M({ type: "connection" }), o, this), + o.dispatchEvent(M({ type: "connect" }), o, this), + this.dispatchEvent(M({ type: "connect", target: this }))) + : ((this.readyState = t.CLOSED), + this.dispatchEvent(M({ type: "error", target: this })), + this.dispatchEvent( + D({ type: "close", target: this, code: O }), + ), + S( + "error", + "Socket.io connection to '" + this.url + "' failed", + )); + }, this), + this.addEventListener("close", function (e) { + n.dispatchEvent( + D({ type: "disconnect", target: e.target, code: e.code }), + ); + })); + } + (e && (t.__proto__ = e), + (t.prototype = Object.create(e && e.prototype)), + (t.prototype.constructor = t)); + var a = { broadcast: {} }; + return ( + (t.prototype.close = function () { + if (this.readyState === t.OPEN) { + var e = R.serverLookup(this.url); + return ( + R.removeWebSocket(this, this.url), + (this.readyState = t.CLOSED), + this.dispatchEvent( + D({ type: "close", target: this, code: O }), + ), + e && + e.dispatchEvent( + D({ type: "disconnect", target: this, code: O }), + e, + ), + this + ); + } + }), + (t.prototype.disconnect = function () { + return this.close(); + }), + (t.prototype.emit = function (e) { + for (var a = [], i = arguments.length - 1; i-- > 0;) + a[i] = arguments[i + 1]; + if (this.readyState !== t.OPEN) + throw new Error( + "SocketIO is already in CLOSING or CLOSED state", + ); + var n = L({ type: e, origin: this.url, data: a }), + s = R.serverLookup(this.url); + return (s && s.dispatchEvent.apply(s, [n].concat(a)), this); + }), + (t.prototype.send = function (e) { + return (this.emit("message", e), this); + }), + (a.broadcast.get = function () { + if (this.readyState !== t.OPEN) + throw new Error( + "SocketIO is already in CLOSING or CLOSED state", + ); + var e = this, + a = R.serverLookup(this.url); + if (!a) + throw new Error( + "SocketIO can not find a server at the specified URL (" + + this.url + + ")", + ); + return { + emit: function (t, i) { + return ( + a.emit(t, i, { + websockets: R.websocketsLookup(e.url, null, e), + }), + e + ); }, - e, - ), - update: t, - isMut: true, - }; + to: function (t) { + return a.to(t, e); + }, + in: function (t) { + return a.in(t, e); + }, + }; + }), + (t.prototype.on = function (e, t) { + return (this.addEventListener(e, t), this); + }), + (t.prototype.off = function (e, t) { + this.removeEventListener(e, t); + }), + (t.prototype.hasListeners = function (e) { + var t = this.listeners[e]; + return !!Array.isArray(t) && !!t.length; + }), + (t.prototype.join = function (e) { + R.addMembershipToRoom(this, e); + }), + (t.prototype.leave = function (e) { + R.removeMembershipFromRoom(this, e); + }), + (t.prototype.to = function (e) { + return this.broadcast.to(e); + }), + (t.prototype.in = function () { + return this.to.apply(null, arguments); + }), + (t.prototype.dispatchEvent = function (e) { + for (var t = this, a = [], i = arguments.length - 1; i-- > 0;) + a[i] = arguments[i + 1]; + var n = e.type, + s = this.listeners[n]; + if (!Array.isArray(s)) return false; + s.forEach(function (i) { + a.length > 0 ? i.apply(t, a) : i.call(t, e.data ? e.data : e); + }); + }), + Object.defineProperties(t.prototype, a), + t + ); + })(_); + ((H.CONNECTING = 0), (H.OPEN = 1), (H.CLOSING = 2), (H.CLOSED = 3)); + var X = function (e, t) { + return new H(e, t); + }; + X.connect = function (e, t) { + return X(e, t); + }; + var z = V, + W = j, + q = X; + ((e.Server = z), + (e.WebSocket = W), + (e.SocketIO = q), + Object.defineProperty(e, "__esModule", { value: true })); + })(t); + }, + 6154: (e, t, a) => { + "use strict"; + function i(e, t) { + var a, i, n, s; + const o = e; + return ( + (o.x = t.x || 0), + (o.y = t.y || 0), + (o.rotation = t.rotation || 0), + (o.opacity = Math.min( + 1, + Math.max(0, null !== (a = t.opacity) && void 0 !== a ? a : 1), + )), + (o.scaleX = null !== (i = t.scaleX) && void 0 !== i ? i : 1), + (o.scaleY = null !== (n = t.scaleY) && void 0 !== n ? n : 1), + (o.anchorX = t.anchorX || 0), + (o.anchorY = t.anchorY || 0), + (o.mask = t.mask || null), + (o.show = null === (s = t.show) || void 0 === s || s), + o + ); + } + (a.r(t), + a.d(t, { Game: () => VE, gameProps: () => jE, options: () => UE })); + const n = (e) => ({ + type: "text", + props: i( + { + testId: e.testId, + font: e.font, + text: e.text, + color: e.color, + gradient: e.gradient, + strokeColor: e.strokeColor, + strokeThickness: e.strokeThickness, }, - f = ({ props: e, mask: t, update: a, array: i, testId: n }) => ({ - type: "lineArray", - mask: t || null, - props: [], - newProps: e, - update: a, - testId: n, - array: i, - isMut: true, - }), - y = (e, t) => ({ - type: "image", + e, + ), + }), + s = (e) => ({ + type: "circle", + props: i({ testId: e.testId, radius: e.radius, color: e.color }, e), + }), + o = (e) => ({ + type: "rectangle", + props: i( + { + testId: e.testId, + width: e.width, + height: e.height, + color: e.color, + gradient: e.gradient, + }, + e, + ), + }), + r = (e) => { + var t; + return { + type: "line", props: i( { testId: e.testId, - width: e.width || 10, - height: e.height || 10, - fileName: e.fileName || "", + color: e.color, + fillColor: e.fillColor, + thickness: null !== (t = e.thickness) && void 0 !== t ? t : 1, + lineCap: e.lineCap || "butt", + path: e.path, + fillGradient: e.fillGradient, }, e, ), - update: t, - isMut: true, - }), - imageArray = ({ - props: e, - fileName: t, - mask: a, - update: i, - array: n, - testId: s, - }) => ({ - type: "imageArray", - mask: a || null, - props: [], - fileName: t, - newProps: e, - update: i, - testId: s, - array: n, - isMut: true, - }), - spriteSheetPrimitive = (e, t) => ({ - type: "spriteSheet", + }; + }, + l = (e) => ({ + type: "image", + props: i( + { + testId: e.testId, + fileName: e.fileName, + width: e.width, + height: e.height, + }, + e, + ), + }), + c = (e, t) => ({ + type: "text", + props: i( + { + testId: e.testId, + font: e.font, + text: e.text || "", + color: e.color || "black", + gradient: e.gradient, + strokeColor: e.strokeColor, + strokeThickness: e.strokeThickness, + }, + e, + ), + update: t, + isMut: true, + }), + d = ({ props: e, mask: t, update: a, array: i, testId: n }) => ({ + type: "textArray", + mask: t || null, + props: [], + newProps: e, + update: a, + testId: n, + array: i, + isMut: true, + }), + u = (e, t) => ({ + type: "circle", + props: i( + { + testId: e.testId, + radius: e.radius || 10, + color: e.color || "black", + gradient: e.gradient, + }, + e, + ), + update: t, + isMut: true, + }), + circleArray = ({ + props: e, + mask: t, + update: a, + array: i, + testId: n, + }) => ({ + type: "circleArray", + mask: t || null, + props: [], + newProps: e, + update: a, + testId: n, + array: i, + isMut: true, + }), + p = (e, t) => ({ + type: "rectangle", + props: i( + { + testId: e.testId, + width: e.width || 10, + height: e.height || 10, + color: e.color || "black", + gradient: e.gradient, + }, + e, + ), + update: t, + isMut: true, + }), + g = ({ props: e, mask: t, update: a, array: i, testId: n }) => ({ + type: "rectangleArray", + mask: t || null, + props: [], + newProps: e, + update: a, + testId: n, + array: i, + isMut: true, + }), + m = (e, t) => { + var a; + return { + type: "line", props: i( { testId: e.testId, - fileName: e.fileName || "", - columns: e.columns || 1, - rows: e.rows || 1, - index: e.index || 0, - width: e.width || 10, - height: e.height || 10, + color: e.color, + fillColor: e.fillColor, + thickness: null !== (a = e.thickness) && void 0 !== a ? a : 1, + lineCap: e.lineCap || "butt", + path: e.path || [], + gradient: e.gradient, + fillGradient: e.fillGradient, }, e, ), update: t, isMut: true, - }); - function makeCustomSprite(e) { - return function (t) { - return { type: "custom", spriteObj: e, props: t }; }; - } - function makePureSprite(e) { - return function (t) { - return { type: "pure", spriteObj: e, props: t }; - }; - } - function makeNativeSprite(e) { - return (t, a) => ({ type: "native", name: e, props: t, update: a }); - } - function makeSprite(e) { - return { - Single: function (t, a) { - return { type: "mutable", spriteObj: e, props: t, update: a }; + }, + f = ({ props: e, mask: t, update: a, array: i, testId: n }) => ({ + type: "lineArray", + mask: t || null, + props: [], + newProps: e, + update: a, + testId: n, + array: i, + isMut: true, + }), + y = (e, t) => ({ + type: "image", + props: i( + { + testId: e.testId, + width: e.width || 10, + height: e.height || 10, + fileName: e.fileName || "", }, - Array: function ({ + e, + ), + update: t, + isMut: true, + }), + imageArray = ({ + props: e, + fileName: t, + mask: a, + update: i, + array: n, + testId: s, + }) => ({ + type: "imageArray", + mask: a || null, + props: [], + fileName: t, + newProps: e, + update: i, + testId: s, + array: n, + isMut: true, + }), + spriteSheetPrimitive = (e, t) => ({ + type: "spriteSheet", + props: i( + { + testId: e.testId, + fileName: e.fileName || "", + columns: e.columns || 1, + rows: e.rows || 1, + index: e.index || 0, + width: e.width || 10, + height: e.height || 10, + }, + e, + ), + update: t, + isMut: true, + }); + function makeCustomSprite(e) { + return function (t) { + return { type: "custom", spriteObj: e, props: t }; + }; + } + function makePureSprite(e) { + return function (t) { + return { type: "pure", spriteObj: e, props: t }; + }; + } + function makeNativeSprite(e) { + return (t, a) => ({ type: "native", name: e, props: t, update: a }); + } + function makeSprite(e) { + return { + Single: function (t, a) { + return { type: "mutable", spriteObj: e, props: t, update: a }; + }, + Array: function ({ + props: t, + update: a, + updateAll: i, + filter: n, + array: s, + key: o, + }) { + return { + type: "mutableArray", + spriteObj: e, props: t, update: a, updateAll: i, filter: n, array: s, key: o, - }) { - return { - type: "mutableArray", - spriteObj: e, - props: t, - update: a, - updateAll: i, - filter: n, - array: s, - key: o, - }; - }, - }; - } - const ifConditional = (e, t) => ({ - type: "conditional", - condition: e, - trueSprites: t, - falseSprites: () => [], - }), - conditional = (e, t, a) => ({ - type: "conditional", - condition: e, - trueSprites: t, - falseSprites: a, - }), - onChange = (e, t) => ({ type: "onChange", value: e, sprites: t }), - lineMask = (e) => ({ - type: "lineMask", - path: e.path, - x: e.x || 0, - y: e.y || 0, - }), - circleMask = (e) => ({ - type: "circleMask", - radius: e.radius, - x: e.x || 0, - y: e.y || 0, - }), - rectangleMask = (e) => ({ - type: "rectangleMask", - width: e.width, - height: e.height, - x: e.x || 0, - y: e.y || 0, - }); - function A() { - const e = { - Sprite: ({ context: t, sprites: a }) => ({ - type: "context", - value: t, - sprites: a, - context: e, - }), - Single: ({ context: t, sprites: a }) => ({ - type: "mutContext", - value: t, - sprites: a, - context: e, - }), - }; - return e; - } - const k = { - create: ({ - props: e, - parentGlobalId: t, - getState: a, - utils: i, - }) => { - const n = `${t}--${e.id}`; - let s; - return ( - !e.numberOfLines || e.numberOfLines <= 1 - ? ((s = document.createElement(e.tagName || "input")), - e.tagName || (s.type = "text")) - : ((s = document.createElement(e.tagName || "textarea")), - (s.style.resize = "none")), - e.setupElement ? e.setupElement(s) : null, - (s.id = n), - (s.style.position = "absolute"), - (s.style.boxSizing = "border-box"), - x(s, e, null, i), - s.addEventListener("input", (e) => { - const t = e.currentTarget, - i = a(); - ((i.selectionEnd = t.selectionEnd), - i.storedProps.onChangeText(t.value), - (t.value = i.storedProps.text), - (t.selectionEnd = i.selectionEnd - ? i.selectionEnd - 1 - : null)); - }), - document.body.appendChild(s), - { domId: n, storedProps: e, selectionEnd: null } - ); - }, - loop: ({ props: e, state: t, utils: a }) => { - const i = t.domId; - let n = false; - for (const [a, i] of Object.entries(e)) { - for (const [e, s] of Object.entries(t.storedProps)) - if (a === e && i !== s && !N.includes(a)) { - n = true; - break; - } - if (n) break; - } - if (a.didResize || n) { - const n = document.getElementById(i); - if (!n) throw Error(`No input found with id ${i}`); - x(n, e, t.selectionEnd, a); - } - t.storedProps = { ...e }; - }, - cleanup: ({ state: e }) => { - const t = e.domId, - a = document.getElementById(t); - if (!a) throw Error(`No input found with id ${t}`); - document.body.removeChild(a); - }, + }; }, - N = ["id", "onChangeText"]; - function x( - e, - t, - a, - { gameYToPlatformY: i, gameXToPlatformX: n, scale: s }, - ) { - ((e.value = t.text), null !== a && (e.selectionEnd = a)); - const o = t.fontSize * s, - r = t.width * s; - ((e.style.font = `${o}px ${t.fontName}`), - (e.style.padding = 4 * s + "px"), - (e.style.borderWidth = 1 * s + "px"), - (e.style.textAlign = t.align || "center"), - (e.style.color = t.color || "black"), - (e.style.width = `${r}px`), - (e.style.lineHeight = `${o}px`)); - const l = o * (t.numberOfLines || 1) + 4 * s * 2 + 1 * s * 2; - e.style.height = `${l}px`; - const c = n(t.x || 0) - r / 2; - e.style.left = `${c}px`; - const d = i(t.y || 0) - l / 2; - e.style.top = `${d}px`; - } - const P = makeNativeSprite("TextInput"), - M = 30, - L = - ([e, t]) => + }; + } + const ifConditional = (e, t) => ({ + type: "conditional", + condition: e, + trueSprites: t, + falseSprites: () => [], + }), + conditional = (e, t, a) => ({ + type: "conditional", + condition: e, + trueSprites: t, + falseSprites: a, + }), + onChange = (e, t) => ({ type: "onChange", value: e, sprites: t }), + lineMask = (e) => ({ + type: "lineMask", + path: e.path, + x: e.x || 0, + y: e.y || 0, + }), + circleMask = (e) => ({ + type: "circleMask", + radius: e.radius, + x: e.x || 0, + y: e.y || 0, + }), + rectangleMask = (e) => ({ + type: "rectangleMask", + width: e.width, + height: e.height, + x: e.x || 0, + y: e.y || 0, + }); + function A() { + const e = { + Sprite: ({ context: t, sprites: a }) => ({ + type: "context", + value: t, + sprites: a, + context: e, + }), + Single: ({ context: t, sprites: a }) => ({ + type: "mutContext", + value: t, + sprites: a, + context: e, + }), + }; + return e; + } + const k = { + create: ({ + props: e, + parentGlobalId: t, + getState: a, + utils: i, + }) => { + const n = `${t}--${e.id}`; + let s; + return ( + !e.numberOfLines || e.numberOfLines <= 1 + ? ((s = document.createElement(e.tagName || "input")), + e.tagName || (s.type = "text")) + : ((s = document.createElement(e.tagName || "textarea")), + (s.style.resize = "none")), + e.setupElement ? e.setupElement(s) : null, + (s.id = n), + (s.style.position = "absolute"), + (s.style.boxSizing = "border-box"), + x(s, e, null, i), + s.addEventListener("input", (e) => { + const t = e.currentTarget, + i = a(); + ((i.selectionEnd = t.selectionEnd), + i.storedProps.onChangeText(t.value), + (t.value = i.storedProps.text), + (t.selectionEnd = i.selectionEnd + ? i.selectionEnd - 1 + : null)); + }), + document.body.appendChild(s), + { domId: n, storedProps: e, selectionEnd: null } + ); + }, + loop: ({ props: e, state: t, utils: a }) => { + const i = t.domId; + let n = false; + for (const [a, i] of Object.entries(e)) { + for (const [e, s] of Object.entries(t.storedProps)) + if (a === e && i !== s && !N.includes(a)) { + n = true; + break; + } + if (n) break; + } + if (a.didResize || n) { + const n = document.getElementById(i); + if (!n) throw Error(`No input found with id ${i}`); + x(n, e, t.selectionEnd, a); + } + t.storedProps = { ...e }; + }, + cleanup: ({ state: e }) => { + const t = e.domId, + a = document.getElementById(t); + if (!a) throw Error(`No input found with id ${t}`); + document.body.removeChild(a); + }, + }, + N = ["id", "onChangeText"]; + function x( + e, + t, + a, + { gameYToPlatformY: i, gameXToPlatformX: n, scale: s }, + ) { + ((e.value = t.text), null !== a && (e.selectionEnd = a)); + const o = t.fontSize * s, + r = t.width * s; + ((e.style.font = `${o}px ${t.fontName}`), + (e.style.padding = 4 * s + "px"), + (e.style.borderWidth = 1 * s + "px"), + (e.style.textAlign = t.align || "center"), + (e.style.color = t.color || "black"), + (e.style.width = `${r}px`), + (e.style.lineHeight = `${o}px`)); + const l = o * (t.numberOfLines || 1) + 4 * s * 2 + 1 * s * 2; + e.style.height = `${l}px`; + const c = n(t.x || 0) - r / 2; + e.style.left = `${c}px`; + const d = i(t.y || 0) - l / 2; + e.style.top = `${d}px`; + } + const P = makeNativeSprite("TextInput"), + M = 30, + L = + ([e, t]) => (a) => Math.max(Math.min(t, a), e), - D = L([0, 1]), - B = { - mapTo: - ([e, t], [a, i]) => + D = L([0, 1]), + B = { + mapTo: + ([e, t], [a, i]) => (n) => ((n - e) / (t - e)) * (i - a) + a, - clamp: L, - clamp2: (e, t, a) => Math.max(Math.min(t, a), e), - numberMap: - ([e, t], [a, i]) => + clamp: L, + clamp2: (e, t, a) => Math.max(Math.min(t, a), e), + numberMap: + ([e, t], [a, i]) => (n) => ((n - e) * (i - a)) / (t - e) + a, - numberMap2: (e, t, a, i, n) => ((n - e) * (i - a)) / (t - e) + a, - toRad: (e) => e * (Math.PI / 180), - toDeg: (e) => e * (180 / Math.PI), - roundTo: (e) => (t) => { - const a = Math.pow(10, e); - return Math.round(a * t) / a; - }, - zeroTo1: D, - isEven: (e) => e % 2 == 0, - formatSeconds: function (e) { - const t = e % 60; - return `${Math.floor(e / 60)}:${t < 10 ? `0${t}` : t}`; - }, - }; - var F = a(2062), - Y = a.n(F); - const U = (e) => 2 * e, - j = { y: 0, gradY: 0 }, - G = { - jumpDistance: 135, - getJumpFrames: (e) => 3600 / e, - getCoefficients: (e) => { - const t = (30 / Math.pow(e, 2)) * -10.125; - return { a: t, b: -t * e }; - }, - initGrad: (e, t) => - e * (t ? t : globalPlayerScale === 1 ? 1 : 0.75), - stepY: (y, gradY, a, df, g) => { - g = g || 1; - let n = Math.max(gradY * g + (U(a) * df) / 2, -30) * g; - const s = y + n * df; - return ( - (n += ((U(a) * df) / 2) * g), - (j.y = s), - (j.gradY = n), - j - ); - }, - getOvershootPercent: (e, t, a) => { - const i = t - U(a) / 2; - return 0 === i ? 0 : B.clamp2(0, 1, e / i); - }, - getSpeed: (e) => 135 / e, - incGrad: U, + numberMap2: (e, t, a, i, n) => ((n - e) * (i - a)) / (t - e) + a, + toRad: (e) => e * (Math.PI / 180), + toDeg: (e) => e * (180 / Math.PI), + roundTo: (e) => (t) => { + const a = Math.pow(10, e); + return Math.round(a * t) / a; }, - V = (e, t) => { - var a, i, n, s; - const o = - null !== (a = null == t ? void 0 : t.x) && void 0 !== a - ? a - : 15, - r = - null !== (i = null == t ? void 0 : t.y) && void 0 !== i - ? i - : 15, - l = - null !== (n = null == t ? void 0 : t.offsetX) && void 0 !== n - ? n - : 0, - c = - null !== (s = null == t ? void 0 : t.offsetY) && void 0 !== s - ? s - : 0, - d = e.x - l, - u = e.y - c, - h = d % o, - p = u % r, - g = d - h + l, - m = u - p + c; - return { - x: Math.abs(h) > o / 2 ? g + o * Math.sign(h) : g, - y: Math.abs(p) > r / 2 ? m + r * Math.sign(p) : m, - }; + zeroTo1: D, + isEven: (e) => e % 2 == 0, + formatSeconds: function (e) { + const t = e % 60; + return `${Math.floor(e / 60)}:${t < 10 ? `0${t}` : t}`; + }, + }; + var F = a(2062), + Y = a.n(F); + const U = (e) => 2 * e, + j = { y: 0, gradY: 0 }, + G = { + jumpDistance: 135, + getJumpFrames: (e) => 3600 / e, + getCoefficients: (e) => { + const t = (30 / Math.pow(e, 2)) * -10.125; + return { a: t, b: -t * e }; + }, + initGrad: (e, t) => + e * (t ? t : globalPlayerScale === 1 ? 1 : 0.75), + stepY: (y, gradY, a, df, g) => { + g = g || 1; + let n = Math.max(gradY * g + (U(a) * df) / 2, -30) * g; + const s = y + n * df; + return ( + (n += ((U(a) * df) / 2) * g), + (j.y = s), + (j.gradY = n), + j + ); + }, + getOvershootPercent: (e, t, a) => { + const i = t - U(a) / 2; + return 0 === i ? 0 : B.clamp2(0, 1, e / i); + }, + getSpeed: (e) => 135 / e, + incGrad: U, + }, + V = (e, t) => { + var a, i, n, s; + const o = + null !== (a = null == t ? void 0 : t.x) && void 0 !== a + ? a + : 15, + r = + null !== (i = null == t ? void 0 : t.y) && void 0 !== i + ? i + : 15, + l = + null !== (n = null == t ? void 0 : t.offsetX) && void 0 !== n + ? n + : 0, + c = + null !== (s = null == t ? void 0 : t.offsetY) && void 0 !== s + ? s + : 0, + d = e.x - l, + u = e.y - c, + h = d % o, + p = u % r, + g = d - h + l, + m = u - p + c; + return { + x: Math.abs(h) > o / 2 ? g + o * Math.sign(h) : g, + y: Math.abs(p) > r / 2 ? m + r * Math.sign(p) : m, }; - function H(e) { - switch (e.type) { - case "switchPlatform": - return (function ({ - x: e, - y: t, - width: a, - height: i, - direction: d, - }) { - const n = i / 2, - s = t + n, - o = t + a - n; - return [ - { x: e, y: t, width: a, height: i }, - { x: e - a / 2 + n, y: (o + s) / 2, width: i, height: o - s }, - ]; - })(e); - case "platform": - return (function ({ - x: e, - y: t, - movement: a, - midY: i, - width: n, - height: s, - }) { - return "static" === a || "falling" === a || "rail" === a - ? [{ x: e, y: t, width: n, height: s }] - : [ - { x: e, y: i + X / 2, width: n, height: s }, - { x: e, y: i - X / 2, width: n, height: s }, - ]; - })(e); - case "saw": - return (function ({ - x: e, - midY: t, - width: a, - height: i, - movement: x, - }) { - return "static" === x || "falling" === x - ? [ - { - x: e, - y: t, - width: a, - height: i, - ignore: "static" === x, - }, - ] - : [ - { x: e, y: t + z / 2, width: a, height: i }, - { x: e, y: t - z / 2, width: a, height: i }, - ]; - //return [ - // { x: e, y: t + z / 2, width: a, height: i }, - // { x: e, y: t - z / 2, width: a, height: i }, - //]; - })(e); - case "portal": - return (function ({ - x: e, - y: t, - width: a, - height: i, - direction: n, - }) { - return [ + }; + function H(e) { + switch (e.type) { + case "switchPlatform": + return (function ({ + x: e, + y: t, + width: a, + height: i, + direction: d, + }) { + const n = i / 2, + s = t + n, + o = t + a - n; + return [ + { x: e, y: t, width: a, height: i }, + { x: e - a / 2 + n, y: (o + s) / 2, width: i, height: o - s }, + ]; + })(e); + case "platform": + return (function ({ + x: e, + y: t, + movement: a, + midY: i, + width: n, + height: s, + }) { + return "static" === a || "falling" === a || "rail" === a + ? [{ x: e, y: t, width: n, height: s }] + : [ + { x: e, y: i + X / 2, width: n, height: s }, + { x: e, y: i - X / 2, width: n, height: s }, + ]; + })(e); + case "saw": + return (function ({ + x: e, + midY: t, + width: a, + height: i, + movement: x, + }) { + return "static" === x || "falling" === x + ? [ { x: e, y: t, - width: "left" === n || "right" === n ? a : i, - height: "left" === n || "right" === n ? i : a, + width: a, + height: i, + ignore: "static" === x, }, + ] + : [ + { x: e, y: t + z / 2, width: a, height: i }, + { x: e, y: t - z / 2, width: a, height: i }, ]; - })(e); - case "enemy": + //return [ + // { x: e, y: t + z / 2, width: a, height: i }, + // { x: e, y: t - z / 2, width: a, height: i }, + //]; + })(e); + case "portal": + return (function ({ + x: e, + y: t, + width: a, + height: i, + direction: n, + }) { return [ { - x: e.x, - y: e.y, - width: Math.max(e.width, 30), - height: Math.max(e.height, 30), + x: e, + y: t, + width: "left" === n || "right" === n ? a : i, + height: "left" === n || "right" === n ? i : a, }, ]; - default: - return [{ x: e.x, y: e.y, width: e.width, height: e.height }]; - } + })(e); + case "enemy": + return [ + { + x: e.x, + y: e.y, + width: Math.max(e.width, 30), + height: Math.max(e.height, 30), + }, + ]; + default: + return [{ x: e.x, y: e.y, width: e.width, height: e.height }]; } - const X = 90, - z = 90; - function W(e) { - let height = + } + const X = 90, + z = 90; + function W(e) { + let height = + "walkerHelmet" === (null == e ? void 0 : e.kind) + ? 45 + : "fireball" === (null == e ? void 0 : e.kind) + ? 15 + : 30, + a = "fireball" === (null == e ? void 0 : e.kind) ? 15 : 30; + return ( + (null == e ? void 0 : e.giant) && + q(e.kind) && + ((height *= 3), (a *= 3)), + { width: a, height: height } + ); + } + function q(e) { + return "walker" === e || "walkerHelmet" === e; + } + const $ = { + updateXY: function (e, t, a) { + return Object.assign(Object.assign({}, e), { + x: t, + y: a, + midY: a, + trueY: a, + }); + }, + getRectangles: H, + getBorderDimensions: function (e) { + if (0 === e.length) return null; + let t = Number.MAX_SAFE_INTEGER, + a = Number.MIN_SAFE_INTEGER, + i = Number.MAX_SAFE_INTEGER, + n = Number.MIN_SAFE_INTEGER; + return ( + e.flatMap(H).forEach(({ x: e, y: s, width: o, height: r }) => { + ((t = Math.min(t, e - o / 2)), + (a = Math.max(a, e + o / 2)), + (i = Math.min(i, s - r / 2)), + (n = Math.max(n, s + r / 2))); + }), + { width: a - t, height: n - i, x: (t + a) / 2, y: (i + n) / 2 } + ); + }, + newPlatform: (e) => { + var t, a, i, n, s, o, r, l; + return { + type: "platform", + array: "platforms", + x: + null !== (t = null == e ? void 0 : e.x) && void 0 !== t + ? t + : 0, + y: + null !== (a = null == e ? void 0 : e.y) && void 0 !== a + ? a + : 0, + midY: + null !== + (n = + null !== (i = null == e ? void 0 : e.midY) && void 0 !== i + ? i + : null == e + ? void 0 + : e.y) && void 0 !== n + ? n + : 0, + width: + null !== (s = null == e ? void 0 : e.width) && void 0 !== s + ? s + : 90, + height: + null !== (o = null == e ? void 0 : e.height) && void 0 !== o + ? o + : 15, + snapSize: { offsetY: 7.5 }, + canJumpThrough: true, + movement: + null !== (r = null == e ? void 0 : e.movement) && void 0 !== r + ? r + : "static", + movementTrigger: + null !== (l = null == e ? void 0 : e.movementTrigger) && + void 0 !== l + ? l + : "beat", + multiplier: e ? e.multiplier || 1 : 1, + }; + }, + newSpike: (e) => { + var t, a, i, n, s, o; + return { + type: "spike", + array: "spikes", + x: + null !== (t = null == e ? void 0 : e.x) && void 0 !== t + ? t + : 0, + y: + null !== (a = null == e ? void 0 : e.y) && void 0 !== a + ? a + : 0, + width: + null !== (i = null == e ? void 0 : e.width) && void 0 !== i + ? i + : 30, + height: + null !== (n = null == e ? void 0 : e.height) && void 0 !== n + ? n + : 30, + rotation: + null !== (s = null == e ? void 0 : e.rotation) && void 0 !== s + ? s + : 0, + skipMissiles: + null !== (o = null == e ? void 0 : e.skipMissiles) && + void 0 !== o && + o, + isFade: e ? e.isFade || false : false, + isLaser: o == null ? false : e.isLaser, + }; + }, + newBlock: (e) => { + var t, a, i, n; + return { + type: "block", + array: "blocks", + x: + null !== (t = null == e ? void 0 : e.x) && void 0 !== t + ? t + : 0, + y: + null !== (a = null == e ? void 0 : e.y) && void 0 !== a + ? a + : 0, + width: + null !== (i = null == e ? void 0 : e.width) && void 0 !== i + ? i + : 30, + height: + null !== (n = null == e ? void 0 : e.height) && void 0 !== n + ? n + : 30, + steel: e == null ? false : e.steel || false, + isVoid: e == null ? false : e.isVoid || false, + isBoss: e == null ? false : e.isBoss || false, + isGround: e == null ? false : e.isGround || false, + isFade: e ? e.isFade || false : false, + rotation: 0, + skipMissiles: false, + snapSize: null == e ? void 0 : e.snapSize, + }; + }, + newMiniBlock: (e) => { + var t, a, i, n; + return { + type: "block", + array: "blocks", + x: + null !== (t = null == e ? void 0 : e.x) && void 0 !== t + ? t + : 0, + y: + null !== (a = null == e ? void 0 : e.y) && void 0 !== a + ? a + : 0, + width: + null !== (i = null == e ? void 0 : e.width) && void 0 !== i + ? i + : 15, + height: + null !== (n = null == e ? void 0 : e.height) && void 0 !== n + ? n + : 15, + rotation: 0, + steel: e != undefined && (e?.steel || false), + isVoid: e != undefined && (e?.isVoid || false), + isBoss: e == undefined ? false : e?.isBoss || false, + isFade: e ? e.isFade || false : false, + skipMissiles: false, + snapSize: { offsetX: 7.5, offsetY: 7.5 }, + }; + }, + miniBlockWidth: 15, + newMiniSpike: (e) => { + var t, a, i, n, s, o; + return { + type: "spike", + array: "spikes", + x: + null !== (t = null == e ? void 0 : e.x) && void 0 !== t + ? t + : 0, + y: + null !== (a = null == e ? void 0 : e.y) && void 0 !== a + ? a + : 0, + width: + null !== (i = null == e ? void 0 : e.width) && void 0 !== i + ? i + : 15, + height: + null !== (n = null == e ? void 0 : e.height) && void 0 !== n + ? n + : 15, + rotation: + null !== (s = null == e ? void 0 : e.rotation) && void 0 !== s + ? s + : 0, + skipMissiles: + null !== (o = null == e ? void 0 : e.skipMissiles) && + void 0 !== o && + o, + isLaser: e == null ? false : e.isLaser, + isFade: e ? e.isFade || false : false, + snapSize: { offsetX: 7.5, offsetY: 7.5 }, + }; + }, + miniSpikeWidth: 15, + newSwitchBlock: (e) => { + var t, a, i, n; + return { + type: "block", + array: "blocks", + x: + null !== (t = null == e ? void 0 : e.x) && void 0 !== t + ? t + : 0, + y: + null !== (a = null == e ? void 0 : e.y) && void 0 !== a + ? a + : 0, + width: + null !== (i = null == e ? void 0 : e.width) && void 0 !== i + ? i + : 30, + height: + null !== (n = null == e ? void 0 : e.height) && void 0 !== n + ? n + : 30, + trigger: e == undefined ? "beat" : e?.trigger || "beat", + init: e == undefined ? "red" : e?.init || "red", + snapSize: null == e ? void 0 : e.snapSize, + rotation: 0, + skipMissiles: false, + }; + }, + newSwitchSpike: (e) => { + var t, a, i, n; + return { + type: "spike", + array: "spikes", + x: + null !== (t = null == e ? void 0 : e.x) && void 0 !== t + ? t + : 0, + y: + null !== (a = null == e ? void 0 : e.y) && void 0 !== a + ? a + : 0, + width: + null !== (i = null == e ? void 0 : e.width) && void 0 !== i + ? i + : 30, + height: + null !== (n = null == e ? void 0 : e.height) && void 0 !== n + ? n + : 30, + trigger: e == null ? "beat" : e.trigger || "beat", + init: e == null ? "red" : e?.init || "red", + snapSize: null == e ? void 0 : e.snapSize, + rotation: e?.rotation || 0, + skipMissiles: false, + }; + }, + newDirectionChange: (e) => { + var t, a, i, n, s, o; + const r = + null !== (t = null == e ? void 0 : e.direction) && void 0 !== t + ? t + : "left"; + t = undefined; + return { + type: "directionChange", + array: "directionChanges", + x: + null !== (a = null == e ? void 0 : e.x) && void 0 !== a + ? a + : 0, + y: + null !== (i = null == e ? void 0 : e.y) && void 0 !== i + ? i + : 0, + width: + null !== (n = null == e ? void 0 : e.width) && void 0 !== n + ? n + : 60, + height: + null !== (s = null == e ? void 0 : e.height) && void 0 !== s + ? s + : 90, + direction: r, + multiUse: e === undefined ? false : e.multiUse, + fixSync: e === undefined ? false : e?.fixSync, + snapSize: + null !== (o = null == e ? void 0 : e.snapSize) && void 0 !== o + ? o + : { x: G.jumpDistance, offsetX: 15 }, + }; + }, + newSpeedChange: (e) => { + var t, a, i, n, s, o; + const r = + null !== (t = null == e ? void 0 : e.direction) && void 0 !== t + ? t + : "right"; + return { + type: "speedChange", + array: "speedChanges", + x: + null !== (a = null == e ? void 0 : e.x) && void 0 !== a + ? a + : 0, + y: + null !== (i = null == e ? void 0 : e.y) && void 0 !== i + ? i + : 0, + width: + null !== (n = null == e ? void 0 : e.width) && void 0 !== n + ? n + : 60, + height: + null !== (s = null == e ? void 0 : e.height) && void 0 !== s + ? s + : 90, + direction: r, + snapSize: + null !== (o = null == e ? void 0 : e.snapSize) && void 0 !== o + ? o + : { x: G.jumpDistance / 2, offsetX: 15 }, + }; + }, + newFlag: (e) => { + var t, a, i, n, s, o, r, b; + const l = + null !== (t = null == e ? void 0 : e.role) && void 0 !== t + ? t + : "checkpoint"; + return { + type: "flag", + array: "flags", + x: + null !== (a = null == e ? void 0 : e.x) && void 0 !== a + ? a + : 0, + y: + null !== (i = null == e ? void 0 : e.y) && void 0 !== i + ? i + : 0, + width: + null !== (n = null == e ? void 0 : e.width) && void 0 !== n + ? n + : 60, + height: + null !== (s = null == e ? void 0 : e.height) && void 0 !== s + ? s + : 90, + role: l, + switchesOn: + null !== (o = null == e ? void 0 : e.switchesOn) && + void 0 !== o && + o, + retainSpeed: + null !== (b = null == e ? void 0 : e.retainSpeed) && + void 0 !== b && + b, + isFlying: e ? e.isFlying : false, + snapSize: + null !== (r = null == e ? void 0 : e.snapSize) && void 0 !== r + ? r + : { x: G.jumpDistance, offsetX: 15 }, + }; + }, + newSaw: (e) => { + var t, + a, + i, + n, + s, + o, + r, + l, + shape = e?.shape || "rail", + diameter = + shape == "bar" + ? 120 + : shape == "large" + ? 90 + : shape == "small" + ? 60 + : 30, + width = diameter, + height = shape == "bar" ? 20 : diameter; + return { + type: "saw", + array: "saws", + x: + null !== (t = null == e ? void 0 : e.x) && void 0 !== t + ? t + : 0, + y: + null !== (a = null == e ? void 0 : e.y) && void 0 !== a + ? a + : 0, + midY: + null !== + (n = + null !== (i = null == e ? void 0 : e.midY) && void 0 !== i + ? i + : null == e + ? void 0 + : e.y) && void 0 !== n + ? n + : 0, + shape: shape, + width: + null !== (s = null == e ? void 0 : e.width) && void 0 !== s + ? s + : width, + height: + null !== (o = null == e ? void 0 : e.height) && void 0 !== o + ? o + : height, + movement: + null !== (r = null == e ? void 0 : e.movement) && void 0 !== r + ? r + : "upDown", + movementTrigger: + null !== (l = null == e ? void 0 : e.movementTrigger) && + void 0 !== l + ? l + : "beat", + multiplier: e == undefined ? 1 : e?.multiplier || 1, + rotation: e == null ? 0 : e.rotation || 0, + offset: e == null ? 0 : e.offset || 0, + skipMissiles: + e?.skipMissiles || false + }; + }, + newEnemy: (e) => { + var t, a, i, n, s; + const { width: o, height: r } = W(e); + return { + type: "enemy", + array: "enemies", + x: + null !== (t = null == e ? void 0 : e.x) && void 0 !== t + ? t + : 0, + y: + null !== (a = null == e ? void 0 : e.y) && void 0 !== a + ? a + : 0, + width: o, + height: r, + kind: + null !== (i = null == e ? void 0 : e.kind) && void 0 !== i + ? i + : "shooter", + giant: + null !== (n = null == e ? void 0 : e.giant) && + void 0 !== n && + n, + skipMissiles: + null !== (s = null == e ? void 0 : e.skipMissiles) && + void 0 !== s && + s, + enemyDir: e == undefined ? -1 : e?.enemyDir, + isCompatible: e ? e.isCompatible : true, + snapSize: "walkerHelmet" === (null == e ? void 0 : e.kind) - ? 45 - : "fireball" === (null == e ? void 0 : e.kind) - ? 15 - : 30, - a = "fireball" === (null == e ? void 0 : e.kind) ? 15 : 30; + ? { offsetY: 7.5 } + : void 0, + }; + }, + newPowerup: (e) => { + var t, a, i, n, s, j; + const o = + null !== (t = null == e ? void 0 : e.item) && void 0 !== t + ? t + : "gun"; + return { + type: "powerup", + array: "powerups", + x: + null !== (a = null == e ? void 0 : e.x) && void 0 !== a + ? a + : 0, + y: + null !== (i = null == e ? void 0 : e.y) && void 0 !== i + ? i + : 0, + width: + null !== (n = null == e ? void 0 : e.width) && void 0 !== n + ? n + : 30, + height: + null !== (s = null == e ? void 0 : e.height) && void 0 !== s + ? s + : 30, + item: o, + compatible: e ? e.compatible : true, + override: e ? e.override : false, + }; + }, + newSwitchButton: (e) => { + var t, a, i, n, s; + return { + type: "switchButton", + array: "switchButtons", + x: + null !== (t = null == e ? void 0 : e.x) && void 0 !== t + ? t + : 0, + y: + null !== (a = null == e ? void 0 : e.y) && void 0 !== a + ? a + : 0, + width: + null !== (i = null == e ? void 0 : e.width) && void 0 !== i + ? i + : 30, + height: + null !== (n = null == e ? void 0 : e.height) && void 0 !== n + ? n + : 30, + affects: + null !== (s = null == e ? void 0 : e.affects) && void 0 !== s + ? s + : "movement", + color: e == undefined ? "flash" : e?.color || 0, + gravity: + e == undefined ? 1 : e?.gravity == null ? 1 : e?.gravity, + up: e ? e.up : false, + down: e ? e.down : false, + }; + }, + newSwitchPlatform: (e) => { + var t, a, i, n, s, o; + const r = + null !== (t = null == e ? void 0 : e.initPosition) && + void 0 !== t + ? t + : "up"; + return { + type: "switchPlatform", + array: "switchPlatforms", + x: + null !== (a = null == e ? void 0 : e.x) && void 0 !== a + ? a + : 0, + y: + null !== (i = null == e ? void 0 : e.y) && void 0 !== i + ? i + : 0, + width: + null !== (n = null == e ? void 0 : e.width) && void 0 !== n + ? n + : 120, + height: + null !== (s = null == e ? void 0 : e.height) && void 0 !== s + ? s + : 15, + snapSize: { offsetY: 7.5 }, + initPosition: r, + movementTrigger: + null !== (o = null == e ? void 0 : e.movementTrigger) && + void 0 !== o + ? o + : "switch", + rotation: "up" === r ? -90 + e.direction : 0 + e.direction, + direction: e?.direction || 0, + }; + }, + newSpring: (e) => { + var t, a, i, n, o; + return { + type: "spring", + array: "springs", + x: + null !== (t = null == e ? void 0 : e.x) && void 0 !== t + ? t + : 0, + y: + null !== (a = null == e ? void 0 : e.y) && void 0 !== a + ? a + : 0, + width: + null !== (i = null == e ? void 0 : e.width) && void 0 !== i + ? i + : 30, + height: + null !== (n = null == e ? void 0 : e.height) && void 0 !== n + ? n + : 15, + direction: + null !== (o = null == e ? void 0 : e.direction) && + void 0 !== o + ? o + : 1, + snapSize: { offsetY: 7.5 }, + }; + }, + newCollectible: (e) => { + var t, a, i, n, s, o; + return { + type: "collectible", + array: "collectibles", + x: + null !== (t = null == e ? void 0 : e.x) && void 0 !== t + ? t + : 0, + y: + null !== (a = null == e ? void 0 : e.y) && void 0 !== a + ? a + : 0, + width: + null !== (i = null == e ? void 0 : e.width) && void 0 !== i + ? i + : 30, + height: + null !== (n = null == e ? void 0 : e.height) && void 0 !== n + ? n + : 30, + form: + null !== (s = null == e ? void 0 : e.form) && void 0 !== s + ? s + : "coin", + snapSize: + null !== (o = null == e ? void 0 : e.snapSize) && void 0 !== o + ? o + : "arrow" === (null == e ? void 0 : e.form) + ? { y: M } + : void 0, + }; + }, + newPortal: (e) => { + var t, a, i, n, s, o, r; + return { + type: "portal", + array: "portals", + x: + null !== (t = null == e ? void 0 : e.x) && void 0 !== t + ? t + : 0, + y: + null !== (a = null == e ? void 0 : e.y) && void 0 !== a + ? a + : 0, + width: + null !== (i = null == e ? void 0 : e.width) && void 0 !== i + ? i + : 30, + height: + null !== (n = null == e ? void 0 : e.height) && void 0 !== n + ? n + : 90, + pairId: + null !== (s = null == e ? void 0 : e.pairId) && void 0 !== s + ? s + : 0, + pair: + null !== (o = null == e ? void 0 : e.pair) && void 0 !== o + ? o + : "a", + direction: + null !== (r = null == e ? void 0 : e.direction) && + void 0 !== r + ? r + : "left", + }; + }, + addPortalPairId: function (e, t) { + const a = t.portals.reduce((e, t) => Math.max(e, t.pairId), 0); + return Object.assign(Object.assign({}, e), { pairId: a + 1 }); + }, + newPortalPair: function (e) { + return Object.assign(Object.assign({}, e), { + pair: "a" === e.pair ? "b" : "a", + x: e.x + 2 * e.width, + }); + }, + sawMove: z, + platformMove: X, + changeEnemyKind: function (e, t) { + const { width: a, height: i } = W( + Object.assign(Object.assign({}, e), { kind: t }), + ), + n = "walkerHelmet" === t ? { offsetY: 7.5 } : void 0, + { x: s, y: o } = V(e, n); + return Object.assign(Object.assign({}, e), { + giant: !!q(t) && e.giant, + width: a, + height: i, + kind: t, + snapSize: n, + x: s, + y: o, + }); + }, + changeEnemyGiant: function (e, t) { + const { width: a, height: i } = W( + Object.assign(Object.assign({}, e), { giant: t }), + ), + { x: n, y: s } = V(e, e.snapSize); + return Object.assign(Object.assign({}, e), { + width: a, + height: i, + giant: t, + x: n, + y: s, + }); + }, + changeCollectibleForm: function (e, t) { + const a = "arrow" === t ? { y: M } : void 0, + { x: i, y: n } = V(e, a); + return Object.assign(Object.assign({}, e), { + form: t, + snapSize: a, + x: i, + y: n, + }); + }, + getArrowRotation: function (e) { + let t = Math.floor((e - 15) / 30) % 4; return ( - (null == e ? void 0 : e.giant) && - q(e.kind) && - ((height *= 3), (a *= 3)), - { width: a, height: height } + t < 0 && (t += 4), + 0 === t || -0 === t ? 90 : 2 === t ? 180 : 3 === t ? 0 : 270 ); + }, + getSwitchPlatformUpRectangle: function ({ + x: e, + y: t, + width: a, + height: i, + }) { + const n = i / 2; + return { + x: e - a / 2 + n, + y: t - n + a / 2, + width: i, + height: a, + }; + }, + getSwitchPlatformDownRectangle: function ({ + x: e, + y: t, + width: a, + height: i, + }) { + const n = i / 2; + return { + x: e - a / 2 + n, + y: t - n + a / 2 - a + i, + width: i, + height: a, + }; + }, + maxJetpackFuel: 60, + skateboardHeight: 7, + explosionTime: 90, + punchWidth: 90, + drillWidth: 90, + }, + J = new F.Vector(), + K = (e, t) => ((J.x = e), (J.y = t), J), + Q = new F.Circle(), + Z = (e, t, a) => ((Q.pos.x = e), (Q.pos.y = t), (Q.r = a), Q), + ee = new F.Polygon(new F.Vector(), [ + new F.Vector(), + new F.Vector(1), + new F.Vector(2), + new F.Vector(3), + ]), + te = (e, t, a, i) => ( + (ee.pos.x = e - a / 2), + (ee.pos.y = t - i / 2), + (ee.points[0].x = 0), + (ee.points[0].y = 0), + (ee.points[1].x = a), + (ee.points[1].y = 0), + (ee.points[2].x = a), + (ee.points[2].y = i), + (ee.points[3].x = 0), + (ee.points[3].y = i), + ee.setAngle(0), + ee + ), + ae = new F.Polygon(new F.Vector(), [ + new F.Vector(), + new F.Vector(1), + new F.Vector(2), + new F.Vector(3), + ]), + ie = new F.Polygon(new F.Vector(), [ + new F.Vector(), + new F.Vector(1), + new F.Vector(2), + new F.Vector(0, 3), + ]), + ne = new F.Polygon(new F.Vector(), [ + new F.Vector(), + new F.Vector(1), + new F.Vector(2), + new F.Vector(0, 3), + ]), + se = new F.Polygon(new F.Vector(), [ + new F.Vector(), + new F.Vector(1), + new F.Vector(2), + new F.Vector(0, 3), + ]), + oe = new F.Polygon(new F.Vector(), [ + new F.Vector(), + new F.Vector(1), + new F.Vector(2), + ]), + re = (e, t, a, i, n, s, o, r) => ( + (oe.pos.x = e), + (oe.pos.y = t), + (oe.points[0].x = a), + (oe.points[0].y = i), + (oe.points[1].x = n), + (oe.points[1].y = s), + (oe.points[2].x = o), + (oe.points[2].y = r), + oe.setPoints(oe.points), + oe + ), + le = new F.Polygon(new F.Vector(), [ + new F.Vector(), + new F.Vector(1), + new F.Vector(2), + new F.Vector(3), + new F.Vector(4), + ]); + function laserHitbox(obj, inset) { + let w2 = obj.width / 2, + h4 = obj.height / 4; + var hit = new F.Polygon(new F.Vector(), [ + new F.Vector(), + new F.Vector(1), + new F.Vector(2), + new F.Vector(3), + new F.Vector(4), + new F.Vector(5), + ]); + switch ( + obj.rotation % 90 // just in case + ) { + case 0: + // why did i do this + return ( + (hit.pos.x = obj.x), + (hit.pos.y = obj.y), + (hit.points[0].x = -w2 + inset), + (hit.points[0].y = 0), + (hit.points[1].x = -w2 + h4 + inset), + (hit.points[1].y = h4), + (hit.points[2].x = w2 - h4 - inset), + (hit.points[2].y = h4), + (hit.points[3].x = w2 - inset), + (hit.points[3].y = 0), + (hit.points[4].x = w2 - h4 - inset), + (hit.points[4].y = -h4), + (hit.points[5].x = -w2 + h4 + inset), + (hit.points[5].y = -h4), + hit.setPoints(hit.points), + hit + ); + case 90: + return ( + (hit.pos.x = obj.x), + (hit.pos.y = obj.y), + (hit.points[0].x = 0), + (hit.points[0].y = -w2 + inset), + (hit.points[1].x = h4), + (hit.points[1].y = -w2 + h4 + inset), + (hit.points[2].x = h4), + (hit.points[2].y = w2 - h4 - inset), + (hit.points[3].x = 0), + (hit.points[3].y = w2 - inset), + (hit.points[4].x = -h4), + (hit.points[4].y = w2 - h4 - inset), + (hit.points[5].x = -h4), + (hit.points[5].y = -w2 + h4 + inset), + hit.setPoints(hit.points), + hit + ); } - function q(e) { - return "walker" === e || "walkerHelmet" === e; + } + function ce(e, t) { + switch (e.rotation || 0) { + case 0: + return re( + e.x, + e.y, + -e.width / 2, + -e.height / 2 + 1, + e.width / 2, + -e.height / 2 + 1, + 0, + e.height / 2 - t, + ); + case 180: + return re( + e.x, + e.y, + -e.width / 2, + e.height / 2 - 1, + e.width / 2, + e.height / 2 - 1, + 0, + -e.height / 2 + t, + ); + case 90: + return re( + e.x, + e.y, + -e.width / 2, + -e.height / 2 + t, + -e.width / 2, + e.height / 2 - t, + e.width / 2 - 1, + 0, + ); + case 270: + return re( + e.x, + e.y, + e.width / 2, + -e.height / 2 + t, + e.width / 2, + e.height / 2 - t, + -e.width / 2 + 1, + 0, + ); } - const $ = { - updateXY: function (e, t, a) { - return Object.assign(Object.assign({}, e), { - x: t, - y: a, - midY: a, - trueY: a, - }); - }, - getRectangles: H, - getBorderDimensions: function (e) { - if (0 === e.length) return null; - let t = Number.MAX_SAFE_INTEGER, - a = Number.MIN_SAFE_INTEGER, - i = Number.MAX_SAFE_INTEGER, - n = Number.MIN_SAFE_INTEGER; + } + const de = { + pointInCircle: (e, t, a, i, n) => + Y().pointInCircle(K(i, n), Z(e, t, a)), + pointInSomething: (e, t, a) => + "r" in a + ? Y().pointInCircle(K(e, t), a) + : Y().pointInPolygon(K(e, t), a), + polygonHitSomething: function (e, t) { + try { + return "r" in t + ? Y().testPolygonCircle(e, t) + : Y().testPolygonPolygon(e, t); + } catch (e) { + console.error(e); + return () => false; + } + }, + getPlayerPoly: ( + playerX, + playerY, + scaleX, + scaleY, + n, + skating, + o, + ) => { + const r = scaleY * (skating ? M + $.skateboardHeight : M), + l = scaleX * M; + return ( + (o.pos.x = playerX), + (o.pos.y = playerY), + (o.points[1].x = l), + (o.points[2].x = l), + (o.points[2].y = r), + (o.points[3].y = r), + (o.offset.x = -15 * scaleX), + (o.offset.y = -15 * scaleY), + o.setAngle(B.toRad(-n)), + o + ); + }, + pooledPlayerPoly1: ie, + pooledPlayerPoly2: ne, + pooledPlayerPoly3: se, + getRectPoly: te, + getDiamondPoly: (e, t, a, i) => ( + (ae.pos.x = e), + (ae.pos.y = t), + (ae.points[0].x = -a / 2), + (ae.points[0].y = 0), + (ae.points[1].x = 0), + (ae.points[1].y = i / 2), + (ae.points[2].x = a / 2), + (ae.points[2].y = 0), + (ae.points[3].x = 0), + (ae.points[3].y = -i / 2), + ae.setAngle(0), + ae + ), + getObjectPolygon: (obj, switchBlockSpike, inset = 3) => { + switch (obj.type) { + case "spike": + return switchBlockSpike + ? te( + obj.x, + obj.y, + obj.width - 2 * inset, + obj.height - 2 * inset, + ) + : obj.isLaser + ? laserHitbox(obj, inset) + : ce(obj, inset); + case "powerup": + return re( + obj.x, + obj.y, + -obj.width / 2 + 1, + -obj.height / 2 + 1, + obj.width / 2 - 1, + -obj.height / 2 + 1, + 0, + obj.height / 2 - 1, + ); + case "collectible": { + const t = 20, + a = 20; + return te(obj.x, obj.y, t, a); + } + case "block": + return switchBlockSpike + ? obj.isLaser + ? laserHitbox(obj, inset) + : ce(obj, inset) + : te( + obj.x, + obj.y, + obj.width - 2 * inset, + obj.height - 2 * inset, + ); + case "platform": + return te( + obj.x, + obj.y, + obj.width - 2 * inset, + obj.height - 2 * inset, + ); + case "portal": + return "up" === obj.direction || "down" === obj.direction + ? te(obj.x, obj.y, obj.height, obj.width) + : te(obj.x, obj.y, obj.width, obj.height); + case "enemy": + return "walkerHelmet" === obj.kind + ? ((r = obj.width / 2), + (l = -obj.height / 2), + (c = obj.width / 2), + (d = -obj.height / 2 + M), + 0, + (u = obj.height / 2 - 1), + (h = -obj.width / 2), + (p = -obj.height / 2 + M), + (le.pos.x = obj.x), + (le.pos.y = obj.y), + (le.points[0].x = -obj.width / 2), + (le.points[0].y = -obj.height / 2), + (le.points[1].x = r), + (le.points[1].y = l), + (le.points[2].x = c), + (le.points[2].y = d), + (le.points[3].x = 0), + (le.points[3].y = u), + (le.points[4].x = h), + (le.points[4].y = p), + le.setPoints(le.points), + le) + : "minion" === obj.kind + ? // width: 15, height: 20 + te(obj.x, obj.y, 15, 20 - 2 * inset) + : "fireball" === obj.kind + ? Z(obj.x, obj.y, 5) + : "shooter" !== obj.kind + ? te(obj.x, obj.y, obj.width, obj.height - 2 * inset) + : te(obj.x, obj.y, obj.width, obj.height); + case "directionChange": + case "speedChange": + case "flag": + case "switchButton": + case "spring": + return te(obj.x, obj.y, obj.width, obj.height); + case "switchPlatform": { + const t = obj.height / 2, + i = -t + inset, + n = -t + obj.width - inset, + s = -obj.height / 2 + inset, + o = obj.height / 2 - inset; return ( - e.flatMap(H).forEach(({ x: e, y: s, width: o, height: r }) => { - ((t = Math.min(t, e - o / 2)), - (a = Math.max(a, e + o / 2)), - (i = Math.min(i, s - r / 2)), - (n = Math.max(n, s + r / 2))); - }), - { width: a - t, height: n - i, x: (t + a) / 2, y: (i + n) / 2 } + (ee.pos.x = obj.x - obj.width / 2 + t), + (ee.pos.y = obj.y), + (ee.points[0].x = i), + (ee.points[0].y = s), + (ee.points[1].x = n), + (ee.points[1].y = s), + (ee.points[2].x = n), + (ee.points[2].y = o), + (ee.points[3].x = i), + (ee.points[3].y = o), + ee.setAngle(B.toRad(-obj.rotation)), + ee ); - }, - newPlatform: (e) => { - var t, a, i, n, s, o, r, l; - return { - type: "platform", - array: "platforms", - x: - null !== (t = null == e ? void 0 : e.x) && void 0 !== t - ? t - : 0, - y: - null !== (a = null == e ? void 0 : e.y) && void 0 !== a - ? a - : 0, - midY: - null !== - (n = - null !== (i = null == e ? void 0 : e.midY) && void 0 !== i - ? i - : null == e - ? void 0 - : e.y) && void 0 !== n - ? n - : 0, - width: - null !== (s = null == e ? void 0 : e.width) && void 0 !== s - ? s - : 90, - height: - null !== (o = null == e ? void 0 : e.height) && void 0 !== o - ? o - : 15, - snapSize: { offsetY: 7.5 }, - canJumpThrough: true, - movement: - null !== (r = null == e ? void 0 : e.movement) && void 0 !== r - ? r - : "static", - movementTrigger: - null !== (l = null == e ? void 0 : e.movementTrigger) && - void 0 !== l - ? l - : "beat", - multiplier: e ? e.multiplier || 1 : 1, - }; - }, - newSpike: (e) => { - var t, a, i, n, s, o; - return { - type: "spike", - array: "spikes", - x: - null !== (t = null == e ? void 0 : e.x) && void 0 !== t - ? t - : 0, - y: - null !== (a = null == e ? void 0 : e.y) && void 0 !== a - ? a - : 0, - width: - null !== (i = null == e ? void 0 : e.width) && void 0 !== i - ? i - : 30, - height: - null !== (n = null == e ? void 0 : e.height) && void 0 !== n - ? n - : 30, - rotation: - null !== (s = null == e ? void 0 : e.rotation) && void 0 !== s - ? s - : 0, - skipMissiles: - null !== (o = null == e ? void 0 : e.skipMissiles) && - void 0 !== o && - o, - isFade: e ? e.isFade || false : false, - isLaser: o == null ? false : e.isLaser, - }; - }, - newBlock: (e) => { - var t, a, i, n; - return { - type: "block", - array: "blocks", - x: - null !== (t = null == e ? void 0 : e.x) && void 0 !== t - ? t - : 0, - y: - null !== (a = null == e ? void 0 : e.y) && void 0 !== a - ? a - : 0, - width: - null !== (i = null == e ? void 0 : e.width) && void 0 !== i - ? i - : 30, - height: - null !== (n = null == e ? void 0 : e.height) && void 0 !== n - ? n - : 30, - steel: e == null ? false : e.steel || false, - isVoid: e == null ? false : e.isVoid || false, - isBoss: e == null ? false : e.isBoss || false, - isGround: e == null ? false : e.isGround || false, - isFade: e ? e.isFade || false : false, - rotation: 0, - skipMissiles: false, - snapSize: null == e ? void 0 : e.snapSize, - }; - }, - newMiniBlock: (e) => { - var t, a, i, n; - return { - type: "block", - array: "blocks", - x: - null !== (t = null == e ? void 0 : e.x) && void 0 !== t - ? t - : 0, - y: - null !== (a = null == e ? void 0 : e.y) && void 0 !== a - ? a - : 0, - width: - null !== (i = null == e ? void 0 : e.width) && void 0 !== i - ? i - : 15, - height: - null !== (n = null == e ? void 0 : e.height) && void 0 !== n - ? n - : 15, - rotation: 0, - steel: e != undefined && (e?.steel || false), - isVoid: e != undefined && (e?.isVoid || false), - isBoss: e == undefined ? false : e?.isBoss || false, - isFade: e ? e.isFade || false : false, - skipMissiles: false, - snapSize: { offsetX: 7.5, offsetY: 7.5 }, - }; - }, - miniBlockWidth: 15, - newMiniSpike: (e) => { - var t, a, i, n, s, o; - return { - type: "spike", - array: "spikes", - x: - null !== (t = null == e ? void 0 : e.x) && void 0 !== t - ? t - : 0, - y: - null !== (a = null == e ? void 0 : e.y) && void 0 !== a - ? a - : 0, - width: - null !== (i = null == e ? void 0 : e.width) && void 0 !== i - ? i - : 15, - height: - null !== (n = null == e ? void 0 : e.height) && void 0 !== n - ? n - : 15, - rotation: - null !== (s = null == e ? void 0 : e.rotation) && void 0 !== s - ? s - : 0, - skipMissiles: - null !== (o = null == e ? void 0 : e.skipMissiles) && - void 0 !== o && - o, - isLaser: e == null ? false : e.isLaser, - isFade: e ? e.isFade || false : false, - snapSize: { offsetX: 7.5, offsetY: 7.5 }, - }; - }, - miniSpikeWidth: 15, - newSwitchBlock: (e) => { - var t, a, i, n; - return { - type: "block", - array: "blocks", - x: - null !== (t = null == e ? void 0 : e.x) && void 0 !== t - ? t - : 0, - y: - null !== (a = null == e ? void 0 : e.y) && void 0 !== a - ? a - : 0, - width: - null !== (i = null == e ? void 0 : e.width) && void 0 !== i - ? i - : 30, - height: - null !== (n = null == e ? void 0 : e.height) && void 0 !== n - ? n - : 30, - trigger: e == undefined ? "beat" : e?.trigger || "beat", - init: e == undefined ? "red" : e?.init || "red", - snapSize: null == e ? void 0 : e.snapSize, - rotation: 0, - skipMissiles: false, - }; - }, - newSwitchSpike: (e) => { - var t, a, i, n; - return { - type: "spike", - array: "spikes", - x: - null !== (t = null == e ? void 0 : e.x) && void 0 !== t - ? t - : 0, - y: - null !== (a = null == e ? void 0 : e.y) && void 0 !== a - ? a - : 0, - width: - null !== (i = null == e ? void 0 : e.width) && void 0 !== i - ? i - : 30, - height: - null !== (n = null == e ? void 0 : e.height) && void 0 !== n - ? n - : 30, - trigger: e == null ? "beat" : e.trigger || "beat", - init: e == null ? "red" : e?.init || "red", - snapSize: null == e ? void 0 : e.snapSize, - rotation: e?.rotation || 0, - skipMissiles: false, - }; - }, - newDirectionChange: (e) => { - var t, a, i, n, s, o; - const r = - null !== (t = null == e ? void 0 : e.direction) && void 0 !== t - ? t - : "left"; - t = undefined; - return { - type: "directionChange", - array: "directionChanges", - x: - null !== (a = null == e ? void 0 : e.x) && void 0 !== a - ? a - : 0, - y: - null !== (i = null == e ? void 0 : e.y) && void 0 !== i - ? i - : 0, - width: - null !== (n = null == e ? void 0 : e.width) && void 0 !== n - ? n - : 60, - height: - null !== (s = null == e ? void 0 : e.height) && void 0 !== s - ? s - : 90, - direction: r, - multiUse: e === undefined ? false : e.multiUse, - fixSync: e === undefined ? false : e?.fixSync, - snapSize: - null !== (o = null == e ? void 0 : e.snapSize) && void 0 !== o - ? o - : { x: G.jumpDistance, offsetX: 15 }, - }; - }, - newSpeedChange: (e) => { - var t, a, i, n, s, o; - const r = - null !== (t = null == e ? void 0 : e.direction) && void 0 !== t - ? t - : "right"; - return { - type: "speedChange", - array: "speedChanges", - x: - null !== (a = null == e ? void 0 : e.x) && void 0 !== a - ? a - : 0, - y: - null !== (i = null == e ? void 0 : e.y) && void 0 !== i - ? i - : 0, - width: - null !== (n = null == e ? void 0 : e.width) && void 0 !== n - ? n - : 60, - height: - null !== (s = null == e ? void 0 : e.height) && void 0 !== s - ? s - : 90, - direction: r, - snapSize: - null !== (o = null == e ? void 0 : e.snapSize) && void 0 !== o - ? o - : { x: G.jumpDistance / 2, offsetX: 15 }, - }; - }, - newFlag: (e) => { - var t, a, i, n, s, o, r, b; - const l = - null !== (t = null == e ? void 0 : e.role) && void 0 !== t - ? t - : "checkpoint"; - return { - type: "flag", - array: "flags", - x: - null !== (a = null == e ? void 0 : e.x) && void 0 !== a - ? a - : 0, - y: - null !== (i = null == e ? void 0 : e.y) && void 0 !== i - ? i - : 0, - width: - null !== (n = null == e ? void 0 : e.width) && void 0 !== n - ? n - : 60, - height: - null !== (s = null == e ? void 0 : e.height) && void 0 !== s - ? s - : 90, - role: l, - switchesOn: - null !== (o = null == e ? void 0 : e.switchesOn) && - void 0 !== o && - o, - retainSpeed: - null !== (b = null == e ? void 0 : e.retainSpeed) && - void 0 !== b && - b, - isFlying: e ? e.isFlying : false, - snapSize: - null !== (r = null == e ? void 0 : e.snapSize) && void 0 !== r - ? r - : { x: G.jumpDistance, offsetX: 15 }, - }; - }, - newSaw: (e) => { - var t, + } + case "saw": + let left = -(obj.width / 2) + inset, + right = obj.width / 2 - inset, + bottom = -obj.height / 2 + inset, + top = obj.height / 2 - inset; + return obj.shape == "bar" + ? ((ee.pos.x = obj.x), + (ee.pos.y = obj.y), + (ee.points[0].x = left), + (ee.points[0].y = bottom), + (ee.points[1].x = right), + (ee.points[1].y = bottom), + (ee.points[2].x = right), + (ee.points[2].y = top), + (ee.points[3].x = left), + (ee.points[3].y = top), + ee.setAngle(B.toRad(-obj.rotation)), + ee) + : Z(obj.x, obj.y, (obj.width / 2) - 0.5); + } + var i, n, s, o, r, l, c, d, u, h, p; + }, + }, + ue = M, + he = (e) => (t) => + t.x >= e.x - e.width / 2 && + t.x <= e.x + e.width / 2 && + t.y >= e.y - e.height / 2 && + t.y <= e.y + e.height / 2, + pe = (e, t, a, i, n) => { + const s = n % 360; + let o, r, l; + switch (true) { + case s <= 45: + ((o = B.toRad(s)), (r = ue * a), (l = ue * i)); + break; + case s <= 135: + ((o = B.toRad(s - 90)), (r = ue * i), (l = ue * a)); + break; + case s <= 225: + ((o = B.toRad(s - 180)), (r = ue * a), (l = ue * i)); + break; + case s <= 315: + ((o = B.toRad(s - 270)), (r = ue * i), (l = ue * a)); + break; + default: + ((o = B.toRad(s - 360)), (r = ue * a), (l = ue * i)); + } + const c = e - (Math.sin(o) * r) / 2, + d = t - (Math.cos(o) * l) / 2; + let u = 0; + for (let e = -r / 1.95; e <= r / 1.95; e++) + (ge[u] + ? ((ge[u].x = c + e * Math.cos(o)), + (ge[u].y = d - e * Math.sin(o))) + : (ge[u] = { x: c + e * Math.cos(o), y: d - e * Math.sin(o) }), + u++); + return (u < ge.length && (ge.length = u), ge); + }, + ge = [], + me = (e, t, a, i, n, s) => { + const o = n % 360; + let r, l, c, d; + switch (true) { + case o <= 45: + ((r = B.toRad(o - 90)), (l = ue * a), (c = ue * i), (d = 1)); + break; + case o <= 90: + ((r = B.toRad(o)), (l = ue * i), (c = ue * a), (d = 0)); + break; + case o <= 135: + ((r = B.toRad(o - 180)), (l = ue * i), (c = ue * a), (d = 1)); + break; + case o <= 180: + ((r = B.toRad(o - 90)), (l = ue * a), (c = ue * i), (d = 0)); + break; + case o <= 225: + ((r = B.toRad(o - 270)), (l = ue * a), (c = ue * i), (d = 1)); + break; + case o <= 270: + ((r = B.toRad(o - 180)), (l = ue * i), (c = ue * a), (d = 0)); + break; + case o <= 315: + ((r = B.toRad(o)), (l = ue * i), (c = ue * a), (d = 1)); + break; + default: + ((r = B.toRad(o - 270)), (l = ue * a), (c = ue * i), (d = 0)); + } + const u = e - (Math.sin(r) * l) / 2, + h = t - (Math.cos(r) * c) / 2; + let p = 0; + for (let e = 0; e <= c / 2; e++) { + if (1 === s || d) { + const t = u - e * Math.cos(r), + a = h + e * Math.sin(r); + (fe[p] + ? ((fe[p].x = t), (fe[p].y = a)) + : (fe[p] = { x: t, y: a }), + p++); + } + if (-1 === s || !d) { + const t = u + e * Math.cos(r), + a = h - e * Math.sin(r); + (fe[p] + ? ((fe[p].x = t), (fe[p].y = a)) + : (fe[p] = { x: t, y: a }), + p++); + } + } + return ((fe.length = p), fe); + }, + fe = [], + ye = []; + function getObjectTopY(obj, t, a) { + if ("switchPlatform" === obj.type && 0 !== obj.rotation) { + const i = obj.height / 2; + if (-90 === obj.rotation) return obj.y + obj.width - i; + if (180 === obj.rotation) return obj.y + 7.5; + if (90 === obj.rotation) return obj.y - i + 15; + const n = -B.toRad(obj.rotation), + s = obj.x - obj.width / 2 + i; + const o = B.clamp2(0, obj.width - i, Math.hypot(t - s, a - obj.y)); + return ( + obj.y + + o * Math.sin(n) + + (obj.height / (obj.rotation < -90 || obj.rotation > 0 ? -2 : 2)) * + Math.cos(n) + ); + } + return obj.y + obj.height / 2; + } + function getObjectBottomY(obj, t, a) { + if ("switchPlatform" === obj.type && 0 !== obj.rotation) { + const i = obj.height / 2; + if (-90 === obj.rotation) return obj.y - 7.5; + if (180 === obj.rotation) return obj.y - 7.5; + if (90 === obj.rotation) return obj.y - i - 15; + const n = -B.toRad(obj.rotation), + s = obj.x - obj.width / 2 + i; + const o = B.clamp2(0, obj.width - i, Math.hypot(t - s, a - obj.y)); + return ( + obj.y - + o * Math.sin(n) + + (obj.height / (obj.rotation < -90 || obj.rotation > 0 ? -2 : 2)) * + Math.cos(n) + ); + } + return obj.y - obj.height / 2; + } + const be = { + pointInBox: he, + pointInBox2: (e, t, a, i, n, s) => + n >= e - a / 2 && + n <= e + a / 2 && + s >= t - i / 2 && + s <= t + i / 2, + pointInCircle: (e) => (t) => + de.pointInCircle(e.x, e.y, e.radius, t.x, t.y), + rectTouchesRect: (e) => (t) => { + if (t.type === "saw" && t.shape === "bar") { + return be.hitObject( + e.x, + e.y, + e.width / 30, + e.height / 30, + 0, + false, + false, + )(t); + } + const a = e.x - e.width / 2, + i = t.x - t.width / 2, + n = e.x + e.width / 2, + s = t.x + t.width / 2, + o = e.y + e.height / 2, + r = t.y + t.height / 2, + l = e.y - e.height / 2, + c = t.y - t.height / 2; + return a < s && n > i && o > c && l < r; + }, + rectTouchesRect2: (e, t, a, i, n) => { + const s = e - a / 2, + o = n.x - n.width / 2, + r = e + a / 2, + l = n.x + n.width / 2, + c = t + i / 2, + d = n.y + n.height / 2, + u = t - i / 2, + h = n.y - n.height / 2; + return s < l && r > o && c > h && u < d; + }, + hitLandableObject: (...params) => { + var [e, t, a, i, n, s, o, r, l, c, gravity, ghost] = params; + const checkDist = "switchPlatform" === r.type ? 120 : 30; + if (isNaN(r.y) || r.y === Infinity) { + return null; + } + if ( + r.x > e + r.width + checkDist || + r.x < e - r.width - checkDist + ) + return null; + const pointInBoundingBox = + "switchPlatform" === r.type + ? ( + (e) => (t) => + de.pointInSomething(t.x, t.y, e) + )(de.getObjectPolygon(r, c, 0)) + : he(r), + edge = + gravity > 0 + ? getObjectTopY(r, e, t) + : getObjectBottomY(r, e, t); + if ( + a <= 0 && + (gravity > 0 + ? t - a >= edge + 7.5 * globalPlayerScale + : t - a <= edge + -7.5 * globalPlayerScale) + ) { + const bottomPlayerLine = pe(e, t, i, n, s), + l = bottomPlayerLine[Math.floor(bottomPlayerLine.length / 2)], + c = (function (e, t, a) { + ye.length = a; + for (let i = 0; i < a; i++) { + let j = i; + ye[i] + ? ((ye[i].x = e), (ye[i].y = t + j * gravity)) + : (ye[i] = { x: e, y: t + j * gravity }); + } + return ye; + })(l.x, l.y, Math.min(Math.ceil(Math.abs(a)), M)); + for (const e of c) + if (pointInBoundingBox(e)) return { type: "hitMidLine" }; + const secondBottomPlayerLine = + s % 90 == 0 ? [] : me(e, t, i, n, s, o); + for (const e of bottomPlayerLine) + if (pointInBoundingBox(e)) + return { type: "hitBottomEdges", rotatePoint: e }; + for (const e of secondBottomPlayerLine) + if (pointInBoundingBox(e)) + return { type: "hitBottomEdges", rotatePoint: e }; + } + const h = de.getObjectPolygon(r, c); + return !("canJumpThrough" in r) && + de.polygonHitSomething(l, h) && + !ghost + ? { type: "crashed" } + : null; + }, + hitObject: function (e, t, a, i, n, s, o) { + const r = de.getPlayerPoly( + e, + t, + a, + i, + n, + s, + de.pooledPlayerPoly1, + ); + return (t) => { + if (t.x > e + t.width + ue || t.x < e - t.width - ue * 2) + return false; + const a = de.getObjectPolygon(t, o); + return de.polygonHitSomething(r, a); + }; + }, + hitRectangle: function (e, t, a, i, n, s) { + const o = de.getPlayerPoly( + e, + t, + a, + i, + n, + s, + de.pooledPlayerPoly2, + ); + return (e) => { + const t = de.getRectPoly(e.x, e.y, e.width, e.height); + return de.polygonHitSomething(t, o); + }; + }, + getBottomPlayerLine: pe, + getSecondBottomPlayerLine: me, + handlePlayerHitBottomEdge: ( + e, + t, + a, + i, + n, + s, + o, + r, + l, + c, + d, + gravity, + ) => { + var u, h; + const edge = + (gravity > 0 + ? getObjectTopY(l, e, t) + : getObjectBottomY(l, e, t)) + + 15 * globalPlayerScale * gravity, + g = 1 === r ? e < l.x : e > l.x; + if ( + ((gravity > 0 ? t < edge : t > edge) && + (g || (gravity > 0 ? t - s > edge : t - s < edge))) || + o + ) + return { y: edge }; + const m = n, + f = r * gravity * (n % 90 < 45 ? -1 : 1); + let y = 45; + for ( + ; + y > 0 && + 0 !== n && + "hitBottomEdges" === + (null === + (u = be.hitLandableObject( + e, + t, + s, a, i, n, - s, - o, r, l, - shape = e?.shape || "rail", - diameter = - shape == "bar" - ? 120 - : shape == "large" - ? 90 - : shape == "small" - ? 60 - : 30, - width = diameter, - height = shape == "bar" ? 20 : diameter; - return { - type: "saw", - array: "saws", - x: - null !== (t = null == e ? void 0 : e.x) && void 0 !== t - ? t - : 0, - y: - null !== (a = null == e ? void 0 : e.y) && void 0 !== a - ? a - : 0, - midY: - null !== - (n = - null !== (i = null == e ? void 0 : e.midY) && void 0 !== i - ? i - : null == e - ? void 0 - : e.y) && void 0 !== n - ? n - : 0, - shape: shape, - width: - null !== (s = null == e ? void 0 : e.width) && void 0 !== s - ? s - : width, - height: - null !== (o = null == e ? void 0 : e.height) && void 0 !== o - ? o - : height, - movement: - null !== (r = null == e ? void 0 : e.movement) && void 0 !== r - ? r - : "upDown", - movementTrigger: - null !== (l = null == e ? void 0 : e.movementTrigger) && - void 0 !== l - ? l - : "beat", - multiplier: e == undefined ? 1 : e?.multiplier || 1, - rotation: e == null ? 0 : e.rotation || 0, - offset: e == null ? 0 : e.offset || 0, - skipMissiles: - e?.skipMissiles || false - }; - }, - newEnemy: (e) => { - var t, a, i, n, s; - const { width: o, height: r } = W(e); - return { - type: "enemy", - array: "enemies", - x: - null !== (t = null == e ? void 0 : e.x) && void 0 !== t - ? t - : 0, - y: - null !== (a = null == e ? void 0 : e.y) && void 0 !== a - ? a - : 0, - width: o, - height: r, - kind: - null !== (i = null == e ? void 0 : e.kind) && void 0 !== i - ? i - : "shooter", - giant: - null !== (n = null == e ? void 0 : e.giant) && - void 0 !== n && - n, - skipMissiles: - null !== (s = null == e ? void 0 : e.skipMissiles) && - void 0 !== s && + c, + d, + gravity, + )) || void 0 === u + ? void 0 + : u.type); + ) + ((n += f), y--); + if (0 === y || 0 === n) { + for ( + n = m, y = 15; + t < edge && + "hitBottomEdges" === + (null === + (h = be.hitLandableObject( + e, + t, s, - enemyDir: e == undefined ? -1 : e?.enemyDir, - isCompatible: e ? e.isCompatible : true, - snapSize: - "walkerHelmet" === (null == e ? void 0 : e.kind) - ? { offsetY: 7.5 } - : void 0, - }; - }, - newPowerup: (e) => { - var t, a, i, n, s, j; - const o = - null !== (t = null == e ? void 0 : e.item) && void 0 !== t - ? t - : "gun"; - return { - type: "powerup", - array: "powerups", - x: - null !== (a = null == e ? void 0 : e.x) && void 0 !== a - ? a - : 0, - y: - null !== (i = null == e ? void 0 : e.y) && void 0 !== i - ? i - : 0, - width: - null !== (n = null == e ? void 0 : e.width) && void 0 !== n - ? n - : 30, - height: - null !== (s = null == e ? void 0 : e.height) && void 0 !== s - ? s - : 30, - item: o, - compatible: e ? e.compatible : true, - override: e ? e.override : false, - }; - }, - newSwitchButton: (e) => { - var t, a, i, n, s; - return { - type: "switchButton", - array: "switchButtons", - x: - null !== (t = null == e ? void 0 : e.x) && void 0 !== t - ? t - : 0, - y: - null !== (a = null == e ? void 0 : e.y) && void 0 !== a - ? a - : 0, - width: - null !== (i = null == e ? void 0 : e.width) && void 0 !== i - ? i - : 30, - height: - null !== (n = null == e ? void 0 : e.height) && void 0 !== n - ? n - : 30, - affects: - null !== (s = null == e ? void 0 : e.affects) && void 0 !== s - ? s - : "movement", - color: e == undefined ? "flash" : e?.color || 0, - gravity: - e == undefined ? 1 : e?.gravity == null ? 1 : e?.gravity, - up: e ? e.up : false, - down: e ? e.down : false, - }; - }, - newSwitchPlatform: (e) => { - var t, a, i, n, s, o; - const r = - null !== (t = null == e ? void 0 : e.initPosition) && - void 0 !== t - ? t - : "up"; - return { - type: "switchPlatform", - array: "switchPlatforms", - x: - null !== (a = null == e ? void 0 : e.x) && void 0 !== a - ? a - : 0, - y: - null !== (i = null == e ? void 0 : e.y) && void 0 !== i - ? i - : 0, - width: - null !== (n = null == e ? void 0 : e.width) && void 0 !== n - ? n - : 120, - height: - null !== (s = null == e ? void 0 : e.height) && void 0 !== s - ? s - : 15, - snapSize: { offsetY: 7.5 }, - initPosition: r, - movementTrigger: - null !== (o = null == e ? void 0 : e.movementTrigger) && - void 0 !== o - ? o - : "switch", - rotation: "up" === r ? -90 + e.direction : 0 + e.direction, - direction: e?.direction || 0, - }; - }, - newSpring: (e) => { - var t, a, i, n, o; - return { - type: "spring", - array: "springs", - x: - null !== (t = null == e ? void 0 : e.x) && void 0 !== t - ? t - : 0, - y: - null !== (a = null == e ? void 0 : e.y) && void 0 !== a - ? a - : 0, - width: - null !== (i = null == e ? void 0 : e.width) && void 0 !== i - ? i - : 30, - height: - null !== (n = null == e ? void 0 : e.height) && void 0 !== n - ? n - : 15, - direction: - null !== (o = null == e ? void 0 : e.direction) && - void 0 !== o - ? o - : 1, - snapSize: { offsetY: 7.5 }, - }; - }, - newCollectible: (e) => { - var t, a, i, n, s, o; - return { - type: "collectible", - array: "collectibles", - x: - null !== (t = null == e ? void 0 : e.x) && void 0 !== t - ? t - : 0, - y: - null !== (a = null == e ? void 0 : e.y) && void 0 !== a - ? a - : 0, - width: - null !== (i = null == e ? void 0 : e.width) && void 0 !== i - ? i - : 30, - height: - null !== (n = null == e ? void 0 : e.height) && void 0 !== n - ? n - : 30, - form: - null !== (s = null == e ? void 0 : e.form) && void 0 !== s - ? s - : "coin", - snapSize: - null !== (o = null == e ? void 0 : e.snapSize) && void 0 !== o - ? o - : "arrow" === (null == e ? void 0 : e.form) - ? { y: M } - : void 0, - }; - }, - newPortal: (e) => { - var t, a, i, n, s, o, r; - return { - type: "portal", - array: "portals", - x: - null !== (t = null == e ? void 0 : e.x) && void 0 !== t - ? t - : 0, - y: - null !== (a = null == e ? void 0 : e.y) && void 0 !== a - ? a - : 0, - width: - null !== (i = null == e ? void 0 : e.width) && void 0 !== i - ? i - : 30, - height: - null !== (n = null == e ? void 0 : e.height) && void 0 !== n - ? n - : 90, - pairId: - null !== (s = null == e ? void 0 : e.pairId) && void 0 !== s - ? s - : 0, - pair: - null !== (o = null == e ? void 0 : e.pair) && void 0 !== o - ? o - : "a", - direction: - null !== (r = null == e ? void 0 : e.direction) && - void 0 !== r - ? r - : "left", - }; - }, - addPortalPairId: function (e, t) { - const a = t.portals.reduce((e, t) => Math.max(e, t.pairId), 0); - return Object.assign(Object.assign({}, e), { pairId: a + 1 }); - }, - newPortalPair: function (e) { - return Object.assign(Object.assign({}, e), { - pair: "a" === e.pair ? "b" : "a", - x: e.x + 2 * e.width, - }); - }, - sawMove: z, - platformMove: X, - changeEnemyKind: function (e, t) { - const { width: a, height: i } = W( - Object.assign(Object.assign({}, e), { kind: t }), - ), - n = "walkerHelmet" === t ? { offsetY: 7.5 } : void 0, - { x: s, y: o } = V(e, n); - return Object.assign(Object.assign({}, e), { - giant: !!q(t) && e.giant, - width: a, - height: i, - kind: t, - snapSize: n, + a, + i, + n, + r, + l, + c, + d, + gravity, + )) || void 0 === h + ? void 0 + : h.type); + ) + ((t += gravity), (n += 0 === n ? 0 : f), (s *= 0.9), y--); + if (0 === y) return { crashed: true, y: t }; + } + return { y: t }; + }, + getObjectTopY: getObjectTopY, + getObjectBottomY: getObjectBottomY, + hitStack: function (e, t, a, i = 30) { + return a.some((a) => + be.rectTouchesRect({ x: t, y: a.y, width: i, height: M })(e), + ); + }, + hitStackWhich: function (e, t, a, i = 30) { + return a.findIndex((a) => + be.rectTouchesRect({ x: t, y: a.y, width: i, height: M })(e), + ); + }, + objectPolyInPoint2: (e, t, a) => de.pointInSomething(t, a, e), + }, + Se = A(), + Clickable = makeCustomSprite({ + init: () => ({ isPressed: false }), + loop({ + state: e, + getInputs: t, + props: { + disabled: a, + onPress: i, + onPressOutside: n, + width: s, + height: o, + x: propX, + y: propY, + }, + getContext: r, + updateState: l, + }) { + if (a) return e; + const { isPressed: c } = e, + { addToOnPressQueue: d } = r(Se), + { + x: u, + y: h, + pressed: p, + justReleased: g, + justPressed: m, + } = t().pointer, + f = () => + be.pointInBox({ x: propX || 0, y: propY || 0, width: s, height: o })({ + x: u + (propX || 0), + y: h + (propY || 0), + }), + y = p && f(); + return ( + g && c ? d(i) : m && n && !f() ? d(n) : y && d(() => null), + y && (m || c) + ? (d(() => { + l(() => ({ isPressed: true })); + }), + e) + : { isPressed: false } + ); + }, + render: ({ + props: { sprites: e, disabled: t }, + state: { isPressed: a }, + }) => e(!t && a), + }), + _e = makeSprite({ + init: () => ({ isPressed: false }), + loop({ state: e, getInputs: t, props: a, getContext: i }) { + if (a.disabled) return; + const { addToOnPressQueue: n } = i(Se), + { x: s, y: o, - }); - }, - changeEnemyGiant: function (e, t) { - const { width: a, height: i } = W( - Object.assign(Object.assign({}, e), { giant: t }), - ), - { x: n, y: s } = V(e, e.snapSize); - return Object.assign(Object.assign({}, e), { - width: a, - height: i, - giant: t, - x: n, - y: s, - }); - }, - changeCollectibleForm: function (e, t) { - const a = "arrow" === t ? { y: M } : void 0, - { x: i, y: n } = V(e, a); - return Object.assign(Object.assign({}, e), { - form: t, - snapSize: a, - x: i, - y: n, - }); - }, - getArrowRotation: function (e) { - let t = Math.floor((e - 15) / 30) % 4; - return ( - t < 0 && (t += 4), - 0 === t || -0 === t ? 90 : 2 === t ? 180 : 3 === t ? 0 : 270 - ); - }, - getSwitchPlatformUpRectangle: function ({ + pressed: r, + justReleased: l, + justPressed: c, + } = t().pointer, + d = () => be.pointInBox2(0, 0, a.width, a.height, s, o), + u = r && d(); + (l && e.isPressed + ? n(a.onPress) + : c && a.onPressOutside && !d() + ? n(a.onPressOutside) + : u && n(() => null), + u && (c || e.isPressed) + ? n(() => { + e.isPressed = true; + }) + : (e.isPressed = false)); + }, + render: ({ props: e, state: t }) => [ + conditional( + () => t.isPressed && !e.disabled, + () => e.sprites(true), + () => e.sprites(false), + ), + ], + }), + ve = "#F9F7FE", + Te = "#FDDF40", + Re = "#06F195", + Oe = "#b0fa37", + Ce = "#00DE84", + we = "#4CF47D", + Ae = "#5143FF", + ke = "#06FFFE", + Ne = "#82FCFD", + xe = "#59C2F9", + Pe = "#A7C2F6", + Me = "#5E01FF", + Le = "#C8ADF3", + De = "#7E61F6", + Be = "#550199", + Fe = "#5710A1", + Ye = "#A93FFF", + Ue = "#2F0245", + je = "#CE92FF", + Ge = "#C464F7", + Ve = "#ED5B29", + He = "#DB4D01", + Xe = "#7b7b7b", + ze = "#c1c1c1", + We = ({ + x: e, + y: t, + rotation: a, + rad: i = 5, + opacity: n, + width: s, + height: o, + color: l, + strokeColor: c, + strokeThickness: d, + gradient: u, + }) => + r({ + color: c, + fillColor: l, + path: [ + [-s / 2, o / 2 - i], + [-s / 2, -o / 2 + i], + [-s / 2 + i, -o / 2], + [s / 2 - i, -o / 2], + [s / 2, -o / 2 + i], + [s / 2, o / 2 - i], + [s / 2 - i, o / 2], + [-s / 2 + i, o / 2], + [-s / 2, o / 2 - i], + ], + x: e, + y: t, + rotation: a, + opacity: n, + fillGradient: u, + thickness: d, + lineCap: "round", + }), + qe = ( + { + x: e, + y: t, + rotation: a, + rad: i = 5, + opacity: n, + width: s = 10, + height: o = 10, + color: r, + fillColor: l, + thickness: c, + fillGradient: d, + }, + u, + ) => + m( + { + color: r, + fillColor: l, + path: [ + [-s / 2, o / 2 - i], + [-s / 2, -o / 2 + i], + [-s / 2 + i, -o / 2], + [s / 2 - i, -o / 2], + [s / 2, -o / 2 + i], + [s / 2, o / 2 - i], + [s / 2 - i, o / 2], + [-s / 2 + i, o / 2], + [-s / 2, o / 2 - i], + ], x: e, y: t, - width: a, - height: i, - }) { - const n = i / 2; - return { - x: e - a / 2 + n, - y: t - n + a / 2, - width: i, - height: a, - }; + rotation: a, + opacity: n, + fillGradient: d, + thickness: c, + lineCap: "round", }, - getSwitchPlatformDownRectangle: function ({ - x: e, - y: t, - width: a, - height: i, - }) { - const n = i / 2; - return { - x: e - a / 2 + n, - y: t - n + a / 2 - a + i, - width: i, + (e) => { + null == u || u(e); + }, + ), + $e = makeCustomSprite({ + render({ + props: { + text: e, + width: t, + height: a, + onPress: i, + disabled: s, + colour: o = "#06F195", + }, + device: r, + }) { + const l = t / 100, + c = 8 * l, + d = c / 2, + u = 10 * l; + return [ + Clickable({ + id: "Clickable", + width: t, height: a, - }; + disabled: s, + onPress: () => { + (r.audio("audio/global/button.wav").play(0), i()); + }, + sprites: (i) => [ + We({ + width: t + c, + height: a + c, + rad: u, + rotation: 45, + color: ve, + strokeColor: Ye, + strokeThickness: 2, + }), + We({ + width: t, + height: a, + rotation: 45, + rad: u, + color: i ? ke : o, + y: d - (i ? 3 : 0), + }), + n({ + font: { size: 20 * l, style: "italic" }, + text: e, + rotation: -8, + color: i ? Ae : Be, + y: d - (i ? 3 : 0), + strokeColor: Te, + strokeThickness: 2, + }), + ], + }), + ]; + }, + }), + Je = makeSprite({ + render({ props: e, device: t }) { + const a = e.width / 100, + i = 8 * a, + n = i / 2, + s = 10 * a; + return [ + qe({ + width: e.width + i, + height: e.height + i, + rad: s, + rotation: 45, + fillColor: ve, + color: Ye, + thickness: 2, + }), + _e.Single({ + width: e.width, + height: e.height, + onPress: () => { + (t.audio("audio/global/button.wav").play(0), e.onPress()); + }, + sprites: (t) => [ + qe({ + width: e.width, + height: e.height, + rotation: 45, + rad: s, + fillColor: t ? ke : e.colour || Re, + y: n - (t ? 3 : 0), + }), + c({ + font: { size: 20 * a, style: "italic" }, + text: e.text, + rotation: -8, + strokeColor: Te, + strokeThickness: 2, + color: t ? Ae : Be, + y: n - (t ? 3 : 0), + }), + ], + }), + ]; + }, + }), + Ke = makeCustomSprite({ + loop({ props: e, getInputs: t }) { + const a = t(); + "edit" === e.type + ? a.keysJustPressed.Escape && e.onPress() + : a.keysJustPressed.Enter && e.onPress(); + }, + render: ({ props: e }) => [ + $e({ + id: "PlayEditButton", + width: 50, + height: 50, + disabled: e.disabled, + onPress: e.onPress, + text: "play" === e.type ? localize("PLAY") : localize("EDIT"), + }), + ], + }), + Qe = { x: -120, y: -60 }, + Ze = B.clamp([0.7, 1]); + var globalPlayerScale = 1; + const et = { + initialPosition: Qe, + setScaleInc: (e, t, a) => { + var { + playerRot: rot, + playerGradY: gy, + playerScaleX: sx, + playerScaleY: sy, + playerScale: ps, + isGravity, + playerPowerups, + } = e; + gy = + isGravity || playerPowerups.some((e) => e.item === "spaceship") + ? 0 + : gy; + globalPlayerScale = ps; + sx = sx / ps; + sy = sy / ps; + const r = (rot > 45 && rot < 135) || (rot > 225 && rot < 315), + l = gy < 0, + c = (!r && l) || (r && !l), + d = !c, + u = B.numberMap2(a, 0, 0.7, 1, Math.abs(gy)), + h = Ze(u), + p = ((c ? h : 1) - sx) / 6, + g = ((d ? h : 1) - sy) / 6; + ((e.playerScaleX += p * t), (e.playerScaleY += g * t)); + }, + landTimerLimit: 20, + closestFlatAngle: (e) => e + 45 - ((e + 45) % 90), + }; + function tt(array, thing, index) { + return [...array.slice(0, index), thing, ...array.slice(index + 1)]; + } + function at(e, t) { + return [...e.slice(0, t), ...e.slice(t + 1)]; + } + function it(e, t, a) { + return [...e.slice(0, a), t, ...e.slice(a)]; + } + function nt(e) { + return null != e; + } + function st(e, t, a) { + const i = t - e; + return Math.round(i * a() + e); + } + function ot(e) { + return e() < 0.5 ? -1 : 1; + } + function rt(e) { + return [...new Set(e)]; + } + function lt(e, t) { + let a = 0, + i = 0; + for (; i < e.length;) (t(e[i], a) ? (i += 1) : e.splice(i, 1), a++); + return e; + } + const ct = (e) => ({ + form: (null == e ? void 0 : e.form) || "default", + bottomColour: (null == e ? void 0 : e.bottomColour) || "#FFBD00", + topColour: (null == e ? void 0 : e.topColour) || "#FFD604", + }), + dt = { name: "Default", fileName: "default", size: 31, trail: ct() }, + ut = { + name: "Pixel", + fileName: "pixel", + size: 30, + trail: ct({ form: "pixel" }), + }, + ht = { name: "Glow", fileName: "glow", size: 41, trail: ct() }, + pt = { name: "World 4", fileName: "world4", size: 31, trail: ct() }, + gt = { + name: "Alien", + fileName: "alien", + size: 45, + trail: ct({ bottomColour: "#21D800", topColour: "#8AFF00" }), + }, + mt = { + name: "Worm", + fileName: "worm", + size: 45, + trail: ct({ topColour: "#79DB00", bottomColour: "#4DC801" }), + }, + ft = { + name: "Bull", + fileName: "bull", + size: 45, + trail: ct({ bottomColour: "#EB4422", topColour: "#FF7745" }), + }, + yt = { + name: "Burger", + fileName: "burger", + size: 45, + trail: ct({ topColour: "#FFAA02", bottomColour: "#E56B04" }), + }, + Et = { name: "Chicken", fileName: "chicken", size: 45, trail: ct() }, + bt = { + name: "Mr Cool", + fileName: "mrcool", + size: 45, + trail: ct({ topColour: "#FECBAB", bottomColour: "#F5AC94" }), + }, + St = { + name: "Dino", + fileName: "dino", + size: 45, + trail: ct({ topColour: "#00F4DE", bottomColour: "#04C4EA" }), + }, + It = { name: "Dog", fileName: "dog", size: 45, trail: ct() }, + _t = { + name: "Knight", + fileName: "knight", + size: 45, + trail: ct({ topColour: "#C2EDF8", bottomColour: "#A5CBFE" }), + }, + vt = { + name: "Machine", + fileName: "machine", + size: 45, + trail: ct({ topColour: "#01DDFF", bottomColour: "#00B6CE" }), + }, + Tt = { + name: "Monkey", + fileName: "monkey", + size: 45, + trail: ct({ topColour: "#FF9900", bottomColour: "#FE5200" }), + }, + Rt = { + name: "Mummy", + fileName: "mummy", + size: 45, + trail: ct({ bottomColour: "#F5BAA4", topColour: "#FEF3C8" }), + }, + Ot = { + name: "Mushroom", + fileName: "mushroom", + size: 42, + trail: ct({ topColour: "#58AA1B", bottomColour: "#328F0D" }), + }, + Ct = { + name: "Parrot", + fileName: "parrot", + size: 42, + trail: ct({ topColour: "#AECEEA", bottomColour: "#6D85D6" }), + }, + wt = { + name: "Green Bot", + fileName: "greenbot", + size: 45, + trail: ct({ topColour: "#00BD68", bottomColour: "#049F72" }), + }, + At = { + name: "Samurai", + fileName: "samurai", + size: 45, + trail: ct({ topColour: "#00A191", bottomColour: "#018188" }), + }, + kt = { + name: "Superhero", + fileName: "superhero", + size: 45, + trail: ct({ topColour: "#C424ED", bottomColour: "#7303A3" }), + }, + Nt = { + name: "Yak", + fileName: "yak", + size: 45, + trail: ct({ topColour: "#00F880", bottomColour: "#00DFFF" }), + }, + xt = { + name: "Spaceship", + fileName: "spaceship", + size: 50, + trail: ct(), + }, + Pt = { + name: "Pixel Cheese", + fileName: "pixelcheese", + size: 67, + trail: ct({ form: "pixel" }), + }, + Mt = { + name: "Pixel Robot", + fileName: "pixelrobot", + size: 67, + trail: ct({ form: "pixel" }), + }, + Lt = { + name: "Pixel Skull", + fileName: "pixelskull", + size: 67, + trail: ct({ form: "pixel" }), + }, + Dt = { + name: "Pixel Crown", + fileName: "pixelcrown", + size: 67, + trail: ct({ form: "pixel" }), + }, + Bt = { name: "Skater", fileName: "skater", size: 47, trail: ct() }, + Ft = { + name: "Fighter", + fileName: "fighter", + size: 67, + trail: ct({ form: "pixel" }), + }, + Yt = { name: "Dreamy", fileName: "dreamy", size: 31, trail: ct() }, + Ut = { + name: "Boss 1", + fileName: "boss1", + size: 40, + trail: ct({ topColour: "#A31D03", bottomColour: "#4C3923" }), + }, + jt = { + name: "Boss 2", + fileName: "boss2", + size: 48, + trail: ct({ + form: "pixel", + topColour: "#FF1E2B", + bottomColour: "#A00E2A", + }), + }, + Gt = { + name: "Boss 3", + fileName: "boss3", + size: 50, + trail: ct({ topColour: "#C60A0B", bottomColour: "#C8443F" }), + }, + Vt = { + name: "Boss 4", + fileName: "boss4", + size: 68, + trail: ct({ topColour: "#E51C04", bottomColour: "#820F1B" }), + }, + Ht = { + name: "Tester", + fileName: "tester", + size: 66, + trail: ct({ topColour: "#FFF142", bottomColour: "#C57700" }), + hidden: true, + }, + Xt = { + name: "Dev", + fileName: "dev", + size: 47, + trail: ct(), + hidden: true, + }, + zt = { + default: dt, + world1: { + name: "First World", + fileName: "world1", + size: 31, + trail: ct(), + }, + pixel: ut, + glow: ht, + world4: pt, + spaceship: xt, + dino: St, + chicken: Et, + yak: Nt, + bull: ft, + monkey: Tt, + samurai: At, + boss1: Ut, + pixelCheese: Pt, + pixelSkull: Lt, + pixelRobot: Mt, + pixelCrown: Dt, + pixelSpaceship: { + name: "Pixel Spaceship", + fileName: "pixelspaceship", + size: 50, + trail: ct({ form: "pixel" }), + }, + boss2: jt, + alien: gt, + machine: vt, + mummy: Rt, + boss3: Gt, + worm: mt, + mushroom: Ot, + burger: yt, + dog: It, + parrot: Ct, + greenBot: wt, + coolGuy: bt, + superhero: kt, + boss4: Vt, + knight: _t, + skater: Bt, + fighter: Ft, + space: { + name: "Astronaut", + fileName: "space", + size: 50, + trail: ct(), + }, + layla: { + name: "Layla", + fileName: "layla", + size: 50, + trail: ct({ topColour: "#f71fc2", bottomColour: "#DA18A9" }), + }, + classic: { + name: "Classic", + fileName: "classic", + size: 30, + trail: ct({ topColour: "#d54809", bottomColour: "#d54809" }), + }, + dreamy: Yt, + tester: Ht, + arrows: { + name: "Outline", + fileName: "arrows", + size: 30, + trail: ct(), + }, + headphone: { + name: "Headphones", + fileName: "headphone", + size: 47, + trail: ct(), + }, + pumpkin: { + name: "Pumpkin", + fileName: "pumpkin", + size: 45, + trail: ct({ topColour: "#e18c0d", bottomColour: "#e18c0d" }), + }, + calavera: { + name: "Calavera", + fileName: "calavera", + size: 45, + trail: ct({ topColour: "#f7ded4", bottomColour: "#f7ded4" }), + }, + mikhael: { + name: "Mikhael", + fileName: "mikhael", + size: 31, + author: "mikhael", + trail: ct({ topColour: "#78baba", bottomColour: "#78baba" }), + }, + benjamin: { + name: "Benja", + fileName: "benjamin", + size: 30, + author: "GatoNegro", + trail: ct({ topColour: "#9f1960", bottomColour: "#691d96" }), + + }, + gd: { + name: "Geometry Dash", + fileName: "gd", + size: 31, + author: "KDSealock", + trail: ct({ topColour: "#7dff00", bottomColour: "#7dff00" }) + }, + blank: { + name: "Blank", + fileName: "blank", + size: 47, + trail: ct(), + hidden: true, + }, + dev: Xt, + }, + Wt = { + skins: zt, + getSkin: (e) => + zt[e || "default"] || + Object.values(zt).find((t) => t.fileName === e) || + Wt.default, + default: zt.default, + }, + qt = { + id: "world2", + name: "World 2", + colour: "#5A20BE", + player: bgOnly ? "blank" : Wt.skins.pixel, + background: "world2", + objects: { + block: bgOnly ? "blank" : "world2", + spike: bgOnly ? "blank" : "world2", + platform: "world2", + dirChange: "world2", + flag: "world2", + saw: "world2", + bottom: "world2", + switch: "world2", + speedChange: "world2", + }, + isBonusTheme: false, + }, + $t = Object.assign(Object.assign({}, qt), { + id: "world2Red", + name: "World 2 Red", + colour: "#952730", + background: "world2Red", + }), + Jt = { + id: "world1", + name: "World 1", + colour: "#050229", + player: bgOnly ? Wt.skins.blank : Wt.skins.default, + background: "world1", + objects: { + block: bgOnly ? "blank" : "world1", + spike: bgOnly ? "blank" : "world1", + platform: "world1", + dirChange: "world1", + flag: "world1", + saw: "world1", + bottom: "world1", + switch: "world3", + speedChange: "speed", + }, + isBonusTheme: false, + }, + Kt = Object.assign(Object.assign({}, Jt), { + id: "red", + name: "World 1 Red", + colour: "#5F1A09", + background: "red", + }), + Qt = Object.assign(Object.assign({}, Jt), { + id: "world1Boss", + name: "World 1 Boss", + colour: "#250B05", + background: "world1Boss", + objects: Object.assign(Object.assign({}, Jt.objects), { + block: "world1Boss", + }), + }), + Zt = { + id: "world3", + name: "World 3", + colour: "#210086", + background: "world3", + player: bgOnly ? Wt.skins.blank : Wt.skins.glow, + objects: { + block: bgOnly ? "blank" : "world3", + spike: bgOnly ? "blank" : "world3", + platform: "world1", + dirChange: "world1", + flag: "world1", + saw: "world1", + bottom: "world3", + switch: "world3", + speedChange: "speed", + }, + isBonusTheme: false, + }, + ea = Object.assign(Object.assign({}, Zt), { + id: "world3Red", + name: "World 3 Red", + colour: "#510602", + background: "world3Red", + }), + ta = Object.assign(Object.assign({}, Zt), { + id: "synthwave", + name: "Synthwave", + colour: "#721A59", + background: "synthwave", + }), + aa = { + id: "world4", + name: "World 4", + colour: "#772582", + background: "world4", + player: Wt.skins.world4, + objects: { + block: "world4", + spike: "world4", + platform: "world1", + dirChange: "world1", + flag: "world1", + saw: "world1", + bottom: "world4", + switch: "world3", + speedChange: "speed", + }, + isBonusTheme: false, + }, + ia = Object.assign(Object.assign({}, aa), { + id: "world4Boss", + name: "World 4 Boss", + colour: "#6d2056", + background: "world4Boss", + }), + na = Object.assign(Object.assign({}, aa), { + id: "world4Red", + name: "World 4 Red", + colour: "#5b0211", + background: "world4Red", + }), + sa = { + id: "skater", + name: "Skater", + colour: "#E2A959", + background: "skater", + player: Wt.skins.skater, + objects: { + block: "skater", + spike: "skater", + platform: "world1", + dirChange: "world1", + flag: "world1", + saw: "skater", + bottom: "world1", + switch: "world3", + speedChange: "speed", + }, + isBonusTheme: true, + }, + oa = { + id: "speed", + name: "Moon", + colour: "#1B222D", + background: "speed", + player: bgOnly ? Wt.skins.blank : Wt.skins.space, + objects: { + block: bgOnly ? "blank" : "world1", + spike: bgOnly ? "blank" : "world3", + platform: "world1", + dirChange: "world1", + flag: "world1", + saw: "world1", + bottom: "world3", + switch: "world3", + speedChange: "speed", + }, + isBonusTheme: true, + }, + ra = { + id: "dreamy", + name: "Dreamy", + colour: "#91099D", + background: "dreamy", + player: Wt.skins.dreamy, + objects: { + block: "world1", + spike: "dreamy", + platform: "world1", + dirChange: "world1", + flag: "world1", + saw: "world1", + bottom: "world1", + switch: "world3", + speedChange: "speed", + }, + isBonusTheme: true, + }, + la = Object.assign(Object.assign({}, qt), { + id: "fighter", + name: "Fighter", + colour: "#0a0353", + background: "fighter", + player: Wt.skins.fighter, + isBonusTheme: true, + }), + ca = { + skater: sa, + arrows: { + id: "arrows", + name: "Arrows", + colour: "#0F35A1", + background: "arrows", + player: bgOnly ? Wt.skins.blank : Wt.skins.arrows, + objects: { + block: bgOnly ? "blank" : "world1", + spike: bgOnly ? "blank" : "world1", + platform: "world1", + dirChange: "world1", + flag: "world1", + saw: "world1", + bottom: "world3", + switch: "world3", + speedChange: "speed", }, - maxJetpackFuel: 60, - skateboardHeight: 7, - explosionTime: 90, - punchWidth: 90, - drillWidth: 90, + isBonusTheme: true, }, - J = new F.Vector(), - K = (e, t) => ((J.x = e), (J.y = t), J), - Q = new F.Circle(), - Z = (e, t, a) => ((Q.pos.x = e), (Q.pos.y = t), (Q.r = a), Q), - ee = new F.Polygon(new F.Vector(), [ - new F.Vector(), - new F.Vector(1), - new F.Vector(2), - new F.Vector(3), - ]), - te = (e, t, a, i) => ( - (ee.pos.x = e - a / 2), - (ee.pos.y = t - i / 2), - (ee.points[0].x = 0), - (ee.points[0].y = 0), - (ee.points[1].x = a), - (ee.points[1].y = 0), - (ee.points[2].x = a), - (ee.points[2].y = i), - (ee.points[3].x = 0), - (ee.points[3].y = i), - ee.setAngle(0), - ee - ), - ae = new F.Polygon(new F.Vector(), [ - new F.Vector(), - new F.Vector(1), - new F.Vector(2), - new F.Vector(3), - ]), - ie = new F.Polygon(new F.Vector(), [ - new F.Vector(), - new F.Vector(1), - new F.Vector(2), - new F.Vector(0, 3), - ]), - ne = new F.Polygon(new F.Vector(), [ - new F.Vector(), - new F.Vector(1), - new F.Vector(2), - new F.Vector(0, 3), - ]), - se = new F.Polygon(new F.Vector(), [ - new F.Vector(), - new F.Vector(1), - new F.Vector(2), - new F.Vector(0, 3), - ]), - oe = new F.Polygon(new F.Vector(), [ - new F.Vector(), - new F.Vector(1), - new F.Vector(2), - ]), - re = (e, t, a, i, n, s, o, r) => ( - (oe.pos.x = e), - (oe.pos.y = t), - (oe.points[0].x = a), - (oe.points[0].y = i), - (oe.points[1].x = n), - (oe.points[1].y = s), - (oe.points[2].x = o), - (oe.points[2].y = r), - oe.setPoints(oe.points), - oe - ), - le = new F.Polygon(new F.Vector(), [ - new F.Vector(), - new F.Vector(1), - new F.Vector(2), - new F.Vector(3), - new F.Vector(4), - ]); - function laserHitbox(obj, inset) { - let w2 = obj.width / 2, - h4 = obj.height / 4; - var hit = new F.Polygon(new F.Vector(), [ - new F.Vector(), - new F.Vector(1), - new F.Vector(2), - new F.Vector(3), - new F.Vector(4), - new F.Vector(5), - ]); - switch ( - obj.rotation % 90 // just in case - ) { - case 0: - // why did i do this - return ( - (hit.pos.x = obj.x), - (hit.pos.y = obj.y), - (hit.points[0].x = -w2 + inset), - (hit.points[0].y = 0), - (hit.points[1].x = -w2 + h4 + inset), - (hit.points[1].y = h4), - (hit.points[2].x = w2 - h4 - inset), - (hit.points[2].y = h4), - (hit.points[3].x = w2 - inset), - (hit.points[3].y = 0), - (hit.points[4].x = w2 - h4 - inset), - (hit.points[4].y = -h4), - (hit.points[5].x = -w2 + h4 + inset), - (hit.points[5].y = -h4), - hit.setPoints(hit.points), - hit - ); - case 90: - return ( - (hit.pos.x = obj.x), - (hit.pos.y = obj.y), - (hit.points[0].x = 0), - (hit.points[0].y = -w2 + inset), - (hit.points[1].x = h4), - (hit.points[1].y = -w2 + h4 + inset), - (hit.points[2].x = h4), - (hit.points[2].y = w2 - h4 - inset), - (hit.points[3].x = 0), - (hit.points[3].y = w2 - inset), - (hit.points[4].x = -h4), - (hit.points[4].y = w2 - h4 - inset), - (hit.points[5].x = -h4), - (hit.points[5].y = -w2 + h4 + inset), - hit.setPoints(hit.points), - hit - ); - } - } - function ce(e, t) { - switch (e.rotation || 0) { - case 0: - return re( - e.x, - e.y, - -e.width / 2, - -e.height / 2 + 1, - e.width / 2, - -e.height / 2 + 1, - 0, - e.height / 2 - t, - ); - case 180: - return re( - e.x, - e.y, - -e.width / 2, - e.height / 2 - 1, - e.width / 2, - e.height / 2 - 1, - 0, - -e.height / 2 + t, - ); - case 90: - return re( - e.x, - e.y, - -e.width / 2, - -e.height / 2 + t, - -e.width / 2, - e.height / 2 - t, - e.width / 2 - 1, - 0, - ); - case 270: - return re( - e.x, - e.y, - e.width / 2, - -e.height / 2 + t, - e.width / 2, - e.height / 2 - t, - -e.width / 2 + 1, - 0, - ); - } - } - const de = { - pointInCircle: (e, t, a, i, n) => - Y().pointInCircle(K(i, n), Z(e, t, a)), - pointInSomething: (e, t, a) => - "r" in a - ? Y().pointInCircle(K(e, t), a) - : Y().pointInPolygon(K(e, t), a), - polygonHitSomething: function (e, t) { - try { - return "r" in t - ? Y().testPolygonCircle(e, t) - : Y().testPolygonPolygon(e, t); - } catch (e) { - console.error(e); - return () => false; - } + /*skaterArrows: { + id: "skaterArrows", + name: "Skater + Arrows", + colour: "#0F35A1", + background: "arrows", + player: Wt.skins.arrows, + objects: { + block: "skater", + spike: "skater", + platform: "world1", + dirChange: "world1", + flag: "world1", + saw: "world1", + bottom: "world3", + switch: "world3", + speedChange: "speed", }, - getPlayerPoly: ( - playerX, - playerY, - scaleX, - scaleY, - n, - skating, - o, - ) => { - const r = scaleY * (skating ? M + $.skateboardHeight : M), - l = scaleX * M; - return ( - (o.pos.x = playerX), - (o.pos.y = playerY), - (o.points[1].x = l), - (o.points[2].x = l), - (o.points[2].y = r), - (o.points[3].y = r), - (o.offset.x = -15 * scaleX), - (o.offset.y = -15 * scaleY), - o.setAngle(B.toRad(-n)), - o - ); + isBonusTheme: true, + },*/ + fighter: la, + dreamy: ra, + speed: oa, + classic: { + id: "classic", + name: "Classic", + colour: "#00c0c0", + player: Wt.skins.classic, + background: "classic", + objects: { + block: "classic", + spike: "classic", + platform: "classic", + dirChange: "world2", + flag: "world2", + saw: "classic", + bottom: "classic", + switch: "world2", + speedChange: "speed", }, - pooledPlayerPoly1: ie, - pooledPlayerPoly2: ne, - pooledPlayerPoly3: se, - getRectPoly: te, - getDiamondPoly: (e, t, a, i) => ( - (ae.pos.x = e), - (ae.pos.y = t), - (ae.points[0].x = -a / 2), - (ae.points[0].y = 0), - (ae.points[1].x = 0), - (ae.points[1].y = i / 2), - (ae.points[2].x = a / 2), - (ae.points[2].y = 0), - (ae.points[3].x = 0), - (ae.points[3].y = -i / 2), - ae.setAngle(0), - ae - ), - getObjectPolygon: (obj, switchBlockSpike, inset = 3) => { - switch (obj.type) { - case "spike": - return switchBlockSpike - ? te( - obj.x, - obj.y, - obj.width - 2 * inset, - obj.height - 2 * inset, - ) - : obj.isLaser - ? laserHitbox(obj, inset) - : ce(obj, inset); - case "powerup": - return re( - obj.x, - obj.y, - -obj.width / 2 + 1, - -obj.height / 2 + 1, - obj.width / 2 - 1, - -obj.height / 2 + 1, - 0, - obj.height / 2 - 1, - ); - case "collectible": { - const t = 20, - a = 20; - return te(obj.x, obj.y, t, a); - } - case "block": - return switchBlockSpike - ? obj.isLaser - ? laserHitbox(obj, inset) - : ce(obj, inset) - : te( - obj.x, - obj.y, - obj.width - 2 * inset, - obj.height - 2 * inset, - ); - case "platform": - return te( - obj.x, - obj.y, - obj.width - 2 * inset, - obj.height - 2 * inset, - ); - case "portal": - return "up" === obj.direction || "down" === obj.direction - ? te(obj.x, obj.y, obj.height, obj.width) - : te(obj.x, obj.y, obj.width, obj.height); - case "enemy": - return "walkerHelmet" === obj.kind - ? ((r = obj.width / 2), - (l = -obj.height / 2), - (c = obj.width / 2), - (d = -obj.height / 2 + M), - 0, - (u = obj.height / 2 - 1), - (h = -obj.width / 2), - (p = -obj.height / 2 + M), - (le.pos.x = obj.x), - (le.pos.y = obj.y), - (le.points[0].x = -obj.width / 2), - (le.points[0].y = -obj.height / 2), - (le.points[1].x = r), - (le.points[1].y = l), - (le.points[2].x = c), - (le.points[2].y = d), - (le.points[3].x = 0), - (le.points[3].y = u), - (le.points[4].x = h), - (le.points[4].y = p), - le.setPoints(le.points), - le) - : "minion" === obj.kind - ? // width: 15, height: 20 - te(obj.x, obj.y, 15, 20 - 2 * inset) - : "fireball" === obj.kind - ? Z(obj.x, obj.y, 5) - : "shooter" !== obj.kind - ? te(obj.x, obj.y, obj.width, obj.height - 2 * inset) - : te(obj.x, obj.y, obj.width, obj.height); - case "directionChange": - case "speedChange": - case "flag": - case "switchButton": - case "spring": - return te(obj.x, obj.y, obj.width, obj.height); - case "switchPlatform": { - const t = obj.height / 2, - i = -t + inset, - n = -t + obj.width - inset, - s = -obj.height / 2 + inset, - o = obj.height / 2 - inset; - return ( - (ee.pos.x = obj.x - obj.width / 2 + t), - (ee.pos.y = obj.y), - (ee.points[0].x = i), - (ee.points[0].y = s), - (ee.points[1].x = n), - (ee.points[1].y = s), - (ee.points[2].x = n), - (ee.points[2].y = o), - (ee.points[3].x = i), - (ee.points[3].y = o), - ee.setAngle(B.toRad(-obj.rotation)), - ee - ); - } - case "saw": - let left = -(obj.width / 2) + inset, - right = obj.width / 2 - inset, - bottom = -obj.height / 2 + inset, - top = obj.height / 2 - inset; - return obj.shape == "bar" - ? ((ee.pos.x = obj.x), - (ee.pos.y = obj.y), - (ee.points[0].x = left), - (ee.points[0].y = bottom), - (ee.points[1].x = right), - (ee.points[1].y = bottom), - (ee.points[2].x = right), - (ee.points[2].y = top), - (ee.points[3].x = left), - (ee.points[3].y = top), - ee.setAngle(B.toRad(-obj.rotation)), - ee) - : Z(obj.x, obj.y, (obj.width / 2) - 0.5); - } - var i, n, s, o, r, l, c, d, u, h, p; + isBonusTheme: true, + }, + infinite: { + id: "infinite", + name: "Infinite", + colour: "#89dde1", + player: Wt.skins.headphone, + background: "infinite", + objects: { + block: "infinite", + spike: "infinite", + platform: "infinite", + dirChange: "world1", + flag: "world1", + saw: "infinite", + bottom: "world3", + switch: "infinite", + speedChange: "speed", }, + isBonusTheme: true, }, - ue = M, - he = (e) => (t) => - t.x >= e.x - e.width / 2 && - t.x <= e.x + e.width / 2 && - t.y >= e.y - e.height / 2 && - t.y <= e.y + e.height / 2, - pe = (e, t, a, i, n) => { - const s = n % 360; - let o, r, l; - switch (true) { - case s <= 45: - ((o = B.toRad(s)), (r = ue * a), (l = ue * i)); - break; - case s <= 135: - ((o = B.toRad(s - 90)), (r = ue * i), (l = ue * a)); - break; - case s <= 225: - ((o = B.toRad(s - 180)), (r = ue * a), (l = ue * i)); - break; - case s <= 315: - ((o = B.toRad(s - 270)), (r = ue * i), (l = ue * a)); - break; - default: - ((o = B.toRad(s - 360)), (r = ue * a), (l = ue * i)); + synthwave: ta, + world1: Jt, + red: Kt, + world1Boss: Qt, + world2: qt, + world2Red: $t, + world3: Zt, + world3Red: ea, + virtual: Object.assign(Object.assign({}, Zt), { id: "virtual", name: "Virtual", player: Wt.skins.layla, hidden: true }), + world4: aa, + world4Boss: ia, + world4Red: na, + }; + const da = 660; + function willApplyMovement(x, y, playerX, playerY, fallTypes) { + y = getBlockFallY(x, y, playerX, fallTypes); + return ( + x < playerX + da && + x > playerX - da && + y < playerY + 450 + $.platformMove && + y > playerY - 450 - $.platformMove + ); + } + function ha(e, t) { + return e.x < t + da && e.x > t - da; + } + function pa( + obj, + updated, + enemies, + i, + playerX, + playerY, + frame, + maxBeat, + switchTrig, + jump, + doNotApply, + fallTypes, + ) { + switch (obj.type) { + case "spike": + case "block": { + var trig = obj.trigger == "jump" ? jump : switchTrig / 90; + if (!("midY" in obj)) { + obj.midY = obj.y; } - const c = e - (Math.sin(o) * r) / 2, - d = t - (Math.cos(o) * l) / 2; - let u = 0; - for (let e = -r / 1.95; e <= r / 1.95; e++) - (ge[u] - ? ((ge[u].x = c + e * Math.cos(o)), - (ge[u].y = d - e * Math.sin(o))) - : (ge[u] = { x: c + e * Math.cos(o), y: d - e * Math.sin(o) }), - u++); - return (u < ge.length && (ge.length = u), ge); - }, - ge = [], - me = (e, t, a, i, n, s) => { - const o = n % 360; - let r, l, c, d; - switch (true) { - case o <= 45: - ((r = B.toRad(o - 90)), (l = ue * a), (c = ue * i), (d = 1)); - break; - case o <= 90: - ((r = B.toRad(o)), (l = ue * i), (c = ue * a), (d = 0)); - break; - case o <= 135: - ((r = B.toRad(o - 180)), (l = ue * i), (c = ue * a), (d = 1)); - break; - case o <= 180: - ((r = B.toRad(o - 90)), (l = ue * a), (c = ue * i), (d = 0)); - break; - case o <= 225: - ((r = B.toRad(o - 270)), (l = ue * a), (c = ue * i), (d = 1)); - break; - case o <= 270: - ((r = B.toRad(o - 180)), (l = ue * i), (c = ue * a), (d = 0)); - break; - case o <= 315: - ((r = B.toRad(o)), (l = ue * i), (c = ue * a), (d = 1)); - break; - default: - ((r = B.toRad(o - 270)), (l = ue * a), (c = ue * i), (d = 0)); + if (!("trueY" in obj)) { + obj.trueY = obj.y; } - const u = e - (Math.sin(r) * l) / 2, - h = t - (Math.cos(r) * c) / 2; - let p = 0; - for (let e = 0; e <= c / 2; e++) { - if (1 === s || d) { - const t = u - e * Math.cos(r), - a = h + e * Math.sin(r); - (fe[p] - ? ((fe[p].x = t), (fe[p].y = a)) - : (fe[p] = { x: t, y: a }), - p++); - } - if (-1 === s || !d) { - const t = u + e * Math.cos(r), - a = h - e * Math.sin(r); - (fe[p] - ? ((fe[p].x = t), (fe[p].y = a)) - : (fe[p] = { x: t, y: a }), - p++); + if (obj.init && !("inSwitch" in obj)) { + obj.inSwitch = false; + } + var trueY = obj.trueY, + toggleOn = (on) => { + var stateOn = obj.init == "red" ? obj.midY : Infinity; + var stateOff = obj.init == "red" ? Infinity : obj.midY; + if (on) { + trueY = stateOn; + } else { + trueY = stateOff; + } + }; + if (obj.init) { + if (obj.trigger == "beat") { + toggleOn((frame / maxBeat) % 2 < 1); + } else { + if (obj?.pastTrigger == trig) { + obj.inSwitch = false; + if (trig == 0) { + trueY = obj.init == "blue" ? Infinity : obj.midY; + } else { + trueY = obj.init == "blue" ? obj.midY : Infinity; + } + } else { + if (obj.inSwitch == false) { + trueY = trueY === Infinity ? obj.midY : Infinity; + obj.inSwitch = true; + } + } } + //i = e.init == "red" ? i : (i == Infinity ? e.midY : Infinity) } - return ((fe.length = p), fe); - }, - fe = [], - ye = []; - function getObjectTopY(obj, t, a) { - if ("switchPlatform" === obj.type && 0 !== obj.rotation) { - const i = obj.height / 2; - if (-90 === obj.rotation) return obj.y + obj.width - i; - if (180 === obj.rotation) return obj.y + 7.5; - if (90 === obj.rotation) return obj.y - i + 15; - const n = -B.toRad(obj.rotation), - s = obj.x - obj.width / 2 + i; - const o = B.clamp2(0, obj.width - i, Math.hypot(t - s, a - obj.y)); - return ( - obj.y + - o * Math.sin(n) + - (obj.height / (obj.rotation < -90 || obj.rotation > 0 ? -2 : 2)) * - Math.cos(n) - ); + if (obj?.pastTrigger != trig) { + obj.pastTrigger = trig; + } + obj.trueY = trueY; + return doNotApply && + !willApplyMovement(obj.x, obj.midY, playerX, playerY, fallTypes) + ? null + : ["block", "spike"].includes( + null == updated ? void 0 : updated.type, + ) + ? ((updated.x = obj.x), + (updated.y = trueY), + (updated.midY = obj.midY), + (updated.width = obj.width), + (updated.height = obj.height), + (updated.movement = obj.movement), + (updated.trigger = obj.trigger), + (updated.steel = obj.steel), + (updated.isVoid = obj.isVoid), + (updated.isBoss = obj.isBoss), + (updated.trigger = obj.trigger), + (updated.init = obj.init), + (updated.pastTrigger = obj.pastTrigger), + (updated.rotation = obj.rotation), + (updated.skipMissiles = obj.skipMissiles), + (updated.isLaser = obj.isLaser), + (updated.isFade = obj.isFade), + updated) + : Object.assign(Object.assign({}, obj), { y: trueY }); + } + case "saw": { + const a = obj; + a.rotation = (a.x - playerX) / 2 + a.offset; + const i = + "static" === a.movement + ? a.y + : "falling" === a.movement + ? a.y - (playerX - a.x) * (a?.multiplier || 1) + : "beat" === a.movementTrigger + ? _a(a.midY, a.movement, $.sawMove, frame, maxBeat) + : "jump" === a.movementTrigger + ? Ia(a.midY, a.movement, $.sawMove, jump) + : Ia(a.midY, a.movement, $.sawMove, switchTrig / 90); + return doNotApply && + !willApplyMovement(a.x, i, playerX, playerY, fallTypes) + ? null + : "saw" === (null == updated ? void 0 : updated.type) + ? ((updated.x = a.x), + (updated.y = i), + (updated.midY = a.midY), + (updated.width = a.width), + (updated.height = a.height), + (updated.movement = a.movement), + (updated.movementTrigger = a.movementTrigger), + (updated.rotation = a.rotation), + (updated.shape = a.shape), + (updated.multiplier = a.multiplier), + (updated.offset = a.offset), + updated) + : Object.assign(Object.assign({}, a), { y: i }); } - return obj.y + obj.height / 2; - } - function getObjectBottomY(obj, t, a) { - if ("switchPlatform" === obj.type && 0 !== obj.rotation) { - const i = obj.height / 2; - if (-90 === obj.rotation) return obj.y - 7.5; - if (180 === obj.rotation) return obj.y - 7.5; - if (90 === obj.rotation) return obj.y - i - 15; - const n = -B.toRad(obj.rotation), - s = obj.x - obj.width / 2 + i; - const o = B.clamp2(0, obj.width - i, Math.hypot(t - s, a - obj.y)); - return ( - obj.y - - o * Math.sin(n) + - (obj.height / (obj.rotation < -90 || obj.rotation > 0 ? -2 : 2)) * - Math.cos(n) - ); + case "switchPlatform": { + const a = obj; + if ( + doNotApply && + !willApplyMovement(a.x, a.y, playerX, playerY, fallTypes) + ) + return null; + const i = "switch" === a.movementTrigger ? switchTrig : 90 * jump, + o = "up" === a.initPosition ? -90 + i : 0 - i; + return "switchPlatform" === + (null == updated ? void 0 : updated.type) + ? ((updated.x = a.x), + (updated.y = a.y), + (updated.width = a.width), + (updated.height = a.height), + (updated.initPosition = a.initPosition), + (updated.movementTrigger = a.movementTrigger), + (updated.direction = a.direction), + (updated.rotation = o + a.direction), + updated) + : Object.assign(Object.assign({}, a), { + rotation: o, + direction: a.direction, + }); } - return obj.y - obj.height / 2; - } - const be = { - pointInBox: he, - pointInBox2: (e, t, a, i, n, s) => - n >= e - a / 2 && - n <= e + a / 2 && - s >= t - i / 2 && - s <= t + i / 2, - pointInCircle: (e) => (t) => - de.pointInCircle(e.x, e.y, e.radius, t.x, t.y), - rectTouchesRect: (e) => (t) => { - if (t.type === "saw" && t.shape === "bar") { - return be.hitObject( - e.x, - e.y, - e.width / 30, - e.height / 30, - 0, - false, - false, - )(t); - } - const a = e.x - e.width / 2, - i = t.x - t.width / 2, - n = e.x + e.width / 2, - s = t.x + t.width / 2, - o = e.y + e.height / 2, - r = t.y + t.height / 2, - l = e.y - e.height / 2, - c = t.y - t.height / 2; - return a < s && n > i && o > c && l < r; - }, - rectTouchesRect2: (e, t, a, i, n) => { - const s = e - a / 2, - o = n.x - n.width / 2, - r = e + a / 2, - l = n.x + n.width / 2, - c = t + i / 2, - d = n.y + n.height / 2, - u = t - i / 2, - h = n.y - n.height / 2; - return s < l && r > o && c > h && u < d; - }, - hitLandableObject: (...params) => { - var [e, t, a, i, n, s, o, r, l, c, gravity, ghost] = params; - const checkDist = "switchPlatform" === r.type ? 120 : 30; - if (isNaN(r.y) || r.y === Infinity) { - return null; - } - if ( - r.x > e + r.width + checkDist || - r.x < e - r.width - checkDist - ) - return null; - const pointInBoundingBox = - "switchPlatform" === r.type - ? ( - (e) => (t) => - de.pointInSomething(t.x, t.y, e) - )(de.getObjectPolygon(r, c, 0)) - : he(r), - edge = - gravity > 0 - ? getObjectTopY(r, e, t) - : getObjectBottomY(r, e, t); - if ( - a <= 0 && - (gravity > 0 - ? t - a >= edge + 7.5 * globalPlayerScale - : t - a <= edge + -7.5 * globalPlayerScale) - ) { - const bottomPlayerLine = pe(e, t, i, n, s), - l = bottomPlayerLine[Math.floor(bottomPlayerLine.length / 2)], - c = (function (e, t, a) { - ye.length = a; - for (let i = 0; i < a; i++) { - let j = i; - ye[i] - ? ((ye[i].x = e), (ye[i].y = t + j * gravity)) - : (ye[i] = { x: e, y: t + j * gravity }); - } - return ye; - })(l.x, l.y, Math.min(Math.ceil(Math.abs(a)), M)); - for (const e of c) - if (pointInBoundingBox(e)) return { type: "hitMidLine" }; - const secondBottomPlayerLine = - s % 90 == 0 ? [] : me(e, t, i, n, s, o); - for (const e of bottomPlayerLine) - if (pointInBoundingBox(e)) - return { type: "hitBottomEdges", rotatePoint: e }; - for (const e of secondBottomPlayerLine) - if (pointInBoundingBox(e)) - return { type: "hitBottomEdges", rotatePoint: e }; - } - const h = de.getObjectPolygon(r, c); - return !("canJumpThrough" in r) && - de.polygonHitSomething(l, h) && - !ghost - ? { type: "crashed" } - : null; - }, - hitObject: function (e, t, a, i, n, s, o) { - const r = de.getPlayerPoly( - e, - t, - a, - i, - n, - s, - de.pooledPlayerPoly1, - ); - return (t) => { - if (t.x > e + t.width + ue || t.x < e - t.width - ue * 2) - return false; - const a = de.getObjectPolygon(t, o); - return de.polygonHitSomething(r, a); - }; - }, - hitRectangle: function (e, t, a, i, n, s) { - const o = de.getPlayerPoly( - e, - t, - a, - i, - n, - s, - de.pooledPlayerPoly2, + case "platform": { + const a = obj; + if ("static" === a.movement || "rail" === a.movement) + return doNotApply && + !willApplyMovement(a.x, a.y, playerX, playerY, fallTypes) + ? null + : a; + let i; + return ( + (i = + "falling" === a.movement + ? a.y - + (playerX - a.x) * + (a?.multiplier == undefined ? 1 : a?.multiplier) //a.y - (n - a.x) + : "jump" === a.movementTrigger + ? Ia(a.midY, a.movement, $.platformMove, jump) + : "switch" === a.movementTrigger + ? Ia( + a.midY, + a.movement, + $.platformMove, + switchTrig / 90, + ) + : _a( + a.midY, + a.movement, + $.platformMove, + frame, + maxBeat, + )), + doNotApply && + !willApplyMovement(a.x, i, playerX, playerY, fallTypes) + ? null + : "platform" === (null == updated ? void 0 : updated.type) && + "static" !== updated.movement && + "rail" !== updated.movement + ? ((updated.x = a.x), + (updated.y = i), + (updated.midY = a.midY), + (updated.width = a.width), + (updated.height = a.height), + (updated.movement = a.movement), + (updated.movementTrigger = a.movementTrigger), + (updated.multiplier = a.multiplier), + updated) + : Object.assign(Object.assign({}, a), { y: i }) + ); + } + case "enemy": { + if (!enemies[i]) { + throw new Error( + 'Could not find enemy state. Please use the "Delete Run History" button in the "More" section of the main menu.', ); - return (e) => { - const t = de.getRectPoly(e.x, e.y, e.width, e.height); - return de.polygonHitSomething(t, o); - }; - }, - getBottomPlayerLine: pe, - getSecondBottomPlayerLine: me, - handlePlayerHitBottomEdge: ( - e, - t, - a, - i, - n, - s, - o, - r, - l, - c, - d, - gravity, - ) => { - var u, h; - const edge = - (gravity > 0 - ? getObjectTopY(l, e, t) - : getObjectBottomY(l, e, t)) + - 15 * globalPlayerScale * gravity, - g = 1 === r ? e < l.x : e > l.x; - if ( - ((gravity > 0 ? t < edge : t > edge) && - (g || (gravity > 0 ? t - s > edge : t - s < edge))) || - o - ) - return { y: edge }; - const m = n, - f = r * gravity * (n % 90 < 45 ? -1 : 1); - let y = 45; - for ( - ; - y > 0 && - 0 !== n && - "hitBottomEdges" === - (null === - (u = be.hitLandableObject( - e, - t, - s, - a, - i, - n, - r, - l, - c, - d, - gravity, - )) || void 0 === u - ? void 0 - : u.type); - ) - ((n += f), y--); - if (0 === y || 0 === n) { - for ( - n = m, y = 15; - t < edge && - "hitBottomEdges" === - (null === - (h = be.hitLandableObject( - e, - t, - s, - a, - i, - n, - r, - l, - c, - d, - gravity, - )) || void 0 === h + } + const o = obj, + r = o.x + enemies[i].offsetX, + l = o.y + enemies[i].offsetY; + return doNotApply && + !willApplyMovement(r, l, playerX, playerY, fallTypes) + ? null + : "enemy" === (null == updated ? void 0 : updated.type) + ? ((updated.x = r), + (updated.y = l), + (updated.width = o.width), + (updated.height = o.height), + (updated.kind = o.kind), + (updated.skipMissiles = o.skipMissiles), + (updated.giant = o.giant), + (updated.enemyDir = o.enemyDir), + updated) + : Object.assign(Object.assign({}, o), { x: r, y: l }); + } + default: + return doNotApply && + !willApplyMovement(obj.x, obj.y, playerX, playerY, fallTypes) + ? null + : obj; + } + } + // sort by position + const sBP = (e, t) => { + const y1 = isNaN(e.y) || e.y === Infinity ? e.midY : e.y, + y2 = isNaN(t.y) || e.y === Infinity ? t.midY : t.y; + return e.x - t.x || y1 - y2; + }; + function ma(e) { + /* + e.blocks.concat( + Array.from({ length: Math.ceil(a / M) + 40 }).map( + (e, t) => + $.newBlock({ + x: et.initialPosition.x + (t - 15) * M, + y: et.initialPosition.y - M, + }) + ) + ), + */ + return { + properties: e.properties, + blocks: [...e.blocks].sort(sBP), + spikes: [...e.spikes].sort(sBP), + platforms: [...e.platforms].sort(sBP), + directionChanges: [...e.directionChanges].sort(sBP), + speedChanges: [...e.speedChanges].sort(sBP), + saws: [...e.saws].sort(sBP), + flags: [...e.flags].sort(sBP), + powerups: [...e.powerups].sort(sBP), + enemies: [...e.enemies].sort(sBP), + switchButtons: [...e.switchButtons].sort(sBP), + switchPlatforms: [...e.switchPlatforms].sort(sBP), + springs: [...e.springs].sort(sBP), + portals: [...e.portals].sort(sBP), + collectibles: [...e.collectibles].sort(sBP), + }; + } + function getMinY(e) { + var t; + const a = Sa(e).sort(sBP); + if (0 === a.length) return { minYsByXDiv1000: [], minX: 0, minY: 0 }; + const i = a[0].x - 2e3, + n = a[a.length - 1].x + 2e3, + s = Array.from({ length: Math.ceil((n - i) / 1000) }, () => null); + return ( + a.forEach((e) => { + const t = Math.ceil((e.x - i) / 1000), + a = s[t]; + s[t] = null === a ? e.y : Math.min(e.y, a); + const n = s[t - 1]; + s[t - 1] = null === n ? e.y : Math.min(e.y, n); + }), + { + minYsByXDiv1000: s, + minX: i, + minY: + null !== + (t = s.reduce( + (e, t) => + null === t ? e : null === e ? t : Math.min(e, t), + null, + )) && void 0 !== t + ? t + : 0, + } + ); + } + function ya(e) { + var t, a, i, n; + const s = { + blocks: e.blocks || [], + spikes: e.spikes || [], + platforms: e.platforms || [], + directionChanges: e.directionChanges || [], + speedChanges: e.speedChanges || [], + saws: e.saws || [], + flags: e.flags || [], + enemies: e.enemies || [], + powerups: e.powerups || [], + switchButtons: e.switchButtons || [], + switchPlatforms: e.switchPlatforms || [], + springs: e.springs || [], + portals: e.portals || [], + collectibles: e.collectibles || [], + }; + return Object.assign( + { + properties: { + minY: + null !== + (a = + null === (t = e.properties) || void 0 === t ? void 0 - : h.type); - ) - ((t += gravity), (n += 0 === n ? 0 : f), (s *= 0.9), y--); - if (0 === y) return { crashed: true, y: t }; - } - return { y: t }; - }, - getObjectTopY: getObjectTopY, - getObjectBottomY: getObjectBottomY, - hitStack: function (e, t, a, i = 30) { - return a.some((a) => - be.rectTouchesRect({ x: t, y: a.y, width: i, height: M })(e), - ); - }, - hitStackWhich: function (e, t, a, i = 30) { - return a.findIndex((a) => - be.rectTouchesRect({ x: t, y: a.y, width: i, height: M })(e), - ); + : t.minY) && void 0 !== a + ? a + : getMinY(s), + theme: + null !== + (n = + null === (i = e.properties) || void 0 === i + ? void 0 + : i.theme) && void 0 !== n + ? n + : ca.world1, }, - objectPolyInPoint2: (e, t, a) => de.pointInSomething(t, a, e), }, - Se = A(), - Clickable = makeCustomSprite({ - init: () => ({ isPressed: false }), - loop({ - state: e, - getInputs: t, - props: { - disabled: a, - onPress: i, - onPressOutside: n, - width: s, - height: o, - x: propX, - y: propY, - }, - getContext: r, - updateState: l, - }) { - if (a) return e; - const { isPressed: c } = e, - { addToOnPressQueue: d } = r(Se), - { - x: u, - y: h, - pressed: p, - justReleased: g, - justPressed: m, - } = t().pointer, - f = () => - be.pointInBox({ x: propX || 0, y: propY || 0, width: s, height: o })({ - x: u + (propX || 0), - y: h + (propY || 0), - }), - y = p && f(); - return ( - g && c ? d(i) : m && n && !f() ? d(n) : y && d(() => null), - y && (m || c) - ? (d(() => { - l(() => ({ isPressed: true })); - }), - e) - : { isPressed: false } - ); - }, - render: ({ - props: { sprites: e, disabled: t }, - state: { isPressed: a }, - }) => e(!t && a), - }), - _e = makeSprite({ - init: () => ({ isPressed: false }), - loop({ state: e, getInputs: t, props: a, getContext: i }) { - if (a.disabled) return; - const { addToOnPressQueue: n } = i(Se), - { - x: s, - y: o, - pressed: r, - justReleased: l, - justPressed: c, - } = t().pointer, - d = () => be.pointInBox2(0, 0, a.width, a.height, s, o), - u = r && d(); - (l && e.isPressed - ? n(a.onPress) - : c && a.onPressOutside && !d() - ? n(a.onPressOutside) - : u && n(() => null), - u && (c || e.isPressed) - ? n(() => { - e.isPressed = true; - }) - : (e.isPressed = false)); - }, - render: ({ props: e, state: t }) => [ - conditional( - () => t.isPressed && !e.disabled, - () => e.sprites(true), - () => e.sprites(false), - ), - ], - }), - ve = "#F9F7FE", - Te = "#FDDF40", - Re = "#06F195", - Oe = "#b0fa37", - Ce = "#00DE84", - we = "#4CF47D", - Ae = "#5143FF", - ke = "#06FFFE", - Ne = "#82FCFD", - xe = "#59C2F9", - Pe = "#A7C2F6", - Me = "#5E01FF", - Le = "#C8ADF3", - De = "#7E61F6", - Be = "#550199", - Fe = "#5710A1", - Ye = "#A93FFF", - Ue = "#2F0245", - je = "#CE92FF", - Ge = "#C464F7", - Ve = "#ED5B29", - He = "#DB4D01", - Xe = "#7b7b7b", - ze = "#c1c1c1", - We = ({ - x: e, - y: t, - rotation: a, - rad: i = 5, - opacity: n, - width: s, - height: o, - color: l, - strokeColor: c, - strokeThickness: d, - gradient: u, - }) => - r({ - color: c, - fillColor: l, - path: [ - [-s / 2, o / 2 - i], - [-s / 2, -o / 2 + i], - [-s / 2 + i, -o / 2], - [s / 2 - i, -o / 2], - [s / 2, -o / 2 + i], - [s / 2, o / 2 - i], - [s / 2 - i, o / 2], - [-s / 2 + i, o / 2], - [-s / 2, o / 2 - i], - ], - x: e, - y: t, - rotation: a, - opacity: n, - fillGradient: u, - thickness: d, - lineCap: "round", - }), - qe = ( - { - x: e, - y: t, - rotation: a, - rad: i = 5, - opacity: n, - width: s = 10, - height: o = 10, - color: r, - fillColor: l, - thickness: c, - fillGradient: d, - }, - u, - ) => - m( - { - color: r, - fillColor: l, - path: [ - [-s / 2, o / 2 - i], - [-s / 2, -o / 2 + i], - [-s / 2 + i, -o / 2], - [s / 2 - i, -o / 2], - [s / 2, -o / 2 + i], - [s / 2, o / 2 - i], - [s / 2 - i, o / 2], - [-s / 2 + i, o / 2], - [-s / 2, o / 2 - i], - ], - x: e, - y: t, - rotation: a, - opacity: n, - fillGradient: d, - thickness: c, - lineCap: "round", - }, - (e) => { - null == u || u(e); - }, - ), - $e = makeCustomSprite({ - render({ - props: { - text: e, - width: t, - height: a, - onPress: i, - disabled: s, - colour: o = "#06F195", - }, - device: r, - }) { - const l = t / 100, - c = 8 * l, - d = c / 2, - u = 10 * l; - return [ - Clickable({ - id: "Clickable", - width: t, - height: a, - disabled: s, - onPress: () => { - (r.audio("audio/global/button.wav").play(0), i()); - }, - sprites: (i) => [ - We({ - width: t + c, - height: a + c, - rad: u, - rotation: 45, - color: ve, - strokeColor: Ye, - strokeThickness: 2, - }), - We({ - width: t, - height: a, - rotation: 45, - rad: u, - color: i ? ke : o, - y: d - (i ? 3 : 0), - }), - n({ - font: { size: 20 * l, style: "italic" }, - text: e, - rotation: -8, - color: i ? Ae : Be, - y: d - (i ? 3 : 0), - strokeColor: Te, - strokeThickness: 2, - }), - ], - }), - ]; - }, - }), - Je = makeSprite({ - render({ props: e, device: t }) { - const a = e.width / 100, - i = 8 * a, - n = i / 2, - s = 10 * a; - return [ - qe({ - width: e.width + i, - height: e.height + i, - rad: s, - rotation: 45, - fillColor: ve, - color: Ye, - thickness: 2, - }), - _e.Single({ - width: e.width, - height: e.height, - onPress: () => { - (t.audio("audio/global/button.wav").play(0), e.onPress()); - }, - sprites: (t) => [ - qe({ - width: e.width, - height: e.height, - rotation: 45, - rad: s, - fillColor: t ? ke : e.colour || Re, - y: n - (t ? 3 : 0), - }), - c({ - font: { size: 20 * a, style: "italic" }, - text: e.text, - rotation: -8, - strokeColor: Te, - strokeThickness: 2, - color: t ? Ae : Be, - y: n - (t ? 3 : 0), - }), - ], - }), - ]; - }, - }), - Ke = makeCustomSprite({ - loop({ props: e, getInputs: t }) { - const a = t(); - "edit" === e.type - ? a.keysJustPressed.Escape && e.onPress() - : a.keysJustPressed.Enter && e.onPress(); - }, - render: ({ props: e }) => [ - $e({ - id: "PlayEditButton", - width: 50, - height: 50, - disabled: e.disabled, - onPress: e.onPress, - text: "play" === e.type ? localize("PLAY") : localize("EDIT"), + s, + ); + } + const Ea = (e, t) => { + const a = [], + i = {}, + n = (e) => { + const t = e.reduce((e, { object: t }) => e + t.x, 0) / e.length; + (a.push({ + index: e[0].index, + object: Object.assign(Object.assign({}, e[0].object), { + x: t, + width: e[0].object.width * e.length, }), - ], - }), - Qe = { x: -120, y: -60 }, - Ze = B.clamp([0.7, 1]); - var globalPlayerScale = 1; - const et = { - initialPosition: Qe, - setScaleInc: (e, t, a) => { - var { - playerRot: rot, - playerGradY: gy, - playerScaleX: sx, - playerScaleY: sy, - playerScale: ps, - isGravity, - playerPowerups, - } = e; - gy = - isGravity || playerPowerups.some((e) => e.item === "spaceship") - ? 0 - : gy; - globalPlayerScale = ps; - sx = sx / ps; - sy = sy / ps; - const r = (rot > 45 && rot < 135) || (rot > 225 && rot < 315), - l = gy < 0, - c = (!r && l) || (r && !l), - d = !c, - u = B.numberMap2(a, 0, 0.7, 1, Math.abs(gy)), - h = Ze(u), - p = ((c ? h : 1) - sx) / 6, - g = ((d ? h : 1) - sy) / 6; - ((e.playerScaleX += p * t), (e.playerScaleY += g * t)); - }, - landTimerLimit: 20, - closestFlatAngle: (e) => e + 45 - ((e + 45) % 90), - }; - function tt(array, thing, index) { - return [...array.slice(0, index), thing, ...array.slice(index + 1)]; - } - function at(e, t) { - return [...e.slice(0, t), ...e.slice(t + 1)]; - } - function it(e, t, a) { - return [...e.slice(0, a), t, ...e.slice(a)]; - } - function nt(e) { - return null != e; - } - function st(e, t, a) { - const i = t - e; - return Math.round(i * a() + e); - } - function ot(e) { - return e() < 0.5 ? -1 : 1; - } - function rt(e) { - return [...new Set(e)]; - } - function lt(e, t) { - let a = 0, - i = 0; - for (; i < e.length; ) (t(e[i], a) ? (i += 1) : e.splice(i, 1), a++); - return e; + }), + (e.length = 0)); + }; + for (let a = 0; a < e.length; a++) { + const s = e[a], + o = { object: s, index: a }; + if (t.blocks[a]?.destroyed || t.blocks[a]?.off) continue; + const r = i[s.y]; + r && 0 !== r.length + ? r[r.length - 1].object.x + s.width === s.x + ? r.push(o) + : (n(r), i[s.y].push(o)) + : (i[s.y] = [o]); } - const ct = (e) => ({ - form: (null == e ? void 0 : e.form) || "default", - bottomColour: (null == e ? void 0 : e.bottomColour) || "#FFBD00", - topColour: (null == e ? void 0 : e.topColour) || "#FFD604", + return ( + Object.values(i).forEach((e) => { + e.length > 0 && n(e); }), - dt = { name: "Default", fileName: "default", size: 31, trail: ct() }, - ut = { - name: "Pixel", - fileName: "pixel", - size: 30, - trail: ct({ form: "pixel" }), - }, - ht = { name: "Glow", fileName: "glow", size: 41, trail: ct() }, - pt = { name: "World 4", fileName: "world4", size: 31, trail: ct() }, - gt = { - name: "Alien", - fileName: "alien", - size: 45, - trail: ct({ bottomColour: "#21D800", topColour: "#8AFF00" }), - }, - mt = { - name: "Worm", - fileName: "worm", - size: 45, - trail: ct({ topColour: "#79DB00", bottomColour: "#4DC801" }), - }, - ft = { - name: "Bull", - fileName: "bull", - size: 45, - trail: ct({ bottomColour: "#EB4422", topColour: "#FF7745" }), - }, - yt = { - name: "Burger", - fileName: "burger", - size: 45, - trail: ct({ topColour: "#FFAA02", bottomColour: "#E56B04" }), - }, - Et = { name: "Chicken", fileName: "chicken", size: 45, trail: ct() }, - bt = { - name: "Mr Cool", - fileName: "mrcool", - size: 45, - trail: ct({ topColour: "#FECBAB", bottomColour: "#F5AC94" }), - }, - St = { - name: "Dino", - fileName: "dino", - size: 45, - trail: ct({ topColour: "#00F4DE", bottomColour: "#04C4EA" }), - }, - It = { name: "Dog", fileName: "dog", size: 45, trail: ct() }, - _t = { - name: "Knight", - fileName: "knight", - size: 45, - trail: ct({ topColour: "#C2EDF8", bottomColour: "#A5CBFE" }), - }, - vt = { - name: "Machine", - fileName: "machine", - size: 45, - trail: ct({ topColour: "#01DDFF", bottomColour: "#00B6CE" }), - }, - Tt = { - name: "Monkey", - fileName: "monkey", - size: 45, - trail: ct({ topColour: "#FF9900", bottomColour: "#FE5200" }), - }, - Rt = { - name: "Mummy", - fileName: "mummy", - size: 45, - trail: ct({ bottomColour: "#F5BAA4", topColour: "#FEF3C8" }), - }, - Ot = { - name: "Mushroom", - fileName: "mushroom", - size: 42, - trail: ct({ topColour: "#58AA1B", bottomColour: "#328F0D" }), + a + ); + }, + ba = (e, t) => ({ object: e, index: t }), + Sa = (e) => Object.values(e).flat(); + function Ia(e, t, a, i) { + return "upDown" === t ? e - a / 2 + i * a : e + a / 2 - i * a; + } + function _a(e, t, a, i, n) { + const s = i % n, + o = s / n; + let r, l, c, d; + return ( + "upDown" === t + ? ((r = e - a / 2), (l = e + a / 2), (c = 1)) + : ((r = e + a / 2), (l = e - a / 2), (c = -1)), + (d = s === i % (2 * n) ? r + o * a * c : l - o * a * c), + d + ); + } + const va = ya({ + blocks: [ + ...Array.from({ length: 10 }).map((e, t) => + $.newBlock({ + x: et.initialPosition.x + t * M, + y: et.initialPosition.y - M, + }), + ), + ...Array.from({ length: 5 }).map((e, t) => + $.newBlock({ + x: et.initialPosition.x + t * M + 300, + y: et.initialPosition.y, + }), + ), + ], + }), + Ta = ya({ + blocks: Array.from({ length: 100 }).map((e, t) => + $.newBlock({ + x: et.initialPosition.x + t * M, + y: et.initialPosition.y - M, + }), + ), + }), + Ra = ya({ + blocks: Array.from({ length: 100 }).map((e, t) => + $.newBlock({ + x: et.initialPosition.x + t * M * 4.5, + y: et.initialPosition.y - M, + }), + ), + }), + Oa = ya({ + blocks: Array.from({ length: 100 }).map((e, t) => + $.newBlock({ + x: et.initialPosition.x + t * M * 4, + y: et.initialPosition.y - M + t * M, + }), + ), + }), + Ca = { + fillInPartial: ya, + sortLayout: ma, + setInViewLayoutAndState: function ( + layout, + frame, + a, + playerX, + playerY, + layoutState, + switchRot, + jumpSwitchRatio, + switchBlockSpikes, + layoutFirstIndexes, + inViewLayout, + inViewLayoutState, + fullLayoutStateIndexes, // optional? + fallTypes, + ) { + // const floorStates = inViewLayoutState.blocks.filter(e => e.isGround), + const p = layoutFirstIndexes; + for (const layoutKey in layout) { + if ("properties" === layoutKey) continue; + const g = layoutKey, + layoutValue = layout[g], + isEnemies = "enemies" === g; + let firstIndexes = layoutFirstIndexes[g]; + if (firstIndexes > 0) + if (isEnemies) firstIndexes = 0; + else { + const e = layoutValue[firstIndexes], + t = + firstIndexes >= layoutValue.length - 1 + ? void 0 + : layoutValue[firstIndexes + 1]; + if (ha(e, playerX) || (t && ha(t, playerX))) + for ( + ; + firstIndexes > 0 && + ha(layoutValue[firstIndexes - 1], playerX); + ) + firstIndexes--; + else firstIndexes = 0; + } + let E = null, + b = 0, + S = firstIndexes; + for (; S < layoutValue.length;) { + const e = layoutValue[S], + l = pa( + e, + inViewLayout[g][b], + layoutState.enemies, + S, + playerX, + playerY, + frame, + a, + switchRot, + jumpSwitchRatio, + true, + fallTypes, + ); + if (null !== l) + (null === E && (E = S), + (fullLayoutStateIndexes[g][b] = S), + (inViewLayout[g][b] = l), + (inViewLayoutState[g][b] = layoutState[g][S]), + b++); + else if (!isEnemies && e.x > playerX && !ha(e, playerX)) { + if (layoutKey !== "blocks") { + break; // ugh. + } + } + S++; + } + (b < fullLayoutStateIndexes[g].length && + ((fullLayoutStateIndexes[g].length = b), + (inViewLayout[g].length = b), + (inViewLayoutState[g].length = b)), + (p[g] = null != E ? E : firstIndexes)); + } + // ! + if (switchBlockSpikes) { + const { blocks: e, spikes: t } = inViewLayout, + { blocks: a, spikes: i } = inViewLayoutState, + { blocks: n, spikes: s } = fullLayoutStateIndexes; + ((inViewLayout.blocks = t), + (inViewLayout.spikes = e), + (inViewLayoutState.blocks = i), + (inViewLayoutState.spikes = a), + (fullLayoutStateIndexes.blocks = s), + (fullLayoutStateIndexes.spikes = n)); + } + if (layout.properties.useGround) { + const { blocks: inViewLayoutBlocks } = inViewLayout, + { blocks: inViewLayoutStateBlocks } = inViewLayoutState, + { blocks: fullLayoutStateIndexesBlocks } = + fullLayoutStateIndexes; + for (let i = 0; i < 44; i++) { + inViewLayoutBlocks.push( + $.newBlock({ + x: i * M - 660 + Math.floor(playerX / M) * M, + y: et.initialPosition.y - M, + isBoss: layout.properties.theme.id !== "world1Boss", + isGround: true, + }), + ); + inViewLayoutStateBlocks.push({ + type: "blockSpikeState", + isBoss: layout.properties.theme.id !== "world1Boss", + isGround: true, + }); + fullLayoutStateIndexesBlocks.push( + Math.max(...fullLayoutStateIndexesBlocks) + 1, + ); + } + } }, - Ct = { - name: "Parrot", - fileName: "parrot", - size: 42, - trail: ct({ topColour: "#AECEEA", bottomColour: "#6D85D6" }), + getEmptyLayout: function (e) { + return { + properties: e, + blocks: [], + spikes: [], + platforms: [], + directionChanges: [], + speedChanges: [], + saws: [], + flags: [], + powerups: [], + enemies: [], + switchButtons: [], + switchPlatforms: [], + springs: [], + portals: [], + collectibles: [], + }; }, - wt = { - name: "Green Bot", - fileName: "greenbot", - size: 45, - trail: ct({ topColour: "#00BD68", bottomColour: "#049F72" }), + setLayoutAtTime: function (e, t, a, i, n, s, o, fallTypes) { + ["saws", "platforms", "switchPlatforms", "enemies"].forEach( + (r) => { + for (let l = 0; l < e[r].length; l++) + e[r][l] = pa( + e[r][l], + void 0, + t, + l, + a, + 0, + i, + n, + s, + o, + false, + fallTypes, + ); + }, + ); }, - At = { - name: "Samurai", - fileName: "samurai", - size: 45, - trail: ct({ topColour: "#00A191", bottomColour: "#018188" }), + removeObject: function (e, t, a) { + if ("properties" === t) return e; + const i = e[t]; + return Object.assign(Object.assign({}, e), { [t]: at(i, a) }); }, - kt = { - name: "Superhero", - fileName: "superhero", - size: 45, - trail: ct({ topColour: "#C424ED", bottomColour: "#7303A3" }), + removeObjects: function (e, t) { + const a = {}; + let i = e; + return ( + t.forEach(({ array: e, index: t }) => { + const n = a[e] || 0; + ((i = Ca.removeObject(i, e, t - n)), (a[e] = n + 1)); + }), + i + ); }, - Nt = { - name: "Yak", - fileName: "yak", - size: 45, - trail: ct({ topColour: "#00F880", bottomColour: "#00DFFF" }), + replaceObject: function (e, t, a, i) { + if ("properties" === t) return e; + const n = e[t]; + return Object.assign(Object.assign({}, e), { [t]: tt(n, i, a) }); }, - xt = { - name: "Spaceship", - fileName: "spaceship", - size: 50, - trail: ct(), + insertObject: function (e, t, a, i) { + if ("properties" === t) return e; + const n = e[t]; + return Object.assign(Object.assign({}, e), { [t]: it(n, i, a) }); }, - Pt = { - name: "Pixel Cheese", - fileName: "pixelcheese", - size: 67, - trail: ct({ form: "pixel" }), + getAllLandableObjects: (e, t, a) => { + const i = e.platforms.map((e, t) => ({ object: e, index: t })); + return ( + a || lt(i, (e) => "rail" !== e.object.movement), + [ + ...Ea(e.blocks, t), + ...i, + ...e.switchPlatforms.map((e, t) => ({ object: e, index: t })), + ] + ); }, - Mt = { - name: "Pixel Robot", - fileName: "pixelrobot", - size: 67, - trail: ct({ form: "pixel" }), + getAllDeadlyObjects: (e, t) => { + const a = e.spikes.map(ba); + lt(a, ({ index: e }) => !t.spikes[e].destroyed); + const i = e.saws.map(ba); + lt(i, ({ index: e }) => !t.saws[e].destroyed); + const n = e.enemies.map(ba); + return ( + lt(n, ({ index: e }) => !t.enemies[e].destroyed), + [...a, ...i, ...n] + ); }, - Lt = { - name: "Pixel Skull", - fileName: "pixelskull", - size: 67, - trail: ct({ form: "pixel" }), + removeCheckpoints: function (e) { + return Object.assign(Object.assign({}, e), { + flags: e.flags.filter((e) => "checkpoint" !== e.role), + }); }, - Dt = { - name: "Pixel Crown", - fileName: "pixelcrown", - size: 67, - trail: ct({ form: "pixel" }), + initialLayout: va, + blocksFlat: Ta, + blocksFlatJumpDistance: Ra, + blocksUpJumpDistance: Oa, + getMinY: getMinY, + getMinYFromX: function ( + e, + { minX: t, minY: a, minYsByXDiv1000: i }, + ) { + const n = i[Math.ceil((e - t) / 1000)]; + return null == n ? a : n; }, - Bt = { name: "Skater", fileName: "skater", size: 47, trail: ct() }, - Ft = { - name: "Fighter", - fileName: "fighter", - size: 67, - trail: ct({ form: "pixel" }), + updateMinY: function (e) { + const { properties: t } = e, + a = (function (e, t) { + var a = {}; + for (var i in e) + Object.prototype.hasOwnProperty.call(e, i) && + t.indexOf(i) < 0 && + (a[i] = e[i]); + if ( + null != e && + "function" == typeof Object.getOwnPropertySymbols + ) { + var n = 0; + for (i = Object.getOwnPropertySymbols(e); n < i.length; n++) + t.indexOf(i[n]) < 0 && + Object.prototype.propertyIsEnumerable.call(e, i[n]) && + (a[i[n]] = e[i[n]]); + } + return a; + })(e, ["properties"]); + return Object.assign(Object.assign({}, e), { + properties: Object.assign(Object.assign({}, e.properties), { + minY: getMinY(a), + }), + }); }, - Yt = { name: "Dreamy", fileName: "dreamy", size: 31, trail: ct() }, - Ut = { - name: "Boss 1", - fileName: "boss1", - size: 40, - trail: ct({ topColour: "#A31D03", bottomColour: "#4C3923" }), + updateTheme: function (e, t) { + return Object.assign(Object.assign({}, e), { + properties: Object.assign(Object.assign({}, e.properties), { + theme: t, + }), + }); }, - jt = { - name: "Boss 2", - fileName: "boss2", - size: 48, - trail: ct({ - form: "pixel", - topColour: "#FF1E2B", - bottomColour: "#A00E2A", - }), + updateGround: function (e, t) { + return Object.assign(Object.assign({}, e), { + properties: Object.assign(Object.assign({}, e.properties), { + useGround: t, + }), + }); }, - Gt = { - name: "Boss 3", - fileName: "boss3", - size: 50, - trail: ct({ topColour: "#C60A0B", bottomColour: "#C8443F" }), + getAllObjects: Sa, + getAllNearbyObjects: (e, t, a, i, n) => { + const s = be.rectTouchesRect({ + x: t, + y: a, + width: i + 150, + height: n + 150, + }); + return Object.values(e).flat().filter(s); }, - Vt = { - name: "Boss 4", - fileName: "boss4", - size: 68, - trail: ct({ topColour: "#E51C04", bottomColour: "#820F1B" }), + getUpDownObjectYAtFrame: _a, + inViewAreaWidth: da, + inViewAreaHeight: 450, + getInitFirstIndexes: function () { + return { + blocks: 0, + spikes: 0, + platforms: 0, + directionChanges: 0, + speedChanges: 0, + saws: 0, + flags: 0, + powerups: 0, + enemies: 0, + switchButtons: 0, + switchPlatforms: 0, + springs: 0, + portals: 0, + collectibles: 0, + }; }, - Ht = { - name: "Tester", - fileName: "tester", - size: 66, - trail: ct({ topColour: "#FFF142", bottomColour: "#C57700" }), - hidden: true, + isObjectInViewX: ha, + addBlocksFlat: (e) => { + var t; + const a = + null === (t = e.flags.find((e) => "endOfLevel" === e.role)) || + void 0 === t + ? void 0 + : t.x; + return void 0 === a + ? e + : ma( + Object.assign(Object.assign({}, e), { + blocks: e.blocks.concat( + Array.from({ length: Math.ceil(a / M) + 40 }).map( + (e, t) => + $.newBlock({ + x: et.initialPosition.x + (t - 15) * M, + y: et.initialPosition.y - M, + }), + ), + ), + }), + ); }, - Xt = { - name: "Dev", - fileName: "dev", - size: 47, - trail: ct(), - hidden: true, + clone: function (e) { + return { + properties: e.properties, + blocks: [...e.blocks], + spikes: [...e.spikes], + platforms: [...e.platforms], + directionChanges: [...e.directionChanges], + speedChanges: [...e.speedChanges], + saws: [...e.saws], + flags: [...e.flags], + powerups: [...e.powerups], + enemies: [...e.enemies], + switchButtons: [...e.switchButtons], + switchPlatforms: [...e.switchPlatforms], + springs: [...e.springs], + portals: [...e.portals], + collectibles: [...e.collectibles], + }; }, - zt = { - default: dt, - world1: { - name: "First World", - fileName: "world1", - size: 31, - trail: ct(), - }, - pixel: ut, - glow: ht, - world4: pt, - spaceship: xt, - dino: St, - chicken: Et, - yak: Nt, - bull: ft, - monkey: Tt, - samurai: At, - boss1: Ut, - pixelCheese: Pt, - pixelSkull: Lt, - pixelRobot: Mt, - pixelCrown: Dt, - pixelSpaceship: { - name: "Pixel Spaceship", - fileName: "pixelspaceship", - size: 50, - trail: ct({ form: "pixel" }), - }, - boss2: jt, - alien: gt, - machine: vt, - mummy: Rt, - boss3: Gt, - worm: mt, - mushroom: Ot, - burger: yt, - dog: It, - parrot: Ct, - greenBot: wt, - coolGuy: bt, - superhero: kt, - boss4: Vt, - knight: _t, - skater: Bt, - fighter: Ft, - space: { - name: "Astronaut", - fileName: "space", - size: 50, - trail: ct(), - }, - layla: { - name: "Layla", - fileName: "layla", - size: 50, - trail: ct({ topColour: "#f71fc2", bottomColour: "#DA18A9" }), - }, - classic: { - name: "Classic", - fileName: "classic", - size: 30, - trail: ct({ topColour: "#d54809", bottomColour: "#d54809" }), - }, - dreamy: Yt, - tester: Ht, - arrows: { - name: "Outline", - fileName: "arrows", - size: 30, - trail: ct(), - }, - headphone: { - name: "Headphones", - fileName: "headphone", - size: 47, - trail: ct(), - }, - pumpkin: { - name: "Pumpkin", - fileName: "pumpkin", - size: 45, - trail: ct({ topColour: "#e18c0d", bottomColour: "#e18c0d" }), - }, - calavera: { - name: "Calavera", - fileName: "calavera", - size: 45, - trail: ct({ topColour: "#f7ded4", bottomColour: "#f7ded4" }), - }, - mikhael: { - name: "Mikhael", - fileName: "mikhael", - size: 31, - author: "mikhael", - trail: ct({ topColour: "#78baba", bottomColour: "#78baba" }), - }, - benjamin: { - name: "Benja", - fileName: "benjamin", - size: 30, - author: "GatoNegro", - trail: ct({ topColour: "#9f1960", bottomColour: "#691d96" }), + }; + function wa(e, t, i) { + //* + //console.warn(e,t,i) + switch (e) { + case "blocks": + var block = { + type: "blockSpikeState", + }; + //t && t.blocks[i.index]?.init && console.warn(t.blocks[i.index], block); + return block; + case "spikes": + return { type: "blockSpikeState" }; + case "saws": + return { type: "sawState", inverse: Math.random() > 0.5 }; + case "directionChanges": + return { type: "directionChangeState", wasHit: false }; + case "speedChanges": + return { type: "speedChangeState" }; + case "flags": + return { type: "flagState", wasHit: false }; + case "enemies": + return { + type: "enemyState", + framesSeen: 0, + offsetX: 0, + offsetY: 0, + bullet: null, + speedY: 0, + direction: + t == undefined ? -1 : t.enemies[i.index]?.enemyDir || -1, + }; + case "powerups": + return { type: "powerupState", wasPickedUp: false }; + case "platforms": + return { type: "platformState" }; + case "switchButtons": + return { type: "switchButtonState", isPressedCounter: 0 }; + case "switchPlatforms": + return { type: "switchPlatformState" }; + case "springs": + return { type: "springState" }; + case "portals": + return { type: "portalState" }; + case "collectibles": + return { type: "collectibleState", wasPickedUp: false }; + } + } + const destroyableObjects = ["saws", "blocks", "spikes", "enemies"], + missleObjects = destroyableObjects.filter((e) => "blocks" !== e); + function Na(e, t, a, i, n, s, o) { + let r = e; + (o && + ("blocks" === r + ? (r = "spikes") + : "spikes" === r && (r = "blocks")), + (n[e][t] = a)); + const l = s[e][t]; + i[r][l] = a; + } + var overlapObjects = false, + mirrorMenuButton = false, + alternativeMenuMusic = false; + const xa = { + getInitState: function (e, t, i) { + return { + blocks: e.blocks.map((j) => + wa(j.array, e, { + array: j.array, + x: j.x, + y: j.y, + index: e.blocks.indexOf(j), + }), + ), + spikes: e.spikes.map((j) => wa(j.array)), + saws: e.saws.map((j) => + wa(j.array, e, { + array: j.array, + x: j.x, + y: j.y, + index: e.saws.indexOf(j), + }), + ), + directionChanges: e.directionChanges.map((j) => wa(j.array)), + speedChanges: e.speedChanges.map((j) => wa(j.array)), + flags: e.flags.map((j) => wa(j.array)), + enemies: e.enemies.map((j) => + wa(j.array, e, { + array: j.array, + x: j.x, + y: j.y, + index: e.enemies.indexOf(j), + }), + ), + powerups: e.powerups.map((j) => wa(j.array)), + platforms: e.platforms.map((j) => wa(j.array)), + switchButtons: e.switchButtons.map((j) => wa(j.array)), + switchPlatforms: e.switchPlatforms.map((j) => wa(j.array)), + springs: e.springs.map((j) => wa(j.array)), + portals: e.portals.map((j) => wa(j.array)), + collectibles: e.collectibles.map((j) => wa(j.array)), + }; + }, + getInitStateForArray: wa, + getEmptyStateIndexes: function () { + return { + blocks: [], + spikes: [], + platforms: [], + directionChanges: [], + speedChanges: [], + saws: [], + flags: [], + powerups: [], + enemies: [], + switchButtons: [], + switchPlatforms: [], + springs: [], + portals: [], + collectibles: [], + }; + }, + isStatefulArrayThatResetsOnMove: function (e) { + return [ + "enemies", + "blocks", + "spikes", + "saws", + "switchButtons", + "platforms", + ].includes(e); + }, + updateHitBulletState: function ( + frame, + layout, + layoutState, + bullets, + n, + s, + o, + ) { + for (let i = 0; i < bullets.length; i++) { + const hit = be.rectTouchesRect(bullets[i]); + for (const destroyableType of destroyableObjects) + for ( + let objIndex = 0; + objIndex < layout[destroyableType].length; + objIndex++ + ) { + const obj = layout[destroyableType][objIndex], + state = layoutState[destroyableType][objIndex], + sign = Math.sign(bullets[i].speed); + if (obj?.steel && hit(obj)) { + return ( + Na( + destroyableType, + objIndex, + state, + n, + layoutState, + s, + o, + ), + (bullets[i].x = + obj.x - + (obj.width / 2) * sign - + bullets[i].width / (2 * sign)), + (bullets[i].frame = 1) + ); + } - }, - gd: { - name: "Geometry Dash", - fileName: "gd", - size: 31, - author: "KDSealock", - trail: ct({ topColour: "#7dff00", bottomColour: "#7dff00" }) - }, - blank: { - name: "Blank", - fileName: "blank", - size: 47, - trail: ct(), - hidden: true, - }, - dev: Xt, - }, - Wt = { - skins: zt, - getSkin: (e) => - zt[e || "default"] || - Object.values(zt).find((t) => t.fileName === e) || - Wt.default, - default: zt.default, - }, - qt = { - id: "world2", - name: "World 2", - colour: "#5A20BE", - player: bgOnly ? "blank" : Wt.skins.pixel, - background: "world2", - objects: { - block: bgOnly ? "blank" : "world2", - spike: bgOnly ? "blank" : "world2", - platform: "world2", - dirChange: "world2", - flag: "world2", - saw: "world2", - bottom: "world2", - switch: "world2", - speedChange: "world2", - }, - isBonusTheme: false, - }, - $t = Object.assign(Object.assign({}, qt), { - id: "world2Red", - name: "World 2 Red", - colour: "#952730", - background: "world2Red", - }), - Jt = { - id: "world1", - name: "World 1", - colour: "#050229", - player: bgOnly ? Wt.skins.blank : Wt.skins.default, - background: "world1", - objects: { - block: bgOnly ? "blank" : "world1", - spike: bgOnly ? "blank" : "world1", - platform: "world1", - dirChange: "world1", - flag: "world1", - saw: "world1", - bottom: "world1", - switch: "world3", - speedChange: "speed", - }, - isBonusTheme: false, - }, - Kt = Object.assign(Object.assign({}, Jt), { - id: "red", - name: "World 1 Red", - colour: "#5F1A09", - background: "red", - }), - Qt = Object.assign(Object.assign({}, Jt), { - id: "world1Boss", - name: "World 1 Boss", - colour: "#250B05", - background: "world1Boss", - objects: Object.assign(Object.assign({}, Jt.objects), { - block: "world1Boss", - }), - }), - Zt = { - id: "world3", - name: "World 3", - colour: "#210086", - background: "world3", - player: bgOnly ? Wt.skins.blank : Wt.skins.glow, - objects: { - block: bgOnly ? "blank" : "world3", - spike: bgOnly ? "blank" : "world3", - platform: "world1", - dirChange: "world1", - flag: "world1", - saw: "world1", - bottom: "world3", - switch: "world3", - speedChange: "speed", - }, - isBonusTheme: false, - }, - ea = Object.assign(Object.assign({}, Zt), { - id: "world3Red", - name: "World 3 Red", - colour: "#510602", - background: "world3Red", - }), - ta = Object.assign(Object.assign({}, Zt), { - id: "synthwave", - name: "Synthwave", - colour: "#721A59", - background: "synthwave", - }), - aa = { - id: "world4", - name: "World 4", - colour: "#772582", - background: "world4", - player: Wt.skins.world4, - objects: { - block: "world4", - spike: "world4", - platform: "world1", - dirChange: "world1", - flag: "world1", - saw: "world1", - bottom: "world4", - switch: "world3", - speedChange: "speed", - }, - isBonusTheme: false, - }, - ia = Object.assign(Object.assign({}, aa), { - id: "world4Boss", - name: "World 4 Boss", - colour: "#6d2056", - background: "world4Boss", - }), - na = Object.assign(Object.assign({}, aa), { - id: "world4Red", - name: "World 4 Red", - colour: "#5b0211", - background: "world4Red", - }), - sa = { - id: "skater", - name: "Skater", - colour: "#E2A959", - background: "skater", - player: Wt.skins.skater, - objects: { - block: "skater", - spike: "skater", - platform: "world1", - dirChange: "world1", - flag: "world1", - saw: "skater", - bottom: "world1", - switch: "world3", - speedChange: "speed", - }, - isBonusTheme: true, - }, - oa = { - id: "speed", - name: "Moon", - colour: "#1B222D", - background: "speed", - player: bgOnly ? Wt.skins.blank : Wt.skins.space, - objects: { - block: bgOnly ? "blank" : "world1", - spike: bgOnly ? "blank" : "world3", - platform: "world1", - dirChange: "world1", - flag: "world1", - saw: "world1", - bottom: "world3", - switch: "world3", - speedChange: "speed", - }, - isBonusTheme: true, - }, - ra = { - id: "dreamy", - name: "Dreamy", - colour: "#91099D", - background: "dreamy", - player: Wt.skins.dreamy, - objects: { - block: "world1", - spike: "dreamy", - platform: "world1", - dirChange: "world1", - flag: "world1", - saw: "world1", - bottom: "world1", - switch: "world3", - speedChange: "speed", - }, - isBonusTheme: true, - }, - la = Object.assign(Object.assign({}, qt), { - id: "fighter", - name: "Fighter", - colour: "#0a0353", - background: "fighter", - player: Wt.skins.fighter, - isBonusTheme: true, - }), - ca = { - skater: sa, - arrows: { - id: "arrows", - name: "Arrows", - colour: "#0F35A1", - background: "arrows", - player: bgOnly ? Wt.skins.blank : Wt.skins.arrows, - objects: { - block: bgOnly ? "blank" : "world1", - spike: bgOnly ? "blank" : "world1", - platform: "world1", - dirChange: "world1", - flag: "world1", - saw: "world1", - bottom: "world3", - switch: "world3", - speedChange: "speed", - }, - isBonusTheme: true, - }, - /*skaterArrows: { - id: "skaterArrows", - name: "Skater + Arrows", - colour: "#0F35A1", - background: "arrows", - player: Wt.skins.arrows, - objects: { - block: "skater", - spike: "skater", - platform: "world1", - dirChange: "world1", - flag: "world1", - saw: "world1", - bottom: "world3", - switch: "world3", - speedChange: "speed", - }, - isBonusTheme: true, - },*/ - fighter: la, - dreamy: ra, - speed: oa, - classic: { - id: "classic", - name: "Classic", - colour: "#00c0c0", - player: Wt.skins.classic, - background: "classic", - objects: { - block: "classic", - spike: "classic", - platform: "classic", - dirChange: "world2", - flag: "world2", - saw: "classic", - bottom: "classic", - switch: "world2", - speedChange: "speed", - }, - isBonusTheme: true, - }, - infinite: { - id: "infinite", - name: "Infinite", - colour: "#89dde1", - player: Wt.skins.headphone, - background: "infinite", - objects: { - block: "infinite", - spike: "infinite", - platform: "infinite", - dirChange: "world1", - flag: "world1", - saw: "infinite", - bottom: "world3", - switch: "infinite", - speedChange: "speed", - }, - isBonusTheme: true, - }, - synthwave: ta, - world1: Jt, - red: Kt, - world1Boss: Qt, - world2: qt, - world2Red: $t, - world3: Zt, - world3Red: ea, - virtual: Object.assign(Object.assign({}, Zt), {id: "virtual", name: "Virtual", player: Wt.skins.layla, hidden: true}), - world4: aa, - world4Boss: ia, - world4Red: na, - }; - const da = 660; - function willApplyMovement(x, y, playerX, playerY, fallTypes) { - y = getBlockFallY(x, y, playerX, fallTypes); - return ( - x < playerX + da && - x > playerX - da && - y < playerY + 450 + $.platformMove && - y > playerY - 450 - $.platformMove - ); - } - function ha(e, t) { - return e.x < t + da && e.x > t - da; - } - function pa( - obj, - updated, - enemies, - i, + if (!state.destroyed && !state.off && hit(obj)) + return ( + Na( + destroyableType, + objIndex, + Object.assign(Object.assign({}, state), { + destroyed: { + frame: frame, + x: obj.x, + y: obj.y, + by: "gun", + }, + }), + n, + layoutState, + s, + o, + ), + void bullets.splice(i, 1) + ); + } + } + }, + updateHitPunchState: function (e, t, a, i, n, s, o, r, l, scale) { + const c = be.rectTouchesRect({ + x: i + s * ($.punchWidth / 2) * scale, + y: n + 10 * scale, + width: $.punchWidth * scale, + height: 40 * scale, + }); + for (const i of destroyableObjects) + for (let n = 0; n < t[i].length; n++) { + const s = t[i][n], + d = a[i][n]; + if (s?.steel && c(s)) { + Na(i, n, d, o, a, r, l); + } else { + !d.destroyed && + !d.off && + c(s) && + Na( + i, + n, + Object.assign(Object.assign({}, d), { + destroyed: { frame: e, x: s.x, y: s.y, by: "gun" }, + }), + o, + a, + r, + l, + ); + } + } + }, + updateHitDrillState: function ( + frame, + t, + a, playerX, playerY, - frame, - maxBeat, - switchTrig, - jump, - doNotApply, - fallTypes, + dir, + layoutState, + r, + l, + scale, ) { - switch (obj.type) { - case "spike": - case "block": { - var trig = obj.trigger == "jump" ? jump : switchTrig / 90; - if (!("midY" in obj)) { - obj.midY = obj.y; - } - if (!("trueY" in obj)) { - obj.trueY = obj.y; - } - if (obj.init && !("inSwitch" in obj)) { - obj.inSwitch = false; - } - var trueY = obj.trueY, - toggleOn = (on) => { - var stateOn = obj.init == "red" ? obj.midY : Infinity; - var stateOff = obj.init == "red" ? Infinity : obj.midY; - if (on) { - trueY = stateOn; - } else { - trueY = stateOff; - } - }; - if (obj.init) { - if (obj.trigger == "beat") { - toggleOn((frame / maxBeat) % 2 < 1); - } else { - if (obj?.pastTrigger == trig) { - obj.inSwitch = false; - if (trig == 0) { - trueY = obj.init == "blue" ? Infinity : obj.midY; - } else { - trueY = obj.init == "blue" ? obj.midY : Infinity; - } - } else { - if (obj.inSwitch == false) { - trueY = trueY === Infinity ? obj.midY : Infinity; - obj.inSwitch = true; - } - } - } - //i = e.init == "red" ? i : (i == Infinity ? e.midY : Infinity) - } - if (obj?.pastTrigger != trig) { - obj.pastTrigger = trig; + var blocksKilled = 0; + const c = be.rectTouchesRect({ + x: playerX, + y: playerY + (-$.punchWidth / 2) * scale, + width: $.drillWidth * scale, + height: $.punchWidth * scale, + }); + for (const i of destroyableObjects) + for (let n = 0; n < t[i].length; n++) { + const s = t[i][n], + d = a[i][n]; + if (s?.steel && c(s)) { + Na(i, n, d, layoutState, a, r, l); + } else { + !d.destroyed && + !d.off && + c(s) && + (Na( + i, + n, + Object.assign(Object.assign({}, d), { + destroyed: { frame: frame, x: s.x, y: s.y, by: "gun" }, + }), + layoutState, + a, + r, + l, + ), + blocksKilled++); } - obj.trueY = trueY; - return doNotApply && - !willApplyMovement(obj.x, obj.midY, playerX, playerY, fallTypes) - ? null - : ["block", "spike"].includes( - null == updated ? void 0 : updated.type, - ) - ? ((updated.x = obj.x), - (updated.y = trueY), - (updated.midY = obj.midY), - (updated.width = obj.width), - (updated.height = obj.height), - (updated.movement = obj.movement), - (updated.trigger = obj.trigger), - (updated.steel = obj.steel), - (updated.isVoid = obj.isVoid), - (updated.isBoss = obj.isBoss), - (updated.trigger = obj.trigger), - (updated.init = obj.init), - (updated.pastTrigger = obj.pastTrigger), - (updated.rotation = obj.rotation), - (updated.skipMissiles = obj.skipMissiles), - (updated.isLaser = obj.isLaser), - (updated.isFade = obj.isFade), - updated) - : Object.assign(Object.assign({}, obj), { y: trueY }); - } - case "saw": { - const a = obj; - a.rotation = (a.x - playerX) / 2 + a.offset; - const i = - "static" === a.movement - ? a.y - : "falling" === a.movement - ? a.y - (playerX - a.x) * (a?.multiplier || 1) - : "beat" === a.movementTrigger - ? _a(a.midY, a.movement, $.sawMove, frame, maxBeat) - : "jump" === a.movementTrigger - ? Ia(a.midY, a.movement, $.sawMove, jump) - : Ia(a.midY, a.movement, $.sawMove, switchTrig / 90); - return doNotApply && - !willApplyMovement(a.x, i, playerX, playerY, fallTypes) - ? null - : "saw" === (null == updated ? void 0 : updated.type) - ? ((updated.x = a.x), - (updated.y = i), - (updated.midY = a.midY), - (updated.width = a.width), - (updated.height = a.height), - (updated.movement = a.movement), - (updated.movementTrigger = a.movementTrigger), - (updated.rotation = a.rotation), - (updated.shape = a.shape), - (updated.multiplier = a.multiplier), - (updated.offset = a.offset), - updated) - : Object.assign(Object.assign({}, a), { y: i }); - } - case "switchPlatform": { - const a = obj; - if ( - doNotApply && - !willApplyMovement(a.x, a.y, playerX, playerY, fallTypes) - ) - return null; - const i = "switch" === a.movementTrigger ? switchTrig : 90 * jump, - o = "up" === a.initPosition ? -90 + i : 0 - i; - return "switchPlatform" === - (null == updated ? void 0 : updated.type) - ? ((updated.x = a.x), - (updated.y = a.y), - (updated.width = a.width), - (updated.height = a.height), - (updated.initPosition = a.initPosition), - (updated.movementTrigger = a.movementTrigger), - (updated.direction = a.direction), - (updated.rotation = o + a.direction), - updated) - : Object.assign(Object.assign({}, a), { - rotation: o, - direction: a.direction, - }); - } - case "platform": { - const a = obj; - if ("static" === a.movement || "rail" === a.movement) - return doNotApply && - !willApplyMovement(a.x, a.y, playerX, playerY, fallTypes) - ? null - : a; - let i; - return ( - (i = - "falling" === a.movement - ? a.y - - (playerX - a.x) * - (a?.multiplier == undefined ? 1 : a?.multiplier) //a.y - (n - a.x) - : "jump" === a.movementTrigger - ? Ia(a.midY, a.movement, $.platformMove, jump) - : "switch" === a.movementTrigger - ? Ia( - a.midY, - a.movement, - $.platformMove, - switchTrig / 90, - ) - : _a( - a.midY, - a.movement, - $.platformMove, - frame, - maxBeat, - )), - doNotApply && - !willApplyMovement(a.x, i, playerX, playerY, fallTypes) - ? null - : "platform" === (null == updated ? void 0 : updated.type) && - "static" !== updated.movement && - "rail" !== updated.movement - ? ((updated.x = a.x), - (updated.y = i), - (updated.midY = a.midY), - (updated.width = a.width), - (updated.height = a.height), - (updated.movement = a.movement), - (updated.movementTrigger = a.movementTrigger), - (updated.multiplier = a.multiplier), - updated) - : Object.assign(Object.assign({}, a), { y: i }) - ); } - case "enemy": { - if (!enemies[i]) { - throw new Error( - 'Could not find enemy state. Please use the "Delete Run History" button in the "More" section of the main menu.', + return blocksKilled; + }, + useMissiles: function (e, t, a, i, n, s, o, r) { + for (const l of missleObjects) + for (let c = 0; c < t[l].length; c++) { + const d = t[l][c], + u = a[l][c]; + ("skipMissiles" in d && false !== d.skipMissiles) || + u.destroyed || + u.off || + !be.pointInBox({ x: i, y: n, width: 840, height: 240 })(d) || + Na( + l, + c, + Object.assign(Object.assign({}, u), { + destroyed: { frame: e, x: d.x, y: d.y, by: "missile" }, + }), + s, + a, + o, + r, ); - } - const o = obj, - r = o.x + enemies[i].offsetX, - l = o.y + enemies[i].offsetY; - return doNotApply && - !willApplyMovement(r, l, playerX, playerY, fallTypes) - ? null - : "enemy" === (null == updated ? void 0 : updated.type) - ? ((updated.x = r), - (updated.y = l), - (updated.width = o.width), - (updated.height = o.height), - (updated.kind = o.kind), - (updated.skipMissiles = o.skipMissiles), - (updated.giant = o.giant), - (updated.enemyDir = o.enemyDir), - updated) - : Object.assign(Object.assign({}, o), { x: r, y: l }); } - default: - return doNotApply && - !willApplyMovement(obj.x, obj.y, playerX, playerY, fallTypes) - ? null - : obj; - } - } - // sort by position - const sBP = (e, t) => { - const y1 = isNaN(e.y) || e.y === Infinity ? e.midY : e.y, - y2 = isNaN(t.y) || e.y === Infinity ? t.midY : t.y; - return e.x - t.x || y1 - y2; - }; - function ma(e) { - /* - e.blocks.concat( - Array.from({ length: Math.ceil(a / M) + 40 }).map( - (e, t) => - $.newBlock({ - x: et.initialPosition.x + (t - 15) * M, - y: et.initialPosition.y - M, - }) - ) - ), - */ + }, + sortLayoutState: function (e, t) { + const a = (a) => { + const i = t[a] + .map((t, i) => ({ object: t, state: e[a][i], index: i })) + .sort( + ({ object: e }, { object: t }) => e.x - t.x || e.y - t.y, + ); + return { + state: i.map(({ state: e }) => e), + originalIndexes: i.map(({ index: e }) => e), + }; + }, + i = a("blocks"), + n = a("spikes"), + s = a("platforms"), + o = a("directionChanges"), + r = a("speedChanges"), + l = a("saws"), + c = a("flags"), + d = a("powerups"), + u = a("enemies"), + h = a("switchButtons"), + p = a("switchPlatforms"), + g = a("springs"), + m = a("portals"), + f = a("collectibles"); return { - properties: e.properties, - blocks: [...e.blocks].sort(sBP), - spikes: [...e.spikes].sort(sBP), - platforms: [...e.platforms].sort(sBP), - directionChanges: [...e.directionChanges].sort(sBP), - speedChanges: [...e.speedChanges].sort(sBP), - saws: [...e.saws].sort(sBP), - flags: [...e.flags].sort(sBP), - powerups: [...e.powerups].sort(sBP), - enemies: [...e.enemies].sort(sBP), - switchButtons: [...e.switchButtons].sort(sBP), - switchPlatforms: [...e.switchPlatforms].sort(sBP), - springs: [...e.springs].sort(sBP), - portals: [...e.portals].sort(sBP), - collectibles: [...e.collectibles].sort(sBP), + sortedState: { + blocks: i.state, + spikes: n.state, + platforms: s.state, + directionChanges: o.state, + speedChanges: r.state, + saws: l.state, + flags: c.state, + powerups: d.state, + enemies: u.state, + switchButtons: h.state, + switchPlatforms: p.state, + springs: g.state, + portals: m.state, + collectibles: f.state, + }, + originalIndexes: { + blocks: i.originalIndexes, + spikes: n.originalIndexes, + platforms: s.originalIndexes, + directionChanges: o.originalIndexes, + speedChanges: r.originalIndexes, + saws: l.originalIndexes, + flags: c.originalIndexes, + powerups: d.originalIndexes, + enemies: u.originalIndexes, + switchButtons: h.originalIndexes, + switchPlatforms: p.originalIndexes, + springs: g.originalIndexes, + portals: m.originalIndexes, + collectibles: f.originalIndexes, + }, }; - } - function getMinY(e) { - var t; - const a = Sa(e).sort(sBP); - if (0 === a.length) return { minYsByXDiv1000: [], minX: 0, minY: 0 }; - const i = a[0].x - 2e3, - n = a[a.length - 1].x + 2e3, - s = Array.from({ length: Math.ceil((n - i) / 1000) }, () => null); - return ( - a.forEach((e) => { - const t = Math.ceil((e.x - i) / 1000), - a = s[t]; - s[t] = null === a ? e.y : Math.min(e.y, a); - const n = s[t - 1]; - s[t - 1] = null === n ? e.y : Math.min(e.y, n); + }, + unsortLayoutState: function (e, t) { + const a = (a) => { + const i = Array.from({ length: e[a].length }); + return ( + t[a].forEach((t, n) => { + i[t] = e[a][n]; + }), + i + ); + }; + return { + blocks: a("blocks"), + spikes: a("spikes"), + platforms: a("platforms"), + directionChanges: a("directionChanges"), + speedChanges: a("speedChanges"), + saws: a("saws"), + flags: a("flags"), + powerups: a("powerups"), + enemies: a("enemies"), + switchButtons: a("switchButtons"), + switchPlatforms: a("switchPlatforms"), + springs: a("springs"), + portals: a("portals"), + collectibles: a("collectibles"), + }; + }, + layoutConsistentWithState: function (e, t) { + return Object.entries(e).every(([e, a]) => { + const i = t[e]; + return !i || !Array.isArray(i) || i.length === a.length; + }); + }, + updateLayoutStateField: Na, + clone: function (e) { + return { + blocks: [...e.blocks], + spikes: [...e.spikes], + saws: [...e.saws], + platforms: [...e.platforms], + directionChanges: [...e.directionChanges], + speedChanges: [...e.speedChanges], + flags: [...e.flags], + enemies: [...e.enemies], + powerups: [...e.powerups], + switchButtons: [...e.switchButtons], + switchPlatforms: [...e.switchPlatforms], + springs: [...e.springs], + portals: [...e.portals], + collectibles: [...e.collectibles], + }; + }, + }; + const Pa = (e, t) => { + if (overlapObjects) return true; + const allRectangles = t.flatMap($.getRectangles); + let i; + if (allRectangles.length > 1) { + const t = allRectangles.reduce( + (e, t) => ({ + minX: Math.min(t.x - t.width / 2, e.minX), + maxX: Math.max(t.x + t.width / 2, e.maxX), + minY: Math.min(t.y - t.height / 2, e.minY), + maxY: Math.max(t.y + t.height / 2, e.maxY), }), { - minYsByXDiv1000: s, - minX: i, - minY: - null !== - (t = s.reduce( - (e, t) => - null === t ? e : null === e ? t : Math.min(e, t), - null, - )) && void 0 !== t - ? t - : 0, - } + minX: 99999999, + maxX: -99999999, + minY: 99999999, + maxY: -99999999, + }, ); - } - function ya(e) { - var t, a, i, n; - const s = { - blocks: e.blocks || [], - spikes: e.spikes || [], - platforms: e.platforms || [], - directionChanges: e.directionChanges || [], - speedChanges: e.speedChanges || [], - saws: e.saws || [], - flags: e.flags || [], - enemies: e.enemies || [], - powerups: e.powerups || [], - switchButtons: e.switchButtons || [], - switchPlatforms: e.switchPlatforms || [], - springs: e.springs || [], - portals: e.portals || [], - collectibles: e.collectibles || [], - }; - return Object.assign( + i = Ma(e, { + x: (t.maxX + t.minX) / 2, + width: t.maxX - t.minX, + y: (t.maxY + t.minY) / 2, + height: t.maxY - t.minY, + }); + } else i = Ma(e); + const n = i.some((e) => + allRectangles.some( + (t) => be.rectTouchesRect(e)(t) && !t.ignore, + ), + ), + s = t.some((e, a) => { + const i = $.getRectangles(e); + return t + .filter((e, t) => a !== t) + .flatMap($.getRectangles) + .some((e) => + i.some((t) => be.rectTouchesRect(e)(t) && !t.ignore), + ); + }); + return !n && !s; + }, + Ma = (e, t) => { + const { properties: a } = e, + i = (function (e, t) { + var a = {}; + for (var i in e) + Object.prototype.hasOwnProperty.call(e, i) && + t.indexOf(i) < 0 && + (a[i] = e[i]); + if ( + null != e && + "function" == typeof Object.getOwnPropertySymbols + ) { + var n = 0; + for (i = Object.getOwnPropertySymbols(e); n < i.length; n++) + t.indexOf(i[n]) < 0 && + Object.prototype.propertyIsEnumerable.call(e, i[n]) && + (a[i[n]] = e[i[n]]); + } + return a; + })(e, ["properties"]); + return [ + ...(t + ? Ca.getAllNearbyObjects(i, t.x, t.y, t.width, t.height) + : Ca.getAllObjects(i) + ).flatMap($.getRectangles), { - properties: { - minY: - null !== - (a = - null === (t = e.properties) || void 0 === t - ? void 0 - : t.minY) && void 0 !== a - ? a - : getMinY(s), - theme: - null !== - (n = - null === (i = e.properties) || void 0 === i - ? void 0 - : i.theme) && void 0 !== n - ? n - : ca.world1, - }, + x: et.initialPosition.x, + y: et.initialPosition.y, + width: M, + height: M, }, - s, - ); - } - const Ea = (e, t) => { - const a = [], - i = {}, - n = (e) => { - const t = e.reduce((e, { object: t }) => e + t.x, 0) / e.length; - (a.push({ - index: e[0].index, - object: Object.assign(Object.assign({}, e[0].object), { - x: t, - width: e[0].object.width * e.length, - }), - }), - (e.length = 0)); - }; - for (let a = 0; a < e.length; a++) { - const s = e[a], - o = { object: s, index: a }; - if (t.blocks[a]?.destroyed || t.blocks[a]?.off) continue; - const r = i[s.y]; - r && 0 !== r.length - ? r[r.length - 1].object.x + s.width === s.x - ? r.push(o) - : (n(r), i[s.y].push(o)) - : (i[s.y] = [o]); - } + ]; + }; + function La(e, t, a = -1) { + let i = 1000; + for (; !Pa(e, t) && i > 0;) + (i--, + (t = t.map((e) => { + const { x: t, y: i } = V( + { x: e.x + M / 2, y: e.y + a * (M / 2) }, + e.snapSize, + ); + return $.updateXY(e, t, i); + }))); + return 0 === i ? null : t; + } + const Da = { + canPlaceLevelObject: (e, t) => + !Ma(e).some((e) => $.getRectangles(t).some(be.rectTouchesRect(e))), + canPlaceLevelObjects: Pa, + moveObjectUntilCanPlace: function (e, t, a = -1) { + const i = La(e, [t], a); + return i ? i[0] : null; + }, + moveObjectsUntilCanPlace: La, + }; + function Ba(e, t, a) { + switch (e.type) { + case "placeObjects": { + let i = t, + n = a; return ( - Object.values(i).forEach((e) => { - e.length > 0 && n(e); + e.objects.forEach((obj) => { + const t = Da.moveObjectUntilCanPlace(i, obj.levelObject); + if (!t) return; + let a = false; + if ("portal" === t.type) { + const n = $.addPortalPairId(t, i); + i = Ca.insertObject(i, obj.array, obj.atIndex, n); + const s = Da.moveObjectUntilCanPlace(i, $.newPortalPair(n)); + if (!s) return; + ((a = true), + (i = Ca.insertObject(i, obj.array, obj.atIndex, s))); + } else i = Ca.insertObject(i, obj.array, obj.atIndex, t); + n = n.map((t) => { + const i = xa.getInitStateForArray( + obj.array, + { blocks: e.objects, enemies: e.objects, saws: e.saws }, + obj.levelObject, + ); + let n = it(t.layoutState[obj.array], i, obj.atIndex); + return ( + a && (n = it(n, i, obj.atIndex)), + Object.assign(Object.assign({}, t), { + layoutState: Object.assign( + Object.assign({}, t.layoutState), + { [obj.array]: n }, + ), + }) + ); + }); }), - a + { layout: Ca.updateMinY(i), runHistory: n } ); - }, - ba = (e, t) => ({ object: e, index: t }), - Sa = (e) => Object.values(e).flat(); - function Ia(e, t, a, i) { - return "upDown" === t ? e - a / 2 + i * a : e + a / 2 - i * a; - } - function _a(e, t, a, i, n) { - const s = i % n, - o = s / n; - let r, l, c, d; - return ( - "upDown" === t - ? ((r = e - a / 2), (l = e + a / 2), (c = 1)) - : ((r = e + a / 2), (l = e - a / 2), (c = -1)), - (d = s === i % (2 * n) ? r + o * a * c : l - o * a * c), - d - ); - } - const va = ya({ - blocks: [ - ...Array.from({ length: 10 }).map((e, t) => - $.newBlock({ - x: et.initialPosition.x + t * M, - y: et.initialPosition.y - M, - }), - ), - ...Array.from({ length: 5 }).map((e, t) => - $.newBlock({ - x: et.initialPosition.x + t * M + 300, - y: et.initialPosition.y, - }), - ), - ], - }), - Ta = ya({ - blocks: Array.from({ length: 100 }).map((e, t) => - $.newBlock({ - x: et.initialPosition.x + t * M, - y: et.initialPosition.y - M, - }), - ), - }), - Ra = ya({ - blocks: Array.from({ length: 100 }).map((e, t) => - $.newBlock({ - x: et.initialPosition.x + t * M * 4.5, - y: et.initialPosition.y - M, - }), - ), - }), - Oa = ya({ - blocks: Array.from({ length: 100 }).map((e, t) => - $.newBlock({ - x: et.initialPosition.x + t * M * 4, - y: et.initialPosition.y - M + t * M, - }), - ), - }), - Ca = { - fillInPartial: ya, - sortLayout: ma, - setInViewLayoutAndState: function ( - layout, - frame, - a, - playerX, - playerY, - layoutState, - switchRot, - jumpSwitchRatio, - switchBlockSpikes, - layoutFirstIndexes, - inViewLayout, - inViewLayoutState, - fullLayoutStateIndexes, // optional? - fallTypes, - ) { - // const floorStates = inViewLayoutState.blocks.filter(e => e.isGround), - const p = layoutFirstIndexes; - for (const layoutKey in layout) { - if ("properties" === layoutKey) continue; - const g = layoutKey, - layoutValue = layout[g], - isEnemies = "enemies" === g; - let firstIndexes = layoutFirstIndexes[g]; - if (firstIndexes > 0) - if (isEnemies) firstIndexes = 0; - else { - const e = layoutValue[firstIndexes], - t = - firstIndexes >= layoutValue.length - 1 - ? void 0 - : layoutValue[firstIndexes + 1]; - if (ha(e, playerX) || (t && ha(t, playerX))) - for ( - ; - firstIndexes > 0 && - ha(layoutValue[firstIndexes - 1], playerX); - ) - firstIndexes--; - else firstIndexes = 0; - } - let E = null, - b = 0, - S = firstIndexes; - for (; S < layoutValue.length; ) { - const e = layoutValue[S], - l = pa( - e, - inViewLayout[g][b], - layoutState.enemies, - S, - playerX, - playerY, - frame, - a, - switchRot, - jumpSwitchRatio, - true, - fallTypes, - ); - if (null !== l) - (null === E && (E = S), - (fullLayoutStateIndexes[g][b] = S), - (inViewLayout[g][b] = l), - (inViewLayoutState[g][b] = layoutState[g][S]), - b++); - else if (!isEnemies && e.x > playerX && !ha(e, playerX)) { - if (layoutKey !== "blocks") { - break; // ugh. - } - } - S++; - } - (b < fullLayoutStateIndexes[g].length && - ((fullLayoutStateIndexes[g].length = b), - (inViewLayout[g].length = b), - (inViewLayoutState[g].length = b)), - (p[g] = null != E ? E : firstIndexes)); - } - // ! - if (switchBlockSpikes) { - const { blocks: e, spikes: t } = inViewLayout, - { blocks: a, spikes: i } = inViewLayoutState, - { blocks: n, spikes: s } = fullLayoutStateIndexes; - ((inViewLayout.blocks = t), - (inViewLayout.spikes = e), - (inViewLayoutState.blocks = i), - (inViewLayoutState.spikes = a), - (fullLayoutStateIndexes.blocks = s), - (fullLayoutStateIndexes.spikes = n)); - } - if (layout.properties.useGround) { - const { blocks: inViewLayoutBlocks } = inViewLayout, - { blocks: inViewLayoutStateBlocks } = inViewLayoutState, - { blocks: fullLayoutStateIndexesBlocks } = - fullLayoutStateIndexes; - for (let i = 0; i < 44; i++) { - inViewLayoutBlocks.push( - $.newBlock({ - x: i * M - 660 + Math.floor(playerX / M) * M, - y: et.initialPosition.y - M, - isBoss: layout.properties.theme.id !== "world1Boss", - isGround: true, - }), - ); - inViewLayoutStateBlocks.push({ - type: "blockSpikeState", - isBoss: layout.properties.theme.id !== "world1Boss", - isGround: true, - }); - fullLayoutStateIndexesBlocks.push( - Math.max(...fullLayoutStateIndexesBlocks) + 1, - ); - } - } - }, - getEmptyLayout: function (e) { - return { - properties: e, - blocks: [], - spikes: [], - platforms: [], - directionChanges: [], - speedChanges: [], - saws: [], - flags: [], - powerups: [], - enemies: [], - switchButtons: [], - switchPlatforms: [], - springs: [], - portals: [], - collectibles: [], - }; - }, - setLayoutAtTime: function (e, t, a, i, n, s, o, fallTypes) { - ["saws", "platforms", "switchPlatforms", "enemies"].forEach( - (r) => { - for (let l = 0; l < e[r].length; l++) - e[r][l] = pa( - e[r][l], - void 0, - t, - l, - a, - 0, - i, - n, - s, - o, - false, - fallTypes, - ); - }, - ); - }, - removeObject: function (e, t, a) { - if ("properties" === t) return e; - const i = e[t]; - return Object.assign(Object.assign({}, e), { [t]: at(i, a) }); - }, - removeObjects: function (e, t) { - const a = {}; - let i = e; - return ( - t.forEach(({ array: e, index: t }) => { - const n = a[e] || 0; - ((i = Ca.removeObject(i, e, t - n)), (a[e] = n + 1)); - }), - i - ); - }, - replaceObject: function (e, t, a, i) { - if ("properties" === t) return e; - const n = e[t]; - return Object.assign(Object.assign({}, e), { [t]: tt(n, i, a) }); - }, - insertObject: function (e, t, a, i) { - if ("properties" === t) return e; - const n = e[t]; - return Object.assign(Object.assign({}, e), { [t]: it(n, i, a) }); - }, - getAllLandableObjects: (e, t, a) => { - const i = e.platforms.map((e, t) => ({ object: e, index: t })); - return ( - a || lt(i, (e) => "rail" !== e.object.movement), - [ - ...Ea(e.blocks, t), - ...i, - ...e.switchPlatforms.map((e, t) => ({ object: e, index: t })), - ] - ); - }, - getAllDeadlyObjects: (e, t) => { - const a = e.spikes.map(ba); - lt(a, ({ index: e }) => !t.spikes[e].destroyed); - const i = e.saws.map(ba); - lt(i, ({ index: e }) => !t.saws[e].destroyed); - const n = e.enemies.map(ba); - return ( - lt(n, ({ index: e }) => !t.enemies[e].destroyed), - [...a, ...i, ...n] - ); - }, - removeCheckpoints: function (e) { - return Object.assign(Object.assign({}, e), { - flags: e.flags.filter((e) => "checkpoint" !== e.role), - }); - }, - initialLayout: va, - blocksFlat: Ta, - blocksFlatJumpDistance: Ra, - blocksUpJumpDistance: Oa, - getMinY: getMinY, - getMinYFromX: function ( - e, - { minX: t, minY: a, minYsByXDiv1000: i }, - ) { - const n = i[Math.ceil((e - t) / 1000)]; - return null == n ? a : n; - }, - updateMinY: function (e) { - const { properties: t } = e, - a = (function (e, t) { - var a = {}; - for (var i in e) - Object.prototype.hasOwnProperty.call(e, i) && - t.indexOf(i) < 0 && - (a[i] = e[i]); - if ( - null != e && - "function" == typeof Object.getOwnPropertySymbols - ) { - var n = 0; - for (i = Object.getOwnPropertySymbols(e); n < i.length; n++) - t.indexOf(i[n]) < 0 && - Object.prototype.propertyIsEnumerable.call(e, i[n]) && - (a[i[n]] = e[i[n]]); - } - return a; - })(e, ["properties"]); - return Object.assign(Object.assign({}, e), { - properties: Object.assign(Object.assign({}, e.properties), { - minY: getMinY(a), - }), - }); - }, - updateTheme: function (e, t) { - return Object.assign(Object.assign({}, e), { - properties: Object.assign(Object.assign({}, e.properties), { - theme: t, - }), - }); - }, - updateGround: function (e, t) { - return Object.assign(Object.assign({}, e), { - properties: Object.assign(Object.assign({}, e.properties), { - useGround: t, - }), - }); - }, - getAllObjects: Sa, - getAllNearbyObjects: (e, t, a, i, n) => { - const s = be.rectTouchesRect({ - x: t, - y: a, - width: i + 150, - height: n + 150, - }); - return Object.values(e).flat().filter(s); - }, - getUpDownObjectYAtFrame: _a, - inViewAreaWidth: da, - inViewAreaHeight: 450, - getInitFirstIndexes: function () { - return { - blocks: 0, - spikes: 0, - platforms: 0, - directionChanges: 0, - speedChanges: 0, - saws: 0, - flags: 0, - powerups: 0, - enemies: 0, - switchButtons: 0, - switchPlatforms: 0, - springs: 0, - portals: 0, - collectibles: 0, - }; - }, - isObjectInViewX: ha, - addBlocksFlat: (e) => { - var t; - const a = - null === (t = e.flags.find((e) => "endOfLevel" === e.role)) || - void 0 === t - ? void 0 - : t.x; - return void 0 === a - ? e - : ma( - Object.assign(Object.assign({}, e), { - blocks: e.blocks.concat( - Array.from({ length: Math.ceil(a / M) + 40 }).map( - (e, t) => - $.newBlock({ - x: et.initialPosition.x + (t - 15) * M, - y: et.initialPosition.y - M, - }), - ), + } + case "moveObjects": { + let i = t, + n = a; + return ( + e.objects.forEach((obj) => { + const a = t[obj.array][obj.index]; + if (a.x === obj.x && a.y === obj.y) return; + const s = $.updateXY(a, obj.x, obj.y); + ((i = Ca.replaceObject(i, obj.array, obj.index, s)), + xa.isStatefulArrayThatResetsOnMove(obj.array) && + (n = n.map((t) => + Object.assign(Object.assign({}, t), { + layoutState: Object.assign( + Object.assign({}, t.layoutState), + { + [obj.array]: tt( + t.layoutState[obj.array], + //!! + xa.getInitStateForArray(obj.array, i, obj), + obj.index, + ), + }, ), }), - ); - }, - clone: function (e) { - return { - properties: e.properties, - blocks: [...e.blocks], - spikes: [...e.spikes], - platforms: [...e.platforms], - directionChanges: [...e.directionChanges], - speedChanges: [...e.speedChanges], - saws: [...e.saws], - flags: [...e.flags], - powerups: [...e.powerups], - enemies: [...e.enemies], - switchButtons: [...e.switchButtons], - switchPlatforms: [...e.switchPlatforms], - springs: [...e.springs], - portals: [...e.portals], - collectibles: [...e.collectibles], - }; - }, - }; - function wa(e, t, i) { - //* - //console.warn(e,t,i) - switch (e) { - case "blocks": - var block = { - type: "blockSpikeState", - }; - //t && t.blocks[i.index]?.init && console.warn(t.blocks[i.index], block); - return block; - case "spikes": - return { type: "blockSpikeState" }; - case "saws": - return { type: "sawState", inverse: Math.random() > 0.5 }; - case "directionChanges": - return { type: "directionChangeState", wasHit: false }; - case "speedChanges": - return { type: "speedChangeState" }; - case "flags": - return { type: "flagState", wasHit: false }; - case "enemies": - return { - type: "enemyState", - framesSeen: 0, - offsetX: 0, - offsetY: 0, - bullet: null, - speedY: 0, - direction: - t == undefined ? -1 : t.enemies[i.index]?.enemyDir || -1, - }; - case "powerups": - return { type: "powerupState", wasPickedUp: false }; - case "platforms": - return { type: "platformState" }; - case "switchButtons": - return { type: "switchButtonState", isPressedCounter: 0 }; - case "switchPlatforms": - return { type: "switchPlatformState" }; - case "springs": - return { type: "springState" }; - case "portals": - return { type: "portalState" }; - case "collectibles": - return { type: "collectibleState", wasPickedUp: false }; + ))); + }), + { layout: Ca.updateMinY(i), runHistory: n } + ); } - } - const destroyableObjects = ["saws", "blocks", "spikes", "enemies"], - missleObjects = destroyableObjects.filter((e) => "blocks" !== e); - function Na(e, t, a, i, n, s, o) { - let r = e; - (o && - ("blocks" === r - ? (r = "spikes") - : "spikes" === r && (r = "blocks")), - (n[e][t] = a)); - const l = s[e][t]; - i[r][l] = a; - } - var overlapObjects = false, - mirrorMenuButton = false, - alternativeMenuMusic = false; - const xa = { - getInitState: function (e, t, i) { + case "setProperty": { + const i = t[e.array], + n = i[e.index], + s = e.set(n, t); + if (null === s) return { layout: t, runHistory: a }; + const o = tt(i, s, e.index); return { - blocks: e.blocks.map((j) => - wa(j.array, e, { - array: j.array, - x: j.x, - y: j.y, - index: e.blocks.indexOf(j), - }), - ), - spikes: e.spikes.map((j) => wa(j.array)), - saws: e.saws.map((j) => - wa(j.array, e, { - array: j.array, - x: j.x, - y: j.y, - index: e.saws.indexOf(j), - }), + layout: Ca.updateMinY( + Object.assign(Object.assign({}, t), { [e.array]: o }), ), - directionChanges: e.directionChanges.map((j) => wa(j.array)), - speedChanges: e.speedChanges.map((j) => wa(j.array)), - flags: e.flags.map((j) => wa(j.array)), - enemies: e.enemies.map((j) => - wa(j.array, e, { - array: j.array, - x: j.x, - y: j.y, - index: e.enemies.indexOf(j), - }), + runHistory: a, + }; + } + case "eraseObjects": { + let i = a; + const n = e.objects.filter((e) => "portals" === e.array), + s = []; + let o; + return ( + n.forEach((e) => { + const a = t.portals[e.index], + i = t.portals.findIndex( + (e) => e.pairId === a.pairId && e.pair !== a.pair, + ); + n.some((e) => e.index === i) || + s.push({ array: "portals", index: i }); + }), + (o = + s.length > 0 + ? [...e.objects, ...s].sort((e, t) => e.index - t.index) + : e.objects), + o.forEach((e) => { + i = i.map((t) => { + const a = t.layoutState[e.array]; + return Object.assign(Object.assign({}, t), { + layoutState: Object.assign( + Object.assign({}, t.layoutState), + { + [e.array]: [ + ...a.slice(0, e.index), + ...a.slice(e.index + 1), + ], + }, + ), + }); + }); + }), + { layout: Ca.updateMinY(Ca.removeObjects(t, o)), runHistory: i } + ); + } + case "changeTheme": + return { + layout: Ca.updateGround( + Ca.updateTheme(t, e.theme), + e.useGround, ), - powerups: e.powerups.map((j) => wa(j.array)), - platforms: e.platforms.map((j) => wa(j.array)), - switchButtons: e.switchButtons.map((j) => wa(j.array)), - switchPlatforms: e.switchPlatforms.map((j) => wa(j.array)), - springs: e.springs.map((j) => wa(j.array)), - portals: e.portals.map((j) => wa(j.array)), - collectibles: e.collectibles.map((j) => wa(j.array)), + runHistory: a, + newAssets: e.theme.id !== t.properties.theme.id, }; - }, - getInitStateForArray: wa, - getEmptyStateIndexes: function () { + } + } + function Fa(e, t) { + switch (e.type) { + case "placeObjects": return { - blocks: [], - spikes: [], - platforms: [], - directionChanges: [], - speedChanges: [], - saws: [], - flags: [], - powerups: [], - enemies: [], - switchButtons: [], - switchPlatforms: [], - springs: [], - portals: [], - collectibles: [], + type: "undoPlaceObjects", + objects: e.objects.map((e) => ({ + array: e.array, + index: e.atIndex, + })), + }; + case "moveObjects": + return { + type: "undoMoveObjects", + objects: e.objects.map((e) => { + const { x: a, y: i } = t[e.array][e.index]; + return Object.assign(Object.assign({}, e), { x: a, y: i }); + }), + }; + case "eraseObjects": + return { + type: "undoEraseObjects", + objects: e.objects.map((e) => ({ + array: e.array, + atIndex: e.index, + levelObject: t[e.array][e.index], + })), + }; + case "setProperty": + return { + type: "undoSetProperty", + array: e.array, + index: e.index, + object: t[e.array][e.index], + }; + case "changeTheme": + return { + type: "undoChangeTheme", + theme: t.properties.theme, + useGround: t.properties.useGround, + }; + } + } + const loopingSpriteSheet = makeSprite({ + render({ props: e }) { + const t = ja(e.frameRate, e.rows, e.columns, e.maxIndex); + return [ + spriteSheetPrimitive( + { + fileName: e.fileName, + columns: e.columns, + rows: e.rows, + index: 0, + width: e.width, + height: e.height, + }, + (a) => { + const i = e.frame % (t + 1); + a.index = Math.floor(i / e.frameRate); + }, + ), + ]; + }, + }), + triggerableSpriteSheet = makeSprite({ + init({ props: e }) { + const t = ja(e.frameRate, e.rows, e.columns, e.maxIndex); + return { + frame: Math.min(e.startFrame || 0, t - 1), + maxFrame: ja(e.frameRate, e.rows, e.columns, e.maxIndex), }; }, - isStatefulArrayThatResetsOnMove: function (e) { - return [ - "enemies", - "blocks", - "spikes", - "saws", - "switchButtons", - "platforms", - ].includes(e); + loop({ state: e, props: t }) { + t.paused || + e.frame === e.maxFrame - 1 || + (e.frame === e.maxFrame - 2 && t.onEnd && t.onEnd(), + (e.frame += t.df)); }, - updateHitBulletState: function ( - frame, - layout, - layoutState, - bullets, - n, - s, - o, - ) { - for (let i = 0; i < bullets.length; i++) { - const hit = be.rectTouchesRect(bullets[i]); - for (const destroyableType of destroyableObjects) - for ( - let objIndex = 0; - objIndex < layout[destroyableType].length; - objIndex++ - ) { - const obj = layout[destroyableType][objIndex], - state = layoutState[destroyableType][objIndex], - sign = Math.sign(bullets[i].speed); - if (obj?.steel && hit(obj)) { - return ( - Na( - destroyableType, - objIndex, - state, - n, - layoutState, - s, - o, - ), - (bullets[i].x = - obj.x - - (obj.width / 2) * sign - - bullets[i].width / (2 * sign)), - (bullets[i].frame = 1) - ); - } - - if (!state.destroyed && !state.off && hit(obj)) - return ( - Na( - destroyableType, - objIndex, - Object.assign(Object.assign({}, state), { - destroyed: { - frame: frame, - x: obj.x, - y: obj.y, - by: "gun", - }, - }), - n, - layoutState, - s, - o, - ), - void bullets.splice(i, 1) - ); - } + render: ({ state: e, props: t }) => [ + ifConditional( + () => !(t.hideOnEnd && e.frame === e.maxFrame - 1), + () => [ + loopingSpriteSheet.Single( + { + fileName: t.fileName, + columns: t.columns, + rows: t.rows, + frameRate: t.frameRate, + width: t.width, + height: t.height, + frame: Math.floor(e.frame), + }, + (t) => { + t.frame = Math.floor(e.frame); + }, + ), + ], + ), + ], + }), + ja = (e, t, a, i) => e * Math.min(t * a, null != i ? i : 999999) - 1, + Ga = function (e, t, a, i) { + a.muteSfx || t.audio(e).play(i); + }, + Va = (e) => e.scale > 0, + Ha = (e) => e.scale <= e.maxScale, + //death anim + Xa = makeSprite({ + init({ props: e, device: t }) { + const a = Array.from({ length: 12 }, () => ({ + angle: 360 * t.random(), + speed: 3 + 6 * t.random(), + rotation: 360 * t.random(), + opacity: 0.5, + scale: 1 - 0.2 * t.random(), + radius: 30 * t.random(), + })), + i = Array.from({ length: 25 }, () => ({ + scale: 0, + maxScale: 1 * t.random() + 1, + x: 0, + y: 0, + rotation: 360 * t.random(), + speedX: 6 * t.random() - 3, + speedY: 8 * t.random(), + })); + return { + justDestroyed: e.justDestroyed, + triangles: a, + squares: i, + }; + }, + loop({ state: e, props: t }) { + if (!t.paused) { + for (const t of e.triangles) + ((t.radius = t.radius + t.speed), + (t.opacity = 1), + (t.scale = t.scale - 0.1), + (t.speed = t.speed + 0.2)); + lt(e.triangles, Va); + for (const t of e.squares) + ((t.scale = t.scale + 0.02), + (t.x = t.x + t.speedX), + (t.y = t.y + t.speedY), + (t.speedY = t.speedY - 0.3)); + lt(e.squares, Ha); } }, - updateHitPunchState: function (e, t, a, i, n, s, o, r, l, scale) { - const c = be.rectTouchesRect({ - x: i + s * ($.punchWidth / 2) * scale, - y: n + 10 * scale, - width: $.punchWidth * scale, - height: 40 * scale, - }); - for (const i of destroyableObjects) - for (let n = 0; n < t[i].length; n++) { - const s = t[i][n], - d = a[i][n]; - if (s?.steel && c(s)) { - Na(i, n, d, o, a, r, l); - } else { - !d.destroyed && - !d.off && - c(s) && - Na( - i, - n, - Object.assign(Object.assign({}, d), { - destroyed: { frame: e, x: s.x, y: s.y, by: "gun" }, - }), - o, - a, - r, - l, - ); - } - } - }, - updateHitDrillState: function ( - frame, - t, - a, - playerX, - playerY, - dir, - layoutState, - r, - l, - scale, - ) { - var blocksKilled = 0; - const c = be.rectTouchesRect({ - x: playerX, - y: playerY + (-$.punchWidth / 2) * scale, - width: $.drillWidth * scale, - height: $.punchWidth * scale, - }); - for (const i of destroyableObjects) - for (let n = 0; n < t[i].length; n++) { - const s = t[i][n], - d = a[i][n]; - if (s?.steel && c(s)) { - Na(i, n, d, layoutState, a, r, l); - } else { - !d.destroyed && - !d.off && - c(s) && - (Na( - i, - n, - Object.assign(Object.assign({}, d), { - destroyed: { frame: frame, x: s.x, y: s.y, by: "gun" }, - }), - layoutState, - a, - r, - l, - ), - blocksKilled++); - } - } - return blocksKilled; - }, - useMissiles: function (e, t, a, i, n, s, o, r) { - for (const l of missleObjects) - for (let c = 0; c < t[l].length; c++) { - const d = t[l][c], - u = a[l][c]; - ("skipMissiles" in d && false !== d.skipMissiles) || - u.destroyed || - u.off || - !be.pointInBox({ x: i, y: n, width: 840, height: 240 })(d) || - Na( - l, - c, - Object.assign(Object.assign({}, u), { - destroyed: { frame: e, x: d.x, y: d.y, by: "missile" }, - }), - s, - a, - o, - r, - ); - } - }, - sortLayoutState: function (e, t) { - const a = (a) => { - const i = t[a] - .map((t, i) => ({ object: t, state: e[a][i], index: i })) - .sort( - ({ object: e }, { object: t }) => e.x - t.x || e.y - t.y, - ); - return { - state: i.map(({ state: e }) => e), - originalIndexes: i.map(({ index: e }) => e), - }; - }, - i = a("blocks"), - n = a("spikes"), - s = a("platforms"), - o = a("directionChanges"), - r = a("speedChanges"), - l = a("saws"), - c = a("flags"), - d = a("powerups"), - u = a("enemies"), - h = a("switchButtons"), - p = a("switchPlatforms"), - g = a("springs"), - m = a("portals"), - f = a("collectibles"); - return { - sortedState: { - blocks: i.state, - spikes: n.state, - platforms: s.state, - directionChanges: o.state, - speedChanges: r.state, - saws: l.state, - flags: c.state, - powerups: d.state, - enemies: u.state, - switchButtons: h.state, - switchPlatforms: p.state, - springs: g.state, - portals: m.state, - collectibles: f.state, - }, - originalIndexes: { - blocks: i.originalIndexes, - spikes: n.originalIndexes, - platforms: s.originalIndexes, - directionChanges: o.originalIndexes, - speedChanges: r.originalIndexes, - saws: l.originalIndexes, - flags: c.originalIndexes, - powerups: d.originalIndexes, - enemies: u.originalIndexes, - switchButtons: h.originalIndexes, - switchPlatforms: p.originalIndexes, - springs: g.originalIndexes, - portals: m.originalIndexes, - collectibles: f.originalIndexes, - }, - }; - }, - unsortLayoutState: function (e, t) { - const a = (a) => { - const i = Array.from({ length: e[a].length }); - return ( - t[a].forEach((t, n) => { - i[t] = e[a][n]; + render: ({ state: e, props: t }) => [ + ifConditional( + () => e.justDestroyed, + () => [ + g({ + props: () => ({ + color: t.bottomColour, + width: 6, + height: 6, + }), + update: (e, t) => { + ((e.scaleX = t.scale), + (e.scaleY = t.scale), + (e.x = t.x), + (e.y = t.y), + (e.rotation = t.rotation), + (e.opacity = + t.maxScale - t.scale < 0.3 + ? t.maxScale - t.scale + : 1)); + }, + array: () => e.squares, }), - i - ); - }; - return { - blocks: a("blocks"), - spikes: a("spikes"), - platforms: a("platforms"), - directionChanges: a("directionChanges"), - speedChanges: a("speedChanges"), - saws: a("saws"), - flags: a("flags"), - powerups: a("powerups"), - enemies: a("enemies"), - switchButtons: a("switchButtons"), - switchPlatforms: a("switchPlatforms"), - springs: a("springs"), - portals: a("portals"), - collectibles: a("collectibles"), - }; - }, - layoutConsistentWithState: function (e, t) { - return Object.entries(e).every(([e, a]) => { - const i = t[e]; - return !i || !Array.isArray(i) || i.length === a.length; - }); - }, - updateLayoutStateField: Na, - clone: function (e) { + f({ + props: () => ({ + fillColor: t.colour, + path: [ + [-15, -15], + [0, 15], + [15, -15], + ], + }), + update: (e, t) => { + ((e.x = t.radius * Math.cos(B.toRad(t.angle))), + (e.y = t.radius * Math.sin(B.toRad(t.angle))), + (e.opacity = t.opacity), + (e.scaleX = t.scale), + (e.scaleY = t.scale), + (e.rotation = t.rotation)); + }, + array: () => e.triangles, + }), + ], + ), + ], + }), + za = makeSprite({ + init({ device: e, props: t, getContext: a }) { + const i = Math.round(10 * e.random()) + 10, + n = (t.objectX - t.playerX) / i, + s = 20 * e.random() - 10; + if (t.justDestroyed) { + const { settings: t } = a(Se); + Ga("audio/levels/missile.wav", e, t, { + fromPosition: 0, + overwrite: true, + }); + } return { - blocks: [...e.blocks], - spikes: [...e.spikes], - saws: [...e.saws], - platforms: [...e.platforms], - directionChanges: [...e.directionChanges], - speedChanges: [...e.speedChanges], - flags: [...e.flags], - enemies: [...e.enemies], - powerups: [...e.powerups], - switchButtons: [...e.switchButtons], - switchPlatforms: [...e.switchPlatforms], - springs: [...e.springs], - portals: [...e.portals], - collectibles: [...e.collectibles], + justDestroyed: t.justDestroyed, + missileFrames: i, + speedX: n, + speedY: s, + position: [[t.playerX, t.playerY]], + frame: 0, + pos: { x: t.objectX, y: t.objectY }, }; }, - }; - const Pa = (e, t) => { - if (overlapObjects) return true; - const allRectangles = t.flatMap($.getRectangles); - let i; - if (allRectangles.length > 1) { - const t = allRectangles.reduce( - (e, t) => ({ - minX: Math.min(t.x - t.width / 2, e.minX), - maxX: Math.max(t.x + t.width / 2, e.maxX), - minY: Math.min(t.y - t.height / 2, e.minY), - maxY: Math.max(t.y + t.height / 2, e.maxY), - }), - { - minX: 99999999, - maxX: -99999999, - minY: 99999999, - maxY: -99999999, - }, - ); - i = Ma(e, { - x: (t.maxX + t.minX) / 2, - width: t.maxX - t.minX, - y: (t.maxY + t.minY) / 2, - height: t.maxY - t.minY, - }); - } else i = Ma(e); - const n = i.some((e) => - allRectangles.some( - (t) => be.rectTouchesRect(e)(t) && !t.ignore, - ), - ), - s = t.some((e, a) => { - const i = $.getRectangles(e); - return t - .filter((e, t) => a !== t) - .flatMap($.getRectangles) - .some((e) => - i.some((t) => be.rectTouchesRect(e)(t) && !t.ignore), - ); - }); - return !n && !s; + loop({ state: e, props: t }) { + if (t.paused) return; + if ( + ((e.pos.x = t.objectX), + (e.pos.y = t.objectY), + e.frame++, + e.frame >= e.missileFrames) + ) + return void e.position.pop(); + const [a, i] = e.position[0]; + if (e.frame > e.missileFrames / 2) { + const a = (t.objectY - i) / 3; + e.speedY += (a - e.speedY) / 3; + } + const n = a + e.speedX, + s = i + e.speedY; + (e.position.unshift([n, s]), + Wa < e.position.length && (e.position.length = Wa)); }, - Ma = (e, t) => { - const { properties: a } = e, - i = (function (e, t) { - var a = {}; - for (var i in e) - Object.prototype.hasOwnProperty.call(e, i) && - t.indexOf(i) < 0 && - (a[i] = e[i]); - if ( - null != e && - "function" == typeof Object.getOwnPropertySymbols - ) { - var n = 0; - for (i = Object.getOwnPropertySymbols(e); n < i.length; n++) - t.indexOf(i[n]) < 0 && - Object.prototype.propertyIsEnumerable.call(e, i[n]) && - (a[i[n]] = e[i[n]]); - } - return a; - })(e, ["properties"]); + render({ state: e, props: t }) { + const a = () => e.frame >= e.missileFrames; return [ - ...(t - ? Ca.getAllNearbyObjects(i, t.x, t.y, t.width, t.height) - : Ca.getAllObjects(i) - ).flatMap($.getRectangles), - { - x: et.initialPosition.x, - y: et.initialPosition.y, - width: M, - height: M, - }, - ]; - }; - function La(e, t, a = -1) { - let i = 1000; - for (; !Pa(e, t) && i > 0; ) - (i--, - (t = t.map((e) => { - const { x: t, y: i } = V( - { x: e.x + M / 2, y: e.y + a * (M / 2) }, - e.snapSize, - ); - return $.updateXY(e, t, i); - }))); - return 0 === i ? null : t; - } - const Da = { - canPlaceLevelObject: (e, t) => - !Ma(e).some((e) => $.getRectangles(t).some(be.rectTouchesRect(e))), - canPlaceLevelObjects: Pa, - moveObjectUntilCanPlace: function (e, t, a = -1) { - const i = La(e, [t], a); - return i ? i[0] : null; - }, - moveObjectsUntilCanPlace: La, - }; - function Ba(e, t, a) { - switch (e.type) { - case "placeObjects": { - let i = t, - n = a; - return ( - e.objects.forEach((obj) => { - const t = Da.moveObjectUntilCanPlace(i, obj.levelObject); - if (!t) return; - let a = false; - if ("portal" === t.type) { - const n = $.addPortalPairId(t, i); - i = Ca.insertObject(i, obj.array, obj.atIndex, n); - const s = Da.moveObjectUntilCanPlace(i, $.newPortalPair(n)); - if (!s) return; - ((a = true), - (i = Ca.insertObject(i, obj.array, obj.atIndex, s))); - } else i = Ca.insertObject(i, obj.array, obj.atIndex, t); - n = n.map((t) => { - const i = xa.getInitStateForArray( - obj.array, - { blocks: e.objects, enemies: e.objects, saws: e.saws }, - obj.levelObject, - ); - let n = it(t.layoutState[obj.array], i, obj.atIndex); - return ( - a && (n = it(n, i, obj.atIndex)), - Object.assign(Object.assign({}, t), { - layoutState: Object.assign( - Object.assign({}, t.layoutState), - { [obj.array]: n }, - ), - }) - ); - }); - }), - { layout: Ca.updateMinY(i), runHistory: n } - ); - } - case "moveObjects": { - let i = t, - n = a; - return ( - e.objects.forEach((obj) => { - const a = t[obj.array][obj.index]; - if (a.x === obj.x && a.y === obj.y) return; - const s = $.updateXY(a, obj.x, obj.y); - ((i = Ca.replaceObject(i, obj.array, obj.index, s)), - xa.isStatefulArrayThatResetsOnMove(obj.array) && - (n = n.map((t) => - Object.assign(Object.assign({}, t), { - layoutState: Object.assign( - Object.assign({}, t.layoutState), - { - [obj.array]: tt( - t.layoutState[obj.array], - //!! - xa.getInitStateForArray(obj.array, i, obj), - obj.index, - ), - }, - ), - }), - ))); - }), - { layout: Ca.updateMinY(i), runHistory: n } - ); - } - case "setProperty": { - const i = t[e.array], - n = i[e.index], - s = e.set(n, t); - if (null === s) return { layout: t, runHistory: a }; - const o = tt(i, s, e.index); - return { - layout: Ca.updateMinY( - Object.assign(Object.assign({}, t), { [e.array]: o }), - ), - runHistory: a, - }; - } - case "eraseObjects": { - let i = a; - const n = e.objects.filter((e) => "portals" === e.array), - s = []; - let o; - return ( - n.forEach((e) => { - const a = t.portals[e.index], - i = t.portals.findIndex( - (e) => e.pairId === a.pairId && e.pair !== a.pair, - ); - n.some((e) => e.index === i) || - s.push({ array: "portals", index: i }); - }), - (o = - s.length > 0 - ? [...e.objects, ...s].sort((e, t) => e.index - t.index) - : e.objects), - o.forEach((e) => { - i = i.map((t) => { - const a = t.layoutState[e.array]; - return Object.assign(Object.assign({}, t), { - layoutState: Object.assign( - Object.assign({}, t.layoutState), - { - [e.array]: [ - ...a.slice(0, e.index), - ...a.slice(e.index + 1), - ], - }, - ), - }); - }); - }), - { layout: Ca.updateMinY(Ca.removeObjects(t, o)), runHistory: i } - ); - } - case "changeTheme": - return { - layout: Ca.updateGround( - Ca.updateTheme(t, e.theme), - e.useGround, - ), - runHistory: a, - newAssets: e.theme.id !== t.properties.theme.id, - }; - } - } - function Fa(e, t) { - switch (e.type) { - case "placeObjects": - return { - type: "undoPlaceObjects", - objects: e.objects.map((e) => ({ - array: e.array, - index: e.atIndex, - })), - }; - case "moveObjects": - return { - type: "undoMoveObjects", - objects: e.objects.map((e) => { - const { x: a, y: i } = t[e.array][e.index]; - return Object.assign(Object.assign({}, e), { x: a, y: i }); - }), - }; - case "eraseObjects": - return { - type: "undoEraseObjects", - objects: e.objects.map((e) => ({ - array: e.array, - atIndex: e.index, - levelObject: t[e.array][e.index], - })), - }; - case "setProperty": - return { - type: "undoSetProperty", - array: e.array, - index: e.index, - object: t[e.array][e.index], - }; - case "changeTheme": - return { - type: "undoChangeTheme", - theme: t.properties.theme, - useGround: t.properties.useGround, - }; - } - } - const loopingSpriteSheet = makeSprite({ - render({ props: e }) { - const t = ja(e.frameRate, e.rows, e.columns, e.maxIndex); - return [ - spriteSheetPrimitive( - { - fileName: e.fileName, - columns: e.columns, - rows: e.rows, - index: 0, - width: e.width, - height: e.height, - }, - (a) => { - const i = e.frame % (t + 1); - a.index = Math.floor(i / e.frameRate); - }, - ), - ]; - }, - }), - triggerableSpriteSheet = makeSprite({ - init({ props: e }) { - const t = ja(e.frameRate, e.rows, e.columns, e.maxIndex); - return { - frame: Math.min(e.startFrame || 0, t - 1), - maxFrame: ja(e.frameRate, e.rows, e.columns, e.maxIndex), - }; - }, - loop({ state: e, props: t }) { - t.paused || - e.frame === e.maxFrame - 1 || - (e.frame === e.maxFrame - 2 && t.onEnd && t.onEnd(), - (e.frame += t.df)); - }, - render: ({ state: e, props: t }) => [ ifConditional( - () => !(t.hideOnEnd && e.frame === e.maxFrame - 1), + () => e.justDestroyed, () => [ - loopingSpriteSheet.Single( + onChange( + () => a(), + () => [t.getSprite(a(), e.pos)], + ), + m( + { + thickness: 5, + lineCap: "round", + color: "#854107", + opacity: 0.6, + }, + (t) => { + const a = Math.max(0, e.frame - e.missileFrames), + i = e.position.slice(0, Math.max(0, 7 - a)); + t.path = i; + }, + ), + m( + { + thickness: 6, + lineCap: "round", + color: "#E79A0D", + opacity: 0.6, + }, + (t) => { + const a = Math.max(0, e.frame - e.missileFrames), + i = e.position.slice(0, Math.max(0, 4 - a)); + t.path = i; + }, + ), + m( { - fileName: t.fileName, - columns: t.columns, - rows: t.rows, - frameRate: t.frameRate, - width: t.width, - height: t.height, - frame: Math.floor(e.frame), + thickness: 7, + lineCap: "round", + color: "#FEFD58", + opacity: 0.6, }, (t) => { - t.frame = Math.floor(e.frame); + const a = Math.max(0, e.frame - e.missileFrames), + i = e.position.slice(0, Math.max(0, 3 - a)); + t.path = i; + }, + ), + m( + { + thickness: 8, + lineCap: "round", + color: "#FDFDE0", + opacity: 0.6, + }, + (t) => { + const a = Math.max(0, e.frame - e.missileFrames), + i = e.position.slice(0, Math.max(0, 2 - a)); + t.path = i; }, ), ], ), - ], - }), - ja = (e, t, a, i) => e * Math.min(t * a, null != i ? i : 999999) - 1, - Ga = function (e, t, a, i) { - a.muteSfx || t.audio(e).play(i); + ]; }, - Va = (e) => e.scale > 0, - Ha = (e) => e.scale <= e.maxScale, - //death anim - Xa = makeSprite({ - init({ props: e, device: t }) { - const a = Array.from({ length: 12 }, () => ({ - angle: 360 * t.random(), - speed: 3 + 6 * t.random(), - rotation: 360 * t.random(), - opacity: 0.5, - scale: 1 - 0.2 * t.random(), - radius: 30 * t.random(), - })), - i = Array.from({ length: 25 }, () => ({ - scale: 0, - maxScale: 1 * t.random() + 1, - x: 0, - y: 0, - rotation: 360 * t.random(), - speedX: 6 * t.random() - 3, - speedY: 8 * t.random(), - })); - return { - justDestroyed: e.justDestroyed, - triangles: a, - squares: i, - }; - }, - loop({ state: e, props: t }) { - if (!t.paused) { - for (const t of e.triangles) - ((t.radius = t.radius + t.speed), - (t.opacity = 1), - (t.scale = t.scale - 0.1), - (t.speed = t.speed + 0.2)); - lt(e.triangles, Va); - for (const t of e.squares) - ((t.scale = t.scale + 0.02), - (t.x = t.x + t.speedX), - (t.y = t.y + t.speedY), - (t.speedY = t.speedY - 0.3)); - lt(e.squares, Ha); - } - }, - render: ({ state: e, props: t }) => [ - ifConditional( - () => e.justDestroyed, - () => [ - g({ - props: () => ({ - color: t.bottomColour, - width: 6, - height: 6, - }), - update: (e, t) => { - ((e.scaleX = t.scale), - (e.scaleY = t.scale), - (e.x = t.x), - (e.y = t.y), - (e.rotation = t.rotation), - (e.opacity = - t.maxScale - t.scale < 0.3 - ? t.maxScale - t.scale - : 1)); + }), + Wa = 6, + qa = makeSprite({ + init({ device: e, props: t }) { + if (t.justDestroyed && false !== t.sfx) { + const t = st(1, 3, e.random); + e.audio(`audio/levels/explosion${t}.wav`).play({ + fromPosition: 0, + overwrite: true, + }); + } + }, + render: ({ props: e }) => [ + conditional( + () => "pixel" === e.trail.form, + () => [ + triggerableSpriteSheet.Single( + { + fileName: "images/player/pixel-explosion.png", + columns: 4, + rows: 2, + frameRate: 3, + width: 73, + height: 110, + paused: e.paused, + rotation: e.playerRot, + df: e.df, + scaleX: e.playerScale, + scaleY: e.playerScale + }, + (t) => { + ((t.paused = e.paused), + (t.rotation = e.playerRot), + (t.df = e.df)); + }, + ), + ], + () => [ + Xa.Single( + { + justDestroyed: e.justDestroyed, + colour: e.trail.topColour, + bottomColour: e.trail.bottomColour, + paused: e.paused, + scaleX: e.playerScale, + scaleY: e.playerScale + }, + (t) => { + ((t.justDestroyed = e.justDestroyed), + (t.colour = e.trail.topColour), + (t.bottomColour = e.trail.bottomColour), + (t.paused = e.paused)); + }, + ), + ], + ), + ], + }), + $a = (e, t) => e >= t - 10, + getBlockFallY = (x, y, playerX, fallTypes, playerDir) => { + if (typeof fallTypes == "undefined" || fallTypes === null) { + return y; + } + if (typeof playerX == "undefined" || playerX === null) { + return y; + } + let newY = y; + let playerXOffset; + if (fallTypes[1] === "up") { + playerXOffset = (playerX + 270 * playerDir - x) * 3 * playerDir; + if (playerXOffset < 0) { + newY += playerXOffset; + } + } + if (fallTypes[0] === "down") { + playerXOffset = -(playerX - 60 * playerDir - x) * playerDir; + if (playerXOffset < 0) { + newY += playerXOffset; + } + } + return newY; + }, + fadeFunction = (s, i) => ( + (s ? s.crashed ? 1 : Math.min((Math.abs(s.playerX - i.x) - 150) / 120, 1) : 1) * 0.8 + ), + isSpecialTheme = (e) => e === "classic" || e === "infinite", + infiniteBgTable = function (i, clr) { + return ( + [ + { + "#FF0000": "#f6d4c5", + "#ffea00": "#f8ecb7", + "#00FF00": "#ceeed7", + "#0000ff": "#c3e6e7", + "#8000ff": "#f8cef6", + "#ff00ff": "#f8cee7", + "#ffFFff": "#e7e7e7", + "#000000": "#4f4f4f", + }, + { + "#FF0000": "#f5c8b7", + "#ffea00": "#F5E190", + "#00FF00": "#bee8c9", + "#0000ff": "#b4d8ea", + "#8000ff": "#f5c1f7", + "#ff00ff": "#f7c1e2", + "#ffFFff": "#d8d8d8", + "#000000": "#383838", + }, + ][i][clr] || (i ? "#76d7d6" : "#89dde1") + ); + }, + getInfiniteThemePath = (bgColor) => { + let table = { + "#FF0000": "red", + "#ffea00": "yellow", + "#00FF00": "green", + "#0000ff": "blue", + "#8000ff": "purple", + "#ff00ff": "pink", + "#ffFFff": "white", + "#000000": "black", + }; + return `infinite/colors/${table[bgColor] || "default"}` + }, + getInfiniteThemeColors = (bgColor) => { + let table = { + "#FF0000": "#2257a3", + "#ffea00": "#6c40c1", + "#00FF00": "#b23e17", + "#0000ff": "#860795", + "#8000ff": "#387330", + "#ff00ff": "#0b8071", + "#ffFFff": "#1c1c1c", + "#000000": "#FFFFFF", + }; + return table[bgColor] || "#9e1808"; + }, + getInfinitePlayerColors = (bgColor) => { + let table = { + "#FF0000": "#cf4f1e", + "#ffea00": "#d48101", + "#00FF00": "#089d72", + "#0000ff": "#2e1b8e", + "#8000ff": "#af4af3", + "#ff00ff": "#ac089b", + "#ffFFff": "#FFFFFF", + "#000000": "#1c1c1c", + }; + return table[bgColor] || "#035c74"; + }, + Ja = makeSprite({ + render: ({ props: e }) => [ + onChange( + () => e.theme, + () => { + const t = "world3" === e.theme ? 41 / 30 : 1; + return [ + imageArray({ + fileName: `images/themes/${e.theme}/block.png`, + props: () => ({}), + update: (a, i, n) => { + var s, o; + const r = + null === + (o = + null === (s = e.inGame) || void 0 === s + ? void 0 + : s.blockStates) || void 0 === o + ? void 0 + : o[n], + gravity = e.inGame?.gravity || 1; + ((a.show = + (e.theme == "world2" + ? i.width !== $.miniBlockWidth + : true) && + !i?.steel && + !(i == undefined ? false : i.init) && + !i.isVoid && + !i.isBoss && + !i.isFade && + !(null == r ? void 0 : r.destroyed) && + !r?.off), + (a.width = i.width * t), + (a.height = i.height * t), + (a.x = i.x), + (a.y = getBlockFallY( + i.x, + i.y, + s && s.playerX, + s && s.fallTypes, + s && s.playerDir, + ))); + }, + array: () => e.blocks, + testId: (t, a) => { + var i, n; + return `Block-${null !== + (n = + null === (i = e.inGame) || void 0 === i + ? void 0 + : i.indexes[a]) && void 0 !== n + ? n + : a + }`; }, - array: () => e.squares, }), - f({ - props: () => ({ - fillColor: t.colour, - path: [ - [-15, -15], - [0, 15], - [15, -15], - ], - }), - update: (e, t) => { - ((e.x = t.radius * Math.cos(B.toRad(t.angle))), - (e.y = t.radius * Math.sin(B.toRad(t.angle))), - (e.opacity = t.opacity), - (e.scaleX = t.scale), - (e.scaleY = t.scale), - (e.rotation = t.rotation)); + imageArray({ + fileName: `images/themes/world2/block-small.png`, + props: () => ({}), + update: (a, i, n) => { + var s, o; + const r = + null === + (o = + null === (s = e.inGame) || void 0 === s + ? void 0 + : s.blockStates) || void 0 === o + ? void 0 + : o[n], + gravity = e?.inGame?.gravity || 1; + ((a.show = + e.theme == "world2" && + i.width === $.miniBlockWidth && + !i?.steel && + !(i == undefined ? false : i.init) && + !i?.isVoid && + !i?.isBoss && + !i.isFade && + !(null == r ? void 0 : r.destroyed) && + !r?.off), + (a.width = i.width * t), + (a.height = i.height * t), + (a.x = i.x), + (a.y = getBlockFallY( + i.x, + i.y, + s && s.playerX, + s && s.fallTypes, + s && s.playerDir, + ))); + }, + array: () => e.blocks, + testId: (t, a) => { + var i, n; + return `Block-${null !== + (n = + null === (i = e.inGame) || void 0 === i + ? void 0 + : i.indexes[a]) && void 0 !== n + ? n + : a + }`; }, - array: () => e.triangles, }), - ], - ), - ], - }), - za = makeSprite({ - init({ device: e, props: t, getContext: a }) { - const i = Math.round(10 * e.random()) + 10, - n = (t.objectX - t.playerX) / i, - s = 20 * e.random() - 10; - if (t.justDestroyed) { - const { settings: t } = a(Se); - Ga("audio/levels/missile.wav", e, t, { - fromPosition: 0, - overwrite: true, - }); - } - return { - justDestroyed: t.justDestroyed, - missileFrames: i, - speedX: n, - speedY: s, - position: [[t.playerX, t.playerY]], - frame: 0, - pos: { x: t.objectX, y: t.objectY }, - }; - }, - loop({ state: e, props: t }) { - if (t.paused) return; - if ( - ((e.pos.x = t.objectX), - (e.pos.y = t.objectY), - e.frame++, - e.frame >= e.missileFrames) - ) - return void e.position.pop(); - const [a, i] = e.position[0]; - if (e.frame > e.missileFrames / 2) { - const a = (t.objectY - i) / 3; - e.speedY += (a - e.speedY) / 3; - } - const n = a + e.speedX, - s = i + e.speedY; - (e.position.unshift([n, s]), - Wa < e.position.length && (e.position.length = Wa)); - }, - render({ state: e, props: t }) { - const a = () => e.frame >= e.missileFrames; - return [ - ifConditional( - () => e.justDestroyed, - () => [ - onChange( - () => a(), - () => [t.getSprite(a(), e.pos)], - ), - m( - { - thickness: 5, - lineCap: "round", - color: "#854107", - opacity: 0.6, - }, - (t) => { - const a = Math.max(0, e.frame - e.missileFrames), - i = e.position.slice(0, Math.max(0, 7 - a)); - t.path = i; - }, - ), - m( - { - thickness: 6, - lineCap: "round", - color: "#E79A0D", - opacity: 0.6, - }, - (t) => { - const a = Math.max(0, e.frame - e.missileFrames), - i = e.position.slice(0, Math.max(0, 4 - a)); - t.path = i; - }, - ), - m( - { - thickness: 7, - lineCap: "round", - color: "#FEFD58", - opacity: 0.6, - }, - (t) => { - const a = Math.max(0, e.frame - e.missileFrames), - i = e.position.slice(0, Math.max(0, 3 - a)); - t.path = i; - }, - ), - m( - { - thickness: 8, - lineCap: "round", - color: "#FDFDE0", - opacity: 0.6, - }, - (t) => { - const a = Math.max(0, e.frame - e.missileFrames), - i = e.position.slice(0, Math.max(0, 2 - a)); - t.path = i; - }, - ), - ], - ), - ]; - }, - }), - Wa = 6, - qa = makeSprite({ - init({ device: e, props: t }) { - if (t.justDestroyed && false !== t.sfx) { - const t = st(1, 3, e.random); - e.audio(`audio/levels/explosion${t}.wav`).play({ - fromPosition: 0, - overwrite: true, - }); - } - }, - render: ({ props: e }) => [ - conditional( - () => "pixel" === e.trail.form, - () => [ - triggerableSpriteSheet.Single( - { - fileName: "images/player/pixel-explosion.png", - columns: 4, - rows: 2, - frameRate: 3, - width: 73, - height: 110, - paused: e.paused, - rotation: e.playerRot, - df: e.df, - scaleX: e.playerScale, - scaleY: e.playerScale + ]; + }, + ), + // outlines + onChange( + () => e.theme, + () => { + const t = "world3" === e.theme ? 1 : 1; + return [ + imageArray({ + fileName: `images/themes/world1/red-outline.png`, + props: () => ({}), + update: (a, i, n) => { + var s, o; + const r = + null === + (o = + null === (s = e.inGame) || void 0 === s + ? void 0 + : s.blockStates) || void 0 === o + ? void 0 + : o[n]; + ((a.show = + i?.init == "red" && + !(null == r ? void 0 : r.destroyed) && + !r?.off), + (a.width = i.width * t), + (a.height = i.height * t), + (a.x = i.x), + (a.y = getBlockFallY( + i.x, + i?.midY, + s && s.playerX, + s && s.fallTypes, + s && s.playerDir, + ))); }, - (t) => { - ((t.paused = e.paused), - (t.rotation = e.playerRot), - (t.df = e.df)); + array: () => e.blocks, + testId: (t, a) => { + var i, n; + return `Block-${null !== + (n = + null === (i = e.inGame) || void 0 === i + ? void 0 + : i.indexes[a]) && void 0 !== n + ? n + : a + }`; }, - ), - ], - () => [ - Xa.Single( - { - justDestroyed: e.justDestroyed, - colour: e.trail.topColour, - bottomColour: e.trail.bottomColour, - paused: e.paused, - scaleX: e.playerScale, - scaleY: e.playerScale + }), + ]; + }, + ), + onChange( + () => e.theme, + () => { + const t = "world3" === e.theme ? 1 : 1; + return [ + imageArray({ + fileName: `images/themes/world1/blue-outline.png`, + props: () => ({}), + update: (a, i, n) => { + var s, o; + const r = + null === + (o = + null === (s = e.inGame) || void 0 === s + ? void 0 + : s.blockStates) || void 0 === o + ? void 0 + : o[n]; + ((a.show = + !(i?.init == "red" || i?.init == undefined) && + !(null == r ? void 0 : r.destroyed)), + (a.width = i.width * t), + (a.height = i.height * t), + (a.x = i.x), + (a.y = getBlockFallY( + i.x, + i?.midY, + s && s.playerX, + s && s.fallTypes, + s && s.playerDir, + ))); }, - (t) => { - ((t.justDestroyed = e.justDestroyed), - (t.colour = e.trail.topColour), - (t.bottomColour = e.trail.bottomColour), - (t.paused = e.paused)); + array: () => e.blocks, + testId: (t, a) => { + var i, n; + return `Block-${null !== + (n = + null === (i = e.inGame) || void 0 === i + ? void 0 + : i.indexes[a]) && void 0 !== n + ? n + : a + }`; }, - ), - ], - ), - ], - }), - $a = (e, t) => e >= t - 10, - getBlockFallY = (x, y, playerX, fallTypes, playerDir) => { - if (typeof fallTypes == "undefined" || fallTypes === null) { - return y; - } - if (typeof playerX == "undefined" || playerX === null) { - return y; - } - let newY = y; - let playerXOffset; - if (fallTypes[1] === "up") { - playerXOffset = (playerX + 270 * playerDir - x) * 3 * playerDir; - if (playerXOffset < 0) { - newY += playerXOffset; - } - } - if (fallTypes[0] === "down") { - playerXOffset = -(playerX - 60 * playerDir - x) * playerDir; - if (playerXOffset < 0) { - newY += playerXOffset; - } - } - return newY; - }, - fadeFunction = (s, i) => ( - (s ? s.crashed ? 1 : Math.min((Math.abs(s.playerX - i.x) - 150) / 120, 1) : 1) * 0.8 - ), - isSpecialTheme = (e) => e === "classic" || e === "infinite", - infiniteBgTable = function (i, clr) { - return ( - [ - { - "#FF0000": "#f6d4c5", - "#ffea00": "#f8ecb7", - "#00FF00": "#ceeed7", - "#0000ff": "#c3e6e7", - "#8000ff": "#f8cef6", - "#ff00ff": "#f8cee7", - "#ffFFff": "#e7e7e7", - "#000000": "#4f4f4f", - }, - { - "#FF0000": "#f5c8b7", - "#ffea00": "#F5E190", - "#00FF00": "#bee8c9", - "#0000ff": "#b4d8ea", - "#8000ff": "#f5c1f7", - "#ff00ff": "#f7c1e2", - "#ffFFff": "#d8d8d8", - "#000000": "#383838", - }, - ][i][clr] || (i ? "#76d7d6" : "#89dde1") - ); - }, - getInfiniteThemePath = (bgColor) => { - let table = { - "#FF0000": "red", - "#ffea00": "yellow", - "#00FF00": "green", - "#0000ff": "blue", - "#8000ff": "purple", - "#ff00ff": "pink", - "#ffFFff": "white", - "#000000": "black", - }; - return `infinite/colors/${table[bgColor] || "default"}` - }, - getInfiniteThemeColors = (bgColor) => { - let table = { - "#FF0000": "#2257a3", - "#ffea00": "#6c40c1", - "#00FF00": "#b23e17", - "#0000ff": "#860795", - "#8000ff": "#387330", - "#ff00ff": "#0b8071", - "#ffFFff": "#1c1c1c", - "#000000": "#FFFFFF", - }; - return table[bgColor] || "#9e1808"; - }, - getInfinitePlayerColors = (bgColor) => { - let table = { - "#FF0000": "#cf4f1e", - "#ffea00": "#d48101", - "#00FF00": "#089d72", - "#0000ff": "#2e1b8e", - "#8000ff": "#af4af3", - "#ff00ff": "#ac089b", - "#ffFFff": "#FFFFFF", - "#000000": "#1c1c1c", - }; - return table[bgColor] || "#035c74"; - }, - Ja = makeSprite({ - render: ({ props: e }) => [ - onChange( - () => e.theme, - () => { - const t = "world3" === e.theme ? 41 / 30 : 1; - return [ - imageArray({ - fileName: `images/themes/${e.theme}/block.png`, - props: () => ({}), - update: (a, i, n) => { - var s, o; - const r = - null === - (o = - null === (s = e.inGame) || void 0 === s - ? void 0 - : s.blockStates) || void 0 === o + }), + ]; + }, + ), + onChange( + () => e.theme, + () => { + const t = "world3" === e.theme ? 1 : 1; + return [ + imageArray({ + fileName: `images/themes/${e.theme == "classic" ? "classic" : e.theme == "world2" ? "world2" : "world1"}/red.png`, + props: () => ({}), + update: (a, i, n) => { + var s, o; + const r = + null === + (o = + null === (s = e.inGame) || void 0 === s ? void 0 - : o[n], - gravity = e.inGame?.gravity || 1; - ((a.show = - (e.theme == "world2" - ? i.width !== $.miniBlockWidth - : true) && - !i?.steel && - !(i == undefined ? false : i.init) && - !i.isVoid && - !i.isBoss && - !i.isFade && - !(null == r ? void 0 : r.destroyed) && - !r?.off), - (a.width = i.width * t), - (a.height = i.height * t), - (a.x = i.x), - (a.y = getBlockFallY( - i.x, - i.y, - s && s.playerX, - s && s.fallTypes, - s && s.playerDir, - ))); - }, - array: () => e.blocks, - testId: (t, a) => { - var i, n; - return `Block-${ - null !== - (n = - null === (i = e.inGame) || void 0 === i - ? void 0 - : i.indexes[a]) && void 0 !== n - ? n - : a + : s.blockStates) || void 0 === o + ? void 0 + : o[n]; + ((a.show = + i?.init == "red" && + !(null == r ? void 0 : r.destroyed) && + !r?.off), + (a.width = i.width * t), + (a.height = i.height * t), + (a.x = i.x), + (a.y = getBlockFallY( + i.x, + i.y, + s && s.playerX, + s && s.fallTypes, + s && s.playerDir, + ))); + }, + array: () => e.blocks, + testId: (t, a) => { + var i, n; + return `Block-${null !== + (n = + null === (i = e.inGame) || void 0 === i + ? void 0 + : i.indexes[a]) && void 0 !== n + ? n + : a }`; - }, - }), - imageArray({ - fileName: `images/themes/world2/block-small.png`, - props: () => ({}), - update: (a, i, n) => { - var s, o; - const r = - null === - (o = - null === (s = e.inGame) || void 0 === s - ? void 0 - : s.blockStates) || void 0 === o + }, + }), + ]; + }, + ), + onChange( + () => e.theme, + () => { + const t = "world3" === e.theme ? 1 : 1; + return [ + imageArray({ + fileName: `images/themes/${e.theme == "classic" ? "classic" : e.theme == "world2" ? "world2" : "world1"}/blue.png`, + props: () => ({}), + update: (a, i, n) => { + var s, o; + const r = + null === + (o = + null === (s = e.inGame) || void 0 === s ? void 0 - : o[n], - gravity = e?.inGame?.gravity || 1; - ((a.show = - e.theme == "world2" && - i.width === $.miniBlockWidth && - !i?.steel && - !(i == undefined ? false : i.init) && - !i?.isVoid && - !i?.isBoss && - !i.isFade && - !(null == r ? void 0 : r.destroyed) && - !r?.off), - (a.width = i.width * t), - (a.height = i.height * t), - (a.x = i.x), - (a.y = getBlockFallY( - i.x, - i.y, - s && s.playerX, - s && s.fallTypes, - s && s.playerDir, - ))); - }, - array: () => e.blocks, - testId: (t, a) => { - var i, n; - return `Block-${ - null !== - (n = - null === (i = e.inGame) || void 0 === i - ? void 0 - : i.indexes[a]) && void 0 !== n - ? n - : a + : s.blockStates) || void 0 === o + ? void 0 + : o[n]; + ((a.show = + !(i?.init == "red" || i?.init == undefined) && + !(null == r ? void 0 : r.destroyed) && + !r?.off), + (a.width = i.width * t), + (a.height = i.height * t), + (a.x = i.x), + (a.y = getBlockFallY( + i.x, + i.y, + s && s.playerX, + s && s.fallTypes, + s && s.playerDir, + ))); + }, + array: () => e.blocks, + testId: (t, a) => { + var i, n; + return `Block-${null !== + (n = + null === (i = e.inGame) || void 0 === i + ? void 0 + : i.indexes[a]) && void 0 !== n + ? n + : a }`; - }, - }), - ]; - }, - ), - // outlines - onChange( - () => e.theme, - () => { - const t = "world3" === e.theme ? 1 : 1; - return [ - imageArray({ - fileName: `images/themes/world1/red-outline.png`, - props: () => ({}), - update: (a, i, n) => { - var s, o; - const r = - null === - (o = - null === (s = e.inGame) || void 0 === s - ? void 0 - : s.blockStates) || void 0 === o - ? void 0 - : o[n]; - ((a.show = - i?.init == "red" && - !(null == r ? void 0 : r.destroyed) && - !r?.off), - (a.width = i.width * t), - (a.height = i.height * t), - (a.x = i.x), - (a.y = getBlockFallY( - i.x, - i?.midY, - s && s.playerX, - s && s.fallTypes, - s && s.playerDir, - ))); - }, - array: () => e.blocks, - testId: (t, a) => { - var i, n; - return `Block-${ - null !== - (n = - null === (i = e.inGame) || void 0 === i - ? void 0 - : i.indexes[a]) && void 0 !== n - ? n - : a - }`; - }, - }), - ]; - }, - ), - onChange( - () => e.theme, - () => { - const t = "world3" === e.theme ? 1 : 1; - return [ - imageArray({ - fileName: `images/themes/world1/blue-outline.png`, - props: () => ({}), - update: (a, i, n) => { - var s, o; - const r = - null === - (o = - null === (s = e.inGame) || void 0 === s - ? void 0 - : s.blockStates) || void 0 === o - ? void 0 - : o[n]; - ((a.show = - !(i?.init == "red" || i?.init == undefined) && - !(null == r ? void 0 : r.destroyed)), - (a.width = i.width * t), - (a.height = i.height * t), - (a.x = i.x), - (a.y = getBlockFallY( - i.x, - i?.midY, - s && s.playerX, - s && s.fallTypes, - s && s.playerDir, - ))); - }, - array: () => e.blocks, - testId: (t, a) => { - var i, n; - return `Block-${ - null !== - (n = - null === (i = e.inGame) || void 0 === i - ? void 0 - : i.indexes[a]) && void 0 !== n - ? n - : a - }`; - }, - }), - ]; - }, - ), - onChange( - () => e.theme, - () => { - const t = "world3" === e.theme ? 1 : 1; - return [ - imageArray({ - fileName: `images/themes/${e.theme == "classic" ? "classic" : e.theme == "world2" ? "world2" : "world1"}/red.png`, - props: () => ({}), - update: (a, i, n) => { - var s, o; - const r = - null === - (o = - null === (s = e.inGame) || void 0 === s - ? void 0 - : s.blockStates) || void 0 === o - ? void 0 - : o[n]; - ((a.show = - i?.init == "red" && - !(null == r ? void 0 : r.destroyed) && - !r?.off), - (a.width = i.width * t), - (a.height = i.height * t), - (a.x = i.x), - (a.y = getBlockFallY( - i.x, - i.y, - s && s.playerX, - s && s.fallTypes, - s && s.playerDir, - ))); - }, - array: () => e.blocks, - testId: (t, a) => { - var i, n; - return `Block-${ - null !== - (n = - null === (i = e.inGame) || void 0 === i - ? void 0 - : i.indexes[a]) && void 0 !== n - ? n - : a + }, + }), + ]; + }, + ), + onChange( + () => e.theme, + () => { + const t = 1; + return [ + imageArray({ + fileName: `images/themes/${e.theme.split("/")[0]}/steel.png`, + props: () => ({}), + update: (a, i, n) => { + var s, o; + const r = + null === + (o = + null === (s = e.inGame) || void 0 === s + ? void 0 + : s.blockStates) || void 0 === o + ? void 0 + : o[n]; + ((a.show = + i?.steel && !(null == r ? void 0 : r.destroyed)), + (a.width = i.width * t), + (a.height = i.height * t), + (a.x = i.x), + (a.y = getBlockFallY( + i.x, + i.y, + s && s.playerX, + s && s.fallTypes, + s && s.playerDir, + ))); + }, + array: () => e.blocks, + testId: (t, a) => { + var i, n; + return `Block-${null !== + (n = + null === (i = e.inGame) || void 0 === i + ? void 0 + : i.indexes[a]) && void 0 !== n + ? n + : a }`; - }, - }), - ]; - }, - ), - onChange( - () => e.theme, - () => { - const t = "world3" === e.theme ? 1 : 1; - return [ - imageArray({ - fileName: `images/themes/${e.theme == "classic" ? "classic" : e.theme == "world2" ? "world2" : "world1"}/blue.png`, - props: () => ({}), - update: (a, i, n) => { - var s, o; - const r = - null === - (o = - null === (s = e.inGame) || void 0 === s - ? void 0 - : s.blockStates) || void 0 === o - ? void 0 - : o[n]; - ((a.show = - !(i?.init == "red" || i?.init == undefined) && - !(null == r ? void 0 : r.destroyed) && - !r?.off), - (a.width = i.width * t), - (a.height = i.height * t), - (a.x = i.x), - (a.y = getBlockFallY( - i.x, - i.y, - s && s.playerX, - s && s.fallTypes, - s && s.playerDir, - ))); - }, - array: () => e.blocks, - testId: (t, a) => { - var i, n; - return `Block-${ - null !== - (n = - null === (i = e.inGame) || void 0 === i - ? void 0 - : i.indexes[a]) && void 0 !== n - ? n - : a + }, + }), + ]; + }, + ), + onChange( + () => e.theme, + () => { + const t = 1; + return [ + imageArray({ + fileName: `images/themes/${e.theme.split("/")[0]}/bottom/block.png`, + props: () => ({}), + update: (a, i, n) => { + var s, o; + const r = + null === + (o = + null === (s = e.inGame) || void 0 === s + ? void 0 + : s.blockStates) || void 0 === o + ? void 0 + : o[n]; + ((a.show = + i?.isVoid && !(null == r ? void 0 : r.destroyed)), + (a.width = i.width * t), + (a.height = i.height * t), + (a.x = i.x), + (a.y = getBlockFallY( + i.x, + i.y, + s && s.playerX, + s && s.fallTypes, + s && s.playerDir, + ))); + }, + array: () => e.blocks, + testId: (t, a) => { + var i, n; + return `Block-${null !== + (n = + null === (i = e.inGame) || void 0 === i + ? void 0 + : i.indexes[a]) && void 0 !== n + ? n + : a }`; - }, - }), - ]; - }, - ), - onChange( - () => e.theme, - () => { - const t = 1; - return [ - imageArray({ - fileName: `images/themes/${e.theme.split("/")[0]}/steel.png`, - props: () => ({}), - update: (a, i, n) => { - var s, o; - const r = - null === - (o = - null === (s = e.inGame) || void 0 === s - ? void 0 - : s.blockStates) || void 0 === o - ? void 0 - : o[n]; - ((a.show = - i?.steel && !(null == r ? void 0 : r.destroyed)), - (a.width = i.width * t), - (a.height = i.height * t), - (a.x = i.x), - (a.y = getBlockFallY( - i.x, - i.y, - s && s.playerX, - s && s.fallTypes, - s && s.playerDir, - ))); - }, - array: () => e.blocks, - testId: (t, a) => { - var i, n; - return `Block-${ - null !== - (n = - null === (i = e.inGame) || void 0 === i - ? void 0 - : i.indexes[a]) && void 0 !== n - ? n - : a + }, + }), + ]; + }, + ), + onChange( + () => e.theme, + () => { + const t = "world3" === e.theme ? 41 / 30 : 1; + return [ + imageArray({ + fileName: `images/themes/${e.theme.split("/")[0]}/boss.png`, + props: () => ({}), + update: (a, i, n) => { + var s, o; + const r = + null === + (o = + null === (s = e.inGame) || void 0 === s + ? void 0 + : s.blockStates) || void 0 === o + ? void 0 + : o[n]; + ((a.show = + !i?.steel && + i?.isBoss && + !i?.isVoid && + !(null == r ? void 0 : r.destroyed) && + !(null == r + ? void 0 + : r.isGround && isSpecialTheme(e.theme.split("/")[0]))), + (a.width = i.width * t), + (a.height = i.height * t), + (a.x = i.x), + (a.y = getBlockFallY( + i.x, + i.y, + s && s.playerX, + s && s.fallTypes, + s && s.playerDir, + ))); + }, + array: () => e.blocks, + testId: (t, a) => { + var i, n; + return `Block-${null !== + (n = + null === (i = e.inGame) || void 0 === i + ? void 0 + : i.indexes[a]) && void 0 !== n + ? n + : a }`; - }, - }), - ]; - }, - ), - onChange( - () => e.theme, - () => { - const t = 1; - return [ - imageArray({ - fileName: `images/themes/${e.theme.split("/")[0]}/bottom/block.png`, - props: () => ({}), - update: (a, i, n) => { - var s, o; - const r = - null === - (o = - null === (s = e.inGame) || void 0 === s - ? void 0 - : s.blockStates) || void 0 === o - ? void 0 - : o[n]; - ((a.show = - i?.isVoid && !(null == r ? void 0 : r.destroyed)), - (a.width = i.width * t), - (a.height = i.height * t), - (a.x = i.x), - (a.y = getBlockFallY( - i.x, - i.y, - s && s.playerX, - s && s.fallTypes, - s && s.playerDir, - ))); - }, - array: () => e.blocks, - testId: (t, a) => { - var i, n; - return `Block-${ - null !== - (n = - null === (i = e.inGame) || void 0 === i - ? void 0 - : i.indexes[a]) && void 0 !== n - ? n - : a + }, + }), + imageArray({ + fileName: `images/themes/world3/block-white.png`, + props: () => ({}), + update: (a, i, n) => { + var s, o; + const r = + null === + (o = + null === (s = e.inGame) || void 0 === s + ? void 0 + : s.blockStates) || void 0 === o + ? void 0 + : o[n]; + ((a.show = + !i?.steel && + !i?.isBoss && + !i?.isVoid && + i?.isFade && + !(null == r ? void 0 : r.destroyed)), + (a.width = i.width * (41 / 30)), + (a.height = i.height * (41 / 30)), + (a.opacity = fadeFunction(s, i)), + (a.x = i.x), + (a.y = getBlockFallY( + i.x, + i.y, + s && s.playerX, + s && s.fallTypes, + s && s.playerDir, + ))); + }, + array: () => e.blocks, + testId: (t, a) => { + var i, n; + return `Block-${null !== + (n = + null === (i = e.inGame) || void 0 === i + ? void 0 + : i.indexes[a]) && void 0 !== n + ? n + : a }`; - }, - }), - ]; - }, - ), - onChange( - () => e.theme, - () => { - const t = "world3" === e.theme ? 41 / 30 : 1; - return [ - imageArray({ - fileName: `images/themes/${e.theme.split("/")[0]}/boss.png`, - props: () => ({}), - update: (a, i, n) => { - var s, o; - const r = - null === - (o = - null === (s = e.inGame) || void 0 === s - ? void 0 - : s.blockStates) || void 0 === o + }, + }), + ]; + }, + ), + ifConditional( + () => void 0 !== e.inGame, + () => { + const t = "world3" === e.theme ? 41 / 30 : 1; + return [ + conditional( + () => e.theme.split("/")[0] === "infinite", + () => [ + g({ + props: (e) => ({ + width: e.width, + height: e.height, + x: e.x, + y: e.y, + color: "white" + }), + update: (a, i, n) => { + const s = e.inGame.blockStates[n]; + if (s && !s.destroyed && s.hitFrame) { + const n = B.zeroTo1( + 1 - (e.inGame.frame - s.hitFrame) / 20, + ); + if (n > 0) + return ( + (a.width = i.width * t), + (a.height = i.height * t), + (a.x = i.x), + (a.y = getBlockFallY( + i.x, + i.y, + e.inGame && e.inGame.playerX, + e.inGame && e.inGame.fallTypes, + e.inGame && e.inGame.playerDir, + )), + (a.opacity = n / 2), + void (a.show = !i.steel && !i.isFade) + ); + } + a.show = false; + }, + array: () => e.blocks, + }) + ], + () => [ + imageArray({ + fileName: `images/themes/${e.theme}/block-light.png`, + props: () => ({}), + update: (a, i, n) => { + const s = e.inGame.blockStates[n]; + if (s && !s.destroyed && s.hitFrame) { + const n = B.zeroTo1( + 1 - (e.inGame.frame - s.hitFrame) / 20, + ); + if (n > 0) + return ( + (a.width = i.width * t), + (a.height = i.height * t), + (a.x = i.x), + (a.y = getBlockFallY( + i.x, + i.y, + e.inGame && e.inGame.playerX, + e.inGame && e.inGame.fallTypes, + e.inGame && e.inGame.playerDir, + )), + (a.opacity = n), + void (a.show = !i.steel && !i.isFade && !i.isBoss) + ); + } + a.show = false; + }, + array: () => e.blocks, + }), + imageArray({ + fileName: `images/themes/${e.theme.split("/")[0]}/boss-light.png`, + props: () => ({}), + update: (a, i, n) => { + const s = e.inGame.blockStates[n]; + if (s && !s.destroyed && s.hitFrame) { + const n = B.zeroTo1( + 1 - (e.inGame.frame - s.hitFrame) / 20, + ); + if (n > 0) + return ( + (a.width = i.width * t), + (a.height = i.height * t), + (a.x = i.x), + (a.y = getBlockFallY( + i.x, + i.y, + e.inGame && e.inGame.playerX, + e.inGame && e.inGame.fallTypes, + e.inGame && e.inGame.playerDir, + )), + (a.opacity = n), + void (a.show = !i.steel && !i.isFade && i.isBoss) + ); + } + a.show = false; + }, + array: () => e.blocks, + }), + ] + ), + imageArray({ + fileName: `images/themes/world3/block-white-light.png`, + props: () => ({}), + update: (a, i, n) => { + const s = e.inGame.blockStates[n]; + if (s && !s.destroyed && s.hitFrame) { + const n = B.zeroTo1( + 1 - (e.inGame.frame - s.hitFrame) / 20, + ); + if (n > 0) + return ( + (a.width = i.width * (41 / 30)), + (a.height = i.height * (41 / 30)), + (a.x = i.x), + (a.y = getBlockFallY( + i.x, + i.y, + e.inGame && e.inGame.playerX, + e.inGame && e.inGame.fallTypes, + e.inGame && e.inGame.playerDir, + )), + (a.opacity = n / 2), + void (a.show = !i.steel && i.isFade) + ); + } + a.show = false; + }, + array: () => e.blocks, + }), + Ka.Array({ + props: (t, a) => { + var i; + const n = e.inGame.blockStates[a]; + return { + justDestroyed: + !!n.destroyed && + $a(n.destroyed.frame, e.inGame.frame), + destroyedBy: + null === (i = n.destroyed) || void 0 === i ? void 0 - : o[n]; - ((a.show = - !i?.steel && - i?.isBoss && - !i?.isVoid && - !(null == r ? void 0 : r.destroyed) && - !(null == r + : i.by, + paused: e.inGame.paused, + df: e.inGame.df, + x: t.x, + y: getBlockFallY( + t.x, + t.y, + e.inGame && e.inGame.playerX, + e.inGame && e.inGame.fallTypes, + e.inGame && e.inGame.playerDir, + ), + theme: e.theme.split("/")[0], + }; + }, + array: () => e.blocks, + filter: (t, a) => + void 0 !== e.inGame.blockStates[a]?.destroyed, + key: (t, a) => e.inGame.indexes[a], + update: (t) => { + var a, i; + ((t.paused = + (null === (a = e.inGame) || void 0 === a + ? void 0 + : a.paused) || false), + (t.df = + (null === (i = e.inGame) || void 0 === i ? void 0 - : r.isGround && isSpecialTheme(e.theme.split("/")[0]))), - (a.width = i.width * t), - (a.height = i.height * t), - (a.x = i.x), - (a.y = getBlockFallY( - i.x, - i.y, - s && s.playerX, - s && s.fallTypes, - s && s.playerDir, - ))); - }, - array: () => e.blocks, - testId: (t, a) => { - var i, n; - return `Block-${ - null !== - (n = - null === (i = e.inGame) || void 0 === i - ? void 0 - : i.indexes[a]) && void 0 !== n - ? n - : a - }`; - }, - }), - imageArray({ - fileName: `images/themes/world3/block-white.png`, - props: () => ({}), - update: (a, i, n) => { - var s, o; - const r = - null === - (o = - null === (s = e.inGame) || void 0 === s - ? void 0 - : s.blockStates) || void 0 === o - ? void 0 - : o[n]; - ((a.show = - !i?.steel && - !i?.isBoss && - !i?.isVoid && - i?.isFade && - !(null == r ? void 0 : r.destroyed)), - (a.width = i.width * (41 / 30)), - (a.height = i.height * (41 / 30)), - (a.opacity = fadeFunction(s, i)), - (a.x = i.x), - (a.y = getBlockFallY( - i.x, - i.y, - s && s.playerX, - s && s.fallTypes, - s && s.playerDir, - ))); - }, - array: () => e.blocks, - testId: (t, a) => { - var i, n; - return `Block-${ - null !== - (n = - null === (i = e.inGame) || void 0 === i - ? void 0 - : i.indexes[a]) && void 0 !== n - ? n - : a - }`; - }, - }), - ]; - }, - ), - ifConditional( - () => void 0 !== e.inGame, - () => { - const t = "world3" === e.theme ? 41 / 30 : 1; - return [ - conditional( - () => e.theme.split("/")[0] === "infinite", - () => [ - g({ - props: (e) => ({ - width: e.width, - height: e.height, - x: e.x, - y: e.y, - color: "white" - }), - update: (a, i, n) => { - const s = e.inGame.blockStates[n]; - if (s && !s.destroyed && s.hitFrame) { - const n = B.zeroTo1( - 1 - (e.inGame.frame - s.hitFrame) / 20, - ); - if (n > 0) - return ( - (a.width = i.width * t), - (a.height = i.height * t), - (a.x = i.x), - (a.y = getBlockFallY( - i.x, - i.y, - e.inGame && e.inGame.playerX, - e.inGame && e.inGame.fallTypes, - e.inGame && e.inGame.playerDir, - )), - (a.opacity = n / 2), - void (a.show = !i.steel && !i.isFade) - ); - } - a.show = false; - }, - array: () => e.blocks, - }) - ], - () => [ - imageArray({ - fileName: `images/themes/${e.theme}/block-light.png`, - props: () => ({}), - update: (a, i, n) => { - const s = e.inGame.blockStates[n]; - if (s && !s.destroyed && s.hitFrame) { - const n = B.zeroTo1( - 1 - (e.inGame.frame - s.hitFrame) / 20, - ); - if (n > 0) - return ( - (a.width = i.width * t), - (a.height = i.height * t), - (a.x = i.x), - (a.y = getBlockFallY( - i.x, - i.y, - e.inGame && e.inGame.playerX, - e.inGame && e.inGame.fallTypes, - e.inGame && e.inGame.playerDir, - )), - (a.opacity = n), - void (a.show = !i.steel && !i.isFade && !i.isBoss) - ); - } - a.show = false; - }, - array: () => e.blocks, - }), - imageArray({ - fileName: `images/themes/${e.theme.split("/")[0]}/boss-light.png`, - props: () => ({}), - update: (a, i, n) => { - const s = e.inGame.blockStates[n]; - if (s && !s.destroyed && s.hitFrame) { - const n = B.zeroTo1( - 1 - (e.inGame.frame - s.hitFrame) / 20, - ); - if (n > 0) - return ( - (a.width = i.width * t), - (a.height = i.height * t), - (a.x = i.x), - (a.y = getBlockFallY( - i.x, - i.y, - e.inGame && e.inGame.playerX, - e.inGame && e.inGame.fallTypes, - e.inGame && e.inGame.playerDir, - )), - (a.opacity = n), - void (a.show = !i.steel && !i.isFade && i.isBoss) - ); - } - a.show = false; - }, - array: () => e.blocks, - }), - ] - ), - imageArray({ - fileName: `images/themes/world3/block-white-light.png`, - props: () => ({}), - update: (a, i, n) => { - const s = e.inGame.blockStates[n]; - if (s && !s.destroyed && s.hitFrame) { - const n = B.zeroTo1( - 1 - (e.inGame.frame - s.hitFrame) / 20, - ); - if (n > 0) - return ( - (a.width = i.width * (41 / 30)), - (a.height = i.height * (41 / 30)), - (a.x = i.x), - (a.y = getBlockFallY( - i.x, - i.y, - e.inGame && e.inGame.playerX, - e.inGame && e.inGame.fallTypes, - e.inGame && e.inGame.playerDir, - )), - (a.opacity = n / 2), - void (a.show = !i.steel && i.isFade) - ); - } - a.show = false; - }, - array: () => e.blocks, - }), - Ka.Array({ - props: (t, a) => { - var i; - const n = e.inGame.blockStates[a]; - return { - justDestroyed: - !!n.destroyed && - $a(n.destroyed.frame, e.inGame.frame), - destroyedBy: - null === (i = n.destroyed) || void 0 === i - ? void 0 - : i.by, - paused: e.inGame.paused, - df: e.inGame.df, - x: t.x, - y: getBlockFallY( - t.x, - t.y, - e.inGame && e.inGame.playerX, - e.inGame && e.inGame.fallTypes, - e.inGame && e.inGame.playerDir, - ), - theme: e.theme.split("/")[0], - }; - }, - array: () => e.blocks, - filter: (t, a) => - void 0 !== e.inGame.blockStates[a]?.destroyed, - key: (t, a) => e.inGame.indexes[a], - update: (t) => { - var a, i; - ((t.paused = - (null === (a = e.inGame) || void 0 === a - ? void 0 - : a.paused) || false), - (t.df = - (null === (i = e.inGame) || void 0 === i - ? void 0 - : i.df) || 1)); - t.theme = e.theme.split("/")[0] || "world2"; - }, - }), - ]; - }, - ), - ], - }), - Ka = makeSprite({ - init({ props: e, device: t, getContext: a }) { - if (e.justDestroyed) { - const { settings: i } = a(Se); - "stomped" === e.destroyedBy - ? Ga("audio/levels/boss4/block_explosion.mp3", t, i, { - overwrite: true, - }) - : Ga("audio/levels/object-explosion.wav", t, i, 0); - } - return { show: e.justDestroyed }; - }, - render: ({ state: e, props: t }) => [ - ifConditional( - () => e.show, - () => [ - triggerableSpriteSheet.Single( - { - fileName: `images/themes/${t.theme || "world2"}/block-explosion.png`, - columns: 3, - rows: 2, - frameRate: 3, - width: 250 / 3, - height: 250 / 3, - paused: t.paused, - df: t.df, - onEnd: () => { - e.show = false; - }, - }, - (e) => { - ((e.paused = t.paused), (e.df = t.df)); - }, - ), - ], - ), - ], - }), - Qa = makeSprite({ - render({ props: e }) { - if (e.editor) - return [ - onChange( - () => e.theme, - () => { - const t = "world2" === e.theme ? 20 / 3 : 3, - a = "world2" === e.theme ? 90 : 93; - return [ - imageArray({ - fileName: `images/themes/${e.theme}/platform-rail.png`, - props: () => ({ width: t, height: a }), - update: (e, t) => { - ((e.x = t.x), - (e.y = t.midY), - (e.show = - "upDown" === t.movement || - "downUp" === t.movement)); - }, - array: () => e.platforms, - }), - imageArray({ - fileName: `images/themes/${e.theme}/platform.png`, - props: () => ({}), - update: (e, t) => { - ((e.width = t.width), - (e.height = t.height), - (e.x = t.x), - (e.y = t.y), - (e.show = - "static" === t.movement || - "falling" === t.movement)); - }, - array: () => e.platforms, - testId: (e, t) => `Platform-${t}`, - }), - imageArray({ - fileName: `images/themes/${e.theme}/platform.png`, - props: () => ({}), - update: (e, t) => { - ((e.width = t.width), - (e.height = t.height), - (e.x = t.x), - (e.y = t.midY - $.platformMove / 2), - (e.show = - "downUp" === t.movement || - "upDown" === t.movement), - (e.opacity = "downUp" === t.movement ? 0.3 : 1)); - }, - array: () => e.platforms, - }), - imageArray({ - fileName: `images/themes/${e.theme}/platform.png`, - props: () => ({}), - update: (e, t) => { - ((e.width = t.width), - (e.height = t.height), - (e.x = t.x), - (e.y = t.midY + $.platformMove / 2), - (e.show = - "downUp" === t.movement || - "upDown" === t.movement), - (e.opacity = "upDown" === t.movement ? 0.3 : 1)); - }, - array: () => e.platforms, - }), - ifConditional( - () => void 0 !== e.editor.previewYs, - () => [ - g({ - props: (e) => ({ - width: e.width, - height: e.height, - opacity: 0.5, - color: "blue", - }), - update: (t, a, i) => { - ((t.x = a.x), - (t.y = e.editor.previewYs[i]), - (t.show = - "falling" === a.movement || - "downUp" === a.movement || - "upDown" === a.movement)); - }, - array: () => e.platforms, - }), - ], - ), - imageArray({ - fileName: "images/themes/skater/rail.png", - props: () => ({ width: 90, height: 20 }), - update: (e, t) => { - ((e.x = t.x), - (e.y = t.y + 2.5), - (e.show = "rail" === t.movement)); - }, - array: () => e.platforms, - }), - ]; + : i.df) || 1)); + t.theme = e.theme.split("/")[0] || "world2"; }, - ), + }), ]; - const t = "world2" === e.theme ? 20 / 3 : 3, - a = "world2" === e.theme ? 90 : 93; - return [ - imageArray({ - fileName: `images/themes/${e.theme}/platform-rail.png`, - props: () => ({ width: t, height: a }), - update: (a, t) => { - ((a.x = t.x), - (a.y = getBlockFallY( - t.x, - t.midY, - e.inGame && e.inGame.playerX, - e.inGame && e.inGame.fallTypes, - e.inGame && e.inGame.playerDir, - )), - (a.show = - "upDown" === t.movement || "downUp" === t.movement)); + }, + ), + ], + }), + Ka = makeSprite({ + init({ props: e, device: t, getContext: a }) { + if (e.justDestroyed) { + const { settings: i } = a(Se); + "stomped" === e.destroyedBy + ? Ga("audio/levels/boss4/block_explosion.mp3", t, i, { + overwrite: true, + }) + : Ga("audio/levels/object-explosion.wav", t, i, 0); + } + return { show: e.justDestroyed }; + }, + render: ({ state: e, props: t }) => [ + ifConditional( + () => e.show, + () => [ + triggerableSpriteSheet.Single( + { + fileName: `images/themes/${t.theme || "world2"}/block-explosion.png`, + columns: 3, + rows: 2, + frameRate: 3, + width: 250 / 3, + height: 250 / 3, + paused: t.paused, + df: t.df, + onEnd: () => { + e.show = false; + }, }, - array: () => e.platforms, - }), - imageArray({ - fileName: `images/themes/${e.theme}/platform.png`, - props: () => ({}), - update: (a, t) => { - ((a.width = t.width), - (a.height = t.height), - (a.x = t.x), - (a.y = getBlockFallY( - t.x, - t.y, - e.inGame && e.inGame.playerX, - e.inGame && e.inGame.fallTypes, - e.inGame && e.inGame.playerDir, - )), - (a.show = "rail" !== t.movement)); + (e) => { + ((e.paused = t.paused), (e.df = t.df)); }, - array: () => e.platforms, - }), - imageArray({ - fileName: "images/themes/skater/rail.png", - props: () => ({ width: 90, height: 20 }), - update: (a, t) => { - ((a.x = t.x), - (a.y = getBlockFallY( - t.x, - t.y + 2.5, - e.inGame && e.inGame.playerX, - e.inGame && e.inGame.fallTypes, - e.inGame && e.inGame.playerDir, - )), - (a.show = "rail" === t.movement)); + ), + ], + ), + ], + }), + Qa = makeSprite({ + render({ props: e }) { + if (e.editor) + return [ + onChange( + () => e.theme, + () => { + const t = "world2" === e.theme ? 20 / 3 : 3, + a = "world2" === e.theme ? 90 : 93; + return [ + imageArray({ + fileName: `images/themes/${e.theme}/platform-rail.png`, + props: () => ({ width: t, height: a }), + update: (e, t) => { + ((e.x = t.x), + (e.y = t.midY), + (e.show = + "upDown" === t.movement || + "downUp" === t.movement)); + }, + array: () => e.platforms, + }), + imageArray({ + fileName: `images/themes/${e.theme}/platform.png`, + props: () => ({}), + update: (e, t) => { + ((e.width = t.width), + (e.height = t.height), + (e.x = t.x), + (e.y = t.y), + (e.show = + "static" === t.movement || + "falling" === t.movement)); + }, + array: () => e.platforms, + testId: (e, t) => `Platform-${t}`, + }), + imageArray({ + fileName: `images/themes/${e.theme}/platform.png`, + props: () => ({}), + update: (e, t) => { + ((e.width = t.width), + (e.height = t.height), + (e.x = t.x), + (e.y = t.midY - $.platformMove / 2), + (e.show = + "downUp" === t.movement || + "upDown" === t.movement), + (e.opacity = "downUp" === t.movement ? 0.3 : 1)); + }, + array: () => e.platforms, + }), + imageArray({ + fileName: `images/themes/${e.theme}/platform.png`, + props: () => ({}), + update: (e, t) => { + ((e.width = t.width), + (e.height = t.height), + (e.x = t.x), + (e.y = t.midY + $.platformMove / 2), + (e.show = + "downUp" === t.movement || + "upDown" === t.movement), + (e.opacity = "upDown" === t.movement ? 0.3 : 1)); + }, + array: () => e.platforms, + }), + ifConditional( + () => void 0 !== e.editor.previewYs, + () => [ + g({ + props: (e) => ({ + width: e.width, + height: e.height, + opacity: 0.5, + color: "blue", + }), + update: (t, a, i) => { + ((t.x = a.x), + (t.y = e.editor.previewYs[i]), + (t.show = + "falling" === a.movement || + "downUp" === a.movement || + "upDown" === a.movement)); + }, + array: () => e.platforms, + }), + ], + ), + imageArray({ + fileName: "images/themes/skater/rail.png", + props: () => ({ width: 90, height: 20 }), + update: (e, t) => { + ((e.x = t.x), + (e.y = t.y + 2.5), + (e.show = "rail" === t.movement)); + }, + array: () => e.platforms, + }), + ]; }, - array: () => e.platforms, - }), + ), ]; - }, - }), - Za = makeSprite({ - render: ({ props: e }) => [ - onChange( - () => e.theme, - () => { - const t = "world3" === e.theme ? 41 / 30 : 1; - return [ - imageArray({ - fileName: `images/themes/world1/red-spike-outline.png`, - props: () => ({}), - update: (a, i, n) => { - var s, o; - const r = - null === - (o = - null === (s = e.inGame) || void 0 === s - ? void 0 - : s.spikeStates) || void 0 === o - ? void 0 - : s.spikeStates[n]; - ((a.show = - i.init === "red" && - !i.isLaser && - !i.isFade && - !(null == r ? void 0 : r.destroyed)), - (a.x = i.x), - (a.y = getBlockFallY( - i.x, - i.midY, - s && s.playerX, - s && s.fallTypes, - e.inGame && e.inGame.playerDir, - )), - (a.rotation = i.rotation), - (a.width = i.width), - (a.height = i.height)); - }, - array: () => e.spikes, - testId: (t, a) => { - var i; - return `Spike-${ - null === (i = e.inGame) || void 0 === i - ? void 0 - : i.indexes[a] - }`; - }, - }), - imageArray({ - fileName: `images/themes/${e.theme === "classic" ? "classic" : "world1"}/red-spike.png`, - props: () => ({}), - update: (a, i, n) => { - var s, o; - const r = - null === - (o = - null === (s = e.inGame) || void 0 === s - ? void 0 - : s.spikeStates) || void 0 === o - ? void 0 - : s.spikeStates[n]; - ((a.show = - i.init === "red" && - !i.isLaser && - !i.isFade && - !(null == r ? void 0 : r.destroyed)), - (a.x = i.x), - (a.y = getBlockFallY( - i.x, - i.y, - s && s.playerX, - s && s.fallTypes, - e.inGame && e.inGame.playerDir, - )), - (a.rotation = i.rotation), - (a.width = i.width), - (a.height = i.height)); - }, - array: () => e.spikes, - testId: (t, a) => { - var i; - return `Spike-${ - null === (i = e.inGame) || void 0 === i - ? void 0 - : i.indexes[a] + const t = "world2" === e.theme ? 20 / 3 : 3, + a = "world2" === e.theme ? 90 : 93; + return [ + imageArray({ + fileName: `images/themes/${e.theme}/platform-rail.png`, + props: () => ({ width: t, height: a }), + update: (a, t) => { + ((a.x = t.x), + (a.y = getBlockFallY( + t.x, + t.midY, + e.inGame && e.inGame.playerX, + e.inGame && e.inGame.fallTypes, + e.inGame && e.inGame.playerDir, + )), + (a.show = + "upDown" === t.movement || "downUp" === t.movement)); + }, + array: () => e.platforms, + }), + imageArray({ + fileName: `images/themes/${e.theme}/platform.png`, + props: () => ({}), + update: (a, t) => { + ((a.width = t.width), + (a.height = t.height), + (a.x = t.x), + (a.y = getBlockFallY( + t.x, + t.y, + e.inGame && e.inGame.playerX, + e.inGame && e.inGame.fallTypes, + e.inGame && e.inGame.playerDir, + )), + (a.show = "rail" !== t.movement)); + }, + array: () => e.platforms, + }), + imageArray({ + fileName: "images/themes/skater/rail.png", + props: () => ({ width: 90, height: 20 }), + update: (a, t) => { + ((a.x = t.x), + (a.y = getBlockFallY( + t.x, + t.y + 2.5, + e.inGame && e.inGame.playerX, + e.inGame && e.inGame.fallTypes, + e.inGame && e.inGame.playerDir, + )), + (a.show = "rail" === t.movement)); + }, + array: () => e.platforms, + }), + ]; + }, + }), + Za = makeSprite({ + render: ({ props: e }) => [ + onChange( + () => e.theme, + () => { + const t = "world3" === e.theme ? 41 / 30 : 1; + return [ + imageArray({ + fileName: `images/themes/world1/red-spike-outline.png`, + props: () => ({}), + update: (a, i, n) => { + var s, o; + const r = + null === + (o = + null === (s = e.inGame) || void 0 === s + ? void 0 + : s.spikeStates) || void 0 === o + ? void 0 + : s.spikeStates[n]; + ((a.show = + i.init === "red" && + !i.isLaser && + !i.isFade && + !(null == r ? void 0 : r.destroyed)), + (a.x = i.x), + (a.y = getBlockFallY( + i.x, + i.midY, + s && s.playerX, + s && s.fallTypes, + e.inGame && e.inGame.playerDir, + )), + (a.rotation = i.rotation), + (a.width = i.width), + (a.height = i.height)); + }, + array: () => e.spikes, + testId: (t, a) => { + var i; + return `Spike-${null === (i = e.inGame) || void 0 === i + ? void 0 + : i.indexes[a] }`; - }, - }), - imageArray({ - fileName: `images/themes/world1/blue-spike-outline.png`, - props: () => ({}), - update: (a, i, n) => { - var s, o; - const r = - null === - (o = - null === (s = e.inGame) || void 0 === s - ? void 0 - : s.spikeStates) || void 0 === o - ? void 0 - : s.spikeStates[n]; - ((a.show = - i.init === "blue" && - !i.isLaser && - !i.isFade && - !(null == r ? void 0 : r.destroyed)), - (a.x = i.x), - (a.y = getBlockFallY( - i.x, - i.midY, - s && s.playerX, - s && s.fallTypes, - e.inGame && e.inGame.playerDir, - )), - (a.rotation = i.rotation), - (a.width = i.width), - (a.height = i.height)); - }, - array: () => e.spikes, - testId: (t, a) => { - var i; - return `Spike-${ - null === (i = e.inGame) || void 0 === i - ? void 0 - : i.indexes[a] + }, + }), + imageArray({ + fileName: `images/themes/${e.theme === "classic" ? "classic" : "world1"}/red-spike.png`, + props: () => ({}), + update: (a, i, n) => { + var s, o; + const r = + null === + (o = + null === (s = e.inGame) || void 0 === s + ? void 0 + : s.spikeStates) || void 0 === o + ? void 0 + : s.spikeStates[n]; + ((a.show = + i.init === "red" && + !i.isLaser && + !i.isFade && + !(null == r ? void 0 : r.destroyed)), + (a.x = i.x), + (a.y = getBlockFallY( + i.x, + i.y, + s && s.playerX, + s && s.fallTypes, + e.inGame && e.inGame.playerDir, + )), + (a.rotation = i.rotation), + (a.width = i.width), + (a.height = i.height)); + }, + array: () => e.spikes, + testId: (t, a) => { + var i; + return `Spike-${null === (i = e.inGame) || void 0 === i + ? void 0 + : i.indexes[a] }`; - }, - }), - imageArray({ - fileName: `images/themes/${e.theme === "classic" ? "classic" : "world1"}/blue-spike.png`, - props: () => ({}), - update: (a, i, n) => { - var s, o; - const r = - null === - (o = - null === (s = e.inGame) || void 0 === s - ? void 0 - : s.spikeStates) || void 0 === o - ? void 0 - : s.spikeStates[n]; - ((a.show = - i.init === "blue" && - !i.isLaser && - !i.isFade && - !(null == r ? void 0 : r.destroyed)), - (a.x = i.x), - (a.y = getBlockFallY( - i.x, - i.y, - s && s.playerX, - s && s.fallTypes, - e.inGame && e.inGame.playerDir, - )), - (a.rotation = i.rotation), - (a.width = i.width), - (a.height = i.height)); - }, - array: () => e.spikes, - testId: (t, a) => { - var i; - return `Spike-${ - null === (i = e.inGame) || void 0 === i - ? void 0 - : i.indexes[a] + }, + }), + imageArray({ + fileName: `images/themes/world1/blue-spike-outline.png`, + props: () => ({}), + update: (a, i, n) => { + var s, o; + const r = + null === + (o = + null === (s = e.inGame) || void 0 === s + ? void 0 + : s.spikeStates) || void 0 === o + ? void 0 + : s.spikeStates[n]; + ((a.show = + i.init === "blue" && + !i.isLaser && + !i.isFade && + !(null == r ? void 0 : r.destroyed)), + (a.x = i.x), + (a.y = getBlockFallY( + i.x, + i.midY, + s && s.playerX, + s && s.fallTypes, + e.inGame && e.inGame.playerDir, + )), + (a.rotation = i.rotation), + (a.width = i.width), + (a.height = i.height)); + }, + array: () => e.spikes, + testId: (t, a) => { + var i; + return `Spike-${null === (i = e.inGame) || void 0 === i + ? void 0 + : i.indexes[a] }`; - }, - }), - imageArray({ - fileName: `images/themes/${e.theme}/spike.png`, - props: () => ({}), - update: (a, i, n) => { - var s, o; - const r = - null === - (o = - null === (s = e.inGame) || void 0 === s - ? void 0 - : s.spikeStates) || void 0 === o - ? void 0 - : s.spikeStates[n]; - ((a.show = - !i.init && - (e.theme == "world2" ? i.width : 30) !== - $.miniSpikeWidth && - !i.isLaser && - !i.isFade && - !(null == r ? void 0 : r.destroyed)), - (a.x = i.x), - (a.y = getBlockFallY( - i.x, - i.y, - s && s.playerX, - s && s.fallTypes, - e.inGame && e.inGame.playerDir, - )), - (a.rotation = i.rotation), - (a.width = i.width * t), - (a.height = i.height * t)); - }, - array: () => e.spikes, - testId: (t, a) => { - var i; - return `Spike-${ - null === (i = e.inGame) || void 0 === i - ? void 0 - : i.indexes[a] + }, + }), + imageArray({ + fileName: `images/themes/${e.theme === "classic" ? "classic" : "world1"}/blue-spike.png`, + props: () => ({}), + update: (a, i, n) => { + var s, o; + const r = + null === + (o = + null === (s = e.inGame) || void 0 === s + ? void 0 + : s.spikeStates) || void 0 === o + ? void 0 + : s.spikeStates[n]; + ((a.show = + i.init === "blue" && + !i.isLaser && + !i.isFade && + !(null == r ? void 0 : r.destroyed)), + (a.x = i.x), + (a.y = getBlockFallY( + i.x, + i.y, + s && s.playerX, + s && s.fallTypes, + e.inGame && e.inGame.playerDir, + )), + (a.rotation = i.rotation), + (a.width = i.width), + (a.height = i.height)); + }, + array: () => e.spikes, + testId: (t, a) => { + var i; + return `Spike-${null === (i = e.inGame) || void 0 === i + ? void 0 + : i.indexes[a] }`; - }, - }), - imageArray({ - fileName: `images/themes/world2/spike-small.png`, - props: () => ({}), - update: (a, i, n) => { - var s, o; - const r = - null === - (o = - null === (s = e.inGame) || void 0 === s - ? void 0 - : s.spikeStates) || void 0 === o - ? void 0 - : s.spikeStates[n]; - ((a.show = - !i.init && - (e.theme == "world2" ? i.width : 30) === - $.miniSpikeWidth && - !i.isLaser && - !i.isFade && - !(null == r ? void 0 : r.destroyed)), - (a.x = i.x), - (a.y = getBlockFallY( - i.x, - i.y, - s && s.playerX, - s && s.fallTypes, - e.inGame && e.inGame.playerDir, - )), - (a.rotation = i.rotation), - (a.width = i.width * t), - (a.height = i.height * t)); - }, - array: () => e.spikes, - testId: (t, a) => { - var i; - return `Spike-${ - null === (i = e.inGame) || void 0 === i - ? void 0 - : i.indexes[a] + }, + }), + imageArray({ + fileName: `images/themes/${e.theme}/spike.png`, + props: () => ({}), + update: (a, i, n) => { + var s, o; + const r = + null === + (o = + null === (s = e.inGame) || void 0 === s + ? void 0 + : s.spikeStates) || void 0 === o + ? void 0 + : s.spikeStates[n]; + ((a.show = + !i.init && + (e.theme == "world2" ? i.width : 30) !== + $.miniSpikeWidth && + !i.isLaser && + !i.isFade && + !(null == r ? void 0 : r.destroyed)), + (a.x = i.x), + (a.y = getBlockFallY( + i.x, + i.y, + s && s.playerX, + s && s.fallTypes, + e.inGame && e.inGame.playerDir, + )), + (a.rotation = i.rotation), + (a.width = i.width * t), + (a.height = i.height * t)); + }, + array: () => e.spikes, + testId: (t, a) => { + var i; + return `Spike-${null === (i = e.inGame) || void 0 === i + ? void 0 + : i.indexes[a] }`; - }, - }), - imageArray({ - fileName: `images/themes/world3/spike-white.png`, - props: () => ({}), - update: (a, i, n) => { - var s, o; - const r = - null === - (o = - null === (s = e.inGame) || void 0 === s - ? void 0 - : s.spikeStates) || void 0 === o - ? void 0 - : s.spikeStates[n]; - ((a.show = - !i.init && - !i.isLaser && - i.isFade && - !(null == r ? void 0 : r.destroyed)), - (a.opacity = fadeFunction(s, i)), - (a.x = i.x), - (a.y = getBlockFallY( - i.x, - i.y, - s && s.playerX, - s && s.fallTypes, - e.inGame && e.inGame.playerDir, - )), - (a.rotation = i.rotation), - (a.width = i.width * (41 / 30)), - (a.height = i.height * (41 / 30))); - }, - array: () => e.spikes, - testId: (t, a) => { - var i; - return `Spike-${ - null === (i = e.inGame) || void 0 === i - ? void 0 - : i.indexes[a] + }, + }), + imageArray({ + fileName: `images/themes/world2/spike-small.png`, + props: () => ({}), + update: (a, i, n) => { + var s, o; + const r = + null === + (o = + null === (s = e.inGame) || void 0 === s + ? void 0 + : s.spikeStates) || void 0 === o + ? void 0 + : s.spikeStates[n]; + ((a.show = + !i.init && + (e.theme == "world2" ? i.width : 30) === + $.miniSpikeWidth && + !i.isLaser && + !i.isFade && + !(null == r ? void 0 : r.destroyed)), + (a.x = i.x), + (a.y = getBlockFallY( + i.x, + i.y, + s && s.playerX, + s && s.fallTypes, + e.inGame && e.inGame.playerDir, + )), + (a.rotation = i.rotation), + (a.width = i.width * t), + (a.height = i.height * t)); + }, + array: () => e.spikes, + testId: (t, a) => { + var i; + return `Spike-${null === (i = e.inGame) || void 0 === i + ? void 0 + : i.indexes[a] }`; - }, - }), - imageArray({ - fileName: `images/themes/${e.theme == "classic" ? "classic" : e.theme == "world2" ? "world2" : "world3"}/bottom/laser-line.png`, - props: () => ({}), - update: (a, i, n) => { - var s, o; - const r = - null === - (o = - null === (s = e.inGame) || void 0 === s - ? void 0 - : s.spikeStates) || void 0 === o - ? void 0 - : s.spikeStates[n]; - ((a.show = - !i.init && - i.isLaser && - !i.isFade && - !(null == r ? void 0 : r.destroyed)), - (a.x = i.x), - (a.y = getBlockFallY( - i.x, - i.y, - s && s.playerX, - s && s.fallTypes, - e.inGame && e.inGame.playerDir, - )), - (a.rotation = i.rotation), - (a.width = i.width), - (a.height = i.height)); - }, - array: () => e.spikes, - testId: (t, a) => { - var i; - return `Spike-${ - null === (i = e.inGame) || void 0 === i - ? void 0 - : i.indexes[a] + }, + }), + imageArray({ + fileName: `images/themes/world3/spike-white.png`, + props: () => ({}), + update: (a, i, n) => { + var s, o; + const r = + null === + (o = + null === (s = e.inGame) || void 0 === s + ? void 0 + : s.spikeStates) || void 0 === o + ? void 0 + : s.spikeStates[n]; + ((a.show = + !i.init && + !i.isLaser && + i.isFade && + !(null == r ? void 0 : r.destroyed)), + (a.opacity = fadeFunction(s, i)), + (a.x = i.x), + (a.y = getBlockFallY( + i.x, + i.y, + s && s.playerX, + s && s.fallTypes, + e.inGame && e.inGame.playerDir, + )), + (a.rotation = i.rotation), + (a.width = i.width * (41 / 30)), + (a.height = i.height * (41 / 30))); + }, + array: () => e.spikes, + testId: (t, a) => { + var i; + return `Spike-${null === (i = e.inGame) || void 0 === i + ? void 0 + : i.indexes[a] }`; - }, - }), - ]; - }, - ), - ifConditional( - () => void 0 !== e.inGame, - () => { - const t = "world3" === e.theme ? 41 / 30 : 1; - return [ - ei.Array({ - props: (t, a) => { - const i = e.inGame.spikeStates[a]; - return { - justDestroyed: - !!i.destroyed && - $a(i.destroyed.frame, e.inGame.frame), - paused: e.inGame.paused, - df: e.inGame.df, - x: t.x, - y: getBlockFallY( - t.x, - t.y, - e.inGame && e.inGame.playerX, - e.inGame && e.inGame.fallTypes, - e.inGame && e.inGame.playerDir, - ), - theme: e.theme.split("/")[0], - }; - }, - array: () => e.spikes, - filter: (t, a) => { - const i = e.inGame.spikeStates[a]; - return ( - void 0 !== i?.destroyed && - "missile" !== i?.destroyed?.by - ); - }, - key: (t, a) => e.inGame.indexes[a], - update: (t) => { - var a, i; - ((t.paused = - (null === (a = e.inGame) || void 0 === a - ? void 0 - : a.paused) || false), - (t.df = - (null === (i = e.inGame) || void 0 === i + }, + }), + imageArray({ + fileName: `images/themes/${e.theme == "classic" ? "classic" : e.theme == "world2" ? "world2" : "world3"}/bottom/laser-line.png`, + props: () => ({}), + update: (a, i, n) => { + var s, o; + const r = + null === + (o = + null === (s = e.inGame) || void 0 === s ? void 0 - : i.df) || 1)); - }, - }), - za.Array({ - props: (a, i) => { - const n = e.inGame.spikeStates[i]; - return { - objectX: a.x, - objectY: getBlockFallY( - a.x, - a.y, - e.inGame && e.inGame.playerX, - e.inGame && e.inGame.fallTypes, - e.inGame && e.inGame.playerDir, - ), - playerX: e.inGame.playerX, - playerY: e.inGame.playerY, - getSprite: (i, position) => - i - ? ei.Single( - { - justDestroyed: true, - paused: e.inGame.paused, - df: e.inGame.df, - x: position.x, - y: position.y, - theme: e.theme, - }, - (t) => { - ((t.paused = e.inGame.paused), - (t.df = e.inGame.df), - (t.y = position.y)); - }, - ) - : y( - { - fileName: a.isFade ? "images/themes/world3/spike-white.png" :a.isLaser - ? `images/themes/${e.theme == "classic" ? "classic" : e.theme == "world2" ? "world2" : "world3"}/bottom/laser-line.png` - : `images/themes/${e.theme}/spike.png`, - width: a.width * (a.isLaser ? 1 : t), - height: a.height * (a.isLaser ? 1 : t), - rotation: a.rotation, - }, - (e) => { - ((e.x = position.x), (e.y = position.y)); - }, - ), - justDestroyed: - !!n.destroyed && - $a(n.destroyed.frame, e.inGame.frame), - paused: e.inGame.paused, - }; - }, - array: () => e.spikes, - filter: (t, a) => { - var i; - return ( - "missile" === - (null === (i = e.inGame.spikeStates[a].destroyed) || - void 0 === i - ? void 0 - : i.by) - ); - }, - key: (t, a) => e.inGame.indexes[a], - update: (t, a) => { - var i; - ((t.paused = + : s.spikeStates) || void 0 === o + ? void 0 + : s.spikeStates[n]; + ((a.show = + !i.init && + i.isLaser && + !i.isFade && + !(null == r ? void 0 : r.destroyed)), + (a.x = i.x), + (a.y = getBlockFallY( + i.x, + i.y, + s && s.playerX, + s && s.fallTypes, + e.inGame && e.inGame.playerDir, + )), + (a.rotation = i.rotation), + (a.width = i.width), + (a.height = i.height)); + }, + array: () => e.spikes, + testId: (t, a) => { + var i; + return `Spike-${null === (i = e.inGame) || void 0 === i + ? void 0 + : i.indexes[a] + }`; + }, + }), + ]; + }, + ), + ifConditional( + () => void 0 !== e.inGame, + () => { + const t = "world3" === e.theme ? 41 / 30 : 1; + return [ + ei.Array({ + props: (t, a) => { + const i = e.inGame.spikeStates[a]; + return { + justDestroyed: + !!i.destroyed && + $a(i.destroyed.frame, e.inGame.frame), + paused: e.inGame.paused, + df: e.inGame.df, + x: t.x, + y: getBlockFallY( + t.x, + t.y, + e.inGame && e.inGame.playerX, + e.inGame && e.inGame.fallTypes, + e.inGame && e.inGame.playerDir, + ), + theme: e.theme.split("/")[0], + }; + }, + array: () => e.spikes, + filter: (t, a) => { + const i = e.inGame.spikeStates[a]; + return ( + void 0 !== i?.destroyed && + "missile" !== i?.destroyed?.by + ); + }, + key: (t, a) => e.inGame.indexes[a], + update: (t) => { + var a, i; + ((t.paused = + (null === (a = e.inGame) || void 0 === a + ? void 0 + : a.paused) || false), + (t.df = (null === (i = e.inGame) || void 0 === i ? void 0 - : i.paused) || false), - (t.playerX = e.inGame.playerX), - (t.playerY = e.inGame.playerY), - (t.objectX = a.x), - (t.objectY = getBlockFallY( - a.x, - a.y, - e.inGame && e.inGame.playerX, - e.inGame && e.inGame.fallTypes, - e.inGame && e.inGame.playerDir, - ))); - }, - }), - ]; - }, - ), - ], - }), - ei = makeSprite({ - init({ props: e, device: t, getContext: a }) { - if (e.justDestroyed) { - const { settings: e } = a(Se); - Ga("audio/levels/object-explosion.wav", t, e, 0); - } - return { show: e.justDestroyed }; - }, - render: ({ state: e, props: t }) => [ - ifConditional( - () => e.show, - () => [ - triggerableSpriteSheet.Single( - { - fileName: `images/themes/${t.theme == "classic" ? "classic" : "world2"}/spike-explosion.png`, - columns: 3, - rows: 2, - frameRate: 3, - width: 80, - height: 80, - paused: t.paused, - df: t.df, - onEnd: () => { - e.show = false; - }, + : i.df) || 1)); }, - (e) => { - ((e.paused = t.paused), (e.df = t.df)); + }), + za.Array({ + props: (a, i) => { + const n = e.inGame.spikeStates[i]; + return { + objectX: a.x, + objectY: getBlockFallY( + a.x, + a.y, + e.inGame && e.inGame.playerX, + e.inGame && e.inGame.fallTypes, + e.inGame && e.inGame.playerDir, + ), + playerX: e.inGame.playerX, + playerY: e.inGame.playerY, + getSprite: (i, position) => + i + ? ei.Single( + { + justDestroyed: true, + paused: e.inGame.paused, + df: e.inGame.df, + x: position.x, + y: position.y, + theme: e.theme, + }, + (t) => { + ((t.paused = e.inGame.paused), + (t.df = e.inGame.df), + (t.y = position.y)); + }, + ) + : y( + { + fileName: a.isFade ? "images/themes/world3/spike-white.png" : a.isLaser + ? `images/themes/${e.theme == "classic" ? "classic" : e.theme == "world2" ? "world2" : "world3"}/bottom/laser-line.png` + : `images/themes/${e.theme}/spike.png`, + width: a.width * (a.isLaser ? 1 : t), + height: a.height * (a.isLaser ? 1 : t), + rotation: a.rotation, + }, + (e) => { + ((e.x = position.x), (e.y = position.y)); + }, + ), + justDestroyed: + !!n.destroyed && + $a(n.destroyed.frame, e.inGame.frame), + paused: e.inGame.paused, + }; }, - ), - ], - ), - ], - }); - class ti { - constructor() { - ((this.entries = {}), (this.size = 0)); - } - add(e) { - let t = this.entries[e]; - return ((this.entries[e] = true), !t && (this.size++, true)); - } - addAll(e) { - let t = this.size; - for (var a = 0, i = e.length; a < i; a++) this.add(e[a]); - return t != this.size; - } - contains(e) { - return this.entries[e]; - } - clear() { - ((this.entries = {}), (this.size = 0)); - } + array: () => e.spikes, + filter: (t, a) => { + var i; + return ( + "missile" === + (null === (i = e.inGame.spikeStates[a].destroyed) || + void 0 === i + ? void 0 + : i.by) + ); + }, + key: (t, a) => e.inGame.indexes[a], + update: (t, a) => { + var i; + ((t.paused = + (null === (i = e.inGame) || void 0 === i + ? void 0 + : i.paused) || false), + (t.playerX = e.inGame.playerX), + (t.playerY = e.inGame.playerY), + (t.objectX = a.x), + (t.objectY = getBlockFallY( + a.x, + a.y, + e.inGame && e.inGame.playerX, + e.inGame && e.inGame.fallTypes, + e.inGame && e.inGame.playerDir, + ))); + }, + }), + ]; + }, + ), + ], + }), + ei = makeSprite({ + init({ props: e, device: t, getContext: a }) { + if (e.justDestroyed) { + const { settings: e } = a(Se); + Ga("audio/levels/object-explosion.wav", t, e, 0); + } + return { show: e.justDestroyed }; + }, + render: ({ state: e, props: t }) => [ + ifConditional( + () => e.show, + () => [ + triggerableSpriteSheet.Single( + { + fileName: `images/themes/${t.theme == "classic" ? "classic" : "world2"}/spike-explosion.png`, + columns: 3, + rows: 2, + frameRate: 3, + width: 80, + height: 80, + paused: t.paused, + df: t.df, + onEnd: () => { + e.show = false; + }, + }, + (e) => { + ((e.paused = t.paused), (e.df = t.df)); + }, + ), + ], + ), + ], + }); + class ti { + constructor() { + ((this.entries = {}), (this.size = 0)); } - class ai { - constructor(e = 0, t = 0, a = 0, i = 0) { - ((this.r = e), (this.g = t), (this.b = a), (this.a = i)); - } - set(e, t, a, i) { - return ( - (this.r = e), - (this.g = t), - (this.b = a), - (this.a = i), - this.clamp() - ); - } - setFromColor(e) { - return ( - (this.r = e.r), - (this.g = e.g), - (this.b = e.b), - (this.a = e.a), - this - ); - } - setFromString(e) { - return ( - (e = "#" == e.charAt(0) ? e.substr(1) : e), - (this.r = parseInt(e.substr(0, 2), 16) / 255), - (this.g = parseInt(e.substr(2, 2), 16) / 255), - (this.b = parseInt(e.substr(4, 2), 16) / 255), - (this.a = 8 != e.length ? 1 : parseInt(e.substr(6, 2), 16) / 255), - this - ); - } - add(e, t, a, i) { - return ( - (this.r += e), - (this.g += t), - (this.b += a), - (this.a += i), - this.clamp() - ); - } - clamp() { - return ( - this.r < 0 ? (this.r = 0) : this.r > 1 && (this.r = 1), - this.g < 0 ? (this.g = 0) : this.g > 1 && (this.g = 1), - this.b < 0 ? (this.b = 0) : this.b > 1 && (this.b = 1), - this.a < 0 ? (this.a = 0) : this.a > 1 && (this.a = 1), - this - ); - } - static rgba8888ToColor(e, t) { - ((e.r = ((4278190080 & t) >>> 24) / 255), - (e.g = ((16711680 & t) >>> 16) / 255), - (e.b = ((65280 & t) >>> 8) / 255), - (e.a = (255 & t) / 255)); - } - static rgb888ToColor(e, t) { - ((e.r = ((16711680 & t) >>> 16) / 255), - (e.g = ((65280 & t) >>> 8) / 255), - (e.b = (255 & t) / 255)); - } - static fromString(e) { - return new ai().setFromString(e); - } + add(e) { + let t = this.entries[e]; + return ((this.entries[e] = true), !t && (this.size++, true)); } - ((ai.WHITE = new ai(1, 1, 1, 1)), - (ai.RED = new ai(1, 0, 0, 1)), - (ai.GREEN = new ai(0, 1, 0, 1)), - (ai.BLUE = new ai(0, 0, 1, 1)), - (ai.MAGENTA = new ai(1, 0, 1, 1))); - class ii { - static clamp(e, t, a) { - return e < t ? t : e > a ? a : e; - } - static cosDeg(e) { - return Math.cos(e * ii.degRad); - } - static sinDeg(e) { - return Math.sin(e * ii.degRad); - } - static signum(e) { - return e > 0 ? 1 : e < 0 ? -1 : 0; - } - static toInt(e) { - return e > 0 ? Math.floor(e) : Math.ceil(e); - } - static cbrt(e) { - let t = Math.pow(Math.abs(e), 1 / 3); - return e < 0 ? -t : t; - } - static randomTriangular(e, t) { - return ii.randomTriangularWith(e, t, 0.5 * (e + t)); - } - static randomTriangularWith(e, t, a) { - let i = Math.random(), - n = t - e; - return i <= (a - e) / n - ? e + Math.sqrt(i * n * (a - e)) - : t - Math.sqrt((1 - i) * n * (t - a)); - } - static isPowerOfTwo(e) { - return e && 0 == (e & (e - 1)); - } + addAll(e) { + let t = this.size; + for (var a = 0, i = e.length; a < i; a++) this.add(e[a]); + return t != this.size; } - ((ii.PI = 3.1415927), - (ii.PI2 = 2 * ii.PI), - (ii.radiansToDegrees = 180 / ii.PI), - (ii.radDeg = ii.radiansToDegrees), - (ii.degreesToRadians = ii.PI / 180), - (ii.degRad = ii.degreesToRadians)); - class ni { - static arrayCopy(e, t, a, i, n) { - for (let s = t, o = i; s < t + n; s++, o++) a[o] = e[s]; - } - static arrayFill(e, t, a, i) { - for (let n = t; n < a; n++) e[n] = i; - } - static setArraySize(e, t, a = 0) { - let i = e.length; - if (i == t) return e; - if (((e.length = t), i < t)) for (let n = i; n < t; n++) e[n] = a; - return e; - } - static ensureArrayCapacity(e, t, a = 0) { - return e.length >= t ? e : ni.setArraySize(e, t, a); - } - static newArray(e, t) { - let a = new Array(e); - for (let i = 0; i < e; i++) a[i] = t; - return a; - } - static newFloatArray(e) { - if (ni.SUPPORTS_TYPED_ARRAYS) return new Float32Array(e); - { - let t = new Array(e); - for (let e = 0; e < t.length; e++) t[e] = 0; - return t; - } - } - static newShortArray(e) { - if (ni.SUPPORTS_TYPED_ARRAYS) return new Int16Array(e); - { - let t = new Array(e); - for (let e = 0; e < t.length; e++) t[e] = 0; - return t; - } - } - static toFloatArray(e) { - return ni.SUPPORTS_TYPED_ARRAYS ? new Float32Array(e) : e; - } - static toSinglePrecision(e) { - return ni.SUPPORTS_TYPED_ARRAYS ? Math.fround(e) : e; - } - static webkit602BugfixHelper(e, t) {} - static contains(e, t, a = true) { - for (var i = 0; i < e.length; i++) if (e[i] == t) return true; - return false; - } - static enumValue(e, t) { - return e[t[0].toUpperCase() + t.slice(1)]; - } + contains(e) { + return this.entries[e]; } - ni.SUPPORTS_TYPED_ARRAYS = "undefined" != typeof Float32Array; - class si { - constructor(e) { - ((this.items = new Array()), (this.instantiator = e)); - } - obtain() { - return this.items.length > 0 - ? this.items.pop() - : this.instantiator(); - } - free(e) { - (e.reset && e.reset(), this.items.push(e)); - } - freeAll(e) { - for (let t = 0; t < e.length; t++) this.free(e[t]); - } - clear() { - this.items.length = 0; - } + clear() { + ((this.entries = {}), (this.size = 0)); } - class oi { - constructor(e = 0, t = 0) { - ((this.x = e), (this.y = t)); - } - set(e, t) { - return ((this.x = e), (this.y = t), this); - } - length() { - let e = this.x, - t = this.y; - return Math.sqrt(e * e + t * t); - } - normalize() { - let e = this.length(); - return (0 != e && ((this.x /= e), (this.y /= e)), this); - } + } + class ai { + constructor(e = 0, t = 0, a = 0, i = 0) { + ((this.r = e), (this.g = t), (this.b = a), (this.a = i)); } - class ri { - constructor(e) { - if (!e) throw new Error("name cannot be null."); - this.name = e; - } + set(e, t, a, i) { + return ( + (this.r = e), + (this.g = t), + (this.b = a), + (this.a = i), + this.clamp() + ); } - class li extends ri { - constructor(e) { - (super(e), - (this.id = li.nextID++), - (this.worldVerticesLength = 0), - (this.timelineAttahment = this)); - } - computeWorldVertices(e, t, a, i, n, s) { - a = n + (a >> 1) * s; - let o = e.bone.skeleton, - r = e.deform, - l = this.vertices, - c = this.bones; - if (!c) { - r.length > 0 && (l = r); - let o = e.bone, - c = o.worldX, - d = o.worldY, - u = o.a, - h = o.b, - p = o.c, - g = o.d; - for (let e = t, o = n; o < a; e += 2, o += s) { - let t = l[e], - a = l[e + 1]; - ((i[o] = t * u + a * h + c), (i[o + 1] = t * p + a * g + d)); - } - return; - } - let d = 0, - u = 0; - for (let e = 0; e < t; e += 2) { - let e = c[d]; - ((d += e + 1), (u += e)); - } - let h = o.bones; - if (0 == r.length) - for (let e = n, t = 3 * u; e < a; e += s) { - let a = 0, - n = 0, - s = c[d++]; - for (s += d; d < s; d++, t += 3) { - let e = h[c[d]], - i = l[t], - s = l[t + 1], - o = l[t + 2]; - ((a += (i * e.a + s * e.b + e.worldX) * o), - (n += (i * e.c + s * e.d + e.worldY) * o)); - } - ((i[e] = a), (i[e + 1] = n)); - } - else { - let e = r; - for (let t = n, o = 3 * u, r = u << 1; t < a; t += s) { - let a = 0, - n = 0, - s = c[d++]; - for (s += d; d < s; d++, o += 3, r += 2) { - let t = h[c[d]], - i = l[o] + e[r], - s = l[o + 1] + e[r + 1], - u = l[o + 2]; - ((a += (i * t.a + s * t.b + t.worldX) * u), - (n += (i * t.c + s * t.d + t.worldY) * u)); - } - ((i[t] = a), (i[t + 1] = n)); - } - } - } - copyTo(e) { - (this.bones - ? ((e.bones = new Array(this.bones.length)), - ni.arrayCopy(this.bones, 0, e.bones, 0, this.bones.length)) - : (e.bones = null), - this.vertices - ? ((e.vertices = ni.newFloatArray(this.vertices.length)), - ni.arrayCopy( - this.vertices, - 0, - e.vertices, - 0, - this.vertices.length, - )) - : (e.vertices = null), - (e.worldVerticesLength = this.worldVerticesLength), - (e.timelineAttahment = this.timelineAttahment)); - } + setFromColor(e) { + return ( + (this.r = e.r), + (this.g = e.g), + (this.b = e.b), + (this.a = e.a), + this + ); } - li.nextID = 0; - class ci { - constructor(e) { - ((this.id = ci.nextID()), - (this.start = 0), - (this.digits = 0), - (this.setupIndex = 0), - (this.regions = new Array(e))); - } - copy() { - let e = new ci(this.regions.length); - return ( - ni.arrayCopy(this.regions, 0, e.regions, 0, this.regions.length), - (e.start = this.start), - (e.digits = this.digits), - (e.setupIndex = this.setupIndex), - e - ); - } - apply(e, t) { - let a = e.sequenceIndex; - (-1 == a && (a = this.setupIndex), - a >= this.regions.length && (a = this.regions.length - 1)); - let i = this.regions[a]; - t.region != i && ((t.region = i), t.updateRegion()); - } - getPath(e, t) { - let a = e, - i = (this.start + t).toString(); - for (let e = this.digits - i.length; e > 0; e--) a += "0"; - return ((a += i), a); - } - static nextID() { - return ci._nextID++; - } + setFromString(e) { + return ( + (e = "#" == e.charAt(0) ? e.substr(1) : e), + (this.r = parseInt(e.substr(0, 2), 16) / 255), + (this.g = parseInt(e.substr(2, 2), 16) / 255), + (this.b = parseInt(e.substr(4, 2), 16) / 255), + (this.a = 8 != e.length ? 1 : parseInt(e.substr(6, 2), 16) / 255), + this + ); } - var di; - ((ci._nextID = 0), - (function (e) { - ((e[(e.hold = 0)] = "hold"), - (e[(e.once = 1)] = "once"), - (e[(e.loop = 2)] = "loop"), - (e[(e.pingpong = 3)] = "pingpong"), - (e[(e.onceReverse = 4)] = "onceReverse"), - (e[(e.loopReverse = 5)] = "loopReverse"), - (e[(e.pingpongReverse = 6)] = "pingpongReverse")); - })(di || (di = {}))); - const ui = [ - di.hold, - di.once, - di.loop, - di.pingpong, - di.onceReverse, - di.loopReverse, - di.pingpongReverse, - ]; - class hi { - constructor(e, t, a) { - if (!e) throw new Error("name cannot be null."); - ((this.name = e), this.setTimelines(t), (this.duration = a)); - } - setTimelines(e) { - if (!e) throw new Error("timelines cannot be null."); - ((this.timelines = e), (this.timelineIds = new ti())); - for (var t = 0; t < e.length; t++) - this.timelineIds.addAll(e[t].getPropertyIds()); - } - hasTimeline(e) { - for (let t = 0; t < e.length; t++) - if (this.timelineIds.contains(e[t])) return true; - return false; - } - apply(e, t, a, i, n, s, o, r) { - if (!e) throw new Error("skeleton cannot be null."); - i && - 0 != this.duration && - ((a %= this.duration), t > 0 && (t %= this.duration)); - let l = this.timelines; - for (let i = 0, c = l.length; i < c; i++) - l[i].apply(e, t, a, n, s, o, r); - } + add(e, t, a, i) { + return ( + (this.r += e), + (this.g += t), + (this.b += a), + (this.a += i), + this.clamp() + ); } - var pi, gi; - (!(function (e) { - ((e[(e.setup = 0)] = "setup"), - (e[(e.first = 1)] = "first"), - (e[(e.replace = 2)] = "replace"), - (e[(e.add = 3)] = "add")); - })(pi || (pi = {})), - (function (e) { - ((e[(e.mixIn = 0)] = "mixIn"), (e[(e.mixOut = 1)] = "mixOut")); - })(gi || (gi = {}))); - class mi { - constructor(e, t) { - ((this.propertyIds = t), - (this.frames = ni.newFloatArray(e * this.getFrameEntries()))); - } - getPropertyIds() { - return this.propertyIds; - } - getFrameEntries() { - return 1; - } - getFrameCount() { - return this.frames.length / this.getFrameEntries(); - } - getDuration() { - return this.frames[this.frames.length - this.getFrameEntries()]; - } - static search1(e, t) { - let a = e.length; - for (let i = 1; i < a; i++) if (e[i] > t) return i - 1; - return a - 1; - } - static search(e, t, a) { - let i = e.length; - for (let n = a; n < i; n += a) if (e[n] > t) return n - a; - return i - a; - } + clamp() { + return ( + this.r < 0 ? (this.r = 0) : this.r > 1 && (this.r = 1), + this.g < 0 ? (this.g = 0) : this.g > 1 && (this.g = 1), + this.b < 0 ? (this.b = 0) : this.b > 1 && (this.b = 1), + this.a < 0 ? (this.a = 0) : this.a > 1 && (this.a = 1), + this + ); } - class fi extends mi { - constructor(e, t, a) { - (super(e, a), - (this.curves = ni.newFloatArray(e + 18 * t)), - (this.curves[e - 1] = 1)); - } - setLinear(e) { - this.curves[e] = 0; + static rgba8888ToColor(e, t) { + ((e.r = ((4278190080 & t) >>> 24) / 255), + (e.g = ((16711680 & t) >>> 16) / 255), + (e.b = ((65280 & t) >>> 8) / 255), + (e.a = (255 & t) / 255)); + } + static rgb888ToColor(e, t) { + ((e.r = ((16711680 & t) >>> 16) / 255), + (e.g = ((65280 & t) >>> 8) / 255), + (e.b = (255 & t) / 255)); + } + static fromString(e) { + return new ai().setFromString(e); + } + } + ((ai.WHITE = new ai(1, 1, 1, 1)), + (ai.RED = new ai(1, 0, 0, 1)), + (ai.GREEN = new ai(0, 1, 0, 1)), + (ai.BLUE = new ai(0, 0, 1, 1)), + (ai.MAGENTA = new ai(1, 0, 1, 1))); + class ii { + static clamp(e, t, a) { + return e < t ? t : e > a ? a : e; + } + static cosDeg(e) { + return Math.cos(e * ii.degRad); + } + static sinDeg(e) { + return Math.sin(e * ii.degRad); + } + static signum(e) { + return e > 0 ? 1 : e < 0 ? -1 : 0; + } + static toInt(e) { + return e > 0 ? Math.floor(e) : Math.ceil(e); + } + static cbrt(e) { + let t = Math.pow(Math.abs(e), 1 / 3); + return e < 0 ? -t : t; + } + static randomTriangular(e, t) { + return ii.randomTriangularWith(e, t, 0.5 * (e + t)); + } + static randomTriangularWith(e, t, a) { + let i = Math.random(), + n = t - e; + return i <= (a - e) / n + ? e + Math.sqrt(i * n * (a - e)) + : t - Math.sqrt((1 - i) * n * (t - a)); + } + static isPowerOfTwo(e) { + return e && 0 == (e & (e - 1)); + } + } + ((ii.PI = 3.1415927), + (ii.PI2 = 2 * ii.PI), + (ii.radiansToDegrees = 180 / ii.PI), + (ii.radDeg = ii.radiansToDegrees), + (ii.degreesToRadians = ii.PI / 180), + (ii.degRad = ii.degreesToRadians)); + class ni { + static arrayCopy(e, t, a, i, n) { + for (let s = t, o = i; s < t + n; s++, o++) a[o] = e[s]; + } + static arrayFill(e, t, a, i) { + for (let n = t; n < a; n++) e[n] = i; + } + static setArraySize(e, t, a = 0) { + let i = e.length; + if (i == t) return e; + if (((e.length = t), i < t)) for (let n = i; n < t; n++) e[n] = a; + return e; + } + static ensureArrayCapacity(e, t, a = 0) { + return e.length >= t ? e : ni.setArraySize(e, t, a); + } + static newArray(e, t) { + let a = new Array(e); + for (let i = 0; i < e; i++) a[i] = t; + return a; + } + static newFloatArray(e) { + if (ni.SUPPORTS_TYPED_ARRAYS) return new Float32Array(e); + { + let t = new Array(e); + for (let e = 0; e < t.length; e++) t[e] = 0; + return t; } - setStepped(e) { - this.curves[e] = 1; + } + static newShortArray(e) { + if (ni.SUPPORTS_TYPED_ARRAYS) return new Int16Array(e); + { + let t = new Array(e); + for (let e = 0; e < t.length; e++) t[e] = 0; + return t; } - shrink(e) { - let t = this.getFrameCount() + 18 * e; - if (this.curves.length > t) { - let e = ni.newFloatArray(t); - (ni.arrayCopy(this.curves, 0, e, 0, t), (this.curves = e)); + } + static toFloatArray(e) { + return ni.SUPPORTS_TYPED_ARRAYS ? new Float32Array(e) : e; + } + static toSinglePrecision(e) { + return ni.SUPPORTS_TYPED_ARRAYS ? Math.fround(e) : e; + } + static webkit602BugfixHelper(e, t) { } + static contains(e, t, a = true) { + for (var i = 0; i < e.length; i++) if (e[i] == t) return true; + return false; + } + static enumValue(e, t) { + return e[t[0].toUpperCase() + t.slice(1)]; + } + } + ni.SUPPORTS_TYPED_ARRAYS = "undefined" != typeof Float32Array; + class si { + constructor(e) { + ((this.items = new Array()), (this.instantiator = e)); + } + obtain() { + return this.items.length > 0 + ? this.items.pop() + : this.instantiator(); + } + free(e) { + (e.reset && e.reset(), this.items.push(e)); + } + freeAll(e) { + for (let t = 0; t < e.length; t++) this.free(e[t]); + } + clear() { + this.items.length = 0; + } + } + class oi { + constructor(e = 0, t = 0) { + ((this.x = e), (this.y = t)); + } + set(e, t) { + return ((this.x = e), (this.y = t), this); + } + length() { + let e = this.x, + t = this.y; + return Math.sqrt(e * e + t * t); + } + normalize() { + let e = this.length(); + return (0 != e && ((this.x /= e), (this.y /= e)), this); + } + } + class ri { + constructor(e) { + if (!e) throw new Error("name cannot be null."); + this.name = e; + } + } + class li extends ri { + constructor(e) { + (super(e), + (this.id = li.nextID++), + (this.worldVerticesLength = 0), + (this.timelineAttahment = this)); + } + computeWorldVertices(e, t, a, i, n, s) { + a = n + (a >> 1) * s; + let o = e.bone.skeleton, + r = e.deform, + l = this.vertices, + c = this.bones; + if (!c) { + r.length > 0 && (l = r); + let o = e.bone, + c = o.worldX, + d = o.worldY, + u = o.a, + h = o.b, + p = o.c, + g = o.d; + for (let e = t, o = n; o < a; e += 2, o += s) { + let t = l[e], + a = l[e + 1]; + ((i[o] = t * u + a * h + c), (i[o + 1] = t * p + a * g + d)); } - } - setBezier(e, t, a, i, n, s, o, r, l, c, d) { - let u = this.curves, - h = this.getFrameCount() + 18 * e; - 0 == a && (u[t] = 2 + h); - let p = 0.03 * (i - 2 * s + r), - g = 0.03 * (n - 2 * o + l), - m = 0.006 * (3 * (s - r) - i + c), - f = 0.006 * (3 * (o - l) - n + d), - y = 2 * p + m, - E = 2 * g + f, - b = 0.3 * (s - i) + p + 0.16666667 * m, - S = 0.3 * (o - n) + g + 0.16666667 * f, - I = i + b, - _ = n + S; - for (let e = h + 18; h < e; h += 2) - ((u[h] = I), - (u[h + 1] = _), - (b += y), - (S += E), - (y += m), - (E += f), - (I += b), - (_ += S)); - } - getBezierValue(e, t, a, i) { - let n = this.curves; - if (n[i] > e) { - let s = this.frames[t], - o = this.frames[t + a]; - return o + ((e - s) / (n[i] - s)) * (n[i + 1] - o); + return; + } + let d = 0, + u = 0; + for (let e = 0; e < t; e += 2) { + let e = c[d]; + ((d += e + 1), (u += e)); + } + let h = o.bones; + if (0 == r.length) + for (let e = n, t = 3 * u; e < a; e += s) { + let a = 0, + n = 0, + s = c[d++]; + for (s += d; d < s; d++, t += 3) { + let e = h[c[d]], + i = l[t], + s = l[t + 1], + o = l[t + 2]; + ((a += (i * e.a + s * e.b + e.worldX) * o), + (n += (i * e.c + s * e.d + e.worldY) * o)); + } + ((i[e] = a), (i[e + 1] = n)); } - let s = i + 18; - for (i += 2; i < s; i += 2) - if (n[i] >= e) { - let t = n[i - 2], - a = n[i - 1]; - return a + ((e - t) / (n[i] - t)) * (n[i + 1] - a); + else { + let e = r; + for (let t = n, o = 3 * u, r = u << 1; t < a; t += s) { + let a = 0, + n = 0, + s = c[d++]; + for (s += d; d < s; d++, o += 3, r += 2) { + let t = h[c[d]], + i = l[o] + e[r], + s = l[o + 1] + e[r + 1], + u = l[o + 2]; + ((a += (i * t.a + s * t.b + t.worldX) * u), + (n += (i * t.c + s * t.d + t.worldY) * u)); } - t += this.getFrameEntries(); - let o = n[s - 2], - r = n[s - 1]; - return ( - r + ((e - o) / (this.frames[t] - o)) * (this.frames[t + a] - r) - ); + ((i[t] = a), (i[t + 1] = n)); + } } } - class yi extends fi { - constructor(e, t, a) { - super(e, t, [a]); - } - getFrameEntries() { - return 2; - } - setFrame(e, t, a) { - ((e <<= 1), (this.frames[e] = t), (this.frames[e + 1] = a)); + copyTo(e) { + (this.bones + ? ((e.bones = new Array(this.bones.length)), + ni.arrayCopy(this.bones, 0, e.bones, 0, this.bones.length)) + : (e.bones = null), + this.vertices + ? ((e.vertices = ni.newFloatArray(this.vertices.length)), + ni.arrayCopy( + this.vertices, + 0, + e.vertices, + 0, + this.vertices.length, + )) + : (e.vertices = null), + (e.worldVerticesLength = this.worldVerticesLength), + (e.timelineAttahment = this.timelineAttahment)); + } + } + li.nextID = 0; + class ci { + constructor(e) { + ((this.id = ci.nextID()), + (this.start = 0), + (this.digits = 0), + (this.setupIndex = 0), + (this.regions = new Array(e))); + } + copy() { + let e = new ci(this.regions.length); + return ( + ni.arrayCopy(this.regions, 0, e.regions, 0, this.regions.length), + (e.start = this.start), + (e.digits = this.digits), + (e.setupIndex = this.setupIndex), + e + ); + } + apply(e, t) { + let a = e.sequenceIndex; + (-1 == a && (a = this.setupIndex), + a >= this.regions.length && (a = this.regions.length - 1)); + let i = this.regions[a]; + t.region != i && ((t.region = i), t.updateRegion()); + } + getPath(e, t) { + let a = e, + i = (this.start + t).toString(); + for (let e = this.digits - i.length; e > 0; e--) a += "0"; + return ((a += i), a); + } + static nextID() { + return ci._nextID++; + } + } + var di; + ((ci._nextID = 0), + (function (e) { + ((e[(e.hold = 0)] = "hold"), + (e[(e.once = 1)] = "once"), + (e[(e.loop = 2)] = "loop"), + (e[(e.pingpong = 3)] = "pingpong"), + (e[(e.onceReverse = 4)] = "onceReverse"), + (e[(e.loopReverse = 5)] = "loopReverse"), + (e[(e.pingpongReverse = 6)] = "pingpongReverse")); + })(di || (di = {}))); + const ui = [ + di.hold, + di.once, + di.loop, + di.pingpong, + di.onceReverse, + di.loopReverse, + di.pingpongReverse, + ]; + class hi { + constructor(e, t, a) { + if (!e) throw new Error("name cannot be null."); + ((this.name = e), this.setTimelines(t), (this.duration = a)); + } + setTimelines(e) { + if (!e) throw new Error("timelines cannot be null."); + ((this.timelines = e), (this.timelineIds = new ti())); + for (var t = 0; t < e.length; t++) + this.timelineIds.addAll(e[t].getPropertyIds()); + } + hasTimeline(e) { + for (let t = 0; t < e.length; t++) + if (this.timelineIds.contains(e[t])) return true; + return false; + } + apply(e, t, a, i, n, s, o, r) { + if (!e) throw new Error("skeleton cannot be null."); + i && + 0 != this.duration && + ((a %= this.duration), t > 0 && (t %= this.duration)); + let l = this.timelines; + for (let i = 0, c = l.length; i < c; i++) + l[i].apply(e, t, a, n, s, o, r); + } + } + var pi, gi; + (!(function (e) { + ((e[(e.setup = 0)] = "setup"), + (e[(e.first = 1)] = "first"), + (e[(e.replace = 2)] = "replace"), + (e[(e.add = 3)] = "add")); + })(pi || (pi = {})), + (function (e) { + ((e[(e.mixIn = 0)] = "mixIn"), (e[(e.mixOut = 1)] = "mixOut")); + })(gi || (gi = {}))); + class mi { + constructor(e, t) { + ((this.propertyIds = t), + (this.frames = ni.newFloatArray(e * this.getFrameEntries()))); + } + getPropertyIds() { + return this.propertyIds; + } + getFrameEntries() { + return 1; + } + getFrameCount() { + return this.frames.length / this.getFrameEntries(); + } + getDuration() { + return this.frames[this.frames.length - this.getFrameEntries()]; + } + static search1(e, t) { + let a = e.length; + for (let i = 1; i < a; i++) if (e[i] > t) return i - 1; + return a - 1; + } + static search(e, t, a) { + let i = e.length; + for (let n = a; n < i; n += a) if (e[n] > t) return n - a; + return i - a; + } + } + class fi extends mi { + constructor(e, t, a) { + (super(e, a), + (this.curves = ni.newFloatArray(e + 18 * t)), + (this.curves[e - 1] = 1)); + } + setLinear(e) { + this.curves[e] = 0; + } + setStepped(e) { + this.curves[e] = 1; + } + shrink(e) { + let t = this.getFrameCount() + 18 * e; + if (this.curves.length > t) { + let e = ni.newFloatArray(t); + (ni.arrayCopy(this.curves, 0, e, 0, t), (this.curves = e)); } - getCurveValue(e) { - let t = this.frames, - a = t.length - 2; - for (let i = 2; i <= a; i += 2) - if (t[i] > e) { - a = i - 2; - break; - } - let i = this.curves[a >> 1]; - switch (i) { - case 0: - let i = t[a], - n = t[a + 1]; - return n + ((e - i) / (t[a + 2] - i)) * (t[a + 2 + 1] - n); - case 1: - return t[a + 1]; + } + setBezier(e, t, a, i, n, s, o, r, l, c, d) { + let u = this.curves, + h = this.getFrameCount() + 18 * e; + 0 == a && (u[t] = 2 + h); + let p = 0.03 * (i - 2 * s + r), + g = 0.03 * (n - 2 * o + l), + m = 0.006 * (3 * (s - r) - i + c), + f = 0.006 * (3 * (o - l) - n + d), + y = 2 * p + m, + E = 2 * g + f, + b = 0.3 * (s - i) + p + 0.16666667 * m, + S = 0.3 * (o - n) + g + 0.16666667 * f, + I = i + b, + _ = n + S; + for (let e = h + 18; h < e; h += 2) + ((u[h] = I), + (u[h + 1] = _), + (b += y), + (S += E), + (y += m), + (E += f), + (I += b), + (_ += S)); + } + getBezierValue(e, t, a, i) { + let n = this.curves; + if (n[i] > e) { + let s = this.frames[t], + o = this.frames[t + a]; + return o + ((e - s) / (n[i] - s)) * (n[i + 1] - o); + } + let s = i + 18; + for (i += 2; i < s; i += 2) + if (n[i] >= e) { + let t = n[i - 2], + a = n[i - 1]; + return a + ((e - t) / (n[i] - t)) * (n[i + 1] - a); } - return this.getBezierValue(e, a, 1, i - 2); - } + t += this.getFrameEntries(); + let o = n[s - 2], + r = n[s - 1]; + return ( + r + ((e - o) / (this.frames[t] - o)) * (this.frames[t + a] - r) + ); } - class Ei extends fi { - constructor(e, t, a, i) { - super(e, t, [a, i]); - } - getFrameEntries() { - return 3; - } - setFrame(e, t, a, i) { - ((e *= 3), - (this.frames[e] = t), - (this.frames[e + 1] = a), - (this.frames[e + 2] = i)); - } + } + class yi extends fi { + constructor(e, t, a) { + super(e, t, [a]); } - class bi extends yi { - constructor(e, t, a) { - (super(e, t, "0|" + a), (this.boneIndex = 0), (this.boneIndex = a)); - } - apply(e, t, a, i, n, s, o) { - let r = e.bones[this.boneIndex]; - if (!r.active) return; - if (a < this.frames[0]) { - switch (s) { - case pi.setup: - return void (r.rotation = r.data.rotation); - case pi.first: - r.rotation += (r.data.rotation - r.rotation) * n; - } - return; + getFrameEntries() { + return 2; + } + setFrame(e, t, a) { + ((e <<= 1), (this.frames[e] = t), (this.frames[e + 1] = a)); + } + getCurveValue(e) { + let t = this.frames, + a = t.length - 2; + for (let i = 2; i <= a; i += 2) + if (t[i] > e) { + a = i - 2; + break; } - let l = this.getCurveValue(a); + let i = this.curves[a >> 1]; + switch (i) { + case 0: + let i = t[a], + n = t[a + 1]; + return n + ((e - i) / (t[a + 2] - i)) * (t[a + 2 + 1] - n); + case 1: + return t[a + 1]; + } + return this.getBezierValue(e, a, 1, i - 2); + } + } + class Ei extends fi { + constructor(e, t, a, i) { + super(e, t, [a, i]); + } + getFrameEntries() { + return 3; + } + setFrame(e, t, a, i) { + ((e *= 3), + (this.frames[e] = t), + (this.frames[e + 1] = a), + (this.frames[e + 2] = i)); + } + } + class bi extends yi { + constructor(e, t, a) { + (super(e, t, "0|" + a), (this.boneIndex = 0), (this.boneIndex = a)); + } + apply(e, t, a, i, n, s, o) { + let r = e.bones[this.boneIndex]; + if (!r.active) return; + if (a < this.frames[0]) { switch (s) { case pi.setup: - r.rotation = r.data.rotation + l * n; - break; + return void (r.rotation = r.data.rotation); case pi.first: - case pi.replace: - l += r.data.rotation - r.rotation; - case pi.add: - r.rotation += l * n; + r.rotation += (r.data.rotation - r.rotation) * n; } + return; + } + let l = this.getCurveValue(a); + switch (s) { + case pi.setup: + r.rotation = r.data.rotation + l * n; + break; + case pi.first: + case pi.replace: + l += r.data.rotation - r.rotation; + case pi.add: + r.rotation += l * n; } } - class Si extends Ei { - constructor(e, t, a) { - (super(e, t, "1|" + a, "2|" + a), - (this.boneIndex = 0), - (this.boneIndex = a)); - } - apply(e, t, a, i, n, s, o) { - let r = e.bones[this.boneIndex]; - if (!r.active) return; - let l = this.frames; - if (a < l[0]) { - switch (s) { - case pi.setup: - return ((r.x = r.data.x), void (r.y = r.data.y)); - case pi.first: - ((r.x += (r.data.x - r.x) * n), - (r.y += (r.data.y - r.y) * n)); - } - return; - } - let c = 0, - d = 0, - u = mi.search(l, a, 3), - h = this.curves[u / 3]; - switch (h) { - case 0: - let e = l[u]; - ((c = l[u + 1]), (d = l[u + 2])); - let t = (a - e) / (l[u + 3] - e); - ((c += (l[u + 3 + 1] - c) * t), (d += (l[u + 3 + 2] - d) * t)); - break; - case 1: - ((c = l[u + 1]), (d = l[u + 2])); - break; - default: - ((c = this.getBezierValue(a, u, 1, h - 2)), - (d = this.getBezierValue(a, u, 2, h + 18 - 2))); - } + } + class Si extends Ei { + constructor(e, t, a) { + (super(e, t, "1|" + a, "2|" + a), + (this.boneIndex = 0), + (this.boneIndex = a)); + } + apply(e, t, a, i, n, s, o) { + let r = e.bones[this.boneIndex]; + if (!r.active) return; + let l = this.frames; + if (a < l[0]) { switch (s) { case pi.setup: - ((r.x = r.data.x + c * n), (r.y = r.data.y + d * n)); - break; + return ((r.x = r.data.x), void (r.y = r.data.y)); case pi.first: - case pi.replace: - ((r.x += (r.data.x + c - r.x) * n), - (r.y += (r.data.y + d - r.y) * n)); - break; - case pi.add: - ((r.x += c * n), (r.y += d * n)); + ((r.x += (r.data.x - r.x) * n), + (r.y += (r.data.y - r.y) * n)); } + return; } - } - class Ii extends yi { - constructor(e, t, a) { - (super(e, t, "1|" + a), (this.boneIndex = 0), (this.boneIndex = a)); + let c = 0, + d = 0, + u = mi.search(l, a, 3), + h = this.curves[u / 3]; + switch (h) { + case 0: + let e = l[u]; + ((c = l[u + 1]), (d = l[u + 2])); + let t = (a - e) / (l[u + 3] - e); + ((c += (l[u + 3 + 1] - c) * t), (d += (l[u + 3 + 2] - d) * t)); + break; + case 1: + ((c = l[u + 1]), (d = l[u + 2])); + break; + default: + ((c = this.getBezierValue(a, u, 1, h - 2)), + (d = this.getBezierValue(a, u, 2, h + 18 - 2))); + } + switch (s) { + case pi.setup: + ((r.x = r.data.x + c * n), (r.y = r.data.y + d * n)); + break; + case pi.first: + case pi.replace: + ((r.x += (r.data.x + c - r.x) * n), + (r.y += (r.data.y + d - r.y) * n)); + break; + case pi.add: + ((r.x += c * n), (r.y += d * n)); } - apply(e, t, a, i, n, s, o) { - let r = e.bones[this.boneIndex]; - if (!r.active) return; - if (a < this.frames[0]) { - switch (s) { - case pi.setup: - return void (r.x = r.data.x); - case pi.first: - r.x += (r.data.x - r.x) * n; - } - return; - } - let l = this.getCurveValue(a); + } + } + class Ii extends yi { + constructor(e, t, a) { + (super(e, t, "1|" + a), (this.boneIndex = 0), (this.boneIndex = a)); + } + apply(e, t, a, i, n, s, o) { + let r = e.bones[this.boneIndex]; + if (!r.active) return; + if (a < this.frames[0]) { switch (s) { case pi.setup: - r.x = r.data.x + l * n; - break; + return void (r.x = r.data.x); case pi.first: - case pi.replace: - r.x += (r.data.x + l - r.x) * n; - break; - case pi.add: - r.x += l * n; + r.x += (r.data.x - r.x) * n; } + return; + } + let l = this.getCurveValue(a); + switch (s) { + case pi.setup: + r.x = r.data.x + l * n; + break; + case pi.first: + case pi.replace: + r.x += (r.data.x + l - r.x) * n; + break; + case pi.add: + r.x += l * n; } } - class _i extends yi { - constructor(e, t, a) { - (super(e, t, "2|" + a), (this.boneIndex = 0), (this.boneIndex = a)); - } - apply(e, t, a, i, n, s, o) { - let r = e.bones[this.boneIndex]; - if (!r.active) return; - if (a < this.frames[0]) { - switch (s) { - case pi.setup: - return void (r.y = r.data.y); - case pi.first: - r.y += (r.data.y - r.y) * n; - } - return; - } - let l = this.getCurveValue(a); + } + class _i extends yi { + constructor(e, t, a) { + (super(e, t, "2|" + a), (this.boneIndex = 0), (this.boneIndex = a)); + } + apply(e, t, a, i, n, s, o) { + let r = e.bones[this.boneIndex]; + if (!r.active) return; + if (a < this.frames[0]) { switch (s) { case pi.setup: - r.y = r.data.y + l * n; - break; + return void (r.y = r.data.y); case pi.first: - case pi.replace: - r.y += (r.data.y + l - r.y) * n; - break; - case pi.add: - r.y += l * n; + r.y += (r.data.y - r.y) * n; } + return; + } + let l = this.getCurveValue(a); + switch (s) { + case pi.setup: + r.y = r.data.y + l * n; + break; + case pi.first: + case pi.replace: + r.y += (r.data.y + l - r.y) * n; + break; + case pi.add: + r.y += l * n; } } - class vi extends Ei { - constructor(e, t, a) { - (super(e, t, "3|" + a, "4|" + a), - (this.boneIndex = 0), - (this.boneIndex = a)); + } + class vi extends Ei { + constructor(e, t, a) { + (super(e, t, "3|" + a, "4|" + a), + (this.boneIndex = 0), + (this.boneIndex = a)); + } + apply(e, t, a, i, n, s, o) { + let r = e.bones[this.boneIndex]; + if (!r.active) return; + let l, + c, + d = this.frames; + if (a < d[0]) { + switch (s) { + case pi.setup: + return ( + (r.scaleX = r.data.scaleX), + void (r.scaleY = r.data.scaleY) + ); + case pi.first: + ((r.scaleX += (r.data.scaleX - r.scaleX) * n), + (r.scaleY += (r.data.scaleY - r.scaleY) * n)); + } + return; } - apply(e, t, a, i, n, s, o) { - let r = e.bones[this.boneIndex]; - if (!r.active) return; - let l, - c, - d = this.frames; - if (a < d[0]) { + let u = mi.search(d, a, 3), + h = this.curves[u / 3]; + switch (h) { + case 0: + let e = d[u]; + ((l = d[u + 1]), (c = d[u + 2])); + let t = (a - e) / (d[u + 3] - e); + ((l += (d[u + 3 + 1] - l) * t), (c += (d[u + 3 + 2] - c) * t)); + break; + case 1: + ((l = d[u + 1]), (c = d[u + 2])); + break; + default: + ((l = this.getBezierValue(a, u, 1, h - 2)), + (c = this.getBezierValue(a, u, 2, h + 18 - 2))); + } + if (((l *= r.data.scaleX), (c *= r.data.scaleY), 1 == n)) + s == pi.add + ? ((r.scaleX += l - r.data.scaleX), + (r.scaleY += c - r.data.scaleY)) + : ((r.scaleX = l), (r.scaleY = c)); + else { + let e = 0, + t = 0; + if (o == gi.mixOut) switch (s) { case pi.setup: - return ( - (r.scaleX = r.data.scaleX), - void (r.scaleY = r.data.scaleY) - ); + ((e = r.data.scaleX), + (t = r.data.scaleY), + (r.scaleX = e + (Math.abs(l) * ii.signum(e) - e) * n), + (r.scaleY = t + (Math.abs(c) * ii.signum(t) - t) * n)); + break; case pi.first: - ((r.scaleX += (r.data.scaleX - r.scaleX) * n), - (r.scaleY += (r.data.scaleY - r.scaleY) * n)); + case pi.replace: + ((e = r.scaleX), + (t = r.scaleY), + (r.scaleX = e + (Math.abs(l) * ii.signum(e) - e) * n), + (r.scaleY = t + (Math.abs(c) * ii.signum(t) - t) * n)); + break; + case pi.add: + ((r.scaleX = (l - r.data.scaleX) * n), + (r.scaleY = (c - r.data.scaleY) * n)); } - return; - } - let u = mi.search(d, a, 3), - h = this.curves[u / 3]; - switch (h) { - case 0: - let e = d[u]; - ((l = d[u + 1]), (c = d[u + 2])); - let t = (a - e) / (d[u + 3] - e); - ((l += (d[u + 3 + 1] - l) * t), (c += (d[u + 3 + 2] - c) * t)); - break; - case 1: - ((l = d[u + 1]), (c = d[u + 2])); - break; - default: - ((l = this.getBezierValue(a, u, 1, h - 2)), - (c = this.getBezierValue(a, u, 2, h + 18 - 2))); - } - if (((l *= r.data.scaleX), (c *= r.data.scaleY), 1 == n)) - s == pi.add - ? ((r.scaleX += l - r.data.scaleX), - (r.scaleY += c - r.data.scaleY)) - : ((r.scaleX = l), (r.scaleY = c)); - else { - let e = 0, - t = 0; - if (o == gi.mixOut) - switch (s) { - case pi.setup: - ((e = r.data.scaleX), - (t = r.data.scaleY), - (r.scaleX = e + (Math.abs(l) * ii.signum(e) - e) * n), - (r.scaleY = t + (Math.abs(c) * ii.signum(t) - t) * n)); - break; - case pi.first: - case pi.replace: - ((e = r.scaleX), - (t = r.scaleY), - (r.scaleX = e + (Math.abs(l) * ii.signum(e) - e) * n), - (r.scaleY = t + (Math.abs(c) * ii.signum(t) - t) * n)); - break; - case pi.add: - ((r.scaleX = (l - r.data.scaleX) * n), - (r.scaleY = (c - r.data.scaleY) * n)); - } - else - switch (s) { - case pi.setup: - ((e = Math.abs(r.data.scaleX) * ii.signum(l)), - (t = Math.abs(r.data.scaleY) * ii.signum(c)), - (r.scaleX = e + (l - e) * n), - (r.scaleY = t + (c - t) * n)); - break; - case pi.first: - case pi.replace: - ((e = Math.abs(r.scaleX) * ii.signum(l)), - (t = Math.abs(r.scaleY) * ii.signum(c)), - (r.scaleX = e + (l - e) * n), - (r.scaleY = t + (c - t) * n)); - break; - case pi.add: - ((r.scaleX += (l - r.data.scaleX) * n), - (r.scaleY += (c - r.data.scaleY) * n)); - } - } - } - } - class Ti extends yi { - constructor(e, t, a) { - (super(e, t, "3|" + a), (this.boneIndex = 0), (this.boneIndex = a)); - } - apply(e, t, a, i, n, s, o) { - let r = e.bones[this.boneIndex]; - if (!r.active) return; - if (a < this.frames[0]) { + else switch (s) { case pi.setup: - return void (r.scaleX = r.data.scaleX); + ((e = Math.abs(r.data.scaleX) * ii.signum(l)), + (t = Math.abs(r.data.scaleY) * ii.signum(c)), + (r.scaleX = e + (l - e) * n), + (r.scaleY = t + (c - t) * n)); + break; case pi.first: - r.scaleX += (r.data.scaleX - r.scaleX) * n; + case pi.replace: + ((e = Math.abs(r.scaleX) * ii.signum(l)), + (t = Math.abs(r.scaleY) * ii.signum(c)), + (r.scaleX = e + (l - e) * n), + (r.scaleY = t + (c - t) * n)); + break; + case pi.add: + ((r.scaleX += (l - r.data.scaleX) * n), + (r.scaleY += (c - r.data.scaleY) * n)); } - return; - } - let l = this.getCurveValue(a) * r.data.scaleX; - if (1 == n) - s == pi.add ? (r.scaleX += l - r.data.scaleX) : (r.scaleX = l); - else { - let e = 0; - if (o == gi.mixOut) - switch (s) { - case pi.setup: - ((e = r.data.scaleX), - (r.scaleX = e + (Math.abs(l) * ii.signum(e) - e) * n)); - break; - case pi.first: - case pi.replace: - ((e = r.scaleX), - (r.scaleX = e + (Math.abs(l) * ii.signum(e) - e) * n)); - break; - case pi.add: - r.scaleX = (l - r.data.scaleX) * n; - } - else - switch (s) { - case pi.setup: - ((e = Math.abs(r.data.scaleX) * ii.signum(l)), - (r.scaleX = e + (l - e) * n)); - break; - case pi.first: - case pi.replace: - ((e = Math.abs(r.scaleX) * ii.signum(l)), - (r.scaleX = e + (l - e) * n)); - break; - case pi.add: - r.scaleX += (l - r.data.scaleX) * n; - } - } } } - class Ri extends yi { - constructor(e, t, a) { - (super(e, t, "4|" + a), (this.boneIndex = 0), (this.boneIndex = a)); + } + class Ti extends yi { + constructor(e, t, a) { + (super(e, t, "3|" + a), (this.boneIndex = 0), (this.boneIndex = a)); + } + apply(e, t, a, i, n, s, o) { + let r = e.bones[this.boneIndex]; + if (!r.active) return; + if (a < this.frames[0]) { + switch (s) { + case pi.setup: + return void (r.scaleX = r.data.scaleX); + case pi.first: + r.scaleX += (r.data.scaleX - r.scaleX) * n; + } + return; } - apply(e, t, a, i, n, s, o) { - let r = e.bones[this.boneIndex]; - if (!r.active) return; - if (a < this.frames[0]) { + let l = this.getCurveValue(a) * r.data.scaleX; + if (1 == n) + s == pi.add ? (r.scaleX += l - r.data.scaleX) : (r.scaleX = l); + else { + let e = 0; + if (o == gi.mixOut) switch (s) { case pi.setup: - return void (r.scaleY = r.data.scaleY); + ((e = r.data.scaleX), + (r.scaleX = e + (Math.abs(l) * ii.signum(e) - e) * n)); + break; case pi.first: - r.scaleY += (r.data.scaleY - r.scaleY) * n; + case pi.replace: + ((e = r.scaleX), + (r.scaleX = e + (Math.abs(l) * ii.signum(e) - e) * n)); + break; + case pi.add: + r.scaleX = (l - r.data.scaleX) * n; } - return; - } - let l = this.getCurveValue(a) * r.data.scaleY; - if (1 == n) - s == pi.add ? (r.scaleY += l - r.data.scaleY) : (r.scaleY = l); - else { - let e = 0; - if (o == gi.mixOut) - switch (s) { - case pi.setup: - ((e = r.data.scaleY), - (r.scaleY = e + (Math.abs(l) * ii.signum(e) - e) * n)); - break; - case pi.first: - case pi.replace: - ((e = r.scaleY), - (r.scaleY = e + (Math.abs(l) * ii.signum(e) - e) * n)); - break; - case pi.add: - r.scaleY = (l - r.data.scaleY) * n; - } - else - switch (s) { - case pi.setup: - ((e = Math.abs(r.data.scaleY) * ii.signum(l)), - (r.scaleY = e + (l - e) * n)); - break; - case pi.first: - case pi.replace: - ((e = Math.abs(r.scaleY) * ii.signum(l)), - (r.scaleY = e + (l - e) * n)); - break; - case pi.add: - r.scaleY += (l - r.data.scaleY) * n; - } - } - } - } - class Oi extends Ei { - constructor(e, t, a) { - (super(e, t, "5|" + a, "6|" + a), - (this.boneIndex = 0), - (this.boneIndex = a)); - } - apply(e, t, a, i, n, s, o) { - let r = e.bones[this.boneIndex]; - if (!r.active) return; - let l = this.frames; - if (a < l[0]) { + else switch (s) { case pi.setup: - return ( - (r.shearX = r.data.shearX), - void (r.shearY = r.data.shearY) - ); + ((e = Math.abs(r.data.scaleX) * ii.signum(l)), + (r.scaleX = e + (l - e) * n)); + break; case pi.first: - ((r.shearX += (r.data.shearX - r.shearX) * n), - (r.shearY += (r.data.shearY - r.shearY) * n)); + case pi.replace: + ((e = Math.abs(r.scaleX) * ii.signum(l)), + (r.scaleX = e + (l - e) * n)); + break; + case pi.add: + r.scaleX += (l - r.data.scaleX) * n; } - return; - } - let c = 0, - d = 0, - u = mi.search(l, a, 3), - h = this.curves[u / 3]; - switch (h) { - case 0: - let e = l[u]; - ((c = l[u + 1]), (d = l[u + 2])); - let t = (a - e) / (l[u + 3] - e); - ((c += (l[u + 3 + 1] - c) * t), (d += (l[u + 3 + 2] - d) * t)); - break; - case 1: - ((c = l[u + 1]), (d = l[u + 2])); - break; - default: - ((c = this.getBezierValue(a, u, 1, h - 2)), - (d = this.getBezierValue(a, u, 2, h + 18 - 2))); - } + } + } + } + class Ri extends yi { + constructor(e, t, a) { + (super(e, t, "4|" + a), (this.boneIndex = 0), (this.boneIndex = a)); + } + apply(e, t, a, i, n, s, o) { + let r = e.bones[this.boneIndex]; + if (!r.active) return; + if (a < this.frames[0]) { switch (s) { case pi.setup: - ((r.shearX = r.data.shearX + c * n), - (r.shearY = r.data.shearY + d * n)); - break; + return void (r.scaleY = r.data.scaleY); case pi.first: - case pi.replace: - ((r.shearX += (r.data.shearX + c - r.shearX) * n), - (r.shearY += (r.data.shearY + d - r.shearY) * n)); - break; - case pi.add: - ((r.shearX += c * n), (r.shearY += d * n)); + r.scaleY += (r.data.scaleY - r.scaleY) * n; } + return; } - } - class Ci extends yi { - constructor(e, t, a) { - (super(e, t, "5|" + a), (this.boneIndex = 0), (this.boneIndex = a)); - } - apply(e, t, a, i, n, s, o) { - let r = e.bones[this.boneIndex]; - if (!r.active) return; - if (a < this.frames[0]) { + let l = this.getCurveValue(a) * r.data.scaleY; + if (1 == n) + s == pi.add ? (r.scaleY += l - r.data.scaleY) : (r.scaleY = l); + else { + let e = 0; + if (o == gi.mixOut) switch (s) { case pi.setup: - return void (r.shearX = r.data.shearX); + ((e = r.data.scaleY), + (r.scaleY = e + (Math.abs(l) * ii.signum(e) - e) * n)); + break; case pi.first: - r.shearX += (r.data.shearX - r.shearX) * n; + case pi.replace: + ((e = r.scaleY), + (r.scaleY = e + (Math.abs(l) * ii.signum(e) - e) * n)); + break; + case pi.add: + r.scaleY = (l - r.data.scaleY) * n; } - return; - } - let l = this.getCurveValue(a); + else + switch (s) { + case pi.setup: + ((e = Math.abs(r.data.scaleY) * ii.signum(l)), + (r.scaleY = e + (l - e) * n)); + break; + case pi.first: + case pi.replace: + ((e = Math.abs(r.scaleY) * ii.signum(l)), + (r.scaleY = e + (l - e) * n)); + break; + case pi.add: + r.scaleY += (l - r.data.scaleY) * n; + } + } + } + } + class Oi extends Ei { + constructor(e, t, a) { + (super(e, t, "5|" + a, "6|" + a), + (this.boneIndex = 0), + (this.boneIndex = a)); + } + apply(e, t, a, i, n, s, o) { + let r = e.bones[this.boneIndex]; + if (!r.active) return; + let l = this.frames; + if (a < l[0]) { switch (s) { case pi.setup: - r.shearX = r.data.shearX + l * n; - break; + return ( + (r.shearX = r.data.shearX), + void (r.shearY = r.data.shearY) + ); case pi.first: - case pi.replace: - r.shearX += (r.data.shearX + l - r.shearX) * n; - break; - case pi.add: - r.shearX += l * n; + ((r.shearX += (r.data.shearX - r.shearX) * n), + (r.shearY += (r.data.shearY - r.shearY) * n)); } + return; } - } - class wi extends yi { - constructor(e, t, a) { - (super(e, t, "6|" + a), (this.boneIndex = 0), (this.boneIndex = a)); + let c = 0, + d = 0, + u = mi.search(l, a, 3), + h = this.curves[u / 3]; + switch (h) { + case 0: + let e = l[u]; + ((c = l[u + 1]), (d = l[u + 2])); + let t = (a - e) / (l[u + 3] - e); + ((c += (l[u + 3 + 1] - c) * t), (d += (l[u + 3 + 2] - d) * t)); + break; + case 1: + ((c = l[u + 1]), (d = l[u + 2])); + break; + default: + ((c = this.getBezierValue(a, u, 1, h - 2)), + (d = this.getBezierValue(a, u, 2, h + 18 - 2))); + } + switch (s) { + case pi.setup: + ((r.shearX = r.data.shearX + c * n), + (r.shearY = r.data.shearY + d * n)); + break; + case pi.first: + case pi.replace: + ((r.shearX += (r.data.shearX + c - r.shearX) * n), + (r.shearY += (r.data.shearY + d - r.shearY) * n)); + break; + case pi.add: + ((r.shearX += c * n), (r.shearY += d * n)); } - apply(e, t, a, i, n, s, o) { - let r = e.bones[this.boneIndex]; - if (!r.active) return; - if (a < this.frames[0]) { - switch (s) { - case pi.setup: - return void (r.shearY = r.data.shearY); - case pi.first: - r.shearY += (r.data.shearY - r.shearY) * n; - } - return; - } - let l = this.getCurveValue(a); + } + } + class Ci extends yi { + constructor(e, t, a) { + (super(e, t, "5|" + a), (this.boneIndex = 0), (this.boneIndex = a)); + } + apply(e, t, a, i, n, s, o) { + let r = e.bones[this.boneIndex]; + if (!r.active) return; + if (a < this.frames[0]) { switch (s) { case pi.setup: - r.shearY = r.data.shearY + l * n; - break; + return void (r.shearX = r.data.shearX); case pi.first: - case pi.replace: - r.shearY += (r.data.shearY + l - r.shearY) * n; - break; - case pi.add: - r.shearY += l * n; + r.shearX += (r.data.shearX - r.shearX) * n; } + return; + } + let l = this.getCurveValue(a); + switch (s) { + case pi.setup: + r.shearX = r.data.shearX + l * n; + break; + case pi.first: + case pi.replace: + r.shearX += (r.data.shearX + l - r.shearX) * n; + break; + case pi.add: + r.shearX += l * n; } } - class Ai extends fi { - constructor(e, t, a) { - (super(e, t, ["7|" + a, "8|" + a]), - (this.slotIndex = 0), - (this.slotIndex = a)); - } - getFrameEntries() { - return 5; - } - setFrame(e, t, a, i, n, s) { - ((e *= 5), - (this.frames[e] = t), - (this.frames[e + 1] = a), - (this.frames[e + 2] = i), - (this.frames[e + 3] = n), - (this.frames[e + 4] = s)); - } - apply(e, t, a, i, n, s, o) { - let r = e.slots[this.slotIndex]; - if (!r.bone.active) return; - let l = this.frames, - c = r.color; - if (a < l[0]) { - let e = r.data.color; - switch (s) { - case pi.setup: - return void c.setFromColor(e); - case pi.first: - c.add( - (e.r - c.r) * n, - (e.g - c.g) * n, - (e.b - c.b) * n, - (e.a - c.a) * n, - ); - } - return; - } - let d = 0, - u = 0, - h = 0, - p = 0, - g = mi.search(l, a, 5), - m = this.curves[g / 5]; - switch (m) { - case 0: - let e = l[g]; - ((d = l[g + 1]), - (u = l[g + 2]), - (h = l[g + 3]), - (p = l[g + 4])); - let t = (a - e) / (l[g + 5] - e); - ((d += (l[g + 5 + 1] - d) * t), - (u += (l[g + 5 + 2] - u) * t), - (h += (l[g + 5 + 3] - h) * t), - (p += (l[g + 5 + 4] - p) * t)); - break; - case 1: - ((d = l[g + 1]), - (u = l[g + 2]), - (h = l[g + 3]), - (p = l[g + 4])); - break; - default: - ((d = this.getBezierValue(a, g, 1, m - 2)), - (u = this.getBezierValue(a, g, 2, m + 18 - 2)), - (h = this.getBezierValue(a, g, 3, m + 36 - 2)), - (p = this.getBezierValue(a, g, 4, m + 54 - 2))); + } + class wi extends yi { + constructor(e, t, a) { + (super(e, t, "6|" + a), (this.boneIndex = 0), (this.boneIndex = a)); + } + apply(e, t, a, i, n, s, o) { + let r = e.bones[this.boneIndex]; + if (!r.active) return; + if (a < this.frames[0]) { + switch (s) { + case pi.setup: + return void (r.shearY = r.data.shearY); + case pi.first: + r.shearY += (r.data.shearY - r.shearY) * n; } - 1 == n - ? c.set(d, u, h, p) - : (s == pi.setup && c.setFromColor(r.data.color), - c.add( - (d - c.r) * n, - (u - c.g) * n, - (h - c.b) * n, - (p - c.a) * n, - )); + return; + } + let l = this.getCurveValue(a); + switch (s) { + case pi.setup: + r.shearY = r.data.shearY + l * n; + break; + case pi.first: + case pi.replace: + r.shearY += (r.data.shearY + l - r.shearY) * n; + break; + case pi.add: + r.shearY += l * n; } } - class ki extends fi { - constructor(e, t, a) { - (super(e, t, ["7|" + a]), - (this.slotIndex = 0), - (this.slotIndex = a)); - } - getFrameEntries() { - return 4; - } - setFrame(e, t, a, i, n) { - ((e <<= 2), - (this.frames[e] = t), - (this.frames[e + 1] = a), - (this.frames[e + 2] = i), - (this.frames[e + 3] = n)); - } - apply(e, t, a, i, n, s, o) { - let r = e.slots[this.slotIndex]; - if (!r.bone.active) return; - let l = this.frames, - c = r.color; - if (a < l[0]) { - let e = r.data.color; - switch (s) { - case pi.setup: - return ((c.r = e.r), (c.g = e.g), void (c.b = e.b)); - case pi.first: - ((c.r += (e.r - c.r) * n), - (c.g += (e.g - c.g) * n), - (c.b += (e.b - c.b) * n)); - } - return; - } - let d = 0, - u = 0, - h = 0, - p = mi.search(l, a, 4), - g = this.curves[p >> 2]; - switch (g) { - case 0: - let e = l[p]; - ((d = l[p + 1]), (u = l[p + 2]), (h = l[p + 3])); - let t = (a - e) / (l[p + 4] - e); - ((d += (l[p + 4 + 1] - d) * t), - (u += (l[p + 4 + 2] - u) * t), - (h += (l[p + 4 + 3] - h) * t)); - break; - case 1: - ((d = l[p + 1]), (u = l[p + 2]), (h = l[p + 3])); - break; - default: - ((d = this.getBezierValue(a, p, 1, g - 2)), - (u = this.getBezierValue(a, p, 2, g + 18 - 2)), - (h = this.getBezierValue(a, p, 3, g + 36 - 2))); - } - if (1 == n) ((c.r = d), (c.g = u), (c.b = h)); - else { - if (s == pi.setup) { - let e = r.data.color; - ((c.r = e.r), (c.g = e.g), (c.b = e.b)); - } - ((c.r += (d - c.r) * n), - (c.g += (u - c.g) * n), - (c.b += (h - c.b) * n)); + } + class Ai extends fi { + constructor(e, t, a) { + (super(e, t, ["7|" + a, "8|" + a]), + (this.slotIndex = 0), + (this.slotIndex = a)); + } + getFrameEntries() { + return 5; + } + setFrame(e, t, a, i, n, s) { + ((e *= 5), + (this.frames[e] = t), + (this.frames[e + 1] = a), + (this.frames[e + 2] = i), + (this.frames[e + 3] = n), + (this.frames[e + 4] = s)); + } + apply(e, t, a, i, n, s, o) { + let r = e.slots[this.slotIndex]; + if (!r.bone.active) return; + let l = this.frames, + c = r.color; + if (a < l[0]) { + let e = r.data.color; + switch (s) { + case pi.setup: + return void c.setFromColor(e); + case pi.first: + c.add( + (e.r - c.r) * n, + (e.g - c.g) * n, + (e.b - c.b) * n, + (e.a - c.a) * n, + ); } - } + return; + } + let d = 0, + u = 0, + h = 0, + p = 0, + g = mi.search(l, a, 5), + m = this.curves[g / 5]; + switch (m) { + case 0: + let e = l[g]; + ((d = l[g + 1]), + (u = l[g + 2]), + (h = l[g + 3]), + (p = l[g + 4])); + let t = (a - e) / (l[g + 5] - e); + ((d += (l[g + 5 + 1] - d) * t), + (u += (l[g + 5 + 2] - u) * t), + (h += (l[g + 5 + 3] - h) * t), + (p += (l[g + 5 + 4] - p) * t)); + break; + case 1: + ((d = l[g + 1]), + (u = l[g + 2]), + (h = l[g + 3]), + (p = l[g + 4])); + break; + default: + ((d = this.getBezierValue(a, g, 1, m - 2)), + (u = this.getBezierValue(a, g, 2, m + 18 - 2)), + (h = this.getBezierValue(a, g, 3, m + 36 - 2)), + (p = this.getBezierValue(a, g, 4, m + 54 - 2))); + } + 1 == n + ? c.set(d, u, h, p) + : (s == pi.setup && c.setFromColor(r.data.color), + c.add( + (d - c.r) * n, + (u - c.g) * n, + (h - c.b) * n, + (p - c.a) * n, + )); + } + } + class ki extends fi { + constructor(e, t, a) { + (super(e, t, ["7|" + a]), + (this.slotIndex = 0), + (this.slotIndex = a)); } - class Ni extends yi { - constructor(e, t, a) { - (super(e, t, "8|" + a), (this.slotIndex = 0), (this.slotIndex = a)); + getFrameEntries() { + return 4; + } + setFrame(e, t, a, i, n) { + ((e <<= 2), + (this.frames[e] = t), + (this.frames[e + 1] = a), + (this.frames[e + 2] = i), + (this.frames[e + 3] = n)); + } + apply(e, t, a, i, n, s, o) { + let r = e.slots[this.slotIndex]; + if (!r.bone.active) return; + let l = this.frames, + c = r.color; + if (a < l[0]) { + let e = r.data.color; + switch (s) { + case pi.setup: + return ((c.r = e.r), (c.g = e.g), void (c.b = e.b)); + case pi.first: + ((c.r += (e.r - c.r) * n), + (c.g += (e.g - c.g) * n), + (c.b += (e.b - c.b) * n)); + } + return; + } + let d = 0, + u = 0, + h = 0, + p = mi.search(l, a, 4), + g = this.curves[p >> 2]; + switch (g) { + case 0: + let e = l[p]; + ((d = l[p + 1]), (u = l[p + 2]), (h = l[p + 3])); + let t = (a - e) / (l[p + 4] - e); + ((d += (l[p + 4 + 1] - d) * t), + (u += (l[p + 4 + 2] - u) * t), + (h += (l[p + 4 + 3] - h) * t)); + break; + case 1: + ((d = l[p + 1]), (u = l[p + 2]), (h = l[p + 3])); + break; + default: + ((d = this.getBezierValue(a, p, 1, g - 2)), + (u = this.getBezierValue(a, p, 2, g + 18 - 2)), + (h = this.getBezierValue(a, p, 3, g + 36 - 2))); } - apply(e, t, a, i, n, s, o) { - let r = e.slots[this.slotIndex]; - if (!r.bone.active) return; - let l = r.color; - if (a < this.frames[0]) { + if (1 == n) ((c.r = d), (c.g = u), (c.b = h)); + else { + if (s == pi.setup) { let e = r.data.color; - switch (s) { - case pi.setup: - return void (l.a = e.a); - case pi.first: - l.a += (e.a - l.a) * n; - } - return; + ((c.r = e.r), (c.g = e.g), (c.b = e.b)); } - let c = this.getCurveValue(a); - 1 == n - ? (l.a = c) - : (s == pi.setup && (l.a = r.data.color.a), - (l.a += (c - l.a) * n)); + ((c.r += (d - c.r) * n), + (c.g += (u - c.g) * n), + (c.b += (h - c.b) * n)); } } - class xi extends fi { - constructor(e, t, a) { - (super(e, t, ["7|" + a, "8|" + a, "9|" + a]), - (this.slotIndex = 0), - (this.slotIndex = a)); - } - getFrameEntries() { - return 8; - } - setFrame(e, t, a, i, n, s, o, r, l) { - ((e <<= 3), - (this.frames[e] = t), - (this.frames[e + 1] = a), - (this.frames[e + 2] = i), - (this.frames[e + 3] = n), - (this.frames[e + 4] = s), - (this.frames[e + 5] = o), - (this.frames[e + 6] = r), - (this.frames[e + 7] = l)); - } - apply(e, t, a, i, n, s, o) { - let r = e.slots[this.slotIndex]; - if (!r.bone.active) return; - let l = this.frames, - c = r.color, - d = r.darkColor; - if (a < l[0]) { - let e = r.data.color, - t = r.data.darkColor; - switch (s) { - case pi.setup: - return ( - c.setFromColor(e), - (d.r = t.r), - (d.g = t.g), - void (d.b = t.b) - ); - case pi.first: - (c.add( - (e.r - c.r) * n, - (e.g - c.g) * n, - (e.b - c.b) * n, - (e.a - c.a) * n, - ), - (d.r += (t.r - d.r) * n), - (d.g += (t.g - d.g) * n), - (d.b += (t.b - d.b) * n)); - } - return; - } - let u = 0, - h = 0, - p = 0, - g = 0, - m = 0, - f = 0, - y = 0, - E = mi.search(l, a, 8), - b = this.curves[E >> 3]; - switch (b) { - case 0: - let e = l[E]; - ((u = l[E + 1]), - (h = l[E + 2]), - (p = l[E + 3]), - (g = l[E + 4]), - (m = l[E + 5]), - (f = l[E + 6]), - (y = l[E + 7])); - let t = (a - e) / (l[E + 8] - e); - ((u += (l[E + 8 + 1] - u) * t), - (h += (l[E + 8 + 2] - h) * t), - (p += (l[E + 8 + 3] - p) * t), - (g += (l[E + 8 + 4] - g) * t), - (m += (l[E + 8 + 5] - m) * t), - (f += (l[E + 8 + 6] - f) * t), - (y += (l[E + 8 + 7] - y) * t)); - break; - case 1: - ((u = l[E + 1]), - (h = l[E + 2]), - (p = l[E + 3]), - (g = l[E + 4]), - (m = l[E + 5]), - (f = l[E + 6]), - (y = l[E + 7])); - break; - default: - ((u = this.getBezierValue(a, E, 1, b - 2)), - (h = this.getBezierValue(a, E, 2, b + 18 - 2)), - (p = this.getBezierValue(a, E, 3, b + 36 - 2)), - (g = this.getBezierValue(a, E, 4, b + 54 - 2)), - (m = this.getBezierValue(a, E, 5, b + 72 - 2)), - (f = this.getBezierValue(a, E, 6, b + 90 - 2)), - (y = this.getBezierValue(a, E, 7, b + 108 - 2))); - } - if (1 == n) (c.set(u, h, p, g), (d.r = m), (d.g = f), (d.b = y)); - else { - if (s == pi.setup) { - c.setFromColor(r.data.color); - let e = r.data.darkColor; - ((d.r = e.r), (d.g = e.g), (d.b = e.b)); - } - (c.add( - (u - c.r) * n, - (h - c.g) * n, - (p - c.b) * n, - (g - c.a) * n, - ), - (d.r += (m - d.r) * n), - (d.g += (f - d.g) * n), - (d.b += (y - d.b) * n)); + } + class Ni extends yi { + constructor(e, t, a) { + (super(e, t, "8|" + a), (this.slotIndex = 0), (this.slotIndex = a)); + } + apply(e, t, a, i, n, s, o) { + let r = e.slots[this.slotIndex]; + if (!r.bone.active) return; + let l = r.color; + if (a < this.frames[0]) { + let e = r.data.color; + switch (s) { + case pi.setup: + return void (l.a = e.a); + case pi.first: + l.a += (e.a - l.a) * n; } + return; } + let c = this.getCurveValue(a); + 1 == n + ? (l.a = c) + : (s == pi.setup && (l.a = r.data.color.a), + (l.a += (c - l.a) * n)); } - class Pi extends fi { - constructor(e, t, a) { - (super(e, t, ["7|" + a, "9|" + a]), - (this.slotIndex = 0), - (this.slotIndex = a)); - } - getFrameEntries() { - return 7; - } - setFrame(e, t, a, i, n, s, o, r) { - ((e *= 7), - (this.frames[e] = t), - (this.frames[e + 1] = a), - (this.frames[e + 2] = i), - (this.frames[e + 3] = n), - (this.frames[e + 4] = s), - (this.frames[e + 5] = o), - (this.frames[e + 6] = r)); - } - apply(e, t, a, i, n, s, o) { - let r = e.slots[this.slotIndex]; - if (!r.bone.active) return; - let l = this.frames, - c = r.color, - d = r.darkColor; - if (a < l[0]) { - let e = r.data.color, - t = r.data.darkColor; - switch (s) { - case pi.setup: - return ( - (c.r = e.r), - (c.g = e.g), - (c.b = e.b), - (d.r = t.r), - (d.g = t.g), - void (d.b = t.b) - ); - case pi.first: - ((c.r += (e.r - c.r) * n), - (c.g += (e.g - c.g) * n), - (c.b += (e.b - c.b) * n), - (d.r += (t.r - d.r) * n), - (d.g += (t.g - d.g) * n), - (d.b += (t.b - d.b) * n)); - } - return; + } + class xi extends fi { + constructor(e, t, a) { + (super(e, t, ["7|" + a, "8|" + a, "9|" + a]), + (this.slotIndex = 0), + (this.slotIndex = a)); + } + getFrameEntries() { + return 8; + } + setFrame(e, t, a, i, n, s, o, r, l) { + ((e <<= 3), + (this.frames[e] = t), + (this.frames[e + 1] = a), + (this.frames[e + 2] = i), + (this.frames[e + 3] = n), + (this.frames[e + 4] = s), + (this.frames[e + 5] = o), + (this.frames[e + 6] = r), + (this.frames[e + 7] = l)); + } + apply(e, t, a, i, n, s, o) { + let r = e.slots[this.slotIndex]; + if (!r.bone.active) return; + let l = this.frames, + c = r.color, + d = r.darkColor; + if (a < l[0]) { + let e = r.data.color, + t = r.data.darkColor; + switch (s) { + case pi.setup: + return ( + c.setFromColor(e), + (d.r = t.r), + (d.g = t.g), + void (d.b = t.b) + ); + case pi.first: + (c.add( + (e.r - c.r) * n, + (e.g - c.g) * n, + (e.b - c.b) * n, + (e.a - c.a) * n, + ), + (d.r += (t.r - d.r) * n), + (d.g += (t.g - d.g) * n), + (d.b += (t.b - d.b) * n)); } - let u = 0, - h = 0, - p = 0, - g = 0, - m = 0, - f = 0, - y = mi.search(l, a, 7), - E = this.curves[y / 7]; - switch (E) { - case 0: - let e = l[y]; - ((u = l[y + 1]), - (h = l[y + 2]), - (p = l[y + 3]), - (g = l[y + 4]), - (m = l[y + 5]), - (f = l[y + 6])); - let t = (a - e) / (l[y + 7] - e); - ((u += (l[y + 7 + 1] - u) * t), - (h += (l[y + 7 + 2] - h) * t), - (p += (l[y + 7 + 3] - p) * t), - (g += (l[y + 7 + 4] - g) * t), - (m += (l[y + 7 + 5] - m) * t), - (f += (l[y + 7 + 6] - f) * t)); - break; - case 1: - ((u = l[y + 1]), - (h = l[y + 2]), - (p = l[y + 3]), - (g = l[y + 4]), - (m = l[y + 5]), - (f = l[y + 6])); - break; - default: - ((u = this.getBezierValue(a, y, 1, E - 2)), - (h = this.getBezierValue(a, y, 2, E + 18 - 2)), - (p = this.getBezierValue(a, y, 3, E + 36 - 2)), - (g = this.getBezierValue(a, y, 4, E + 54 - 2)), - (m = this.getBezierValue(a, y, 5, E + 72 - 2)), - (f = this.getBezierValue(a, y, 6, E + 90 - 2))); + return; + } + let u = 0, + h = 0, + p = 0, + g = 0, + m = 0, + f = 0, + y = 0, + E = mi.search(l, a, 8), + b = this.curves[E >> 3]; + switch (b) { + case 0: + let e = l[E]; + ((u = l[E + 1]), + (h = l[E + 2]), + (p = l[E + 3]), + (g = l[E + 4]), + (m = l[E + 5]), + (f = l[E + 6]), + (y = l[E + 7])); + let t = (a - e) / (l[E + 8] - e); + ((u += (l[E + 8 + 1] - u) * t), + (h += (l[E + 8 + 2] - h) * t), + (p += (l[E + 8 + 3] - p) * t), + (g += (l[E + 8 + 4] - g) * t), + (m += (l[E + 8 + 5] - m) * t), + (f += (l[E + 8 + 6] - f) * t), + (y += (l[E + 8 + 7] - y) * t)); + break; + case 1: + ((u = l[E + 1]), + (h = l[E + 2]), + (p = l[E + 3]), + (g = l[E + 4]), + (m = l[E + 5]), + (f = l[E + 6]), + (y = l[E + 7])); + break; + default: + ((u = this.getBezierValue(a, E, 1, b - 2)), + (h = this.getBezierValue(a, E, 2, b + 18 - 2)), + (p = this.getBezierValue(a, E, 3, b + 36 - 2)), + (g = this.getBezierValue(a, E, 4, b + 54 - 2)), + (m = this.getBezierValue(a, E, 5, b + 72 - 2)), + (f = this.getBezierValue(a, E, 6, b + 90 - 2)), + (y = this.getBezierValue(a, E, 7, b + 108 - 2))); + } + if (1 == n) (c.set(u, h, p, g), (d.r = m), (d.g = f), (d.b = y)); + else { + if (s == pi.setup) { + c.setFromColor(r.data.color); + let e = r.data.darkColor; + ((d.r = e.r), (d.g = e.g), (d.b = e.b)); } - if (1 == n) - ((c.r = u), - (c.g = h), - (c.b = p), - (d.r = g), - (d.g = m), - (d.b = f)); - else { - if (s == pi.setup) { - let e = r.data.color, - t = r.data.darkColor; - ((c.r = e.r), + (c.add( + (u - c.r) * n, + (h - c.g) * n, + (p - c.b) * n, + (g - c.a) * n, + ), + (d.r += (m - d.r) * n), + (d.g += (f - d.g) * n), + (d.b += (y - d.b) * n)); + } + } + } + class Pi extends fi { + constructor(e, t, a) { + (super(e, t, ["7|" + a, "9|" + a]), + (this.slotIndex = 0), + (this.slotIndex = a)); + } + getFrameEntries() { + return 7; + } + setFrame(e, t, a, i, n, s, o, r) { + ((e *= 7), + (this.frames[e] = t), + (this.frames[e + 1] = a), + (this.frames[e + 2] = i), + (this.frames[e + 3] = n), + (this.frames[e + 4] = s), + (this.frames[e + 5] = o), + (this.frames[e + 6] = r)); + } + apply(e, t, a, i, n, s, o) { + let r = e.slots[this.slotIndex]; + if (!r.bone.active) return; + let l = this.frames, + c = r.color, + d = r.darkColor; + if (a < l[0]) { + let e = r.data.color, + t = r.data.darkColor; + switch (s) { + case pi.setup: + return ( + (c.r = e.r), (c.g = e.g), (c.b = e.b), (d.r = t.r), (d.g = t.g), - (d.b = t.b)); - } - ((c.r += (u - c.r) * n), - (c.g += (h - c.g) * n), - (c.b += (p - c.b) * n), - (d.r += (g - d.r) * n), - (d.g += (m - d.g) * n), - (d.b += (f - d.b) * n)); + void (d.b = t.b) + ); + case pi.first: + ((c.r += (e.r - c.r) * n), + (c.g += (e.g - c.g) * n), + (c.b += (e.b - c.b) * n), + (d.r += (t.r - d.r) * n), + (d.g += (t.g - d.g) * n), + (d.b += (t.b - d.b) * n)); } + return; } - } - class Mi extends mi { - constructor(e, t) { - (super(e, ["10|" + t]), - (this.slotIndex = 0), - (this.slotIndex = t), - (this.attachmentNames = new Array(e))); - } - getFrameCount() { - return this.frames.length; - } - setFrame(e, t, a) { - ((this.frames[e] = t), (this.attachmentNames[e] = a)); - } - apply(e, t, a, i, n, s, o) { - let r = e.slots[this.slotIndex]; - r.bone.active && - (o != gi.mixOut - ? a < this.frames[0] - ? (s != pi.setup && s != pi.first) || - this.setAttachment(e, r, r.data.attachmentName) - : this.setAttachment( - e, - r, - this.attachmentNames[mi.search1(this.frames, a)], - ) - : s == pi.setup && - this.setAttachment(e, r, r.data.attachmentName)); - } - setAttachment(e, t, a) { - t.setAttachment(a ? e.getAttachment(this.slotIndex, a) : null); + let u = 0, + h = 0, + p = 0, + g = 0, + m = 0, + f = 0, + y = mi.search(l, a, 7), + E = this.curves[y / 7]; + switch (E) { + case 0: + let e = l[y]; + ((u = l[y + 1]), + (h = l[y + 2]), + (p = l[y + 3]), + (g = l[y + 4]), + (m = l[y + 5]), + (f = l[y + 6])); + let t = (a - e) / (l[y + 7] - e); + ((u += (l[y + 7 + 1] - u) * t), + (h += (l[y + 7 + 2] - h) * t), + (p += (l[y + 7 + 3] - p) * t), + (g += (l[y + 7 + 4] - g) * t), + (m += (l[y + 7 + 5] - m) * t), + (f += (l[y + 7 + 6] - f) * t)); + break; + case 1: + ((u = l[y + 1]), + (h = l[y + 2]), + (p = l[y + 3]), + (g = l[y + 4]), + (m = l[y + 5]), + (f = l[y + 6])); + break; + default: + ((u = this.getBezierValue(a, y, 1, E - 2)), + (h = this.getBezierValue(a, y, 2, E + 18 - 2)), + (p = this.getBezierValue(a, y, 3, E + 36 - 2)), + (g = this.getBezierValue(a, y, 4, E + 54 - 2)), + (m = this.getBezierValue(a, y, 5, E + 72 - 2)), + (f = this.getBezierValue(a, y, 6, E + 90 - 2))); + } + if (1 == n) + ((c.r = u), + (c.g = h), + (c.b = p), + (d.r = g), + (d.g = m), + (d.b = f)); + else { + if (s == pi.setup) { + let e = r.data.color, + t = r.data.darkColor; + ((c.r = e.r), + (c.g = e.g), + (c.b = e.b), + (d.r = t.r), + (d.g = t.g), + (d.b = t.b)); + } + ((c.r += (u - c.r) * n), + (c.g += (h - c.g) * n), + (c.b += (p - c.b) * n), + (d.r += (g - d.r) * n), + (d.g += (m - d.g) * n), + (d.b += (f - d.b) * n)); } } - class Li extends fi { - constructor(e, t, a, i) { - (super(e, t, ["11|" + a + "|" + i.id]), - (this.slotIndex = 0), - (this.slotIndex = a), - (this.attachment = i), - (this.vertices = new Array(e))); - } - getFrameCount() { - return this.frames.length; - } - setFrame(e, t, a) { - ((this.frames[e] = t), (this.vertices[e] = a)); - } - setBezier(e, t, a, i, n, s, o, r, l, c, d) { - let u = this.curves, - h = this.getFrameCount() + 18 * e; - 0 == a && (u[t] = 2 + h); - let p = 0.03 * (i - 2 * s + r), - g = 0.03 * l - 0.06 * o, - m = 0.006 * (3 * (s - r) - i + c), - f = 0.018 * (o - l + 0.33333333), - y = 2 * p + m, - E = 2 * g + f, - b = 0.3 * (s - i) + p + 0.16666667 * m, - S = 0.3 * o + g + 0.16666667 * f, - I = i + b, - _ = S; - for (let e = h + 18; h < e; h += 2) - ((u[h] = I), - (u[h + 1] = _), - (b += y), - (S += E), - (y += m), - (E += f), - (I += b), - (_ += S)); - } - getCurvePercent(e, t) { - let a = this.curves, - i = a[t]; - switch (i) { - case 0: - let a = this.frames[t]; - return (e - a) / (this.frames[t + this.getFrameEntries()] - a); - case 1: - return 0; + } + class Mi extends mi { + constructor(e, t) { + (super(e, ["10|" + t]), + (this.slotIndex = 0), + (this.slotIndex = t), + (this.attachmentNames = new Array(e))); + } + getFrameCount() { + return this.frames.length; + } + setFrame(e, t, a) { + ((this.frames[e] = t), (this.attachmentNames[e] = a)); + } + apply(e, t, a, i, n, s, o) { + let r = e.slots[this.slotIndex]; + r.bone.active && + (o != gi.mixOut + ? a < this.frames[0] + ? (s != pi.setup && s != pi.first) || + this.setAttachment(e, r, r.data.attachmentName) + : this.setAttachment( + e, + r, + this.attachmentNames[mi.search1(this.frames, a)], + ) + : s == pi.setup && + this.setAttachment(e, r, r.data.attachmentName)); + } + setAttachment(e, t, a) { + t.setAttachment(a ? e.getAttachment(this.slotIndex, a) : null); + } + } + class Li extends fi { + constructor(e, t, a, i) { + (super(e, t, ["11|" + a + "|" + i.id]), + (this.slotIndex = 0), + (this.slotIndex = a), + (this.attachment = i), + (this.vertices = new Array(e))); + } + getFrameCount() { + return this.frames.length; + } + setFrame(e, t, a) { + ((this.frames[e] = t), (this.vertices[e] = a)); + } + setBezier(e, t, a, i, n, s, o, r, l, c, d) { + let u = this.curves, + h = this.getFrameCount() + 18 * e; + 0 == a && (u[t] = 2 + h); + let p = 0.03 * (i - 2 * s + r), + g = 0.03 * l - 0.06 * o, + m = 0.006 * (3 * (s - r) - i + c), + f = 0.018 * (o - l + 0.33333333), + y = 2 * p + m, + E = 2 * g + f, + b = 0.3 * (s - i) + p + 0.16666667 * m, + S = 0.3 * o + g + 0.16666667 * f, + I = i + b, + _ = S; + for (let e = h + 18; h < e; h += 2) + ((u[h] = I), + (u[h + 1] = _), + (b += y), + (S += E), + (y += m), + (E += f), + (I += b), + (_ += S)); + } + getCurvePercent(e, t) { + let a = this.curves, + i = a[t]; + switch (i) { + case 0: + let a = this.frames[t]; + return (e - a) / (this.frames[t + this.getFrameEntries()] - a); + case 1: + return 0; + } + if (((i -= 2), a[i] > e)) { + let n = this.frames[t]; + return (a[i + 1] * (e - n)) / (a[i] - n); + } + let n = i + 18; + for (i += 2; i < n; i += 2) + if (a[i] >= e) { + let t = a[i - 2], + n = a[i - 1]; + return n + ((e - t) / (a[i] - t)) * (a[i + 1] - n); } - if (((i -= 2), a[i] > e)) { - let n = this.frames[t]; - return (a[i + 1] * (e - n)) / (a[i] - n); + let s = a[n - 2], + o = a[n - 1]; + return ( + o + + ((1 - o) * (e - s)) / + (this.frames[t + this.getFrameEntries()] - s) + ); + } + apply(e, t, a, i, n, s, o) { + let r = e.slots[this.slotIndex]; + if (!r.bone.active) return; + let l = r.getAttachment(); + if (!(l instanceof li) || l.timelineAttahment != this.attachment) + return; + let c = r.deform; + 0 == c.length && (s = pi.setup); + let d = this.vertices, + u = d[0].length, + h = this.frames; + if (a < h[0]) { + switch (s) { + case pi.setup: + return void (c.length = 0); + case pi.first: + if (1 == n) return void (c.length = 0); + c.length = u; + let e = l; + if (e.bones) for (n = 1 - n, p = 0; p < u; p++) c[p] *= n; + else { + let t = e.vertices; + for (var p = 0; p < u; p++) c[p] += (t[p] - c[p]) * n; + } } - let n = i + 18; - for (i += 2; i < n; i += 2) - if (a[i] >= e) { - let t = a[i - 2], - n = a[i - 1]; - return n + ((e - t) / (a[i] - t)) * (a[i + 1] - n); - } - let s = a[n - 2], - o = a[n - 1]; - return ( - o + - ((1 - o) * (e - s)) / - (this.frames[t + this.getFrameEntries()] - s) - ); + return; } - apply(e, t, a, i, n, s, o) { - let r = e.slots[this.slotIndex]; - if (!r.bone.active) return; - let l = r.getAttachment(); - if (!(l instanceof li) || l.timelineAttahment != this.attachment) - return; - let c = r.deform; - 0 == c.length && (s = pi.setup); - let d = this.vertices, - u = d[0].length, - h = this.frames; - if (a < h[0]) { + if (((c.length = u), a >= h[h.length - 1])) { + let e = d[h.length - 1]; + if (1 == n) + if (s == pi.add) { + let t = l; + if (t.bones) for (let t = 0; t < u; t++) c[t] += e[t]; + else { + let a = t.vertices; + for (let t = 0; t < u; t++) c[t] += e[t] - a[t]; + } + } else ni.arrayCopy(e, 0, c, 0, u); + else switch (s) { - case pi.setup: - return void (c.length = 0); - case pi.first: - if (1 == n) return void (c.length = 0); - c.length = u; - let e = l; - if (e.bones) for (n = 1 - n, p = 0; p < u; p++) c[p] *= n; + case pi.setup: { + let t = l; + if (t.bones) for (let t = 0; t < u; t++) c[t] = e[t] * n; else { - let t = e.vertices; - for (var p = 0; p < u; p++) c[p] += (t[p] - c[p]) * n; + let a = t.vertices; + for (let t = 0; t < u; t++) { + let i = a[t]; + c[t] = i + (e[t] - i) * n; + } } - } - return; - } - if (((c.length = u), a >= h[h.length - 1])) { - let e = d[h.length - 1]; - if (1 == n) - if (s == pi.add) { + break; + } + case pi.first: + case pi.replace: + for (let t = 0; t < u; t++) c[t] += (e[t] - c[t]) * n; + break; + case pi.add: let t = l; - if (t.bones) for (let t = 0; t < u; t++) c[t] += e[t]; + if (t.bones) for (let t = 0; t < u; t++) c[t] += e[t] * n; else { let a = t.vertices; - for (let t = 0; t < u; t++) c[t] += e[t] - a[t]; - } - } else ni.arrayCopy(e, 0, c, 0, u); - else - switch (s) { - case pi.setup: { - let t = l; - if (t.bones) for (let t = 0; t < u; t++) c[t] = e[t] * n; - else { - let a = t.vertices; - for (let t = 0; t < u; t++) { - let i = a[t]; - c[t] = i + (e[t] - i) * n; - } - } - break; + for (let t = 0; t < u; t++) c[t] += (e[t] - a[t]) * n; } - case pi.first: - case pi.replace: - for (let t = 0; t < u; t++) c[t] += (e[t] - c[t]) * n; - break; - case pi.add: - let t = l; - if (t.bones) for (let t = 0; t < u; t++) c[t] += e[t] * n; - else { - let a = t.vertices; - for (let t = 0; t < u; t++) c[t] += (e[t] - a[t]) * n; - } + } + return; + } + let g = mi.search1(h, a), + m = this.getCurvePercent(a, g), + f = d[g], + y = d[g + 1]; + if (1 == n) + if (s == pi.add) { + let e = l; + if (e.bones) + for (let e = 0; e < u; e++) { + let t = f[e]; + c[e] += t + (y[e] - t) * m; } - return; - } - let g = mi.search1(h, a), - m = this.getCurvePercent(a, g), - f = d[g], - y = d[g + 1]; - if (1 == n) - if (s == pi.add) { + else { + let t = e.vertices; + for (let e = 0; e < u; e++) { + let a = f[e]; + c[e] += a + (y[e] - a) * m - t[e]; + } + } + } else + for (let e = 0; e < u; e++) { + let t = f[e]; + c[e] = t + (y[e] - t) * m; + } + else + switch (s) { + case pi.setup: { let e = l; if (e.bones) for (let e = 0; e < u; e++) { let t = f[e]; - c[e] += t + (y[e] - t) * m; + c[e] = (t + (y[e] - t) * m) * n; } else { let t = e.vertices; for (let e = 0; e < u; e++) { - let a = f[e]; - c[e] += a + (y[e] - a) * m - t[e]; + let a = f[e], + i = t[e]; + c[e] = i + (a + (y[e] - a) * m - i) * n; } } - } else + break; + } + case pi.first: + case pi.replace: for (let e = 0; e < u; e++) { let t = f[e]; - c[e] = t + (y[e] - t) * m; - } - else - switch (s) { - case pi.setup: { - let e = l; - if (e.bones) - for (let e = 0; e < u; e++) { - let t = f[e]; - c[e] = (t + (y[e] - t) * m) * n; - } - else { - let t = e.vertices; - for (let e = 0; e < u; e++) { - let a = f[e], - i = t[e]; - c[e] = i + (a + (y[e] - a) * m - i) * n; - } - } - break; + c[e] += (t + (y[e] - t) * m - c[e]) * n; } - case pi.first: - case pi.replace: + break; + case pi.add: + let e = l; + if (e.bones) for (let e = 0; e < u; e++) { let t = f[e]; - c[e] += (t + (y[e] - t) * m - c[e]) * n; + c[e] += (t + (y[e] - t) * m) * n; } - break; - case pi.add: - let e = l; - if (e.bones) - for (let e = 0; e < u; e++) { - let t = f[e]; - c[e] += (t + (y[e] - t) * m) * n; - } - else { - let t = e.vertices; - for (let e = 0; e < u; e++) { - let a = f[e]; - c[e] += (a + (y[e] - a) * m - t[e]) * n; - } + else { + let t = e.vertices; + for (let e = 0; e < u; e++) { + let a = f[e]; + c[e] += (a + (y[e] - a) * m - t[e]) * n; } - } - } + } + } } - class Di extends mi { - constructor(e) { - (super(e, Di.propertyIds), (this.events = new Array(e))); - } - getFrameCount() { - return this.frames.length; - } - setFrame(e, t) { - ((this.frames[e] = t.time), (this.events[e] = t)); - } - apply(e, t, a, i, n, s, o) { - if (!i) return; - let r = this.frames, - l = this.frames.length; - if (t > a) - (this.apply(e, t, Number.MAX_VALUE, i, n, s, o), (t = -1)); - else if (t >= r[l - 1]) return; - if (a < r[0]) return; - let c = 0; - if (t < r[0]) c = 0; - else { - c = mi.search1(r, t) + 1; - let e = r[c]; - for (; c > 0 && r[c - 1] == e; ) c--; + } + class Di extends mi { + constructor(e) { + (super(e, Di.propertyIds), (this.events = new Array(e))); + } + getFrameCount() { + return this.frames.length; + } + setFrame(e, t) { + ((this.frames[e] = t.time), (this.events[e] = t)); + } + apply(e, t, a, i, n, s, o) { + if (!i) return; + let r = this.frames, + l = this.frames.length; + if (t > a) + (this.apply(e, t, Number.MAX_VALUE, i, n, s, o), (t = -1)); + else if (t >= r[l - 1]) return; + if (a < r[0]) return; + let c = 0; + if (t < r[0]) c = 0; + else { + c = mi.search1(r, t) + 1; + let e = r[c]; + for (; c > 0 && r[c - 1] == e;) c--; + } + for (; c < l && a >= r[c]; c++) i.push(this.events[c]); + } + } + Di.propertyIds = ["12"]; + class Bi extends mi { + constructor(e) { + (super(e, Bi.propertyIds), (this.drawOrders = new Array(e))); + } + getFrameCount() { + return this.frames.length; + } + setFrame(e, t, a) { + ((this.frames[e] = t), (this.drawOrders[e] = a)); + } + apply(e, t, a, i, n, s, o) { + if (o == gi.mixOut) + return void ( + s == pi.setup && + ni.arrayCopy(e.slots, 0, e.drawOrder, 0, e.slots.length) + ); + if (a < this.frames[0]) + return void ( + (s != pi.setup && s != pi.first) || + ni.arrayCopy(e.slots, 0, e.drawOrder, 0, e.slots.length) + ); + let r = this.drawOrders[mi.search1(this.frames, a)]; + if (r) { + let t = e.drawOrder, + a = e.slots; + for (let e = 0, i = r.length; e < i; e++) t[e] = a[r[e]]; + } else ni.arrayCopy(e.slots, 0, e.drawOrder, 0, e.slots.length); + } + } + Bi.propertyIds = ["13"]; + class Fi extends fi { + constructor(e, t, a) { + (super(e, t, ["14|" + a]), (this.ikConstraintIndex = a)); + } + getFrameEntries() { + return 6; + } + setFrame(e, t, a, i, n, s, o) { + ((e *= 6), + (this.frames[e] = t), + (this.frames[e + 1] = a), + (this.frames[e + 2] = i), + (this.frames[e + 3] = n), + (this.frames[e + 4] = s ? 1 : 0), + (this.frames[e + 5] = o ? 1 : 0)); + } + apply(e, t, a, i, n, s, o) { + let r = e.ikConstraints[this.ikConstraintIndex]; + if (!r.active) return; + let l = this.frames; + if (a < l[0]) { + switch (s) { + case pi.setup: + return ( + (r.mix = r.data.mix), + (r.softness = r.data.softness), + (r.bendDirection = r.data.bendDirection), + (r.compress = r.data.compress), + void (r.stretch = r.data.stretch) + ); + case pi.first: + ((r.mix += (r.data.mix - r.mix) * n), + (r.softness += (r.data.softness - r.softness) * n), + (r.bendDirection = r.data.bendDirection), + (r.compress = r.data.compress), + (r.stretch = r.data.stretch)); } - for (; c < l && a >= r[c]; c++) i.push(this.events[c]); + return; } + let c = 0, + d = 0, + u = mi.search(l, a, 6), + h = this.curves[u / 6]; + switch (h) { + case 0: + let e = l[u]; + ((c = l[u + 1]), (d = l[u + 2])); + let t = (a - e) / (l[u + 6] - e); + ((c += (l[u + 6 + 1] - c) * t), (d += (l[u + 6 + 2] - d) * t)); + break; + case 1: + ((c = l[u + 1]), (d = l[u + 2])); + break; + default: + ((c = this.getBezierValue(a, u, 1, h - 2)), + (d = this.getBezierValue(a, u, 2, h + 18 - 2))); + } + s == pi.setup + ? ((r.mix = r.data.mix + (c - r.data.mix) * n), + (r.softness = r.data.softness + (d - r.data.softness) * n), + o == gi.mixOut + ? ((r.bendDirection = r.data.bendDirection), + (r.compress = r.data.compress), + (r.stretch = r.data.stretch)) + : ((r.bendDirection = l[u + 3]), + (r.compress = 0 != l[u + 4]), + (r.stretch = 0 != l[u + 5]))) + : ((r.mix += (c - r.mix) * n), + (r.softness += (d - r.softness) * n), + o == gi.mixIn && + ((r.bendDirection = l[u + 3]), + (r.compress = 0 != l[u + 4]), + (r.stretch = 0 != l[u + 5]))); } - Di.propertyIds = ["12"]; - class Bi extends mi { - constructor(e) { - (super(e, Bi.propertyIds), (this.drawOrders = new Array(e))); - } - getFrameCount() { - return this.frames.length; - } - setFrame(e, t, a) { - ((this.frames[e] = t), (this.drawOrders[e] = a)); - } - apply(e, t, a, i, n, s, o) { - if (o == gi.mixOut) - return void ( - s == pi.setup && - ni.arrayCopy(e.slots, 0, e.drawOrder, 0, e.slots.length) - ); - if (a < this.frames[0]) - return void ( - (s != pi.setup && s != pi.first) || - ni.arrayCopy(e.slots, 0, e.drawOrder, 0, e.slots.length) - ); - let r = this.drawOrders[mi.search1(this.frames, a)]; - if (r) { - let t = e.drawOrder, - a = e.slots; - for (let e = 0, i = r.length; e < i; e++) t[e] = a[r[e]]; - } else ni.arrayCopy(e.slots, 0, e.drawOrder, 0, e.slots.length); - } + } + class Yi extends fi { + constructor(e, t, a) { + (super(e, t, ["15|" + a]), (this.transformConstraintIndex = a)); } - Bi.propertyIds = ["13"]; - class Fi extends fi { - constructor(e, t, a) { - (super(e, t, ["14|" + a]), (this.ikConstraintIndex = a)); - } - getFrameEntries() { - return 6; - } - setFrame(e, t, a, i, n, s, o) { - ((e *= 6), - (this.frames[e] = t), - (this.frames[e + 1] = a), - (this.frames[e + 2] = i), - (this.frames[e + 3] = n), - (this.frames[e + 4] = s ? 1 : 0), - (this.frames[e + 5] = o ? 1 : 0)); - } - apply(e, t, a, i, n, s, o) { - let r = e.ikConstraints[this.ikConstraintIndex]; - if (!r.active) return; - let l = this.frames; - if (a < l[0]) { - switch (s) { - case pi.setup: - return ( - (r.mix = r.data.mix), - (r.softness = r.data.softness), - (r.bendDirection = r.data.bendDirection), - (r.compress = r.data.compress), - void (r.stretch = r.data.stretch) - ); - case pi.first: - ((r.mix += (r.data.mix - r.mix) * n), - (r.softness += (r.data.softness - r.softness) * n), - (r.bendDirection = r.data.bendDirection), - (r.compress = r.data.compress), - (r.stretch = r.data.stretch)); - } - return; - } - let c = 0, - d = 0, - u = mi.search(l, a, 6), - h = this.curves[u / 6]; - switch (h) { - case 0: - let e = l[u]; - ((c = l[u + 1]), (d = l[u + 2])); - let t = (a - e) / (l[u + 6] - e); - ((c += (l[u + 6 + 1] - c) * t), (d += (l[u + 6 + 2] - d) * t)); - break; - case 1: - ((c = l[u + 1]), (d = l[u + 2])); - break; - default: - ((c = this.getBezierValue(a, u, 1, h - 2)), - (d = this.getBezierValue(a, u, 2, h + 18 - 2))); + getFrameEntries() { + return 7; + } + setFrame(e, t, a, i, n, s, o, r) { + let l = this.frames; + ((l[(e *= 7)] = t), + (l[e + 1] = a), + (l[e + 2] = i), + (l[e + 3] = n), + (l[e + 4] = s), + (l[e + 5] = o), + (l[e + 6] = r)); + } + apply(e, t, a, i, n, s, o) { + let r = e.transformConstraints[this.transformConstraintIndex]; + if (!r.active) return; + let l, + c, + d, + u, + h, + p, + g = this.frames; + if (a < g[0]) { + let e = r.data; + switch (s) { + case pi.setup: + return ( + (r.mixRotate = e.mixRotate), + (r.mixX = e.mixX), + (r.mixY = e.mixY), + (r.mixScaleX = e.mixScaleX), + (r.mixScaleY = e.mixScaleY), + void (r.mixShearY = e.mixShearY) + ); + case pi.first: + ((r.mixRotate += (e.mixRotate - r.mixRotate) * n), + (r.mixX += (e.mixX - r.mixX) * n), + (r.mixY += (e.mixY - r.mixY) * n), + (r.mixScaleX += (e.mixScaleX - r.mixScaleX) * n), + (r.mixScaleY += (e.mixScaleY - r.mixScaleY) * n), + (r.mixShearY += (e.mixShearY - r.mixShearY) * n)); } - s == pi.setup - ? ((r.mix = r.data.mix + (c - r.data.mix) * n), - (r.softness = r.data.softness + (d - r.data.softness) * n), - o == gi.mixOut - ? ((r.bendDirection = r.data.bendDirection), - (r.compress = r.data.compress), - (r.stretch = r.data.stretch)) - : ((r.bendDirection = l[u + 3]), - (r.compress = 0 != l[u + 4]), - (r.stretch = 0 != l[u + 5]))) - : ((r.mix += (c - r.mix) * n), - (r.softness += (d - r.softness) * n), - o == gi.mixIn && - ((r.bendDirection = l[u + 3]), - (r.compress = 0 != l[u + 4]), - (r.stretch = 0 != l[u + 5]))); + return; } + let m = mi.search(g, a, 7), + f = this.curves[m / 7]; + switch (f) { + case 0: + let e = g[m]; + ((l = g[m + 1]), + (c = g[m + 2]), + (d = g[m + 3]), + (u = g[m + 4]), + (h = g[m + 5]), + (p = g[m + 6])); + let t = (a - e) / (g[m + 7] - e); + ((l += (g[m + 7 + 1] - l) * t), + (c += (g[m + 7 + 2] - c) * t), + (d += (g[m + 7 + 3] - d) * t), + (u += (g[m + 7 + 4] - u) * t), + (h += (g[m + 7 + 5] - h) * t), + (p += (g[m + 7 + 6] - p) * t)); + break; + case 1: + ((l = g[m + 1]), + (c = g[m + 2]), + (d = g[m + 3]), + (u = g[m + 4]), + (h = g[m + 5]), + (p = g[m + 6])); + break; + default: + ((l = this.getBezierValue(a, m, 1, f - 2)), + (c = this.getBezierValue(a, m, 2, f + 18 - 2)), + (d = this.getBezierValue(a, m, 3, f + 36 - 2)), + (u = this.getBezierValue(a, m, 4, f + 54 - 2)), + (h = this.getBezierValue(a, m, 5, f + 72 - 2)), + (p = this.getBezierValue(a, m, 6, f + 90 - 2))); + } + if (s == pi.setup) { + let e = r.data; + ((r.mixRotate = e.mixRotate + (l - e.mixRotate) * n), + (r.mixX = e.mixX + (c - e.mixX) * n), + (r.mixY = e.mixY + (d - e.mixY) * n), + (r.mixScaleX = e.mixScaleX + (u - e.mixScaleX) * n), + (r.mixScaleY = e.mixScaleY + (h - e.mixScaleY) * n), + (r.mixShearY = e.mixShearY + (p - e.mixShearY) * n)); + } else + ((r.mixRotate += (l - r.mixRotate) * n), + (r.mixX += (c - r.mixX) * n), + (r.mixY += (d - r.mixY) * n), + (r.mixScaleX += (u - r.mixScaleX) * n), + (r.mixScaleY += (h - r.mixScaleY) * n), + (r.mixShearY += (p - r.mixShearY) * n)); } - class Yi extends fi { - constructor(e, t, a) { - (super(e, t, ["15|" + a]), (this.transformConstraintIndex = a)); - } - getFrameEntries() { - return 7; + } + class Ui extends yi { + constructor(e, t, a) { + (super(e, t, "16|" + a), (this.pathConstraintIndex = a)); + } + apply(e, t, a, i, n, s, o) { + let r = e.pathConstraints[this.pathConstraintIndex]; + if (!r.active) return; + if (a < this.frames[0]) { + switch (s) { + case pi.setup: + return void (r.position = r.data.position); + case pi.first: + r.position += (r.data.position - r.position) * n; + } + return; } - setFrame(e, t, a, i, n, s, o, r) { - let l = this.frames; - ((l[(e *= 7)] = t), - (l[e + 1] = a), - (l[e + 2] = i), - (l[e + 3] = n), - (l[e + 4] = s), - (l[e + 5] = o), - (l[e + 6] = r)); + let l = this.getCurveValue(a); + s == pi.setup + ? (r.position = r.data.position + (l - r.data.position) * n) + : (r.position += (l - r.position) * n); + } + } + class ji extends yi { + constructor(e, t, a) { + (super(e, t, "17|" + a), + (this.pathConstraintIndex = 0), + (this.pathConstraintIndex = a)); + } + apply(e, t, a, i, n, s, o) { + let r = e.pathConstraints[this.pathConstraintIndex]; + if (!r.active) return; + if (a < this.frames[0]) { + switch (s) { + case pi.setup: + return void (r.spacing = r.data.spacing); + case pi.first: + r.spacing += (r.data.spacing - r.spacing) * n; + } + return; } - apply(e, t, a, i, n, s, o) { - let r = e.transformConstraints[this.transformConstraintIndex]; - if (!r.active) return; - let l, - c, - d, - u, - h, - p, - g = this.frames; - if (a < g[0]) { - let e = r.data; - switch (s) { - case pi.setup: - return ( - (r.mixRotate = e.mixRotate), - (r.mixX = e.mixX), - (r.mixY = e.mixY), - (r.mixScaleX = e.mixScaleX), - (r.mixScaleY = e.mixScaleY), - void (r.mixShearY = e.mixShearY) - ); - case pi.first: - ((r.mixRotate += (e.mixRotate - r.mixRotate) * n), - (r.mixX += (e.mixX - r.mixX) * n), - (r.mixY += (e.mixY - r.mixY) * n), - (r.mixScaleX += (e.mixScaleX - r.mixScaleX) * n), - (r.mixScaleY += (e.mixScaleY - r.mixScaleY) * n), - (r.mixShearY += (e.mixShearY - r.mixShearY) * n)); - } - return; + let l = this.getCurveValue(a); + s == pi.setup + ? (r.spacing = r.data.spacing + (l - r.data.spacing) * n) + : (r.spacing += (l - r.spacing) * n); + } + } + class Gi extends fi { + constructor(e, t, a) { + (super(e, t, ["18|" + a]), + (this.pathConstraintIndex = 0), + (this.pathConstraintIndex = a)); + } + getFrameEntries() { + return 4; + } + setFrame(e, t, a, i, n) { + let s = this.frames; + ((s[(e <<= 2)] = t), + (s[e + 1] = a), + (s[e + 2] = i), + (s[e + 3] = n)); + } + apply(e, t, a, i, n, s, o) { + let r = e.pathConstraints[this.pathConstraintIndex]; + if (!r.active) return; + let l, + c, + d, + u = this.frames; + if (a < u[0]) { + switch (s) { + case pi.setup: + return ( + (r.mixRotate = r.data.mixRotate), + (r.mixX = r.data.mixX), + void (r.mixY = r.data.mixY) + ); + case pi.first: + ((r.mixRotate += (r.data.mixRotate - r.mixRotate) * n), + (r.mixX += (r.data.mixX - r.mixX) * n), + (r.mixY += (r.data.mixY - r.mixY) * n)); } - let m = mi.search(g, a, 7), - f = this.curves[m / 7]; - switch (f) { - case 0: - let e = g[m]; - ((l = g[m + 1]), - (c = g[m + 2]), - (d = g[m + 3]), - (u = g[m + 4]), - (h = g[m + 5]), - (p = g[m + 6])); - let t = (a - e) / (g[m + 7] - e); - ((l += (g[m + 7 + 1] - l) * t), - (c += (g[m + 7 + 2] - c) * t), - (d += (g[m + 7 + 3] - d) * t), - (u += (g[m + 7 + 4] - u) * t), - (h += (g[m + 7 + 5] - h) * t), - (p += (g[m + 7 + 6] - p) * t)); + return; + } + let h = mi.search(u, a, 4), + p = this.curves[h >> 2]; + switch (p) { + case 0: + let e = u[h]; + ((l = u[h + 1]), (c = u[h + 2]), (d = u[h + 3])); + let t = (a - e) / (u[h + 4] - e); + ((l += (u[h + 4 + 1] - l) * t), + (c += (u[h + 4 + 2] - c) * t), + (d += (u[h + 4 + 3] - d) * t)); + break; + case 1: + ((l = u[h + 1]), (c = u[h + 2]), (d = u[h + 3])); + break; + default: + ((l = this.getBezierValue(a, h, 1, p - 2)), + (c = this.getBezierValue(a, h, 2, p + 18 - 2)), + (d = this.getBezierValue(a, h, 3, p + 36 - 2))); + } + if (s == pi.setup) { + let e = r.data; + ((r.mixRotate = e.mixRotate + (l - e.mixRotate) * n), + (r.mixX = e.mixX + (c - e.mixX) * n), + (r.mixY = e.mixY + (d - e.mixY) * n)); + } else + ((r.mixRotate += (l - r.mixRotate) * n), + (r.mixX += (c - r.mixX) * n), + (r.mixY += (d - r.mixY) * n)); + } + } + class Vi extends mi { + constructor(e, t, a) { + (super(e, ["19|" + t + "|" + a.sequence.id]), + (this.slotIndex = t), + (this.attachment = a)); + } + getFrameEntries() { + return Vi.ENTRIES; + } + getSlotIndex() { + return this.slotIndex; + } + getAttachment() { + return this.attachment; + } + setFrame(e, t, a, i, n) { + let s = this.frames; + ((s[(e *= Vi.ENTRIES)] = t), + (s[e + Vi.MODE] = a | (i << 4)), + (s[e + Vi.DELAY] = n)); + } + apply(e, t, a, i, n, s, o) { + let r = e.slots[this.slotIndex]; + if (!r.bone.active) return; + let l = r.attachment, + c = this.attachment; + if (!(l == c || (l instanceof li && l.timelineAttahment == c))) + return; + let d = this.frames; + if (a < d[0]) + return void ( + (s != pi.setup && s != pi.first) || + (r.sequenceIndex = -1) + ); + let u = mi.search(d, a, Vi.ENTRIES), + h = d[u], + p = d[u + Vi.MODE], + g = d[u + Vi.DELAY], + m = p >> 4, + f = this.attachment.sequence.regions.length, + y = ui[15 & p]; + if (y != di.hold) + switch (((m += ((a - h) / g + 1e-5) | 0), y)) { + case di.once: + m = Math.min(f - 1, m); break; - case 1: - ((l = g[m + 1]), - (c = g[m + 2]), - (d = g[m + 3]), - (u = g[m + 4]), - (h = g[m + 5]), - (p = g[m + 6])); + case di.loop: + m %= f; break; - default: - ((l = this.getBezierValue(a, m, 1, f - 2)), - (c = this.getBezierValue(a, m, 2, f + 18 - 2)), - (d = this.getBezierValue(a, m, 3, f + 36 - 2)), - (u = this.getBezierValue(a, m, 4, f + 54 - 2)), - (h = this.getBezierValue(a, m, 5, f + 72 - 2)), - (p = this.getBezierValue(a, m, 6, f + 90 - 2))); + case di.pingpong: + let e = (f << 1) - 2; + ((m %= e), m >= f && (m = e - m)); + break; + case di.onceReverse: + m = Math.max(f - 1 - m, 0); + break; + case di.loopReverse: + m = f - 1 - (m % f); } - if (s == pi.setup) { - let e = r.data; - ((r.mixRotate = e.mixRotate + (l - e.mixRotate) * n), - (r.mixX = e.mixX + (c - e.mixX) * n), - (r.mixY = e.mixY + (d - e.mixY) * n), - (r.mixScaleX = e.mixScaleX + (u - e.mixScaleX) * n), - (r.mixScaleY = e.mixScaleY + (h - e.mixScaleY) * n), - (r.mixShearY = e.mixShearY + (p - e.mixShearY) * n)); - } else - ((r.mixRotate += (l - r.mixRotate) * n), - (r.mixX += (c - r.mixX) * n), - (r.mixY += (d - r.mixY) * n), - (r.mixScaleX += (u - r.mixScaleX) * n), - (r.mixScaleY += (h - r.mixScaleY) * n), - (r.mixShearY += (p - r.mixShearY) * n)); - } + r.sequenceIndex = m; } - class Ui extends yi { - constructor(e, t, a) { - (super(e, t, "16|" + a), (this.pathConstraintIndex = a)); - } - apply(e, t, a, i, n, s, o) { - let r = e.pathConstraints[this.pathConstraintIndex]; - if (!r.active) return; - if (a < this.frames[0]) { - switch (s) { - case pi.setup: - return void (r.position = r.data.position); - case pi.first: - r.position += (r.data.position - r.position) * n; - } - return; - } - let l = this.getCurveValue(a); - s == pi.setup - ? (r.position = r.data.position + (l - r.data.position) * n) - : (r.position += (l - r.position) * n); - } + } + ((Vi.ENTRIES = 3), (Vi.MODE = 1), (Vi.DELAY = 2)); + class Hi { + constructor(e) { + ((this.tracks = new Array()), + (this.timeScale = 1), + (this.unkeyedState = 0), + (this.events = new Array()), + (this.listeners = new Array()), + (this.queue = new zi(this)), + (this.propertyIDs = new ti()), + (this.animationsChanged = false), + (this.trackEntryPool = new si(() => new Xi())), + (this.data = e)); } - class ji extends yi { - constructor(e, t, a) { - (super(e, t, "17|" + a), - (this.pathConstraintIndex = 0), - (this.pathConstraintIndex = a)); - } - apply(e, t, a, i, n, s, o) { - let r = e.pathConstraints[this.pathConstraintIndex]; - if (!r.active) return; - if (a < this.frames[0]) { - switch (s) { - case pi.setup: - return void (r.spacing = r.data.spacing); - case pi.first: - r.spacing += (r.data.spacing - r.spacing) * n; + static emptyAnimation() { + return (tn || (tn = new hi("", [], 0)), tn); + } + update(e) { + e *= this.timeScale; + let t = this.tracks; + for (let a = 0, i = t.length; a < i; a++) { + let i = t[a]; + if (!i) continue; + ((i.animationLast = i.nextAnimationLast), + (i.trackLast = i.nextTrackLast)); + let n = e * i.timeScale; + if (i.delay > 0) { + if (((i.delay -= n), i.delay > 0)) continue; + ((n = -i.delay), (i.delay = 0)); + } + let s = i.next; + if (s) { + let t = i.trackLast - s.delay; + if (t >= 0) { + for ( + s.delay = 0, + s.trackTime += + 0 == i.timeScale + ? 0 + : (t / i.timeScale + e) * s.timeScale, + i.trackTime += n, + this.setCurrent(a, s, true); + s.mixingFrom; + ) + ((s.mixTime += e), (s = s.mixingFrom)); + continue; } - return; + } else if (i.trackLast >= i.trackEnd && !i.mixingFrom) { + ((t[a] = null), this.queue.end(i), this.clearNext(i)); + continue; + } + if (i.mixingFrom && this.updateMixingFrom(i, e)) { + let e = i.mixingFrom; + for (i.mixingFrom = null, e && (e.mixingTo = null); e;) + (this.queue.end(e), (e = e.mixingFrom)); } - let l = this.getCurveValue(a); - s == pi.setup - ? (r.spacing = r.data.spacing + (l - r.data.spacing) * n) - : (r.spacing += (l - r.spacing) * n); + i.trackTime += n; } + this.queue.drain(); } - class Gi extends fi { - constructor(e, t, a) { - (super(e, t, ["18|" + a]), - (this.pathConstraintIndex = 0), - (this.pathConstraintIndex = a)); - } - getFrameEntries() { - return 4; - } - setFrame(e, t, a, i, n) { - let s = this.frames; - ((s[(e <<= 2)] = t), - (s[e + 1] = a), - (s[e + 2] = i), - (s[e + 3] = n)); - } - apply(e, t, a, i, n, s, o) { - let r = e.pathConstraints[this.pathConstraintIndex]; - if (!r.active) return; - let l, - c, - d, - u = this.frames; - if (a < u[0]) { - switch (s) { - case pi.setup: - return ( - (r.mixRotate = r.data.mixRotate), - (r.mixX = r.data.mixX), - void (r.mixY = r.data.mixY) - ); - case pi.first: - ((r.mixRotate += (r.data.mixRotate - r.mixRotate) * n), - (r.mixX += (r.data.mixX - r.mixX) * n), - (r.mixY += (r.data.mixY - r.mixY) * n)); + updateMixingFrom(e, t) { + let a = e.mixingFrom; + if (!a) return true; + let i = this.updateMixingFrom(a, t); + return ( + (a.animationLast = a.nextAnimationLast), + (a.trackLast = a.nextTrackLast), + e.mixTime > 0 && e.mixTime >= e.mixDuration + ? ((0 != a.totalAlpha && 0 != e.mixDuration) || + ((e.mixingFrom = a.mixingFrom), + a.mixingFrom && (a.mixingFrom.mixingTo = e), + (e.interruptAlpha = a.interruptAlpha), + this.queue.end(a)), + i) + : ((a.trackTime += t * a.timeScale), (e.mixTime += t), false) + ); + } + apply(e) { + if (!e) throw new Error("skeleton cannot be null."); + this.animationsChanged && this._animationsChanged(); + let t = this.events, + a = this.tracks, + i = false; + for (let s = 0, o = a.length; s < o; s++) { + let o = a[s]; + if (!o || o.delay > 0) continue; + i = true; + let r = 0 == s ? pi.first : o.mixBlend, + l = o.alpha; + o.mixingFrom + ? (l *= this.applyMixingFrom(o, e, r)) + : o.trackTime >= o.trackEnd && !o.next && (l = 0); + let c = o.animationLast, + d = o.getAnimationTime(), + u = d, + h = t; + o.reverse && ((u = o.animation.duration - u), (h = null)); + let p = o.animation.timelines, + g = p.length; + if ((0 == s && 1 == l) || r == pi.add) + for (let t = 0; t < g; t++) { + ni.webkit602BugfixHelper(l, r); + var n = p[t]; + n instanceof Mi + ? this.applyAttachmentTimeline(n, e, u, r, true) + : n.apply(e, c, u, h, l, r, gi.mixIn); + } + else { + let t = o.timelineMode, + a = o.timelinesRotation.length != g << 1; + a && (o.timelinesRotation.length = g << 1); + for (let i = 0; i < g; i++) { + let n = p[i], + s = t[i] == qi ? r : pi.setup; + n instanceof bi + ? this.applyRotateTimeline( + n, + e, + u, + l, + s, + o.timelinesRotation, + i << 1, + a, + ) + : n instanceof Mi + ? this.applyAttachmentTimeline(n, e, u, r, true) + : (ni.webkit602BugfixHelper(l, r), + n.apply(e, c, u, h, l, s, gi.mixIn)); } - return; } - let h = mi.search(u, a, 4), - p = this.curves[h >> 2]; - switch (p) { - case 0: - let e = u[h]; - ((l = u[h + 1]), (c = u[h + 2]), (d = u[h + 3])); - let t = (a - e) / (u[h + 4] - e); - ((l += (u[h + 4 + 1] - l) * t), - (c += (u[h + 4 + 2] - c) * t), - (d += (u[h + 4 + 3] - d) * t)); - break; - case 1: - ((l = u[h + 1]), (c = u[h + 2]), (d = u[h + 3])); - break; - default: - ((l = this.getBezierValue(a, h, 1, p - 2)), - (c = this.getBezierValue(a, h, 2, p + 18 - 2)), - (d = this.getBezierValue(a, h, 3, p + 36 - 2))); + (this.queueEvents(o, d), + (t.length = 0), + (o.nextAnimationLast = d), + (o.nextTrackLast = o.trackTime)); + } + for ( + var s = this.unkeyedState + Zi, + o = e.slots, + r = 0, + l = e.slots.length; + r < l; + r++ + ) { + var c = o[r]; + if (c.attachmentState == s) { + var d = c.data.attachmentName; + c.setAttachment(d ? e.getAttachment(c.data.index, d) : null); } - if (s == pi.setup) { - let e = r.data; - ((r.mixRotate = e.mixRotate + (l - e.mixRotate) * n), - (r.mixX = e.mixX + (c - e.mixX) * n), - (r.mixY = e.mixY + (d - e.mixY) * n)); - } else - ((r.mixRotate += (l - r.mixRotate) * n), - (r.mixX += (c - r.mixX) * n), - (r.mixY += (d - r.mixY) * n)); } + return ((this.unkeyedState += 2), this.queue.drain(), i); } - class Vi extends mi { - constructor(e, t, a) { - (super(e, ["19|" + t + "|" + a.sequence.id]), - (this.slotIndex = t), - (this.attachment = a)); - } - getFrameEntries() { - return Vi.ENTRIES; - } - getSlotIndex() { - return this.slotIndex; - } - getAttachment() { - return this.attachment; - } - setFrame(e, t, a, i, n) { - let s = this.frames; - ((s[(e *= Vi.ENTRIES)] = t), - (s[e + Vi.MODE] = a | (i << 4)), - (s[e + Vi.DELAY] = n)); - } - apply(e, t, a, i, n, s, o) { - let r = e.slots[this.slotIndex]; - if (!r.bone.active) return; - let l = r.attachment, - c = this.attachment; - if (!(l == c || (l instanceof li && l.timelineAttahment == c))) - return; - let d = this.frames; - if (a < d[0]) - return void ( - (s != pi.setup && s != pi.first) || - (r.sequenceIndex = -1) - ); - let u = mi.search(d, a, Vi.ENTRIES), - h = d[u], - p = d[u + Vi.MODE], - g = d[u + Vi.DELAY], - m = p >> 4, - f = this.attachment.sequence.regions.length, - y = ui[15 & p]; - if (y != di.hold) - switch (((m += ((a - h) / g + 1e-5) | 0), y)) { - case di.once: - m = Math.min(f - 1, m); + applyMixingFrom(e, t, a) { + let i = e.mixingFrom; + i.mixingFrom && this.applyMixingFrom(i, t, a); + let n = 0; + 0 == e.mixDuration + ? ((n = 1), a == pi.first && (a = pi.setup)) + : ((n = e.mixTime / e.mixDuration), + n > 1 && (n = 1), + a != pi.first && (a = i.mixBlend)); + let s = n < i.attachmentThreshold, + o = n < i.drawOrderThreshold, + r = i.animation.timelines, + l = r.length, + c = i.alpha * e.interruptAlpha, + d = c * (1 - n), + u = i.animationLast, + h = i.getAnimationTime(), + p = h, + g = null; + if ( + (i.reverse + ? (p = i.animation.duration - p) + : n < i.eventThreshold && (g = this.events), + a == pi.add) + ) + for (let e = 0; e < l; e++) + r[e].apply(t, u, p, g, d, a, gi.mixOut); + else { + let e = i.timelineMode, + n = i.timelineHoldMix, + h = i.timelinesRotation.length != l << 1; + (h && (i.timelinesRotation.length = l << 1), (i.totalAlpha = 0)); + for (let m = 0; m < l; m++) { + let l, + f = r[m], + y = gi.mixOut, + E = 0; + switch (e[m]) { + case qi: + if (!o && f instanceof Bi) continue; + ((l = a), (E = d)); break; - case di.loop: - m %= f; + case $i: + ((l = pi.setup), (E = d)); break; - case di.pingpong: - let e = (f << 1) - 2; - ((m %= e), m >= f && (m = e - m)); + case Ji: + ((l = a), (E = c)); break; - case di.onceReverse: - m = Math.max(f - 1 - m, 0); + case Ki: + ((l = pi.setup), (E = c)); break; - case di.loopReverse: - m = f - 1 - (m % f); - } - r.sequenceIndex = m; - } - } - ((Vi.ENTRIES = 3), (Vi.MODE = 1), (Vi.DELAY = 2)); - class Hi { - constructor(e) { - ((this.tracks = new Array()), - (this.timeScale = 1), - (this.unkeyedState = 0), - (this.events = new Array()), - (this.listeners = new Array()), - (this.queue = new zi(this)), - (this.propertyIDs = new ti()), - (this.animationsChanged = false), - (this.trackEntryPool = new si(() => new Xi())), - (this.data = e)); - } - static emptyAnimation() { - return (tn || (tn = new hi("", [], 0)), tn); - } - update(e) { - e *= this.timeScale; - let t = this.tracks; - for (let a = 0, i = t.length; a < i; a++) { - let i = t[a]; - if (!i) continue; - ((i.animationLast = i.nextAnimationLast), - (i.trackLast = i.nextTrackLast)); - let n = e * i.timeScale; - if (i.delay > 0) { - if (((i.delay -= n), i.delay > 0)) continue; - ((n = -i.delay), (i.delay = 0)); + default: + l = pi.setup; + let e = n[m]; + E = c * Math.max(0, 1 - e.mixTime / e.mixDuration); } - let s = i.next; - if (s) { - let t = i.trackLast - s.delay; - if (t >= 0) { - for ( - s.delay = 0, - s.trackTime += - 0 == i.timeScale - ? 0 - : (t / i.timeScale + e) * s.timeScale, - i.trackTime += n, - this.setCurrent(a, s, true); - s.mixingFrom; + ((i.totalAlpha += E), + f instanceof bi + ? this.applyRotateTimeline( + f, + t, + p, + E, + l, + i.timelinesRotation, + m << 1, + h, ) - ((s.mixTime += e), (s = s.mixingFrom)); - continue; - } - } else if (i.trackLast >= i.trackEnd && !i.mixingFrom) { - ((t[a] = null), this.queue.end(i), this.clearNext(i)); - continue; - } - if (i.mixingFrom && this.updateMixingFrom(i, e)) { - let e = i.mixingFrom; - for (i.mixingFrom = null, e && (e.mixingTo = null); e; ) - (this.queue.end(e), (e = e.mixingFrom)); - } - i.trackTime += n; - } - this.queue.drain(); - } - updateMixingFrom(e, t) { - let a = e.mixingFrom; - if (!a) return true; - let i = this.updateMixingFrom(a, t); - return ( - (a.animationLast = a.nextAnimationLast), - (a.trackLast = a.nextTrackLast), - e.mixTime > 0 && e.mixTime >= e.mixDuration - ? ((0 != a.totalAlpha && 0 != e.mixDuration) || - ((e.mixingFrom = a.mixingFrom), - a.mixingFrom && (a.mixingFrom.mixingTo = e), - (e.interruptAlpha = a.interruptAlpha), - this.queue.end(a)), - i) - : ((a.trackTime += t * a.timeScale), (e.mixTime += t), false) - ); - } - apply(e) { - if (!e) throw new Error("skeleton cannot be null."); - this.animationsChanged && this._animationsChanged(); - let t = this.events, - a = this.tracks, - i = false; - for (let s = 0, o = a.length; s < o; s++) { - let o = a[s]; - if (!o || o.delay > 0) continue; - i = true; - let r = 0 == s ? pi.first : o.mixBlend, - l = o.alpha; - o.mixingFrom - ? (l *= this.applyMixingFrom(o, e, r)) - : o.trackTime >= o.trackEnd && !o.next && (l = 0); - let c = o.animationLast, - d = o.getAnimationTime(), - u = d, - h = t; - o.reverse && ((u = o.animation.duration - u), (h = null)); - let p = o.animation.timelines, - g = p.length; - if ((0 == s && 1 == l) || r == pi.add) - for (let t = 0; t < g; t++) { - ni.webkit602BugfixHelper(l, r); - var n = p[t]; - n instanceof Mi - ? this.applyAttachmentTimeline(n, e, u, r, true) - : n.apply(e, c, u, h, l, r, gi.mixIn); - } - else { - let t = o.timelineMode, - a = o.timelinesRotation.length != g << 1; - a && (o.timelinesRotation.length = g << 1); - for (let i = 0; i < g; i++) { - let n = p[i], - s = t[i] == qi ? r : pi.setup; - n instanceof bi - ? this.applyRotateTimeline( - n, - e, - u, - l, - s, - o.timelinesRotation, - i << 1, - a, - ) - : n instanceof Mi - ? this.applyAttachmentTimeline(n, e, u, r, true) - : (ni.webkit602BugfixHelper(l, r), - n.apply(e, c, u, h, l, s, gi.mixIn)); - } - } - (this.queueEvents(o, d), - (t.length = 0), - (o.nextAnimationLast = d), - (o.nextTrackLast = o.trackTime)); - } - for ( - var s = this.unkeyedState + Zi, - o = e.slots, - r = 0, - l = e.slots.length; - r < l; - r++ - ) { - var c = o[r]; - if (c.attachmentState == s) { - var d = c.data.attachmentName; - c.setAttachment(d ? e.getAttachment(c.data.index, d) : null); - } - } - return ((this.unkeyedState += 2), this.queue.drain(), i); - } - applyMixingFrom(e, t, a) { - let i = e.mixingFrom; - i.mixingFrom && this.applyMixingFrom(i, t, a); - let n = 0; - 0 == e.mixDuration - ? ((n = 1), a == pi.first && (a = pi.setup)) - : ((n = e.mixTime / e.mixDuration), - n > 1 && (n = 1), - a != pi.first && (a = i.mixBlend)); - let s = n < i.attachmentThreshold, - o = n < i.drawOrderThreshold, - r = i.animation.timelines, - l = r.length, - c = i.alpha * e.interruptAlpha, - d = c * (1 - n), - u = i.animationLast, - h = i.getAnimationTime(), - p = h, - g = null; - if ( - (i.reverse - ? (p = i.animation.duration - p) - : n < i.eventThreshold && (g = this.events), - a == pi.add) - ) - for (let e = 0; e < l; e++) - r[e].apply(t, u, p, g, d, a, gi.mixOut); - else { - let e = i.timelineMode, - n = i.timelineHoldMix, - h = i.timelinesRotation.length != l << 1; - (h && (i.timelinesRotation.length = l << 1), (i.totalAlpha = 0)); - for (let m = 0; m < l; m++) { - let l, - f = r[m], - y = gi.mixOut, - E = 0; - switch (e[m]) { - case qi: - if (!o && f instanceof Bi) continue; - ((l = a), (E = d)); - break; - case $i: - ((l = pi.setup), (E = d)); - break; - case Ji: - ((l = a), (E = c)); - break; - case Ki: - ((l = pi.setup), (E = c)); - break; - default: - l = pi.setup; - let e = n[m]; - E = c * Math.max(0, 1 - e.mixTime / e.mixDuration); - } - ((i.totalAlpha += E), - f instanceof bi - ? this.applyRotateTimeline( - f, - t, - p, - E, - l, - i.timelinesRotation, - m << 1, - h, - ) - : f instanceof Mi - ? this.applyAttachmentTimeline(f, t, p, l, s) - : (ni.webkit602BugfixHelper(E, a), - o && f instanceof Bi && l == pi.setup && (y = gi.mixIn), - f.apply(t, u, p, g, E, l, y))); - } + : f instanceof Mi + ? this.applyAttachmentTimeline(f, t, p, l, s) + : (ni.webkit602BugfixHelper(E, a), + o && f instanceof Bi && l == pi.setup && (y = gi.mixIn), + f.apply(t, u, p, g, E, l, y))); } - return ( - e.mixDuration > 0 && this.queueEvents(i, h), - (this.events.length = 0), - (i.nextAnimationLast = h), - (i.nextTrackLast = i.trackTime), - n - ); } - applyAttachmentTimeline(e, t, a, i, n) { - var s = t.slots[e.slotIndex]; - s.bone.active && - (a < e.frames[0] - ? (i != pi.setup && i != pi.first) || - this.setAttachment(t, s, s.data.attachmentName, n) - : this.setAttachment( - t, - s, - e.attachmentNames[mi.search1(e.frames, a)], - n, - ), + return ( + e.mixDuration > 0 && this.queueEvents(i, h), + (this.events.length = 0), + (i.nextAnimationLast = h), + (i.nextTrackLast = i.trackTime), + n + ); + } + applyAttachmentTimeline(e, t, a, i, n) { + var s = t.slots[e.slotIndex]; + s.bone.active && + (a < e.frames[0] + ? (i != pi.setup && i != pi.first) || + this.setAttachment(t, s, s.data.attachmentName, n) + : this.setAttachment( + t, + s, + e.attachmentNames[mi.search1(e.frames, a)], + n, + ), s.attachmentState <= this.unkeyedState && - (s.attachmentState = this.unkeyedState + Zi)); - } - setAttachment(e, t, a, i) { - (t.setAttachment(a ? e.getAttachment(t.data.index, a) : null), - i && (t.attachmentState = this.unkeyedState + en)); - } - applyRotateTimeline(e, t, a, i, n, s, o, r) { - if ((r && (s[o] = 0), 1 == i)) - return void e.apply(t, 0, a, null, 1, n, gi.mixIn); - let l = t.bones[e.boneIndex]; - if (!l.active) return; - let c = 0, - d = 0; - if (a < e.frames[0]) - switch (n) { - case pi.setup: - l.rotation = l.data.rotation; - default: - return; - case pi.first: - ((c = l.rotation), (d = l.data.rotation)); - } - else - ((c = n == pi.setup ? l.data.rotation : l.rotation), - (d = l.data.rotation + e.getCurveValue(a))); - let u = 0, - h = d - c; - if ( - ((h -= 360 * (16384 - ((16384.499999999996 - h / 360) | 0))), - 0 == h) - ) - u = s[o]; - else { - let e = 0, - t = 0; - r ? ((e = 0), (t = h)) : ((e = s[o]), (t = s[o + 1])); - let a = h > 0, - i = e >= 0; - (ii.signum(t) != ii.signum(h) && - Math.abs(t) <= 90 && - (Math.abs(e) > 180 && (e += 360 * ii.signum(e)), (i = a)), - (u = h + e - (e % 360)), - i != a && (u += 360 * ii.signum(e)), - (s[o] = u)); - } - ((s[o + 1] = h), (l.rotation = c + u * i)); - } - queueEvents(e, t) { - let a = e.animationStart, - i = e.animationEnd, - n = i - a, - s = e.trackLast % n, - o = this.events, - r = 0, - l = o.length; - for (; r < l; r++) { - let t = o[r]; - if (t.time < s) break; - t.time > i || this.queue.event(e, t); - } - let c = false; - for ( - c = e.loop - ? 0 == n || s > e.trackTime % n - : t >= i && e.animationLast < i, - c && this.queue.complete(e); - r < l; - r++ - ) { - let t = o[r]; - t.time < a || this.queue.event(e, t); - } - } - clearTracks() { - let e = this.queue.drainDisabled; - this.queue.drainDisabled = true; - for (let e = 0, t = this.tracks.length; e < t; e++) - this.clearTrack(e); - ((this.tracks.length = 0), - (this.queue.drainDisabled = e), - this.queue.drain()); - } - clearTrack(e) { - if (e >= this.tracks.length) return; - let t = this.tracks[e]; - if (!t) return; - (this.queue.end(t), this.clearNext(t)); - let a = t; - for (;;) { - let e = a.mixingFrom; - if (!e) break; - (this.queue.end(e), - (a.mixingFrom = null), - (a.mixingTo = null), - (a = e)); - } - ((this.tracks[t.trackIndex] = null), this.queue.drain()); - } - setCurrent(e, t, a) { - let i = this.expandToIndex(e); - ((this.tracks[e] = t), - (t.previous = null), - i && - (a && this.queue.interrupt(i), - (t.mixingFrom = i), - (i.mixingTo = t), - (t.mixTime = 0), - i.mixingFrom && - i.mixDuration > 0 && - (t.interruptAlpha *= Math.min(1, i.mixTime / i.mixDuration)), - (i.timelinesRotation.length = 0)), - this.queue.start(t)); - } - setAnimation(e, t, a = false) { - let i = this.data.skeletonData.findAnimation(t); - if (!i) throw new Error("Animation not found: " + t); - return this.setAnimationWith(e, i, a); - } - setAnimationWith(e, t, a = false) { - if (!t) throw new Error("animation cannot be null."); - let i = true, - n = this.expandToIndex(e); - n && - (-1 == n.nextTrackLast - ? ((this.tracks[e] = n.mixingFrom), - this.queue.interrupt(n), - this.queue.end(n), - this.clearNext(n), - (n = n.mixingFrom), - (i = false)) - : this.clearNext(n)); - let s = this.trackEntry(e, t, a, n); - return (this.setCurrent(e, s, i), this.queue.drain(), s); - } - addAnimation(e, t, a = false, i = 0) { - let n = this.data.skeletonData.findAnimation(t); - if (!n) throw new Error("Animation not found: " + t); - return this.addAnimationWith(e, n, a, i); - } - addAnimationWith(e, t, a = false, i = 0) { - if (!t) throw new Error("animation cannot be null."); - let n = this.expandToIndex(e); - if (n) for (; n.next; ) n = n.next; - let s = this.trackEntry(e, t, a, n); - return ( - n - ? ((n.next = s), - (s.previous = n), - i <= 0 && (i += n.getTrackComplete() - s.mixDuration)) - : (this.setCurrent(e, s, true), this.queue.drain()), - (s.delay = i), - s - ); - } - setEmptyAnimation(e, t = 0) { - let a = this.setAnimationWith(e, Hi.emptyAnimation(), false); - return ((a.mixDuration = t), (a.trackEnd = t), a); - } - addEmptyAnimation(e, t = 0, a = 0) { - let i = this.addAnimationWith(e, Hi.emptyAnimation(), false, a); - return ( - a <= 0 && (i.delay += i.mixDuration - t), - (i.mixDuration = t), - (i.trackEnd = t), - i - ); - } - setEmptyAnimations(e = 0) { - let t = this.queue.drainDisabled; - this.queue.drainDisabled = true; - for (let t = 0, a = this.tracks.length; t < a; t++) { - let a = this.tracks[t]; - a && this.setEmptyAnimation(a.trackIndex, e); + (s.attachmentState = this.unkeyedState + Zi)); + } + setAttachment(e, t, a, i) { + (t.setAttachment(a ? e.getAttachment(t.data.index, a) : null), + i && (t.attachmentState = this.unkeyedState + en)); + } + applyRotateTimeline(e, t, a, i, n, s, o, r) { + if ((r && (s[o] = 0), 1 == i)) + return void e.apply(t, 0, a, null, 1, n, gi.mixIn); + let l = t.bones[e.boneIndex]; + if (!l.active) return; + let c = 0, + d = 0; + if (a < e.frames[0]) + switch (n) { + case pi.setup: + l.rotation = l.data.rotation; + default: + return; + case pi.first: + ((c = l.rotation), (d = l.data.rotation)); } - ((this.queue.drainDisabled = t), this.queue.drain()); - } - expandToIndex(e) { - return e < this.tracks.length - ? this.tracks[e] - : (ni.ensureArrayCapacity(this.tracks, e + 1, null), - (this.tracks.length = e + 1), - null); - } - trackEntry(e, t, a, i) { - let n = this.trackEntryPool.obtain(); - return ( - (n.trackIndex = e), - (n.animation = t), - (n.loop = a), - (n.holdPrevious = false), - (n.eventThreshold = 0), - (n.attachmentThreshold = 0), - (n.drawOrderThreshold = 0), - (n.animationStart = 0), - (n.animationEnd = t.duration), - (n.animationLast = -1), - (n.nextAnimationLast = -1), - (n.delay = 0), - (n.trackTime = 0), - (n.trackLast = -1), - (n.nextTrackLast = -1), - (n.trackEnd = Number.MAX_VALUE), - (n.timeScale = 1), - (n.alpha = 1), - (n.interruptAlpha = 1), - (n.mixTime = 0), - (n.mixDuration = i ? this.data.getMix(i.animation, t) : 0), - (n.mixBlend = pi.replace), - n - ); - } - clearNext(e) { - let t = e.next; - for (; t; ) (this.queue.dispose(t), (t = t.next)); - e.next = null; + else + ((c = n == pi.setup ? l.data.rotation : l.rotation), + (d = l.data.rotation + e.getCurveValue(a))); + let u = 0, + h = d - c; + if ( + ((h -= 360 * (16384 - ((16384.499999999996 - h / 360) | 0))), + 0 == h) + ) + u = s[o]; + else { + let e = 0, + t = 0; + r ? ((e = 0), (t = h)) : ((e = s[o]), (t = s[o + 1])); + let a = h > 0, + i = e >= 0; + (ii.signum(t) != ii.signum(h) && + Math.abs(t) <= 90 && + (Math.abs(e) > 180 && (e += 360 * ii.signum(e)), (i = a)), + (u = h + e - (e % 360)), + i != a && (u += 360 * ii.signum(e)), + (s[o] = u)); + } + ((s[o + 1] = h), (l.rotation = c + u * i)); + } + queueEvents(e, t) { + let a = e.animationStart, + i = e.animationEnd, + n = i - a, + s = e.trackLast % n, + o = this.events, + r = 0, + l = o.length; + for (; r < l; r++) { + let t = o[r]; + if (t.time < s) break; + t.time > i || this.queue.event(e, t); + } + let c = false; + for ( + c = e.loop + ? 0 == n || s > e.trackTime % n + : t >= i && e.animationLast < i, + c && this.queue.complete(e); + r < l; + r++ + ) { + let t = o[r]; + t.time < a || this.queue.event(e, t); } - _animationsChanged() { - ((this.animationsChanged = false), this.propertyIDs.clear()); - let e = this.tracks; - for (let t = 0, a = e.length; t < a; t++) { - let a = e[t]; - if (a) { - for (; a.mixingFrom; ) a = a.mixingFrom; - do { - ((a.mixingTo && a.mixBlend == pi.add) || this.computeHold(a), - (a = a.mixingTo)); - } while (a); - } + } + clearTracks() { + let e = this.queue.drainDisabled; + this.queue.drainDisabled = true; + for (let e = 0, t = this.tracks.length; e < t; e++) + this.clearTrack(e); + ((this.tracks.length = 0), + (this.queue.drainDisabled = e), + this.queue.drain()); + } + clearTrack(e) { + if (e >= this.tracks.length) return; + let t = this.tracks[e]; + if (!t) return; + (this.queue.end(t), this.clearNext(t)); + let a = t; + for (; ;) { + let e = a.mixingFrom; + if (!e) break; + (this.queue.end(e), + (a.mixingFrom = null), + (a.mixingTo = null), + (a = e)); + } + ((this.tracks[t.trackIndex] = null), this.queue.drain()); + } + setCurrent(e, t, a) { + let i = this.expandToIndex(e); + ((this.tracks[e] = t), + (t.previous = null), + i && + (a && this.queue.interrupt(i), + (t.mixingFrom = i), + (i.mixingTo = t), + (t.mixTime = 0), + i.mixingFrom && + i.mixDuration > 0 && + (t.interruptAlpha *= Math.min(1, i.mixTime / i.mixDuration)), + (i.timelinesRotation.length = 0)), + this.queue.start(t)); + } + setAnimation(e, t, a = false) { + let i = this.data.skeletonData.findAnimation(t); + if (!i) throw new Error("Animation not found: " + t); + return this.setAnimationWith(e, i, a); + } + setAnimationWith(e, t, a = false) { + if (!t) throw new Error("animation cannot be null."); + let i = true, + n = this.expandToIndex(e); + n && + (-1 == n.nextTrackLast + ? ((this.tracks[e] = n.mixingFrom), + this.queue.interrupt(n), + this.queue.end(n), + this.clearNext(n), + (n = n.mixingFrom), + (i = false)) + : this.clearNext(n)); + let s = this.trackEntry(e, t, a, n); + return (this.setCurrent(e, s, i), this.queue.drain(), s); + } + addAnimation(e, t, a = false, i = 0) { + let n = this.data.skeletonData.findAnimation(t); + if (!n) throw new Error("Animation not found: " + t); + return this.addAnimationWith(e, n, a, i); + } + addAnimationWith(e, t, a = false, i = 0) { + if (!t) throw new Error("animation cannot be null."); + let n = this.expandToIndex(e); + if (n) for (; n.next;) n = n.next; + let s = this.trackEntry(e, t, a, n); + return ( + n + ? ((n.next = s), + (s.previous = n), + i <= 0 && (i += n.getTrackComplete() - s.mixDuration)) + : (this.setCurrent(e, s, true), this.queue.drain()), + (s.delay = i), + s + ); + } + setEmptyAnimation(e, t = 0) { + let a = this.setAnimationWith(e, Hi.emptyAnimation(), false); + return ((a.mixDuration = t), (a.trackEnd = t), a); + } + addEmptyAnimation(e, t = 0, a = 0) { + let i = this.addAnimationWith(e, Hi.emptyAnimation(), false, a); + return ( + a <= 0 && (i.delay += i.mixDuration - t), + (i.mixDuration = t), + (i.trackEnd = t), + i + ); + } + setEmptyAnimations(e = 0) { + let t = this.queue.drainDisabled; + this.queue.drainDisabled = true; + for (let t = 0, a = this.tracks.length; t < a; t++) { + let a = this.tracks[t]; + a && this.setEmptyAnimation(a.trackIndex, e); + } + ((this.queue.drainDisabled = t), this.queue.drain()); + } + expandToIndex(e) { + return e < this.tracks.length + ? this.tracks[e] + : (ni.ensureArrayCapacity(this.tracks, e + 1, null), + (this.tracks.length = e + 1), + null); + } + trackEntry(e, t, a, i) { + let n = this.trackEntryPool.obtain(); + return ( + (n.trackIndex = e), + (n.animation = t), + (n.loop = a), + (n.holdPrevious = false), + (n.eventThreshold = 0), + (n.attachmentThreshold = 0), + (n.drawOrderThreshold = 0), + (n.animationStart = 0), + (n.animationEnd = t.duration), + (n.animationLast = -1), + (n.nextAnimationLast = -1), + (n.delay = 0), + (n.trackTime = 0), + (n.trackLast = -1), + (n.nextTrackLast = -1), + (n.trackEnd = Number.MAX_VALUE), + (n.timeScale = 1), + (n.alpha = 1), + (n.interruptAlpha = 1), + (n.mixTime = 0), + (n.mixDuration = i ? this.data.getMix(i.animation, t) : 0), + (n.mixBlend = pi.replace), + n + ); + } + clearNext(e) { + let t = e.next; + for (; t;) (this.queue.dispose(t), (t = t.next)); + e.next = null; + } + _animationsChanged() { + ((this.animationsChanged = false), this.propertyIDs.clear()); + let e = this.tracks; + for (let t = 0, a = e.length; t < a; t++) { + let a = e[t]; + if (a) { + for (; a.mixingFrom;) a = a.mixingFrom; + do { + ((a.mixingTo && a.mixBlend == pi.add) || this.computeHold(a), + (a = a.mixingTo)); + } while (a); } } - computeHold(e) { - let t = e.mixingTo, - a = e.animation.timelines, - i = e.animation.timelines.length, - n = e.timelineMode; - n.length = i; - let s = e.timelineHoldMix; - s.length = 0; - let o = this.propertyIDs; - if (t && t.holdPrevious) - for (let e = 0; e < i; e++) - n[e] = o.addAll(a[e].getPropertyIds()) ? Ki : Ji; - else - e: for (let r = 0; r < i; r++) { - let i = a[r], - l = i.getPropertyIds(); - if (o.addAll(l)) - if ( - !t || - i instanceof Mi || - i instanceof Bi || - i instanceof Di || - !t.animation.hasTimeline(l) - ) - n[r] = $i; - else { - for (let a = t.mixingTo; a; a = a.mixingTo) - if (!a.animation.hasTimeline(l)) { - if (e.mixDuration > 0) { - ((n[r] = Qi), (s[r] = a)); - continue e; - } - break; - } - n[r] = Ki; - } - else n[r] = qi; - } - } - getCurrent(e) { - return e >= this.tracks.length ? null : this.tracks[e]; - } - addListener(e) { - if (!e) throw new Error("listener cannot be null."); - this.listeners.push(e); - } - removeListener(e) { - let t = this.listeners.indexOf(e); - t >= 0 && this.listeners.splice(t, 1); - } - clearListeners() { - this.listeners.length = 0; - } - clearListenerNotifications() { - this.queue.clear(); - } } - class Xi { - constructor() { - ((this.mixBlend = pi.replace), - (this.timelineMode = new Array()), - (this.timelineHoldMix = new Array()), - (this.timelinesRotation = new Array())); - } - reset() { - ((this.next = null), - (this.previous = null), - (this.mixingFrom = null), - (this.mixingTo = null), - (this.animation = null), - (this.listener = null), - (this.timelineMode.length = 0), - (this.timelineHoldMix.length = 0), - (this.timelinesRotation.length = 0)); - } - getAnimationTime() { - if (this.loop) { - let e = this.animationEnd - this.animationStart; - return 0 == e - ? this.animationStart - : (this.trackTime % e) + this.animationStart; + computeHold(e) { + let t = e.mixingTo, + a = e.animation.timelines, + i = e.animation.timelines.length, + n = e.timelineMode; + n.length = i; + let s = e.timelineHoldMix; + s.length = 0; + let o = this.propertyIDs; + if (t && t.holdPrevious) + for (let e = 0; e < i; e++) + n[e] = o.addAll(a[e].getPropertyIds()) ? Ki : Ji; + else + e: for (let r = 0; r < i; r++) { + let i = a[r], + l = i.getPropertyIds(); + if (o.addAll(l)) + if ( + !t || + i instanceof Mi || + i instanceof Bi || + i instanceof Di || + !t.animation.hasTimeline(l) + ) + n[r] = $i; + else { + for (let a = t.mixingTo; a; a = a.mixingTo) + if (!a.animation.hasTimeline(l)) { + if (e.mixDuration > 0) { + ((n[r] = Qi), (s[r] = a)); + continue e; + } + break; + } + n[r] = Ki; + } + else n[r] = qi; } - return Math.min( - this.trackTime + this.animationStart, - this.animationEnd, - ); - } - setAnimationLast(e) { - ((this.animationLast = e), (this.nextAnimationLast = e)); - } - isComplete() { - return this.trackTime >= this.animationEnd - this.animationStart; - } - resetRotationDirections() { - this.timelinesRotation.length = 0; - } - getTrackComplete() { + } + getCurrent(e) { + return e >= this.tracks.length ? null : this.tracks[e]; + } + addListener(e) { + if (!e) throw new Error("listener cannot be null."); + this.listeners.push(e); + } + removeListener(e) { + let t = this.listeners.indexOf(e); + t >= 0 && this.listeners.splice(t, 1); + } + clearListeners() { + this.listeners.length = 0; + } + clearListenerNotifications() { + this.queue.clear(); + } + } + class Xi { + constructor() { + ((this.mixBlend = pi.replace), + (this.timelineMode = new Array()), + (this.timelineHoldMix = new Array()), + (this.timelinesRotation = new Array())); + } + reset() { + ((this.next = null), + (this.previous = null), + (this.mixingFrom = null), + (this.mixingTo = null), + (this.animation = null), + (this.listener = null), + (this.timelineMode.length = 0), + (this.timelineHoldMix.length = 0), + (this.timelinesRotation.length = 0)); + } + getAnimationTime() { + if (this.loop) { let e = this.animationEnd - this.animationStart; - if (0 != e) { - if (this.loop) return e * (1 + ((this.trackTime / e) | 0)); - if (this.trackTime < e) return e; - } - return this.trackTime; + return 0 == e + ? this.animationStart + : (this.trackTime % e) + this.animationStart; } + return Math.min( + this.trackTime + this.animationStart, + this.animationEnd, + ); } - class zi { - constructor(e) { - ((this.objects = []), - (this.drainDisabled = false), - (this.animState = e)); - } - start(e) { - (this.objects.push(Wi.start), - this.objects.push(e), - (this.animState.animationsChanged = true)); - } - interrupt(e) { - (this.objects.push(Wi.interrupt), this.objects.push(e)); - } - end(e) { - (this.objects.push(Wi.end), - this.objects.push(e), - (this.animState.animationsChanged = true)); - } - dispose(e) { - (this.objects.push(Wi.dispose), this.objects.push(e)); - } - complete(e) { - (this.objects.push(Wi.complete), this.objects.push(e)); - } - event(e, t) { - (this.objects.push(Wi.event), - this.objects.push(e), - this.objects.push(t)); + setAnimationLast(e) { + ((this.animationLast = e), (this.nextAnimationLast = e)); + } + isComplete() { + return this.trackTime >= this.animationEnd - this.animationStart; + } + resetRotationDirections() { + this.timelinesRotation.length = 0; + } + getTrackComplete() { + let e = this.animationEnd - this.animationStart; + if (0 != e) { + if (this.loop) return e * (1 + ((this.trackTime / e) | 0)); + if (this.trackTime < e) return e; } - drain() { - if (this.drainDisabled) return; - this.drainDisabled = true; - let e = this.objects, - t = this.animState.listeners; - for (let a = 0; a < e.length; a += 2) { - let i = e[a], - n = e[a + 1]; - switch (i) { - case Wi.start: - n.listener && n.listener.start && n.listener.start(n); - for (let e = 0; e < t.length; e++) - t[e].start && t[e].start(n); - break; - case Wi.interrupt: - n.listener && n.listener.interrupt && n.listener.interrupt(n); - for (let e = 0; e < t.length; e++) - t[e].interrupt && t[e].interrupt(n); - break; - case Wi.end: - n.listener && n.listener.end && n.listener.end(n); - for (let e = 0; e < t.length; e++) t[e].end && t[e].end(n); - case Wi.dispose: - n.listener && n.listener.dispose && n.listener.dispose(n); - for (let e = 0; e < t.length; e++) - t[e].dispose && t[e].dispose(n); - this.animState.trackEntryPool.free(n); - break; - case Wi.complete: - n.listener && n.listener.complete && n.listener.complete(n); - for (let e = 0; e < t.length; e++) - t[e].complete && t[e].complete(n); - break; - case Wi.event: - let i = e[2 + a++]; - n.listener && n.listener.event && n.listener.event(n, i); - for (let e = 0; e < t.length; e++) - t[e].event && t[e].event(n, i); - } + return this.trackTime; + } + } + class zi { + constructor(e) { + ((this.objects = []), + (this.drainDisabled = false), + (this.animState = e)); + } + start(e) { + (this.objects.push(Wi.start), + this.objects.push(e), + (this.animState.animationsChanged = true)); + } + interrupt(e) { + (this.objects.push(Wi.interrupt), this.objects.push(e)); + } + end(e) { + (this.objects.push(Wi.end), + this.objects.push(e), + (this.animState.animationsChanged = true)); + } + dispose(e) { + (this.objects.push(Wi.dispose), this.objects.push(e)); + } + complete(e) { + (this.objects.push(Wi.complete), this.objects.push(e)); + } + event(e, t) { + (this.objects.push(Wi.event), + this.objects.push(e), + this.objects.push(t)); + } + drain() { + if (this.drainDisabled) return; + this.drainDisabled = true; + let e = this.objects, + t = this.animState.listeners; + for (let a = 0; a < e.length; a += 2) { + let i = e[a], + n = e[a + 1]; + switch (i) { + case Wi.start: + n.listener && n.listener.start && n.listener.start(n); + for (let e = 0; e < t.length; e++) + t[e].start && t[e].start(n); + break; + case Wi.interrupt: + n.listener && n.listener.interrupt && n.listener.interrupt(n); + for (let e = 0; e < t.length; e++) + t[e].interrupt && t[e].interrupt(n); + break; + case Wi.end: + n.listener && n.listener.end && n.listener.end(n); + for (let e = 0; e < t.length; e++) t[e].end && t[e].end(n); + case Wi.dispose: + n.listener && n.listener.dispose && n.listener.dispose(n); + for (let e = 0; e < t.length; e++) + t[e].dispose && t[e].dispose(n); + this.animState.trackEntryPool.free(n); + break; + case Wi.complete: + n.listener && n.listener.complete && n.listener.complete(n); + for (let e = 0; e < t.length; e++) + t[e].complete && t[e].complete(n); + break; + case Wi.event: + let i = e[2 + a++]; + n.listener && n.listener.event && n.listener.event(n, i); + for (let e = 0; e < t.length; e++) + t[e].event && t[e].event(n, i); } - (this.clear(), (this.drainDisabled = false)); - } - clear() { - this.objects.length = 0; } + (this.clear(), (this.drainDisabled = false)); } - var Wi; - !(function (e) { - ((e[(e.start = 0)] = "start"), - (e[(e.interrupt = 1)] = "interrupt"), - (e[(e.end = 2)] = "end"), - (e[(e.dispose = 3)] = "dispose"), - (e[(e.complete = 4)] = "complete"), - (e[(e.event = 5)] = "event")); - })(Wi || (Wi = {})); - const qi = 0, - $i = 1, - Ji = 2, - Ki = 3, - Qi = 4, - Zi = 1, - en = 2; - let tn = null; - class an { - constructor(e) { - if (((this.animationToMixTime = {}), (this.defaultMix = 0), !e)) - throw new Error("skeletonData cannot be null."); - this.skeletonData = e; - } - setMix(e, t, a) { - let i = this.skeletonData.findAnimation(e); - if (!i) throw new Error("Animation not found: " + e); - let n = this.skeletonData.findAnimation(t); - if (!n) throw new Error("Animation not found: " + t); - this.setMixWith(i, n, a); - } - setMixWith(e, t, a) { - if (!e) throw new Error("from cannot be null."); - if (!t) throw new Error("to cannot be null."); - let i = e.name + "." + t.name; - this.animationToMixTime[i] = a; - } - getMix(e, t) { - let a = e.name + "." + t.name, - i = this.animationToMixTime[a]; - return void 0 === i ? this.defaultMix : i; - } + clear() { + this.objects.length = 0; } - class nn extends li { - constructor(e) { - (super(e), (this.color = new ai(1, 1, 1, 1))); - } - copy() { - let e = new nn(this.name); - return (this.copyTo(e), e.color.setFromColor(this.color), e); - } + } + var Wi; + !(function (e) { + ((e[(e.start = 0)] = "start"), + (e[(e.interrupt = 1)] = "interrupt"), + (e[(e.end = 2)] = "end"), + (e[(e.dispose = 3)] = "dispose"), + (e[(e.complete = 4)] = "complete"), + (e[(e.event = 5)] = "event")); + })(Wi || (Wi = {})); + const qi = 0, + $i = 1, + Ji = 2, + Ki = 3, + Qi = 4, + Zi = 1, + en = 2; + let tn = null; + class an { + constructor(e) { + if (((this.animationToMixTime = {}), (this.defaultMix = 0), !e)) + throw new Error("skeletonData cannot be null."); + this.skeletonData = e; } - class sn extends li { - constructor(e) { - (super(e), (this.color = new ai(0.2275, 0.2275, 0.8078, 1))); - } - copy() { - let e = new sn(this.name); - return ( - this.copyTo(e), - (e.endSlot = this.endSlot), - e.color.setFromColor(this.color), - e - ); - } + setMix(e, t, a) { + let i = this.skeletonData.findAnimation(e); + if (!i) throw new Error("Animation not found: " + e); + let n = this.skeletonData.findAnimation(t); + if (!n) throw new Error("Animation not found: " + t); + this.setMixWith(i, n, a); } - var on, rn, ln, cn, dn, un, hn, pn, gn, mn; - (!(function (e) { - ((e[(e.Nearest = 9728)] = "Nearest"), - (e[(e.Linear = 9729)] = "Linear"), - (e[(e.MipMap = 9987)] = "MipMap"), - (e[(e.MipMapNearestNearest = 9984)] = "MipMapNearestNearest"), - (e[(e.MipMapLinearNearest = 9985)] = "MipMapLinearNearest"), - (e[(e.MipMapNearestLinear = 9986)] = "MipMapNearestLinear"), - (e[(e.MipMapLinearLinear = 9987)] = "MipMapLinearLinear")); - })(on || (on = {})), - (function (e) { - ((e[(e.MirroredRepeat = 33648)] = "MirroredRepeat"), - (e[(e.ClampToEdge = 33071)] = "ClampToEdge"), - (e[(e.Repeat = 10497)] = "Repeat")); - })(rn || (rn = {}))); - class fn { - constructor(e) { - ((this.pages = new Array()), (this.regions = new Array())); - let t = new yn(e), - a = new Array(4), - i = null, - n = null, - s = { - size: () => { - ((i.width = parseInt(a[1])), (i.height = parseInt(a[2]))); - }, - format: () => {}, - filter: () => { - ((i.minFilter = ni.enumValue(on, a[1])), - (i.magFilter = ni.enumValue(on, a[2]))); - }, - repeat: () => { - (-1 != a[1].indexOf("x") && (i.uWrap = rn.Repeat), - -1 != a[1].indexOf("y") && (i.vWrap = rn.Repeat)); - }, - pma: () => { - i.pma = "true" == a[1]; - }, - }; - var o = { - xy: () => { - ((n.x = parseInt(a[1])), (n.y = parseInt(a[2]))); - }, + setMixWith(e, t, a) { + if (!e) throw new Error("from cannot be null."); + if (!t) throw new Error("to cannot be null."); + let i = e.name + "." + t.name; + this.animationToMixTime[i] = a; + } + getMix(e, t) { + let a = e.name + "." + t.name, + i = this.animationToMixTime[a]; + return void 0 === i ? this.defaultMix : i; + } + } + class nn extends li { + constructor(e) { + (super(e), (this.color = new ai(1, 1, 1, 1))); + } + copy() { + let e = new nn(this.name); + return (this.copyTo(e), e.color.setFromColor(this.color), e); + } + } + class sn extends li { + constructor(e) { + (super(e), (this.color = new ai(0.2275, 0.2275, 0.8078, 1))); + } + copy() { + let e = new sn(this.name); + return ( + this.copyTo(e), + (e.endSlot = this.endSlot), + e.color.setFromColor(this.color), + e + ); + } + } + var on, rn, ln, cn, dn, un, hn, pn, gn, mn; + (!(function (e) { + ((e[(e.Nearest = 9728)] = "Nearest"), + (e[(e.Linear = 9729)] = "Linear"), + (e[(e.MipMap = 9987)] = "MipMap"), + (e[(e.MipMapNearestNearest = 9984)] = "MipMapNearestNearest"), + (e[(e.MipMapLinearNearest = 9985)] = "MipMapLinearNearest"), + (e[(e.MipMapNearestLinear = 9986)] = "MipMapNearestLinear"), + (e[(e.MipMapLinearLinear = 9987)] = "MipMapLinearLinear")); + })(on || (on = {})), + (function (e) { + ((e[(e.MirroredRepeat = 33648)] = "MirroredRepeat"), + (e[(e.ClampToEdge = 33071)] = "ClampToEdge"), + (e[(e.Repeat = 10497)] = "Repeat")); + })(rn || (rn = {}))); + class fn { + constructor(e) { + ((this.pages = new Array()), (this.regions = new Array())); + let t = new yn(e), + a = new Array(4), + i = null, + n = null, + s = { size: () => { - ((n.width = parseInt(a[1])), (n.height = parseInt(a[2]))); - }, - bounds: () => { - ((n.x = parseInt(a[1])), - (n.y = parseInt(a[2])), - (n.width = parseInt(a[3])), - (n.height = parseInt(a[4]))); - }, - offset: () => { - ((n.offsetX = parseInt(a[1])), (n.offsetY = parseInt(a[2]))); + ((i.width = parseInt(a[1])), (i.height = parseInt(a[2]))); }, - orig: () => { - ((n.originalWidth = parseInt(a[1])), - (n.originalHeight = parseInt(a[2]))); + format: () => { }, + filter: () => { + ((i.minFilter = ni.enumValue(on, a[1])), + (i.magFilter = ni.enumValue(on, a[2]))); }, - offsets: () => { - ((n.offsetX = parseInt(a[1])), - (n.offsetY = parseInt(a[2])), - (n.originalWidth = parseInt(a[3])), - (n.originalHeight = parseInt(a[4]))); + repeat: () => { + (-1 != a[1].indexOf("x") && (i.uWrap = rn.Repeat), + -1 != a[1].indexOf("y") && (i.vWrap = rn.Repeat)); }, - rotate: () => { - let e = a[1]; - "true" == e - ? (n.degrees = 90) - : "false" != e && (n.degrees = parseInt(e)); - }, - index: () => { - n.index = parseInt(a[1]); + pma: () => { + i.pma = "true" == a[1]; }, }; - let r = t.readLine(); - for (; r && 0 == r.trim().length; ) r = t.readLine(); - for (; r && 0 != r.trim().length && 0 != t.readEntry(a, r); ) - r = t.readLine(); - let l = null, - c = null; - for (; null !== r; ) - if (0 == r.trim().length) ((i = null), (r = t.readLine())); - else if (i) { - for (n = new bn(), n.page = i, n.name = r; ; ) { - let e = t.readEntry(a, (r = t.readLine())); - if (0 == e) break; - let i = o[a[0]]; - if (i) i(); - else { - (l || ((l = []), (c = [])), l.push(a[0])); - let t = []; - for (let i = 0; i < e; i++) t.push(parseInt(a[i + 1])); - c.push(t); - } - } - (0 == n.originalWidth && - 0 == n.originalHeight && - ((n.originalWidth = n.width), (n.originalHeight = n.height)), - l && - l.length > 0 && - ((n.names = l), (n.values = c), (l = null), (c = null)), - (n.u = n.x / i.width), - (n.v = n.y / i.height), - 90 == n.degrees - ? ((n.u2 = (n.x + n.height) / i.width), - (n.v2 = (n.y + n.width) / i.height)) - : ((n.u2 = (n.x + n.width) / i.width), - (n.v2 = (n.y + n.height) / i.height)), - this.regions.push(n)); - } else { - for ( - i = new En(), i.name = r.trim(); - 0 != t.readEntry(a, (r = t.readLine())); - ) { - let e = s[a[0]]; - e && e(); + var o = { + xy: () => { + ((n.x = parseInt(a[1])), (n.y = parseInt(a[2]))); + }, + size: () => { + ((n.width = parseInt(a[1])), (n.height = parseInt(a[2]))); + }, + bounds: () => { + ((n.x = parseInt(a[1])), + (n.y = parseInt(a[2])), + (n.width = parseInt(a[3])), + (n.height = parseInt(a[4]))); + }, + offset: () => { + ((n.offsetX = parseInt(a[1])), (n.offsetY = parseInt(a[2]))); + }, + orig: () => { + ((n.originalWidth = parseInt(a[1])), + (n.originalHeight = parseInt(a[2]))); + }, + offsets: () => { + ((n.offsetX = parseInt(a[1])), + (n.offsetY = parseInt(a[2])), + (n.originalWidth = parseInt(a[3])), + (n.originalHeight = parseInt(a[4]))); + }, + rotate: () => { + let e = a[1]; + "true" == e + ? (n.degrees = 90) + : "false" != e && (n.degrees = parseInt(e)); + }, + index: () => { + n.index = parseInt(a[1]); + }, + }; + let r = t.readLine(); + for (; r && 0 == r.trim().length;) r = t.readLine(); + for (; r && 0 != r.trim().length && 0 != t.readEntry(a, r);) + r = t.readLine(); + let l = null, + c = null; + for (; null !== r;) + if (0 == r.trim().length) ((i = null), (r = t.readLine())); + else if (i) { + for (n = new bn(), n.page = i, n.name = r; ;) { + let e = t.readEntry(a, (r = t.readLine())); + if (0 == e) break; + let i = o[a[0]]; + if (i) i(); + else { + (l || ((l = []), (c = [])), l.push(a[0])); + let t = []; + for (let i = 0; i < e; i++) t.push(parseInt(a[i + 1])); + c.push(t); } - this.pages.push(i); } - } - findRegion(e) { - for (let t = 0; t < this.regions.length; t++) - if (this.regions[t].name == e) return this.regions[t]; - return null; - } - setTextures(e, t = "") { - for (let a of this.pages) a.setTexture(e.get(t + a.name)); - } - dispose() { - for (let e = 0; e < this.pages.length; e++) - this.pages[e].texture.dispose(); - } + (0 == n.originalWidth && + 0 == n.originalHeight && + ((n.originalWidth = n.width), (n.originalHeight = n.height)), + l && + l.length > 0 && + ((n.names = l), (n.values = c), (l = null), (c = null)), + (n.u = n.x / i.width), + (n.v = n.y / i.height), + 90 == n.degrees + ? ((n.u2 = (n.x + n.height) / i.width), + (n.v2 = (n.y + n.width) / i.height)) + : ((n.u2 = (n.x + n.width) / i.width), + (n.v2 = (n.y + n.height) / i.height)), + this.regions.push(n)); + } else { + for ( + i = new En(), i.name = r.trim(); + 0 != t.readEntry(a, (r = t.readLine())); + ) { + let e = s[a[0]]; + e && e(); + } + this.pages.push(i); + } } - class yn { - constructor(e) { - ((this.index = 0), (this.lines = e.split(/\r\n|\r|\n/))); - } - readLine() { - return this.index >= this.lines.length - ? null - : this.lines[this.index++]; + findRegion(e) { + for (let t = 0; t < this.regions.length; t++) + if (this.regions[t].name == e) return this.regions[t]; + return null; + } + setTextures(e, t = "") { + for (let a of this.pages) a.setTexture(e.get(t + a.name)); + } + dispose() { + for (let e = 0; e < this.pages.length; e++) + this.pages[e].texture.dispose(); + } + } + class yn { + constructor(e) { + ((this.index = 0), (this.lines = e.split(/\r\n|\r|\n/))); + } + readLine() { + return this.index >= this.lines.length + ? null + : this.lines[this.index++]; + } + readEntry(e, t) { + if (!t) return 0; + if (0 == (t = t.trim()).length) return 0; + let a = t.indexOf(":"); + if (-1 == a) return 0; + e[0] = t.substr(0, a).trim(); + for (let i = 1, n = a + 1; ; i++) { + let a = t.indexOf(",", n); + if (-1 == a) return ((e[i] = t.substr(n).trim()), i); + if (((e[i] = t.substr(n, a - n).trim()), (n = a + 1), 4 == i)) + return 4; } - readEntry(e, t) { - if (!t) return 0; - if (0 == (t = t.trim()).length) return 0; - let a = t.indexOf(":"); - if (-1 == a) return 0; - e[0] = t.substr(0, a).trim(); - for (let i = 1, n = a + 1; ; i++) { - let a = t.indexOf(",", n); - if (-1 == a) return ((e[i] = t.substr(n).trim()), i); - if (((e[i] = t.substr(n, a - n).trim()), (n = a + 1), 4 == i)) - return 4; + } + } + class En { + constructor() { + ((this.minFilter = on.Nearest), + (this.magFilter = on.Nearest), + (this.uWrap = rn.ClampToEdge), + (this.vWrap = rn.ClampToEdge)); + } + setTexture(e) { + ((this.texture = e), + e.setFilters(this.minFilter, this.magFilter), + e.setWraps(this.uWrap, this.vWrap)); + } + } + class bn extends class { + constructor() { + ((this.u = 0), + (this.v = 0), + (this.u2 = 0), + (this.v2 = 0), + (this.width = 0), + (this.height = 0), + (this.degrees = 0), + (this.offsetX = 0), + (this.offsetY = 0), + (this.originalWidth = 0), + (this.originalHeight = 0)); + } + } { } + class Sn extends li { + constructor(e) { + (super(e), + (this.color = new ai(1, 1, 1, 1)), + (this.tempColor = new ai(0, 0, 0, 0))); + } + updateRegion() { + let e = this.regionUVs; + (this.uvs && this.uvs.length == e.length) || + (this.uvs = ni.newFloatArray(e.length)); + let t = this.uvs, + a = this.uvs.length, + i = this.region.u, + n = this.region.v, + s = 0, + o = 0; + if (this.region instanceof bn) { + let r = this.region, + l = r.page.texture.getImage(), + c = l.width, + d = l.height; + switch (r.degrees) { + case 90: + ((i -= (r.originalHeight - r.offsetY - r.height) / c), + (n -= (r.originalWidth - r.offsetX - r.width) / d), + (s = r.originalHeight / c), + (o = r.originalWidth / d)); + for (let r = 0; r < a; r += 2) + ((t[r] = i + e[r + 1] * s), + (t[r + 1] = n + (1 - e[r]) * o)); + return; + case 180: + ((i -= (r.originalWidth - r.offsetX - r.width) / c), + (n -= r.offsetY / d), + (s = r.originalWidth / c), + (o = r.originalHeight / d)); + for (let r = 0; r < a; r += 2) + ((t[r] = i + (1 - e[r]) * s), + (t[r + 1] = n + (1 - e[r + 1]) * o)); + return; + case 270: + ((i -= r.offsetY / c), + (n -= r.offsetX / d), + (s = r.originalHeight / c), + (o = r.originalWidth / d)); + for (let r = 0; r < a; r += 2) + ((t[r] = i + (1 - e[r + 1]) * s), + (t[r + 1] = n + e[r] * o)); + return; } - } + ((i -= r.offsetX / c), + (n -= (r.originalHeight - r.offsetY - r.height) / d), + (s = r.originalWidth / c), + (o = r.originalHeight / d)); + } else + this.region + ? ((s = this.region.u2 - i), (o = this.region.v2 - n)) + : ((i = n = 0), (s = o = 1)); + for (let r = 0; r < a; r += 2) + ((t[r] = i + e[r] * s), (t[r + 1] = n + e[r + 1] * o)); } - class En { - constructor() { - ((this.minFilter = on.Nearest), - (this.magFilter = on.Nearest), - (this.uWrap = rn.ClampToEdge), - (this.vWrap = rn.ClampToEdge)); - } - setTexture(e) { - ((this.texture = e), - e.setFilters(this.minFilter, this.magFilter), - e.setWraps(this.uWrap, this.vWrap)); - } + getParentMesh() { + return this.parentMesh; } - class bn extends class { - constructor() { - ((this.u = 0), - (this.v = 0), - (this.u2 = 0), - (this.v2 = 0), - (this.width = 0), - (this.height = 0), - (this.degrees = 0), - (this.offsetX = 0), - (this.offsetY = 0), - (this.originalWidth = 0), - (this.originalHeight = 0)); - } - } {} - class Sn extends li { - constructor(e) { - (super(e), - (this.color = new ai(1, 1, 1, 1)), - (this.tempColor = new ai(0, 0, 0, 0))); - } - updateRegion() { - let e = this.regionUVs; - (this.uvs && this.uvs.length == e.length) || - (this.uvs = ni.newFloatArray(e.length)); - let t = this.uvs, - a = this.uvs.length, - i = this.region.u, - n = this.region.v, - s = 0, - o = 0; - if (this.region instanceof bn) { - let r = this.region, - l = r.page.texture.getImage(), - c = l.width, - d = l.height; - switch (r.degrees) { - case 90: - ((i -= (r.originalHeight - r.offsetY - r.height) / c), - (n -= (r.originalWidth - r.offsetX - r.width) / d), - (s = r.originalHeight / c), - (o = r.originalWidth / d)); - for (let r = 0; r < a; r += 2) - ((t[r] = i + e[r + 1] * s), - (t[r + 1] = n + (1 - e[r]) * o)); - return; - case 180: - ((i -= (r.originalWidth - r.offsetX - r.width) / c), - (n -= r.offsetY / d), - (s = r.originalWidth / c), - (o = r.originalHeight / d)); - for (let r = 0; r < a; r += 2) - ((t[r] = i + (1 - e[r]) * s), - (t[r + 1] = n + (1 - e[r + 1]) * o)); - return; - case 270: - ((i -= r.offsetY / c), - (n -= r.offsetX / d), - (s = r.originalHeight / c), - (o = r.originalWidth / d)); - for (let r = 0; r < a; r += 2) - ((t[r] = i + (1 - e[r + 1]) * s), - (t[r + 1] = n + e[r] * o)); - return; - } - ((i -= r.offsetX / c), - (n -= (r.originalHeight - r.offsetY - r.height) / d), - (s = r.originalWidth / c), - (o = r.originalHeight / d)); - } else - this.region - ? ((s = this.region.u2 - i), (o = this.region.v2 - n)) - : ((i = n = 0), (s = o = 1)); - for (let r = 0; r < a; r += 2) - ((t[r] = i + e[r] * s), (t[r + 1] = n + e[r + 1] * o)); - } - getParentMesh() { - return this.parentMesh; - } - setParentMesh(e) { - ((this.parentMesh = e), - e && - ((this.bones = e.bones), - (this.vertices = e.vertices), - (this.worldVerticesLength = e.worldVerticesLength), - (this.regionUVs = e.regionUVs), - (this.triangles = e.triangles), - (this.hullLength = e.hullLength), - (this.worldVerticesLength = e.worldVerticesLength))); - } - copy() { - if (this.parentMesh) return this.newLinkedMesh(); - let e = new Sn(this.name); - return ( - (e.region = this.region), - (e.path = this.path), - e.color.setFromColor(this.color), - this.copyTo(e), - (e.regionUVs = new Array(this.regionUVs.length)), - ni.arrayCopy( - this.regionUVs, - 0, - e.regionUVs, - 0, - this.regionUVs.length, - ), - (e.uvs = new Array(this.uvs.length)), - ni.arrayCopy(this.uvs, 0, e.uvs, 0, this.uvs.length), - (e.triangles = new Array(this.triangles.length)), - ni.arrayCopy( - this.triangles, - 0, - e.triangles, - 0, - this.triangles.length, - ), - (e.hullLength = this.hullLength), - (e.sequence = - null != this.sequence ? this.sequence.copy() : null), - this.edges && - ((e.edges = new Array(this.edges.length)), - ni.arrayCopy(this.edges, 0, e.edges, 0, this.edges.length)), - (e.width = this.width), - (e.height = this.height), - e - ); - } - computeWorldVertices(e, t, a, i, n, s) { - (null != this.sequence && this.sequence.apply(e, this), - super.computeWorldVertices(e, t, a, i, n, s)); - } - newLinkedMesh() { - let e = new Sn(this.name); - return ( - (e.region = this.region), - (e.path = this.path), - e.color.setFromColor(this.color), - (e.timelineAttahment = this.timelineAttahment), - e.setParentMesh(this.parentMesh ? this.parentMesh : this), - null != e.region && e.updateRegion(), - e - ); - } + setParentMesh(e) { + ((this.parentMesh = e), + e && + ((this.bones = e.bones), + (this.vertices = e.vertices), + (this.worldVerticesLength = e.worldVerticesLength), + (this.regionUVs = e.regionUVs), + (this.triangles = e.triangles), + (this.hullLength = e.hullLength), + (this.worldVerticesLength = e.worldVerticesLength))); } - class In extends li { - constructor(e) { - (super(e), - (this.closed = false), - (this.constantSpeed = false), - (this.color = new ai(1, 1, 1, 1))); - } - copy() { - let e = new In(this.name); - return ( - this.copyTo(e), - (e.lengths = new Array(this.lengths.length)), - ni.arrayCopy(this.lengths, 0, e.lengths, 0, this.lengths.length), - (e.closed = closed), - (e.constantSpeed = this.constantSpeed), - e.color.setFromColor(this.color), - e - ); - } + copy() { + if (this.parentMesh) return this.newLinkedMesh(); + let e = new Sn(this.name); + return ( + (e.region = this.region), + (e.path = this.path), + e.color.setFromColor(this.color), + this.copyTo(e), + (e.regionUVs = new Array(this.regionUVs.length)), + ni.arrayCopy( + this.regionUVs, + 0, + e.regionUVs, + 0, + this.regionUVs.length, + ), + (e.uvs = new Array(this.uvs.length)), + ni.arrayCopy(this.uvs, 0, e.uvs, 0, this.uvs.length), + (e.triangles = new Array(this.triangles.length)), + ni.arrayCopy( + this.triangles, + 0, + e.triangles, + 0, + this.triangles.length, + ), + (e.hullLength = this.hullLength), + (e.sequence = + null != this.sequence ? this.sequence.copy() : null), + this.edges && + ((e.edges = new Array(this.edges.length)), + ni.arrayCopy(this.edges, 0, e.edges, 0, this.edges.length)), + (e.width = this.width), + (e.height = this.height), + e + ); } - class _n extends li { - constructor(e) { - (super(e), (this.color = new ai(0.38, 0.94, 0, 1))); - } - computeWorldPosition(e, t) { - return ( - (t.x = this.x * e.a + this.y * e.b + e.worldX), - (t.y = this.x * e.c + this.y * e.d + e.worldY), - t - ); - } - computeWorldRotation(e) { - let t = ii.cosDeg(this.rotation), - a = ii.sinDeg(this.rotation), - i = t * e.a + a * e.b, - n = t * e.c + a * e.d; - return Math.atan2(n, i) * ii.radDeg; - } - copy() { - let e = new _n(this.name); - return ( - (e.x = this.x), - (e.y = this.y), - (e.rotation = this.rotation), - e.color.setFromColor(this.color), - e - ); - } + computeWorldVertices(e, t, a, i, n, s) { + (null != this.sequence && this.sequence.apply(e, this), + super.computeWorldVertices(e, t, a, i, n, s)); } - class vn extends ri { - constructor(e) { - (super(e), - (this.x = 0), - (this.y = 0), - (this.scaleX = 1), - (this.scaleY = 1), - (this.rotation = 0), - (this.width = 0), - (this.height = 0), - (this.color = new ai(1, 1, 1, 1)), - (this.offset = ni.newFloatArray(8)), - (this.uvs = ni.newFloatArray(8)), - (this.tempColor = new ai(1, 1, 1, 1))); - } - updateRegion() { - let e = this.region, - t = (this.width / this.region.originalWidth) * this.scaleX, - a = (this.height / this.region.originalHeight) * this.scaleY, - i = (-this.width / 2) * this.scaleX + this.region.offsetX * t, - n = (-this.height / 2) * this.scaleY + this.region.offsetY * a, - s = i + this.region.width * t, - o = n + this.region.height * a, - r = (this.rotation * Math.PI) / 180, - l = Math.cos(r), - c = Math.sin(r), - d = this.x, - u = this.y, - h = i * l + d, - p = i * c, - g = n * l + u, - m = n * c, - f = s * l + d, - y = s * c, - E = o * l + u, - b = o * c, - S = this.offset; - ((S[0] = h - m), - (S[1] = g + p), - (S[2] = h - b), - (S[3] = E + p), - (S[4] = f - b), - (S[5] = E + y), - (S[6] = f - m), - (S[7] = g + y)); - let I = this.uvs; - 90 == e.degrees - ? ((I[2] = e.u), - (I[3] = e.v2), - (I[4] = e.u), - (I[5] = e.v), - (I[6] = e.u2), - (I[7] = e.v), - (I[0] = e.u2), - (I[1] = e.v2)) - : ((I[0] = e.u), - (I[1] = e.v2), - (I[2] = e.u), - (I[3] = e.v), - (I[4] = e.u2), - (I[5] = e.v), - (I[6] = e.u2), - (I[7] = e.v2)); - } - computeWorldVertices(e, t, a, i) { - null != this.sequence && this.sequence.apply(e, this); - let n = e.bone, - s = this.offset, - o = n.worldX, - r = n.worldY, - l = n.a, - c = n.b, - d = n.c, - u = n.d, - h = 0, - p = 0; - ((h = s[0]), - (p = s[1]), - (t[a] = h * l + p * c + o), - (t[a + 1] = h * d + p * u + r), - (a += i), - (h = s[2]), - (p = s[3]), - (t[a] = h * l + p * c + o), - (t[a + 1] = h * d + p * u + r), - (a += i), - (h = s[4]), - (p = s[5]), - (t[a] = h * l + p * c + o), - (t[a + 1] = h * d + p * u + r), - (a += i), - (h = s[6]), - (p = s[7]), - (t[a] = h * l + p * c + o), - (t[a + 1] = h * d + p * u + r)); - } - copy() { - let e = new vn(this.name); - return ( - (e.region = this.region), - (e.rendererObject = this.rendererObject), - (e.path = this.path), - (e.x = this.x), - (e.y = this.y), - (e.scaleX = this.scaleX), - (e.scaleY = this.scaleY), - (e.rotation = this.rotation), - (e.width = this.width), - (e.height = this.height), - ni.arrayCopy(this.uvs, 0, e.uvs, 0, 8), - ni.arrayCopy(this.offset, 0, e.offset, 0, 8), - e.color.setFromColor(this.color), - (e.sequence = - null != this.sequence ? this.sequence.copy() : null), - e - ); - } + newLinkedMesh() { + let e = new Sn(this.name); + return ( + (e.region = this.region), + (e.path = this.path), + e.color.setFromColor(this.color), + (e.timelineAttahment = this.timelineAttahment), + e.setParentMesh(this.parentMesh ? this.parentMesh : this), + null != e.region && e.updateRegion(), + e + ); } - ((vn.X1 = 0), - (vn.Y1 = 1), - (vn.C1R = 2), - (vn.C1G = 3), - (vn.C1B = 4), - (vn.C1A = 5), - (vn.U1 = 6), - (vn.V1 = 7), - (vn.X2 = 8), - (vn.Y2 = 9), - (vn.C2R = 10), - (vn.C2G = 11), - (vn.C2B = 12), - (vn.C2A = 13), - (vn.U2 = 14), - (vn.V2 = 15), - (vn.X3 = 16), - (vn.Y3 = 17), - (vn.C3R = 18), - (vn.C3G = 19), - (vn.C3B = 20), - (vn.C3A = 21), - (vn.U3 = 22), - (vn.V3 = 23), - (vn.X4 = 24), - (vn.Y4 = 25), - (vn.C4R = 26), - (vn.C4G = 27), - (vn.C4B = 28), - (vn.C4A = 29), - (vn.U4 = 30), - (vn.V4 = 31)); - class Tn { - constructor(e) { - this.atlas = e; - } - loadSequence(e, t, a) { - let i = a.regions; - for (let n = 0, s = i.length; n < s; n++) { - let s = a.getPath(t, n); - if ( - ((i[n] = this.atlas.findRegion(s)), + } + class In extends li { + constructor(e) { + (super(e), + (this.closed = false), + (this.constantSpeed = false), + (this.color = new ai(1, 1, 1, 1))); + } + copy() { + let e = new In(this.name); + return ( + this.copyTo(e), + (e.lengths = new Array(this.lengths.length)), + ni.arrayCopy(this.lengths, 0, e.lengths, 0, this.lengths.length), + (e.closed = closed), + (e.constantSpeed = this.constantSpeed), + e.color.setFromColor(this.color), + e + ); + } + } + class _n extends li { + constructor(e) { + (super(e), (this.color = new ai(0.38, 0.94, 0, 1))); + } + computeWorldPosition(e, t) { + return ( + (t.x = this.x * e.a + this.y * e.b + e.worldX), + (t.y = this.x * e.c + this.y * e.d + e.worldY), + t + ); + } + computeWorldRotation(e) { + let t = ii.cosDeg(this.rotation), + a = ii.sinDeg(this.rotation), + i = t * e.a + a * e.b, + n = t * e.c + a * e.d; + return Math.atan2(n, i) * ii.radDeg; + } + copy() { + let e = new _n(this.name); + return ( + (e.x = this.x), + (e.y = this.y), + (e.rotation = this.rotation), + e.color.setFromColor(this.color), + e + ); + } + } + class vn extends ri { + constructor(e) { + (super(e), + (this.x = 0), + (this.y = 0), + (this.scaleX = 1), + (this.scaleY = 1), + (this.rotation = 0), + (this.width = 0), + (this.height = 0), + (this.color = new ai(1, 1, 1, 1)), + (this.offset = ni.newFloatArray(8)), + (this.uvs = ni.newFloatArray(8)), + (this.tempColor = new ai(1, 1, 1, 1))); + } + updateRegion() { + let e = this.region, + t = (this.width / this.region.originalWidth) * this.scaleX, + a = (this.height / this.region.originalHeight) * this.scaleY, + i = (-this.width / 2) * this.scaleX + this.region.offsetX * t, + n = (-this.height / 2) * this.scaleY + this.region.offsetY * a, + s = i + this.region.width * t, + o = n + this.region.height * a, + r = (this.rotation * Math.PI) / 180, + l = Math.cos(r), + c = Math.sin(r), + d = this.x, + u = this.y, + h = i * l + d, + p = i * c, + g = n * l + u, + m = n * c, + f = s * l + d, + y = s * c, + E = o * l + u, + b = o * c, + S = this.offset; + ((S[0] = h - m), + (S[1] = g + p), + (S[2] = h - b), + (S[3] = E + p), + (S[4] = f - b), + (S[5] = E + y), + (S[6] = f - m), + (S[7] = g + y)); + let I = this.uvs; + 90 == e.degrees + ? ((I[2] = e.u), + (I[3] = e.v2), + (I[4] = e.u), + (I[5] = e.v), + (I[6] = e.u2), + (I[7] = e.v), + (I[0] = e.u2), + (I[1] = e.v2)) + : ((I[0] = e.u), + (I[1] = e.v2), + (I[2] = e.u), + (I[3] = e.v), + (I[4] = e.u2), + (I[5] = e.v), + (I[6] = e.u2), + (I[7] = e.v2)); + } + computeWorldVertices(e, t, a, i) { + null != this.sequence && this.sequence.apply(e, this); + let n = e.bone, + s = this.offset, + o = n.worldX, + r = n.worldY, + l = n.a, + c = n.b, + d = n.c, + u = n.d, + h = 0, + p = 0; + ((h = s[0]), + (p = s[1]), + (t[a] = h * l + p * c + o), + (t[a + 1] = h * d + p * u + r), + (a += i), + (h = s[2]), + (p = s[3]), + (t[a] = h * l + p * c + o), + (t[a + 1] = h * d + p * u + r), + (a += i), + (h = s[4]), + (p = s[5]), + (t[a] = h * l + p * c + o), + (t[a + 1] = h * d + p * u + r), + (a += i), + (h = s[6]), + (p = s[7]), + (t[a] = h * l + p * c + o), + (t[a + 1] = h * d + p * u + r)); + } + copy() { + let e = new vn(this.name); + return ( + (e.region = this.region), + (e.rendererObject = this.rendererObject), + (e.path = this.path), + (e.x = this.x), + (e.y = this.y), + (e.scaleX = this.scaleX), + (e.scaleY = this.scaleY), + (e.rotation = this.rotation), + (e.width = this.width), + (e.height = this.height), + ni.arrayCopy(this.uvs, 0, e.uvs, 0, 8), + ni.arrayCopy(this.offset, 0, e.offset, 0, 8), + e.color.setFromColor(this.color), + (e.sequence = + null != this.sequence ? this.sequence.copy() : null), + e + ); + } + } + ((vn.X1 = 0), + (vn.Y1 = 1), + (vn.C1R = 2), + (vn.C1G = 3), + (vn.C1B = 4), + (vn.C1A = 5), + (vn.U1 = 6), + (vn.V1 = 7), + (vn.X2 = 8), + (vn.Y2 = 9), + (vn.C2R = 10), + (vn.C2G = 11), + (vn.C2B = 12), + (vn.C2A = 13), + (vn.U2 = 14), + (vn.V2 = 15), + (vn.X3 = 16), + (vn.Y3 = 17), + (vn.C3R = 18), + (vn.C3G = 19), + (vn.C3B = 20), + (vn.C3A = 21), + (vn.U3 = 22), + (vn.V3 = 23), + (vn.X4 = 24), + (vn.Y4 = 25), + (vn.C4R = 26), + (vn.C4G = 27), + (vn.C4B = 28), + (vn.C4A = 29), + (vn.U4 = 30), + (vn.V4 = 31)); + class Tn { + constructor(e) { + this.atlas = e; + } + loadSequence(e, t, a) { + let i = a.regions; + for (let n = 0, s = i.length; n < s; n++) { + let s = a.getPath(t, n); + if ( + ((i[n] = this.atlas.findRegion(s)), (i[n].renderObject = i[n]), null == i[n]) - ) - throw new Error( - "Region not found in atlas: " + s + " (sequence: " + e + ")", - ); - } - } - newRegionAttachment(e, t, a, i) { - let n = new vn(t); - if (null != i) this.loadSequence(t, a, i); - else { - if (!this.atlas.findRegion) { - throw new Error( - "Region not found in atlas: " + - a + - " (region attachment: " + - t + - ") THIS IS NORMAL!! JUST REFRESH THE PAGE!" - ) - } - let e = this.atlas.findRegion(a); - if (!e) - throw new Error( - "Region not found in atlas: " + - a + - " (region attachment: " + - t + - ")", - ); - ((e.renderObject = e), (n.region = e)); - } - return n; - } - newMeshAttachment(e, t, a, i) { - let n = new Sn(t); - if (null != i) this.loadSequence(t, a, i); - else { - let e = this.atlas.findRegion(a); - if (!e) - throw new Error( - "Region not found in atlas: " + - a + - " (mesh attachment: " + - t + - ")", - ); - ((e.renderObject = e), (n.region = e)); - } - return n; - } - newBoundingBoxAttachment(e, t) { - return new nn(t); - } - newPathAttachment(e, t) { - return new In(t); + ) + throw new Error( + "Region not found in atlas: " + s + " (sequence: " + e + ")", + ); } - newPointAttachment(e, t) { - return new _n(t); + } + newRegionAttachment(e, t, a, i) { + let n = new vn(t); + if (null != i) this.loadSequence(t, a, i); + else { + let e = this.atlas.findRegion(a); + if (!e) + throw new Error( + "Region not found in atlas: " + + a + + " (region attachment: " + + t + + ")", + ); + ((e.renderObject = e), (n.region = e)); } - newClippingAttachment(e, t) { - return new sn(t); + return n; + } + newMeshAttachment(e, t, a, i) { + let n = new Sn(t); + if (null != i) this.loadSequence(t, a, i); + else { + let e = this.atlas.findRegion(a); + if (!e) + throw new Error( + "Region not found in atlas: " + + a + + " (mesh attachment: " + + t + + ")", + ); + ((e.renderObject = e), (n.region = e)); } + return n; } - class Rn { - constructor(e, t, a) { - if ( - ((this.x = 0), + newBoundingBoxAttachment(e, t) { + return new nn(t); + } + newPathAttachment(e, t) { + return new In(t); + } + newPointAttachment(e, t) { + return new _n(t); + } + newClippingAttachment(e, t) { + return new sn(t); + } + } + class Rn { + constructor(e, t, a) { + if ( + ((this.x = 0), (this.y = 0), (this.rotation = 0), (this.scaleX = 1), @@ -24820,23 +24793,23 @@ var version = "v1.17.2"; (this.skinRequired = false), (this.color = new ai()), e < 0) - ) - throw new Error("index must be >= 0."); - if (!t) throw new Error("name cannot be null."); - ((this.index = e), (this.name = t), (this.parent = a)); - } + ) + throw new Error("index must be >= 0."); + if (!t) throw new Error("name cannot be null."); + ((this.index = e), (this.name = t), (this.parent = a)); } - !(function (e) { - ((e[(e.Normal = 0)] = "Normal"), - (e[(e.OnlyTranslation = 1)] = "OnlyTranslation"), - (e[(e.NoRotationOrReflection = 2)] = "NoRotationOrReflection"), - (e[(e.NoScale = 3)] = "NoScale"), - (e[(e.NoScaleOrReflection = 4)] = "NoScaleOrReflection")); - })(ln || (ln = {})); - class On { - constructor(e, t, a) { - if ( - ((this.children = new Array()), + } + !(function (e) { + ((e[(e.Normal = 0)] = "Normal"), + (e[(e.OnlyTranslation = 1)] = "OnlyTranslation"), + (e[(e.NoRotationOrReflection = 2)] = "NoRotationOrReflection"), + (e[(e.NoScale = 3)] = "NoScale"), + (e[(e.NoScaleOrReflection = 4)] = "NoScaleOrReflection")); + })(ln || (ln = {})); + class On { + constructor(e, t, a) { + if ( + ((this.children = new Array()), (this.x = 0), (this.y = 0), (this.rotation = 0), @@ -24860,656 +24833,656 @@ var version = "v1.17.2"; (this.sorted = false), (this.active = false), !e) - ) - throw new Error("data cannot be null."); - if (!t) throw new Error("skeleton cannot be null."); - ((this.data = e), - (this.skeleton = t), - (this.parent = a), - this.setToSetupPose()); - } - isActive() { - return this.active; - } - update() { - this.updateWorldTransformWith( - this.ax, - this.ay, - this.arotation, - this.ascaleX, - this.ascaleY, - this.ashearX, - this.ashearY, - ); - } - updateWorldTransform() { - this.updateWorldTransformWith( - this.x, - this.y, - this.rotation, - this.scaleX, - this.scaleY, - this.shearX, - this.shearY, + ) + throw new Error("data cannot be null."); + if (!t) throw new Error("skeleton cannot be null."); + ((this.data = e), + (this.skeleton = t), + (this.parent = a), + this.setToSetupPose()); + } + isActive() { + return this.active; + } + update() { + this.updateWorldTransformWith( + this.ax, + this.ay, + this.arotation, + this.ascaleX, + this.ascaleY, + this.ashearX, + this.ashearY, + ); + } + updateWorldTransform() { + this.updateWorldTransformWith( + this.x, + this.y, + this.rotation, + this.scaleX, + this.scaleY, + this.shearX, + this.shearY, + ); + } + updateWorldTransformWith(e, t, a, i, n, s, o) { + ((this.ax = e), + (this.ay = t), + (this.arotation = a), + (this.ascaleX = i), + (this.ascaleY = n), + (this.ashearX = s), + (this.ashearY = o)); + let r = this.parent; + if (!r) { + let r = this.skeleton, + l = a + 90 + o, + c = r.scaleX, + d = r.scaleY; + return ( + (this.a = ii.cosDeg(a + s) * i * c), + (this.b = ii.cosDeg(l) * n * c), + (this.c = ii.sinDeg(a + s) * i * d), + (this.d = ii.sinDeg(l) * n * d), + (this.worldX = e * c + r.x), + void (this.worldY = t * d + r.y) ); } - updateWorldTransformWith(e, t, a, i, n, s, o) { - ((this.ax = e), - (this.ay = t), - (this.arotation = a), - (this.ascaleX = i), - (this.ascaleY = n), - (this.ashearX = s), - (this.ashearY = o)); - let r = this.parent; - if (!r) { - let r = this.skeleton, - l = a + 90 + o, - c = r.scaleX, - d = r.scaleY; + let l = r.a, + c = r.b, + d = r.c, + u = r.d; + switch ( + ((this.worldX = l * e + c * t + r.worldX), + (this.worldY = d * e + u * t + r.worldY), + this.data.transformMode) + ) { + case ln.Normal: { + let e = a + 90 + o, + t = ii.cosDeg(a + s) * i, + r = ii.cosDeg(e) * n, + h = ii.sinDeg(a + s) * i, + p = ii.sinDeg(e) * n; return ( - (this.a = ii.cosDeg(a + s) * i * c), - (this.b = ii.cosDeg(l) * n * c), - (this.c = ii.sinDeg(a + s) * i * d), - (this.d = ii.sinDeg(l) * n * d), - (this.worldX = e * c + r.x), - void (this.worldY = t * d + r.y) + (this.a = l * t + c * h), + (this.b = l * r + c * p), + (this.c = d * t + u * h), + void (this.d = d * r + u * p) ); } - let l = r.a, - c = r.b, - d = r.c, - u = r.d; - switch ( - ((this.worldX = l * e + c * t + r.worldX), - (this.worldY = d * e + u * t + r.worldY), - this.data.transformMode) - ) { - case ln.Normal: { - let e = a + 90 + o, - t = ii.cosDeg(a + s) * i, - r = ii.cosDeg(e) * n, - h = ii.sinDeg(a + s) * i, - p = ii.sinDeg(e) * n; - return ( - (this.a = l * t + c * h), - (this.b = l * r + c * p), - (this.c = d * t + u * h), - void (this.d = d * r + u * p) - ); - } - case ln.OnlyTranslation: { - let e = a + 90 + o; - ((this.a = ii.cosDeg(a + s) * i), - (this.b = ii.cosDeg(e) * n), - (this.c = ii.sinDeg(a + s) * i), - (this.d = ii.sinDeg(e) * n)); - break; - } - case ln.NoRotationOrReflection: { - let e = l * l + d * d, - t = 0; - e > 1e-4 - ? ((e = Math.abs(l * u - c * d) / e), - (l /= this.skeleton.scaleX), - (d /= this.skeleton.scaleY), - (c = d * e), - (u = l * e), - (t = Math.atan2(d, l) * ii.radDeg)) - : ((l = 0), (d = 0), (t = 90 - Math.atan2(u, c) * ii.radDeg)); - let r = a + s - t, - h = a + o - t + 90, - p = ii.cosDeg(r) * i, - g = ii.cosDeg(h) * n, - m = ii.sinDeg(r) * i, - f = ii.sinDeg(h) * n; - ((this.a = l * p - c * m), - (this.b = l * g - c * f), - (this.c = d * p + u * m), - (this.d = d * g + u * f)); - break; - } - case ln.NoScale: - case ln.NoScaleOrReflection: { - let e = ii.cosDeg(a), - t = ii.sinDeg(a), - r = (l * e + c * t) / this.skeleton.scaleX, - h = (d * e + u * t) / this.skeleton.scaleY, - p = Math.sqrt(r * r + h * h); - (p > 1e-5 && (p = 1 / p), - (r *= p), - (h *= p), - (p = Math.sqrt(r * r + h * h)), - this.data.transformMode == ln.NoScale && - l * u - c * d < 0 != - (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0) && - (p = -p)); - let g = Math.PI / 2 + Math.atan2(h, r), - m = Math.cos(g) * p, - f = Math.sin(g) * p, - y = ii.cosDeg(s) * i, - E = ii.cosDeg(90 + o) * n, - b = ii.sinDeg(s) * i, - S = ii.sinDeg(90 + o) * n; - ((this.a = r * y + m * b), - (this.b = r * E + m * S), - (this.c = h * y + f * b), - (this.d = h * E + f * S)); - break; - } + case ln.OnlyTranslation: { + let e = a + 90 + o; + ((this.a = ii.cosDeg(a + s) * i), + (this.b = ii.cosDeg(e) * n), + (this.c = ii.sinDeg(a + s) * i), + (this.d = ii.sinDeg(e) * n)); + break; + } + case ln.NoRotationOrReflection: { + let e = l * l + d * d, + t = 0; + e > 1e-4 + ? ((e = Math.abs(l * u - c * d) / e), + (l /= this.skeleton.scaleX), + (d /= this.skeleton.scaleY), + (c = d * e), + (u = l * e), + (t = Math.atan2(d, l) * ii.radDeg)) + : ((l = 0), (d = 0), (t = 90 - Math.atan2(u, c) * ii.radDeg)); + let r = a + s - t, + h = a + o - t + 90, + p = ii.cosDeg(r) * i, + g = ii.cosDeg(h) * n, + m = ii.sinDeg(r) * i, + f = ii.sinDeg(h) * n; + ((this.a = l * p - c * m), + (this.b = l * g - c * f), + (this.c = d * p + u * m), + (this.d = d * g + u * f)); + break; + } + case ln.NoScale: + case ln.NoScaleOrReflection: { + let e = ii.cosDeg(a), + t = ii.sinDeg(a), + r = (l * e + c * t) / this.skeleton.scaleX, + h = (d * e + u * t) / this.skeleton.scaleY, + p = Math.sqrt(r * r + h * h); + (p > 1e-5 && (p = 1 / p), + (r *= p), + (h *= p), + (p = Math.sqrt(r * r + h * h)), + this.data.transformMode == ln.NoScale && + l * u - c * d < 0 != + (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0) && + (p = -p)); + let g = Math.PI / 2 + Math.atan2(h, r), + m = Math.cos(g) * p, + f = Math.sin(g) * p, + y = ii.cosDeg(s) * i, + E = ii.cosDeg(90 + o) * n, + b = ii.sinDeg(s) * i, + S = ii.sinDeg(90 + o) * n; + ((this.a = r * y + m * b), + (this.b = r * E + m * S), + (this.c = h * y + f * b), + (this.d = h * E + f * S)); + break; } - ((this.a *= this.skeleton.scaleX), - (this.b *= this.skeleton.scaleX), - (this.c *= this.skeleton.scaleY), - (this.d *= this.skeleton.scaleY)); - } - setToSetupPose() { - let e = this.data; - ((this.x = e.x), - (this.y = e.y), - (this.rotation = e.rotation), - (this.scaleX = e.scaleX), - (this.scaleY = e.scaleY), - (this.shearX = e.shearX), - (this.shearY = e.shearY)); - } - getWorldRotationX() { - return Math.atan2(this.c, this.a) * ii.radDeg; - } - getWorldRotationY() { - return Math.atan2(this.d, this.b) * ii.radDeg; - } - getWorldScaleX() { - return Math.sqrt(this.a * this.a + this.c * this.c); - } - getWorldScaleY() { - return Math.sqrt(this.b * this.b + this.d * this.d); - } - updateAppliedTransform() { - let e = this.parent; - if (!e) - return ( - (this.ax = this.worldX - this.skeleton.x), - (this.ay = this.worldY - this.skeleton.y), - (this.arotation = Math.atan2(this.c, this.a) * ii.radDeg), - (this.ascaleX = Math.sqrt(this.a * this.a + this.c * this.c)), - (this.ascaleY = Math.sqrt(this.b * this.b + this.d * this.d)), - (this.ashearX = 0), - void (this.ashearY = - Math.atan2( - this.a * this.b + this.c * this.d, - this.a * this.d - this.b * this.c, - ) * ii.radDeg) - ); - let t = e.a, - a = e.b, - i = e.c, - n = e.d, - s = 1 / (t * n - a * i), - o = this.worldX - e.worldX, - r = this.worldY - e.worldY; - ((this.ax = o * n * s - r * a * s), - (this.ay = r * t * s - o * i * s)); - let l = s * n, - c = s * t, - d = s * a, - u = s * i, - h = l * this.a - d * this.c, - p = l * this.b - d * this.d, - g = c * this.c - u * this.a, - m = c * this.d - u * this.b; - if ( - ((this.ashearX = 0), - (this.ascaleX = Math.sqrt(h * h + g * g)), - this.ascaleX > 1e-4) - ) { - let e = h * m - p * g; - ((this.ascaleY = e / this.ascaleX), - (this.ashearY = Math.atan2(h * p + g * m, e) * ii.radDeg), - (this.arotation = Math.atan2(g, h) * ii.radDeg)); - } else - ((this.ascaleX = 0), - (this.ascaleY = Math.sqrt(p * p + m * m)), - (this.ashearY = 0), - (this.arotation = 90 - Math.atan2(m, p) * ii.radDeg)); - } - worldToLocal(e) { - let t = 1 / (this.a * this.d - this.b * this.c), - a = e.x - this.worldX, - i = e.y - this.worldY; - return ( - (e.x = a * this.d * t - i * this.b * t), - (e.y = i * this.a * t - a * this.c * t), - e - ); - } - localToWorld(e) { - let t = e.x, - a = e.y; - return ( - (e.x = t * this.a + a * this.b + this.worldX), - (e.y = t * this.c + a * this.d + this.worldY), - e - ); - } - worldToLocalRotation(e) { - let t = ii.sinDeg(e), - a = ii.cosDeg(e); - return ( - Math.atan2(this.a * t - this.c * a, this.d * a - this.b * t) * - ii.radDeg + - this.rotation - - this.shearX - ); } - localToWorldRotation(e) { - e -= this.rotation - this.shearX; - let t = ii.sinDeg(e), - a = ii.cosDeg(e); + ((this.a *= this.skeleton.scaleX), + (this.b *= this.skeleton.scaleX), + (this.c *= this.skeleton.scaleY), + (this.d *= this.skeleton.scaleY)); + } + setToSetupPose() { + let e = this.data; + ((this.x = e.x), + (this.y = e.y), + (this.rotation = e.rotation), + (this.scaleX = e.scaleX), + (this.scaleY = e.scaleY), + (this.shearX = e.shearX), + (this.shearY = e.shearY)); + } + getWorldRotationX() { + return Math.atan2(this.c, this.a) * ii.radDeg; + } + getWorldRotationY() { + return Math.atan2(this.d, this.b) * ii.radDeg; + } + getWorldScaleX() { + return Math.sqrt(this.a * this.a + this.c * this.c); + } + getWorldScaleY() { + return Math.sqrt(this.b * this.b + this.d * this.d); + } + updateAppliedTransform() { + let e = this.parent; + if (!e) return ( - Math.atan2(a * this.c + t * this.d, a * this.a + t * this.b) * - ii.radDeg + (this.ax = this.worldX - this.skeleton.x), + (this.ay = this.worldY - this.skeleton.y), + (this.arotation = Math.atan2(this.c, this.a) * ii.radDeg), + (this.ascaleX = Math.sqrt(this.a * this.a + this.c * this.c)), + (this.ascaleY = Math.sqrt(this.b * this.b + this.d * this.d)), + (this.ashearX = 0), + void (this.ashearY = + Math.atan2( + this.a * this.b + this.c * this.d, + this.a * this.d - this.b * this.c, + ) * ii.radDeg) ); - } - rotateWorld(e) { - let t = this.a, - a = this.b, - i = this.c, - n = this.d, - s = ii.cosDeg(e), - o = ii.sinDeg(e); - ((this.a = s * t - o * i), - (this.b = s * a - o * n), - (this.c = o * t + s * i), - (this.d = o * a + s * n)); - } - } - class Cn { - constructor() { - ((this.callbacks = {}), (this.rawDataUris = {})); - } - dataUriToString(e) { - if (!e.startsWith("data:")) throw new Error("Not a data URI."); - let t = e.indexOf("base64,"); - return -1 != t - ? ((t += "base64,".length), atob(e.substr(t))) - : e.substr(e.indexOf(",") + 1); - } - base64ToUint8Array(e) { - for ( - var t = window.atob(e), - a = t.length, - i = new Uint8Array(a), - n = 0; - n < a; - n++ - ) - i[n] = t.charCodeAt(n); - return i; - } - dataUriToUint8Array(e) { - if (!e.startsWith("data:")) throw new Error("Not a data URI."); - let t = e.indexOf("base64,"); - if (-1 == t) throw new Error("Not a binary data URI."); - return ( - (t += "base64,".length), - this.base64ToUint8Array(e.substr(t)) - ); - } - downloadText(e, t, a) { - if (this.start(e, t, a)) return; - if (this.rawDataUris[e]) { - try { - let t = this.rawDataUris[e]; - this.finish(e, 200, this.dataUriToString(t)); - } catch (t) { - this.finish(e, 400, JSON.stringify(t)); - } - return; - } - let i = new XMLHttpRequest(); - (i.overrideMimeType("text/html"), i.open("GET", e, true)); - let n = () => { - this.finish(e, i.status, i.responseText); - }; - ((i.onload = n), (i.onerror = n), i.send()); - } - downloadJson(e, t, a) { - this.downloadText( - e, - (e) => { - t(JSON.parse(e)); - }, - a, - ); - } - downloadBinary(e, t, a) { - if (this.start(e, t, a)) return; - if (this.rawDataUris[e]) { - try { - let t = this.rawDataUris[e]; - this.finish(e, 200, this.dataUriToUint8Array(t)); - } catch (t) { - this.finish(e, 400, JSON.stringify(t)); - } - return; + let t = e.a, + a = e.b, + i = e.c, + n = e.d, + s = 1 / (t * n - a * i), + o = this.worldX - e.worldX, + r = this.worldY - e.worldY; + ((this.ax = o * n * s - r * a * s), + (this.ay = r * t * s - o * i * s)); + let l = s * n, + c = s * t, + d = s * a, + u = s * i, + h = l * this.a - d * this.c, + p = l * this.b - d * this.d, + g = c * this.c - u * this.a, + m = c * this.d - u * this.b; + if ( + ((this.ashearX = 0), + (this.ascaleX = Math.sqrt(h * h + g * g)), + this.ascaleX > 1e-4) + ) { + let e = h * m - p * g; + ((this.ascaleY = e / this.ascaleX), + (this.ashearY = Math.atan2(h * p + g * m, e) * ii.radDeg), + (this.arotation = Math.atan2(g, h) * ii.radDeg)); + } else + ((this.ascaleX = 0), + (this.ascaleY = Math.sqrt(p * p + m * m)), + (this.ashearY = 0), + (this.arotation = 90 - Math.atan2(m, p) * ii.radDeg)); + } + worldToLocal(e) { + let t = 1 / (this.a * this.d - this.b * this.c), + a = e.x - this.worldX, + i = e.y - this.worldY; + return ( + (e.x = a * this.d * t - i * this.b * t), + (e.y = i * this.a * t - a * this.c * t), + e + ); + } + localToWorld(e) { + let t = e.x, + a = e.y; + return ( + (e.x = t * this.a + a * this.b + this.worldX), + (e.y = t * this.c + a * this.d + this.worldY), + e + ); + } + worldToLocalRotation(e) { + let t = ii.sinDeg(e), + a = ii.cosDeg(e); + return ( + Math.atan2(this.a * t - this.c * a, this.d * a - this.b * t) * + ii.radDeg + + this.rotation - + this.shearX + ); + } + localToWorldRotation(e) { + e -= this.rotation - this.shearX; + let t = ii.sinDeg(e), + a = ii.cosDeg(e); + return ( + Math.atan2(a * this.c + t * this.d, a * this.a + t * this.b) * + ii.radDeg + ); + } + rotateWorld(e) { + let t = this.a, + a = this.b, + i = this.c, + n = this.d, + s = ii.cosDeg(e), + o = ii.sinDeg(e); + ((this.a = s * t - o * i), + (this.b = s * a - o * n), + (this.c = o * t + s * i), + (this.d = o * a + s * n)); + } + } + class Cn { + constructor() { + ((this.callbacks = {}), (this.rawDataUris = {})); + } + dataUriToString(e) { + if (!e.startsWith("data:")) throw new Error("Not a data URI."); + let t = e.indexOf("base64,"); + return -1 != t + ? ((t += "base64,".length), atob(e.substr(t))) + : e.substr(e.indexOf(",") + 1); + } + base64ToUint8Array(e) { + for ( + var t = window.atob(e), + a = t.length, + i = new Uint8Array(a), + n = 0; + n < a; + n++ + ) + i[n] = t.charCodeAt(n); + return i; + } + dataUriToUint8Array(e) { + if (!e.startsWith("data:")) throw new Error("Not a data URI."); + let t = e.indexOf("base64,"); + if (-1 == t) throw new Error("Not a binary data URI."); + return ( + (t += "base64,".length), + this.base64ToUint8Array(e.substr(t)) + ); + } + downloadText(e, t, a) { + if (this.start(e, t, a)) return; + if (this.rawDataUris[e]) { + try { + let t = this.rawDataUris[e]; + this.finish(e, 200, this.dataUriToString(t)); + } catch (t) { + this.finish(e, 400, JSON.stringify(t)); } - let i = new XMLHttpRequest(); - (i.open("GET", e, true), (i.responseType = "arraybuffer")); - let n = () => { - this.finish(e, i.status, i.response); - }; - ((i.onload = () => { - 200 == i.status || 0 == i.status - ? this.finish(e, 200, new Uint8Array(i.response)) - : n(); - }), - (i.onerror = n), - i.send()); + return; } - start(e, t, a) { - let i = this.callbacks[e]; + let i = new XMLHttpRequest(); + (i.overrideMimeType("text/html"), i.open("GET", e, true)); + let n = () => { + this.finish(e, i.status, i.responseText); + }; + ((i.onload = n), (i.onerror = n), i.send()); + } + downloadJson(e, t, a) { + this.downloadText( + e, + (e) => { + t(JSON.parse(e)); + }, + a, + ); + } + downloadBinary(e, t, a) { + if (this.start(e, t, a)) return; + if (this.rawDataUris[e]) { try { - if (i) return true; - this.callbacks[e] = i = []; - } finally { - i.push(t, a); + let t = this.rawDataUris[e]; + this.finish(e, 200, this.dataUriToUint8Array(t)); + } catch (t) { + this.finish(e, 400, JSON.stringify(t)); } + return; } - finish(e, t, a) { - let i = this.callbacks[e]; - delete this.callbacks[e]; - let n = 200 == t || 0 == t ? [a] : [t, a]; - for (let e = n.length - 1, t = i.length; e < t; e += 2) - i[e].apply(null, n); + let i = new XMLHttpRequest(); + (i.open("GET", e, true), (i.responseType = "arraybuffer")); + let n = () => { + this.finish(e, i.status, i.response); + }; + ((i.onload = () => { + 200 == i.status || 0 == i.status + ? this.finish(e, 200, new Uint8Array(i.response)) + : n(); + }), + (i.onerror = n), + i.send()); + } + start(e, t, a) { + let i = this.callbacks[e]; + try { + if (i) return true; + this.callbacks[e] = i = []; + } finally { + i.push(t, a); } } - class wn { - constructor(e, t) { - if ( - ((this.bendDirection = 0), + finish(e, t, a) { + let i = this.callbacks[e]; + delete this.callbacks[e]; + let n = 200 == t || 0 == t ? [a] : [t, a]; + for (let e = n.length - 1, t = i.length; e < t; e += 2) + i[e].apply(null, n); + } + } + class wn { + constructor(e, t) { + if ( + ((this.bendDirection = 0), (this.compress = false), (this.stretch = false), (this.mix = 1), (this.softness = 0), (this.active = false), !e) - ) - throw new Error("data cannot be null."); - if (!t) throw new Error("skeleton cannot be null."); - ((this.data = e), - (this.mix = e.mix), - (this.softness = e.softness), - (this.bendDirection = e.bendDirection), - (this.compress = e.compress), - (this.stretch = e.stretch), - (this.bones = new Array())); - for (let a = 0; a < e.bones.length; a++) - this.bones.push(t.findBone(e.bones[a].name)); - this.target = t.findBone(e.target.name); - } - isActive() { - return this.active; - } - update() { - if (0 == this.mix) return; - let e = this.target, - t = this.bones; - switch (t.length) { - case 1: - this.apply1( - t[0], - e.worldX, - e.worldY, - this.compress, - this.stretch, - this.data.uniform, - this.mix, - ); - break; - case 2: - this.apply2( - t[0], - t[1], - e.worldX, - e.worldY, - this.bendDirection, - this.stretch, - this.data.uniform, - this.softness, - this.mix, - ); - } + ) + throw new Error("data cannot be null."); + if (!t) throw new Error("skeleton cannot be null."); + ((this.data = e), + (this.mix = e.mix), + (this.softness = e.softness), + (this.bendDirection = e.bendDirection), + (this.compress = e.compress), + (this.stretch = e.stretch), + (this.bones = new Array())); + for (let a = 0; a < e.bones.length; a++) + this.bones.push(t.findBone(e.bones[a].name)); + this.target = t.findBone(e.target.name); + } + isActive() { + return this.active; + } + update() { + if (0 == this.mix) return; + let e = this.target, + t = this.bones; + switch (t.length) { + case 1: + this.apply1( + t[0], + e.worldX, + e.worldY, + this.compress, + this.stretch, + this.data.uniform, + this.mix, + ); + break; + case 2: + this.apply2( + t[0], + t[1], + e.worldX, + e.worldY, + this.bendDirection, + this.stretch, + this.data.uniform, + this.softness, + this.mix, + ); } - apply1(e, t, a, i, n, s, o) { - let r = e.parent, - l = r.a, - c = r.b, - d = r.c, - u = r.d, - h = -e.ashearX - e.arotation, - p = 0, - g = 0; + } + apply1(e, t, a, i, n, s, o) { + let r = e.parent, + l = r.a, + c = r.b, + d = r.c, + u = r.d, + h = -e.ashearX - e.arotation, + p = 0, + g = 0; + switch (e.data.transformMode) { + case ln.OnlyTranslation: + ((p = t - e.worldX), (g = a - e.worldY)); + break; + case ln.NoRotationOrReflection: + let i = Math.abs(l * u - c * d) / (l * l + d * d), + n = l / e.skeleton.scaleX, + s = d / e.skeleton.scaleY; + ((c = -s * i * e.skeleton.scaleX), + (u = n * i * e.skeleton.scaleY), + (h += Math.atan2(s, n) * ii.radDeg)); + default: + let o = t - r.worldX, + m = a - r.worldY, + f = l * u - c * d; + ((p = (o * u - m * c) / f - e.ax), + (g = (m * l - o * d) / f - e.ay)); + } + ((h += Math.atan2(g, p) * ii.radDeg), + e.ascaleX < 0 && (h += 180), + h > 180 ? (h -= 360) : h < -180 && (h += 360)); + let m = e.ascaleX, + f = e.ascaleY; + if (i || n) { switch (e.data.transformMode) { - case ln.OnlyTranslation: + case ln.NoScale: + case ln.NoScaleOrReflection: ((p = t - e.worldX), (g = a - e.worldY)); - break; - case ln.NoRotationOrReflection: - let i = Math.abs(l * u - c * d) / (l * l + d * d), - n = l / e.skeleton.scaleX, - s = d / e.skeleton.scaleY; - ((c = -s * i * e.skeleton.scaleX), - (u = n * i * e.skeleton.scaleY), - (h += Math.atan2(s, n) * ii.radDeg)); - default: - let o = t - r.worldX, - m = a - r.worldY, - f = l * u - c * d; - ((p = (o * u - m * c) / f - e.ax), - (g = (m * l - o * d) / f - e.ay)); } - ((h += Math.atan2(g, p) * ii.radDeg), - e.ascaleX < 0 && (h += 180), - h > 180 ? (h -= 360) : h < -180 && (h += 360)); - let m = e.ascaleX, - f = e.ascaleY; - if (i || n) { - switch (e.data.transformMode) { - case ln.NoScale: - case ln.NoScaleOrReflection: - ((p = t - e.worldX), (g = a - e.worldY)); - } - let r = e.data.length * m, - l = Math.sqrt(p * p + g * g); - if ((i && l < r) || (n && l > r && r > 1e-4)) { - let e = (l / r - 1) * o + 1; - ((m *= e), s && (f *= e)); - } + let r = e.data.length * m, + l = Math.sqrt(p * p + g * g); + if ((i && l < r) || (n && l > r && r > 1e-4)) { + let e = (l / r - 1) * o + 1; + ((m *= e), s && (f *= e)); } - e.updateWorldTransformWith( - e.ax, - e.ay, - e.arotation + h * o, - m, - f, - e.ashearX, - e.ashearY, - ); } - apply2(e, t, a, i, n, s, o, r, l) { - let c = e.ax, - d = e.ay, - u = e.ascaleX, - h = e.ascaleY, - p = u, - g = h, - m = t.ascaleX, - f = 0, - y = 0, - E = 0; - (u < 0 ? ((u = -u), (f = 180), (E = -1)) : ((f = 0), (E = 1)), - h < 0 && ((h = -h), (E = -E)), - m < 0 ? ((m = -m), (y = 180)) : (y = 0)); - let b = t.ax, - S = 0, - I = 0, - _ = 0, - v = e.a, - T = e.b, - R = e.c, - O = e.d, - C = Math.abs(u - h) <= 1e-4; - !C || s - ? ((S = 0), (I = v * b + e.worldX), (_ = R * b + e.worldY)) - : ((S = t.ay), - (I = v * b + T * S + e.worldX), - (_ = R * b + O * S + e.worldY)); - let w = e.parent; - ((v = w.a), (T = w.b), (R = w.c), (O = w.d)); - let A, - k, - N = 1 / (v * O - T * R), - x = I - w.worldX, - P = _ - w.worldY, - M = (x * O - P * T) * N - c, - L = (P * v - x * R) * N - d, - D = Math.sqrt(M * M + L * L), - B = t.data.length * m; - if (D < 1e-4) - return ( - this.apply1(e, a, i, false, s, false, l), - void t.updateWorldTransformWith( - b, - S, - 0, - t.ascaleX, - t.ascaleY, - t.ashearX, - t.ashearY, - ) - ); - ((x = a - w.worldX), (P = i - w.worldY)); - let F = (x * O - P * T) * N - c, - Y = (P * v - x * R) * N - d, - U = F * F + Y * Y; - if (0 != r) { - r *= u * (m + 1) * 0.5; - let e = Math.sqrt(U), - t = e - D - B * u + r; - if (t > 0) { - let a = Math.min(1, t / (2 * r)) - 1; - ((a = (t - r * (1 - a * a)) / e), - (F -= a * F), - (Y -= a * Y), - (U = F * F + Y * Y)); - } - } - e: if (C) { - B *= u; - let e = (U - D * D - B * B) / (2 * D * B); - (e < -1 - ? ((e = -1), (k = Math.PI * n)) - : e > 1 - ? ((e = 1), - (k = 0), - s && - ((v = (Math.sqrt(U) / (D + B) - 1) * l + 1), - (p *= v), - o && (g *= v))) - : (k = Math.acos(e) * n), - (v = D + B * e), - (T = B * Math.sin(k)), - (A = Math.atan2(Y * v - F * T, F * v + Y * T))); - } else { - ((v = u * B), (T = h * B)); - let e = v * v, - t = T * T, - a = Math.atan2(Y, F); - R = t * D * D + e * U - e * t; - let i = -2 * t * D, - s = t - e; - if (((O = i * i - 4 * s * R), O >= 0)) { - let e = Math.sqrt(O); - (i < 0 && (e = -e), (e = 0.5 * -(i + e))); - let t = e / s, - o = R / e, - r = Math.abs(t) < Math.abs(o) ? t : o; - if (r * r <= U) { - ((P = Math.sqrt(U - r * r) * n), - (A = a - Math.atan2(P, r)), - (k = Math.atan2(P / h, (r - D) / u))); - break e; - } - } - let o = ii.PI, - r = D - v, - l = r * r, - c = 0, - d = 0, - p = D + v, - g = p * p, - m = 0; - ((R = (-v * D) / (e - t)), - R >= -1 && - R <= 1 && - ((R = Math.acos(R)), - (x = v * Math.cos(R) + D), - (P = T * Math.sin(R)), - (O = x * x + P * P), - O < l && ((o = R), (l = O), (r = x), (c = P)), - O > g && ((d = R), (g = O), (p = x), (m = P))), - U <= 0.5 * (l + g) - ? ((A = a - Math.atan2(c * n, r)), (k = o * n)) - : ((A = a - Math.atan2(m * n, p)), (k = d * n))); - } - let j = Math.atan2(S, b) * E, - G = e.arotation; - ((A = (A - j) * ii.radDeg + f - G), - A > 180 ? (A -= 360) : A < -180 && (A += 360), - e.updateWorldTransformWith(c, d, G + A * l, p, g, 0, 0), - (G = t.arotation), - (k = ((k + j) * ii.radDeg - t.ashearX) * E + y - G), - k > 180 ? (k -= 360) : k < -180 && (k += 360), - t.updateWorldTransformWith( + e.updateWorldTransformWith( + e.ax, + e.ay, + e.arotation + h * o, + m, + f, + e.ashearX, + e.ashearY, + ); + } + apply2(e, t, a, i, n, s, o, r, l) { + let c = e.ax, + d = e.ay, + u = e.ascaleX, + h = e.ascaleY, + p = u, + g = h, + m = t.ascaleX, + f = 0, + y = 0, + E = 0; + (u < 0 ? ((u = -u), (f = 180), (E = -1)) : ((f = 0), (E = 1)), + h < 0 && ((h = -h), (E = -E)), + m < 0 ? ((m = -m), (y = 180)) : (y = 0)); + let b = t.ax, + S = 0, + I = 0, + _ = 0, + v = e.a, + T = e.b, + R = e.c, + O = e.d, + C = Math.abs(u - h) <= 1e-4; + !C || s + ? ((S = 0), (I = v * b + e.worldX), (_ = R * b + e.worldY)) + : ((S = t.ay), + (I = v * b + T * S + e.worldX), + (_ = R * b + O * S + e.worldY)); + let w = e.parent; + ((v = w.a), (T = w.b), (R = w.c), (O = w.d)); + let A, + k, + N = 1 / (v * O - T * R), + x = I - w.worldX, + P = _ - w.worldY, + M = (x * O - P * T) * N - c, + L = (P * v - x * R) * N - d, + D = Math.sqrt(M * M + L * L), + B = t.data.length * m; + if (D < 1e-4) + return ( + this.apply1(e, a, i, false, s, false, l), + void t.updateWorldTransformWith( b, S, - G + k * l, + 0, t.ascaleX, t.ascaleY, t.ashearX, t.ashearY, - )); + ) + ); + ((x = a - w.worldX), (P = i - w.worldY)); + let F = (x * O - P * T) * N - c, + Y = (P * v - x * R) * N - d, + U = F * F + Y * Y; + if (0 != r) { + r *= u * (m + 1) * 0.5; + let e = Math.sqrt(U), + t = e - D - B * u + r; + if (t > 0) { + let a = Math.min(1, t / (2 * r)) - 1; + ((a = (t - r * (1 - a * a)) / e), + (F -= a * F), + (Y -= a * Y), + (U = F * F + Y * Y)); + } } + e: if (C) { + B *= u; + let e = (U - D * D - B * B) / (2 * D * B); + (e < -1 + ? ((e = -1), (k = Math.PI * n)) + : e > 1 + ? ((e = 1), + (k = 0), + s && + ((v = (Math.sqrt(U) / (D + B) - 1) * l + 1), + (p *= v), + o && (g *= v))) + : (k = Math.acos(e) * n), + (v = D + B * e), + (T = B * Math.sin(k)), + (A = Math.atan2(Y * v - F * T, F * v + Y * T))); + } else { + ((v = u * B), (T = h * B)); + let e = v * v, + t = T * T, + a = Math.atan2(Y, F); + R = t * D * D + e * U - e * t; + let i = -2 * t * D, + s = t - e; + if (((O = i * i - 4 * s * R), O >= 0)) { + let e = Math.sqrt(O); + (i < 0 && (e = -e), (e = 0.5 * -(i + e))); + let t = e / s, + o = R / e, + r = Math.abs(t) < Math.abs(o) ? t : o; + if (r * r <= U) { + ((P = Math.sqrt(U - r * r) * n), + (A = a - Math.atan2(P, r)), + (k = Math.atan2(P / h, (r - D) / u))); + break e; + } + } + let o = ii.PI, + r = D - v, + l = r * r, + c = 0, + d = 0, + p = D + v, + g = p * p, + m = 0; + ((R = (-v * D) / (e - t)), + R >= -1 && + R <= 1 && + ((R = Math.acos(R)), + (x = v * Math.cos(R) + D), + (P = T * Math.sin(R)), + (O = x * x + P * P), + O < l && ((o = R), (l = O), (r = x), (c = P)), + O > g && ((d = R), (g = O), (p = x), (m = P))), + U <= 0.5 * (l + g) + ? ((A = a - Math.atan2(c * n, r)), (k = o * n)) + : ((A = a - Math.atan2(m * n, p)), (k = d * n))); + } + let j = Math.atan2(S, b) * E, + G = e.arotation; + ((A = (A - j) * ii.radDeg + f - G), + A > 180 ? (A -= 360) : A < -180 && (A += 360), + e.updateWorldTransformWith(c, d, G + A * l, p, g, 0, 0), + (G = t.arotation), + (k = ((k + j) * ii.radDeg - t.ashearX) * E + y - G), + k > 180 ? (k -= 360) : k < -180 && (k += 360), + t.updateWorldTransformWith( + b, + S, + G + k * l, + t.ascaleX, + t.ascaleY, + t.ashearX, + t.ashearY, + )); } - class An { - constructor(e, t, a) { - ((this.name = e), (this.order = t), (this.skinRequired = a)); - } + } + class An { + constructor(e, t, a) { + ((this.name = e), (this.order = t), (this.skinRequired = a)); } - class kn extends An { - constructor(e) { - (super(e, 0, false), - (this.bones = new Array()), - (this.mixRotate = 0), - (this.mixX = 0), - (this.mixY = 0)); - } + } + class kn extends An { + constructor(e) { + (super(e, 0, false), + (this.bones = new Array()), + (this.mixRotate = 0), + (this.mixX = 0), + (this.mixY = 0)); } - (((mn = cn || (cn = {}))[(mn.Fixed = 0)] = "Fixed"), - (mn[(mn.Percent = 1)] = "Percent"), - ((gn = dn || (dn = {}))[(gn.Length = 0)] = "Length"), - (gn[(gn.Fixed = 1)] = "Fixed"), - (gn[(gn.Percent = 2)] = "Percent"), - (gn[(gn.Proportional = 3)] = "Proportional"), - (function (e) { - ((e[(e.Tangent = 0)] = "Tangent"), - (e[(e.Chain = 1)] = "Chain"), - (e[(e.ChainScale = 2)] = "ChainScale")); - })(un || (un = {}))); - class Nn { - constructor(e, t) { - if ( - ((this.position = 0), + } + (((mn = cn || (cn = {}))[(mn.Fixed = 0)] = "Fixed"), + (mn[(mn.Percent = 1)] = "Percent"), + ((gn = dn || (dn = {}))[(gn.Length = 0)] = "Length"), + (gn[(gn.Fixed = 1)] = "Fixed"), + (gn[(gn.Percent = 2)] = "Percent"), + (gn[(gn.Proportional = 3)] = "Proportional"), + (function (e) { + ((e[(e.Tangent = 0)] = "Tangent"), + (e[(e.Chain = 1)] = "Chain"), + (e[(e.ChainScale = 2)] = "ChainScale")); + })(un || (un = {}))); + class Nn { + constructor(e, t) { + if ( + ((this.position = 0), (this.spacing = 0), (this.mixRotate = 0), (this.mixX = 0), @@ -25522,499 +25495,499 @@ var version = "v1.17.2"; (this.segments = new Array()), (this.active = false), !e) - ) - throw new Error("data cannot be null."); - if (!t) throw new Error("skeleton cannot be null."); - ((this.data = e), (this.bones = new Array())); - for (let a = 0, i = e.bones.length; a < i; a++) - this.bones.push(t.findBone(e.bones[a].name)); - ((this.target = t.findSlot(e.target.name)), - (this.position = e.position), - (this.spacing = e.spacing), - (this.mixRotate = e.mixRotate), - (this.mixX = e.mixX), - (this.mixY = e.mixY)); - } - isActive() { - return this.active; - } - update() { - let e = this.target.getAttachment(); - if (!(e instanceof In)) return; - let t = this.mixRotate, - a = this.mixX, - i = this.mixY; - if (0 == t && 0 == a && 0 == i) return; - let n = this.data, - s = n.rotateMode == un.Tangent, - o = n.rotateMode == un.ChainScale, - r = this.bones, - l = r.length, - c = s ? l : l + 1, - d = ni.setArraySize(this.spaces, c), - u = o ? (this.lengths = ni.setArraySize(this.lengths, l)) : null, - h = this.spacing; - switch (n.spacingMode) { - case dn.Percent: - if (o) - for (let e = 0, t = c - 1; e < t; e++) { - let t = r[e], - a = t.data.length; - if (a < Nn.epsilon) u[e] = 0; - else { - let i = a * t.a, - n = a * t.c; - u[e] = Math.sqrt(i * i + n * n); - } - } - ni.arrayFill(d, 1, c, h); - break; - case dn.Proportional: - let e = 0; - for (let t = 0, a = c - 1; t < a; ) { - let a = r[t], - i = a.data.length; - if (i < Nn.epsilon) (o && (u[t] = 0), (d[++t] = h)); - else { - let n = i * a.a, - s = i * a.c, - r = Math.sqrt(n * n + s * s); - (o && (u[t] = r), (d[++t] = r), (e += r)); - } - } - if (e > 0) { - e = (c / e) * h; - for (let t = 1; t < c; t++) d[t] *= e; - } - break; - default: - let t = n.spacingMode == dn.Length; - for (let e = 0, a = c - 1; e < a; ) { - let a = r[e], - i = a.data.length; - if (i < Nn.epsilon) (o && (u[e] = 0), (d[++e] = h)); + ) + throw new Error("data cannot be null."); + if (!t) throw new Error("skeleton cannot be null."); + ((this.data = e), (this.bones = new Array())); + for (let a = 0, i = e.bones.length; a < i; a++) + this.bones.push(t.findBone(e.bones[a].name)); + ((this.target = t.findSlot(e.target.name)), + (this.position = e.position), + (this.spacing = e.spacing), + (this.mixRotate = e.mixRotate), + (this.mixX = e.mixX), + (this.mixY = e.mixY)); + } + isActive() { + return this.active; + } + update() { + let e = this.target.getAttachment(); + if (!(e instanceof In)) return; + let t = this.mixRotate, + a = this.mixX, + i = this.mixY; + if (0 == t && 0 == a && 0 == i) return; + let n = this.data, + s = n.rotateMode == un.Tangent, + o = n.rotateMode == un.ChainScale, + r = this.bones, + l = r.length, + c = s ? l : l + 1, + d = ni.setArraySize(this.spaces, c), + u = o ? (this.lengths = ni.setArraySize(this.lengths, l)) : null, + h = this.spacing; + switch (n.spacingMode) { + case dn.Percent: + if (o) + for (let e = 0, t = c - 1; e < t; e++) { + let t = r[e], + a = t.data.length; + if (a < Nn.epsilon) u[e] = 0; else { - let n = i * a.a, - s = i * a.c, - r = Math.sqrt(n * n + s * s); - (o && (u[e] = r), (d[++e] = ((t ? i + h : h) * r) / i)); + let i = a * t.a, + n = a * t.c; + u[e] = Math.sqrt(i * i + n * n); } } - } - let p = this.computeWorldPositions(e, c, s), - g = p[0], - m = p[1], - f = n.offsetRotation, - y = false; - if (0 == f) y = n.rotateMode == un.Chain; - else { - y = false; - let e = this.target.bone; - f *= e.a * e.d - e.b * e.c > 0 ? ii.degRad : -ii.degRad; - } - for (let e = 0, n = 3; e < l; e++, n += 3) { - let l = r[e]; - ((l.worldX += (g - l.worldX) * a), - (l.worldY += (m - l.worldY) * i)); - let c = p[n], - h = p[n + 1], - E = c - g, - b = h - m; - if (o) { - let a = u[e]; - if (0 != a) { - let e = (Math.sqrt(E * E + b * b) / a - 1) * t + 1; - ((l.a *= e), (l.c *= e)); + ni.arrayFill(d, 1, c, h); + break; + case dn.Proportional: + let e = 0; + for (let t = 0, a = c - 1; t < a;) { + let a = r[t], + i = a.data.length; + if (i < Nn.epsilon) (o && (u[t] = 0), (d[++t] = h)); + else { + let n = i * a.a, + s = i * a.c, + r = Math.sqrt(n * n + s * s); + (o && (u[t] = r), (d[++t] = r), (e += r)); } } - if (((g = c), (m = h), t > 0)) { - let a = l.a, - i = l.b, - o = l.c, - r = l.d, - c = 0, - u = 0, - h = 0; - if ( - ((c = s - ? p[n - 1] - : 0 == d[e + 1] - ? p[n + 2] - : Math.atan2(b, E)), - (c -= Math.atan2(o, a)), - y) - ) { - ((u = Math.cos(c)), (h = Math.sin(c))); - let e = l.data.length; - ((g += (e * (u * a - h * o) - E) * t), - (m += (e * (h * a + u * o) - b) * t)); - } else c += f; - (c > ii.PI ? (c -= ii.PI2) : c < -ii.PI && (c += ii.PI2), - (c *= t), - (u = Math.cos(c)), - (h = Math.sin(c)), - (l.a = u * a - h * o), - (l.b = u * i - h * r), - (l.c = h * a + u * o), - (l.d = h * i + u * r)); - } - l.updateAppliedTransform(); - } - } - computeWorldPositions(e, t, a) { - let i = this.target, - n = this.position, - s = this.spaces, - o = ni.setArraySize(this.positions, 3 * t + 2), - r = null, - l = e.closed, - c = e.worldVerticesLength, - d = c / 6, - u = Nn.NONE; - if (!e.constantSpeed) { - let h = e.lengths; - d -= l ? 1 : 2; - let p, - g = h[d]; - switch ( - (this.data.positionMode == cn.Percent && (n *= g), - this.data.spacingMode) - ) { - case dn.Percent: - p = g; - break; - case dn.Proportional: - p = g / t; - break; - default: - p = 1; + if (e > 0) { + e = (c / e) * h; + for (let t = 1; t < c; t++) d[t] *= e; } - r = ni.setArraySize(this.world, 8); - for (let m = 0, f = 0, y = 0; m < t; m++, f += 3) { - let t = s[m] * p; - n += t; - let E = n; - if (l) ((E %= g), E < 0 && (E += g), (y = 0)); + break; + default: + let t = n.spacingMode == dn.Length; + for (let e = 0, a = c - 1; e < a;) { + let a = r[e], + i = a.data.length; + if (i < Nn.epsilon) (o && (u[e] = 0), (d[++e] = h)); else { - if (E < 0) { - (u != Nn.BEFORE && - ((u = Nn.BEFORE), - e.computeWorldVertices(i, 2, 4, r, 0, 2)), - this.addBeforePosition(E, r, 0, o, f)); - continue; - } - if (E > g) { - (u != Nn.AFTER && - ((u = Nn.AFTER), - e.computeWorldVertices(i, c - 6, 4, r, 0, 2)), - this.addAfterPosition(E - g, r, 0, o, f)); - continue; - } - } - for (; ; y++) { - let e = h[y]; - if (!(E > e)) { - if (0 == y) E /= e; - else { - let t = h[y - 1]; - E = (E - t) / (e - t); - } - break; - } + let n = i * a.a, + s = i * a.c, + r = Math.sqrt(n * n + s * s); + (o && (u[e] = r), (d[++e] = ((t ? i + h : h) * r) / i)); } - (y != u && - ((u = y), - l && y == d - ? (e.computeWorldVertices(i, c - 4, 4, r, 0, 2), - e.computeWorldVertices(i, 0, 4, r, 4, 2)) - : e.computeWorldVertices(i, 6 * y + 2, 8, r, 0, 2)), - this.addCurvePosition( - E, - r[0], - r[1], - r[2], - r[3], - r[4], - r[5], - r[6], - r[7], - o, - f, - a || (m > 0 && 0 == t), - )); } - return o; + } + let p = this.computeWorldPositions(e, c, s), + g = p[0], + m = p[1], + f = n.offsetRotation, + y = false; + if (0 == f) y = n.rotateMode == un.Chain; + else { + y = false; + let e = this.target.bone; + f *= e.a * e.d - e.b * e.c > 0 ? ii.degRad : -ii.degRad; + } + for (let e = 0, n = 3; e < l; e++, n += 3) { + let l = r[e]; + ((l.worldX += (g - l.worldX) * a), + (l.worldY += (m - l.worldY) * i)); + let c = p[n], + h = p[n + 1], + E = c - g, + b = h - m; + if (o) { + let a = u[e]; + if (0 != a) { + let e = (Math.sqrt(E * E + b * b) / a - 1) * t + 1; + ((l.a *= e), (l.c *= e)); + } } - l - ? ((c += 2), - (r = ni.setArraySize(this.world, c)), - e.computeWorldVertices(i, 2, c - 4, r, 0, 2), - e.computeWorldVertices(i, 0, 2, r, c - 4, 2), - (r[c - 2] = r[0]), - (r[c - 1] = r[1])) - : (d--, - (c -= 4), - (r = ni.setArraySize(this.world, c)), - e.computeWorldVertices(i, 2, c, r, 0, 2)); - let h, - p = ni.setArraySize(this.curves, d), - g = 0, - m = r[0], - f = r[1], - y = 0, - E = 0, - b = 0, - S = 0, - I = 0, - _ = 0, - v = 0, - T = 0, - R = 0, - O = 0, - C = 0, - w = 0, - A = 0, - k = 0; - for (let e = 0, t = 2; e < d; e++, t += 6) - ((y = r[t]), - (E = r[t + 1]), - (b = r[t + 2]), - (S = r[t + 3]), - (I = r[t + 4]), - (_ = r[t + 5]), - (v = 0.1875 * (m - 2 * y + b)), - (T = 0.1875 * (f - 2 * E + S)), - (R = 0.09375 * (3 * (y - b) - m + I)), - (O = 0.09375 * (3 * (E - S) - f + _)), - (C = 2 * v + R), - (w = 2 * T + O), - (A = 0.75 * (y - m) + v + 0.16666667 * R), - (k = 0.75 * (E - f) + T + 0.16666667 * O), - (g += Math.sqrt(A * A + k * k)), - (A += C), - (k += w), - (C += R), - (w += O), - (g += Math.sqrt(A * A + k * k)), - (A += C), - (k += w), - (g += Math.sqrt(A * A + k * k)), - (A += C + R), - (k += w + O), - (g += Math.sqrt(A * A + k * k)), - (p[e] = g), - (m = I), - (f = _)); + if (((g = c), (m = h), t > 0)) { + let a = l.a, + i = l.b, + o = l.c, + r = l.d, + c = 0, + u = 0, + h = 0; + if ( + ((c = s + ? p[n - 1] + : 0 == d[e + 1] + ? p[n + 2] + : Math.atan2(b, E)), + (c -= Math.atan2(o, a)), + y) + ) { + ((u = Math.cos(c)), (h = Math.sin(c))); + let e = l.data.length; + ((g += (e * (u * a - h * o) - E) * t), + (m += (e * (h * a + u * o) - b) * t)); + } else c += f; + (c > ii.PI ? (c -= ii.PI2) : c < -ii.PI && (c += ii.PI2), + (c *= t), + (u = Math.cos(c)), + (h = Math.sin(c)), + (l.a = u * a - h * o), + (l.b = u * i - h * r), + (l.c = h * a + u * o), + (l.d = h * i + u * r)); + } + l.updateAppliedTransform(); + } + } + computeWorldPositions(e, t, a) { + let i = this.target, + n = this.position, + s = this.spaces, + o = ni.setArraySize(this.positions, 3 * t + 2), + r = null, + l = e.closed, + c = e.worldVerticesLength, + d = c / 6, + u = Nn.NONE; + if (!e.constantSpeed) { + let h = e.lengths; + d -= l ? 1 : 2; + let p, + g = h[d]; switch ( - (this.data.positionMode == cn.Percent && (n *= g), + (this.data.positionMode == cn.Percent && (n *= g), this.data.spacingMode) ) { case dn.Percent: - h = g; + p = g; break; case dn.Proportional: - h = g / t; + p = g / t; break; default: - h = 1; + p = 1; } - let N = this.segments, - x = 0; - for (let e = 0, i = 0, d = 0, P = 0; e < t; e++, i += 3) { - let t = s[e] * h; + r = ni.setArraySize(this.world, 8); + for (let m = 0, f = 0, y = 0; m < t; m++, f += 3) { + let t = s[m] * p; n += t; - let M = n; - if (l) ((M %= g), M < 0 && (M += g), (d = 0)); + let E = n; + if (l) ((E %= g), E < 0 && (E += g), (y = 0)); else { - if (M < 0) { - this.addBeforePosition(M, r, 0, o, i); + if (E < 0) { + (u != Nn.BEFORE && + ((u = Nn.BEFORE), + e.computeWorldVertices(i, 2, 4, r, 0, 2)), + this.addBeforePosition(E, r, 0, o, f)); continue; } - if (M > g) { - this.addAfterPosition(M - g, r, c - 4, o, i); + if (E > g) { + (u != Nn.AFTER && + ((u = Nn.AFTER), + e.computeWorldVertices(i, c - 6, 4, r, 0, 2)), + this.addAfterPosition(E - g, r, 0, o, f)); continue; } } - for (; ; d++) { - let e = p[d]; - if (!(M > e)) { - if (0 == d) M /= e; + for (; ; y++) { + let e = h[y]; + if (!(E > e)) { + if (0 == y) E /= e; else { - let t = p[d - 1]; - M = (M - t) / (e - t); + let t = h[y - 1]; + E = (E - t) / (e - t); } break; } } - if (d != u) { - u = d; - let e = 6 * d; - for ( - m = r[e], - f = r[e + 1], - y = r[e + 2], - E = r[e + 3], - b = r[e + 4], - S = r[e + 5], - I = r[e + 6], - _ = r[e + 7], - v = 0.03 * (m - 2 * y + b), - T = 0.03 * (f - 2 * E + S), - R = 0.006 * (3 * (y - b) - m + I), - O = 0.006 * (3 * (E - S) - f + _), - C = 2 * v + R, - w = 2 * T + O, - A = 0.3 * (y - m) + v + 0.16666667 * R, - k = 0.3 * (E - f) + T + 0.16666667 * O, - x = Math.sqrt(A * A + k * k), - N[0] = x, - e = 1; - e < 8; - e++ - ) - ((A += C), - (k += w), - (C += R), - (w += O), - (x += Math.sqrt(A * A + k * k)), - (N[e] = x)); + (y != u && + ((u = y), + l && y == d + ? (e.computeWorldVertices(i, c - 4, 4, r, 0, 2), + e.computeWorldVertices(i, 0, 4, r, 4, 2)) + : e.computeWorldVertices(i, 6 * y + 2, 8, r, 0, 2)), + this.addCurvePosition( + E, + r[0], + r[1], + r[2], + r[3], + r[4], + r[5], + r[6], + r[7], + o, + f, + a || (m > 0 && 0 == t), + )); + } + return o; + } + l + ? ((c += 2), + (r = ni.setArraySize(this.world, c)), + e.computeWorldVertices(i, 2, c - 4, r, 0, 2), + e.computeWorldVertices(i, 0, 2, r, c - 4, 2), + (r[c - 2] = r[0]), + (r[c - 1] = r[1])) + : (d--, + (c -= 4), + (r = ni.setArraySize(this.world, c)), + e.computeWorldVertices(i, 2, c, r, 0, 2)); + let h, + p = ni.setArraySize(this.curves, d), + g = 0, + m = r[0], + f = r[1], + y = 0, + E = 0, + b = 0, + S = 0, + I = 0, + _ = 0, + v = 0, + T = 0, + R = 0, + O = 0, + C = 0, + w = 0, + A = 0, + k = 0; + for (let e = 0, t = 2; e < d; e++, t += 6) + ((y = r[t]), + (E = r[t + 1]), + (b = r[t + 2]), + (S = r[t + 3]), + (I = r[t + 4]), + (_ = r[t + 5]), + (v = 0.1875 * (m - 2 * y + b)), + (T = 0.1875 * (f - 2 * E + S)), + (R = 0.09375 * (3 * (y - b) - m + I)), + (O = 0.09375 * (3 * (E - S) - f + _)), + (C = 2 * v + R), + (w = 2 * T + O), + (A = 0.75 * (y - m) + v + 0.16666667 * R), + (k = 0.75 * (E - f) + T + 0.16666667 * O), + (g += Math.sqrt(A * A + k * k)), + (A += C), + (k += w), + (C += R), + (w += O), + (g += Math.sqrt(A * A + k * k)), + (A += C), + (k += w), + (g += Math.sqrt(A * A + k * k)), + (A += C + R), + (k += w + O), + (g += Math.sqrt(A * A + k * k)), + (p[e] = g), + (m = I), + (f = _)); + switch ( + (this.data.positionMode == cn.Percent && (n *= g), + this.data.spacingMode) + ) { + case dn.Percent: + h = g; + break; + case dn.Proportional: + h = g / t; + break; + default: + h = 1; + } + let N = this.segments, + x = 0; + for (let e = 0, i = 0, d = 0, P = 0; e < t; e++, i += 3) { + let t = s[e] * h; + n += t; + let M = n; + if (l) ((M %= g), M < 0 && (M += g), (d = 0)); + else { + if (M < 0) { + this.addBeforePosition(M, r, 0, o, i); + continue; + } + if (M > g) { + this.addAfterPosition(M - g, r, c - 4, o, i); + continue; + } + } + for (; ; d++) { + let e = p[d]; + if (!(M > e)) { + if (0 == d) M /= e; + else { + let t = p[d - 1]; + M = (M - t) / (e - t); + } + break; + } + } + if (d != u) { + u = d; + let e = 6 * d; + for ( + m = r[e], + f = r[e + 1], + y = r[e + 2], + E = r[e + 3], + b = r[e + 4], + S = r[e + 5], + I = r[e + 6], + _ = r[e + 7], + v = 0.03 * (m - 2 * y + b), + T = 0.03 * (f - 2 * E + S), + R = 0.006 * (3 * (y - b) - m + I), + O = 0.006 * (3 * (E - S) - f + _), + C = 2 * v + R, + w = 2 * T + O, + A = 0.3 * (y - m) + v + 0.16666667 * R, + k = 0.3 * (E - f) + T + 0.16666667 * O, + x = Math.sqrt(A * A + k * k), + N[0] = x, + e = 1; + e < 8; + e++ + ) ((A += C), (k += w), + (C += R), + (w += O), (x += Math.sqrt(A * A + k * k)), - (N[8] = x), - (A += C + R), - (k += w + O), - (x += Math.sqrt(A * A + k * k)), - (N[9] = x), - (P = 0)); - } - for (M *= x; ; P++) { - let e = N[P]; - if (!(M > e)) { - if (0 == P) M /= e; - else { - let t = N[P - 1]; - M = P + (M - t) / (e - t); - } - break; + (N[e] = x)); + ((A += C), + (k += w), + (x += Math.sqrt(A * A + k * k)), + (N[8] = x), + (A += C + R), + (k += w + O), + (x += Math.sqrt(A * A + k * k)), + (N[9] = x), + (P = 0)); + } + for (M *= x; ; P++) { + let e = N[P]; + if (!(M > e)) { + if (0 == P) M /= e; + else { + let t = N[P - 1]; + M = P + (M - t) / (e - t); } + break; } - this.addCurvePosition( - 0.1 * M, - m, - f, - y, - E, - b, - S, - I, - _, - o, - i, - a || (e > 0 && 0 == t), - ); } - return o; - } - addBeforePosition(e, t, a, i, n) { - let s = t[a], - o = t[a + 1], - r = t[a + 2] - s, - l = t[a + 3] - o, - c = Math.atan2(l, r); - ((i[n] = s + e * Math.cos(c)), - (i[n + 1] = o + e * Math.sin(c)), - (i[n + 2] = c)); - } - addAfterPosition(e, t, a, i, n) { - let s = t[a + 2], - o = t[a + 3], - r = s - t[a], - l = o - t[a + 1], - c = Math.atan2(l, r); - ((i[n] = s + e * Math.cos(c)), - (i[n + 1] = o + e * Math.sin(c)), - (i[n + 2] = c)); - } - addCurvePosition(e, t, a, i, n, s, o, r, l, c, d, u) { - if (0 == e || isNaN(e)) - return ( - (c[d] = t), - (c[d + 1] = a), - void (c[d + 2] = Math.atan2(n - a, i - t)) - ); - let h = e * e, - p = h * e, - g = 1 - e, - m = g * g, - f = m * g, - y = g * e, - E = 3 * y, - b = g * E, - S = E * e, - I = t * f + i * b + s * S + r * p, - _ = a * f + n * b + o * S + l * p; - ((c[d] = I), - (c[d + 1] = _), - u && - (c[d + 2] = - e < 0.001 - ? Math.atan2(n - a, i - t) - : Math.atan2( - _ - (a * m + n * y * 2 + o * h), - I - (t * m + i * y * 2 + s * h), - ))); + this.addCurvePosition( + 0.1 * M, + m, + f, + y, + E, + b, + S, + I, + _, + o, + i, + a || (e > 0 && 0 == t), + ); } + return o; } - ((Nn.NONE = -1), - (Nn.BEFORE = -2), - (Nn.AFTER = -3), - (Nn.epsilon = 1e-5)); - class xn { - constructor(e, t) { - if (((this.deform = new Array()), !e)) - throw new Error("data cannot be null."); - if (!t) throw new Error("bone cannot be null."); - ((this.data = e), - (this.bone = t), - (this.color = new ai()), - (this.darkColor = e.darkColor ? new ai() : null), - this.setToSetupPose()); - } - getSkeleton() { - return this.bone.skeleton; - } - getAttachment() { - return this.attachment; - } - setAttachment(e) { - this.attachment != e && - ((e instanceof li && - this.attachment instanceof li && - e.timelineAttahment == this.attachment.timelineAttahment) || - (this.deform.length = 0), + addBeforePosition(e, t, a, i, n) { + let s = t[a], + o = t[a + 1], + r = t[a + 2] - s, + l = t[a + 3] - o, + c = Math.atan2(l, r); + ((i[n] = s + e * Math.cos(c)), + (i[n + 1] = o + e * Math.sin(c)), + (i[n + 2] = c)); + } + addAfterPosition(e, t, a, i, n) { + let s = t[a + 2], + o = t[a + 3], + r = s - t[a], + l = o - t[a + 1], + c = Math.atan2(l, r); + ((i[n] = s + e * Math.cos(c)), + (i[n + 1] = o + e * Math.sin(c)), + (i[n + 2] = c)); + } + addCurvePosition(e, t, a, i, n, s, o, r, l, c, d, u) { + if (0 == e || isNaN(e)) + return ( + (c[d] = t), + (c[d + 1] = a), + void (c[d + 2] = Math.atan2(n - a, i - t)) + ); + let h = e * e, + p = h * e, + g = 1 - e, + m = g * g, + f = m * g, + y = g * e, + E = 3 * y, + b = g * E, + S = E * e, + I = t * f + i * b + s * S + r * p, + _ = a * f + n * b + o * S + l * p; + ((c[d] = I), + (c[d + 1] = _), + u && + (c[d + 2] = + e < 0.001 + ? Math.atan2(n - a, i - t) + : Math.atan2( + _ - (a * m + n * y * 2 + o * h), + I - (t * m + i * y * 2 + s * h), + ))); + } + } + ((Nn.NONE = -1), + (Nn.BEFORE = -2), + (Nn.AFTER = -3), + (Nn.epsilon = 1e-5)); + class xn { + constructor(e, t) { + if (((this.deform = new Array()), !e)) + throw new Error("data cannot be null."); + if (!t) throw new Error("bone cannot be null."); + ((this.data = e), + (this.bone = t), + (this.color = new ai()), + (this.darkColor = e.darkColor ? new ai() : null), + this.setToSetupPose()); + } + getSkeleton() { + return this.bone.skeleton; + } + getAttachment() { + return this.attachment; + } + setAttachment(e) { + this.attachment != e && + ((e instanceof li && + this.attachment instanceof li && + e.timelineAttahment == this.attachment.timelineAttahment) || + (this.deform.length = 0), (this.attachment = e), (this.sequenceIndex = -1)); - } - setToSetupPose() { - (this.color.setFromColor(this.data.color), - this.darkColor && - this.darkColor.setFromColor(this.data.darkColor), - this.data.attachmentName - ? ((this.attachment = null), - this.setAttachment( - this.bone.skeleton.getAttachment( - this.data.index, - this.data.attachmentName, - ), - )) - : (this.attachment = null)); - } } - class Pn { - constructor(e, t) { - if ( - ((this.mixRotate = 0), + setToSetupPose() { + (this.color.setFromColor(this.data.color), + this.darkColor && + this.darkColor.setFromColor(this.data.darkColor), + this.data.attachmentName + ? ((this.attachment = null), + this.setAttachment( + this.bone.skeleton.getAttachment( + this.data.index, + this.data.attachmentName, + ), + )) + : (this.attachment = null)); + } + } + class Pn { + constructor(e, t) { + if ( + ((this.mixRotate = 0), (this.mixX = 0), (this.mixY = 0), (this.mixScaleX = 0), @@ -26023,1092 +25996,1092 @@ var version = "v1.17.2"; (this.temp = new oi()), (this.active = false), !e) - ) - throw new Error("data cannot be null."); - if (!t) throw new Error("skeleton cannot be null."); - ((this.data = e), - (this.mixRotate = e.mixRotate), - (this.mixX = e.mixX), - (this.mixY = e.mixY), - (this.mixScaleX = e.mixScaleX), - (this.mixScaleY = e.mixScaleY), - (this.mixShearY = e.mixShearY), - (this.bones = new Array())); - for (let a = 0; a < e.bones.length; a++) - this.bones.push(t.findBone(e.bones[a].name)); - this.target = t.findBone(e.target.name); - } - isActive() { - return this.active; - } - update() { - (0 == this.mixRotate && - 0 == this.mixX && - 0 == this.mixY && - 0 == this.mixScaleX && - 0 == this.mixScaleX && - 0 == this.mixShearY) || - (this.data.local - ? this.data.relative - ? this.applyRelativeLocal() - : this.applyAbsoluteLocal() - : this.data.relative - ? this.applyRelativeWorld() - : this.applyAbsoluteWorld()); - } - applyAbsoluteWorld() { - let e = this.mixRotate, - t = this.mixX, - a = this.mixY, - i = this.mixScaleX, - n = this.mixScaleY, - s = this.mixShearY, - o = 0 != t || 0 != a, - r = this.target, - l = r.a, - c = r.b, - d = r.c, - u = r.d, - h = l * u - c * d > 0 ? ii.degRad : -ii.degRad, - p = this.data.offsetRotation * h, - g = this.data.offsetShearY * h, - m = this.bones; - for (let h = 0, f = m.length; h < f; h++) { - let f = m[h]; - if (0 != e) { - let t = f.a, - a = f.b, - i = f.c, - n = f.d, - s = Math.atan2(d, l) - Math.atan2(i, t) + p; - (s > ii.PI ? (s -= ii.PI2) : s < -ii.PI && (s += ii.PI2), - (s *= e)); - let o = Math.cos(s), - r = Math.sin(s); - ((f.a = o * t - r * i), - (f.b = o * a - r * n), - (f.c = r * t + o * i), - (f.d = r * a + o * n)); - } - if (o) { - let e = this.temp; - (r.localToWorld(e.set(this.data.offsetX, this.data.offsetY)), - (f.worldX += (e.x - f.worldX) * t), - (f.worldY += (e.y - f.worldY) * a)); - } - if (0 != i) { - let e = Math.sqrt(f.a * f.a + f.c * f.c); - (0 != e && - (e = - (e + - (Math.sqrt(l * l + d * d) - e + this.data.offsetScaleX) * - i) / - e), - (f.a *= e), - (f.c *= e)); - } - if (0 != n) { - let e = Math.sqrt(f.b * f.b + f.d * f.d); - (0 != e && - (e = - (e + - (Math.sqrt(c * c + u * u) - e + this.data.offsetScaleY) * - n) / - e), - (f.b *= e), - (f.d *= e)); - } - if (s > 0) { - let e = f.b, - t = f.d, - a = Math.atan2(t, e), - i = - Math.atan2(u, c) - - Math.atan2(d, l) - - (a - Math.atan2(f.c, f.a)); - (i > ii.PI ? (i -= ii.PI2) : i < -ii.PI && (i += ii.PI2), - (i = a + (i + g) * s)); - let n = Math.sqrt(e * e + t * t); - ((f.b = Math.cos(i) * n), (f.d = Math.sin(i) * n)); - } - f.updateAppliedTransform(); + ) + throw new Error("data cannot be null."); + if (!t) throw new Error("skeleton cannot be null."); + ((this.data = e), + (this.mixRotate = e.mixRotate), + (this.mixX = e.mixX), + (this.mixY = e.mixY), + (this.mixScaleX = e.mixScaleX), + (this.mixScaleY = e.mixScaleY), + (this.mixShearY = e.mixShearY), + (this.bones = new Array())); + for (let a = 0; a < e.bones.length; a++) + this.bones.push(t.findBone(e.bones[a].name)); + this.target = t.findBone(e.target.name); + } + isActive() { + return this.active; + } + update() { + (0 == this.mixRotate && + 0 == this.mixX && + 0 == this.mixY && + 0 == this.mixScaleX && + 0 == this.mixScaleX && + 0 == this.mixShearY) || + (this.data.local + ? this.data.relative + ? this.applyRelativeLocal() + : this.applyAbsoluteLocal() + : this.data.relative + ? this.applyRelativeWorld() + : this.applyAbsoluteWorld()); + } + applyAbsoluteWorld() { + let e = this.mixRotate, + t = this.mixX, + a = this.mixY, + i = this.mixScaleX, + n = this.mixScaleY, + s = this.mixShearY, + o = 0 != t || 0 != a, + r = this.target, + l = r.a, + c = r.b, + d = r.c, + u = r.d, + h = l * u - c * d > 0 ? ii.degRad : -ii.degRad, + p = this.data.offsetRotation * h, + g = this.data.offsetShearY * h, + m = this.bones; + for (let h = 0, f = m.length; h < f; h++) { + let f = m[h]; + if (0 != e) { + let t = f.a, + a = f.b, + i = f.c, + n = f.d, + s = Math.atan2(d, l) - Math.atan2(i, t) + p; + (s > ii.PI ? (s -= ii.PI2) : s < -ii.PI && (s += ii.PI2), + (s *= e)); + let o = Math.cos(s), + r = Math.sin(s); + ((f.a = o * t - r * i), + (f.b = o * a - r * n), + (f.c = r * t + o * i), + (f.d = r * a + o * n)); } - } - applyRelativeWorld() { - let e = this.mixRotate, - t = this.mixX, - a = this.mixY, - i = this.mixScaleX, - n = this.mixScaleY, - s = this.mixShearY, - o = 0 != t || 0 != a, - r = this.target, - l = r.a, - c = r.b, - d = r.c, - u = r.d, - h = l * u - c * d > 0 ? ii.degRad : -ii.degRad, - p = this.data.offsetRotation * h, - g = this.data.offsetShearY * h, - m = this.bones; - for (let h = 0, f = m.length; h < f; h++) { - let f = m[h]; - if (0 != e) { - let t = f.a, - a = f.b, - i = f.c, - n = f.d, - s = Math.atan2(d, l) + p; - (s > ii.PI ? (s -= ii.PI2) : s < -ii.PI && (s += ii.PI2), - (s *= e)); - let o = Math.cos(s), - r = Math.sin(s); - ((f.a = o * t - r * i), - (f.b = o * a - r * n), - (f.c = r * t + o * i), - (f.d = r * a + o * n)); - } - if (o) { - let e = this.temp; - (r.localToWorld(e.set(this.data.offsetX, this.data.offsetY)), - (f.worldX += e.x * t), - (f.worldY += e.y * a)); - } - if (0 != i) { - let e = - (Math.sqrt(l * l + d * d) - 1 + this.data.offsetScaleX) * i + - 1; - ((f.a *= e), (f.c *= e)); - } - if (0 != n) { - let e = - (Math.sqrt(c * c + u * u) - 1 + this.data.offsetScaleY) * n + - 1; - ((f.b *= e), (f.d *= e)); - } - if (s > 0) { - let e = Math.atan2(u, c) - Math.atan2(d, l); - e > ii.PI ? (e -= ii.PI2) : e < -ii.PI && (e += ii.PI2); - let t = f.b, - a = f.d; - e = Math.atan2(a, t) + (e - ii.PI / 2 + g) * s; - let i = Math.sqrt(t * t + a * a); - ((f.b = Math.cos(e) * i), (f.d = Math.sin(e) * i)); - } - f.updateAppliedTransform(); + if (o) { + let e = this.temp; + (r.localToWorld(e.set(this.data.offsetX, this.data.offsetY)), + (f.worldX += (e.x - f.worldX) * t), + (f.worldY += (e.y - f.worldY) * a)); + } + if (0 != i) { + let e = Math.sqrt(f.a * f.a + f.c * f.c); + (0 != e && + (e = + (e + + (Math.sqrt(l * l + d * d) - e + this.data.offsetScaleX) * + i) / + e), + (f.a *= e), + (f.c *= e)); } + if (0 != n) { + let e = Math.sqrt(f.b * f.b + f.d * f.d); + (0 != e && + (e = + (e + + (Math.sqrt(c * c + u * u) - e + this.data.offsetScaleY) * + n) / + e), + (f.b *= e), + (f.d *= e)); + } + if (s > 0) { + let e = f.b, + t = f.d, + a = Math.atan2(t, e), + i = + Math.atan2(u, c) - + Math.atan2(d, l) - + (a - Math.atan2(f.c, f.a)); + (i > ii.PI ? (i -= ii.PI2) : i < -ii.PI && (i += ii.PI2), + (i = a + (i + g) * s)); + let n = Math.sqrt(e * e + t * t); + ((f.b = Math.cos(i) * n), (f.d = Math.sin(i) * n)); + } + f.updateAppliedTransform(); } - applyAbsoluteLocal() { - let e = this.mixRotate, - t = this.mixX, - a = this.mixY, - i = this.mixScaleX, - n = this.mixScaleY, - s = this.mixShearY, - o = this.target, - r = this.bones; - for (let l = 0, c = r.length; l < c; l++) { - let c = r[l], - d = c.arotation; - if (0 != e) { - let t = o.arotation - d + this.data.offsetRotation; - ((t -= 360 * (16384 - ((16384.499999999996 - t / 360) | 0))), - (d += t * e)); - } - let u = c.ax, - h = c.ay; - ((u += (o.ax - u + this.data.offsetX) * t), - (h += (o.ay - h + this.data.offsetY) * a)); - let p = c.ascaleX, - g = c.ascaleY; - (0 != i && - 0 != p && - (p = (p + (o.ascaleX - p + this.data.offsetScaleX) * i) / p), - 0 != n && - 0 != g && - (g = (g + (o.ascaleY - g + this.data.offsetScaleY) * n) / g)); - let m = c.ashearY; - if (0 != s) { - let e = o.ashearY - m + this.data.offsetShearY; - ((e -= 360 * (16384 - ((16384.499999999996 - e / 360) | 0))), - (m += e * s)); - } - c.updateWorldTransformWith(u, h, d, p, g, c.ashearX, m); + } + applyRelativeWorld() { + let e = this.mixRotate, + t = this.mixX, + a = this.mixY, + i = this.mixScaleX, + n = this.mixScaleY, + s = this.mixShearY, + o = 0 != t || 0 != a, + r = this.target, + l = r.a, + c = r.b, + d = r.c, + u = r.d, + h = l * u - c * d > 0 ? ii.degRad : -ii.degRad, + p = this.data.offsetRotation * h, + g = this.data.offsetShearY * h, + m = this.bones; + for (let h = 0, f = m.length; h < f; h++) { + let f = m[h]; + if (0 != e) { + let t = f.a, + a = f.b, + i = f.c, + n = f.d, + s = Math.atan2(d, l) + p; + (s > ii.PI ? (s -= ii.PI2) : s < -ii.PI && (s += ii.PI2), + (s *= e)); + let o = Math.cos(s), + r = Math.sin(s); + ((f.a = o * t - r * i), + (f.b = o * a - r * n), + (f.c = r * t + o * i), + (f.d = r * a + o * n)); + } + if (o) { + let e = this.temp; + (r.localToWorld(e.set(this.data.offsetX, this.data.offsetY)), + (f.worldX += e.x * t), + (f.worldY += e.y * a)); } + if (0 != i) { + let e = + (Math.sqrt(l * l + d * d) - 1 + this.data.offsetScaleX) * i + + 1; + ((f.a *= e), (f.c *= e)); + } + if (0 != n) { + let e = + (Math.sqrt(c * c + u * u) - 1 + this.data.offsetScaleY) * n + + 1; + ((f.b *= e), (f.d *= e)); + } + if (s > 0) { + let e = Math.atan2(u, c) - Math.atan2(d, l); + e > ii.PI ? (e -= ii.PI2) : e < -ii.PI && (e += ii.PI2); + let t = f.b, + a = f.d; + e = Math.atan2(a, t) + (e - ii.PI / 2 + g) * s; + let i = Math.sqrt(t * t + a * a); + ((f.b = Math.cos(e) * i), (f.d = Math.sin(e) * i)); + } + f.updateAppliedTransform(); } - applyRelativeLocal() { - let e = this.mixRotate, - t = this.mixX, - a = this.mixY, - i = this.mixScaleX, - n = this.mixScaleY, - s = this.mixShearY, - o = this.target, - r = this.bones; - for (let l = 0, c = r.length; l < c; l++) { - let c = r[l], - d = c.arotation + (o.arotation + this.data.offsetRotation) * e, - u = c.ax + (o.ax + this.data.offsetX) * t, - h = c.ay + (o.ay + this.data.offsetY) * a, - p = - c.ascaleX * - ((o.ascaleX - 1 + this.data.offsetScaleX) * i + 1), - g = - c.ascaleY * - ((o.ascaleY - 1 + this.data.offsetScaleY) * n + 1), - m = c.ashearY + (o.ashearY + this.data.offsetShearY) * s; - c.updateWorldTransformWith(u, h, d, p, g, c.ashearX, m); + } + applyAbsoluteLocal() { + let e = this.mixRotate, + t = this.mixX, + a = this.mixY, + i = this.mixScaleX, + n = this.mixScaleY, + s = this.mixShearY, + o = this.target, + r = this.bones; + for (let l = 0, c = r.length; l < c; l++) { + let c = r[l], + d = c.arotation; + if (0 != e) { + let t = o.arotation - d + this.data.offsetRotation; + ((t -= 360 * (16384 - ((16384.499999999996 - t / 360) | 0))), + (d += t * e)); + } + let u = c.ax, + h = c.ay; + ((u += (o.ax - u + this.data.offsetX) * t), + (h += (o.ay - h + this.data.offsetY) * a)); + let p = c.ascaleX, + g = c.ascaleY; + (0 != i && + 0 != p && + (p = (p + (o.ascaleX - p + this.data.offsetScaleX) * i) / p), + 0 != n && + 0 != g && + (g = (g + (o.ascaleY - g + this.data.offsetScaleY) * n) / g)); + let m = c.ashearY; + if (0 != s) { + let e = o.ashearY - m + this.data.offsetShearY; + ((e -= 360 * (16384 - ((16384.499999999996 - e / 360) | 0))), + (m += e * s)); } + c.updateWorldTransformWith(u, h, d, p, g, c.ashearX, m); } } - class Mn { - constructor(e) { - if ( - ((this._updateCache = new Array()), + applyRelativeLocal() { + let e = this.mixRotate, + t = this.mixX, + a = this.mixY, + i = this.mixScaleX, + n = this.mixScaleY, + s = this.mixShearY, + o = this.target, + r = this.bones; + for (let l = 0, c = r.length; l < c; l++) { + let c = r[l], + d = c.arotation + (o.arotation + this.data.offsetRotation) * e, + u = c.ax + (o.ax + this.data.offsetX) * t, + h = c.ay + (o.ay + this.data.offsetY) * a, + p = + c.ascaleX * + ((o.ascaleX - 1 + this.data.offsetScaleX) * i + 1), + g = + c.ascaleY * + ((o.ascaleY - 1 + this.data.offsetScaleY) * n + 1), + m = c.ashearY + (o.ashearY + this.data.offsetShearY) * s; + c.updateWorldTransformWith(u, h, d, p, g, c.ashearX, m); + } + } + } + class Mn { + constructor(e) { + if ( + ((this._updateCache = new Array()), (this.scaleX = 1), (this.scaleY = 1), (this.x = 0), (this.y = 0), !e) - ) - throw new Error("data cannot be null."); - ((this.data = e), (this.bones = new Array())); - for (let t = 0; t < e.bones.length; t++) { - let a, - i = e.bones[t]; - if (i.parent) { - let e = this.bones[i.parent.index]; - ((a = new On(i, this, e)), e.children.push(a)); - } else a = new On(i, this, null); - this.bones.push(a); - } - ((this.slots = new Array()), (this.drawOrder = new Array())); - for (let t = 0; t < e.slots.length; t++) { - let a = e.slots[t], - i = this.bones[a.boneData.index], - n = new xn(a, i); - (this.slots.push(n), this.drawOrder.push(n)); - } - this.ikConstraints = new Array(); - for (let t = 0; t < e.ikConstraints.length; t++) { - let a = e.ikConstraints[t]; - this.ikConstraints.push(new wn(a, this)); - } - this.transformConstraints = new Array(); - for (let t = 0; t < e.transformConstraints.length; t++) { - let a = e.transformConstraints[t]; - this.transformConstraints.push(new Pn(a, this)); - } - this.pathConstraints = new Array(); - for (let t = 0; t < e.pathConstraints.length; t++) { - let a = e.pathConstraints[t]; - this.pathConstraints.push(new Nn(a, this)); + ) + throw new Error("data cannot be null."); + ((this.data = e), (this.bones = new Array())); + for (let t = 0; t < e.bones.length; t++) { + let a, + i = e.bones[t]; + if (i.parent) { + let e = this.bones[i.parent.index]; + ((a = new On(i, this, e)), e.children.push(a)); + } else a = new On(i, this, null); + this.bones.push(a); + } + ((this.slots = new Array()), (this.drawOrder = new Array())); + for (let t = 0; t < e.slots.length; t++) { + let a = e.slots[t], + i = this.bones[a.boneData.index], + n = new xn(a, i); + (this.slots.push(n), this.drawOrder.push(n)); + } + this.ikConstraints = new Array(); + for (let t = 0; t < e.ikConstraints.length; t++) { + let a = e.ikConstraints[t]; + this.ikConstraints.push(new wn(a, this)); + } + this.transformConstraints = new Array(); + for (let t = 0; t < e.transformConstraints.length; t++) { + let a = e.transformConstraints[t]; + this.transformConstraints.push(new Pn(a, this)); + } + this.pathConstraints = new Array(); + for (let t = 0; t < e.pathConstraints.length; t++) { + let a = e.pathConstraints[t]; + this.pathConstraints.push(new Nn(a, this)); + } + ((this.color = new ai(1, 1, 1, 1)), this.updateCache()); + } + updateCache() { + this._updateCache.length = 0; + let e = this.bones; + for (let t = 0, a = e.length; t < a; t++) { + let a = e[t]; + ((a.sorted = a.data.skinRequired), (a.active = !a.sorted)); + } + if (this.skin) { + let e = this.skin.bones; + for (let t = 0, a = this.skin.bones.length; t < a; t++) { + let a = this.bones[e[t].index]; + do { + ((a.sorted = false), (a.active = true), (a = a.parent)); + } while (a); } - ((this.color = new ai(1, 1, 1, 1)), this.updateCache()); } - updateCache() { - this._updateCache.length = 0; - let e = this.bones; - for (let t = 0, a = e.length; t < a; t++) { - let a = e[t]; - ((a.sorted = a.data.skinRequired), (a.active = !a.sorted)); - } - if (this.skin) { - let e = this.skin.bones; - for (let t = 0, a = this.skin.bones.length; t < a; t++) { - let a = this.bones[e[t].index]; - do { - ((a.sorted = false), (a.active = true), (a = a.parent)); - } while (a); + let t = this.ikConstraints, + a = this.transformConstraints, + i = this.pathConstraints, + n = t.length, + s = a.length, + o = i.length, + r = n + s + o; + e: for (let e = 0; e < r; e++) { + for (let a = 0; a < n; a++) { + let i = t[a]; + if (i.data.order == e) { + this.sortIkConstraint(i); + continue e; } } - let t = this.ikConstraints, - a = this.transformConstraints, - i = this.pathConstraints, - n = t.length, - s = a.length, - o = i.length, - r = n + s + o; - e: for (let e = 0; e < r; e++) { - for (let a = 0; a < n; a++) { - let i = t[a]; - if (i.data.order == e) { - this.sortIkConstraint(i); - continue e; - } - } - for (let t = 0; t < s; t++) { - let i = a[t]; - if (i.data.order == e) { - this.sortTransformConstraint(i); - continue e; - } + for (let t = 0; t < s; t++) { + let i = a[t]; + if (i.data.order == e) { + this.sortTransformConstraint(i); + continue e; } - for (let t = 0; t < o; t++) { - let a = i[t]; - if (a.data.order == e) { - this.sortPathConstraint(a); - continue e; - } + } + for (let t = 0; t < o; t++) { + let a = i[t]; + if (a.data.order == e) { + this.sortPathConstraint(a); + continue e; } } - for (let t = 0, a = e.length; t < a; t++) this.sortBone(e[t]); } - sortIkConstraint(e) { - if ( - ((e.active = - e.target.isActive() && - (!e.data.skinRequired || - (this.skin && - ni.contains(this.skin.constraints, e.data, true)))), + for (let t = 0, a = e.length; t < a; t++) this.sortBone(e[t]); + } + sortIkConstraint(e) { + if ( + ((e.active = + e.target.isActive() && + (!e.data.skinRequired || + (this.skin && + ni.contains(this.skin.constraints, e.data, true)))), !e.active) - ) - return; - let t = e.target; - this.sortBone(t); - let a = e.bones, - i = a[0]; - if ((this.sortBone(i), 1 == a.length)) - (this._updateCache.push(e), this.sortReset(i.children)); - else { - let t = a[a.length - 1]; - (this.sortBone(t), - this._updateCache.push(e), - this.sortReset(i.children), - (t.sorted = true)); - } + ) + return; + let t = e.target; + this.sortBone(t); + let a = e.bones, + i = a[0]; + if ((this.sortBone(i), 1 == a.length)) + (this._updateCache.push(e), this.sortReset(i.children)); + else { + let t = a[a.length - 1]; + (this.sortBone(t), + this._updateCache.push(e), + this.sortReset(i.children), + (t.sorted = true)); } - sortPathConstraint(e) { - if ( - ((e.active = - e.target.bone.isActive() && - (!e.data.skinRequired || - (this.skin && - ni.contains(this.skin.constraints, e.data, true)))), + } + sortPathConstraint(e) { + if ( + ((e.active = + e.target.bone.isActive() && + (!e.data.skinRequired || + (this.skin && + ni.contains(this.skin.constraints, e.data, true)))), !e.active) - ) - return; - let t = e.target, - a = t.data.index, - i = t.bone; - (this.skin && this.sortPathConstraintAttachment(this.skin, a, i), - this.data.defaultSkin && - this.data.defaultSkin != this.skin && - this.sortPathConstraintAttachment(this.data.defaultSkin, a, i)); - for (let e = 0, t = this.data.skins.length; e < t; e++) - this.sortPathConstraintAttachment(this.data.skins[e], a, i); - let n = t.getAttachment(); - n instanceof In && this.sortPathConstraintAttachmentWith(n, i); - let s = e.bones, - o = s.length; - for (let e = 0; e < o; e++) this.sortBone(s[e]); - this._updateCache.push(e); - for (let e = 0; e < o; e++) this.sortReset(s[e].children); - for (let e = 0; e < o; e++) s[e].sorted = true; - } - sortTransformConstraint(e) { - if ( - ((e.active = - e.target.isActive() && - (!e.data.skinRequired || - (this.skin && - ni.contains(this.skin.constraints, e.data, true)))), + ) + return; + let t = e.target, + a = t.data.index, + i = t.bone; + (this.skin && this.sortPathConstraintAttachment(this.skin, a, i), + this.data.defaultSkin && + this.data.defaultSkin != this.skin && + this.sortPathConstraintAttachment(this.data.defaultSkin, a, i)); + for (let e = 0, t = this.data.skins.length; e < t; e++) + this.sortPathConstraintAttachment(this.data.skins[e], a, i); + let n = t.getAttachment(); + n instanceof In && this.sortPathConstraintAttachmentWith(n, i); + let s = e.bones, + o = s.length; + for (let e = 0; e < o; e++) this.sortBone(s[e]); + this._updateCache.push(e); + for (let e = 0; e < o; e++) this.sortReset(s[e].children); + for (let e = 0; e < o; e++) s[e].sorted = true; + } + sortTransformConstraint(e) { + if ( + ((e.active = + e.target.isActive() && + (!e.data.skinRequired || + (this.skin && + ni.contains(this.skin.constraints, e.data, true)))), !e.active) - ) - return; - this.sortBone(e.target); - let t = e.bones, - a = t.length; - if (e.data.local) - for (let e = 0; e < a; e++) { - let a = t[e]; - (this.sortBone(a.parent), this.sortBone(a)); - } - else for (let e = 0; e < a; e++) this.sortBone(t[e]); - this._updateCache.push(e); - for (let e = 0; e < a; e++) this.sortReset(t[e].children); - for (let e = 0; e < a; e++) t[e].sorted = true; - } - sortPathConstraintAttachment(e, t, a) { - let i = e.attachments[t]; - if (i) - for (let e in i) this.sortPathConstraintAttachmentWith(i[e], a); - } - sortPathConstraintAttachmentWith(e, t) { - if (!(e instanceof In)) return; - let a = e.bones; - if (a) { - let e = this.bones; - for (let t = 0, i = a.length; t < i; ) { - let i = a[t++]; - for (i += t; t < i; ) this.sortBone(e[a[t++]]); - } - } else this.sortBone(t); - } - sortBone(e) { - if (e.sorted) return; - let t = e.parent; - (t && this.sortBone(t), - (e.sorted = true), - this._updateCache.push(e)); - } - sortReset(e) { - for (let t = 0, a = e.length; t < a; t++) { - let a = e[t]; - a.active && - (a.sorted && this.sortReset(a.children), (a.sorted = false)); - } - } - updateWorldTransform() { - let e = this.bones; - for (let t = 0, a = e.length; t < a; t++) { - let a = e[t]; - ((a.ax = a.x), - (a.ay = a.y), - (a.arotation = a.rotation), - (a.ascaleX = a.scaleX), - (a.ascaleY = a.scaleY), - (a.ashearX = a.shearX), - (a.ashearY = a.shearY)); - } - let t = this._updateCache; - for (let e = 0, a = t.length; e < a; e++) t[e].update(); - } - updateWorldTransformWith(e) { - let t = this.getRootBone(), - a = e.a, - i = e.b, - n = e.c, - s = e.d; - ((t.worldX = a * this.x + i * this.y + e.worldX), - (t.worldY = n * this.x + s * this.y + e.worldY)); - let o = t.rotation + 90 + t.shearY, - r = ii.cosDeg(t.rotation + t.shearX) * t.scaleX, - l = ii.cosDeg(o) * t.scaleY, - c = ii.sinDeg(t.rotation + t.shearX) * t.scaleX, - d = ii.sinDeg(o) * t.scaleY; - ((t.a = (a * r + i * c) * this.scaleX), - (t.b = (a * l + i * d) * this.scaleX), - (t.c = (n * r + s * c) * this.scaleY), - (t.d = (n * l + s * d) * this.scaleY)); - let u = this._updateCache; - for (let e = 0, a = u.length; e < a; e++) { - let a = u[e]; - a != t && a.update(); - } - } - setToSetupPose() { - (this.setBonesToSetupPose(), this.setSlotsToSetupPose()); - } - setBonesToSetupPose() { - let e = this.bones; - for (let t = 0, a = e.length; t < a; t++) e[t].setToSetupPose(); - let t = this.ikConstraints; - for (let e = 0, a = t.length; e < a; e++) { + ) + return; + this.sortBone(e.target); + let t = e.bones, + a = t.length; + if (e.data.local) + for (let e = 0; e < a; e++) { let a = t[e]; - ((a.mix = a.data.mix), - (a.softness = a.data.softness), - (a.bendDirection = a.data.bendDirection), - (a.compress = a.data.compress), - (a.stretch = a.data.stretch)); - } - let a = this.transformConstraints; - for (let e = 0, t = a.length; e < t; e++) { - let t = a[e], - i = t.data; - ((t.mixRotate = i.mixRotate), - (t.mixX = i.mixX), - (t.mixY = i.mixY), - (t.mixScaleX = i.mixScaleX), - (t.mixScaleY = i.mixScaleY), - (t.mixShearY = i.mixShearY)); + (this.sortBone(a.parent), this.sortBone(a)); } - let i = this.pathConstraints; - for (let e = 0, t = i.length; e < t; e++) { - let t = i[e], - a = t.data; - ((t.position = a.position), - (t.spacing = a.spacing), - (t.mixRotate = a.mixRotate), - (t.mixX = a.mixX), - (t.mixY = a.mixY)); - } - } - setSlotsToSetupPose() { - let e = this.slots; - ni.arrayCopy(e, 0, this.drawOrder, 0, e.length); - for (let t = 0, a = e.length; t < a; t++) e[t].setToSetupPose(); - } - getRootBone() { - return 0 == this.bones.length ? null : this.bones[0]; - } - findBone(e) { - if (!e) throw new Error("boneName cannot be null."); - let t = this.bones; - for (let a = 0, i = t.length; a < i; a++) { - let i = t[a]; - if (i.data.name == e) return i; + else for (let e = 0; e < a; e++) this.sortBone(t[e]); + this._updateCache.push(e); + for (let e = 0; e < a; e++) this.sortReset(t[e].children); + for (let e = 0; e < a; e++) t[e].sorted = true; + } + sortPathConstraintAttachment(e, t, a) { + let i = e.attachments[t]; + if (i) + for (let e in i) this.sortPathConstraintAttachmentWith(i[e], a); + } + sortPathConstraintAttachmentWith(e, t) { + if (!(e instanceof In)) return; + let a = e.bones; + if (a) { + let e = this.bones; + for (let t = 0, i = a.length; t < i;) { + let i = a[t++]; + for (i += t; t < i;) this.sortBone(e[a[t++]]); } - return null; + } else this.sortBone(t); + } + sortBone(e) { + if (e.sorted) return; + let t = e.parent; + (t && this.sortBone(t), + (e.sorted = true), + this._updateCache.push(e)); + } + sortReset(e) { + for (let t = 0, a = e.length; t < a; t++) { + let a = e[t]; + a.active && + (a.sorted && this.sortReset(a.children), (a.sorted = false)); } - findSlot(e) { - if (!e) throw new Error("slotName cannot be null."); - let t = this.slots; - for (let a = 0, i = t.length; a < i; a++) { - let i = t[a]; - if (i.data.name == e) return i; - } - return null; + } + updateWorldTransform() { + let e = this.bones; + for (let t = 0, a = e.length; t < a; t++) { + let a = e[t]; + ((a.ax = a.x), + (a.ay = a.y), + (a.arotation = a.rotation), + (a.ascaleX = a.scaleX), + (a.ascaleY = a.scaleY), + (a.ashearX = a.shearX), + (a.ashearY = a.shearY)); + } + let t = this._updateCache; + for (let e = 0, a = t.length; e < a; e++) t[e].update(); + } + updateWorldTransformWith(e) { + let t = this.getRootBone(), + a = e.a, + i = e.b, + n = e.c, + s = e.d; + ((t.worldX = a * this.x + i * this.y + e.worldX), + (t.worldY = n * this.x + s * this.y + e.worldY)); + let o = t.rotation + 90 + t.shearY, + r = ii.cosDeg(t.rotation + t.shearX) * t.scaleX, + l = ii.cosDeg(o) * t.scaleY, + c = ii.sinDeg(t.rotation + t.shearX) * t.scaleX, + d = ii.sinDeg(o) * t.scaleY; + ((t.a = (a * r + i * c) * this.scaleX), + (t.b = (a * l + i * d) * this.scaleX), + (t.c = (n * r + s * c) * this.scaleY), + (t.d = (n * l + s * d) * this.scaleY)); + let u = this._updateCache; + for (let e = 0, a = u.length; e < a; e++) { + let a = u[e]; + a != t && a.update(); } - setSkinByName(e) { - let t = this.data.findSkin(e); - if (!t) throw new Error("Skin not found: " + e); - this.setSkin(t); + } + setToSetupPose() { + (this.setBonesToSetupPose(), this.setSlotsToSetupPose()); + } + setBonesToSetupPose() { + let e = this.bones; + for (let t = 0, a = e.length; t < a; t++) e[t].setToSetupPose(); + let t = this.ikConstraints; + for (let e = 0, a = t.length; e < a; e++) { + let a = t[e]; + ((a.mix = a.data.mix), + (a.softness = a.data.softness), + (a.bendDirection = a.data.bendDirection), + (a.compress = a.data.compress), + (a.stretch = a.data.stretch)); + } + let a = this.transformConstraints; + for (let e = 0, t = a.length; e < t; e++) { + let t = a[e], + i = t.data; + ((t.mixRotate = i.mixRotate), + (t.mixX = i.mixX), + (t.mixY = i.mixY), + (t.mixScaleX = i.mixScaleX), + (t.mixScaleY = i.mixScaleY), + (t.mixShearY = i.mixShearY)); + } + let i = this.pathConstraints; + for (let e = 0, t = i.length; e < t; e++) { + let t = i[e], + a = t.data; + ((t.position = a.position), + (t.spacing = a.spacing), + (t.mixRotate = a.mixRotate), + (t.mixX = a.mixX), + (t.mixY = a.mixY)); } - setSkin(e) { - if (e != this.skin) { - if (e) - if (this.skin) e.attachAll(this, this.skin); - else { - let t = this.slots; - for (let a = 0, i = t.length; a < i; a++) { - let i = t[a], - n = i.data.attachmentName; - if (n) { - let t = e.getAttachment(a, n); - t && i.setAttachment(t); - } + } + setSlotsToSetupPose() { + let e = this.slots; + ni.arrayCopy(e, 0, this.drawOrder, 0, e.length); + for (let t = 0, a = e.length; t < a; t++) e[t].setToSetupPose(); + } + getRootBone() { + return 0 == this.bones.length ? null : this.bones[0]; + } + findBone(e) { + if (!e) throw new Error("boneName cannot be null."); + let t = this.bones; + for (let a = 0, i = t.length; a < i; a++) { + let i = t[a]; + if (i.data.name == e) return i; + } + return null; + } + findSlot(e) { + if (!e) throw new Error("slotName cannot be null."); + let t = this.slots; + for (let a = 0, i = t.length; a < i; a++) { + let i = t[a]; + if (i.data.name == e) return i; + } + return null; + } + setSkinByName(e) { + let t = this.data.findSkin(e); + if (!t) throw new Error("Skin not found: " + e); + this.setSkin(t); + } + setSkin(e) { + if (e != this.skin) { + if (e) + if (this.skin) e.attachAll(this, this.skin); + else { + let t = this.slots; + for (let a = 0, i = t.length; a < i; a++) { + let i = t[a], + n = i.data.attachmentName; + if (n) { + let t = e.getAttachment(a, n); + t && i.setAttachment(t); } } - ((this.skin = e), this.updateCache()); - } - } - getAttachmentByName(e, t) { - return this.getAttachment(this.data.findSlot(e).index, t); - } - getAttachment(e, t) { - if (!t) throw new Error("attachmentName cannot be null."); - if (this.skin) { - let a = this.skin.getAttachment(e, t); - if (a) return a; - } - return this.data.defaultSkin - ? this.data.defaultSkin.getAttachment(e, t) - : null; - } - setAttachment(e, t) { - if (!e) throw new Error("slotName cannot be null."); - let a = this.slots; - for (let i = 0, n = a.length; i < n; i++) { - let n = a[i]; - if (n.data.name == e) { - let a = null; - if (t && ((a = this.getAttachment(i, t)), !a)) - throw new Error( - "Attachment not found: " + t + ", for slot: " + e, - ); - return void n.setAttachment(a); } - } - throw new Error("Slot not found: " + e); - } - findIkConstraint(e) { - if (!e) throw new Error("constraintName cannot be null."); - let t = this.ikConstraints; - for (let a = 0, i = t.length; a < i; a++) { - let i = t[a]; - if (i.data.name == e) return i; - } - return null; + ((this.skin = e), this.updateCache()); } - findTransformConstraint(e) { - if (!e) throw new Error("constraintName cannot be null."); - let t = this.transformConstraints; - for (let a = 0, i = t.length; a < i; a++) { - let i = t[a]; - if (i.data.name == e) return i; + } + getAttachmentByName(e, t) { + return this.getAttachment(this.data.findSlot(e).index, t); + } + getAttachment(e, t) { + if (!t) throw new Error("attachmentName cannot be null."); + if (this.skin) { + let a = this.skin.getAttachment(e, t); + if (a) return a; + } + return this.data.defaultSkin + ? this.data.defaultSkin.getAttachment(e, t) + : null; + } + setAttachment(e, t) { + if (!e) throw new Error("slotName cannot be null."); + let a = this.slots; + for (let i = 0, n = a.length; i < n; i++) { + let n = a[i]; + if (n.data.name == e) { + let a = null; + if (t && ((a = this.getAttachment(i, t)), !a)) + throw new Error( + "Attachment not found: " + t + ", for slot: " + e, + ); + return void n.setAttachment(a); } - return null; } - findPathConstraint(e) { - if (!e) throw new Error("constraintName cannot be null."); - let t = this.pathConstraints; - for (let a = 0, i = t.length; a < i; a++) { - let i = t[a]; - if (i.data.name == e) return i; + throw new Error("Slot not found: " + e); + } + findIkConstraint(e) { + if (!e) throw new Error("constraintName cannot be null."); + let t = this.ikConstraints; + for (let a = 0, i = t.length; a < i; a++) { + let i = t[a]; + if (i.data.name == e) return i; + } + return null; + } + findTransformConstraint(e) { + if (!e) throw new Error("constraintName cannot be null."); + let t = this.transformConstraints; + for (let a = 0, i = t.length; a < i; a++) { + let i = t[a]; + if (i.data.name == e) return i; + } + return null; + } + findPathConstraint(e) { + if (!e) throw new Error("constraintName cannot be null."); + let t = this.pathConstraints; + for (let a = 0, i = t.length; a < i; a++) { + let i = t[a]; + if (i.data.name == e) return i; + } + return null; + } + getBounds(e, t, a = new Array(2)) { + if (!e) throw new Error("offset cannot be null."); + if (!t) throw new Error("size cannot be null."); + let i = this.drawOrder, + n = Number.POSITIVE_INFINITY, + s = Number.POSITIVE_INFINITY, + o = Number.NEGATIVE_INFINITY, + r = Number.NEGATIVE_INFINITY; + for (let e = 0, t = i.length; e < t; e++) { + let t = i[e]; + if (!t.bone.active) continue; + let l = 0, + c = null, + d = t.getAttachment(); + if (d instanceof vn) + ((l = 8), + (c = ni.setArraySize(a, l, 0)), + d.computeWorldVertices(t, c, 0, 2)); + else if (d instanceof Sn) { + let e = d; + ((l = e.worldVerticesLength), + (c = ni.setArraySize(a, l, 0)), + e.computeWorldVertices(t, 0, l, c, 0, 2)); } - return null; - } - getBounds(e, t, a = new Array(2)) { - if (!e) throw new Error("offset cannot be null."); - if (!t) throw new Error("size cannot be null."); - let i = this.drawOrder, - n = Number.POSITIVE_INFINITY, - s = Number.POSITIVE_INFINITY, - o = Number.NEGATIVE_INFINITY, - r = Number.NEGATIVE_INFINITY; - for (let e = 0, t = i.length; e < t; e++) { - let t = i[e]; - if (!t.bone.active) continue; - let l = 0, - c = null, - d = t.getAttachment(); - if (d instanceof vn) - ((l = 8), - (c = ni.setArraySize(a, l, 0)), - d.computeWorldVertices(t, c, 0, 2)); - else if (d instanceof Sn) { - let e = d; - ((l = e.worldVerticesLength), - (c = ni.setArraySize(a, l, 0)), - e.computeWorldVertices(t, 0, l, c, 0, 2)); + if (c) + for (let e = 0, t = c.length; e < t; e += 2) { + let t = c[e], + a = c[e + 1]; + ((n = Math.min(n, t)), + (s = Math.min(s, a)), + (o = Math.max(o, t)), + (r = Math.max(r, a))); } - if (c) - for (let e = 0, t = c.length; e < t; e += 2) { - let t = c[e], - a = c[e + 1]; - ((n = Math.min(n, t)), - (s = Math.min(s, a)), - (o = Math.max(o, t)), - (r = Math.max(r, a))); - } - } - (e.set(n, s), t.set(o - n, r - s)); } + (e.set(n, s), t.set(o - n, r - s)); } - class Ln { - constructor(e, t, a) { - ((this.slotIndex = e), (this.name = t), (this.attachment = a)); - } + } + class Ln { + constructor(e, t, a) { + ((this.slotIndex = e), (this.name = t), (this.attachment = a)); } - class Dn { - constructor(e) { - if ( - ((this.attachments = new Array()), + } + class Dn { + constructor(e) { + if ( + ((this.attachments = new Array()), (this.bones = Array()), (this.constraints = new Array()), !e) - ) - throw new Error("name cannot be null."); - this.name = e; - } - setAttachment(e, t, a) { - if (!a) throw new Error("attachment cannot be null."); - let i = this.attachments; - (e >= i.length && (i.length = e + 1), - i[e] || (i[e] = {}), - (i[e][t] = a)); - } - addSkin(e) { - for (let t = 0; t < e.bones.length; t++) { - let a = e.bones[t], - i = false; - for (let e = 0; e < this.bones.length; e++) - if (this.bones[e] == a) { - i = true; - break; - } - i || this.bones.push(a); - } - for (let t = 0; t < e.constraints.length; t++) { - let a = e.constraints[t], - i = false; - for (let e = 0; e < this.constraints.length; e++) - if (this.constraints[e] == a) { - i = true; - break; - } - i || this.constraints.push(a); - } - let t = e.getAttachments(); - for (let e = 0; e < t.length; e++) { - var a = t[e]; - this.setAttachment(a.slotIndex, a.name, a.attachment); - } + ) + throw new Error("name cannot be null."); + this.name = e; + } + setAttachment(e, t, a) { + if (!a) throw new Error("attachment cannot be null."); + let i = this.attachments; + (e >= i.length && (i.length = e + 1), + i[e] || (i[e] = {}), + (i[e][t] = a)); + } + addSkin(e) { + for (let t = 0; t < e.bones.length; t++) { + let a = e.bones[t], + i = false; + for (let e = 0; e < this.bones.length; e++) + if (this.bones[e] == a) { + i = true; + break; + } + i || this.bones.push(a); } - copySkin(e) { - for (let t = 0; t < e.bones.length; t++) { - let a = e.bones[t], - i = false; - for (let e = 0; e < this.bones.length; e++) - if (this.bones[e] == a) { - i = true; - break; - } - i || this.bones.push(a); - } - for (let t = 0; t < e.constraints.length; t++) { - let a = e.constraints[t], - i = false; - for (let e = 0; e < this.constraints.length; e++) - if (this.constraints[e] == a) { - i = true; - break; - } - i || this.constraints.push(a); - } - let t = e.getAttachments(); - for (let e = 0; e < t.length; e++) { - var a = t[e]; - a.attachment && - (a.attachment instanceof Sn - ? ((a.attachment = a.attachment.newLinkedMesh()), - this.setAttachment(a.slotIndex, a.name, a.attachment)) - : ((a.attachment = a.attachment.copy()), - this.setAttachment(a.slotIndex, a.name, a.attachment))); - } + for (let t = 0; t < e.constraints.length; t++) { + let a = e.constraints[t], + i = false; + for (let e = 0; e < this.constraints.length; e++) + if (this.constraints[e] == a) { + i = true; + break; + } + i || this.constraints.push(a); } - getAttachment(e, t) { - let a = this.attachments[e]; - return a ? a[t] : null; + let t = e.getAttachments(); + for (let e = 0; e < t.length; e++) { + var a = t[e]; + this.setAttachment(a.slotIndex, a.name, a.attachment); } - removeAttachment(e, t) { - let a = this.attachments[e]; - a && (a[t] = null); + } + copySkin(e) { + for (let t = 0; t < e.bones.length; t++) { + let a = e.bones[t], + i = false; + for (let e = 0; e < this.bones.length; e++) + if (this.bones[e] == a) { + i = true; + break; + } + i || this.bones.push(a); } - getAttachments() { - let e = new Array(); - for (var t = 0; t < this.attachments.length; t++) { - let a = this.attachments[t]; - if (a) - for (let i in a) { - let n = a[i]; - n && e.push(new Ln(t, i, n)); - } - } - return e; + for (let t = 0; t < e.constraints.length; t++) { + let a = e.constraints[t], + i = false; + for (let e = 0; e < this.constraints.length; e++) + if (this.constraints[e] == a) { + i = true; + break; + } + i || this.constraints.push(a); + } + let t = e.getAttachments(); + for (let e = 0; e < t.length; e++) { + var a = t[e]; + a.attachment && + (a.attachment instanceof Sn + ? ((a.attachment = a.attachment.newLinkedMesh()), + this.setAttachment(a.slotIndex, a.name, a.attachment)) + : ((a.attachment = a.attachment.copy()), + this.setAttachment(a.slotIndex, a.name, a.attachment))); } - getAttachmentsForSlot(e, t) { - let a = this.attachments[e]; + } + getAttachment(e, t) { + let a = this.attachments[e]; + return a ? a[t] : null; + } + removeAttachment(e, t) { + let a = this.attachments[e]; + a && (a[t] = null); + } + getAttachments() { + let e = new Array(); + for (var t = 0; t < this.attachments.length; t++) { + let a = this.attachments[t]; if (a) for (let i in a) { let n = a[i]; - n && t.push(new Ln(e, i, n)); + n && e.push(new Ln(t, i, n)); } } - clear() { - ((this.attachments.length = 0), - (this.bones.length = 0), - (this.constraints.length = 0)); - } - attachAll(e, t) { - let a = 0; - for (let i = 0; i < e.slots.length; i++) { - let n = e.slots[i], - s = n.getAttachment(); - if (s && a < t.attachments.length) { - let e = t.attachments[a]; - for (let t in e) - if (s == e[t]) { - let e = this.getAttachment(a, t); - e && n.setAttachment(e); - break; - } - } - a++; + return e; + } + getAttachmentsForSlot(e, t) { + let a = this.attachments[e]; + if (a) + for (let i in a) { + let n = a[i]; + n && t.push(new Ln(e, i, n)); + } + } + clear() { + ((this.attachments.length = 0), + (this.bones.length = 0), + (this.constraints.length = 0)); + } + attachAll(e, t) { + let a = 0; + for (let i = 0; i < e.slots.length; i++) { + let n = e.slots[i], + s = n.getAttachment(); + if (s && a < t.attachments.length) { + let e = t.attachments[a]; + for (let t in e) + if (s == e[t]) { + let e = this.getAttachment(a, t); + e && n.setAttachment(e); + break; + } } + a++; } } - class Bn { - constructor(e, t, a) { - if (((this.color = new ai(1, 1, 1, 1)), e < 0)) - throw new Error("index must be >= 0."); - if (!t) throw new Error("name cannot be null."); - if (!a) throw new Error("boneData cannot be null."); - ((this.index = e), (this.name = t), (this.boneData = a)); + } + class Bn { + constructor(e, t, a) { + if (((this.color = new ai(1, 1, 1, 1)), e < 0)) + throw new Error("index must be >= 0."); + if (!t) throw new Error("name cannot be null."); + if (!a) throw new Error("boneData cannot be null."); + ((this.index = e), (this.name = t), (this.boneData = a)); + } + } + (!(function (e) { + ((e[(e.Normal = 0)] = "Normal"), + (e[(e.Additive = 1)] = "Additive"), + (e[(e.Multiply = 2)] = "Multiply"), + (e[(e.Screen = 3)] = "Screen")); + })(hn || (hn = {})), + (function (e) { + ((e[(e.Region = 0)] = "Region"), + (e[(e.BoundingBox = 1)] = "BoundingBox"), + (e[(e.Mesh = 2)] = "Mesh"), + (e[(e.LinkedMesh = 3)] = "LinkedMesh"), + (e[(e.Path = 4)] = "Path"), + (e[(e.Point = 5)] = "Point"), + (e[(e.Clipping = 6)] = "Clipping")); + })(pn || (pn = {}))); + class Fn { + constructor() { + ((this.minX = 0), + (this.minY = 0), + (this.maxX = 0), + (this.maxY = 0), + (this.boundingBoxes = new Array()), + (this.polygons = new Array()), + (this.polygonPool = new si(() => ni.newFloatArray(16)))); + } + update(e, t) { + if (!e) throw new Error("skeleton cannot be null."); + let a = this.boundingBoxes, + i = this.polygons, + n = this.polygonPool, + s = e.slots, + o = s.length; + ((a.length = 0), n.freeAll(i), (i.length = 0)); + for (let e = 0; e < o; e++) { + let t = s[e]; + if (!t.bone.active) continue; + let o = t.getAttachment(); + if (o instanceof nn) { + let e = o; + a.push(e); + let s = n.obtain(); + (s.length != e.worldVerticesLength && + (s = ni.newFloatArray(e.worldVerticesLength)), + i.push(s), + e.computeWorldVertices(t, 0, e.worldVerticesLength, s, 0, 2)); + } } + t + ? this.aabbCompute() + : ((this.minX = Number.POSITIVE_INFINITY), + (this.minY = Number.POSITIVE_INFINITY), + (this.maxX = Number.NEGATIVE_INFINITY), + (this.maxY = Number.NEGATIVE_INFINITY)); } - (!(function (e) { - ((e[(e.Normal = 0)] = "Normal"), - (e[(e.Additive = 1)] = "Additive"), - (e[(e.Multiply = 2)] = "Multiply"), - (e[(e.Screen = 3)] = "Screen")); - })(hn || (hn = {})), - (function (e) { - ((e[(e.Region = 0)] = "Region"), - (e[(e.BoundingBox = 1)] = "BoundingBox"), - (e[(e.Mesh = 2)] = "Mesh"), - (e[(e.LinkedMesh = 3)] = "LinkedMesh"), - (e[(e.Path = 4)] = "Path"), - (e[(e.Point = 5)] = "Point"), - (e[(e.Clipping = 6)] = "Clipping")); - })(pn || (pn = {}))); - class Fn { - constructor() { - ((this.minX = 0), - (this.minY = 0), - (this.maxX = 0), - (this.maxY = 0), - (this.boundingBoxes = new Array()), - (this.polygons = new Array()), - (this.polygonPool = new si(() => ni.newFloatArray(16)))); + aabbCompute() { + let e = Number.POSITIVE_INFINITY, + t = Number.POSITIVE_INFINITY, + a = Number.NEGATIVE_INFINITY, + i = Number.NEGATIVE_INFINITY, + n = this.polygons; + for (let s = 0, o = n.length; s < o; s++) { + let o = n[s], + r = o; + for (let n = 0, s = o.length; n < s; n += 2) { + let s = r[n], + o = r[n + 1]; + ((e = Math.min(e, s)), + (t = Math.min(t, o)), + (a = Math.max(a, s)), + (i = Math.max(i, o))); + } } - update(e, t) { - if (!e) throw new Error("skeleton cannot be null."); - let a = this.boundingBoxes, - i = this.polygons, - n = this.polygonPool, - s = e.slots, - o = s.length; - ((a.length = 0), n.freeAll(i), (i.length = 0)); - for (let e = 0; e < o; e++) { - let t = s[e]; - if (!t.bone.active) continue; - let o = t.getAttachment(); - if (o instanceof nn) { - let e = o; - a.push(e); - let s = n.obtain(); - (s.length != e.worldVerticesLength && - (s = ni.newFloatArray(e.worldVerticesLength)), - i.push(s), - e.computeWorldVertices(t, 0, e.worldVerticesLength, s, 0, 2)); - } - } - t - ? this.aabbCompute() - : ((this.minX = Number.POSITIVE_INFINITY), - (this.minY = Number.POSITIVE_INFINITY), - (this.maxX = Number.NEGATIVE_INFINITY), - (this.maxY = Number.NEGATIVE_INFINITY)); - } - aabbCompute() { - let e = Number.POSITIVE_INFINITY, - t = Number.POSITIVE_INFINITY, - a = Number.NEGATIVE_INFINITY, - i = Number.NEGATIVE_INFINITY, - n = this.polygons; - for (let s = 0, o = n.length; s < o; s++) { - let o = n[s], - r = o; - for (let n = 0, s = o.length; n < s; n += 2) { - let s = r[n], - o = r[n + 1]; - ((e = Math.min(e, s)), - (t = Math.min(t, o)), - (a = Math.max(a, s)), - (i = Math.max(i, o))); - } + ((this.minX = e), + (this.minY = t), + (this.maxX = a), + (this.maxY = i)); + } + aabbContainsPoint(e, t) { + return ( + e >= this.minX && + e <= this.maxX && + t >= this.minY && + t <= this.maxY + ); + } + aabbIntersectsSegment(e, t, a, i) { + let n = this.minX, + s = this.minY, + o = this.maxX, + r = this.maxY; + if ( + (e <= n && a <= n) || + (t <= s && i <= s) || + (e >= o && a >= o) || + (t >= r && i >= r) + ) + return false; + let l = (i - t) / (a - e), + c = l * (n - e) + t; + if (c > s && c < r) return true; + if (((c = l * (o - e) + t), c > s && c < r)) return true; + let d = (s - t) / l + e; + return (d > n && d < o) || ((d = (r - t) / l + e), d > n && d < o); + } + aabbIntersectsSkeleton(e) { + return ( + this.minX < e.maxX && + this.maxX > e.minX && + this.minY < e.maxY && + this.maxY > e.minY + ); + } + containsPoint(e, t) { + let a = this.polygons; + for (let i = 0, n = a.length; i < n; i++) + if (this.containsPointPolygon(a[i], e, t)) + return this.boundingBoxes[i]; + return null; + } + containsPointPolygon(e, t, a) { + let i = e, + n = e.length, + s = n - 2, + o = false; + for (let e = 0; e < n; e += 2) { + let n = i[e + 1], + r = i[s + 1]; + if ((n < a && r >= a) || (r < a && n >= a)) { + let l = i[e]; + l + ((a - n) / (r - n)) * (i[s] - l) < t && (o = !o); } - ((this.minX = e), - (this.minY = t), - (this.maxX = a), - (this.maxY = i)); - } - aabbContainsPoint(e, t) { - return ( - e >= this.minX && - e <= this.maxX && - t >= this.minY && - t <= this.maxY - ); + s = e; } - aabbIntersectsSegment(e, t, a, i) { - let n = this.minX, - s = this.minY, - o = this.maxX, - r = this.maxY; + return o; + } + intersectsSegment(e, t, a, i) { + let n = this.polygons; + for (let s = 0, o = n.length; s < o; s++) + if (this.intersectsSegmentPolygon(n[s], e, t, a, i)) + return this.boundingBoxes[s]; + return null; + } + intersectsSegmentPolygon(e, t, a, i, n) { + let s = e, + o = e.length, + r = t - i, + l = a - n, + c = t * n - a * i, + d = s[o - 2], + u = s[o - 1]; + for (let e = 0; e < o; e += 2) { + let o = s[e], + h = s[e + 1], + p = d * h - u * o, + g = d - o, + m = u - h, + f = r * m - l * g, + y = (c * g - r * p) / f; if ( - (e <= n && a <= n) || - (t <= s && i <= s) || - (e >= o && a >= o) || - (t >= r && i >= r) - ) - return false; - let l = (i - t) / (a - e), - c = l * (n - e) + t; - if (c > s && c < r) return true; - if (((c = l * (o - e) + t), c > s && c < r)) return true; - let d = (s - t) / l + e; - return (d > n && d < o) || ((d = (r - t) / l + e), d > n && d < o); - } - aabbIntersectsSkeleton(e) { - return ( - this.minX < e.maxX && - this.maxX > e.minX && - this.minY < e.maxY && - this.maxY > e.minY - ); - } - containsPoint(e, t) { - let a = this.polygons; - for (let i = 0, n = a.length; i < n; i++) - if (this.containsPointPolygon(a[i], e, t)) - return this.boundingBoxes[i]; - return null; - } - containsPointPolygon(e, t, a) { - let i = e, - n = e.length, - s = n - 2, - o = false; - for (let e = 0; e < n; e += 2) { - let n = i[e + 1], - r = i[s + 1]; - if ((n < a && r >= a) || (r < a && n >= a)) { - let l = i[e]; - l + ((a - n) / (r - n)) * (i[s] - l) < t && (o = !o); - } - s = e; - } - return o; - } - intersectsSegment(e, t, a, i) { - let n = this.polygons; - for (let s = 0, o = n.length; s < o; s++) - if (this.intersectsSegmentPolygon(n[s], e, t, a, i)) - return this.boundingBoxes[s]; - return null; - } - intersectsSegmentPolygon(e, t, a, i, n) { - let s = e, - o = e.length, - r = t - i, - l = a - n, - c = t * n - a * i, - d = s[o - 2], - u = s[o - 1]; - for (let e = 0; e < o; e += 2) { - let o = s[e], - h = s[e + 1], - p = d * h - u * o, - g = d - o, - m = u - h, - f = r * m - l * g, - y = (c * g - r * p) / f; + ((y >= d && y <= o) || (y >= o && y <= d)) && + ((y >= t && y <= i) || (y >= i && y <= t)) + ) { + let e = (c * m - l * p) / f; if ( - ((y >= d && y <= o) || (y >= o && y <= d)) && - ((y >= t && y <= i) || (y >= i && y <= t)) - ) { - let e = (c * m - l * p) / f; - if ( - ((e >= u && e <= h) || (e >= h && e <= u)) && - ((e >= a && e <= n) || (e >= n && e <= a)) - ) - return true; - } - ((d = o), (u = h)); + ((e >= u && e <= h) || (e >= h && e <= u)) && + ((e >= a && e <= n) || (e >= n && e <= a)) + ) + return true; } - return false; - } - getPolygon(e) { - if (!e) throw new Error("boundingBox cannot be null."); - let t = this.boundingBoxes.indexOf(e); - return -1 == t ? null : this.polygons[t]; - } - getWidth() { - return this.maxX - this.minX; - } - getHeight() { - return this.maxY - this.minY; + ((d = o), (u = h)); } + return false; } - class Yn { - constructor() { - ((this.convexPolygons = new Array()), - (this.convexPolygonsIndices = new Array()), - (this.indicesArray = new Array()), - (this.isConcaveArray = new Array()), - (this.triangles = new Array()), - (this.polygonPool = new si(() => new Array())), - (this.polygonIndicesPool = new si(() => new Array()))); - } - triangulate(e) { - let t = e, - a = e.length >> 1, - i = this.indicesArray; - i.length = 0; - for (let e = 0; e < a; e++) i[e] = e; - let n = this.isConcaveArray; - n.length = 0; - for (let e = 0, s = a; e < s; ++e) n[e] = Yn.isConcave(e, a, t, i); - let s = this.triangles; - for (s.length = 0; a > 3; ) { - let e = a - 1, - o = 0, - r = 1; - for (;;) { - e: if (!n[o]) { - let s = i[e] << 1, - l = i[o] << 1, - c = i[r] << 1, - d = t[s], - u = t[s + 1], - h = t[l], - p = t[l + 1], - g = t[c], - m = t[c + 1]; - for (let s = (r + 1) % a; s != e; s = (s + 1) % a) { - if (!n[s]) continue; - let e = i[s] << 1, - a = t[e], - o = t[e + 1]; - if ( - Yn.positiveArea(g, m, d, u, a, o) && - Yn.positiveArea(d, u, h, p, a, o) && - Yn.positiveArea(h, p, g, m, a, o) - ) - break e; - } - break; - } - if (0 == r) { - do { - if (!n[o]) break; - o--; - } while (o > 0); - break; + getPolygon(e) { + if (!e) throw new Error("boundingBox cannot be null."); + let t = this.boundingBoxes.indexOf(e); + return -1 == t ? null : this.polygons[t]; + } + getWidth() { + return this.maxX - this.minX; + } + getHeight() { + return this.maxY - this.minY; + } + } + class Yn { + constructor() { + ((this.convexPolygons = new Array()), + (this.convexPolygonsIndices = new Array()), + (this.indicesArray = new Array()), + (this.isConcaveArray = new Array()), + (this.triangles = new Array()), + (this.polygonPool = new si(() => new Array())), + (this.polygonIndicesPool = new si(() => new Array()))); + } + triangulate(e) { + let t = e, + a = e.length >> 1, + i = this.indicesArray; + i.length = 0; + for (let e = 0; e < a; e++) i[e] = e; + let n = this.isConcaveArray; + n.length = 0; + for (let e = 0, s = a; e < s; ++e) n[e] = Yn.isConcave(e, a, t, i); + let s = this.triangles; + for (s.length = 0; a > 3;) { + let e = a - 1, + o = 0, + r = 1; + for (; ;) { + e: if (!n[o]) { + let s = i[e] << 1, + l = i[o] << 1, + c = i[r] << 1, + d = t[s], + u = t[s + 1], + h = t[l], + p = t[l + 1], + g = t[c], + m = t[c + 1]; + for (let s = (r + 1) % a; s != e; s = (s + 1) % a) { + if (!n[s]) continue; + let e = i[s] << 1, + a = t[e], + o = t[e + 1]; + if ( + Yn.positiveArea(g, m, d, u, a, o) && + Yn.positiveArea(d, u, h, p, a, o) && + Yn.positiveArea(h, p, g, m, a, o) + ) + break e; } - ((e = o), (o = r), (r = (r + 1) % a)); + break; } - (s.push(i[(a + o - 1) % a]), - s.push(i[o]), - s.push(i[(o + 1) % a]), - i.splice(o, 1), - n.splice(o, 1), - a--); - let l = (a + o - 1) % a, - c = o == a ? 0 : o; - ((n[l] = Yn.isConcave(l, a, t, i)), - (n[c] = Yn.isConcave(c, a, t, i))); - } - return (3 == a && (s.push(i[2]), s.push(i[0]), s.push(i[1])), s); - } - decompose(e, t) { - let a = e, - i = this.convexPolygons; - (this.polygonPool.freeAll(i), (i.length = 0)); - let n = this.convexPolygonsIndices; - (this.polygonIndicesPool.freeAll(n), (n.length = 0)); - let s = this.polygonIndicesPool.obtain(); - s.length = 0; - let o = this.polygonPool.obtain(); - o.length = 0; - let r = -1, - l = 0; - for (let e = 0, c = t.length; e < c; e += 3) { - let c = t[e] << 1, - d = t[e + 1] << 1, - u = t[e + 2] << 1, - h = a[c], - p = a[c + 1], - g = a[d], - m = a[d + 1], - f = a[u], - y = a[u + 1], - E = false; - if (r == c) { - let e = o.length - 4, - t = Yn.winding(o[e], o[e + 1], o[e + 2], o[e + 3], f, y), - a = Yn.winding(f, y, o[0], o[1], o[2], o[3]); - t == l && - a == l && - (o.push(f), o.push(y), s.push(u), (E = true)); + if (0 == r) { + do { + if (!n[o]) break; + o--; + } while (o > 0); + break; } - E || - (o.length > 0 - ? (i.push(o), n.push(s)) - : (this.polygonPool.free(o), this.polygonIndicesPool.free(s)), + ((e = o), (o = r), (r = (r + 1) % a)); + } + (s.push(i[(a + o - 1) % a]), + s.push(i[o]), + s.push(i[(o + 1) % a]), + i.splice(o, 1), + n.splice(o, 1), + a--); + let l = (a + o - 1) % a, + c = o == a ? 0 : o; + ((n[l] = Yn.isConcave(l, a, t, i)), + (n[c] = Yn.isConcave(c, a, t, i))); + } + return (3 == a && (s.push(i[2]), s.push(i[0]), s.push(i[1])), s); + } + decompose(e, t) { + let a = e, + i = this.convexPolygons; + (this.polygonPool.freeAll(i), (i.length = 0)); + let n = this.convexPolygonsIndices; + (this.polygonIndicesPool.freeAll(n), (n.length = 0)); + let s = this.polygonIndicesPool.obtain(); + s.length = 0; + let o = this.polygonPool.obtain(); + o.length = 0; + let r = -1, + l = 0; + for (let e = 0, c = t.length; e < c; e += 3) { + let c = t[e] << 1, + d = t[e + 1] << 1, + u = t[e + 2] << 1, + h = a[c], + p = a[c + 1], + g = a[d], + m = a[d + 1], + f = a[u], + y = a[u + 1], + E = false; + if (r == c) { + let e = o.length - 4, + t = Yn.winding(o[e], o[e + 1], o[e + 2], o[e + 3], f, y), + a = Yn.winding(f, y, o[0], o[1], o[2], o[3]); + t == l && + a == l && + (o.push(f), o.push(y), s.push(u), (E = true)); + } + E || + (o.length > 0 + ? (i.push(o), n.push(s)) + : (this.polygonPool.free(o), this.polygonIndicesPool.free(s)), (o = this.polygonPool.obtain()), (o.length = 0), o.push(h), @@ -27124,39 +27097,39 @@ var version = "v1.17.2"; s.push(u), (l = Yn.winding(h, p, g, m, f, y)), (r = c)); - } - o.length > 0 && (i.push(o), n.push(s)); - for (let e = 0, t = i.length; e < t; e++) { - if (((s = n[e]), 0 == s.length)) continue; - let a = s[0], - r = s[s.length - 1]; - o = i[e]; - let l = o.length - 4, - c = o[l], - d = o[l + 1], - u = o[l + 2], - h = o[l + 3], - p = o[0], - g = o[1], - m = o[2], - f = o[3], - y = Yn.winding(c, d, u, h, p, g); - for (let l = 0; l < t; l++) { - if (l == e) continue; - let t = n[l]; - if (3 != t.length) continue; - let E = t[0], - b = t[1], - S = t[2], - I = i[l], - _ = I[I.length - 2], - v = I[I.length - 1]; - if (E != a || b != r) continue; - let T = Yn.winding(c, d, u, h, _, v), - R = Yn.winding(_, v, p, g, m, f); - T == y && - R == y && - ((I.length = 0), + } + o.length > 0 && (i.push(o), n.push(s)); + for (let e = 0, t = i.length; e < t; e++) { + if (((s = n[e]), 0 == s.length)) continue; + let a = s[0], + r = s[s.length - 1]; + o = i[e]; + let l = o.length - 4, + c = o[l], + d = o[l + 1], + u = o[l + 2], + h = o[l + 3], + p = o[0], + g = o[1], + m = o[2], + f = o[3], + y = Yn.winding(c, d, u, h, p, g); + for (let l = 0; l < t; l++) { + if (l == e) continue; + let t = n[l]; + if (3 != t.length) continue; + let E = t[0], + b = t[1], + S = t[2], + I = i[l], + _ = I[I.length - 2], + v = I[I.length - 1]; + if (E != a || b != r) continue; + let T = Yn.winding(c, d, u, h, _, v), + R = Yn.winding(_, v, p, g, m, f); + T == y && + R == y && + ((I.length = 0), (t.length = 0), o.push(_), o.push(v), @@ -27166,460 +27139,460 @@ var version = "v1.17.2"; (u = _), (h = v), (l = 0)); - } } - for (let e = i.length - 1; e >= 0; e--) - ((o = i[e]), - 0 == o.length && - (i.splice(e, 1), - this.polygonPool.free(o), - (s = n[e]), - n.splice(e, 1), - this.polygonIndicesPool.free(s))); - return i; - } - static isConcave(e, t, a, i) { - let n = i[(t + e - 1) % t] << 1, - s = i[e] << 1, - o = i[(e + 1) % t] << 1; - return !this.positiveArea( - a[n], - a[n + 1], - a[s], - a[s + 1], - a[o], - a[o + 1], - ); - } - static positiveArea(e, t, a, i, n, s) { - return e * (s - i) + a * (t - s) + n * (i - t) >= 0; - } - static winding(e, t, a, i, n, s) { - let o = a - e, - r = i - t; - return n * r - s * o + o * t - e * r >= 0 ? 1 : -1; } + for (let e = i.length - 1; e >= 0; e--) + ((o = i[e]), + 0 == o.length && + (i.splice(e, 1), + this.polygonPool.free(o), + (s = n[e]), + n.splice(e, 1), + this.polygonIndicesPool.free(s))); + return i; } - class Un { - constructor() { - ((this.triangulator = new Yn()), - (this.clippingPolygon = new Array()), - (this.clipOutput = new Array()), - (this.clippedVertices = new Array()), - (this.clippedTriangles = new Array()), - (this.scratch = new Array())); - } - clipStart(e, t) { - if (this.clipAttachment) return 0; - this.clipAttachment = t; - let a = t.worldVerticesLength, - i = ni.setArraySize(this.clippingPolygon, a); - t.computeWorldVertices(e, 0, a, i, 0, 2); - let n = this.clippingPolygon; - Un.makeClockwise(n); - let s = (this.clippingPolygons = this.triangulator.decompose( - n, - this.triangulator.triangulate(n), - )); - for (let e = 0, t = s.length; e < t; e++) { - let t = s[e]; - (Un.makeClockwise(t), t.push(t[0]), t.push(t[1])); - } - return s.length; - } - clipEndWithSlot(e) { - this.clipAttachment && - this.clipAttachment.endSlot == e.data && - this.clipEnd(); + static isConcave(e, t, a, i) { + let n = i[(t + e - 1) % t] << 1, + s = i[e] << 1, + o = i[(e + 1) % t] << 1; + return !this.positiveArea( + a[n], + a[n + 1], + a[s], + a[s + 1], + a[o], + a[o + 1], + ); + } + static positiveArea(e, t, a, i, n, s) { + return e * (s - i) + a * (t - s) + n * (i - t) >= 0; + } + static winding(e, t, a, i, n, s) { + let o = a - e, + r = i - t; + return n * r - s * o + o * t - e * r >= 0 ? 1 : -1; + } + } + class Un { + constructor() { + ((this.triangulator = new Yn()), + (this.clippingPolygon = new Array()), + (this.clipOutput = new Array()), + (this.clippedVertices = new Array()), + (this.clippedTriangles = new Array()), + (this.scratch = new Array())); + } + clipStart(e, t) { + if (this.clipAttachment) return 0; + this.clipAttachment = t; + let a = t.worldVerticesLength, + i = ni.setArraySize(this.clippingPolygon, a); + t.computeWorldVertices(e, 0, a, i, 0, 2); + let n = this.clippingPolygon; + Un.makeClockwise(n); + let s = (this.clippingPolygons = this.triangulator.decompose( + n, + this.triangulator.triangulate(n), + )); + for (let e = 0, t = s.length; e < t; e++) { + let t = s[e]; + (Un.makeClockwise(t), t.push(t[0]), t.push(t[1])); } - clipEnd() { - this.clipAttachment && - ((this.clipAttachment = null), + return s.length; + } + clipEndWithSlot(e) { + this.clipAttachment && + this.clipAttachment.endSlot == e.data && + this.clipEnd(); + } + clipEnd() { + this.clipAttachment && + ((this.clipAttachment = null), (this.clippingPolygons = null), (this.clippedVertices.length = 0), (this.clippedTriangles.length = 0), (this.clippingPolygon.length = 0)); - } - isClipping() { - return null != this.clipAttachment; - } - clipTriangles(e, t, a, i, n, s, o, r) { - let l = this.clipOutput, - c = this.clippedVertices, - d = this.clippedTriangles, - u = this.clippingPolygons, - h = this.clippingPolygons.length, - p = r ? 12 : 8, - g = 0; - ((c.length = 0), (d.length = 0)); - e: for (let t = 0; t < i; t += 3) { - let i = a[t] << 1, - m = e[i], - f = e[i + 1], - y = n[i], - E = n[i + 1]; - i = a[t + 1] << 1; - let b = e[i], - S = e[i + 1], - I = n[i], - _ = n[i + 1]; - i = a[t + 2] << 1; - let v = e[i], - T = e[i + 1], - R = n[i], - O = n[i + 1]; - for (let e = 0; e < h; e++) { - let t = c.length; - if (!this.clip(m, f, b, S, v, T, u[e], l)) { - let e = ni.setArraySize(c, t + 3 * p); - ((e[t] = m), - (e[t + 1] = f), - (e[t + 2] = s.r), - (e[t + 3] = s.g), - (e[t + 4] = s.b), - (e[t + 5] = s.a), - r - ? ((e[t + 6] = y), - (e[t + 7] = E), - (e[t + 8] = o.r), - (e[t + 9] = o.g), - (e[t + 10] = o.b), - (e[t + 11] = o.a), - (e[t + 12] = b), - (e[t + 13] = S), - (e[t + 14] = s.r), - (e[t + 15] = s.g), - (e[t + 16] = s.b), - (e[t + 17] = s.a), - (e[t + 18] = I), - (e[t + 19] = _), - (e[t + 20] = o.r), - (e[t + 21] = o.g), - (e[t + 22] = o.b), - (e[t + 23] = o.a), - (e[t + 24] = v), - (e[t + 25] = T), - (e[t + 26] = s.r), - (e[t + 27] = s.g), - (e[t + 28] = s.b), - (e[t + 29] = s.a), - (e[t + 30] = R), - (e[t + 31] = O), - (e[t + 32] = o.r), - (e[t + 33] = o.g), - (e[t + 34] = o.b), - (e[t + 35] = o.a)) - : ((e[t + 6] = y), - (e[t + 7] = E), - (e[t + 8] = b), - (e[t + 9] = S), - (e[t + 10] = s.r), - (e[t + 11] = s.g), - (e[t + 12] = s.b), - (e[t + 13] = s.a), - (e[t + 14] = I), - (e[t + 15] = _), - (e[t + 16] = v), - (e[t + 17] = T), - (e[t + 18] = s.r), - (e[t + 19] = s.g), - (e[t + 20] = s.b), - (e[t + 21] = s.a), - (e[t + 22] = R), - (e[t + 23] = O)), - (t = d.length)); - let a = ni.setArraySize(d, t + 3); - ((a[t] = g), - (a[t + 1] = g + 1), - (a[t + 2] = g + 2), - (g += 3)); - continue e; - } - { - let e = l.length; - if (0 == e) continue; - let a = S - T, - i = v - b, - n = m - v, - u = T - f, - h = 1 / (a * n + i * (f - T)), - C = e >> 1, - w = this.clipOutput, - A = ni.setArraySize(c, t + C * p); - for (let l = 0; l < e; l += 2) { - let e = w[l], - c = w[l + 1]; - ((A[t] = e), - (A[t + 1] = c), - (A[t + 2] = s.r), - (A[t + 3] = s.g), - (A[t + 4] = s.b), - (A[t + 5] = s.a)); - let d = e - v, - g = c - T, - m = (a * d + i * g) * h, - f = (u * d + n * g) * h, - b = 1 - m - f; - ((A[t + 6] = y * m + I * f + R * b), - (A[t + 7] = E * m + _ * f + O * b), - r && - ((A[t + 8] = o.r), - (A[t + 9] = o.g), - (A[t + 10] = o.b), - (A[t + 11] = o.a)), - (t += p)); - } - t = d.length; - let k = ni.setArraySize(d, t + 3 * (C - 2)); - C--; - for (let e = 1; e < C; e++) - ((k[t] = g), - (k[t + 1] = g + e), - (k[t + 2] = g + e + 1), - (t += 3)); - g += C + 1; + } + isClipping() { + return null != this.clipAttachment; + } + clipTriangles(e, t, a, i, n, s, o, r) { + let l = this.clipOutput, + c = this.clippedVertices, + d = this.clippedTriangles, + u = this.clippingPolygons, + h = this.clippingPolygons.length, + p = r ? 12 : 8, + g = 0; + ((c.length = 0), (d.length = 0)); + e: for (let t = 0; t < i; t += 3) { + let i = a[t] << 1, + m = e[i], + f = e[i + 1], + y = n[i], + E = n[i + 1]; + i = a[t + 1] << 1; + let b = e[i], + S = e[i + 1], + I = n[i], + _ = n[i + 1]; + i = a[t + 2] << 1; + let v = e[i], + T = e[i + 1], + R = n[i], + O = n[i + 1]; + for (let e = 0; e < h; e++) { + let t = c.length; + if (!this.clip(m, f, b, S, v, T, u[e], l)) { + let e = ni.setArraySize(c, t + 3 * p); + ((e[t] = m), + (e[t + 1] = f), + (e[t + 2] = s.r), + (e[t + 3] = s.g), + (e[t + 4] = s.b), + (e[t + 5] = s.a), + r + ? ((e[t + 6] = y), + (e[t + 7] = E), + (e[t + 8] = o.r), + (e[t + 9] = o.g), + (e[t + 10] = o.b), + (e[t + 11] = o.a), + (e[t + 12] = b), + (e[t + 13] = S), + (e[t + 14] = s.r), + (e[t + 15] = s.g), + (e[t + 16] = s.b), + (e[t + 17] = s.a), + (e[t + 18] = I), + (e[t + 19] = _), + (e[t + 20] = o.r), + (e[t + 21] = o.g), + (e[t + 22] = o.b), + (e[t + 23] = o.a), + (e[t + 24] = v), + (e[t + 25] = T), + (e[t + 26] = s.r), + (e[t + 27] = s.g), + (e[t + 28] = s.b), + (e[t + 29] = s.a), + (e[t + 30] = R), + (e[t + 31] = O), + (e[t + 32] = o.r), + (e[t + 33] = o.g), + (e[t + 34] = o.b), + (e[t + 35] = o.a)) + : ((e[t + 6] = y), + (e[t + 7] = E), + (e[t + 8] = b), + (e[t + 9] = S), + (e[t + 10] = s.r), + (e[t + 11] = s.g), + (e[t + 12] = s.b), + (e[t + 13] = s.a), + (e[t + 14] = I), + (e[t + 15] = _), + (e[t + 16] = v), + (e[t + 17] = T), + (e[t + 18] = s.r), + (e[t + 19] = s.g), + (e[t + 20] = s.b), + (e[t + 21] = s.a), + (e[t + 22] = R), + (e[t + 23] = O)), + (t = d.length)); + let a = ni.setArraySize(d, t + 3); + ((a[t] = g), + (a[t + 1] = g + 1), + (a[t + 2] = g + 2), + (g += 3)); + continue e; + } + { + let e = l.length; + if (0 == e) continue; + let a = S - T, + i = v - b, + n = m - v, + u = T - f, + h = 1 / (a * n + i * (f - T)), + C = e >> 1, + w = this.clipOutput, + A = ni.setArraySize(c, t + C * p); + for (let l = 0; l < e; l += 2) { + let e = w[l], + c = w[l + 1]; + ((A[t] = e), + (A[t + 1] = c), + (A[t + 2] = s.r), + (A[t + 3] = s.g), + (A[t + 4] = s.b), + (A[t + 5] = s.a)); + let d = e - v, + g = c - T, + m = (a * d + i * g) * h, + f = (u * d + n * g) * h, + b = 1 - m - f; + ((A[t + 6] = y * m + I * f + R * b), + (A[t + 7] = E * m + _ * f + O * b), + r && + ((A[t + 8] = o.r), + (A[t + 9] = o.g), + (A[t + 10] = o.b), + (A[t + 11] = o.a)), + (t += p)); } + t = d.length; + let k = ni.setArraySize(d, t + 3 * (C - 2)); + C--; + for (let e = 1; e < C; e++) + ((k[t] = g), + (k[t + 1] = g + e), + (k[t + 2] = g + e + 1), + (t += 3)); + g += C + 1; } } } - clip(e, t, a, i, n, s, o, r) { - let l = r, - c = false, - d = null; - (o.length % 4 >= 2 - ? ((d = r), (r = this.scratch)) - : (d = this.scratch), - (d.length = 0), - d.push(e), - d.push(t), - d.push(a), - d.push(i), - d.push(n), - d.push(s), - d.push(e), - d.push(t), - (r.length = 0)); - let u = o, - h = o.length - 4; - for (let e = 0; ; e += 2) { - let t = u[e], - a = u[e + 1], - i = u[e + 2], - n = u[e + 3], - s = t - i, - o = a - n, - p = d, - g = d.length - 2, - m = r.length; - for (let e = 0; e < g; e += 2) { - let l = p[e], - d = p[e + 1], - u = p[e + 2], - h = p[e + 3], - g = s * (h - n) - o * (u - i) > 0; - if (s * (d - n) - o * (l - i) > 0) { - if (g) { - (r.push(u), r.push(h)); - continue; - } - let e = h - d, - s = u - l, - o = e * (i - t) - s * (n - a); - if (Math.abs(o) > 1e-6) { - let c = (s * (a - d) - e * (t - l)) / o; - (r.push(t + (i - t) * c), r.push(a + (n - a) * c)); - } else (r.push(t), r.push(a)); - } else if (g) { - let e = h - d, - s = u - l, - o = e * (i - t) - s * (n - a); - if (Math.abs(o) > 1e-6) { - let c = (s * (a - d) - e * (t - l)) / o; - (r.push(t + (i - t) * c), r.push(a + (n - a) * c)); - } else (r.push(t), r.push(a)); + } + clip(e, t, a, i, n, s, o, r) { + let l = r, + c = false, + d = null; + (o.length % 4 >= 2 + ? ((d = r), (r = this.scratch)) + : (d = this.scratch), + (d.length = 0), + d.push(e), + d.push(t), + d.push(a), + d.push(i), + d.push(n), + d.push(s), + d.push(e), + d.push(t), + (r.length = 0)); + let u = o, + h = o.length - 4; + for (let e = 0; ; e += 2) { + let t = u[e], + a = u[e + 1], + i = u[e + 2], + n = u[e + 3], + s = t - i, + o = a - n, + p = d, + g = d.length - 2, + m = r.length; + for (let e = 0; e < g; e += 2) { + let l = p[e], + d = p[e + 1], + u = p[e + 2], + h = p[e + 3], + g = s * (h - n) - o * (u - i) > 0; + if (s * (d - n) - o * (l - i) > 0) { + if (g) { (r.push(u), r.push(h)); + continue; } - c = true; + let e = h - d, + s = u - l, + o = e * (i - t) - s * (n - a); + if (Math.abs(o) > 1e-6) { + let c = (s * (a - d) - e * (t - l)) / o; + (r.push(t + (i - t) * c), r.push(a + (n - a) * c)); + } else (r.push(t), r.push(a)); + } else if (g) { + let e = h - d, + s = u - l, + o = e * (i - t) - s * (n - a); + if (Math.abs(o) > 1e-6) { + let c = (s * (a - d) - e * (t - l)) / o; + (r.push(t + (i - t) * c), r.push(a + (n - a) * c)); + } else (r.push(t), r.push(a)); + (r.push(u), r.push(h)); } - if (m == r.length) return ((l.length = 0), true); - if ((r.push(r[0]), r.push(r[1]), e == h)) break; - let f = r; - (((r = d).length = 0), (d = f)); + c = true; } - if (l != r) { - l.length = 0; - for (let e = 0, t = r.length - 2; e < t; e++) l[e] = r[e]; - } else l.length = l.length - 2; - return c; - } - static makeClockwise(e) { - let t = e, - a = e.length, - i = t[a - 2] * t[1] - t[0] * t[a - 1], - n = 0, - s = 0, - o = 0, - r = 0; - for (let e = 0, l = a - 3; e < l; e += 2) - ((n = t[e]), - (s = t[e + 1]), - (o = t[e + 2]), - (r = t[e + 3]), - (i += n * r - o * s)); - if (!(i < 0)) - for (let e = 0, i = a - 2, n = a >> 1; e < n; e += 2) { - let a = t[e], - n = t[e + 1], - s = i - e; - ((t[e] = t[s]), - (t[e + 1] = t[s + 1]), - (t[s] = a), - (t[s + 1] = n)); - } - } + if (m == r.length) return ((l.length = 0), true); + if ((r.push(r[0]), r.push(r[1]), e == h)) break; + let f = r; + (((r = d).length = 0), (d = f)); + } + if (l != r) { + l.length = 0; + for (let e = 0, t = r.length - 2; e < t; e++) l[e] = r[e]; + } else l.length = l.length - 2; + return c; } - class jn { - constructor(e) { - this.name = e; - } + static makeClockwise(e) { + let t = e, + a = e.length, + i = t[a - 2] * t[1] - t[0] * t[a - 1], + n = 0, + s = 0, + o = 0, + r = 0; + for (let e = 0, l = a - 3; e < l; e += 2) + ((n = t[e]), + (s = t[e + 1]), + (o = t[e + 2]), + (r = t[e + 3]), + (i += n * r - o * s)); + if (!(i < 0)) + for (let e = 0, i = a - 2, n = a >> 1; e < n; e += 2) { + let a = t[e], + n = t[e + 1], + s = i - e; + ((t[e] = t[s]), + (t[e + 1] = t[s + 1]), + (t[s] = a), + (t[s + 1] = n)); + } } - class Gn { - constructor(e, t) { - if (!t) throw new Error("data cannot be null."); - ((this.time = e), (this.data = t)); - } + } + class jn { + constructor(e) { + this.name = e; } - class Vn extends An { - constructor(e) { - (super(e, 0, false), - (this.bones = new Array()), - (this.bendDirection = 1), - (this.compress = false), - (this.stretch = false), - (this.uniform = false), - (this.mix = 1), - (this.softness = 0)); - } + } + class Gn { + constructor(e, t) { + if (!t) throw new Error("data cannot be null."); + ((this.time = e), (this.data = t)); } - class Hn { - constructor() { - ((this.bones = new Array()), - (this.slots = new Array()), - (this.skins = new Array()), - (this.events = new Array()), - (this.animations = new Array()), - (this.ikConstraints = new Array()), - (this.transformConstraints = new Array()), - (this.pathConstraints = new Array()), - (this.fps = 0)); - } - findBone(e) { - if (!e) throw new Error("boneName cannot be null."); - let t = this.bones; - for (let a = 0, i = t.length; a < i; a++) { - let i = t[a]; - if (i.name == e) return i; - } - return null; - } - findSlot(e) { - if (!e) throw new Error("slotName cannot be null."); - let t = this.slots; - for (let a = 0, i = t.length; a < i; a++) { - let i = t[a]; - if (i.name == e) return i; - } - return null; - } - findSkin(e) { - if (!e) throw new Error("skinName cannot be null."); - let t = this.skins; - for (let a = 0, i = t.length; a < i; a++) { - let i = t[a]; - if (i.name == e) return i; - } - return null; - } - findEvent(e) { - if (!e) throw new Error("eventDataName cannot be null."); - let t = this.events; - for (let a = 0, i = t.length; a < i; a++) { - let i = t[a]; - if (i.name == e) return i; - } - return null; - } - findAnimation(e) { - if (!e) throw new Error("animationName cannot be null."); - let t = this.animations; - for (let a = 0, i = t.length; a < i; a++) { - let i = t[a]; - if (i.name == e) return i; - } - return null; - } - findIkConstraint(e) { - if (!e) throw new Error("constraintName cannot be null."); - let t = this.ikConstraints; - for (let a = 0, i = t.length; a < i; a++) { - let i = t[a]; - if (i.name == e) return i; - } - return null; - } - findTransformConstraint(e) { - if (!e) throw new Error("constraintName cannot be null."); - let t = this.transformConstraints; - for (let a = 0, i = t.length; a < i; a++) { - let i = t[a]; - if (i.name == e) return i; - } - return null; - } - findPathConstraint(e) { - if (!e) throw new Error("constraintName cannot be null."); - let t = this.pathConstraints; - for (let a = 0, i = t.length; a < i; a++) { - let i = t[a]; - if (i.name == e) return i; - } - return null; - } + } + class Vn extends An { + constructor(e) { + (super(e, 0, false), + (this.bones = new Array()), + (this.bendDirection = 1), + (this.compress = false), + (this.stretch = false), + (this.uniform = false), + (this.mix = 1), + (this.softness = 0)); } - class Xn extends An { - constructor(e) { - (super(e, 0, false), - (this.bones = new Array()), - (this.mixRotate = 0), - (this.mixX = 0), - (this.mixY = 0), - (this.mixScaleX = 0), - (this.mixScaleY = 0), - (this.mixShearY = 0), - (this.offsetRotation = 0), - (this.offsetX = 0), - (this.offsetY = 0), - (this.offsetScaleX = 0), - (this.offsetScaleY = 0), - (this.offsetShearY = 0), - (this.relative = false), - (this.local = false)); - } + } + class Hn { + constructor() { + ((this.bones = new Array()), + (this.slots = new Array()), + (this.skins = new Array()), + (this.events = new Array()), + (this.animations = new Array()), + (this.ikConstraints = new Array()), + (this.transformConstraints = new Array()), + (this.pathConstraints = new Array()), + (this.fps = 0)); } - class zn { - constructor(e) { - ((this.scale = 1), - (this.linkedMeshes = new Array()), - (this.attachmentLoader = e)); - } - readSkeletonData(e) { - let t = this.scale, - a = new Hn(), - i = "string" == typeof e ? JSON.parse(e) : e, - n = i.skeleton; - if ( - (n && - ((a.hash = n.hash), + findBone(e) { + if (!e) throw new Error("boneName cannot be null."); + let t = this.bones; + for (let a = 0, i = t.length; a < i; a++) { + let i = t[a]; + if (i.name == e) return i; + } + return null; + } + findSlot(e) { + if (!e) throw new Error("slotName cannot be null."); + let t = this.slots; + for (let a = 0, i = t.length; a < i; a++) { + let i = t[a]; + if (i.name == e) return i; + } + return null; + } + findSkin(e) { + if (!e) throw new Error("skinName cannot be null."); + let t = this.skins; + for (let a = 0, i = t.length; a < i; a++) { + let i = t[a]; + if (i.name == e) return i; + } + return null; + } + findEvent(e) { + if (!e) throw new Error("eventDataName cannot be null."); + let t = this.events; + for (let a = 0, i = t.length; a < i; a++) { + let i = t[a]; + if (i.name == e) return i; + } + return null; + } + findAnimation(e) { + if (!e) throw new Error("animationName cannot be null."); + let t = this.animations; + for (let a = 0, i = t.length; a < i; a++) { + let i = t[a]; + if (i.name == e) return i; + } + return null; + } + findIkConstraint(e) { + if (!e) throw new Error("constraintName cannot be null."); + let t = this.ikConstraints; + for (let a = 0, i = t.length; a < i; a++) { + let i = t[a]; + if (i.name == e) return i; + } + return null; + } + findTransformConstraint(e) { + if (!e) throw new Error("constraintName cannot be null."); + let t = this.transformConstraints; + for (let a = 0, i = t.length; a < i; a++) { + let i = t[a]; + if (i.name == e) return i; + } + return null; + } + findPathConstraint(e) { + if (!e) throw new Error("constraintName cannot be null."); + let t = this.pathConstraints; + for (let a = 0, i = t.length; a < i; a++) { + let i = t[a]; + if (i.name == e) return i; + } + return null; + } + } + class Xn extends An { + constructor(e) { + (super(e, 0, false), + (this.bones = new Array()), + (this.mixRotate = 0), + (this.mixX = 0), + (this.mixY = 0), + (this.mixScaleX = 0), + (this.mixScaleY = 0), + (this.mixShearY = 0), + (this.offsetRotation = 0), + (this.offsetX = 0), + (this.offsetY = 0), + (this.offsetScaleX = 0), + (this.offsetScaleY = 0), + (this.offsetShearY = 0), + (this.relative = false), + (this.local = false)); + } + } + class zn { + constructor(e) { + ((this.scale = 1), + (this.linkedMeshes = new Array()), + (this.attachmentLoader = e)); + } + readSkeletonData(e) { + let t = this.scale, + a = new Hn(), + i = "string" == typeof e ? JSON.parse(e) : e, + n = i.skeleton; + if ( + (n && + ((a.hash = n.hash), (a.version = n.spine), (a.x = n.x), (a.y = n.y), @@ -27628,1530 +27601,1369 @@ var version = "v1.17.2"; (a.fps = n.fps), (a.imagesPath = n.images)), i.bones) - ) - for (let e = 0; e < i.bones.length; e++) { - let n = i.bones[e], - s = null, - o = Kn(n, "parent", null); - o && (s = a.findBone(o)); - let r = new Rn(a.bones.length, n.name, s); - ((r.length = Kn(n, "length", 0) * t), - (r.x = Kn(n, "x", 0) * t), - (r.y = Kn(n, "y", 0) * t), - (r.rotation = Kn(n, "rotation", 0)), - (r.scaleX = Kn(n, "scaleX", 1)), - (r.scaleY = Kn(n, "scaleY", 1)), - (r.shearX = Kn(n, "shearX", 0)), - (r.shearY = Kn(n, "shearY", 0)), - (r.transformMode = ni.enumValue( - ln, - Kn(n, "transform", "Normal"), - )), - (r.skinRequired = Kn(n, "skin", false))); - let l = Kn(n, "color", null); - (l && r.color.setFromString(l), a.bones.push(r)); - } - if (i.slots) - for (let e = 0; e < i.slots.length; e++) { - let t = i.slots[e], - n = a.findBone(t.bone), - s = new Bn(a.slots.length, t.name, n), - o = Kn(t, "color", null); - o && s.color.setFromString(o); - let r = Kn(t, "dark", null); - (r && (s.darkColor = ai.fromString(r)), - (s.attachmentName = Kn(t, "attachment", null)), - (s.blendMode = ni.enumValue(hn, Kn(t, "blend", "normal"))), - a.slots.push(s)); - } - if (i.ik) - for (let e = 0; e < i.ik.length; e++) { - let n = i.ik[e], - s = new Vn(n.name); - ((s.order = Kn(n, "order", 0)), - (s.skinRequired = Kn(n, "skin", false))); - for (let e = 0; e < n.bones.length; e++) - s.bones.push(a.findBone(n.bones[e])); - ((s.target = a.findBone(n.target)), - (s.mix = Kn(n, "mix", 1)), - (s.softness = Kn(n, "softness", 0) * t), - (s.bendDirection = Kn(n, "bendPositive", true) ? 1 : -1), - (s.compress = Kn(n, "compress", false)), - (s.stretch = Kn(n, "stretch", false)), - (s.uniform = Kn(n, "uniform", false)), - a.ikConstraints.push(s)); - } - if (i.transform) - for (let e = 0; e < i.transform.length; e++) { - let n = i.transform[e], - s = new Xn(n.name); - ((s.order = Kn(n, "order", 0)), - (s.skinRequired = Kn(n, "skin", false))); - for (let e = 0; e < n.bones.length; e++) - s.bones.push(a.findBone(n.bones[e])); - let o = n.target; - ((s.target = a.findBone(o)), - (s.local = Kn(n, "local", false)), - (s.relative = Kn(n, "relative", false)), - (s.offsetRotation = Kn(n, "rotation", 0)), - (s.offsetX = Kn(n, "x", 0) * t), - (s.offsetY = Kn(n, "y", 0) * t), - (s.offsetScaleX = Kn(n, "scaleX", 0)), - (s.offsetScaleY = Kn(n, "scaleY", 0)), - (s.offsetShearY = Kn(n, "shearY", 0)), - (s.mixRotate = Kn(n, "mixRotate", 1)), - (s.mixX = Kn(n, "mixX", 1)), - (s.mixY = Kn(n, "mixY", s.mixX)), - (s.mixScaleX = Kn(n, "mixScaleX", 1)), - (s.mixScaleY = Kn(n, "mixScaleY", s.mixScaleX)), - (s.mixShearY = Kn(n, "mixShearY", 1)), - a.transformConstraints.push(s)); - } - if (i.path) - for (let e = 0; e < i.path.length; e++) { - let n = i.path[e], - s = new kn(n.name); - ((s.order = Kn(n, "order", 0)), - (s.skinRequired = Kn(n, "skin", false))); - for (let e = 0; e < n.bones.length; e++) - s.bones.push(a.findBone(n.bones[e])); - let o = n.target; - ((s.target = a.findSlot(o)), - (s.positionMode = ni.enumValue( - cn, - Kn(n, "positionMode", "Percent"), - )), - (s.spacingMode = ni.enumValue( - dn, - Kn(n, "spacingMode", "Length"), - )), - (s.rotateMode = ni.enumValue( - un, - Kn(n, "rotateMode", "Tangent"), - )), - (s.offsetRotation = Kn(n, "rotation", 0)), - (s.position = Kn(n, "position", 0)), - s.positionMode == cn.Fixed && (s.position *= t), - (s.spacing = Kn(n, "spacing", 0)), - (s.spacingMode != dn.Length && s.spacingMode != dn.Fixed) || - (s.spacing *= t), - (s.mixRotate = Kn(n, "mixRotate", 1)), - (s.mixX = Kn(n, "mixX", 1)), - (s.mixY = Kn(n, "mixY", s.mixX)), - a.pathConstraints.push(s)); - } - if (i.skins) - for (let e = 0; e < i.skins.length; e++) { - let t = i.skins[e], - n = new Dn(t.name); - if (t.bones) - for (let e = 0; e < t.bones.length; e++) - n.bones.push(a.findBone(t.bones[e])); - if (t.ik) - for (let e = 0; e < t.ik.length; e++) - n.constraints.push(a.findIkConstraint(t.ik[e])); - if (t.transform) - for (let e = 0; e < t.transform.length; e++) - n.constraints.push( - a.findTransformConstraint(t.transform[e]), - ); - if (t.path) - for (let e = 0; e < t.path.length; e++) - n.constraints.push(a.findPathConstraint(t.path[e])); - for (let e in t.attachments) { - let i = a.findSlot(e), - s = t.attachments[e]; - for (let e in s) { - let t = this.readAttachment(s[e], n, i.index, e, a); - t && n.setAttachment(i.index, e, t); - } + ) + for (let e = 0; e < i.bones.length; e++) { + let n = i.bones[e], + s = null, + o = Kn(n, "parent", null); + o && (s = a.findBone(o)); + let r = new Rn(a.bones.length, n.name, s); + ((r.length = Kn(n, "length", 0) * t), + (r.x = Kn(n, "x", 0) * t), + (r.y = Kn(n, "y", 0) * t), + (r.rotation = Kn(n, "rotation", 0)), + (r.scaleX = Kn(n, "scaleX", 1)), + (r.scaleY = Kn(n, "scaleY", 1)), + (r.shearX = Kn(n, "shearX", 0)), + (r.shearY = Kn(n, "shearY", 0)), + (r.transformMode = ni.enumValue( + ln, + Kn(n, "transform", "Normal"), + )), + (r.skinRequired = Kn(n, "skin", false))); + let l = Kn(n, "color", null); + (l && r.color.setFromString(l), a.bones.push(r)); + } + if (i.slots) + for (let e = 0; e < i.slots.length; e++) { + let t = i.slots[e], + n = a.findBone(t.bone), + s = new Bn(a.slots.length, t.name, n), + o = Kn(t, "color", null); + o && s.color.setFromString(o); + let r = Kn(t, "dark", null); + (r && (s.darkColor = ai.fromString(r)), + (s.attachmentName = Kn(t, "attachment", null)), + (s.blendMode = ni.enumValue(hn, Kn(t, "blend", "normal"))), + a.slots.push(s)); + } + if (i.ik) + for (let e = 0; e < i.ik.length; e++) { + let n = i.ik[e], + s = new Vn(n.name); + ((s.order = Kn(n, "order", 0)), + (s.skinRequired = Kn(n, "skin", false))); + for (let e = 0; e < n.bones.length; e++) + s.bones.push(a.findBone(n.bones[e])); + ((s.target = a.findBone(n.target)), + (s.mix = Kn(n, "mix", 1)), + (s.softness = Kn(n, "softness", 0) * t), + (s.bendDirection = Kn(n, "bendPositive", true) ? 1 : -1), + (s.compress = Kn(n, "compress", false)), + (s.stretch = Kn(n, "stretch", false)), + (s.uniform = Kn(n, "uniform", false)), + a.ikConstraints.push(s)); + } + if (i.transform) + for (let e = 0; e < i.transform.length; e++) { + let n = i.transform[e], + s = new Xn(n.name); + ((s.order = Kn(n, "order", 0)), + (s.skinRequired = Kn(n, "skin", false))); + for (let e = 0; e < n.bones.length; e++) + s.bones.push(a.findBone(n.bones[e])); + let o = n.target; + ((s.target = a.findBone(o)), + (s.local = Kn(n, "local", false)), + (s.relative = Kn(n, "relative", false)), + (s.offsetRotation = Kn(n, "rotation", 0)), + (s.offsetX = Kn(n, "x", 0) * t), + (s.offsetY = Kn(n, "y", 0) * t), + (s.offsetScaleX = Kn(n, "scaleX", 0)), + (s.offsetScaleY = Kn(n, "scaleY", 0)), + (s.offsetShearY = Kn(n, "shearY", 0)), + (s.mixRotate = Kn(n, "mixRotate", 1)), + (s.mixX = Kn(n, "mixX", 1)), + (s.mixY = Kn(n, "mixY", s.mixX)), + (s.mixScaleX = Kn(n, "mixScaleX", 1)), + (s.mixScaleY = Kn(n, "mixScaleY", s.mixScaleX)), + (s.mixShearY = Kn(n, "mixShearY", 1)), + a.transformConstraints.push(s)); + } + if (i.path) + for (let e = 0; e < i.path.length; e++) { + let n = i.path[e], + s = new kn(n.name); + ((s.order = Kn(n, "order", 0)), + (s.skinRequired = Kn(n, "skin", false))); + for (let e = 0; e < n.bones.length; e++) + s.bones.push(a.findBone(n.bones[e])); + let o = n.target; + ((s.target = a.findSlot(o)), + (s.positionMode = ni.enumValue( + cn, + Kn(n, "positionMode", "Percent"), + )), + (s.spacingMode = ni.enumValue( + dn, + Kn(n, "spacingMode", "Length"), + )), + (s.rotateMode = ni.enumValue( + un, + Kn(n, "rotateMode", "Tangent"), + )), + (s.offsetRotation = Kn(n, "rotation", 0)), + (s.position = Kn(n, "position", 0)), + s.positionMode == cn.Fixed && (s.position *= t), + (s.spacing = Kn(n, "spacing", 0)), + (s.spacingMode != dn.Length && s.spacingMode != dn.Fixed) || + (s.spacing *= t), + (s.mixRotate = Kn(n, "mixRotate", 1)), + (s.mixX = Kn(n, "mixX", 1)), + (s.mixY = Kn(n, "mixY", s.mixX)), + a.pathConstraints.push(s)); + } + if (i.skins) + for (let e = 0; e < i.skins.length; e++) { + let t = i.skins[e], + n = new Dn(t.name); + if (t.bones) + for (let e = 0; e < t.bones.length; e++) + n.bones.push(a.findBone(t.bones[e])); + if (t.ik) + for (let e = 0; e < t.ik.length; e++) + n.constraints.push(a.findIkConstraint(t.ik[e])); + if (t.transform) + for (let e = 0; e < t.transform.length; e++) + n.constraints.push( + a.findTransformConstraint(t.transform[e]), + ); + if (t.path) + for (let e = 0; e < t.path.length; e++) + n.constraints.push(a.findPathConstraint(t.path[e])); + for (let e in t.attachments) { + let i = a.findSlot(e), + s = t.attachments[e]; + for (let e in s) { + let t = this.readAttachment(s[e], n, i.index, e, a); + t && n.setAttachment(i.index, e, t); } - (a.skins.push(n), "default" == n.name && (a.defaultSkin = n)); } - for (let e = 0, t = this.linkedMeshes.length; e < t; e++) { - let t = this.linkedMeshes[e], - i = (t.skin ? a.findSkin(t.skin) : a.defaultSkin).getAttachment( - t.slotIndex, - t.parent, - ); - ((t.mesh.timelineAttahment = t.inheritTimeline ? i : t.mesh), - t.mesh.setParentMesh(i), - null != t.mesh.region && t.mesh.updateRegion()); + (a.skins.push(n), "default" == n.name && (a.defaultSkin = n)); } - if (((this.linkedMeshes.length = 0), i.events)) - for (let e in i.events) { - let t = i.events[e], - n = new jn(e); - ((n.intValue = Kn(t, "int", 0)), - (n.floatValue = Kn(t, "float", 0)), - (n.stringValue = Kn(t, "string", "")), - (n.audioPath = Kn(t, "audio", null)), - n.audioPath && - ((n.volume = Kn(t, "volume", 1)), - (n.balance = Kn(t, "balance", 0))), - a.events.push(n)); - } - if (i.animations) - for (let e in i.animations) { - let t = i.animations[e]; - this.readAnimation(t, e, a); - } - return a; - } - readAttachment(e, t, a, i, n) { - let s = this.scale; - switch (((i = Kn(e, "name", i)), Kn(e, "type", "region"))) { - case "region": { - let a = Kn(e, "path", i), - n = this.readSequence(Kn(e, "sequence", null)), - o = this.attachmentLoader.newRegionAttachment(t, i, a, n); - if (!o) return null; - ((o.path = a), - (o.x = Kn(e, "x", 0) * s), - (o.y = Kn(e, "y", 0) * s), - (o.scaleX = Kn(e, "scaleX", 1)), - (o.scaleY = Kn(e, "scaleY", 1)), - (o.rotation = Kn(e, "rotation", 0)), - (o.width = e.width * s), - (o.height = e.height * s), - (o.sequence = n)); - let r = Kn(e, "color", null); + for (let e = 0, t = this.linkedMeshes.length; e < t; e++) { + let t = this.linkedMeshes[e], + i = (t.skin ? a.findSkin(t.skin) : a.defaultSkin).getAttachment( + t.slotIndex, + t.parent, + ); + ((t.mesh.timelineAttahment = t.inheritTimeline ? i : t.mesh), + t.mesh.setParentMesh(i), + null != t.mesh.region && t.mesh.updateRegion()); + } + if (((this.linkedMeshes.length = 0), i.events)) + for (let e in i.events) { + let t = i.events[e], + n = new jn(e); + ((n.intValue = Kn(t, "int", 0)), + (n.floatValue = Kn(t, "float", 0)), + (n.stringValue = Kn(t, "string", "")), + (n.audioPath = Kn(t, "audio", null)), + n.audioPath && + ((n.volume = Kn(t, "volume", 1)), + (n.balance = Kn(t, "balance", 0))), + a.events.push(n)); + } + if (i.animations) + for (let e in i.animations) { + let t = i.animations[e]; + this.readAnimation(t, e, a); + } + return a; + } + readAttachment(e, t, a, i, n) { + let s = this.scale; + switch (((i = Kn(e, "name", i)), Kn(e, "type", "region"))) { + case "region": { + let a = Kn(e, "path", i), + n = this.readSequence(Kn(e, "sequence", null)), + o = this.attachmentLoader.newRegionAttachment(t, i, a, n); + if (!o) return null; + ((o.path = a), + (o.x = Kn(e, "x", 0) * s), + (o.y = Kn(e, "y", 0) * s), + (o.scaleX = Kn(e, "scaleX", 1)), + (o.scaleY = Kn(e, "scaleY", 1)), + (o.rotation = Kn(e, "rotation", 0)), + (o.width = e.width * s), + (o.height = e.height * s), + (o.sequence = n)); + let r = Kn(e, "color", null); + return ( + r && o.color.setFromString(r), + null != o.region && o.updateRegion(), + o + ); + } + case "boundingbox": { + let a = this.attachmentLoader.newBoundingBoxAttachment(t, i); + if (!a) return null; + this.readVertices(e, a, e.vertexCount << 1); + let n = Kn(e, "color", null); + return (n && a.color.setFromString(n), a); + } + case "mesh": + case "linkedmesh": { + let n = Kn(e, "path", i), + o = this.readSequence(Kn(e, "sequence", null)), + r = this.attachmentLoader.newMeshAttachment(t, i, n, o); + if (!r) return null; + r.path = n; + let l = Kn(e, "color", null); + (l && r.color.setFromString(l), + (r.width = Kn(e, "width", 0) * s), + (r.height = Kn(e, "height", 0) * s), + (r.sequence = o)); + let c = Kn(e, "parent", null); + if (c) return ( - r && o.color.setFromString(r), - null != o.region && o.updateRegion(), - o - ); - } - case "boundingbox": { - let a = this.attachmentLoader.newBoundingBoxAttachment(t, i); - if (!a) return null; - this.readVertices(e, a, e.vertexCount << 1); - let n = Kn(e, "color", null); - return (n && a.color.setFromString(n), a); - } - case "mesh": - case "linkedmesh": { - let n = Kn(e, "path", i), - o = this.readSequence(Kn(e, "sequence", null)), - r = this.attachmentLoader.newMeshAttachment(t, i, n, o); - if (!r) return null; - r.path = n; - let l = Kn(e, "color", null); - (l && r.color.setFromString(l), - (r.width = Kn(e, "width", 0) * s), - (r.height = Kn(e, "height", 0) * s), - (r.sequence = o)); - let c = Kn(e, "parent", null); - if (c) - return ( - this.linkedMeshes.push( - new Wn( - r, - Kn(e, "skin", null), - a, - c, - Kn(e, "timelines", true), - ), + this.linkedMeshes.push( + new Wn( + r, + Kn(e, "skin", null), + a, + c, + Kn(e, "timelines", true), ), - r - ); - let d = e.uvs; - return ( - this.readVertices(e, r, d.length), - (r.triangles = e.triangles), - (r.regionUVs = d), - null != r.region && r.updateRegion(), - (r.edges = Kn(e, "edges", null)), - (r.hullLength = 2 * Kn(e, "hull", 0)), + ), r ); - } - case "path": { - let a = this.attachmentLoader.newPathAttachment(t, i); - if (!a) return null; - ((a.closed = Kn(e, "closed", false)), - (a.constantSpeed = Kn(e, "constantSpeed", true))); - let n = e.vertexCount; - this.readVertices(e, a, n << 1); - let o = ni.newArray(n / 3, 0); - for (let t = 0; t < e.lengths.length; t++) - o[t] = e.lengths[t] * s; - a.lengths = o; - let r = Kn(e, "color", null); - return (r && a.color.setFromString(r), a); - } - case "point": { - let a = this.attachmentLoader.newPointAttachment(t, i); - if (!a) return null; - ((a.x = Kn(e, "x", 0) * s), - (a.y = Kn(e, "y", 0) * s), - (a.rotation = Kn(e, "rotation", 0))); - let n = Kn(e, "color", null); - return (n && a.color.setFromString(n), a); - } - case "clipping": { - let a = this.attachmentLoader.newClippingAttachment(t, i); - if (!a) return null; - let s = Kn(e, "end", null); - s && (a.endSlot = n.findSlot(s)); - let o = e.vertexCount; - this.readVertices(e, a, o << 1); - let r = Kn(e, "color", null); - return (r && a.color.setFromString(r), a); - } + let d = e.uvs; + return ( + this.readVertices(e, r, d.length), + (r.triangles = e.triangles), + (r.regionUVs = d), + null != r.region && r.updateRegion(), + (r.edges = Kn(e, "edges", null)), + (r.hullLength = 2 * Kn(e, "hull", 0)), + r + ); } - return null; - } - readSequence(e) { - if (null == e) return null; - let t = new ci(Kn(e, "count", 0)); - return ( - (t.start = Kn(e, "start", 1)), - (t.digits = Kn(e, "digits", 0)), - (t.setupIndex = Kn(e, "setup", 0)), - t - ); - } - readVertices(e, t, a) { - let i = this.scale; - t.worldVerticesLength = a; - let n = e.vertices; - if (a == n.length) { - let e = ni.toFloatArray(n); - if (1 != i) for (let t = 0, a = n.length; t < a; t++) e[t] *= i; - return void (t.vertices = e); + case "path": { + let a = this.attachmentLoader.newPathAttachment(t, i); + if (!a) return null; + ((a.closed = Kn(e, "closed", false)), + (a.constantSpeed = Kn(e, "constantSpeed", true))); + let n = e.vertexCount; + this.readVertices(e, a, n << 1); + let o = ni.newArray(n / 3, 0); + for (let t = 0; t < e.lengths.length; t++) + o[t] = e.lengths[t] * s; + a.lengths = o; + let r = Kn(e, "color", null); + return (r && a.color.setFromString(r), a); + } + case "point": { + let a = this.attachmentLoader.newPointAttachment(t, i); + if (!a) return null; + ((a.x = Kn(e, "x", 0) * s), + (a.y = Kn(e, "y", 0) * s), + (a.rotation = Kn(e, "rotation", 0))); + let n = Kn(e, "color", null); + return (n && a.color.setFromString(n), a); } - let s = new Array(), - o = new Array(); - for (let e = 0, t = n.length; e < t; ) { - let t = n[e++]; - o.push(t); - for (let a = e + 4 * t; e < a; e += 4) - (o.push(n[e]), - s.push(n[e + 1] * i), - s.push(n[e + 2] * i), - s.push(n[e + 3])); + case "clipping": { + let a = this.attachmentLoader.newClippingAttachment(t, i); + if (!a) return null; + let s = Kn(e, "end", null); + s && (a.endSlot = n.findSlot(s)); + let o = e.vertexCount; + this.readVertices(e, a, o << 1); + let r = Kn(e, "color", null); + return (r && a.color.setFromString(r), a); } - ((t.bones = o), (t.vertices = ni.toFloatArray(s))); } - readAnimation(e, t, a) { - let i = this.scale, - n = new Array(); - if (e.slots) - for (let t in e.slots) { - let i = e.slots[t], - s = a.findSlot(t).index; - for (let e in i) { - let t = i[e]; - if (!t) continue; - let a = t.length; - if ("attachment" == e) { - let e = new Mi(a, s); - for (let i = 0; i < a; i++) { - let a = t[i]; - e.setFrame(i, Kn(a, "time", 0), Kn(a, "name", null)); + return null; + } + readSequence(e) { + if (null == e) return null; + let t = new ci(Kn(e, "count", 0)); + return ( + (t.start = Kn(e, "start", 1)), + (t.digits = Kn(e, "digits", 0)), + (t.setupIndex = Kn(e, "setup", 0)), + t + ); + } + readVertices(e, t, a) { + let i = this.scale; + t.worldVerticesLength = a; + let n = e.vertices; + if (a == n.length) { + let e = ni.toFloatArray(n); + if (1 != i) for (let t = 0, a = n.length; t < a; t++) e[t] *= i; + return void (t.vertices = e); + } + let s = new Array(), + o = new Array(); + for (let e = 0, t = n.length; e < t;) { + let t = n[e++]; + o.push(t); + for (let a = e + 4 * t; e < a; e += 4) + (o.push(n[e]), + s.push(n[e + 1] * i), + s.push(n[e + 2] * i), + s.push(n[e + 3])); + } + ((t.bones = o), (t.vertices = ni.toFloatArray(s))); + } + readAnimation(e, t, a) { + let i = this.scale, + n = new Array(); + if (e.slots) + for (let t in e.slots) { + let i = e.slots[t], + s = a.findSlot(t).index; + for (let e in i) { + let t = i[e]; + if (!t) continue; + let a = t.length; + if ("attachment" == e) { + let e = new Mi(a, s); + for (let i = 0; i < a; i++) { + let a = t[i]; + e.setFrame(i, Kn(a, "time", 0), Kn(a, "name", null)); + } + n.push(e); + } else if ("rgba" == e) { + let e = new Ai(a, a << 2, s), + i = t[0], + o = Kn(i, "time", 0), + r = ai.fromString(i.color); + for (let a = 0, n = 0; ; a++) { + e.setFrame(a, o, r.r, r.g, r.b, r.a); + let s = t[a + 1]; + if (!s) { + e.shrink(n); + break; } - n.push(e); - } else if ("rgba" == e) { - let e = new Ai(a, a << 2, s), - i = t[0], - o = Kn(i, "time", 0), - r = ai.fromString(i.color); - for (let a = 0, n = 0; ; a++) { - e.setFrame(a, o, r.r, r.g, r.b, r.a); - let s = t[a + 1]; - if (!s) { - e.shrink(n); - break; - } - let l = Kn(s, "time", 0), - c = ai.fromString(s.color), - d = i.curve; - (d && - ((n = Jn(d, e, n, a, 0, o, l, r.r, c.r, 1)), + let l = Kn(s, "time", 0), + c = ai.fromString(s.color), + d = i.curve; + (d && + ((n = Jn(d, e, n, a, 0, o, l, r.r, c.r, 1)), (n = Jn(d, e, n, a, 1, o, l, r.g, c.g, 1)), (n = Jn(d, e, n, a, 2, o, l, r.b, c.b, 1)), (n = Jn(d, e, n, a, 3, o, l, r.a, c.a, 1))), - (o = l), - (r = c), - (i = s)); + (o = l), + (r = c), + (i = s)); + } + n.push(e); + } else if ("rgb" == e) { + let e = new ki(a, 3 * a, s), + i = t[0], + o = Kn(i, "time", 0), + r = ai.fromString(i.color); + for (let a = 0, n = 0; ; a++) { + e.setFrame(a, o, r.r, r.g, r.b); + let s = t[a + 1]; + if (!s) { + e.shrink(n); + break; } - n.push(e); - } else if ("rgb" == e) { - let e = new ki(a, 3 * a, s), - i = t[0], - o = Kn(i, "time", 0), - r = ai.fromString(i.color); - for (let a = 0, n = 0; ; a++) { - e.setFrame(a, o, r.r, r.g, r.b); - let s = t[a + 1]; - if (!s) { - e.shrink(n); - break; - } - let l = Kn(s, "time", 0), - c = ai.fromString(s.color), - d = i.curve; - (d && - ((n = Jn(d, e, n, a, 0, o, l, r.r, c.r, 1)), + let l = Kn(s, "time", 0), + c = ai.fromString(s.color), + d = i.curve; + (d && + ((n = Jn(d, e, n, a, 0, o, l, r.r, c.r, 1)), (n = Jn(d, e, n, a, 1, o, l, r.g, c.g, 1)), (n = Jn(d, e, n, a, 2, o, l, r.b, c.b, 1))), - (o = l), - (r = c), - (i = s)); + (o = l), + (r = c), + (i = s)); + } + n.push(e); + } else if ("alpha" == e) n.push(qn(t, new Ni(a, a, s), 0, 1)); + else if ("rgba2" == e) { + let e = new xi(a, 7 * a, s), + i = t[0], + o = Kn(i, "time", 0), + r = ai.fromString(i.light), + l = ai.fromString(i.dark); + for (let a = 0, n = 0; ; a++) { + e.setFrame(a, o, r.r, r.g, r.b, r.a, l.r, l.g, l.b); + let s = t[a + 1]; + if (!s) { + e.shrink(n); + break; } - n.push(e); - } else if ("alpha" == e) n.push(qn(t, new Ni(a, a, s), 0, 1)); - else if ("rgba2" == e) { - let e = new xi(a, 7 * a, s), - i = t[0], - o = Kn(i, "time", 0), - r = ai.fromString(i.light), - l = ai.fromString(i.dark); - for (let a = 0, n = 0; ; a++) { - e.setFrame(a, o, r.r, r.g, r.b, r.a, l.r, l.g, l.b); - let s = t[a + 1]; - if (!s) { - e.shrink(n); - break; - } - let c = Kn(s, "time", 0), - d = ai.fromString(s.light), - u = ai.fromString(s.dark), - h = i.curve; - (h && - ((n = Jn(h, e, n, a, 0, o, c, r.r, d.r, 1)), + let c = Kn(s, "time", 0), + d = ai.fromString(s.light), + u = ai.fromString(s.dark), + h = i.curve; + (h && + ((n = Jn(h, e, n, a, 0, o, c, r.r, d.r, 1)), (n = Jn(h, e, n, a, 1, o, c, r.g, d.g, 1)), (n = Jn(h, e, n, a, 2, o, c, r.b, d.b, 1)), (n = Jn(h, e, n, a, 3, o, c, r.a, d.a, 1)), (n = Jn(h, e, n, a, 4, o, c, l.r, u.r, 1)), (n = Jn(h, e, n, a, 5, o, c, l.g, u.g, 1)), (n = Jn(h, e, n, a, 6, o, c, l.b, u.b, 1))), - (o = c), - (r = d), - (l = u), - (i = s)); + (o = c), + (r = d), + (l = u), + (i = s)); + } + n.push(e); + } else if ("rgb2" == e) { + let e = new Pi(a, 6 * a, s), + i = t[0], + o = Kn(i, "time", 0), + r = ai.fromString(i.light), + l = ai.fromString(i.dark); + for (let a = 0, n = 0; ; a++) { + e.setFrame(a, o, r.r, r.g, r.b, l.r, l.g, l.b); + let s = t[a + 1]; + if (!s) { + e.shrink(n); + break; } - n.push(e); - } else if ("rgb2" == e) { - let e = new Pi(a, 6 * a, s), - i = t[0], - o = Kn(i, "time", 0), - r = ai.fromString(i.light), - l = ai.fromString(i.dark); - for (let a = 0, n = 0; ; a++) { - e.setFrame(a, o, r.r, r.g, r.b, l.r, l.g, l.b); - let s = t[a + 1]; - if (!s) { - e.shrink(n); - break; - } - let c = Kn(s, "time", 0), - d = ai.fromString(s.light), - u = ai.fromString(s.dark), - h = i.curve; - (h && - ((n = Jn(h, e, n, a, 0, o, c, r.r, d.r, 1)), + let c = Kn(s, "time", 0), + d = ai.fromString(s.light), + u = ai.fromString(s.dark), + h = i.curve; + (h && + ((n = Jn(h, e, n, a, 0, o, c, r.r, d.r, 1)), (n = Jn(h, e, n, a, 1, o, c, r.g, d.g, 1)), (n = Jn(h, e, n, a, 2, o, c, r.b, d.b, 1)), (n = Jn(h, e, n, a, 3, o, c, l.r, u.r, 1)), (n = Jn(h, e, n, a, 4, o, c, l.g, u.g, 1)), (n = Jn(h, e, n, a, 5, o, c, l.b, u.b, 1))), - (o = c), - (r = d), - (l = u), - (i = s)); - } - n.push(e); + (o = c), + (r = d), + (l = u), + (i = s)); } + n.push(e); } } - if (e.bones) - for (let t in e.bones) { - let s = e.bones[t], - o = a.findBone(t).index; - for (let e in s) { - let t = s[e], - a = t.length; - if (0 != a) - if ("rotate" === e) n.push(qn(t, new bi(a, a, o), 0, 1)); - else if ("translate" === e) { - let e = new Si(a, a << 1, o); - n.push($n(t, e, "x", "y", 0, i)); - } else if ("translatex" === e) { - let e = new Ii(a, a, o); - n.push(qn(t, e, 0, i)); - } else if ("translatey" === e) { - let e = new _i(a, a, o); - n.push(qn(t, e, 0, i)); - } else if ("scale" === e) { - let e = new vi(a, a << 1, o); - n.push($n(t, e, "x", "y", 1, 1)); - } else if ("scalex" === e) { - let e = new Ti(a, a, o); - n.push(qn(t, e, 1, 1)); - } else if ("scaley" === e) { - let e = new Ri(a, a, o); - n.push(qn(t, e, 1, 1)); - } else if ("shear" === e) { - let e = new Oi(a, a << 1, o); - n.push($n(t, e, "x", "y", 0, 1)); - } else if ("shearx" === e) { - let e = new Ci(a, a, o); - n.push(qn(t, e, 0, 1)); - } else if ("sheary" === e) { - let e = new wi(a, a, o); - n.push(qn(t, e, 0, 1)); - } - } - } - if (e.ik) - for (let t in e.ik) { - let s = e.ik[t], - o = s[0]; - if (!o) continue; - let r = a.findIkConstraint(t), - l = a.ikConstraints.indexOf(r), - c = new Fi(s.length, s.length << 1, l), - d = Kn(o, "time", 0), - u = Kn(o, "mix", 1), - h = Kn(o, "softness", 0) * i; - for (let e = 0, t = 0; ; e++) { - c.setFrame( - e, - d, - u, - h, - Kn(o, "bendPositive", true) ? 1 : -1, - Kn(o, "compress", false), - Kn(o, "stretch", false), - ); - let a = s[e + 1]; - if (!a) { - c.shrink(t); - break; + } + if (e.bones) + for (let t in e.bones) { + let s = e.bones[t], + o = a.findBone(t).index; + for (let e in s) { + let t = s[e], + a = t.length; + if (0 != a) + if ("rotate" === e) n.push(qn(t, new bi(a, a, o), 0, 1)); + else if ("translate" === e) { + let e = new Si(a, a << 1, o); + n.push($n(t, e, "x", "y", 0, i)); + } else if ("translatex" === e) { + let e = new Ii(a, a, o); + n.push(qn(t, e, 0, i)); + } else if ("translatey" === e) { + let e = new _i(a, a, o); + n.push(qn(t, e, 0, i)); + } else if ("scale" === e) { + let e = new vi(a, a << 1, o); + n.push($n(t, e, "x", "y", 1, 1)); + } else if ("scalex" === e) { + let e = new Ti(a, a, o); + n.push(qn(t, e, 1, 1)); + } else if ("scaley" === e) { + let e = new Ri(a, a, o); + n.push(qn(t, e, 1, 1)); + } else if ("shear" === e) { + let e = new Oi(a, a << 1, o); + n.push($n(t, e, "x", "y", 0, 1)); + } else if ("shearx" === e) { + let e = new Ci(a, a, o); + n.push(qn(t, e, 0, 1)); + } else if ("sheary" === e) { + let e = new wi(a, a, o); + n.push(qn(t, e, 0, 1)); } - let n = Kn(a, "time", 0), - r = Kn(a, "mix", 1), - l = Kn(a, "softness", 0) * i, - p = o.curve; - (p && - ((t = Jn(p, c, t, e, 0, d, n, u, r, 1)), - (t = Jn(p, c, t, e, 1, d, n, h, l, i))), - (d = n), - (u = r), - (h = l), - (o = a)); + } + } + if (e.ik) + for (let t in e.ik) { + let s = e.ik[t], + o = s[0]; + if (!o) continue; + let r = a.findIkConstraint(t), + l = a.ikConstraints.indexOf(r), + c = new Fi(s.length, s.length << 1, l), + d = Kn(o, "time", 0), + u = Kn(o, "mix", 1), + h = Kn(o, "softness", 0) * i; + for (let e = 0, t = 0; ; e++) { + c.setFrame( + e, + d, + u, + h, + Kn(o, "bendPositive", true) ? 1 : -1, + Kn(o, "compress", false), + Kn(o, "stretch", false), + ); + let a = s[e + 1]; + if (!a) { + c.shrink(t); + break; } - n.push(c); + let n = Kn(a, "time", 0), + r = Kn(a, "mix", 1), + l = Kn(a, "softness", 0) * i, + p = o.curve; + (p && + ((t = Jn(p, c, t, e, 0, d, n, u, r, 1)), + (t = Jn(p, c, t, e, 1, d, n, h, l, i))), + (d = n), + (u = r), + (h = l), + (o = a)); } - if (e.transform) - for (let t in e.transform) { - let i = e.transform[t], - s = i[0]; - if (!s) continue; - let o = a.findTransformConstraint(t), - r = a.transformConstraints.indexOf(o), - l = new Yi(i.length, 6 * i.length, r), - c = Kn(s, "time", 0), - d = Kn(s, "mixRotate", 1), - u = Kn(s, "mixX", 1), - h = Kn(s, "mixY", u), - p = Kn(s, "mixScaleX", 1), - g = Kn(s, "mixScaleY", p), - m = Kn(s, "mixShearY", 1); - for (let e = 0, t = 0; ; e++) { - l.setFrame(e, c, d, u, h, p, g, m); - let a = i[e + 1]; - if (!a) { - l.shrink(t); - break; - } - let n = Kn(a, "time", 0), - o = Kn(a, "mixRotate", 1), - r = Kn(a, "mixX", 1), - f = Kn(a, "mixY", r), - y = Kn(a, "mixScaleX", 1), - E = Kn(a, "mixScaleY", y), - b = Kn(a, "mixShearY", 1), - S = s.curve; - (S && - ((t = Jn(S, l, t, e, 0, c, n, d, o, 1)), + n.push(c); + } + if (e.transform) + for (let t in e.transform) { + let i = e.transform[t], + s = i[0]; + if (!s) continue; + let o = a.findTransformConstraint(t), + r = a.transformConstraints.indexOf(o), + l = new Yi(i.length, 6 * i.length, r), + c = Kn(s, "time", 0), + d = Kn(s, "mixRotate", 1), + u = Kn(s, "mixX", 1), + h = Kn(s, "mixY", u), + p = Kn(s, "mixScaleX", 1), + g = Kn(s, "mixScaleY", p), + m = Kn(s, "mixShearY", 1); + for (let e = 0, t = 0; ; e++) { + l.setFrame(e, c, d, u, h, p, g, m); + let a = i[e + 1]; + if (!a) { + l.shrink(t); + break; + } + let n = Kn(a, "time", 0), + o = Kn(a, "mixRotate", 1), + r = Kn(a, "mixX", 1), + f = Kn(a, "mixY", r), + y = Kn(a, "mixScaleX", 1), + E = Kn(a, "mixScaleY", y), + b = Kn(a, "mixShearY", 1), + S = s.curve; + (S && + ((t = Jn(S, l, t, e, 0, c, n, d, o, 1)), (t = Jn(S, l, t, e, 1, c, n, u, r, 1)), (t = Jn(S, l, t, e, 2, c, n, h, f, 1)), (t = Jn(S, l, t, e, 3, c, n, p, y, 1)), (t = Jn(S, l, t, e, 4, c, n, g, E, 1)), (t = Jn(S, l, t, e, 5, c, n, m, b, 1))), - (c = n), - (d = o), - (u = r), - (h = f), - (p = y), - (g = E), - (p = y), - (s = a)); - } - n.push(l); + (c = n), + (d = o), + (u = r), + (h = f), + (p = y), + (g = E), + (p = y), + (s = a)); } - if (e.path) - for (let t in e.path) { - let s = e.path[t], - o = a.findPathConstraint(t), - r = a.pathConstraints.indexOf(o); - for (let e in s) { - let t = s[e], - a = t[0]; - if (!a) continue; - let l = t.length; - if ("position" === e) { - let e = new Ui(l, l, r); - n.push(qn(t, e, 0, o.positionMode == cn.Fixed ? i : 1)); - } else if ("spacing" === e) { - let e = new ji(l, l, r); - n.push( - qn( - t, - e, - 0, - o.spacingMode == dn.Length || o.spacingMode == dn.Fixed - ? i - : 1, - ), - ); - } else if ("mix" === e) { - let e = new Gi(l, 3 * l, r), - i = Kn(a, "time", 0), - s = Kn(a, "mixRotate", 1), - o = Kn(a, "mixX", 1), - c = Kn(a, "mixY", o); - for (let n = 0, r = 0; ; n++) { - e.setFrame(n, i, s, o, c); - let l = t[n + 1]; - if (!l) { - e.shrink(r); - break; - } - let d = Kn(l, "time", 0), - u = Kn(l, "mixRotate", 1), - h = Kn(l, "mixX", 1), - p = Kn(l, "mixY", h), - g = a.curve; - (g && - ((r = Jn(g, e, r, n, 0, i, d, s, u, 1)), + n.push(l); + } + if (e.path) + for (let t in e.path) { + let s = e.path[t], + o = a.findPathConstraint(t), + r = a.pathConstraints.indexOf(o); + for (let e in s) { + let t = s[e], + a = t[0]; + if (!a) continue; + let l = t.length; + if ("position" === e) { + let e = new Ui(l, l, r); + n.push(qn(t, e, 0, o.positionMode == cn.Fixed ? i : 1)); + } else if ("spacing" === e) { + let e = new ji(l, l, r); + n.push( + qn( + t, + e, + 0, + o.spacingMode == dn.Length || o.spacingMode == dn.Fixed + ? i + : 1, + ), + ); + } else if ("mix" === e) { + let e = new Gi(l, 3 * l, r), + i = Kn(a, "time", 0), + s = Kn(a, "mixRotate", 1), + o = Kn(a, "mixX", 1), + c = Kn(a, "mixY", o); + for (let n = 0, r = 0; ; n++) { + e.setFrame(n, i, s, o, c); + let l = t[n + 1]; + if (!l) { + e.shrink(r); + break; + } + let d = Kn(l, "time", 0), + u = Kn(l, "mixRotate", 1), + h = Kn(l, "mixX", 1), + p = Kn(l, "mixY", h), + g = a.curve; + (g && + ((r = Jn(g, e, r, n, 0, i, d, s, u, 1)), (r = Jn(g, e, r, n, 1, i, d, o, h, 1)), (r = Jn(g, e, r, n, 2, i, d, c, p, 1))), - (i = d), - (s = u), - (o = h), - (c = p), - (a = l)); - } - n.push(e); + (i = d), + (s = u), + (o = h), + (c = p), + (a = l)); } + n.push(e); } } - if (e.attachments) - for (let t in e.attachments) { - let s = e.attachments[t], - o = a.findSkin(t); - for (let e in s) { - let t = s[e], - r = a.findSlot(e).index; - for (let e in t) { - let a = t[e], - s = o.getAttachment(r, e); - for (let e in a) { - let t = a[e], - o = t[0]; - if (o) - if ("deform" == e) { - let e = s.bones, - a = s.vertices, - l = e ? (a.length / 3) * 2 : a.length, - c = new Li(t.length, t.length, r, s), - d = Kn(o, "time", 0); - for (let n = 0, s = 0; ; n++) { - let r, - u = Kn(o, "vertices", null); - if (u) { - r = ni.newFloatArray(l); - let t = Kn(o, "offset", 0); - if ((ni.arrayCopy(u, 0, r, t, u.length), 1 != i)) - for (let e = t, a = e + u.length; e < a; e++) - r[e] *= i; - if (!e) for (let e = 0; e < l; e++) r[e] += a[e]; - } else r = e ? ni.newFloatArray(l) : a; - c.setFrame(n, d, r); - let h = t[n + 1]; - if (!h) { - c.shrink(s); - break; - } - let p = Kn(h, "time", 0), - g = o.curve; - (g && (s = Jn(g, c, s, n, 0, d, p, 0, 1, 1)), - (d = p), - (o = h)); - } - n.push(c); - } else if ("sequence" == e) { - let e = new Vi(t.length, r, s), - a = 0; - for (let i = 0; i < t.length; i++) { - let n = Kn(o, "delay", a), - s = Kn(o, "time", 0), - r = di[Kn(o, "mode", "hold")], - l = Kn(o, "index", 0); - (e.setFrame(i, s, r, l, n), - (a = n), - (o = t[i + 1])); + } + if (e.attachments) + for (let t in e.attachments) { + let s = e.attachments[t], + o = a.findSkin(t); + for (let e in s) { + let t = s[e], + r = a.findSlot(e).index; + for (let e in t) { + let a = t[e], + s = o.getAttachment(r, e); + for (let e in a) { + let t = a[e], + o = t[0]; + if (o) + if ("deform" == e) { + let e = s.bones, + a = s.vertices, + l = e ? (a.length / 3) * 2 : a.length, + c = new Li(t.length, t.length, r, s), + d = Kn(o, "time", 0); + for (let n = 0, s = 0; ; n++) { + let r, + u = Kn(o, "vertices", null); + if (u) { + r = ni.newFloatArray(l); + let t = Kn(o, "offset", 0); + if ((ni.arrayCopy(u, 0, r, t, u.length), 1 != i)) + for (let e = t, a = e + u.length; e < a; e++) + r[e] *= i; + if (!e) for (let e = 0; e < l; e++) r[e] += a[e]; + } else r = e ? ni.newFloatArray(l) : a; + c.setFrame(n, d, r); + let h = t[n + 1]; + if (!h) { + c.shrink(s); + break; } - n.push(e); + let p = Kn(h, "time", 0), + g = o.curve; + (g && (s = Jn(g, c, s, n, 0, d, p, 0, 1, 1)), + (d = p), + (o = h)); } - } + n.push(c); + } else if ("sequence" == e) { + let e = new Vi(t.length, r, s), + a = 0; + for (let i = 0; i < t.length; i++) { + let n = Kn(o, "delay", a), + s = Kn(o, "time", 0), + r = di[Kn(o, "mode", "hold")], + l = Kn(o, "index", 0); + (e.setFrame(i, s, r, l, n), + (a = n), + (o = t[i + 1])); + } + n.push(e); + } } } } - if (e.drawOrder) { - let t = new Bi(e.drawOrder.length), - i = a.slots.length, - s = 0; - for (let n = 0; n < e.drawOrder.length; n++, s++) { - let o = e.drawOrder[n], - r = null, - l = Kn(o, "offsets", null); - if (l) { - r = ni.newArray(i, -1); - let e = ni.newArray(i - l.length, 0), - t = 0, - n = 0; - for (let i = 0; i < l.length; i++) { - let s = l[i], - o = a.findSlot(s.slot).index; - for (; t != o; ) e[n++] = t++; - r[t + s.offset] = t++; - } - for (; t < i; ) e[n++] = t++; - for (let t = i - 1; t >= 0; t--) - -1 == r[t] && (r[t] = e[--n]); + } + if (e.drawOrder) { + let t = new Bi(e.drawOrder.length), + i = a.slots.length, + s = 0; + for (let n = 0; n < e.drawOrder.length; n++, s++) { + let o = e.drawOrder[n], + r = null, + l = Kn(o, "offsets", null); + if (l) { + r = ni.newArray(i, -1); + let e = ni.newArray(i - l.length, 0), + t = 0, + n = 0; + for (let i = 0; i < l.length; i++) { + let s = l[i], + o = a.findSlot(s.slot).index; + for (; t != o;) e[n++] = t++; + r[t + s.offset] = t++; } - t.setFrame(s, Kn(o, "time", 0), r); + for (; t < i;) e[n++] = t++; + for (let t = i - 1; t >= 0; t--) + -1 == r[t] && (r[t] = e[--n]); } - n.push(t); + t.setFrame(s, Kn(o, "time", 0), r); } - if (e.events) { - let t = new Di(e.events.length), - i = 0; - for (let n = 0; n < e.events.length; n++, i++) { - let s = e.events[n], - o = a.findEvent(s.name), - r = new Gn(ni.toSinglePrecision(Kn(s, "time", 0)), o); - ((r.intValue = Kn(s, "int", o.intValue)), - (r.floatValue = Kn(s, "float", o.floatValue)), - (r.stringValue = Kn(s, "string", o.stringValue)), - r.data.audioPath && - ((r.volume = Kn(s, "volume", 1)), - (r.balance = Kn(s, "balance", 0))), - t.setFrame(i, r)); - } - n.push(t); + n.push(t); + } + if (e.events) { + let t = new Di(e.events.length), + i = 0; + for (let n = 0; n < e.events.length; n++, i++) { + let s = e.events[n], + o = a.findEvent(s.name), + r = new Gn(ni.toSinglePrecision(Kn(s, "time", 0)), o); + ((r.intValue = Kn(s, "int", o.intValue)), + (r.floatValue = Kn(s, "float", o.floatValue)), + (r.stringValue = Kn(s, "string", o.stringValue)), + r.data.audioPath && + ((r.volume = Kn(s, "volume", 1)), + (r.balance = Kn(s, "balance", 0))), + t.setFrame(i, r)); } - let s = 0; - for (let e = 0, t = n.length; e < t; e++) - s = Math.max(s, n[e].getDuration()); - a.animations.push(new hi(t, n, s)); + n.push(t); } + let s = 0; + for (let e = 0, t = n.length; e < t; e++) + s = Math.max(s, n[e].getDuration()); + a.animations.push(new hi(t, n, s)); } - class Wn { - constructor(e, t, a, i, n) { - ((this.mesh = e), - (this.skin = t), - (this.slotIndex = a), - (this.parent = i), - (this.inheritTimeline = n)); - } + } + class Wn { + constructor(e, t, a, i, n) { + ((this.mesh = e), + (this.skin = t), + (this.slotIndex = a), + (this.parent = i), + (this.inheritTimeline = n)); } - function qn(e, t, a, i) { - let n = e[0], - s = Kn(n, "time", 0), - o = Kn(n, "value", a) * i, - r = 0; - for (let l = 0; ; l++) { - t.setFrame(l, s, o); - let c = e[l + 1]; - if (!c) return (t.shrink(r), t); - let d = Kn(c, "time", 0), - u = Kn(c, "value", a) * i; - (n.curve && (r = Jn(n.curve, t, r, l, 0, s, d, o, u, i)), - (s = d), - (o = u), - (n = c)); - } + } + function qn(e, t, a, i) { + let n = e[0], + s = Kn(n, "time", 0), + o = Kn(n, "value", a) * i, + r = 0; + for (let l = 0; ; l++) { + t.setFrame(l, s, o); + let c = e[l + 1]; + if (!c) return (t.shrink(r), t); + let d = Kn(c, "time", 0), + u = Kn(c, "value", a) * i; + (n.curve && (r = Jn(n.curve, t, r, l, 0, s, d, o, u, i)), + (s = d), + (o = u), + (n = c)); } - function $n(e, t, a, i, n, s) { - let o = e[0], - r = Kn(o, "time", 0), - l = Kn(o, a, n) * s, - c = Kn(o, i, n) * s, - d = 0; - for (let u = 0; ; u++) { - t.setFrame(u, r, l, c); - let h = e[u + 1]; - if (!h) return (t.shrink(d), t); - let p = Kn(h, "time", 0), - g = Kn(h, a, n) * s, - m = Kn(h, i, n) * s, - f = o.curve; - (f && - ((d = Jn(f, t, d, u, 0, r, p, l, g, s)), + } + function $n(e, t, a, i, n, s) { + let o = e[0], + r = Kn(o, "time", 0), + l = Kn(o, a, n) * s, + c = Kn(o, i, n) * s, + d = 0; + for (let u = 0; ; u++) { + t.setFrame(u, r, l, c); + let h = e[u + 1]; + if (!h) return (t.shrink(d), t); + let p = Kn(h, "time", 0), + g = Kn(h, a, n) * s, + m = Kn(h, i, n) * s, + f = o.curve; + (f && + ((d = Jn(f, t, d, u, 0, r, p, l, g, s)), (d = Jn(f, t, d, u, 1, r, p, c, m, s))), - (r = p), - (l = g), - (c = m), - (o = h)); - } + (r = p), + (l = g), + (c = m), + (o = h)); } - function Jn(e, t, a, i, n, s, o, r, l, c) { - if ("stepped" == e) return (t.setStepped(i), a); - let d = n << 2, - u = e[d], - h = e[d + 1] * c, - p = e[d + 2], - g = e[d + 3] * c; - return (t.setBezier(a, i, n, s, r, u, h, p, g, o, l), a + 1); - } - function Kn(e, t, a) { - return void 0 !== e[t] ? e[t] : a; - } - void 0 === Math.fround && - (Math.fround = (function (e) { - return function (t) { - return ((e[0] = t), e[0]); - }; - })(new Float32Array(1))); - class Qn { - constructor(e) { - ((this.centerX = 0), - (this.centerY = 0), - (this.radius = 0), - (this.angle = 0), - (this.worldX = 0), - (this.worldY = 0), - (this.radius = e)); - } - begin(e) { - ((this.worldX = e.x + this.centerX), - (this.worldY = e.y + this.centerY)); - } - transform(e, t, a, i) { - let n = this.angle * ii.degreesToRadians, - s = e.x - this.worldX, - o = e.y - this.worldY, - r = Math.sqrt(s * s + o * o); - if (r < this.radius) { - let t = Qn.interpolation.apply( - 0, - n, - (this.radius - r) / this.radius, - ), - a = Math.cos(t), - i = Math.sin(t); - ((e.x = a * s - i * o + this.worldX), - (e.y = i * s + a * o + this.worldY)); - } - } - end() {} + } + function Jn(e, t, a, i, n, s, o, r, l, c) { + if ("stepped" == e) return (t.setStepped(i), a); + let d = n << 2, + u = e[d], + h = e[d + 1] * c, + p = e[d + 2], + g = e[d + 3] * c; + return (t.setBezier(a, i, n, s, r, u, h, p, g, o, l), a + 1); + } + function Kn(e, t, a) { + return void 0 !== e[t] ? e[t] : a; + } + void 0 === Math.fround && + (Math.fround = (function (e) { + return function (t) { + return ((e[0] = t), e[0]); + }; + })(new Float32Array(1))); + class Qn { + constructor(e) { + ((this.centerX = 0), + (this.centerY = 0), + (this.radius = 0), + (this.angle = 0), + (this.worldX = 0), + (this.worldY = 0), + (this.radius = e)); } - Qn.interpolation = new (class extends class extends class { - apply(e, t, a) { - return e + (t - e) * this.applyInternal(a); - } - } { - constructor(e) { - (super(), (this.power = 2), (this.power = e)); - } - applyInternal(e) { - return e <= 0.5 - ? Math.pow(2 * e, this.power) / 2 - : Math.pow(2 * (e - 1), this.power) / - (this.power % 2 == 0 ? -2 : 2) + - 1; - } - } { - constructor(e) { - super(e); - } - applyInternal(e) { - return ( - Math.pow(e - 1, this.power) * (this.power % 2 == 0 ? -1 : 1) + 1 - ); + begin(e) { + ((this.worldX = e.x + this.centerX), + (this.worldY = e.y + this.centerY)); + } + transform(e, t, a, i) { + let n = this.angle * ii.degreesToRadians, + s = e.x - this.worldX, + o = e.y - this.worldY, + r = Math.sqrt(s * s + o * o); + if (r < this.radius) { + let t = Qn.interpolation.apply( + 0, + n, + (this.radius - r) / this.radius, + ), + a = Math.cos(t), + i = Math.sin(t); + ((e.x = a * s - i * o + this.worldX), + (e.y = i * s + a * o + this.worldY)); } - })(2); - class Zn { - constructor(e, t = { alpha: "true" }) { - ((this.restorables = new Array()), - e instanceof WebGLRenderingContext || + } + end() { } + } + Qn.interpolation = new (class extends class extends class { + apply(e, t, a) { + return e + (t - e) * this.applyInternal(a); + } + } { + constructor(e) { + (super(), (this.power = 2), (this.power = e)); + } + applyInternal(e) { + return e <= 0.5 + ? Math.pow(2 * e, this.power) / 2 + : Math.pow(2 * (e - 1), this.power) / + (this.power % 2 == 0 ? -2 : 2) + + 1; + } + } { + constructor(e) { + super(e); + } + applyInternal(e) { + return ( + Math.pow(e - 1, this.power) * (this.power % 2 == 0 ? -1 : 1) + 1 + ); + } + })(2); + class Zn { + constructor(e, t = { alpha: "true" }) { + ((this.restorables = new Array()), + e instanceof WebGLRenderingContext || ("undefined" != typeof WebGL2RenderingContext && e instanceof WebGL2RenderingContext) - ? ((this.gl = e), (this.canvas = this.gl.canvas)) - : this.setupCanvas(e, t)); - } - setupCanvas(e, t) { - ((this.gl = e.getContext("webgl2", t) || e.getContext("webgl", t)), - (this.canvas = e), - e.addEventListener("webglcontextlost", (e) => { - e && e.preventDefault(); - }), - e.addEventListener("webglcontextrestored", (e) => { - for (let e = 0, t = this.restorables.length; e < t; e++) - this.restorables[e].restore(); - })); - } - addRestorable(e) { - this.restorables.push(e); - } - removeRestorable(e) { - let t = this.restorables.indexOf(e); - t > -1 && this.restorables.splice(t, 1); - } + ? ((this.gl = e), (this.canvas = this.gl.canvas)) + : this.setupCanvas(e, t)); } - class es { - static getDestGLBlendMode(e) { - switch (e) { - case hn.Normal: - return 771; - case hn.Additive: - return 1; - case hn.Multiply: - case hn.Screen: - return 771; - default: - throw new Error("Unknown blend mode: " + e); - } - } - static getSourceColorGLBlendMode(e, t = false) { - switch (e) { - case hn.Normal: - case hn.Additive: - return t ? 1 : 770; - case hn.Multiply: - return 774; - case hn.Screen: - return 1; - default: - throw new Error("Unknown blend mode: " + e); - } - } - static getSourceAlphaGLBlendMode(e) { - switch (e) { - case hn.Normal: - case hn.Additive: - return 1; - case hn.Multiply: - return 771; - case hn.Screen: - return 769; - default: - throw new Error("Unknown blend mode: " + e); - } - } + setupCanvas(e, t) { + ((this.gl = e.getContext("webgl2", t) || e.getContext("webgl", t)), + (this.canvas = e), + e.addEventListener("webglcontextlost", (e) => { + e && e.preventDefault(); + }), + e.addEventListener("webglcontextrestored", (e) => { + for (let e = 0, t = this.restorables.length; e < t; e++) + this.restorables[e].restore(); + })); } - class ts extends class { - constructor(e) { - this._image = e; - } - getImage() { - return this._image; - } - } { - constructor(e, t, a = false) { - (super(t), - (this.texture = null), - (this.boundUnit = 0), - (this.useMipMaps = false), - (this.context = e instanceof Zn ? e : new Zn(e)), - (this.useMipMaps = a), - this.restore(), - this.context.addRestorable(this)); - } - setFilters(e, t) { - let a = this.context.gl; - (this.bind(), - a.texParameteri(a.TEXTURE_2D, a.TEXTURE_MIN_FILTER, e), - a.texParameteri( - a.TEXTURE_2D, - a.TEXTURE_MAG_FILTER, - ts.validateMagFilter(t), - )); - } - static validateMagFilter(e) { - switch (e) { - case on.MipMap: - case on.MipMapLinearLinear: - case on.MipMapLinearNearest: - case on.MipMapNearestLinear: - case on.MipMapNearestNearest: - return on.Linear; - default: - return e; - } - } - setWraps(e, t) { - let a = this.context.gl; - (this.bind(), - a.texParameteri(a.TEXTURE_2D, a.TEXTURE_WRAP_S, e), - a.texParameteri(a.TEXTURE_2D, a.TEXTURE_WRAP_T, t)); - } - update(e) { - let t = this.context.gl; - (this.texture || (this.texture = this.context.gl.createTexture()), - this.bind(), - ts.DISABLE_UNPACK_PREMULTIPLIED_ALPHA_WEBGL && - t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false), - t.texImage2D( - t.TEXTURE_2D, - 0, - t.RGBA, - t.RGBA, - t.UNSIGNED_BYTE, - this._image, - ), - t.texParameteri(t.TEXTURE_2D, t.TEXTURE_MAG_FILTER, t.LINEAR), - t.texParameteri( - t.TEXTURE_2D, - t.TEXTURE_MIN_FILTER, - e ? t.LINEAR_MIPMAP_LINEAR : t.LINEAR, - ), - t.texParameteri(t.TEXTURE_2D, t.TEXTURE_WRAP_S, t.CLAMP_TO_EDGE), - t.texParameteri(t.TEXTURE_2D, t.TEXTURE_WRAP_T, t.CLAMP_TO_EDGE), - e && t.generateMipmap(t.TEXTURE_2D)); - } - restore() { - ((this.texture = null), this.update(this.useMipMaps)); - } - bind(e = 0) { - let t = this.context.gl; - ((this.boundUnit = e), - t.activeTexture(t.TEXTURE0 + e), - t.bindTexture(t.TEXTURE_2D, this.texture)); - } - unbind() { - let e = this.context.gl; - (e.activeTexture(e.TEXTURE0 + this.boundUnit), - e.bindTexture(e.TEXTURE_2D, null)); - } - dispose() { - (this.context.removeRestorable(this), - this.context.gl.deleteTexture(this.texture)); - } + addRestorable(e) { + this.restorables.push(e); } - ts.DISABLE_UNPACK_PREMULTIPLIED_ALPHA_WEBGL = false; - class as extends class { - constructor(e, t = "", a = null) { - ((this.assets = {}), - (this.errors = {}), - (this.toLoad = 0), - (this.loaded = 0), - (this.textureLoader = e), - (this.pathPrefix = t), - (this.downloader = a || new Cn())); - } - start(e) { - return (this.toLoad++, this.pathPrefix + e); + removeRestorable(e) { + let t = this.restorables.indexOf(e); + t > -1 && this.restorables.splice(t, 1); + } + } + class es { + static getDestGLBlendMode(e) { + switch (e) { + case hn.Normal: + return 771; + case hn.Additive: + return 1; + case hn.Multiply: + case hn.Screen: + return 771; + default: + throw new Error("Unknown blend mode: " + e); } - success(e, t, a) { - (this.toLoad--, this.loaded++, (this.assets[t] = a), e && e(t, a)); + } + static getSourceColorGLBlendMode(e, t = false) { + switch (e) { + case hn.Normal: + case hn.Additive: + return t ? 1 : 770; + case hn.Multiply: + return 774; + case hn.Screen: + return 1; + default: + throw new Error("Unknown blend mode: " + e); } - error(e, t, a) { - (this.toLoad--, this.loaded++, (this.errors[t] = a), e && e(t, a)); + } + static getSourceAlphaGLBlendMode(e) { + switch (e) { + case hn.Normal: + case hn.Additive: + return 1; + case hn.Multiply: + return 771; + case hn.Screen: + return 769; + default: + throw new Error("Unknown blend mode: " + e); } - setRawDataURI(e, t) { - this.downloader.rawDataUris[this.pathPrefix + e] = t; + } + } + class ts extends class { + constructor(e) { + this._image = e; + } + getImage() { + return this._image; + } + } { + constructor(e, t, a = false) { + (super(t), + (this.texture = null), + (this.boundUnit = 0), + (this.useMipMaps = false), + (this.context = e instanceof Zn ? e : new Zn(e)), + (this.useMipMaps = a), + this.restore(), + this.context.addRestorable(this)); + } + setFilters(e, t) { + let a = this.context.gl; + (this.bind(), + a.texParameteri(a.TEXTURE_2D, a.TEXTURE_MIN_FILTER, e), + a.texParameteri( + a.TEXTURE_2D, + a.TEXTURE_MAG_FILTER, + ts.validateMagFilter(t), + )); + } + static validateMagFilter(e) { + switch (e) { + case on.MipMap: + case on.MipMapLinearLinear: + case on.MipMapLinearNearest: + case on.MipMapNearestLinear: + case on.MipMapNearestNearest: + return on.Linear; + default: + return e; } - loadBinary(e, t = null, a = null) { + } + setWraps(e, t) { + let a = this.context.gl; + (this.bind(), + a.texParameteri(a.TEXTURE_2D, a.TEXTURE_WRAP_S, e), + a.texParameteri(a.TEXTURE_2D, a.TEXTURE_WRAP_T, t)); + } + update(e) { + let t = this.context.gl; + (this.texture || (this.texture = this.context.gl.createTexture()), + this.bind(), + ts.DISABLE_UNPACK_PREMULTIPLIED_ALPHA_WEBGL && + t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false), + t.texImage2D( + t.TEXTURE_2D, + 0, + t.RGBA, + t.RGBA, + t.UNSIGNED_BYTE, + this._image, + ), + t.texParameteri(t.TEXTURE_2D, t.TEXTURE_MAG_FILTER, t.LINEAR), + t.texParameteri( + t.TEXTURE_2D, + t.TEXTURE_MIN_FILTER, + e ? t.LINEAR_MIPMAP_LINEAR : t.LINEAR, + ), + t.texParameteri(t.TEXTURE_2D, t.TEXTURE_WRAP_S, t.CLAMP_TO_EDGE), + t.texParameteri(t.TEXTURE_2D, t.TEXTURE_WRAP_T, t.CLAMP_TO_EDGE), + e && t.generateMipmap(t.TEXTURE_2D)); + } + restore() { + ((this.texture = null), this.update(this.useMipMaps)); + } + bind(e = 0) { + let t = this.context.gl; + ((this.boundUnit = e), + t.activeTexture(t.TEXTURE0 + e), + t.bindTexture(t.TEXTURE_2D, this.texture)); + } + unbind() { + let e = this.context.gl; + (e.activeTexture(e.TEXTURE0 + this.boundUnit), + e.bindTexture(e.TEXTURE_2D, null)); + } + dispose() { + (this.context.removeRestorable(this), + this.context.gl.deleteTexture(this.texture)); + } + } + ts.DISABLE_UNPACK_PREMULTIPLIED_ALPHA_WEBGL = false; + class as extends class { + constructor(e, t = "", a = null) { + ((this.assets = {}), + (this.errors = {}), + (this.toLoad = 0), + (this.loaded = 0), + (this.textureLoader = e), + (this.pathPrefix = t), + (this.downloader = a || new Cn())); + } + start(e) { + return (this.toLoad++, this.pathPrefix + e); + } + success(e, t, a) { + (this.toLoad--, this.loaded++, (this.assets[t] = a), e && e(t, a)); + } + error(e, t, a) { + (this.toLoad--, this.loaded++, (this.errors[t] = a), e && e(t, a)); + } + setRawDataURI(e, t) { + this.downloader.rawDataUris[this.pathPrefix + e] = t; + } + loadBinary(e, t = null, a = null) { + ((e = this.start(e)), + this.downloader.downloadBinary( + e, + (a) => { + this.success(t, e, a); + }, + (t, i) => { + this.error( + a, + e, + `Couldn't load binary ${e}: status ${t}, ${i}`, + ); + }, + )); + } + loadText(e, t = null, a = null) { + ((e = this.start(e)), + this.downloader.downloadText( + e, + (a) => { + this.success(t, e, a); + }, + (t, i) => { + this.error( + a, + e, + `Couldn't load text ${e}: status ${t}, ${i}`, + ); + }, + )); + } + loadJson(e, t = null, a = null) { + ((e = this.start(e)), + this.downloader.downloadJson( + e, + (a) => { + this.success(t, e, a); + }, + (t, i) => { + this.error( + a, + e, + `Couldn't load JSON ${e}: status ${t}, ${i}`, + ); + }, + )); + } + loadTexture(e, t = null, a = null) { + if ( ((e = this.start(e)), - this.downloader.downloadBinary( - e, - (a) => { - this.success(t, e, a); - }, - (t, i) => { + "undefined" != typeof window && + "undefined" != typeof navigator && + window.document) + ) { + let i = new Image(); + ((i.crossOrigin = "anonymous"), + (i.onload = () => { + this.success(t, e, this.textureLoader(i)); + }), + (i.onerror = () => { + this.error(a, e, `Couldn't load image: ${e}`); + }), + this.downloader.rawDataUris[e] && + (e = this.downloader.rawDataUris[e]), + (i.src = e)); + } else + fetch(e, { mode: "cors" }) + .then((t) => + t.ok + ? t.blob() + : (this.error(a, e, `Couldn't load image: ${e}`), null), + ) + .then((e) => + e + ? createImageBitmap(e, { + premultiplyAlpha: "none", + colorSpaceConversion: "none", + }) + : null, + ) + .then((a) => { + a && this.success(t, e, this.textureLoader(a)); + }); + } + loadTextureAtlas(e, t = null, a = null) { + let i = e.lastIndexOf("/"), + n = i >= 0 ? e.substring(0, i + 1) : ""; + ((e = this.start(e)), + this.downloader.downloadText( + e, + (i) => { + try { + let s = new fn(i), + o = s.pages.length, + r = false; + for (let i of s.pages) + this.loadTexture( + n + i.name, + (a, n) => { + r || + (i.setTexture(n), + 0 == --o && this.success(t, e, s)); + }, + (t, i) => { + (r || + this.error( + a, + e, + `Couldn't load texture atlas ${e} page image: ${t}`, + ), + (r = true)); + }, + ); + } catch (t) { this.error( a, e, - `Couldn't load binary ${e}: status ${t}, ${i}`, + `Couldn't parse texture atlas ${e}: ${t.message}`, ); - }, - )); - } - loadText(e, t = null, a = null) { - ((e = this.start(e)), - this.downloader.downloadText( - e, - (a) => { - this.success(t, e, a); - }, - (t, i) => { - this.error( - a, - e, - `Couldn't load text ${e}: status ${t}, ${i}`, - ); - }, - )); - } - loadJson(e, t = null, a = null) { - ((e = this.start(e)), - this.downloader.downloadJson( - e, - (a) => { - this.success(t, e, a); - }, - (t, i) => { - this.error( - a, - e, - `Couldn't load JSON ${e}: status ${t}, ${i}`, - ); - }, - )); - } - loadTexture(e, t = null, a = null) { - if ( - ((e = this.start(e)), - "undefined" != typeof window && - "undefined" != typeof navigator && - window.document) - ) { - let i = new Image(); - ((i.crossOrigin = "anonymous"), - (i.onload = () => { - this.success(t, e, this.textureLoader(i)); - }), - (i.onerror = () => { - this.error(a, e, `Couldn't load image: ${e}`); - }), - this.downloader.rawDataUris[e] && - (e = this.downloader.rawDataUris[e]), - (i.src = e)); - } else - fetch(e, { mode: "cors" }) - .then((t) => - t.ok - ? t.blob() - : (this.error(a, e, `Couldn't load image: ${e}`), null), - ) - .then((e) => - e - ? createImageBitmap(e, { - premultiplyAlpha: "none", - colorSpaceConversion: "none", - }) - : null, - ) - .then((a) => { - a && this.success(t, e, this.textureLoader(a)); - }); - } - loadTextureAtlas(e, t = null, a = null) { - let i = e.lastIndexOf("/"), - n = i >= 0 ? e.substring(0, i + 1) : ""; - ((e = this.start(e)), - this.downloader.downloadText( - e, - (i) => { - try { - let s = new fn(i), - o = s.pages.length, - r = false; - for (let i of s.pages) - this.loadTexture( - n + i.name, - (a, n) => { - r || - (i.setTexture(n), - 0 == --o && this.success(t, e, s)); - }, - (t, i) => { - (r || - this.error( - a, - e, - `Couldn't load texture atlas ${e} page image: ${t}`, - ), - (r = true)); - }, - ); - } catch (t) { - this.error( - a, - e, - `Couldn't parse texture atlas ${e}: ${t.message}`, - ); - } - }, - (t, i) => { - this.error( - a, - e, - `Couldn't load texture atlas ${e}: status ${t}, ${i}`, - ); - }, - )); - } - get(e) { - return this.assets[this.pathPrefix + e]; - } - require(e) { - e = this.pathPrefix + e; - let t = this.assets[e]; - if (t) return t; - let a = this.errors[e]; - throw Error("Asset not found: " + e + (a ? "\n" + a : "")); - } - remove(e) { - e = this.pathPrefix + e; + } + }, + (t, i) => { + this.error( + a, + e, + `Couldn't load texture atlas ${e}: status ${t}, ${i}`, + ); + }, + )); + } + get(e) { + return this.assets[this.pathPrefix + e]; + } + require(e) { + e = this.pathPrefix + e; + let t = this.assets[e]; + if (t) return t; + let a = this.errors[e]; + throw Error("Asset not found: " + e + (a ? "\n" + a : "")); + } + remove(e) { + e = this.pathPrefix + e; + let t = this.assets[e]; + return (t.dispose && t.dispose(), delete this.assets[e], t); + } + removeAll() { + for (let e in this.assets) { let t = this.assets[e]; - return (t.dispose && t.dispose(), delete this.assets[e], t); - } - removeAll() { - for (let e in this.assets) { - let t = this.assets[e]; - t.dispose && t.dispose(); - } - this.assets = {}; - } - isLoadingComplete() { - return 0 == this.toLoad; - } - getToLoad() { - return this.toLoad; - } - getLoaded() { - return this.loaded; - } - dispose() { - this.removeAll(); - } - hasErrors() { - return Object.keys(this.errors).length > 0; - } - getErrors() { - return this.errors; - } - } { - constructor(e, t = "", a = null) { - super((t) => new ts(e, t), t, a); + t.dispose && t.dispose(); } + this.assets = {}; } - class is { - constructor(e = 0, t = 0, a = 0) { - ((this.x = 0), - (this.y = 0), - (this.z = 0), - (this.x = e), - (this.y = t), - (this.z = a)); - } - setFrom(e) { - return ((this.x = e.x), (this.y = e.y), (this.z = e.z), this); - } - set(e, t, a) { - return ((this.x = e), (this.y = t), (this.z = a), this); - } - add(e) { - return ((this.x += e.x), (this.y += e.y), (this.z += e.z), this); - } - sub(e) { - return ((this.x -= e.x), (this.y -= e.y), (this.z -= e.z), this); - } - scale(e) { - return ((this.x *= e), (this.y *= e), (this.z *= e), this); - } - normalize() { - let e = this.length(); - return ( - 0 == e || - ((e = 1 / e), (this.x *= e), (this.y *= e), (this.z *= e)), - this - ); - } - cross(e) { - return this.set( - this.y * e.z - this.z * e.y, - this.z * e.x - this.x * e.z, - this.x * e.y - this.y * e.x, - ); - } - multiply(e) { - let t = e.values; - return this.set( - this.x * t[ns] + this.y * t[ss] + this.z * t[os] + t[rs], - this.x * t[ls] + this.y * t[cs] + this.z * t[ds] + t[us], - this.x * t[hs] + this.y * t[ps] + this.z * t[gs] + t[ms], - ); - } - project(e) { - let t = e.values, - a = - 1 / (this.x * t[fs] + this.y * t[ys] + this.z * t[Es] + t[bs]); - return this.set( - (this.x * t[ns] + this.y * t[ss] + this.z * t[os] + t[rs]) * a, - (this.x * t[ls] + this.y * t[cs] + this.z * t[ds] + t[us]) * a, - (this.x * t[hs] + this.y * t[ps] + this.z * t[gs] + t[ms]) * a, - ); - } - dot(e) { - return this.x * e.x + this.y * e.y + this.z * e.z; - } - length() { - return Math.sqrt( - this.x * this.x + this.y * this.y + this.z * this.z, - ); - } - distance(e) { - let t = e.x - this.x, - a = e.y - this.y, - i = e.z - this.z; - return Math.sqrt(t * t + a * a + i * i); - } + isLoadingComplete() { + return 0 == this.toLoad; } - const ns = 0, - ss = 4, - os = 8, - rs = 12, - ls = 1, - cs = 5, - ds = 9, - us = 13, - hs = 2, - ps = 6, - gs = 10, - ms = 14, - fs = 3, - ys = 7, - Es = 11, - bs = 15; - class Ss { - constructor() { - ((this.temp = new Float32Array(16)), - (this.values = new Float32Array(16))); - let e = this.values; - ((e[ns] = 1), (e[cs] = 1), (e[gs] = 1), (e[bs] = 1)); - } - set(e) { - return (this.values.set(e), this); - } - transpose() { - let e = this.temp, - t = this.values; - return ( - (e[ns] = t[ns]), - (e[ss] = t[ls]), - (e[os] = t[hs]), - (e[rs] = t[fs]), - (e[ls] = t[ss]), - (e[cs] = t[cs]), - (e[ds] = t[ps]), - (e[us] = t[ys]), - (e[hs] = t[os]), - (e[ps] = t[ds]), - (e[gs] = t[gs]), - (e[ms] = t[Es]), - (e[fs] = t[rs]), - (e[ys] = t[us]), - (e[Es] = t[ms]), - (e[bs] = t[bs]), - this.set(e) - ); - } - identity() { - let e = this.values; - return ( - (e[ns] = 1), - (e[ss] = 0), - (e[os] = 0), - (e[rs] = 0), - (e[ls] = 0), - (e[cs] = 1), - (e[ds] = 0), - (e[us] = 0), - (e[hs] = 0), - (e[ps] = 0), - (e[gs] = 1), - (e[ms] = 0), - (e[fs] = 0), - (e[ys] = 0), - (e[Es] = 0), - (e[bs] = 1), - this - ); - } - invert() { - let e = this.values, - t = this.temp, - a = - e[fs] * e[ps] * e[ds] * e[rs] - - e[hs] * e[ys] * e[ds] * e[rs] - - e[fs] * e[cs] * e[gs] * e[rs] + - e[ls] * e[ys] * e[gs] * e[rs] + - e[hs] * e[cs] * e[Es] * e[rs] - - e[ls] * e[ps] * e[Es] * e[rs] - - e[fs] * e[ps] * e[os] * e[us] + - e[hs] * e[ys] * e[os] * e[us] + - e[fs] * e[ss] * e[gs] * e[us] - - e[ns] * e[ys] * e[gs] * e[us] - - e[hs] * e[ss] * e[Es] * e[us] + - e[ns] * e[ps] * e[Es] * e[us] + - e[fs] * e[cs] * e[os] * e[ms] - - e[ls] * e[ys] * e[os] * e[ms] - - e[fs] * e[ss] * e[ds] * e[ms] + - e[ns] * e[ys] * e[ds] * e[ms] + - e[ls] * e[ss] * e[Es] * e[ms] - - e[ns] * e[cs] * e[Es] * e[ms] - - e[hs] * e[cs] * e[os] * e[bs] + - e[ls] * e[ps] * e[os] * e[bs] + - e[hs] * e[ss] * e[ds] * e[bs] - - e[ns] * e[ps] * e[ds] * e[bs] - - e[ls] * e[ss] * e[gs] * e[bs] + - e[ns] * e[cs] * e[gs] * e[bs]; - if (0 == a) throw new Error("non-invertible matrix"); - let i = 1 / a; - return ( - (t[ns] = - e[ds] * e[ms] * e[ys] - - e[us] * e[gs] * e[ys] + - e[us] * e[ps] * e[Es] - - e[cs] * e[ms] * e[Es] - - e[ds] * e[ps] * e[bs] + - e[cs] * e[gs] * e[bs]), - (t[ss] = - e[rs] * e[gs] * e[ys] - - e[os] * e[ms] * e[ys] - - e[rs] * e[ps] * e[Es] + - e[ss] * e[ms] * e[Es] + - e[os] * e[ps] * e[bs] - - e[ss] * e[gs] * e[bs]), - (t[os] = - e[os] * e[us] * e[ys] - - e[rs] * e[ds] * e[ys] + - e[rs] * e[cs] * e[Es] - - e[ss] * e[us] * e[Es] - - e[os] * e[cs] * e[bs] + - e[ss] * e[ds] * e[bs]), - (t[rs] = - e[rs] * e[ds] * e[ps] - - e[os] * e[us] * e[ps] - - e[rs] * e[cs] * e[gs] + - e[ss] * e[us] * e[gs] + - e[os] * e[cs] * e[ms] - - e[ss] * e[ds] * e[ms]), - (t[ls] = - e[us] * e[gs] * e[fs] - - e[ds] * e[ms] * e[fs] - - e[us] * e[hs] * e[Es] + - e[ls] * e[ms] * e[Es] + - e[ds] * e[hs] * e[bs] - - e[ls] * e[gs] * e[bs]), - (t[cs] = - e[os] * e[ms] * e[fs] - - e[rs] * e[gs] * e[fs] + - e[rs] * e[hs] * e[Es] - - e[ns] * e[ms] * e[Es] - - e[os] * e[hs] * e[bs] + - e[ns] * e[gs] * e[bs]), - (t[ds] = - e[rs] * e[ds] * e[fs] - - e[os] * e[us] * e[fs] - - e[rs] * e[ls] * e[Es] + - e[ns] * e[us] * e[Es] + - e[os] * e[ls] * e[bs] - - e[ns] * e[ds] * e[bs]), - (t[us] = - e[os] * e[us] * e[hs] - - e[rs] * e[ds] * e[hs] + - e[rs] * e[ls] * e[gs] - - e[ns] * e[us] * e[gs] - - e[os] * e[ls] * e[ms] + - e[ns] * e[ds] * e[ms]), - (t[hs] = - e[cs] * e[ms] * e[fs] - - e[us] * e[ps] * e[fs] + - e[us] * e[hs] * e[ys] - - e[ls] * e[ms] * e[ys] - - e[cs] * e[hs] * e[bs] + - e[ls] * e[ps] * e[bs]), - (t[ps] = - e[rs] * e[ps] * e[fs] - - e[ss] * e[ms] * e[fs] - - e[rs] * e[hs] * e[ys] + - e[ns] * e[ms] * e[ys] + - e[ss] * e[hs] * e[bs] - - e[ns] * e[ps] * e[bs]), - (t[gs] = - e[ss] * e[us] * e[fs] - - e[rs] * e[cs] * e[fs] + - e[rs] * e[ls] * e[ys] - - e[ns] * e[us] * e[ys] - - e[ss] * e[ls] * e[bs] + - e[ns] * e[cs] * e[bs]), - (t[ms] = - e[rs] * e[cs] * e[hs] - - e[ss] * e[us] * e[hs] - - e[rs] * e[ls] * e[ps] + - e[ns] * e[us] * e[ps] + - e[ss] * e[ls] * e[ms] - - e[ns] * e[cs] * e[ms]), - (t[fs] = - e[ds] * e[ps] * e[fs] - - e[cs] * e[gs] * e[fs] - - e[ds] * e[hs] * e[ys] + - e[ls] * e[gs] * e[ys] + - e[cs] * e[hs] * e[Es] - - e[ls] * e[ps] * e[Es]), - (t[ys] = - e[ss] * e[gs] * e[fs] - - e[os] * e[ps] * e[fs] + - e[os] * e[hs] * e[ys] - - e[ns] * e[gs] * e[ys] - - e[ss] * e[hs] * e[Es] + - e[ns] * e[ps] * e[Es]), - (t[Es] = - e[os] * e[cs] * e[fs] - - e[ss] * e[ds] * e[fs] - - e[os] * e[ls] * e[ys] + - e[ns] * e[ds] * e[ys] + - e[ss] * e[ls] * e[Es] - - e[ns] * e[cs] * e[Es]), - (t[bs] = - e[ss] * e[ds] * e[hs] - - e[os] * e[cs] * e[hs] + - e[os] * e[ls] * e[ps] - - e[ns] * e[ds] * e[ps] - - e[ss] * e[ls] * e[gs] + - e[ns] * e[cs] * e[gs]), - (e[ns] = t[ns] * i), - (e[ss] = t[ss] * i), - (e[os] = t[os] * i), - (e[rs] = t[rs] * i), - (e[ls] = t[ls] * i), - (e[cs] = t[cs] * i), - (e[ds] = t[ds] * i), - (e[us] = t[us] * i), - (e[hs] = t[hs] * i), - (e[ps] = t[ps] * i), - (e[gs] = t[gs] * i), - (e[ms] = t[ms] * i), - (e[fs] = t[fs] * i), - (e[ys] = t[ys] * i), - (e[Es] = t[Es] * i), - (e[bs] = t[bs] * i), - this - ); - } - determinant() { - let e = this.values; - return ( + getToLoad() { + return this.toLoad; + } + getLoaded() { + return this.loaded; + } + dispose() { + this.removeAll(); + } + hasErrors() { + return Object.keys(this.errors).length > 0; + } + getErrors() { + return this.errors; + } + } { + constructor(e, t = "", a = null) { + super((t) => new ts(e, t), t, a); + } + } + class is { + constructor(e = 0, t = 0, a = 0) { + ((this.x = 0), + (this.y = 0), + (this.z = 0), + (this.x = e), + (this.y = t), + (this.z = a)); + } + setFrom(e) { + return ((this.x = e.x), (this.y = e.y), (this.z = e.z), this); + } + set(e, t, a) { + return ((this.x = e), (this.y = t), (this.z = a), this); + } + add(e) { + return ((this.x += e.x), (this.y += e.y), (this.z += e.z), this); + } + sub(e) { + return ((this.x -= e.x), (this.y -= e.y), (this.z -= e.z), this); + } + scale(e) { + return ((this.x *= e), (this.y *= e), (this.z *= e), this); + } + normalize() { + let e = this.length(); + return ( + 0 == e || + ((e = 1 / e), (this.x *= e), (this.y *= e), (this.z *= e)), + this + ); + } + cross(e) { + return this.set( + this.y * e.z - this.z * e.y, + this.z * e.x - this.x * e.z, + this.x * e.y - this.y * e.x, + ); + } + multiply(e) { + let t = e.values; + return this.set( + this.x * t[ns] + this.y * t[ss] + this.z * t[os] + t[rs], + this.x * t[ls] + this.y * t[cs] + this.z * t[ds] + t[us], + this.x * t[hs] + this.y * t[ps] + this.z * t[gs] + t[ms], + ); + } + project(e) { + let t = e.values, + a = + 1 / (this.x * t[fs] + this.y * t[ys] + this.z * t[Es] + t[bs]); + return this.set( + (this.x * t[ns] + this.y * t[ss] + this.z * t[os] + t[rs]) * a, + (this.x * t[ls] + this.y * t[cs] + this.z * t[ds] + t[us]) * a, + (this.x * t[hs] + this.y * t[ps] + this.z * t[gs] + t[ms]) * a, + ); + } + dot(e) { + return this.x * e.x + this.y * e.y + this.z * e.z; + } + length() { + return Math.sqrt( + this.x * this.x + this.y * this.y + this.z * this.z, + ); + } + distance(e) { + let t = e.x - this.x, + a = e.y - this.y, + i = e.z - this.z; + return Math.sqrt(t * t + a * a + i * i); + } + } + const ns = 0, + ss = 4, + os = 8, + rs = 12, + ls = 1, + cs = 5, + ds = 9, + us = 13, + hs = 2, + ps = 6, + gs = 10, + ms = 14, + fs = 3, + ys = 7, + Es = 11, + bs = 15; + class Ss { + constructor() { + ((this.temp = new Float32Array(16)), + (this.values = new Float32Array(16))); + let e = this.values; + ((e[ns] = 1), (e[cs] = 1), (e[gs] = 1), (e[bs] = 1)); + } + set(e) { + return (this.values.set(e), this); + } + transpose() { + let e = this.temp, + t = this.values; + return ( + (e[ns] = t[ns]), + (e[ss] = t[ls]), + (e[os] = t[hs]), + (e[rs] = t[fs]), + (e[ls] = t[ss]), + (e[cs] = t[cs]), + (e[ds] = t[ps]), + (e[us] = t[ys]), + (e[hs] = t[os]), + (e[ps] = t[ds]), + (e[gs] = t[gs]), + (e[ms] = t[Es]), + (e[fs] = t[rs]), + (e[ys] = t[us]), + (e[Es] = t[ms]), + (e[bs] = t[bs]), + this.set(e) + ); + } + identity() { + let e = this.values; + return ( + (e[ns] = 1), + (e[ss] = 0), + (e[os] = 0), + (e[rs] = 0), + (e[ls] = 0), + (e[cs] = 1), + (e[ds] = 0), + (e[us] = 0), + (e[hs] = 0), + (e[ps] = 0), + (e[gs] = 1), + (e[ms] = 0), + (e[fs] = 0), + (e[ys] = 0), + (e[Es] = 0), + (e[bs] = 1), + this + ); + } + invert() { + let e = this.values, + t = this.temp, + a = e[fs] * e[ps] * e[ds] * e[rs] - e[hs] * e[ys] * e[ds] * e[rs] - e[fs] * e[cs] * e[gs] * e[rs] + @@ -29175,492 +28987,653 @@ var version = "v1.17.2"; e[hs] * e[ss] * e[ds] * e[bs] - e[ns] * e[ps] * e[ds] * e[bs] - e[ls] * e[ss] * e[gs] * e[bs] + - e[ns] * e[cs] * e[gs] * e[bs] - ); - } - translate(e, t, a) { - let i = this.values; - return ((i[rs] += e), (i[us] += t), (i[ms] += a), this); - } - copy() { - return new Ss().set(this.values); - } - projection(e, t, a, i) { - this.identity(); - let n = 1 / Math.tan((a * (Math.PI / 180)) / 2), - s = (t + e) / (e - t), - o = (2 * t * e) / (e - t), - r = this.values; - return ( - (r[ns] = n / i), - (r[ls] = 0), - (r[hs] = 0), - (r[fs] = 0), - (r[ss] = 0), - (r[cs] = n), - (r[ps] = 0), - (r[ys] = 0), - (r[os] = 0), - (r[ds] = 0), - (r[gs] = s), - (r[Es] = -1), - (r[rs] = 0), - (r[us] = 0), - (r[ms] = o), - (r[bs] = 0), - this - ); - } - ortho2d(e, t, a, i) { - return this.ortho(e, e + a, t, t + i, 0, 1); - } - ortho(e, t, a, i, n, s) { - this.identity(); - let o = 2 / (t - e), - r = 2 / (i - a), - l = -2 / (s - n), - c = -(t + e) / (t - e), - d = -(i + a) / (i - a), - u = -(s + n) / (s - n), - h = this.values; - return ( - (h[ns] = o), - (h[ls] = 0), - (h[hs] = 0), - (h[fs] = 0), - (h[ss] = 0), - (h[cs] = r), - (h[ps] = 0), - (h[ys] = 0), - (h[os] = 0), - (h[ds] = 0), - (h[gs] = l), - (h[Es] = 0), - (h[rs] = c), - (h[us] = d), - (h[ms] = u), - (h[bs] = 1), - this - ); - } - multiply(e) { - let t = this.temp, - a = this.values, - i = e.values; - return ( - (t[ns] = - a[ns] * i[ns] + a[ss] * i[ls] + a[os] * i[hs] + a[rs] * i[fs]), - (t[ss] = - a[ns] * i[ss] + a[ss] * i[cs] + a[os] * i[ps] + a[rs] * i[ys]), - (t[os] = - a[ns] * i[os] + a[ss] * i[ds] + a[os] * i[gs] + a[rs] * i[Es]), - (t[rs] = - a[ns] * i[rs] + a[ss] * i[us] + a[os] * i[ms] + a[rs] * i[bs]), - (t[ls] = - a[ls] * i[ns] + a[cs] * i[ls] + a[ds] * i[hs] + a[us] * i[fs]), - (t[cs] = - a[ls] * i[ss] + a[cs] * i[cs] + a[ds] * i[ps] + a[us] * i[ys]), - (t[ds] = - a[ls] * i[os] + a[cs] * i[ds] + a[ds] * i[gs] + a[us] * i[Es]), - (t[us] = - a[ls] * i[rs] + a[cs] * i[us] + a[ds] * i[ms] + a[us] * i[bs]), - (t[hs] = - a[hs] * i[ns] + a[ps] * i[ls] + a[gs] * i[hs] + a[ms] * i[fs]), - (t[ps] = - a[hs] * i[ss] + a[ps] * i[cs] + a[gs] * i[ps] + a[ms] * i[ys]), - (t[gs] = - a[hs] * i[os] + a[ps] * i[ds] + a[gs] * i[gs] + a[ms] * i[Es]), - (t[ms] = - a[hs] * i[rs] + a[ps] * i[us] + a[gs] * i[ms] + a[ms] * i[bs]), - (t[fs] = - a[fs] * i[ns] + a[ys] * i[ls] + a[Es] * i[hs] + a[bs] * i[fs]), - (t[ys] = - a[fs] * i[ss] + a[ys] * i[cs] + a[Es] * i[ps] + a[bs] * i[ys]), - (t[Es] = - a[fs] * i[os] + a[ys] * i[ds] + a[Es] * i[gs] + a[bs] * i[Es]), - (t[bs] = - a[fs] * i[rs] + a[ys] * i[us] + a[Es] * i[ms] + a[bs] * i[bs]), - this.set(this.temp) - ); - } - multiplyLeft(e) { - let t = this.temp, - a = this.values, - i = e.values; - return ( - (t[ns] = - i[ns] * a[ns] + i[ss] * a[ls] + i[os] * a[hs] + i[rs] * a[fs]), - (t[ss] = - i[ns] * a[ss] + i[ss] * a[cs] + i[os] * a[ps] + i[rs] * a[ys]), - (t[os] = - i[ns] * a[os] + i[ss] * a[ds] + i[os] * a[gs] + i[rs] * a[Es]), - (t[rs] = - i[ns] * a[rs] + i[ss] * a[us] + i[os] * a[ms] + i[rs] * a[bs]), - (t[ls] = - i[ls] * a[ns] + i[cs] * a[ls] + i[ds] * a[hs] + i[us] * a[fs]), - (t[cs] = - i[ls] * a[ss] + i[cs] * a[cs] + i[ds] * a[ps] + i[us] * a[ys]), - (t[ds] = - i[ls] * a[os] + i[cs] * a[ds] + i[ds] * a[gs] + i[us] * a[Es]), - (t[us] = - i[ls] * a[rs] + i[cs] * a[us] + i[ds] * a[ms] + i[us] * a[bs]), - (t[hs] = - i[hs] * a[ns] + i[ps] * a[ls] + i[gs] * a[hs] + i[ms] * a[fs]), - (t[ps] = - i[hs] * a[ss] + i[ps] * a[cs] + i[gs] * a[ps] + i[ms] * a[ys]), - (t[gs] = - i[hs] * a[os] + i[ps] * a[ds] + i[gs] * a[gs] + i[ms] * a[Es]), - (t[ms] = - i[hs] * a[rs] + i[ps] * a[us] + i[gs] * a[ms] + i[ms] * a[bs]), - (t[fs] = - i[fs] * a[ns] + i[ys] * a[ls] + i[Es] * a[hs] + i[bs] * a[fs]), - (t[ys] = - i[fs] * a[ss] + i[ys] * a[cs] + i[Es] * a[ps] + i[bs] * a[ys]), - (t[Es] = - i[fs] * a[os] + i[ys] * a[ds] + i[Es] * a[gs] + i[bs] * a[Es]), - (t[bs] = - i[fs] * a[rs] + i[ys] * a[us] + i[Es] * a[ms] + i[bs] * a[bs]), - this.set(this.temp) - ); - } - lookAt(e, t, a) { - Ss.initTemps(); - let i = Ss.xAxis, - n = Ss.yAxis, - s = Ss.zAxis; - (s.setFrom(t).normalize(), - i.setFrom(t).normalize(), - i.cross(a).normalize(), - n.setFrom(i).cross(s).normalize(), - this.identity()); - let o = this.values; - return ( - (o[ns] = i.x), - (o[ss] = i.y), - (o[os] = i.z), - (o[ls] = n.x), - (o[cs] = n.y), - (o[ds] = n.z), - (o[hs] = -s.x), - (o[ps] = -s.y), - (o[gs] = -s.z), - Ss.tmpMatrix.identity(), - (Ss.tmpMatrix.values[rs] = -e.x), - (Ss.tmpMatrix.values[us] = -e.y), - (Ss.tmpMatrix.values[ms] = -e.z), - this.multiply(Ss.tmpMatrix), - this - ); - } - static initTemps() { - (null === Ss.xAxis && (Ss.xAxis = new is()), - null === Ss.yAxis && (Ss.yAxis = new is()), - null === Ss.zAxis && (Ss.zAxis = new is())); - } + e[ns] * e[cs] * e[gs] * e[bs]; + if (0 == a) throw new Error("non-invertible matrix"); + let i = 1 / a; + return ( + (t[ns] = + e[ds] * e[ms] * e[ys] - + e[us] * e[gs] * e[ys] + + e[us] * e[ps] * e[Es] - + e[cs] * e[ms] * e[Es] - + e[ds] * e[ps] * e[bs] + + e[cs] * e[gs] * e[bs]), + (t[ss] = + e[rs] * e[gs] * e[ys] - + e[os] * e[ms] * e[ys] - + e[rs] * e[ps] * e[Es] + + e[ss] * e[ms] * e[Es] + + e[os] * e[ps] * e[bs] - + e[ss] * e[gs] * e[bs]), + (t[os] = + e[os] * e[us] * e[ys] - + e[rs] * e[ds] * e[ys] + + e[rs] * e[cs] * e[Es] - + e[ss] * e[us] * e[Es] - + e[os] * e[cs] * e[bs] + + e[ss] * e[ds] * e[bs]), + (t[rs] = + e[rs] * e[ds] * e[ps] - + e[os] * e[us] * e[ps] - + e[rs] * e[cs] * e[gs] + + e[ss] * e[us] * e[gs] + + e[os] * e[cs] * e[ms] - + e[ss] * e[ds] * e[ms]), + (t[ls] = + e[us] * e[gs] * e[fs] - + e[ds] * e[ms] * e[fs] - + e[us] * e[hs] * e[Es] + + e[ls] * e[ms] * e[Es] + + e[ds] * e[hs] * e[bs] - + e[ls] * e[gs] * e[bs]), + (t[cs] = + e[os] * e[ms] * e[fs] - + e[rs] * e[gs] * e[fs] + + e[rs] * e[hs] * e[Es] - + e[ns] * e[ms] * e[Es] - + e[os] * e[hs] * e[bs] + + e[ns] * e[gs] * e[bs]), + (t[ds] = + e[rs] * e[ds] * e[fs] - + e[os] * e[us] * e[fs] - + e[rs] * e[ls] * e[Es] + + e[ns] * e[us] * e[Es] + + e[os] * e[ls] * e[bs] - + e[ns] * e[ds] * e[bs]), + (t[us] = + e[os] * e[us] * e[hs] - + e[rs] * e[ds] * e[hs] + + e[rs] * e[ls] * e[gs] - + e[ns] * e[us] * e[gs] - + e[os] * e[ls] * e[ms] + + e[ns] * e[ds] * e[ms]), + (t[hs] = + e[cs] * e[ms] * e[fs] - + e[us] * e[ps] * e[fs] + + e[us] * e[hs] * e[ys] - + e[ls] * e[ms] * e[ys] - + e[cs] * e[hs] * e[bs] + + e[ls] * e[ps] * e[bs]), + (t[ps] = + e[rs] * e[ps] * e[fs] - + e[ss] * e[ms] * e[fs] - + e[rs] * e[hs] * e[ys] + + e[ns] * e[ms] * e[ys] + + e[ss] * e[hs] * e[bs] - + e[ns] * e[ps] * e[bs]), + (t[gs] = + e[ss] * e[us] * e[fs] - + e[rs] * e[cs] * e[fs] + + e[rs] * e[ls] * e[ys] - + e[ns] * e[us] * e[ys] - + e[ss] * e[ls] * e[bs] + + e[ns] * e[cs] * e[bs]), + (t[ms] = + e[rs] * e[cs] * e[hs] - + e[ss] * e[us] * e[hs] - + e[rs] * e[ls] * e[ps] + + e[ns] * e[us] * e[ps] + + e[ss] * e[ls] * e[ms] - + e[ns] * e[cs] * e[ms]), + (t[fs] = + e[ds] * e[ps] * e[fs] - + e[cs] * e[gs] * e[fs] - + e[ds] * e[hs] * e[ys] + + e[ls] * e[gs] * e[ys] + + e[cs] * e[hs] * e[Es] - + e[ls] * e[ps] * e[Es]), + (t[ys] = + e[ss] * e[gs] * e[fs] - + e[os] * e[ps] * e[fs] + + e[os] * e[hs] * e[ys] - + e[ns] * e[gs] * e[ys] - + e[ss] * e[hs] * e[Es] + + e[ns] * e[ps] * e[Es]), + (t[Es] = + e[os] * e[cs] * e[fs] - + e[ss] * e[ds] * e[fs] - + e[os] * e[ls] * e[ys] + + e[ns] * e[ds] * e[ys] + + e[ss] * e[ls] * e[Es] - + e[ns] * e[cs] * e[Es]), + (t[bs] = + e[ss] * e[ds] * e[hs] - + e[os] * e[cs] * e[hs] + + e[os] * e[ls] * e[ps] - + e[ns] * e[ds] * e[ps] - + e[ss] * e[ls] * e[gs] + + e[ns] * e[cs] * e[gs]), + (e[ns] = t[ns] * i), + (e[ss] = t[ss] * i), + (e[os] = t[os] * i), + (e[rs] = t[rs] * i), + (e[ls] = t[ls] * i), + (e[cs] = t[cs] * i), + (e[ds] = t[ds] * i), + (e[us] = t[us] * i), + (e[hs] = t[hs] * i), + (e[ps] = t[ps] * i), + (e[gs] = t[gs] * i), + (e[ms] = t[ms] * i), + (e[fs] = t[fs] * i), + (e[ys] = t[ys] * i), + (e[Es] = t[Es] * i), + (e[bs] = t[bs] * i), + this + ); } - ((Ss.xAxis = null), - (Ss.yAxis = null), - (Ss.zAxis = null), - (Ss.tmpMatrix = new Ss())); - class Is { - constructor(e, t, a) { - ((this.vertexShader = t), - (this.fragmentShader = a), - (this.vs = null), - (this.fs = null), - (this.program = null), - (this.tmp2x2 = new Float32Array(4)), - (this.tmp3x3 = new Float32Array(9)), - (this.tmp4x4 = new Float32Array(16)), - (this.vsSource = t), - (this.fsSource = a), - (this.context = e instanceof Zn ? e : new Zn(e)), - this.context.addRestorable(this), - this.compile()); - } - getProgram() { - return this.program; - } - getVertexShader() { - return this.vertexShader; - } - getFragmentShader() { - return this.fragmentShader; - } - getVertexShaderSource() { - return this.vsSource; - } - getFragmentSource() { - return this.fsSource; - } - compile() { - let e = this.context.gl; - try { - ((this.vs = this.compileShader( - e.VERTEX_SHADER, - this.vertexShader, + determinant() { + let e = this.values; + return ( + e[fs] * e[ps] * e[ds] * e[rs] - + e[hs] * e[ys] * e[ds] * e[rs] - + e[fs] * e[cs] * e[gs] * e[rs] + + e[ls] * e[ys] * e[gs] * e[rs] + + e[hs] * e[cs] * e[Es] * e[rs] - + e[ls] * e[ps] * e[Es] * e[rs] - + e[fs] * e[ps] * e[os] * e[us] + + e[hs] * e[ys] * e[os] * e[us] + + e[fs] * e[ss] * e[gs] * e[us] - + e[ns] * e[ys] * e[gs] * e[us] - + e[hs] * e[ss] * e[Es] * e[us] + + e[ns] * e[ps] * e[Es] * e[us] + + e[fs] * e[cs] * e[os] * e[ms] - + e[ls] * e[ys] * e[os] * e[ms] - + e[fs] * e[ss] * e[ds] * e[ms] + + e[ns] * e[ys] * e[ds] * e[ms] + + e[ls] * e[ss] * e[Es] * e[ms] - + e[ns] * e[cs] * e[Es] * e[ms] - + e[hs] * e[cs] * e[os] * e[bs] + + e[ls] * e[ps] * e[os] * e[bs] + + e[hs] * e[ss] * e[ds] * e[bs] - + e[ns] * e[ps] * e[ds] * e[bs] - + e[ls] * e[ss] * e[gs] * e[bs] + + e[ns] * e[cs] * e[gs] * e[bs] + ); + } + translate(e, t, a) { + let i = this.values; + return ((i[rs] += e), (i[us] += t), (i[ms] += a), this); + } + copy() { + return new Ss().set(this.values); + } + projection(e, t, a, i) { + this.identity(); + let n = 1 / Math.tan((a * (Math.PI / 180)) / 2), + s = (t + e) / (e - t), + o = (2 * t * e) / (e - t), + r = this.values; + return ( + (r[ns] = n / i), + (r[ls] = 0), + (r[hs] = 0), + (r[fs] = 0), + (r[ss] = 0), + (r[cs] = n), + (r[ps] = 0), + (r[ys] = 0), + (r[os] = 0), + (r[ds] = 0), + (r[gs] = s), + (r[Es] = -1), + (r[rs] = 0), + (r[us] = 0), + (r[ms] = o), + (r[bs] = 0), + this + ); + } + ortho2d(e, t, a, i) { + return this.ortho(e, e + a, t, t + i, 0, 1); + } + ortho(e, t, a, i, n, s) { + this.identity(); + let o = 2 / (t - e), + r = 2 / (i - a), + l = -2 / (s - n), + c = -(t + e) / (t - e), + d = -(i + a) / (i - a), + u = -(s + n) / (s - n), + h = this.values; + return ( + (h[ns] = o), + (h[ls] = 0), + (h[hs] = 0), + (h[fs] = 0), + (h[ss] = 0), + (h[cs] = r), + (h[ps] = 0), + (h[ys] = 0), + (h[os] = 0), + (h[ds] = 0), + (h[gs] = l), + (h[Es] = 0), + (h[rs] = c), + (h[us] = d), + (h[ms] = u), + (h[bs] = 1), + this + ); + } + multiply(e) { + let t = this.temp, + a = this.values, + i = e.values; + return ( + (t[ns] = + a[ns] * i[ns] + a[ss] * i[ls] + a[os] * i[hs] + a[rs] * i[fs]), + (t[ss] = + a[ns] * i[ss] + a[ss] * i[cs] + a[os] * i[ps] + a[rs] * i[ys]), + (t[os] = + a[ns] * i[os] + a[ss] * i[ds] + a[os] * i[gs] + a[rs] * i[Es]), + (t[rs] = + a[ns] * i[rs] + a[ss] * i[us] + a[os] * i[ms] + a[rs] * i[bs]), + (t[ls] = + a[ls] * i[ns] + a[cs] * i[ls] + a[ds] * i[hs] + a[us] * i[fs]), + (t[cs] = + a[ls] * i[ss] + a[cs] * i[cs] + a[ds] * i[ps] + a[us] * i[ys]), + (t[ds] = + a[ls] * i[os] + a[cs] * i[ds] + a[ds] * i[gs] + a[us] * i[Es]), + (t[us] = + a[ls] * i[rs] + a[cs] * i[us] + a[ds] * i[ms] + a[us] * i[bs]), + (t[hs] = + a[hs] * i[ns] + a[ps] * i[ls] + a[gs] * i[hs] + a[ms] * i[fs]), + (t[ps] = + a[hs] * i[ss] + a[ps] * i[cs] + a[gs] * i[ps] + a[ms] * i[ys]), + (t[gs] = + a[hs] * i[os] + a[ps] * i[ds] + a[gs] * i[gs] + a[ms] * i[Es]), + (t[ms] = + a[hs] * i[rs] + a[ps] * i[us] + a[gs] * i[ms] + a[ms] * i[bs]), + (t[fs] = + a[fs] * i[ns] + a[ys] * i[ls] + a[Es] * i[hs] + a[bs] * i[fs]), + (t[ys] = + a[fs] * i[ss] + a[ys] * i[cs] + a[Es] * i[ps] + a[bs] * i[ys]), + (t[Es] = + a[fs] * i[os] + a[ys] * i[ds] + a[Es] * i[gs] + a[bs] * i[Es]), + (t[bs] = + a[fs] * i[rs] + a[ys] * i[us] + a[Es] * i[ms] + a[bs] * i[bs]), + this.set(this.temp) + ); + } + multiplyLeft(e) { + let t = this.temp, + a = this.values, + i = e.values; + return ( + (t[ns] = + i[ns] * a[ns] + i[ss] * a[ls] + i[os] * a[hs] + i[rs] * a[fs]), + (t[ss] = + i[ns] * a[ss] + i[ss] * a[cs] + i[os] * a[ps] + i[rs] * a[ys]), + (t[os] = + i[ns] * a[os] + i[ss] * a[ds] + i[os] * a[gs] + i[rs] * a[Es]), + (t[rs] = + i[ns] * a[rs] + i[ss] * a[us] + i[os] * a[ms] + i[rs] * a[bs]), + (t[ls] = + i[ls] * a[ns] + i[cs] * a[ls] + i[ds] * a[hs] + i[us] * a[fs]), + (t[cs] = + i[ls] * a[ss] + i[cs] * a[cs] + i[ds] * a[ps] + i[us] * a[ys]), + (t[ds] = + i[ls] * a[os] + i[cs] * a[ds] + i[ds] * a[gs] + i[us] * a[Es]), + (t[us] = + i[ls] * a[rs] + i[cs] * a[us] + i[ds] * a[ms] + i[us] * a[bs]), + (t[hs] = + i[hs] * a[ns] + i[ps] * a[ls] + i[gs] * a[hs] + i[ms] * a[fs]), + (t[ps] = + i[hs] * a[ss] + i[ps] * a[cs] + i[gs] * a[ps] + i[ms] * a[ys]), + (t[gs] = + i[hs] * a[os] + i[ps] * a[ds] + i[gs] * a[gs] + i[ms] * a[Es]), + (t[ms] = + i[hs] * a[rs] + i[ps] * a[us] + i[gs] * a[ms] + i[ms] * a[bs]), + (t[fs] = + i[fs] * a[ns] + i[ys] * a[ls] + i[Es] * a[hs] + i[bs] * a[fs]), + (t[ys] = + i[fs] * a[ss] + i[ys] * a[cs] + i[Es] * a[ps] + i[bs] * a[ys]), + (t[Es] = + i[fs] * a[os] + i[ys] * a[ds] + i[Es] * a[gs] + i[bs] * a[Es]), + (t[bs] = + i[fs] * a[rs] + i[ys] * a[us] + i[Es] * a[ms] + i[bs] * a[bs]), + this.set(this.temp) + ); + } + lookAt(e, t, a) { + Ss.initTemps(); + let i = Ss.xAxis, + n = Ss.yAxis, + s = Ss.zAxis; + (s.setFrom(t).normalize(), + i.setFrom(t).normalize(), + i.cross(a).normalize(), + n.setFrom(i).cross(s).normalize(), + this.identity()); + let o = this.values; + return ( + (o[ns] = i.x), + (o[ss] = i.y), + (o[os] = i.z), + (o[ls] = n.x), + (o[cs] = n.y), + (o[ds] = n.z), + (o[hs] = -s.x), + (o[ps] = -s.y), + (o[gs] = -s.z), + Ss.tmpMatrix.identity(), + (Ss.tmpMatrix.values[rs] = -e.x), + (Ss.tmpMatrix.values[us] = -e.y), + (Ss.tmpMatrix.values[ms] = -e.z), + this.multiply(Ss.tmpMatrix), + this + ); + } + static initTemps() { + (null === Ss.xAxis && (Ss.xAxis = new is()), + null === Ss.yAxis && (Ss.yAxis = new is()), + null === Ss.zAxis && (Ss.zAxis = new is())); + } + } + ((Ss.xAxis = null), + (Ss.yAxis = null), + (Ss.zAxis = null), + (Ss.tmpMatrix = new Ss())); + class Is { + constructor(e, t, a) { + ((this.vertexShader = t), + (this.fragmentShader = a), + (this.vs = null), + (this.fs = null), + (this.program = null), + (this.tmp2x2 = new Float32Array(4)), + (this.tmp3x3 = new Float32Array(9)), + (this.tmp4x4 = new Float32Array(16)), + (this.vsSource = t), + (this.fsSource = a), + (this.context = e instanceof Zn ? e : new Zn(e)), + this.context.addRestorable(this), + this.compile()); + } + getProgram() { + return this.program; + } + getVertexShader() { + return this.vertexShader; + } + getFragmentShader() { + return this.fragmentShader; + } + getVertexShaderSource() { + return this.vsSource; + } + getFragmentSource() { + return this.fsSource; + } + compile() { + let e = this.context.gl; + try { + ((this.vs = this.compileShader( + e.VERTEX_SHADER, + this.vertexShader, + )), + (this.fs = this.compileShader( + e.FRAGMENT_SHADER, + this.fragmentShader, )), - (this.fs = this.compileShader( - e.FRAGMENT_SHADER, - this.fragmentShader, - )), - (this.program = this.compileProgram(this.vs, this.fs))); - } catch (e) { - throw (this.dispose(), e); - } + (this.program = this.compileProgram(this.vs, this.fs))); + } catch (e) { + throw (this.dispose(), e); } - compileShader(e, t) { - let a = this.context.gl, - i = a.createShader(e); - if ( - (a.shaderSource(i, t), + } + compileShader(e, t) { + let a = this.context.gl, + i = a.createShader(e); + if ( + (a.shaderSource(i, t), a.compileShader(i), !a.getShaderParameter(i, a.COMPILE_STATUS)) - ) { - let e = "Couldn't compile shader: " + a.getShaderInfoLog(i); - if ((a.deleteShader(i), !a.isContextLost())) throw new Error(e); - } - return i; + ) { + let e = "Couldn't compile shader: " + a.getShaderInfoLog(i); + if ((a.deleteShader(i), !a.isContextLost())) throw new Error(e); } - compileProgram(e, t) { - let a = this.context.gl, - i = a.createProgram(); - if ( - (a.attachShader(i, e), + return i; + } + compileProgram(e, t) { + let a = this.context.gl, + i = a.createProgram(); + if ( + (a.attachShader(i, e), a.attachShader(i, t), a.linkProgram(i), !a.getProgramParameter(i, a.LINK_STATUS)) - ) { - let e = - "Couldn't compile shader program: " + a.getProgramInfoLog(i); - if ((a.deleteProgram(i), !a.isContextLost())) throw new Error(e); - } - return i; - } - restore() { - this.compile(); - } - bind() { - this.context.gl.useProgram(this.program); - } - unbind() { - this.context.gl.useProgram(null); - } - setUniformi(e, t) { - this.context.gl.uniform1i(this.getUniformLocation(e), t); - } - setUniformf(e, t) { - this.context.gl.uniform1f(this.getUniformLocation(e), t); - } - setUniform2f(e, t, a) { - this.context.gl.uniform2f(this.getUniformLocation(e), t, a); - } - setUniform3f(e, t, a, i) { - this.context.gl.uniform3f(this.getUniformLocation(e), t, a, i); - } - setUniform4f(e, t, a, i, n) { - this.context.gl.uniform4f(this.getUniformLocation(e), t, a, i, n); - } - setUniform2x2f(e, t) { - let a = this.context.gl; - (this.tmp2x2.set(t), - a.uniformMatrix2fv( - this.getUniformLocation(e), - false, - this.tmp2x2, - )); - } - setUniform3x3f(e, t) { - let a = this.context.gl; - (this.tmp3x3.set(t), - a.uniformMatrix3fv( - this.getUniformLocation(e), - false, - this.tmp3x3, - )); - } - setUniform4x4f(e, t) { - let a = this.context.gl; - (this.tmp4x4.set(t), - a.uniformMatrix4fv( - this.getUniformLocation(e), - false, - this.tmp4x4, - )); - } - getUniformLocation(e) { - let t = this.context.gl, - a = t.getUniformLocation(this.program, e); - if (!a && !t.isContextLost()) - throw new Error(`Couldn't find location for uniform ${e}`); - return a; - } - getAttributeLocation(e) { - let t = this.context.gl, - a = t.getAttribLocation(this.program, e); - if (-1 == a && !t.isContextLost()) - throw new Error(`Couldn't find location for attribute ${e}`); - return a; - } - dispose() { - this.context.removeRestorable(this); - let e = this.context.gl; - (this.vs && (e.deleteShader(this.vs), (this.vs = null)), - this.fs && (e.deleteShader(this.fs), (this.fs = null)), - this.program && - (e.deleteProgram(this.program), (this.program = null))); - } - static newColoredTextured(e) { - let t = `\n\t\t\t\tattribute vec4 ${Is.POSITION};\n\t\t\t\tattribute vec4 ${Is.COLOR};\n\t\t\t\tattribute vec2 ${Is.TEXCOORDS};\n\t\t\t\tuniform mat4 ${Is.MVP_MATRIX};\n\t\t\t\tvarying vec4 v_color;\n\t\t\t\tvarying vec2 v_texCoords;\n\n\t\t\t\tvoid main () {\n\t\t\t\t\tv_color = ${Is.COLOR};\n\t\t\t\t\tv_texCoords = ${Is.TEXCOORDS};\n\t\t\t\t\tgl_Position = ${Is.MVP_MATRIX} * ${Is.POSITION};\n\t\t\t\t}\n\t\t\t`; - return new Is( - e, - t, - "\n\t\t\t\t#ifdef GL_ES\n\t\t\t\t\t#define LOWP lowp\n\t\t\t\t\tprecision mediump float;\n\t\t\t\t#else\n\t\t\t\t\t#define LOWP\n\t\t\t\t#endif\n\t\t\t\tvarying LOWP vec4 v_color;\n\t\t\t\tvarying vec2 v_texCoords;\n\t\t\t\tuniform sampler2D u_texture;\n\n\t\t\t\tvoid main () {\n\t\t\t\t\tgl_FragColor = v_color * texture2D(u_texture, v_texCoords);\n\t\t\t\t}\n\t\t\t", - ); + ) { + let e = + "Couldn't compile shader program: " + a.getProgramInfoLog(i); + if ((a.deleteProgram(i), !a.isContextLost())) throw new Error(e); } - static newTwoColoredTextured(e) { - let t = `\n\t\t\t\tattribute vec4 ${Is.POSITION};\n\t\t\t\tattribute vec4 ${Is.COLOR};\n\t\t\t\tattribute vec4 ${Is.COLOR2};\n\t\t\t\tattribute vec2 ${Is.TEXCOORDS};\n\t\t\t\tuniform mat4 ${Is.MVP_MATRIX};\n\t\t\t\tvarying vec4 v_light;\n\t\t\t\tvarying vec4 v_dark;\n\t\t\t\tvarying vec2 v_texCoords;\n\n\t\t\t\tvoid main () {\n\t\t\t\t\tv_light = ${Is.COLOR};\n\t\t\t\t\tv_dark = ${Is.COLOR2};\n\t\t\t\t\tv_texCoords = ${Is.TEXCOORDS};\n\t\t\t\t\tgl_Position = ${Is.MVP_MATRIX} * ${Is.POSITION};\n\t\t\t\t}\n\t\t\t`; - return new Is( - e, - t, - "\n\t\t\t\t#ifdef GL_ES\n\t\t\t\t\t#define LOWP lowp\n\t\t\t\t\tprecision mediump float;\n\t\t\t\t#else\n\t\t\t\t\t#define LOWP\n\t\t\t\t#endif\n\t\t\t\tvarying LOWP vec4 v_light;\n\t\t\t\tvarying LOWP vec4 v_dark;\n\t\t\t\tvarying vec2 v_texCoords;\n\t\t\t\tuniform sampler2D u_texture;\n\n\t\t\t\tvoid main () {\n\t\t\t\t\tvec4 texColor = texture2D(u_texture, v_texCoords);\n\t\t\t\t\tgl_FragColor.a = texColor.a * v_light.a;\n\t\t\t\t\tgl_FragColor.rgb = ((texColor.a - 1.0) * v_dark.a + 1.0 - texColor.rgb) * v_dark.rgb + texColor.rgb * v_light.rgb;\n\t\t\t\t}\n\t\t\t", - ); - } - static newColored(e) { - let t = `\n\t\t\t\tattribute vec4 ${Is.POSITION};\n\t\t\t\tattribute vec4 ${Is.COLOR};\n\t\t\t\tuniform mat4 ${Is.MVP_MATRIX};\n\t\t\t\tvarying vec4 v_color;\n\n\t\t\t\tvoid main () {\n\t\t\t\t\tv_color = ${Is.COLOR};\n\t\t\t\t\tgl_Position = ${Is.MVP_MATRIX} * ${Is.POSITION};\n\t\t\t\t}\n\t\t\t`; - return new Is( - e, - t, - "\n\t\t\t\t#ifdef GL_ES\n\t\t\t\t\t#define LOWP lowp\n\t\t\t\t\tprecision mediump float;\n\t\t\t\t#else\n\t\t\t\t\t#define LOWP\n\t\t\t\t#endif\n\t\t\t\tvarying LOWP vec4 v_color;\n\n\t\t\t\tvoid main () {\n\t\t\t\t\tgl_FragColor = v_color;\n\t\t\t\t}\n\t\t\t", + return i; + } + restore() { + this.compile(); + } + bind() { + this.context.gl.useProgram(this.program); + } + unbind() { + this.context.gl.useProgram(null); + } + setUniformi(e, t) { + this.context.gl.uniform1i(this.getUniformLocation(e), t); + } + setUniformf(e, t) { + this.context.gl.uniform1f(this.getUniformLocation(e), t); + } + setUniform2f(e, t, a) { + this.context.gl.uniform2f(this.getUniformLocation(e), t, a); + } + setUniform3f(e, t, a, i) { + this.context.gl.uniform3f(this.getUniformLocation(e), t, a, i); + } + setUniform4f(e, t, a, i, n) { + this.context.gl.uniform4f(this.getUniformLocation(e), t, a, i, n); + } + setUniform2x2f(e, t) { + let a = this.context.gl; + (this.tmp2x2.set(t), + a.uniformMatrix2fv( + this.getUniformLocation(e), + false, + this.tmp2x2, + )); + } + setUniform3x3f(e, t) { + let a = this.context.gl; + (this.tmp3x3.set(t), + a.uniformMatrix3fv( + this.getUniformLocation(e), + false, + this.tmp3x3, + )); + } + setUniform4x4f(e, t) { + let a = this.context.gl; + (this.tmp4x4.set(t), + a.uniformMatrix4fv( + this.getUniformLocation(e), + false, + this.tmp4x4, + )); + } + getUniformLocation(e) { + let t = this.context.gl, + a = t.getUniformLocation(this.program, e); + if (!a && !t.isContextLost()) + throw new Error(`Couldn't find location for uniform ${e}`); + return a; + } + getAttributeLocation(e) { + let t = this.context.gl, + a = t.getAttribLocation(this.program, e); + if (-1 == a && !t.isContextLost()) + throw new Error(`Couldn't find location for attribute ${e}`); + return a; + } + dispose() { + this.context.removeRestorable(this); + let e = this.context.gl; + (this.vs && (e.deleteShader(this.vs), (this.vs = null)), + this.fs && (e.deleteShader(this.fs), (this.fs = null)), + this.program && + (e.deleteProgram(this.program), (this.program = null))); + } + static newColoredTextured(e) { + let t = `\n\t\t\t\tattribute vec4 ${Is.POSITION};\n\t\t\t\tattribute vec4 ${Is.COLOR};\n\t\t\t\tattribute vec2 ${Is.TEXCOORDS};\n\t\t\t\tuniform mat4 ${Is.MVP_MATRIX};\n\t\t\t\tvarying vec4 v_color;\n\t\t\t\tvarying vec2 v_texCoords;\n\n\t\t\t\tvoid main () {\n\t\t\t\t\tv_color = ${Is.COLOR};\n\t\t\t\t\tv_texCoords = ${Is.TEXCOORDS};\n\t\t\t\t\tgl_Position = ${Is.MVP_MATRIX} * ${Is.POSITION};\n\t\t\t\t}\n\t\t\t`; + return new Is( + e, + t, + "\n\t\t\t\t#ifdef GL_ES\n\t\t\t\t\t#define LOWP lowp\n\t\t\t\t\tprecision mediump float;\n\t\t\t\t#else\n\t\t\t\t\t#define LOWP\n\t\t\t\t#endif\n\t\t\t\tvarying LOWP vec4 v_color;\n\t\t\t\tvarying vec2 v_texCoords;\n\t\t\t\tuniform sampler2D u_texture;\n\n\t\t\t\tvoid main () {\n\t\t\t\t\tgl_FragColor = v_color * texture2D(u_texture, v_texCoords);\n\t\t\t\t}\n\t\t\t", + ); + } + static newTwoColoredTextured(e) { + let t = `\n\t\t\t\tattribute vec4 ${Is.POSITION};\n\t\t\t\tattribute vec4 ${Is.COLOR};\n\t\t\t\tattribute vec4 ${Is.COLOR2};\n\t\t\t\tattribute vec2 ${Is.TEXCOORDS};\n\t\t\t\tuniform mat4 ${Is.MVP_MATRIX};\n\t\t\t\tvarying vec4 v_light;\n\t\t\t\tvarying vec4 v_dark;\n\t\t\t\tvarying vec2 v_texCoords;\n\n\t\t\t\tvoid main () {\n\t\t\t\t\tv_light = ${Is.COLOR};\n\t\t\t\t\tv_dark = ${Is.COLOR2};\n\t\t\t\t\tv_texCoords = ${Is.TEXCOORDS};\n\t\t\t\t\tgl_Position = ${Is.MVP_MATRIX} * ${Is.POSITION};\n\t\t\t\t}\n\t\t\t`; + return new Is( + e, + t, + "\n\t\t\t\t#ifdef GL_ES\n\t\t\t\t\t#define LOWP lowp\n\t\t\t\t\tprecision mediump float;\n\t\t\t\t#else\n\t\t\t\t\t#define LOWP\n\t\t\t\t#endif\n\t\t\t\tvarying LOWP vec4 v_light;\n\t\t\t\tvarying LOWP vec4 v_dark;\n\t\t\t\tvarying vec2 v_texCoords;\n\t\t\t\tuniform sampler2D u_texture;\n\n\t\t\t\tvoid main () {\n\t\t\t\t\tvec4 texColor = texture2D(u_texture, v_texCoords);\n\t\t\t\t\tgl_FragColor.a = texColor.a * v_light.a;\n\t\t\t\t\tgl_FragColor.rgb = ((texColor.a - 1.0) * v_dark.a + 1.0 - texColor.rgb) * v_dark.rgb + texColor.rgb * v_light.rgb;\n\t\t\t\t}\n\t\t\t", + ); + } + static newColored(e) { + let t = `\n\t\t\t\tattribute vec4 ${Is.POSITION};\n\t\t\t\tattribute vec4 ${Is.COLOR};\n\t\t\t\tuniform mat4 ${Is.MVP_MATRIX};\n\t\t\t\tvarying vec4 v_color;\n\n\t\t\t\tvoid main () {\n\t\t\t\t\tv_color = ${Is.COLOR};\n\t\t\t\t\tgl_Position = ${Is.MVP_MATRIX} * ${Is.POSITION};\n\t\t\t\t}\n\t\t\t`; + return new Is( + e, + t, + "\n\t\t\t\t#ifdef GL_ES\n\t\t\t\t\t#define LOWP lowp\n\t\t\t\t\tprecision mediump float;\n\t\t\t\t#else\n\t\t\t\t\t#define LOWP\n\t\t\t\t#endif\n\t\t\t\tvarying LOWP vec4 v_color;\n\n\t\t\t\tvoid main () {\n\t\t\t\t\tgl_FragColor = v_color;\n\t\t\t\t}\n\t\t\t", + ); + } + } + ((Is.MVP_MATRIX = "u_projTrans"), + (Is.POSITION = "a_position"), + (Is.COLOR = "a_color"), + (Is.COLOR2 = "a_color2"), + (Is.TEXCOORDS = "a_texCoords"), + (Is.SAMPLER = "u_texture")); + class _s { + constructor(e, t, a, i) { + ((this.attributes = t), + (this.verticesLength = 0), + (this.dirtyVertices = false), + (this.indicesLength = 0), + (this.dirtyIndices = false), + (this.elementsPerVertex = 0), + (this.context = e instanceof Zn ? e : new Zn(e)), + (this.elementsPerVertex = 0)); + for (let e = 0; e < t.length; e++) + this.elementsPerVertex += t[e].numElements; + ((this.vertices = new Float32Array(a * this.elementsPerVertex)), + (this.indices = new Uint16Array(i)), + this.context.addRestorable(this)); + } + getAttributes() { + return this.attributes; + } + maxVertices() { + return this.vertices.length / this.elementsPerVertex; + } + numVertices() { + return this.verticesLength / this.elementsPerVertex; + } + setVerticesLength(e) { + ((this.dirtyVertices = true), (this.verticesLength = e)); + } + getVertices() { + return this.vertices; + } + maxIndices() { + return this.indices.length; + } + numIndices() { + return this.indicesLength; + } + setIndicesLength(e) { + ((this.dirtyIndices = true), (this.indicesLength = e)); + } + getIndices() { + return this.indices; + } + getVertexSizeInFloats() { + let e = 0; + for (var t = 0; t < this.attributes.length; t++) + e += this.attributes[t].numElements; + return e; + } + setVertices(e) { + if (((this.dirtyVertices = true), e.length > this.vertices.length)) + throw Error( + "Mesh can't store more than " + + this.maxVertices() + + " vertices", ); - } + (this.vertices.set(e, 0), (this.verticesLength = e.length)); } - ((Is.MVP_MATRIX = "u_projTrans"), - (Is.POSITION = "a_position"), - (Is.COLOR = "a_color"), - (Is.COLOR2 = "a_color2"), - (Is.TEXCOORDS = "a_texCoords"), - (Is.SAMPLER = "u_texture")); - class _s { - constructor(e, t, a, i) { - ((this.attributes = t), - (this.verticesLength = 0), - (this.dirtyVertices = false), - (this.indicesLength = 0), - (this.dirtyIndices = false), - (this.elementsPerVertex = 0), - (this.context = e instanceof Zn ? e : new Zn(e)), - (this.elementsPerVertex = 0)); - for (let e = 0; e < t.length; e++) - this.elementsPerVertex += t[e].numElements; - ((this.vertices = new Float32Array(a * this.elementsPerVertex)), - (this.indices = new Uint16Array(i)), - this.context.addRestorable(this)); - } - getAttributes() { - return this.attributes; - } - maxVertices() { - return this.vertices.length / this.elementsPerVertex; - } - numVertices() { - return this.verticesLength / this.elementsPerVertex; - } - setVerticesLength(e) { - ((this.dirtyVertices = true), (this.verticesLength = e)); - } - getVertices() { - return this.vertices; - } - maxIndices() { - return this.indices.length; - } - numIndices() { - return this.indicesLength; - } - setIndicesLength(e) { - ((this.dirtyIndices = true), (this.indicesLength = e)); - } - getIndices() { - return this.indices; - } - getVertexSizeInFloats() { - let e = 0; - for (var t = 0; t < this.attributes.length; t++) - e += this.attributes[t].numElements; - return e; - } - setVertices(e) { - if (((this.dirtyVertices = true), e.length > this.vertices.length)) - throw Error( - "Mesh can't store more than " + - this.maxVertices() + - " vertices", - ); - (this.vertices.set(e, 0), (this.verticesLength = e.length)); - } - setIndices(e) { - if (((this.dirtyIndices = true), e.length > this.indices.length)) - throw Error( - "Mesh can't store more than " + this.maxIndices() + " indices", - ); - (this.indices.set(e, 0), (this.indicesLength = e.length)); - } - draw(e, t) { - this.drawWithOffset( - e, - t, - 0, - this.indicesLength > 0 - ? this.indicesLength - : this.verticesLength / this.elementsPerVertex, + setIndices(e) { + if (((this.dirtyIndices = true), e.length > this.indices.length)) + throw Error( + "Mesh can't store more than " + this.maxIndices() + " indices", ); + (this.indices.set(e, 0), (this.indicesLength = e.length)); + } + draw(e, t) { + this.drawWithOffset( + e, + t, + 0, + this.indicesLength > 0 + ? this.indicesLength + : this.verticesLength / this.elementsPerVertex, + ); + } + drawWithOffset(e, t, a, i) { + let n = this.context.gl; + ((this.dirtyVertices || this.dirtyIndices) && this.update(), + this.bind(e), + this.indicesLength > 0 + ? n.drawElements(t, i, n.UNSIGNED_SHORT, 2 * a) + : n.drawArrays(t, a, i), + this.unbind(e)); + } + bind(e) { + let t = this.context.gl; + t.bindBuffer(t.ARRAY_BUFFER, this.verticesBuffer); + let a = 0; + for (let i = 0; i < this.attributes.length; i++) { + let n = this.attributes[i], + s = e.getAttributeLocation(n.name); + (t.enableVertexAttribArray(s), + t.vertexAttribPointer( + s, + n.numElements, + t.FLOAT, + false, + 4 * this.elementsPerVertex, + 4 * a, + ), + (a += n.numElements)); } - drawWithOffset(e, t, a, i) { - let n = this.context.gl; - ((this.dirtyVertices || this.dirtyIndices) && this.update(), - this.bind(e), - this.indicesLength > 0 - ? n.drawElements(t, i, n.UNSIGNED_SHORT, 2 * a) - : n.drawArrays(t, a, i), - this.unbind(e)); - } - bind(e) { - let t = this.context.gl; - t.bindBuffer(t.ARRAY_BUFFER, this.verticesBuffer); - let a = 0; - for (let i = 0; i < this.attributes.length; i++) { - let n = this.attributes[i], - s = e.getAttributeLocation(n.name); - (t.enableVertexAttribArray(s), - t.vertexAttribPointer( - s, - n.numElements, - t.FLOAT, - false, - 4 * this.elementsPerVertex, - 4 * a, - ), - (a += n.numElements)); - } + this.indicesLength > 0 && + t.bindBuffer(t.ELEMENT_ARRAY_BUFFER, this.indicesBuffer); + } + unbind(e) { + let t = this.context.gl; + for (let a = 0; a < this.attributes.length; a++) { + let i = this.attributes[a], + n = e.getAttributeLocation(i.name); + t.disableVertexAttribArray(n); + } + (t.bindBuffer(t.ARRAY_BUFFER, null), this.indicesLength > 0 && - t.bindBuffer(t.ELEMENT_ARRAY_BUFFER, this.indicesBuffer); - } - unbind(e) { - let t = this.context.gl; - for (let a = 0; a < this.attributes.length; a++) { - let i = this.attributes[a], - n = e.getAttributeLocation(i.name); - t.disableVertexAttribArray(n); - } - (t.bindBuffer(t.ARRAY_BUFFER, null), - this.indicesLength > 0 && - t.bindBuffer(t.ELEMENT_ARRAY_BUFFER, null)); - } - update() { - let e = this.context.gl; - (this.dirtyVertices && - (this.verticesBuffer || (this.verticesBuffer = e.createBuffer()), + t.bindBuffer(t.ELEMENT_ARRAY_BUFFER, null)); + } + update() { + let e = this.context.gl; + (this.dirtyVertices && + (this.verticesBuffer || (this.verticesBuffer = e.createBuffer()), e.bindBuffer(e.ARRAY_BUFFER, this.verticesBuffer), e.bufferData( e.ARRAY_BUFFER, @@ -29668,657 +29641,657 @@ var version = "v1.17.2"; e.DYNAMIC_DRAW, ), (this.dirtyVertices = false)), - this.dirtyIndices && - (this.indicesBuffer || (this.indicesBuffer = e.createBuffer()), - e.bindBuffer(e.ELEMENT_ARRAY_BUFFER, this.indicesBuffer), - e.bufferData( - e.ELEMENT_ARRAY_BUFFER, - this.indices.subarray(0, this.indicesLength), - e.DYNAMIC_DRAW, - ), - (this.dirtyIndices = false))); - } - restore() { - ((this.verticesBuffer = null), - (this.indicesBuffer = null), - this.update()); - } - dispose() { - this.context.removeRestorable(this); - let e = this.context.gl; - (e.deleteBuffer(this.verticesBuffer), - e.deleteBuffer(this.indicesBuffer)); - } + this.dirtyIndices && + (this.indicesBuffer || (this.indicesBuffer = e.createBuffer()), + e.bindBuffer(e.ELEMENT_ARRAY_BUFFER, this.indicesBuffer), + e.bufferData( + e.ELEMENT_ARRAY_BUFFER, + this.indices.subarray(0, this.indicesLength), + e.DYNAMIC_DRAW, + ), + (this.dirtyIndices = false))); } - class vs { - constructor(e, t, a) { - ((this.name = e), (this.type = t), (this.numElements = a)); - } + restore() { + ((this.verticesBuffer = null), + (this.indicesBuffer = null), + this.update()); } - class Ts extends vs { - constructor() { - super(Is.POSITION, ws.Float, 2); - } + dispose() { + this.context.removeRestorable(this); + let e = this.context.gl; + (e.deleteBuffer(this.verticesBuffer), + e.deleteBuffer(this.indicesBuffer)); } - class Rs extends vs { - constructor(e = 0) { - super(Is.TEXCOORDS + (0 == e ? "" : e), ws.Float, 2); - } + } + class vs { + constructor(e, t, a) { + ((this.name = e), (this.type = t), (this.numElements = a)); } - class Os extends vs { - constructor() { - super(Is.COLOR, ws.Float, 4); - } + } + class Ts extends vs { + constructor() { + super(Is.POSITION, ws.Float, 2); } - class Cs extends vs { - constructor() { - super(Is.COLOR2, ws.Float, 4); - } + } + class Rs extends vs { + constructor(e = 0) { + super(Is.TEXCOORDS + (0 == e ? "" : e), ws.Float, 2); } - var ws, As, ks, Ns; - !(function (e) { - e[(e.Float = 0)] = "Float"; - })(ws || (ws = {})); - class xs { - constructor(e, t = true, a = 10920) { - if ( - ((this.isDrawing = false), + } + class Os extends vs { + constructor() { + super(Is.COLOR, ws.Float, 4); + } + } + class Cs extends vs { + constructor() { + super(Is.COLOR2, ws.Float, 4); + } + } + var ws, As, ks, Ns; + !(function (e) { + e[(e.Float = 0)] = "Float"; + })(ws || (ws = {})); + class xs { + constructor(e, t = true, a = 10920) { + if ( + ((this.isDrawing = false), (this.shader = null), (this.lastTexture = null), (this.verticesLength = 0), (this.indicesLength = 0), a > 10920) - ) - throw new Error( - "Can't have more than 10920 triangles per batch: " + a, - ); - this.context = e instanceof Zn ? e : new Zn(e); - let i = t - ? [new Ts(), new Os(), new Rs(), new Cs()] - : [new Ts(), new Os(), new Rs()]; - this.mesh = new _s(e, i, a, 3 * a); - let n = this.context.gl; - ((this.srcColorBlend = n.SRC_ALPHA), - (this.srcAlphaBlend = n.ONE), - (this.dstBlend = n.ONE_MINUS_SRC_ALPHA)); - } - begin(e) { - if (this.isDrawing) - throw new Error( - "PolygonBatch is already drawing. Call PolygonBatch.end() before calling PolygonBatch.begin()", - ); - ((this.drawCalls = 0), - (this.shader = e), - (this.lastTexture = null), - (this.isDrawing = true)); - let t = this.context.gl; - (t.enable(t.BLEND), - t.blendFuncSeparate( - this.srcColorBlend, - this.dstBlend, - this.srcAlphaBlend, - this.dstBlend, - )); - } - setBlendMode(e, t, a) { - (this.srcColorBlend == e && - this.srcAlphaBlend == t && - this.dstBlend == a) || - ((this.srcColorBlend = e), + ) + throw new Error( + "Can't have more than 10920 triangles per batch: " + a, + ); + this.context = e instanceof Zn ? e : new Zn(e); + let i = t + ? [new Ts(), new Os(), new Rs(), new Cs()] + : [new Ts(), new Os(), new Rs()]; + this.mesh = new _s(e, i, a, 3 * a); + let n = this.context.gl; + ((this.srcColorBlend = n.SRC_ALPHA), + (this.srcAlphaBlend = n.ONE), + (this.dstBlend = n.ONE_MINUS_SRC_ALPHA)); + } + begin(e) { + if (this.isDrawing) + throw new Error( + "PolygonBatch is already drawing. Call PolygonBatch.end() before calling PolygonBatch.begin()", + ); + ((this.drawCalls = 0), + (this.shader = e), + (this.lastTexture = null), + (this.isDrawing = true)); + let t = this.context.gl; + (t.enable(t.BLEND), + t.blendFuncSeparate( + this.srcColorBlend, + this.dstBlend, + this.srcAlphaBlend, + this.dstBlend, + )); + } + setBlendMode(e, t, a) { + (this.srcColorBlend == e && + this.srcAlphaBlend == t && + this.dstBlend == a) || + ((this.srcColorBlend = e), (this.srcAlphaBlend = t), (this.dstBlend = a), !this.isDrawing) || - (this.flush(), this.context.gl.blendFuncSeparate(e, a, t, a)); - } - draw(e, t, a) { - e != this.lastTexture - ? (this.flush(), (this.lastTexture = e)) - : (this.verticesLength + t.length > - this.mesh.getVertices().length || - this.indicesLength + a.length > - this.mesh.getIndices().length) && - this.flush(); - let i = this.mesh.numVertices(); - (this.mesh.getVertices().set(t, this.verticesLength), - (this.verticesLength += t.length), - this.mesh.setVerticesLength(this.verticesLength)); - let n = this.mesh.getIndices(); - for (let e = this.indicesLength, t = 0; t < a.length; e++, t++) - n[e] = a[t] + i; - ((this.indicesLength += a.length), - this.mesh.setIndicesLength(this.indicesLength)); - } - flush() { - 0 != this.verticesLength && - (this.lastTexture.bind(), + (this.flush(), this.context.gl.blendFuncSeparate(e, a, t, a)); + } + draw(e, t, a) { + e != this.lastTexture + ? (this.flush(), (this.lastTexture = e)) + : (this.verticesLength + t.length > + this.mesh.getVertices().length || + this.indicesLength + a.length > + this.mesh.getIndices().length) && + this.flush(); + let i = this.mesh.numVertices(); + (this.mesh.getVertices().set(t, this.verticesLength), + (this.verticesLength += t.length), + this.mesh.setVerticesLength(this.verticesLength)); + let n = this.mesh.getIndices(); + for (let e = this.indicesLength, t = 0; t < a.length; e++, t++) + n[e] = a[t] + i; + ((this.indicesLength += a.length), + this.mesh.setIndicesLength(this.indicesLength)); + } + flush() { + 0 != this.verticesLength && + (this.lastTexture.bind(), this.mesh.draw(this.shader, this.context.gl.TRIANGLES), (this.verticesLength = 0), (this.indicesLength = 0), this.mesh.setVerticesLength(0), this.mesh.setIndicesLength(0), this.drawCalls++); - } - end() { - if (!this.isDrawing) - throw new Error( - "PolygonBatch is not drawing. Call PolygonBatch.begin() before calling PolygonBatch.end()", - ); - ((this.verticesLength > 0 || this.indicesLength > 0) && - this.flush(), - (this.shader = null), - (this.lastTexture = null), - (this.isDrawing = false)); - let e = this.context.gl; - e.disable(e.BLEND); - } - getDrawCalls() { - return this.drawCalls; - } - dispose() { - this.mesh.dispose(); - } } - !(function (e) { - ((e[(e.Point = 0)] = "Point"), - (e[(e.Line = 1)] = "Line"), - (e[(e.Filled = 4)] = "Filled")); - })(As || (As = {})); - class Ps { - constructor(e) { - ((this.boneLineColor = new ai(1, 0, 0, 1)), - (this.boneOriginColor = new ai(0, 1, 0, 1)), - (this.attachmentLineColor = new ai(0, 0, 1, 0.5)), - (this.triangleLineColor = new ai(1, 0.64, 0, 0.5)), - (this.pathColor = new ai().setFromString("FF7F00")), - (this.clipColor = new ai(0.8, 0, 0, 2)), - (this.aabbColor = new ai(0, 1, 0, 0.5)), - (this.drawBones = true), - (this.drawRegionAttachments = true), - (this.drawBoundingBoxes = true), - (this.drawMeshHull = true), - (this.drawMeshTriangles = true), - (this.drawPaths = true), - (this.drawSkeletonXY = false), - (this.drawClipping = true), - (this.premultipliedAlpha = false), - (this.scale = 1), - (this.boneWidth = 2), - (this.bounds = new Fn()), - (this.temp = new Array()), - (this.vertices = ni.newFloatArray(2048)), - (this.context = e instanceof Zn ? e : new Zn(e))); - } - draw(e, t, a = null) { - let i = t.x, - n = t.y, - s = this.context.gl, - o = this.premultipliedAlpha ? s.ONE : s.SRC_ALPHA; - e.setBlendMode(o, s.ONE, s.ONE_MINUS_SRC_ALPHA); - let r = t.bones; - if (this.drawBones) { - e.setColor(this.boneLineColor); - for (let t = 0, i = r.length; t < i; t++) { - let i = r[t]; - if (a && a.indexOf(i.data.name) > -1) continue; - if (!i.parent) continue; - let n = i.data.length * i.a + i.worldX, - s = i.data.length * i.c + i.worldY; - e.rectLine( - true, - i.worldX, - i.worldY, - n, - s, - this.boneWidth * this.scale, - ); - } - this.drawSkeletonXY && e.x(i, n, 4 * this.scale); + end() { + if (!this.isDrawing) + throw new Error( + "PolygonBatch is not drawing. Call PolygonBatch.begin() before calling PolygonBatch.end()", + ); + ((this.verticesLength > 0 || this.indicesLength > 0) && + this.flush(), + (this.shader = null), + (this.lastTexture = null), + (this.isDrawing = false)); + let e = this.context.gl; + e.disable(e.BLEND); + } + getDrawCalls() { + return this.drawCalls; + } + dispose() { + this.mesh.dispose(); + } + } + !(function (e) { + ((e[(e.Point = 0)] = "Point"), + (e[(e.Line = 1)] = "Line"), + (e[(e.Filled = 4)] = "Filled")); + })(As || (As = {})); + class Ps { + constructor(e) { + ((this.boneLineColor = new ai(1, 0, 0, 1)), + (this.boneOriginColor = new ai(0, 1, 0, 1)), + (this.attachmentLineColor = new ai(0, 0, 1, 0.5)), + (this.triangleLineColor = new ai(1, 0.64, 0, 0.5)), + (this.pathColor = new ai().setFromString("FF7F00")), + (this.clipColor = new ai(0.8, 0, 0, 2)), + (this.aabbColor = new ai(0, 1, 0, 0.5)), + (this.drawBones = true), + (this.drawRegionAttachments = true), + (this.drawBoundingBoxes = true), + (this.drawMeshHull = true), + (this.drawMeshTriangles = true), + (this.drawPaths = true), + (this.drawSkeletonXY = false), + (this.drawClipping = true), + (this.premultipliedAlpha = false), + (this.scale = 1), + (this.boneWidth = 2), + (this.bounds = new Fn()), + (this.temp = new Array()), + (this.vertices = ni.newFloatArray(2048)), + (this.context = e instanceof Zn ? e : new Zn(e))); + } + draw(e, t, a = null) { + let i = t.x, + n = t.y, + s = this.context.gl, + o = this.premultipliedAlpha ? s.ONE : s.SRC_ALPHA; + e.setBlendMode(o, s.ONE, s.ONE_MINUS_SRC_ALPHA); + let r = t.bones; + if (this.drawBones) { + e.setColor(this.boneLineColor); + for (let t = 0, i = r.length; t < i; t++) { + let i = r[t]; + if (a && a.indexOf(i.data.name) > -1) continue; + if (!i.parent) continue; + let n = i.data.length * i.a + i.worldX, + s = i.data.length * i.c + i.worldY; + e.rectLine( + true, + i.worldX, + i.worldY, + n, + s, + this.boneWidth * this.scale, + ); } - if (this.drawRegionAttachments) { - e.setColor(this.attachmentLineColor); - let a = t.slots; - for (let t = 0, i = a.length; t < i; t++) { - let i = a[t], - n = i.getAttachment(); - if (n instanceof vn) { - let t = n, - a = this.vertices; - (t.computeWorldVertices(i, a, 0, 2), - e.line(a[0], a[1], a[2], a[3]), - e.line(a[2], a[3], a[4], a[5]), - e.line(a[4], a[5], a[6], a[7]), - e.line(a[6], a[7], a[0], a[1])); - } + this.drawSkeletonXY && e.x(i, n, 4 * this.scale); + } + if (this.drawRegionAttachments) { + e.setColor(this.attachmentLineColor); + let a = t.slots; + for (let t = 0, i = a.length; t < i; t++) { + let i = a[t], + n = i.getAttachment(); + if (n instanceof vn) { + let t = n, + a = this.vertices; + (t.computeWorldVertices(i, a, 0, 2), + e.line(a[0], a[1], a[2], a[3]), + e.line(a[2], a[3], a[4], a[5]), + e.line(a[4], a[5], a[6], a[7]), + e.line(a[6], a[7], a[0], a[1])); } } - if (this.drawMeshHull || this.drawMeshTriangles) { - let a = t.slots; - for (let t = 0, i = a.length; t < i; t++) { - let i = a[t]; - if (!i.bone.active) continue; - let n = i.getAttachment(); - if (!(n instanceof Sn)) continue; - let s = n, - o = this.vertices; - s.computeWorldVertices(i, 0, s.worldVerticesLength, o, 0, 2); - let r = s.triangles, - l = s.hullLength; - if (this.drawMeshTriangles) { - e.setColor(this.triangleLineColor); - for (let t = 0, a = r.length; t < a; t += 3) { - let a = 2 * r[t], - i = 2 * r[t + 1], - n = 2 * r[t + 2]; - e.triangle( - false, - o[a], - o[a + 1], - o[i], - o[i + 1], - o[n], - o[n + 1], - ); - } + } + if (this.drawMeshHull || this.drawMeshTriangles) { + let a = t.slots; + for (let t = 0, i = a.length; t < i; t++) { + let i = a[t]; + if (!i.bone.active) continue; + let n = i.getAttachment(); + if (!(n instanceof Sn)) continue; + let s = n, + o = this.vertices; + s.computeWorldVertices(i, 0, s.worldVerticesLength, o, 0, 2); + let r = s.triangles, + l = s.hullLength; + if (this.drawMeshTriangles) { + e.setColor(this.triangleLineColor); + for (let t = 0, a = r.length; t < a; t += 3) { + let a = 2 * r[t], + i = 2 * r[t + 1], + n = 2 * r[t + 2]; + e.triangle( + false, + o[a], + o[a + 1], + o[i], + o[i + 1], + o[n], + o[n + 1], + ); } - if (this.drawMeshHull && l > 0) { - (e.setColor(this.attachmentLineColor), (l = 2 * (l >> 1))); - let t = o[l - 2], - a = o[l - 1]; - for (let i = 0, n = l; i < n; i += 2) { - let n = o[i], - s = o[i + 1]; - (e.line(n, s, t, a), (t = n), (a = s)); - } + } + if (this.drawMeshHull && l > 0) { + (e.setColor(this.attachmentLineColor), (l = 2 * (l >> 1))); + let t = o[l - 2], + a = o[l - 1]; + for (let i = 0, n = l; i < n; i += 2) { + let n = o[i], + s = o[i + 1]; + (e.line(n, s, t, a), (t = n), (a = s)); } } } - if (this.drawBoundingBoxes) { - let a = this.bounds; - (a.update(t, true), - e.setColor(this.aabbColor), - e.rect(false, a.minX, a.minY, a.getWidth(), a.getHeight())); - let i = a.polygons, - n = a.boundingBoxes; - for (let t = 0, a = i.length; t < a; t++) { - let a = i[t]; - (e.setColor(n[t].color), e.polygon(a, 0, a.length)); - } + } + if (this.drawBoundingBoxes) { + let a = this.bounds; + (a.update(t, true), + e.setColor(this.aabbColor), + e.rect(false, a.minX, a.minY, a.getWidth(), a.getHeight())); + let i = a.polygons, + n = a.boundingBoxes; + for (let t = 0, a = i.length; t < a; t++) { + let a = i[t]; + (e.setColor(n[t].color), e.polygon(a, 0, a.length)); } - if (this.drawPaths) { - let a = t.slots; - for (let t = 0, i = a.length; t < i; t++) { - let i = a[t]; - if (!i.bone.active) continue; - let n = i.getAttachment(); - if (!(n instanceof In)) continue; - let s = n, - o = s.worldVerticesLength, - r = (this.temp = ni.setArraySize(this.temp, o, 0)); - s.computeWorldVertices(i, 0, o, r, 0, 2); - let l = this.pathColor, - c = r[2], - d = r[3], - u = 0, - h = 0; - if (s.closed) { - e.setColor(l); - let t = r[0], - a = r[1], - i = r[o - 2], - n = r[o - 1]; - ((u = r[o - 4]), - (h = r[o - 3]), - e.curve(c, d, t, a, i, n, u, h, 32), - e.setColor(Ps.LIGHT_GRAY), - e.line(c, d, t, a), - e.line(u, h, i, n)); - } - o -= 4; - for (let t = 4; t < o; t += 6) { - let a = r[t], - i = r[t + 1], - n = r[t + 2], - s = r[t + 3]; - ((u = r[t + 4]), - (h = r[t + 5]), - e.setColor(l), - e.curve(c, d, a, i, n, s, u, h, 32), - e.setColor(Ps.LIGHT_GRAY), - e.line(c, d, a, i), - e.line(u, h, n, s), - (c = u), - (d = h)); - } + } + if (this.drawPaths) { + let a = t.slots; + for (let t = 0, i = a.length; t < i; t++) { + let i = a[t]; + if (!i.bone.active) continue; + let n = i.getAttachment(); + if (!(n instanceof In)) continue; + let s = n, + o = s.worldVerticesLength, + r = (this.temp = ni.setArraySize(this.temp, o, 0)); + s.computeWorldVertices(i, 0, o, r, 0, 2); + let l = this.pathColor, + c = r[2], + d = r[3], + u = 0, + h = 0; + if (s.closed) { + e.setColor(l); + let t = r[0], + a = r[1], + i = r[o - 2], + n = r[o - 1]; + ((u = r[o - 4]), + (h = r[o - 3]), + e.curve(c, d, t, a, i, n, u, h, 32), + e.setColor(Ps.LIGHT_GRAY), + e.line(c, d, t, a), + e.line(u, h, i, n)); } - } - if (this.drawBones) { - e.setColor(this.boneOriginColor); - for (let t = 0, i = r.length; t < i; t++) { - let i = r[t]; - (a && a.indexOf(i.data.name) > -1) || - e.circle( - true, - i.worldX, - i.worldY, - 3 * this.scale, - Ps.GREEN, - 8, - ); + o -= 4; + for (let t = 4; t < o; t += 6) { + let a = r[t], + i = r[t + 1], + n = r[t + 2], + s = r[t + 3]; + ((u = r[t + 4]), + (h = r[t + 5]), + e.setColor(l), + e.curve(c, d, a, i, n, s, u, h, 32), + e.setColor(Ps.LIGHT_GRAY), + e.line(c, d, a, i), + e.line(u, h, n, s), + (c = u), + (d = h)); } } - if (this.drawClipping) { - let a = t.slots; - e.setColor(this.clipColor); - for (let t = 0, i = a.length; t < i; t++) { - let i = a[t]; - if (!i.bone.active) continue; - let n = i.getAttachment(); - if (!(n instanceof sn)) continue; - let s = n, - o = s.worldVerticesLength, - r = (this.temp = ni.setArraySize(this.temp, o, 0)); - s.computeWorldVertices(i, 0, o, r, 0, 2); - for (let t = 0, a = r.length; t < a; t += 2) { - let a = r[t], - i = r[t + 1], - n = r[(t + 2) % r.length], - s = r[(t + 3) % r.length]; - e.line(a, i, n, s); - } + } + if (this.drawBones) { + e.setColor(this.boneOriginColor); + for (let t = 0, i = r.length; t < i; t++) { + let i = r[t]; + (a && a.indexOf(i.data.name) > -1) || + e.circle( + true, + i.worldX, + i.worldY, + 3 * this.scale, + Ps.GREEN, + 8, + ); + } + } + if (this.drawClipping) { + let a = t.slots; + e.setColor(this.clipColor); + for (let t = 0, i = a.length; t < i; t++) { + let i = a[t]; + if (!i.bone.active) continue; + let n = i.getAttachment(); + if (!(n instanceof sn)) continue; + let s = n, + o = s.worldVerticesLength, + r = (this.temp = ni.setArraySize(this.temp, o, 0)); + s.computeWorldVertices(i, 0, o, r, 0, 2); + for (let t = 0, a = r.length; t < a; t += 2) { + let a = r[t], + i = r[t + 1], + n = r[(t + 2) % r.length], + s = r[(t + 3) % r.length]; + e.line(a, i, n, s); } } } - dispose() {} } - ((Ps.LIGHT_GRAY = new ai(192 / 255, 192 / 255, 192 / 255, 1)), - (Ps.GREEN = new ai(0, 1, 0, 1))); - class Ms { - constructor(e, t, a) { - ((this.vertices = e), (this.numVertices = t), (this.numFloats = a)); - } + dispose() { } + } + ((Ps.LIGHT_GRAY = new ai(192 / 255, 192 / 255, 192 / 255, 1)), + (Ps.GREEN = new ai(0, 1, 0, 1))); + class Ms { + constructor(e, t, a) { + ((this.vertices = e), (this.numVertices = t), (this.numFloats = a)); } - class Ls { - constructor(e, t = true) { - ((this.premultipliedAlpha = false), - (this.vertexEffect = null), - (this.tempColor = new ai()), - (this.tempColor2 = new ai()), - (this.vertexSize = 8), - (this.twoColorTint = false), - (this.renderable = new Ms(null, 0, 0)), - (this.clipper = new Un()), - (this.temp = new oi()), - (this.temp2 = new oi()), - (this.temp3 = new ai()), - (this.temp4 = new ai()), - (this.twoColorTint = t), - t && (this.vertexSize += 4), - (this.vertices = ni.newFloatArray(1024 * this.vertexSize))); - } - draw(e, t, a = -1, i = -1) { - let n = this.clipper, - s = this.premultipliedAlpha, - o = this.twoColorTint, - r = null, - l = this.temp, - c = this.temp2, - d = this.temp3, - u = this.temp4, - h = this.renderable, - p = null, - g = null, - m = t.drawOrder, - f = null, - y = t.color, - E = o ? 12 : 8, - b = false; - -1 == a && (b = true); - for (let t = 0, S = m.length; t < S; t++) { - let S = n.isClipping() ? 2 : E, - I = m[t]; - if (!I.bone.active) { - n.clipEndWithSlot(I); - continue; - } - if ((a >= 0 && a == I.data.index && (b = true), !b)) { + } + class Ls { + constructor(e, t = true) { + ((this.premultipliedAlpha = false), + (this.vertexEffect = null), + (this.tempColor = new ai()), + (this.tempColor2 = new ai()), + (this.vertexSize = 8), + (this.twoColorTint = false), + (this.renderable = new Ms(null, 0, 0)), + (this.clipper = new Un()), + (this.temp = new oi()), + (this.temp2 = new oi()), + (this.temp3 = new ai()), + (this.temp4 = new ai()), + (this.twoColorTint = t), + t && (this.vertexSize += 4), + (this.vertices = ni.newFloatArray(1024 * this.vertexSize))); + } + draw(e, t, a = -1, i = -1) { + let n = this.clipper, + s = this.premultipliedAlpha, + o = this.twoColorTint, + r = null, + l = this.temp, + c = this.temp2, + d = this.temp3, + u = this.temp4, + h = this.renderable, + p = null, + g = null, + m = t.drawOrder, + f = null, + y = t.color, + E = o ? 12 : 8, + b = false; + -1 == a && (b = true); + for (let t = 0, S = m.length; t < S; t++) { + let S = n.isClipping() ? 2 : E, + I = m[t]; + if (!I.bone.active) { + n.clipEndWithSlot(I); + continue; + } + if ((a >= 0 && a == I.data.index && (b = true), !b)) { + n.clipEndWithSlot(I); + continue; + } + i >= 0 && i == I.data.index && (b = false); + let _ = I.getAttachment(), + v = null; + if (_ instanceof vn) { + let e = _; + ((h.vertices = this.vertices), + (h.numVertices = 4), + (h.numFloats = S << 2), + e.computeWorldVertices(I, h.vertices, 0, S), + (g = Ls.QUAD_TRIANGLES), + (p = e.uvs), + (v = e.region.renderObject.page.texture), + (f = e.color)); + } else { + if (!(_ instanceof Sn)) { + if (_ instanceof sn) { + let e = _; + n.clipStart(I, e); + continue; + } n.clipEndWithSlot(I); continue; } - i >= 0 && i == I.data.index && (b = false); - let _ = I.getAttachment(), - v = null; - if (_ instanceof vn) { + { let e = _; ((h.vertices = this.vertices), - (h.numVertices = 4), - (h.numFloats = S << 2), - e.computeWorldVertices(I, h.vertices, 0, S), - (g = Ls.QUAD_TRIANGLES), - (p = e.uvs), + (h.numVertices = e.worldVerticesLength >> 1), + (h.numFloats = h.numVertices * S), + h.numFloats > h.vertices.length && + (h.vertices = this.vertices = + ni.newFloatArray(h.numFloats)), + e.computeWorldVertices( + I, + 0, + e.worldVerticesLength, + h.vertices, + 0, + S, + ), + (g = e.triangles), (v = e.region.renderObject.page.texture), + (p = e.uvs), (f = e.color)); - } else { - if (!(_ instanceof Sn)) { - if (_ instanceof sn) { - let e = _; - n.clipStart(I, e); - continue; - } - n.clipEndWithSlot(I); - continue; - } - { - let e = _; - ((h.vertices = this.vertices), - (h.numVertices = e.worldVerticesLength >> 1), - (h.numFloats = h.numVertices * S), - h.numFloats > h.vertices.length && - (h.vertices = this.vertices = - ni.newFloatArray(h.numFloats)), - e.computeWorldVertices( - I, - 0, - e.worldVerticesLength, - h.vertices, - 0, - S, - ), - (g = e.triangles), - (v = e.region.renderObject.page.texture), - (p = e.uvs), - (f = e.color)); - } } - if (v) { - let t = I.color, - a = this.tempColor; - ((a.r = y.r * t.r * f.r), - (a.g = y.g * t.g * f.g), - (a.b = y.b * t.b * f.b), - (a.a = y.a * t.a * f.a), - s && ((a.r *= a.a), (a.g *= a.a), (a.b *= a.a))); - let i = this.tempColor2; - I.darkColor - ? (s - ? ((i.r = I.darkColor.r * a.a), - (i.g = I.darkColor.g * a.a), - (i.b = I.darkColor.b * a.a)) - : i.setFromColor(I.darkColor), - (i.a = s ? 1 : 0)) - : i.set(0, 0, 0, 1); - let m = I.data.blendMode; - if ( - (m != r && - ((r = m), + } + if (v) { + let t = I.color, + a = this.tempColor; + ((a.r = y.r * t.r * f.r), + (a.g = y.g * t.g * f.g), + (a.b = y.b * t.b * f.b), + (a.a = y.a * t.a * f.a), + s && ((a.r *= a.a), (a.g *= a.a), (a.b *= a.a))); + let i = this.tempColor2; + I.darkColor + ? (s + ? ((i.r = I.darkColor.r * a.a), + (i.g = I.darkColor.g * a.a), + (i.b = I.darkColor.b * a.a)) + : i.setFromColor(I.darkColor), + (i.a = s ? 1 : 0)) + : i.set(0, 0, 0, 1); + let m = I.data.blendMode; + if ( + (m != r && + ((r = m), e.setBlendMode( es.getSourceColorGLBlendMode(r, s), es.getSourceAlphaGLBlendMode(r), es.getDestGLBlendMode(r), )), n.isClipping()) - ) { - n.clipTriangles( - h.vertices, - h.numFloats, - g, - g.length, - p, - a, - i, - o, - ); - let t = new Float32Array(n.clippedVertices), - s = n.clippedTriangles; - if (this.vertexEffect) { - let e = this.vertexEffect, - a = t; - if (o) - for (let i = 0, n = t.length; i < n; i += E) - ((l.x = a[i]), - (l.y = a[i + 1]), - d.set(a[i + 2], a[i + 3], a[i + 4], a[i + 5]), - (c.x = a[i + 6]), - (c.y = a[i + 7]), - u.set(a[i + 8], a[i + 9], a[i + 10], a[i + 11]), - e.transform(l, c, d, u), - (a[i] = l.x), - (a[i + 1] = l.y), - (a[i + 2] = d.r), - (a[i + 3] = d.g), - (a[i + 4] = d.b), - (a[i + 5] = d.a), - (a[i + 6] = c.x), - (a[i + 7] = c.y), - (a[i + 8] = u.r), - (a[i + 9] = u.g), - (a[i + 10] = u.b), - (a[i + 11] = u.a)); - else - for (let i = 0, n = t.length; i < n; i += E) - ((l.x = a[i]), - (l.y = a[i + 1]), - d.set(a[i + 2], a[i + 3], a[i + 4], a[i + 5]), - (c.x = a[i + 6]), - (c.y = a[i + 7]), - u.set(0, 0, 0, 0), - e.transform(l, c, d, u), - (a[i] = l.x), - (a[i + 1] = l.y), - (a[i + 2] = d.r), - (a[i + 3] = d.g), - (a[i + 4] = d.b), - (a[i + 5] = d.a), - (a[i + 6] = c.x), - (a[i + 7] = c.y)); - } - e.draw(v, t, s); - } else { - let t = h.vertices; - if (this.vertexEffect) { - let e = this.vertexEffect; - if (o) - for ( - let n = 0, s = 0, o = h.numFloats; - n < o; - n += E, s += 2 - ) - ((l.x = t[n]), - (l.y = t[n + 1]), - (c.x = p[s]), - (c.y = p[s + 1]), - d.setFromColor(a), - u.setFromColor(i), - e.transform(l, c, d, u), - (t[n] = l.x), - (t[n + 1] = l.y), - (t[n + 2] = d.r), - (t[n + 3] = d.g), - (t[n + 4] = d.b), - (t[n + 5] = d.a), - (t[n + 6] = c.x), - (t[n + 7] = c.y), - (t[n + 8] = u.r), - (t[n + 9] = u.g), - (t[n + 10] = u.b), - (t[n + 11] = u.a)); - else - for ( - let i = 0, n = 0, s = h.numFloats; - i < s; - i += E, n += 2 - ) - ((l.x = t[i]), - (l.y = t[i + 1]), - (c.x = p[n]), - (c.y = p[n + 1]), - d.setFromColor(a), - u.set(0, 0, 0, 0), - e.transform(l, c, d, u), - (t[i] = l.x), - (t[i + 1] = l.y), - (t[i + 2] = d.r), - (t[i + 3] = d.g), - (t[i + 4] = d.b), - (t[i + 5] = d.a), - (t[i + 6] = c.x), - (t[i + 7] = c.y)); - } else if (o) - for ( - let e = 2, n = 0, s = h.numFloats; - e < s; - e += E, n += 2 - ) - ((t[e] = a.r), - (t[e + 1] = a.g), - (t[e + 2] = a.b), - (t[e + 3] = a.a), - (t[e + 4] = p[n]), - (t[e + 5] = p[n + 1]), - (t[e + 6] = i.r), - (t[e + 7] = i.g), - (t[e + 8] = i.b), - (t[e + 9] = i.a)); + ) { + n.clipTriangles( + h.vertices, + h.numFloats, + g, + g.length, + p, + a, + i, + o, + ); + let t = new Float32Array(n.clippedVertices), + s = n.clippedTriangles; + if (this.vertexEffect) { + let e = this.vertexEffect, + a = t; + if (o) + for (let i = 0, n = t.length; i < n; i += E) + ((l.x = a[i]), + (l.y = a[i + 1]), + d.set(a[i + 2], a[i + 3], a[i + 4], a[i + 5]), + (c.x = a[i + 6]), + (c.y = a[i + 7]), + u.set(a[i + 8], a[i + 9], a[i + 10], a[i + 11]), + e.transform(l, c, d, u), + (a[i] = l.x), + (a[i + 1] = l.y), + (a[i + 2] = d.r), + (a[i + 3] = d.g), + (a[i + 4] = d.b), + (a[i + 5] = d.a), + (a[i + 6] = c.x), + (a[i + 7] = c.y), + (a[i + 8] = u.r), + (a[i + 9] = u.g), + (a[i + 10] = u.b), + (a[i + 11] = u.a)); else - for ( - let e = 2, i = 0, n = h.numFloats; - e < n; - e += E, i += 2 - ) - ((t[e] = a.r), - (t[e + 1] = a.g), - (t[e + 2] = a.b), - (t[e + 3] = a.a), - (t[e + 4] = p[i]), - (t[e + 5] = p[i + 1])); - let n = h.vertices.subarray(0, h.numFloats); - e.draw(v, n, g); + for (let i = 0, n = t.length; i < n; i += E) + ((l.x = a[i]), + (l.y = a[i + 1]), + d.set(a[i + 2], a[i + 3], a[i + 4], a[i + 5]), + (c.x = a[i + 6]), + (c.y = a[i + 7]), + u.set(0, 0, 0, 0), + e.transform(l, c, d, u), + (a[i] = l.x), + (a[i + 1] = l.y), + (a[i + 2] = d.r), + (a[i + 3] = d.g), + (a[i + 4] = d.b), + (a[i + 5] = d.a), + (a[i + 6] = c.x), + (a[i + 7] = c.y)); } + e.draw(v, t, s); + } else { + let t = h.vertices; + if (this.vertexEffect) { + let e = this.vertexEffect; + if (o) + for ( + let n = 0, s = 0, o = h.numFloats; + n < o; + n += E, s += 2 + ) + ((l.x = t[n]), + (l.y = t[n + 1]), + (c.x = p[s]), + (c.y = p[s + 1]), + d.setFromColor(a), + u.setFromColor(i), + e.transform(l, c, d, u), + (t[n] = l.x), + (t[n + 1] = l.y), + (t[n + 2] = d.r), + (t[n + 3] = d.g), + (t[n + 4] = d.b), + (t[n + 5] = d.a), + (t[n + 6] = c.x), + (t[n + 7] = c.y), + (t[n + 8] = u.r), + (t[n + 9] = u.g), + (t[n + 10] = u.b), + (t[n + 11] = u.a)); + else + for ( + let i = 0, n = 0, s = h.numFloats; + i < s; + i += E, n += 2 + ) + ((l.x = t[i]), + (l.y = t[i + 1]), + (c.x = p[n]), + (c.y = p[n + 1]), + d.setFromColor(a), + u.set(0, 0, 0, 0), + e.transform(l, c, d, u), + (t[i] = l.x), + (t[i + 1] = l.y), + (t[i + 2] = d.r), + (t[i + 3] = d.g), + (t[i + 4] = d.b), + (t[i + 5] = d.a), + (t[i + 6] = c.x), + (t[i + 7] = c.y)); + } else if (o) + for ( + let e = 2, n = 0, s = h.numFloats; + e < s; + e += E, n += 2 + ) + ((t[e] = a.r), + (t[e + 1] = a.g), + (t[e + 2] = a.b), + (t[e + 3] = a.a), + (t[e + 4] = p[n]), + (t[e + 5] = p[n + 1]), + (t[e + 6] = i.r), + (t[e + 7] = i.g), + (t[e + 8] = i.b), + (t[e + 9] = i.a)); + else + for ( + let e = 2, i = 0, n = h.numFloats; + e < n; + e += E, i += 2 + ) + ((t[e] = a.r), + (t[e + 1] = a.g), + (t[e + 2] = a.b), + (t[e + 3] = a.a), + (t[e + 4] = p[i]), + (t[e + 5] = p[i + 1])); + let n = h.vertices.subarray(0, h.numFloats); + e.draw(v, n, g); } - n.clipEndWithSlot(I); } - n.clipEnd(); + n.clipEndWithSlot(I); } + n.clipEnd(); } - ((Ls.QUAD_TRIANGLES = [0, 1, 2, 2, 3, 0]), - new ai(1, 1, 1, 1), - ((Ns = ks || (ks = {}))[(Ns.Stretch = 0)] = "Stretch"), - (Ns[(Ns.Expand = 1)] = "Expand"), - (Ns[(Ns.Fit = 2)] = "Fit")); - const Ds = 1 / 60, - Bs = function () { - const e = document.getElementById("replay-canvas"), - t = new Zn(e), - a = Is.newTwoColoredTextured(t), - i = new xs(t), - n = new Ls(t); - return ( - (n.premultipliedAlpha = true), - { - context: t, - renderer: (e, t, s, o, r = 1, l = 0) => { - o && - (0 === l && - (a.bind(), + } + ((Ls.QUAD_TRIANGLES = [0, 1, 2, 2, 3, 0]), + new ai(1, 1, 1, 1), + ((Ns = ks || (ks = {}))[(Ns.Stretch = 0)] = "Stretch"), + (Ns[(Ns.Expand = 1)] = "Expand"), + (Ns[(Ns.Fit = 2)] = "Fit")); + const Ds = 1 / 60, + Bs = function () { + const e = document.getElementById("replay-canvas"), + t = new Zn(e), + a = Is.newTwoColoredTextured(t), + i = new xs(t), + n = new Ls(t); + return ( + (n.premultipliedAlpha = true), + { + context: t, + renderer: (e, t, s, o, r = 1, l = 0) => { + o && + (0 === l && + (a.bind(), a.setUniform4x4f( Is.MVP_MATRIX, new Float32Array([ @@ -30344,980 +30317,926 @@ var version = "v1.17.2"; i.begin(a)), n.draw(i, e), l === r - 1 && (i.end(), a.unbind())); - }, - } - ); - }, - Fs = function (e, t, a) { - return new Promise((i) => { - const n = new as(e); - (t.forEach(({ folder: e, atlas: t, json: a }) => { - (t && n.loadTextureAtlas(`${e}/${t}`), n.loadJson(`${e}/${a}`)); - }), - (function e() { - a(() => { - n.isLoadingComplete() - ? i({ assetManager: n, cachedSkeletonData: {} }) - : e(); - }, 100); - })()); - }); - }, - Ys = function ( - e, - { assetManager: t, cachedSkeletonData: a }, - i, - n, - s, - o, - r, - l, - c, - d, - ) { - var u, h; - const p = t.get(`${e.folder}/${e.atlas}`), - g = new Tn(p), - m = new zn(g), - f = `${e.folder}/${e.json}`; - let y; - a[f] - ? (y = a[f]) - : ((y = m.readSkeletonData(t.get(f))), (a[f] = y)); - const E = new Mn(y); - ((E.x = o), - (E.y = r), - (E.scaleX = - (null !== (u = null == l ? void 0 : l.x) && void 0 !== u - ? u - : 1) / 3), - (E.scaleY = - (null !== (h = null == l ? void 0 : l.y) && void 0 !== h - ? h - : 1) / 3)); - const b = new Hi(new an(E.data)); - return ( - b.setAnimation(0, n, s), - (d || c) && - b.addListener({ - event: - d && - ((e, t) => { - t.time > e.trackTime - 0.1 && d(t.data.name); - }), - complete: c, + }, + } + ); + }, + Fs = function (e, t, a) { + return new Promise((i) => { + const n = new as(e); + (t.forEach(({ folder: e, atlas: t, json: a }) => { + (t && n.loadTextureAtlas(`${e}/${t}`), n.loadJson(`${e}/${a}`)); + }), + (function e() { + a(() => { + n.isLoadingComplete() + ? i({ assetManager: n, cachedSkeletonData: {} }) + : e(); + }, 100); + })()); + }); + }, + Ys = function ( + e, + { assetManager: t, cachedSkeletonData: a }, + i, + n, + s, + o, + r, + l, + c, + d, + ) { + var u, h; + const p = t.get(`${e.folder}/${e.atlas}`), + g = new Tn(p), + m = new zn(g), + f = `${e.folder}/${e.json}`; + let y; + a[f] + ? (y = a[f]) + : ((y = m.readSkeletonData(t.get(f))), (a[f] = y)); + const E = new Mn(y); + ((E.x = o), + (E.y = r), + (E.scaleX = + (null !== (u = null == l ? void 0 : l.x) && void 0 !== u + ? u + : 1) / 3), + (E.scaleY = + (null !== (h = null == l ? void 0 : l.y) && void 0 !== h + ? h + : 1) / 3)); + const b = new Hi(new an(E.data)); + return ( + b.setAnimation(0, n, s), + (d || c) && + b.addListener({ + event: + d && + ((e, t) => { + t.time > e.trackTime - 0.1 && d(t.data.name); }), - b.update(Ds * i), - b.apply(E), - E.updateWorldTransform(), - { animationState: b, skeleton: E } - ); - }, - Us = function (e, t, a, i, n, s) { - const { animationState: o, skeleton: r } = e.runtime; - ((!e.dead && n > 5175) || (o.update(Ds * t), o.apply(r)), - r.updateWorldTransform()); - const l = new Fn(); - l.update(r, true); - const c = r.slots - .filter((e) => e.data.name.startsWith("Thorn_0")) - .map((e) => { - const { bone: t, attachment: i } = e; - return null === i - ? null - : { x: t.worldX + a, y: t.worldY, width: 70, height: 70 }; + complete: c, + }), + b.update(Ds * i), + b.apply(E), + E.updateWorldTransform(), + { animationState: b, skeleton: E } + ); + }, + Us = function (e, t, a, i, n, s) { + const { animationState: o, skeleton: r } = e.runtime; + ((!e.dead && n > 5175) || (o.update(Ds * t), o.apply(r)), + r.updateWorldTransform()); + const l = new Fn(); + l.update(r, true); + const c = r.slots + .filter((e) => e.data.name.startsWith("Thorn_0")) + .map((e) => { + const { bone: t, attachment: i } = e; + return null === i + ? null + : { x: t.worldX + a, y: t.worldY, width: 70, height: 70 }; + }) + .filter(nt); + e.collisionFn = (t, i) => { + if ( + c.some((e) => { + if ( + be.pointInBox2(e.x, e.y, 2 * e.width, 2 * e.height, t, i) + ) { + const a = de.getDiamondPoly(e.x, e.y, e.width, e.height); + if (be.objectPolyInPoint2(a, t, i)) return true; + } + return false; }) - .filter(nt); - e.collisionFn = (t, i) => { - if ( - c.some((e) => { - if ( - be.pointInBox2(e.x, e.y, 2 * e.width, 2 * e.height, t, i) - ) { - const a = de.getDiamondPoly(e.x, e.y, e.width, e.height); - if (be.objectPolyInPoint2(a, t, i)) return true; - } - return false; - }) - ) - return true; - const n = t - a, - d = i; - if (!e.dead && l.aabbContainsPoint(n, d)) { - const t = l.containsPoint(n, d); - if (null !== t) { - if ("5" !== t.name) return true; - { - ((e.dead = true), s("audio/levels/boss1/death.mp3")); - const t = o.getCurrent(0).trackTime, - a = 86.23; - t < a && (o.update(a - t), o.apply(r)); - } + ) + return true; + const n = t - a, + d = i; + if (!e.dead && l.aabbContainsPoint(n, d)) { + const t = l.containsPoint(n, d); + if (null !== t) { + if ("5" !== t.name) return true; + { + ((e.dead = true), s("audio/levels/boss1/death.mp3")); + const t = o.getCurrent(0).trackTime, + a = 86.23; + t < a && (o.update(a - t), o.apply(r)); } } - return false; - }; + } + return false; + }; + }, + js = function ({ animationState: e, skeleton: t }, a, i, n) { + (e.update(Ds * i), + e.apply(t), + a.animationState.update(Ds * i), + a.animationState.apply(a.skeleton), + t.updateWorldTransform(), + a.skeleton.updateWorldTransform()); + const s = new Fn(); + s.update(t, false); + const o = new Fn(); + return ( + o.update(a.skeleton, false), + { + collisionFn: (e, t) => null !== s.containsPoint(e - n, t), + blockCollisionFn: (e, t) => null !== o.containsPoint(e - n, t), + } + ); + }, + Gs = function (e) { + ((e.cachedSkeletonData = {}), e.assetManager.removeAll()); + }, + Vs = makeNativeSprite("Spine"), + Hs = makeNativeSprite("SpineWithRuntime"), + Xs = { + create: ({ + props: { + animationAssets: e, + loop: t, + fileNames: a, + animationName: i, + startFromFrame: n = 0, + x: s, + y: o, + scale: r, + onEnd: l, + onEvent: c, + }, + }) => ({ runtime: Ys(a, e, n, i, t, s, o, r, l, c) }), + loop: ({ + props: { + x: e, + y: t, + scale: a, + rotation: i, + height: n, + df: s, + paused: o, + animationRenderer: r, + batchLength: l, + batchIndex: c, + }, + state: d, + spriteToGameCoords: u, + utils: h, + }) => { + const { + runtime: { skeleton: p, animationState: g }, + } = d; + (o || (g.update(zs * s), g.apply(p)), + u(e, t - n / 2, p), + void 0 !== i && (p.getRootBone().rotation = -i), + void 0 !== a && ((p.scaleX = a.x / 3), (p.scaleY = a.y / 3)), + p.updateWorldTransform(), + r( + p, + h.size.width + 2 * h.size.widthMargin, + h.size.height + 2 * h.size.heightMargin, + h.isLastFrame, + l, + c, + )); }, - js = function ({ animationState: e, skeleton: t }, a, i, n) { - (e.update(Ds * i), - e.apply(t), - a.animationState.update(Ds * i), - a.animationState.apply(a.skeleton), - t.updateWorldTransform(), - a.skeleton.updateWorldTransform()); - const s = new Fn(); - s.update(t, false); - const o = new Fn(); - return ( - o.update(a.skeleton, false), - { - collisionFn: (e, t) => null !== s.containsPoint(e - n, t), - blockCollisionFn: (e, t) => null !== o.containsPoint(e - n, t), - } - ); + cleanup: () => { }, + }, + zs = 1 / 60, + Ws = A(), + qs = (e) => { + switch (e) { + case "world1": + case "world1Boss": + return [ + `images/themes/${e}/background/Blur02.png`, + `images/themes/${e}/background/Fence03.png`, + `images/themes/${e}/background/RectangleBG02.png`, + `images/themes/${e}/background/Shape02.png`, + `images/themes/${e}/background/Star03.png`, + `images/themes/${e}/background/Dust.png`, + `images/themes/${e}/background/Fence04.png`, + `images/themes/${e}/background/RectangleBG03.png`, + `images/themes/${e}/background/Shape03.png`, + `images/themes/${e}/background/Fence01.png`, + `images/themes/${e}/background/Flara01.png`, + `images/themes/${e}/background/RectangleBG04.png`, + `images/themes/${e}/background/Star01.png`, + `images/themes/${e}/background/Blur01.png`, + `images/themes/${e}/background/Fence02.png`, + `images/themes/${e}/background/RectangleBG01.png`, + `images/themes/${e}/background/Shape01.png`, + `images/themes/${e}/background/Star02.png`, + `images/themes/${e}/background/Triangle01.png`, + `images/themes/${e}/background/Triangle02.png`, + `images/themes/${e}/background/Triangle03.png`, + `images/themes/${e}/background/Triangle04.png`, + `images/themes/${e}/background/Triangle05.png`, + `images/themes/${e}/background/Triangle06.png`, + `images/themes/${e}/background/Triangle07.png`, + `images/themes/${e}/background/Rectangle06.png`, + `images/themes/${e}/background/RectangleLong.png`, + ]; + case "world2": + case "world2Red": + case "dreamy": + case "arrows": + case "fighter": + return []; + case "classic": + return ["images/themes/classic/background/fade.png"]; + case "infinite": + return ["images/themes/infinite/background/tile.png"]; + case "red": + return [ + "images/themes/red/background/background.png", + "images/themes/red/background/background-red-dots.png", + "images/themes/red/background/background-red-flame1.png", + "images/themes/red/background/background-red-flame2.png", + ]; + case "world3": + case "virtual": + case "world3Red": + return [ + `images/themes/world3/background/pink-triangle.png`, + `images/themes/world3/background/red-triangle.png`, + "images/themes/world3/background/stars-moving.png", + "images/themes/world3/background/stars-static.png", + "images/themes/world3/background/cloud.png", + ]; + case "synthwave": + return [ + "images/themes/synthwave/background.png", + "images/themes/synthwave/mountains.png", + ]; + case "world4": + case "world4Boss": + case "world4Red": + const t = + "world4" === e + ? "background" + : "world4Red" === e + ? "red" + : "boss"; + return [ + `images/themes/world4/${t}/background.png`, + `images/themes/world4/${t}/castle.png`, + `images/themes/world4/${t}/cloud1.png`, + `images/themes/world4/${t}/cloud2.png`, + `images/themes/world4/${t}/front-mountain1.png`, + `images/themes/world4/${t}/front-mountain2.png`, + ]; + case "skater": + return [ + "images/themes/skater/background/cloud1.png", + "images/themes/skater/background/cloud2.png", + "images/themes/skater/background/distant-buildings.png", + "images/themes/skater/background/distant-buildings2.png", + "images/themes/skater/background/ground-buildings.png", + "images/themes/skater/background/hedges.png", + "images/themes/skater/background/sky-buildings.png", + "images/themes/skater/background/sky.png", + ]; + case "speed": + return [ + "images/themes/speed/moon.png", + "images/themes/speed/red_moon.png", + "images/themes/speed/plan1.png", + "images/themes/speed/ash.png", + ]; + } + }, + $s = (e) => { + switch (e) { + case "world2": + return [ + "images/themes/world2/background/BG_01.png", + "images/themes/world2/background/BG_02.png", + "images/themes/world2/background/BG_03.png", + "images/themes/world2/background/BG_04.png", + "images/themes/world2/background/BG_05.png", + ]; + case "world2Red": + return [ + "images/themes/world2Red/BG_01.png", + "images/themes/world2Red/BG_02.png", + "images/themes/world2Red/BG_03.png", + "images/themes/world2Red/BG_04.png", + "images/themes/world2Red/BG_05.png", + ]; + case "fighter": + return [ + "images/themes/punch/background/BG_01.png", + "images/themes/punch/background/BG_02.png", + "images/themes/punch/background/BG_03.png", + "images/themes/punch/background/BG_04.png", + "images/themes/punch/background/BG_05.png", + "images/themes/punch/background/Building_01.png", + "images/themes/punch/background/cloud_01.png", + "images/themes/punch/background/cloud_02.png", + "images/themes/punch/background/cloud_03.png", + "images/themes/punch/background/cloud_04.png", + "images/themes/punch/background/ground.png", + "images/themes/punch/background/moon.png", + "images/themes/punch/background/water.png", + ]; + default: + return []; + } + }, + Js = (e, t) => [ + bgOnly ? "images/themes/blank/block.png" : "images/player/glow.png", + ...e.map((e) => `images/player/skins/${e.fileName}.png`), + ...t.map((e) => `images/player/skins/dark/${e.fileName}.png`), + ...(e.some((e) => "pixel" === e.trail.form) + ? ["images/player/pixel-explosion.png"] + : []), + ], + Ks = { + world1Boss: { + folder: "spine/robotBoss", + atlas: "skeleton.atlas", + json: "skeleton.json", }, - Gs = function (e) { - ((e.cachedSkeletonData = {}), e.assetManager.removeAll()); + world4Boss: { + folder: "spine/demonBoss", + atlas: "boss_anima.atlas", + json: "boss_anima.json", }, - Vs = makeNativeSprite("Spine"), - Hs = makeNativeSprite("SpineWithRuntime"), - Xs = { - create: ({ - props: { - animationAssets: e, - loop: t, - fileNames: a, - animationName: i, - startFromFrame: n = 0, - x: s, - y: o, - scale: r, - onEnd: l, - onEvent: c, - }, - }) => ({ runtime: Ys(a, e, n, i, t, s, o, r, l, c) }), - loop: ({ - props: { - x: e, - y: t, - scale: a, - rotation: i, - height: n, - df: s, - paused: o, - animationRenderer: r, - batchLength: l, - batchIndex: c, - }, - state: d, - spriteToGameCoords: u, - utils: h, - }) => { - const { - runtime: { skeleton: p, animationState: g }, - } = d; - (o || (g.update(zs * s), g.apply(p)), - u(e, t - n / 2, p), - void 0 !== i && (p.getRootBone().rotation = -i), - void 0 !== a && ((p.scaleX = a.x / 3), (p.scaleY = a.y / 3)), - p.updateWorldTransform(), - r( - p, - h.size.width + 2 * h.size.widthMargin, - h.size.height + 2 * h.size.heightMargin, - h.isLastFrame, - l, - c, - )); - }, - cleanup: () => {}, + world4BossFistCollision: { + folder: "spine/demonBossFist", + atlas: "", + json: "fist_collision.json", }, - zs = 1 / 60, - Ws = A(), - qs = (e) => { - switch (e) { - case "world1": - case "world1Boss": - return [ - `images/themes/${e}/background/Blur02.png`, - `images/themes/${e}/background/Fence03.png`, - `images/themes/${e}/background/RectangleBG02.png`, - `images/themes/${e}/background/Shape02.png`, - `images/themes/${e}/background/Star03.png`, - `images/themes/${e}/background/Dust.png`, - `images/themes/${e}/background/Fence04.png`, - `images/themes/${e}/background/RectangleBG03.png`, - `images/themes/${e}/background/Shape03.png`, - `images/themes/${e}/background/Fence01.png`, - `images/themes/${e}/background/Flara01.png`, - `images/themes/${e}/background/RectangleBG04.png`, - `images/themes/${e}/background/Star01.png`, - `images/themes/${e}/background/Blur01.png`, - `images/themes/${e}/background/Fence02.png`, - `images/themes/${e}/background/RectangleBG01.png`, - `images/themes/${e}/background/Shape01.png`, - `images/themes/${e}/background/Star02.png`, - `images/themes/${e}/background/Triangle01.png`, - `images/themes/${e}/background/Triangle02.png`, - `images/themes/${e}/background/Triangle03.png`, - `images/themes/${e}/background/Triangle04.png`, - `images/themes/${e}/background/Triangle05.png`, - `images/themes/${e}/background/Triangle06.png`, - `images/themes/${e}/background/Triangle07.png`, - `images/themes/${e}/background/Rectangle06.png`, - `images/themes/${e}/background/RectangleLong.png`, - ]; - case "world2": - case "world2Red": - case "dreamy": - case "arrows": - case "fighter": - return []; - case "classic": - return ["images/themes/classic/background/fade.png"]; - case "infinite": - return ["images/themes/infinite/background/tile.png"]; - case "red": - return [ - "images/themes/red/background/background.png", - "images/themes/red/background/background-red-dots.png", - "images/themes/red/background/background-red-flame1.png", - "images/themes/red/background/background-red-flame2.png", - ]; - case "world3": - case "virtual": - case "world3Red": - return [ - `images/themes/world3/background/pink-triangle.png`, - `images/themes/world3/background/red-triangle.png`, - "images/themes/world3/background/stars-moving.png", - "images/themes/world3/background/stars-static.png", - "images/themes/world3/background/cloud.png", - ]; - case "synthwave": - return [ - "images/themes/synthwave/background.png", - "images/themes/synthwave/mountains.png", - ]; - case "world4": - case "world4Boss": - case "world4Red": - const t = - "world4" === e - ? "background" - : "world4Red" === e - ? "red" - : "boss"; - return [ - `images/themes/world4/${t}/background.png`, - `images/themes/world4/${t}/castle.png`, - `images/themes/world4/${t}/cloud1.png`, - `images/themes/world4/${t}/cloud2.png`, - `images/themes/world4/${t}/front-mountain1.png`, - `images/themes/world4/${t}/front-mountain2.png`, - ]; - case "skater": - return [ - "images/themes/skater/background/cloud1.png", - "images/themes/skater/background/cloud2.png", - "images/themes/skater/background/distant-buildings.png", - "images/themes/skater/background/distant-buildings2.png", - "images/themes/skater/background/ground-buildings.png", - "images/themes/skater/background/hedges.png", - "images/themes/skater/background/sky-buildings.png", - "images/themes/skater/background/sky.png", - ]; - case "speed": - return [ - "images/themes/speed/moon.png", - "images/themes/speed/red_moon.png", - "images/themes/speed/plan1.png", - "images/themes/speed/ash.png", - ]; - } + world4BossMinion: { + folder: "spine/demonBossMinion", + atlas: "minion.atlas", + json: "minion.json", }, - $s = (e) => { - switch (e) { + world4BossFireBall: { + folder: "spine/demonBossFireball", + atlas: "skeleton.atlas", + json: "skeleton.json", + }, + world4BossPlayerHit: { + folder: "spine/demonBossPlayerHit", + atlas: "Player.atlas", + json: "Player.json", + }, + checkpointBasic: { + folder: "spine/checkpointBasic", + atlas: "skeleton.atlas", + json: "skeleton.json", + }, + checkpointEnd: { + folder: "spine/checkpointEnd", + atlas: "skeleton.atlas", + json: "skeleton.json", + }, + checkpointHit: { + folder: "spine/checkpointHit", + atlas: "skeleton.atlas", + json: "skeleton.json", + }, + countdownStart: { + folder: "spine/countdownStart", + atlas: "skeleton.atlas", + json: "skeleton.json", + }, + countdownResume: { + folder: "spine/countdownResume", + atlas: "skeleton.atlas", + json: "skeleton.json", + }, + levelComplete: { + folder: "spine/endOfLevel", + atlas: "skeleton.atlas", + json: "skeleton.json", + }, + doubleJump: { + folder: "spine/doubleJump", + atlas: "skeleton.atlas", + json: "skeleton.json", + }, + doubleJumpOnPlayer: { + folder: "spine/doubleJumpOnPlayer", + atlas: "skeleton.atlas", + json: "skeleton.json", + }, + portal: { + folder: "spine/portal", + atlas: "Portal2.atlas", + json: "Portal2.json", + }, + pixelPortal: { + folder: "spine/pixelPortal", + atlas: "Portal2.atlas", + json: "Portal2.json", + }, + skateboard: { + folder: "spine/skateboard", + atlas: "skateboard.atlas", + json: "skateboard.json", + }, + directionChange: { + folder: "spine/directionChange", + atlas: "skeleton.atlas", + json: "skeleton.json", + }, + directionChangeHit: { + folder: "spine/directionChangeHit", + atlas: "skeleton.atlas", + json: "skeleton.json", + }, + spring: { + folder: "spine/spring", + atlas: "skeleton.atlas", + json: "skeleton.json", + }, + flyingFlag: { + folder: "spine/flyingFlag", + atlas: "Flag1.atlas", + json: "Flag1.json", + }, + bossSpaceGun: { + folder: "spine/bossSpaceGun", + atlas: "spaceship_2.atlas", + json: "spaceship_2.json", + }, + arrow: { + folder: "spine/arrow", + atlas: "arrow_animation.atlas", + json: "arrow_animation.json", + }, + speedChange: { + folder: "spine/speedBoost", + atlas: "speed_boost_animation.atlas", + json: "speed_boost_animation.json", + }, + blockSwitchButton: { + folder: "spine/blockSwitchButton", + atlas: "Switch_button.atlas", + json: "Switch_button.json", + }, + sizeButton: { + folder: "spine/sizeButton", + atlas: "Switch_button.atlas", + json: "Switch_button.json", + }, + }, + Qs = { + getThemeImages: (e) => [ + ...(e.objects.block === "infinite" ? [ + "images/themes/infinite/colors/red", + "images/themes/infinite/colors/yellow", + "images/themes/infinite/colors/green", + "images/themes/infinite/colors/default", + "images/themes/infinite/colors/blue", + "images/themes/infinite/colors/purple", + "images/themes/infinite/colors/pink", + "images/themes/infinite/colors/black", + "images/themes/infinite/colors/white", + ].map((e) => [ + e + "/arrow.png", + e + "/doubleJump.png", + e + "/block.png", + e + "/spike.png", + e + "/player.png", + e + "/player-collecting.png", + e + "/player-golden-headphones.png", + e + "/saw-big.png", + e + "/saw-medium.png", + e + "/saw-bar.png", + e + "/saw.png" + ]).flat() : []), + `images/themes/${e.objects.block}/block.png`, + `images/themes/${e.objects.block}/boss.png`, + `images/themes/${e.objects.block}/steel.png`, + `images/themes/${e.objects.block}/block-light.png`, + `images/themes/${e.objects.block}/boss-light.png`, + `images/themes/${e.objects.platform}/platform.png`, + `images/themes/${e.objects.platform}/platform-rail.png`, + `images/themes/${e.objects.saw}/saw.png`, + `images/themes/${e.objects.saw}/saw-rail.png`, + `images/themes/${e.objects.spike}/spike.png`, + `images/themes/${e.objects.switch}/switch-platform.png`, + `images/themes/${e.objects.switch}/switch-button.png`, + "images/themes/world3/block-white.png", + "images/themes/world3/block-white-light.png", + "images/themes/world3/spike-white.png", + "images/themes/classic/ground.png", + "images/themes/infinite/ground.png", + "images/themes/world2/block-small.png", + "images/themes/world2/spike-small.png", + "images/themes/world3/bottom/laser-line.png", + "images/themes/classic/bottom/laser-line.png", + "images/themes/world2/bottom/laser-line.png", + "images/themes/world2/speed-change.png", + "images/themes/world1/arrow.png", + "images/themes/world2/arrow.png", + "images/themes/infinite/arrow.png", + "images/themes/world1/doubleJump.png", + "images/themes/classic/doubleJump.png", + "images/themes/infinite/doubleJump.png", + "images/themes/world2/double-jump.png", + `images/themes/${e.objects.spike == "classic" ? "classic" : e.objects.spike == "infinite" ? "infinite" : e.objects.spike == "world3" ? "world3" : "world1"}/saw-big.png`, + `images/themes/${e.objects.spike == "classic" ? "classic" : e.objects.spike == "infinite" ? "infinite" : e.objects.spike == "world3" ? "world3" : "world1"}/saw-medium.png`, + `images/themes/${e.objects.saw == "classic" ? "classic" : "infinite"}/saw-bar.png`, + "images/themes/world1/red.png", + "images/themes/world1/red-spike.png", + "images/themes/world1/blue-spike.png", + "images/themes/classic/red-spike.png", + "images/themes/classic/blue-spike.png", + "images/themes/world1/blue.png", + "images/themes/world2/red.png", + "images/themes/world2/blue.png", + "images/themes/classic/red.png", + "images/themes/classic/blue.png", + "images/themes/world1/red-outline.png", + "images/themes/world1/red-spike-outline.png", + "images/themes/world1/blue-outline.png", + "images/themes/world1/blue-spike-outline.png", + `images/themes/${e.objects.block || "world2"}/block-explosion.png`, + "images/themes/world2/block-spike-switch.png", + "images/themes/world1/spike-explosion.png", + "images/themes/world2/spike-explosion.png", + "images/themes/classic/spike-explosion.png", + "images/themes/world2/gun/bullet.png", + "images/themes/world2/gun/bullet-enemy.png", + "images/themes/world2/gun/bullet-destroy.png", + "images/themes/world2/gun/ground.png", + "images/themes/world2/gun/idle.png", + "images/themes/world2/gun/shooting.png", + "images/themes/world2/jetpack/back-launch.png", + "images/themes/world2/jetpack/back-on.png", + "images/themes/world2/jetpack/back-out.png", + "images/themes/world2/jetpack/back.png", + "images/themes/world2/jetpack/front-out.png", + "images/themes/world2/jetpack/front.png", + "images/themes/world2/jetpack/gauge.png", + "images/themes/world2/jetpack/ground.png", + "images/themes/world2/enemy-shooter.png", + "images/themes/world2/enemy-shooting.png", + "images/level/boss2/thinBullet.png", + "images/level/boss2/missile.png", + "images/level/boss2/bomb.png", + "images/level/boss2/bulletHell.png", + "images/level/boss2/bulletHellBig.png", + "images/themes/world3/player-ship.png", + "images/level/boss3/player-ship.png", + "images/level/boss3/star-line.png", + "images/level/boss3/star-line-stars.png", + "images/editor/editorOnly/size-button.png", + "images/editor/editorOnly/color-button.png", + "images/themes/skater/rail.png", + "images/themes/skater/skateboard.png", + `images/themes/${e.objects.switch == "world2" ? "world2" : "world4"}/portal-green.png`, + `images/themes/${e.objects.switch == "world2" ? "world2" : "world4"}/portal-yellow.png`, + `images/themes/${e.objects.switch == "world2" ? "world2" : "world4"}/portal-red.png`, + `images/themes/${e.objects.switch == "world2" ? "world2" : "world4"}/portal-blue.png`, + "images/themes/infinite/collectible.png", + "images/themes/synthwave/collectible.png", + "images/themes/world2/collectible-solid.png", + "images/themes/synthwave/collectible-pickup.png", + "images/themes/arrows/arrow.png", + "images/themes/punch/arrow.png", + "images/themes/arrows/arrow-outline.png", + "images/themes/arrows/arrow-outline-selected.png", + `images/themes/blank/bottom/block.png`, + + ...Js([e.player], []), + ...qs(e.background), + ...("world2" === e.objects.flag + ? [ + "images/themes/world2/flag/end.png", + "images/themes/world2/flag/idle.png", + "images/themes/world2/flag/passed.png", + "images/themes/world2/flag/confetti.png", + ] + : []), + ...("world2" === e.objects.dirChange + ? [ + "images/themes/world2/direction-change.png", + "images/themes/world2/direction-change-hit.png", + ] + : []), + ...("world3" === e.objects.bottom || + "classic" === e.objects.bottom + ? [ + "images/themes/world3/bottom/laser-line.png", + "images/themes/world3/bottom/block.png", + "images/themes/world1/bottom/block.png", + `images/themes/classic/bottom/block.png`, + "images/themes/skater/bottom/block.png", + `images/themes/infinite/bottom/block.png`, + ] + : [ + `images/themes/${e.objects.bottom}/bottom/block-small-spike.png`, + `images/themes/${e.objects.bottom}/bottom/block-spike-corner.png`, + `images/themes/${e.objects.bottom}/bottom/block-spike.png`, + `images/themes/${e.objects.bottom}/bottom/block.png`, + `images/themes/world1Boss/bottom/block.png`, + `images/themes/skater/bottom/block.png`, + + `images/themes/${e.objects.bottom}/bottom/double-tall-block-spike.png`, + `images/themes/${e.objects.bottom}/bottom/tall-block-spike.png`, + ]), + ], + getThemeImagesPixel: (e) => [ + "images/themes/world2/drill/ground.png", + "images/themes/world2/drill/idle.png", + "images/themes/punch/ground.png", + "images/themes/punch/idle.png", + "images/themes/punch/punch.png", + ...$s(e.background), + "images/themes/world2/enemy-walker-helmet.png", + "images/themes/world2/enemy-walker.png", + "images/themes/world2/enemy-walker-stomped.png", + "images/themes/world2/enemy-explosion.png", + ], + mainMenuImages: [ + "images/mainMenu/appleid_button.png", + "images/mainMenu/googlesignin_button.png", + "images/mainMenu/googlesignin_button_pressed.png", + "images/mainMenu/rhythm-button-lines.png", + "images/mainMenu/levelSelect/difficultyIcons/background.png", + "images/mainMenu/levelSelect/difficultyIcons/0.png", + "images/mainMenu/levelSelect/difficultyIcons/1.png", + "images/mainMenu/levelSelect/difficultyIcons/2.png", + "images/mainMenu/levelSelect/difficultyIcons/3.png", + "images/mainMenu/levelSelect/difficultyIcons/4.png", + "images/mainMenu/levelSelect/difficultyIcons/5.png", + "images/mainMenu/levelSelect/difficultyIcons/6.png", + "images/mainMenu/levelSelect/difficultyIcons/7.png", + "images/mainMenu/levelSelect/difficultyIcons/8.png", + "images/mainMenu/levelSelect/difficultyIcons/9.png", + "images/mainMenu/levelSelect/difficultyIcons/10.png", + "images/mainMenu/levelSelect/difficultyIconsModal/0.png", + "images/mainMenu/levelSelect/difficultyIconsModal/1.png", + "images/mainMenu/levelSelect/difficultyIconsModal/2.png", + "images/mainMenu/levelSelect/difficultyIconsModal/3.png", + "images/mainMenu/levelSelect/difficultyIconsModal/4.png", + "images/mainMenu/levelSelect/difficultyIconsModal/5.png", + "images/mainMenu/levelSelect/difficultyIconsModal/6.png", + "images/mainMenu/levelSelect/difficultyIconsModal/7.png", + "images/mainMenu/levelSelect/difficultyIconsModal/8.png", + "images/mainMenu/levelSelect/difficultyIconsModal/9.png", + "images/mainMenu/levelSelect/difficultyIconsModal/10.png", + "images/mainMenu/levelSelect/bpm/1.png", + "images/mainMenu/levelSelect/bpm/2.png", + "images/mainMenu/levelSelect/bpm/3.png", + "images/mainMenu/levelSelect/bpm/4.png", + "images/mainMenu/levelSelect/checkpointsIcon.png", + "images/mainMenu/levelSelect/checkpointsIconComplete.png", + "images/mainMenu/levelSelect/noCheckpointsIcon.png", + "images/mainMenu/levelSelect/noCheckpointsIconComplete.png", + "images/mainMenu/levelSelect/Level_Locked.png", + "images/mainMenu/lockIcon.png", + "images/mainMenu/levelSelect/Star01.png", + "images/mainMenu/levelSelect/Star02.png", + "images/mainMenu/flukegames.png", + "images/mainMenu/logo.png", + "images/mainMenu/worldSelect/1.png", + "images/mainMenu/worldSelect/2.png", + "images/mainMenu/worldSelect/3.png", + "images/mainMenu/worldSelect/4.png", + "images/mainMenu/worldSelect/5.png", + "images/level/arrow-up.png", + ], + getPlayerImages: Js, + editorImages: [ + "images/editor/delete.png", + "images/editor/pointer.png", + "images/editor/eraser.png", + "images/editor/add.png", + "images/editor/select.png", + "images/editor/duplicate.png", + "images/editor/undo.png", + "images/editor/theme.png", + "images/editor/editorOnly/direction-change.png", + "images/editor/editorOnly/double-jump.png", + "images/editor/editorOnly/spring.png", + "images/editor/editorOnly/speed-change.png", + "images/themes/blank/block.png", + "images/editor/editorOnly/block-switch-button.png", + "images/editor/editorOnly/size-button.png", + "images/editor/editorOnly/color-button.png", + "images/editor/editorOnly/falling-button.png", + "images/editor/editorOnly/falling-none.png", + "images/editor/editorOnly/falling-up-down.png", + "images/editor/editorOnly/minion.png", + "images/editor/objects/miniblock.png", + "images/editor/objects/block.png", + "images/editor/objects/platform.png", + "images/editor/objects/saw.png", + "images/editor/objects/powerup.png", + "images/editor/objects/spike.png", + "images/editor/objects/minispike.png", + "images/editor/objects/flag.png", + "images/editor/objects/dirchange.png", + "images/editor/objects/speedchange.png", + "images/editor/objects/switch.png", + "images/editor/objects/portal.png", + "images/editor/objects/enemy.png", + "images/editor/objects/spring.png", + "images/editor/objects/switchplatform.png", + "images/editor/objects/collectible.png", + "images/themes/world1/flag.png", + "images/themes/world1/flagEnd.png", + ], + editorSfx: ["audio/editor/erase.wav", "audio/editor/place.wav"], + superLevelPackImages: [ + "images/superLevelPack/Default.png", + "images/superLevelPack/Aura.png", + "images/superLevelPack/Cool Friends.png", + "images/superLevelPack/Nacreous Snowmelt.png", + "images/superLevelPack/For You.png", + ], + achievementImages: [ + "images/achievement/rewards/autopilot.png", + "images/achievement/rewards/missiles.png", + "images/achievement/rewards/slowmo.png", + "images/achievement/rewards/blocks.png", + "images/achievement/rewards/bonus.png", + "images/achievement/rewards/editor.png", + "images/achievement/rewards/theme.png", + "images/achievement/rewards-hidden.png", + "images/achievement/buy-pass-marks.png", + "images/achievement/skater-screenshot.png", + ], + achievementSfx: [ + "audio/achievement/achievement-unlocked.wav", + "audio/achievement/rewards-collect.wav", + ], + globalSfx: [ + "audio/global/button.wav", + "audio/global/button-select.wav", + "audio/global/purchase-blocks.wav", + "audio/global/purchase-item.wav", + "audio/global/sync.wav", + ], + levelSfx: [ + "audio/levels/explosion1.wav", + "audio/levels/explosion2.wav", + "audio/levels/explosion3.wav", + "audio/levels/jump.wav", + "audio/levels/flag.wav", + "audio/levels/direction-change.wav", + "audio/levels/coin-collect.wav", + "audio/levels/switch-button.mp3", + "audio/levels/missile.wav", + "audio/levels/portal1.wav", + "audio/levels/portal2.wav", + "audio/levels/spring.wav", + "audio/levels/level-complete.wav", + "audio/levels/object-explosion.wav", + "audio/levels/boss4/block_explosion.mp3", + "audio/levels/enemy/shoot.wav", + "audio/levels/enemy/stomped.wav", + "audio/levels/enemy/explosion.wav", + "audio/levels/gun/pickup.wav", + "audio/levels/gun/shoot.wav", + "audio/levels/jetpack/pickup.wav", + "audio/levels/jetpack/loop.wav", + "audio/levels/jetpack/finish.wav", + "audio/levels/punch/pickup.wav", + "audio/levels/punch/use.wav", + "audio/levels/stack/1.wav", + "audio/levels/stack/2.wav", + "audio/levels/stack/3.wav", + "audio/levels/stack/4.wav", + "audio/levels/stack/5.wav", + "audio/levels/stack/6.wav", + "audio/levels/stack/7.wav", + "audio/levels/doubleJump/jump.wav", + "audio/levels/doubleJump/pickup.wav", + "audio/levels/skateboard/move.wav", + "audio/levels/skateboard/ollie.wav", + "audio/levels/skateboard/grind.wav", + "audio/levels/skateboard/score/add.wav", + "audio/levels/skateboard/score/1.wav", + "audio/levels/skateboard/score/2.wav", + "audio/levels/skateboard/score/3.wav", + "audio/levels/skateboard/score/4.wav", + "audio/levels/skateboard/score/5.wav", + "audio/levels/skateboard/score/6.wav", + "audio/levels/skateboard/score/7.wav", + "audio/levels/skateboard/score/8.wav", + "audio/levels/skateboard/score/9.wav", + "audio/levels/skateboard/score/10.wav", + "audio/levels/speedChange/up1.wav", + "audio/levels/speedChange/up2.wav", + "audio/levels/speedChange/up3.wav", + "audio/levels/speedChange/up4.wav", + "audio/levels/speedChange/up5.wav", + "audio/levels/speedChange/down1.wav", + "audio/levels/speedChange/down2.wav", + "audio/levels/speedChange/down3.wav", + "audio/levels/speedChange/down4.wav", + "audio/levels/speedChange/down5.wav", + ], + levelImages: [ + "images/themes/infinite/attempt.png", + "images/level/attempt.png", + "images/themes/classic/menu-button.png", + "images/themes/classic/menu-button-pressed.png", + "images/themes/infinite/menu-button.png", + "images/themes/infinite/menu-button-pressed.png", + "images/level/arrow-up.png", + "images/level/arrow-down-stroke.png", + "images/level/flag.png", + "images/achievement/rewards/autopilot.png", + "images/achievement/rewards/missiles.png", + "images/achievement/rewards/slowmo.png", + ], + mainMenuAudio: [ + "audio/menu/accept.wav", + "audio/menu/error.wav", + "audio/menu/send.wav", + "audio/menu/party-invite.wav", + ], + getThemeSpine: (e) => { + const t = [ + Ks.levelComplete, + Ks.doubleJump, + Ks.doubleJumpOnPlayer, + Ks.spring, + Ks.portal, + Ks.pixelPortal, + Ks.skateboard, + Ks.speedChange, + Ks.arrow, + Ks.blockSwitchButton, + Ks.sizeButton, + Ks.world4BossMinion, + Ks.world4BossFireBall, + Ks.flyingFlag, + ]; + switch (e.id) { case "world2": - return [ - "images/themes/world2/background/BG_01.png", - "images/themes/world2/background/BG_02.png", - "images/themes/world2/background/BG_03.png", - "images/themes/world2/background/BG_04.png", - "images/themes/world2/background/BG_05.png", - ]; case "world2Red": + return t; + default: return [ - "images/themes/world2Red/BG_01.png", - "images/themes/world2Red/BG_02.png", - "images/themes/world2Red/BG_03.png", - "images/themes/world2Red/BG_04.png", - "images/themes/world2Red/BG_05.png", - ]; - case "fighter": - return [ - "images/themes/punch/background/BG_01.png", - "images/themes/punch/background/BG_02.png", - "images/themes/punch/background/BG_03.png", - "images/themes/punch/background/BG_04.png", - "images/themes/punch/background/BG_05.png", - "images/themes/punch/background/Building_01.png", - "images/themes/punch/background/cloud_01.png", - "images/themes/punch/background/cloud_02.png", - "images/themes/punch/background/cloud_03.png", - "images/themes/punch/background/cloud_04.png", - "images/themes/punch/background/ground.png", - "images/themes/punch/background/moon.png", - "images/themes/punch/background/water.png", + ...t, + Ks.checkpointBasic, + Ks.checkpointEnd, + Ks.checkpointHit, + Ks.directionChange, + Ks.directionChangeHit, ]; - default: - return []; } }, - Js = (e, t) => [ - bgOnly ? "images/themes/blank/block.png" : "images/player/glow.png", - ...e.map((e) => `images/player/skins/${e.fileName}.png`), - ...t.map((e) => `images/player/skins/dark/${e.fileName}.png`), - ...(e.some((e) => "pixel" === e.trail.form) - ? ["images/player/pixel-explosion.png"] - : []), + spineFiles: Ks, + onlineSpine: [Ks.countdownStart, Ks.countdownResume], + onlineImages: [ + "images/online/name-arrow.png", + "images/online/highlight-player.png", + "images/online/eye-icon.png", ], - Ks = { - world1Boss: { - folder: "spine/robotBoss", - atlas: "skeleton.atlas", - json: "skeleton.json", - }, - world4Boss: { - folder: "spine/demonBoss", - atlas: "boss_anima.atlas", - json: "boss_anima.json", - }, - world4BossFistCollision: { - folder: "spine/demonBossFist", - atlas: "", - json: "fist_collision.json", - }, - world4BossMinion: { - folder: "spine/demonBossMinion", - atlas: "minion.atlas", - json: "minion.json", - }, - world4BossFireBall: { - folder: "spine/demonBossFireball", - atlas: "skeleton.atlas", - json: "skeleton.json", - }, - world4BossPlayerHit: { - folder: "spine/demonBossPlayerHit", - atlas: "Player.atlas", - json: "Player.json", - }, - checkpointBasic: { - folder: "spine/checkpointBasic", - atlas: "skeleton.atlas", - json: "skeleton.json", - }, - checkpointEnd: { - folder: "spine/checkpointEnd", - atlas: "skeleton.atlas", - json: "skeleton.json", - }, - checkpointHit: { - folder: "spine/checkpointHit", - atlas: "skeleton.atlas", - json: "skeleton.json", - }, - countdownStart: { - folder: "spine/countdownStart", - atlas: "skeleton.atlas", - json: "skeleton.json", - }, - countdownResume: { - folder: "spine/countdownResume", - atlas: "skeleton.atlas", - json: "skeleton.json", - }, - levelComplete: { - folder: "spine/endOfLevel", - atlas: "skeleton.atlas", - json: "skeleton.json", - }, - doubleJump: { - folder: "spine/doubleJump", - atlas: "skeleton.atlas", - json: "skeleton.json", - }, - doubleJumpOnPlayer: { - folder: "spine/doubleJumpOnPlayer", - atlas: "skeleton.atlas", - json: "skeleton.json", - }, - portal: { - folder: "spine/portal", - atlas: "Portal2.atlas", - json: "Portal2.json", - }, - pixelPortal: { - folder: "spine/pixelPortal", - atlas: "Portal2.atlas", - json: "Portal2.json", - }, - skateboard: { - folder: "spine/skateboard", - atlas: "skateboard.atlas", - json: "skateboard.json", - }, - directionChange: { - folder: "spine/directionChange", - atlas: "skeleton.atlas", - json: "skeleton.json", - }, - directionChangeHit: { - folder: "spine/directionChangeHit", - atlas: "skeleton.atlas", - json: "skeleton.json", - }, - spring: { - folder: "spine/spring", - atlas: "skeleton.atlas", - json: "skeleton.json", - }, - flyingFlag: { - folder: "spine/flyingFlag", - atlas: "Flag1.atlas", - json: "Flag1.json", - }, - bossSpaceGun: { - folder: "spine/bossSpaceGun", - atlas: "spaceship_2.atlas", - json: "spaceship_2.json", - }, - arrow: { - folder: "spine/arrow", - atlas: "arrow_animation.atlas", - json: "arrow_animation.json", - }, - speedChange: { - folder: "spine/speedBoost", - atlas: "speed_boost_animation.atlas", - json: "speed_boost_animation.json", - }, - blockSwitchButton: { - folder: "spine/blockSwitchButton", - atlas: "Switch_button.atlas", - json: "Switch_button.json", - }, - sizeButton: { - folder: "spine/sizeButton", - atlas: "Switch_button.atlas", - json: "Switch_button.json", - }, - }, - Qs = { - getThemeImages: (e) => [ - ...(e.objects.block === "infinite" ? [ - "images/themes/infinite/colors/red", - "images/themes/infinite/colors/yellow", - "images/themes/infinite/colors/green", - "images/themes/infinite/colors/default", - "images/themes/infinite/colors/blue", - "images/themes/infinite/colors/purple", - "images/themes/infinite/colors/pink", - "images/themes/infinite/colors/black", - "images/themes/infinite/colors/white", - ].map((e) => [ - e + "/arrow.png", - e + "/doubleJump.png", - e + "/block.png", - e + "/spike.png", - e + "/player.png", - e + "/player-collecting.png", - e + "/player-golden-headphones.png", - e + "/saw-big.png", - e + "/saw-medium.png", - e + "/saw-bar.png", - e + "/saw.png" - ]).flat() : []), - `images/themes/${e.objects.block}/block.png`, - `images/themes/${e.objects.block}/boss.png`, - `images/themes/${e.objects.block}/steel.png`, - `images/themes/${e.objects.block}/block-light.png`, - `images/themes/${e.objects.block}/boss-light.png`, - `images/themes/${e.objects.platform}/platform.png`, - `images/themes/${e.objects.platform}/platform-rail.png`, - `images/themes/${e.objects.saw}/saw.png`, - `images/themes/${e.objects.saw}/saw-rail.png`, - `images/themes/${e.objects.spike}/spike.png`, - `images/themes/${e.objects.switch}/switch-platform.png`, - `images/themes/${e.objects.switch}/switch-button.png`, - "images/themes/world3/block-white.png", - "images/themes/world3/block-white-light.png", - "images/themes/world3/spike-white.png", - "images/themes/classic/ground.png", - "images/themes/infinite/ground.png", - "images/themes/world2/block-small.png", - "images/themes/world2/spike-small.png", - "images/themes/world3/bottom/laser-line.png", - "images/themes/classic/bottom/laser-line.png", - "images/themes/world2/bottom/laser-line.png", - "images/themes/world2/speed-change.png", - "images/themes/world1/arrow.png", - "images/themes/world2/arrow.png", - "images/themes/infinite/arrow.png", - "images/themes/world1/doubleJump.png", - "images/themes/classic/doubleJump.png", - "images/themes/infinite/doubleJump.png", - "images/themes/world2/double-jump.png", - `images/themes/${e.objects.spike == "classic" ? "classic" : e.objects.spike == "infinite" ? "infinite" : e.objects.spike == "world3" ? "world3" : "world1"}/saw-big.png`, - `images/themes/${e.objects.spike == "classic" ? "classic" : e.objects.spike == "infinite" ? "infinite" : e.objects.spike == "world3" ? "world3" : "world1"}/saw-medium.png`, - `images/themes/${e.objects.saw == "classic" ? "classic" : "infinite"}/saw-bar.png`, - "images/themes/world1/red.png", - "images/themes/world1/red-spike.png", - "images/themes/world1/blue-spike.png", - "images/themes/classic/red-spike.png", - "images/themes/classic/blue-spike.png", - "images/themes/world1/blue.png", - "images/themes/world2/red.png", - "images/themes/world2/blue.png", - "images/themes/classic/red.png", - "images/themes/classic/blue.png", - "images/themes/world1/red-outline.png", - "images/themes/world1/red-spike-outline.png", - "images/themes/world1/blue-outline.png", - "images/themes/world1/blue-spike-outline.png", - `images/themes/${e.objects.block || "world2"}/block-explosion.png`, - "images/themes/world2/block-spike-switch.png", - "images/themes/world1/spike-explosion.png", - "images/themes/world2/spike-explosion.png", - "images/themes/classic/spike-explosion.png", - "images/themes/world2/gun/bullet.png", - "images/themes/world2/gun/bullet-enemy.png", - "images/themes/world2/gun/bullet-destroy.png", - "images/themes/world2/gun/ground.png", - "images/themes/world2/gun/idle.png", - "images/themes/world2/gun/shooting.png", - "images/themes/world2/jetpack/back-launch.png", - "images/themes/world2/jetpack/back-on.png", - "images/themes/world2/jetpack/back-out.png", - "images/themes/world2/jetpack/back.png", - "images/themes/world2/jetpack/front-out.png", - "images/themes/world2/jetpack/front.png", - "images/themes/world2/jetpack/gauge.png", - "images/themes/world2/jetpack/ground.png", - "images/themes/world2/enemy-shooter.png", - "images/themes/world2/enemy-shooting.png", - "images/level/boss2/thinBullet.png", - "images/level/boss2/missile.png", - "images/level/boss2/bomb.png", - "images/level/boss2/bulletHell.png", - "images/level/boss2/bulletHellBig.png", - "images/themes/world3/player-ship.png", - "images/level/boss3/player-ship.png", - "images/level/boss3/star-line.png", - "images/level/boss3/star-line-stars.png", - "images/editor/editorOnly/size-button.png", - "images/editor/editorOnly/color-button.png", - "images/themes/skater/rail.png", - "images/themes/skater/skateboard.png", - `images/themes/${e.objects.switch == "world2" ? "world2" : "world4"}/portal-green.png`, - `images/themes/${e.objects.switch == "world2" ? "world2" : "world4"}/portal-yellow.png`, - `images/themes/${e.objects.switch == "world2" ? "world2" : "world4"}/portal-red.png`, - `images/themes/${e.objects.switch == "world2" ? "world2" : "world4"}/portal-blue.png`, - "images/themes/infinite/collectible.png", - "images/themes/synthwave/collectible.png", - "images/themes/world2/collectible-solid.png", - "images/themes/synthwave/collectible-pickup.png", - "images/themes/arrows/arrow.png", - "images/themes/punch/arrow.png", - "images/themes/arrows/arrow-outline.png", - "images/themes/arrows/arrow-outline-selected.png", - `images/themes/blank/bottom/block.png`, - - ...Js([e.player], []), - ...qs(e.background), - ...("world2" === e.objects.flag - ? [ - "images/themes/world2/flag/end.png", - "images/themes/world2/flag/idle.png", - "images/themes/world2/flag/passed.png", - "images/themes/world2/flag/confetti.png", - ] - : []), - ...("world2" === e.objects.dirChange - ? [ - "images/themes/world2/direction-change.png", - "images/themes/world2/direction-change-hit.png", - ] - : []), - ...("world3" === e.objects.bottom || - "classic" === e.objects.bottom - ? [ - "images/themes/world3/bottom/laser-line.png", - "images/themes/world3/bottom/block.png", - "images/themes/world1/bottom/block.png", - `images/themes/classic/bottom/block.png`, - "images/themes/skater/bottom/block.png", - `images/themes/infinite/bottom/block.png`, - ] - : [ - `images/themes/${e.objects.bottom}/bottom/block-small-spike.png`, - `images/themes/${e.objects.bottom}/bottom/block-spike-corner.png`, - `images/themes/${e.objects.bottom}/bottom/block-spike.png`, - `images/themes/${e.objects.bottom}/bottom/block.png`, - `images/themes/world1Boss/bottom/block.png`, - `images/themes/skater/bottom/block.png`, - - `images/themes/${e.objects.bottom}/bottom/double-tall-block-spike.png`, - `images/themes/${e.objects.bottom}/bottom/tall-block-spike.png`, - ]), - ], - getThemeImagesPixel: (e) => [ - "images/themes/world2/drill/ground.png", - "images/themes/world2/drill/idle.png", - "images/themes/punch/ground.png", - "images/themes/punch/idle.png", - "images/themes/punch/punch.png", - ...$s(e.background), - "images/themes/world2/enemy-walker-helmet.png", - "images/themes/world2/enemy-walker.png", - "images/themes/world2/enemy-walker-stomped.png", - "images/themes/world2/enemy-explosion.png", - ], - mainMenuImages: [ - "images/mainMenu/appleid_button.png", - "images/mainMenu/googlesignin_button.png", - "images/mainMenu/googlesignin_button_pressed.png", - "images/mainMenu/rhythm-button-lines.png", - "images/mainMenu/levelSelect/difficultyIcons/background.png", - "images/mainMenu/levelSelect/difficultyIcons/0.png", - "images/mainMenu/levelSelect/difficultyIcons/1.png", - "images/mainMenu/levelSelect/difficultyIcons/2.png", - "images/mainMenu/levelSelect/difficultyIcons/3.png", - "images/mainMenu/levelSelect/difficultyIcons/4.png", - "images/mainMenu/levelSelect/difficultyIcons/5.png", - "images/mainMenu/levelSelect/difficultyIcons/6.png", - "images/mainMenu/levelSelect/difficultyIcons/7.png", - "images/mainMenu/levelSelect/difficultyIcons/8.png", - "images/mainMenu/levelSelect/difficultyIcons/9.png", - "images/mainMenu/levelSelect/difficultyIcons/10.png", - "images/mainMenu/levelSelect/difficultyIconsModal/0.png", - "images/mainMenu/levelSelect/difficultyIconsModal/1.png", - "images/mainMenu/levelSelect/difficultyIconsModal/2.png", - "images/mainMenu/levelSelect/difficultyIconsModal/3.png", - "images/mainMenu/levelSelect/difficultyIconsModal/4.png", - "images/mainMenu/levelSelect/difficultyIconsModal/5.png", - "images/mainMenu/levelSelect/difficultyIconsModal/6.png", - "images/mainMenu/levelSelect/difficultyIconsModal/7.png", - "images/mainMenu/levelSelect/difficultyIconsModal/8.png", - "images/mainMenu/levelSelect/difficultyIconsModal/9.png", - "images/mainMenu/levelSelect/difficultyIconsModal/10.png", - "images/mainMenu/levelSelect/bpm/1.png", - "images/mainMenu/levelSelect/bpm/2.png", - "images/mainMenu/levelSelect/bpm/3.png", - "images/mainMenu/levelSelect/bpm/4.png", - "images/mainMenu/levelSelect/checkpointsIcon.png", - "images/mainMenu/levelSelect/checkpointsIconComplete.png", - "images/mainMenu/levelSelect/noCheckpointsIcon.png", - "images/mainMenu/levelSelect/noCheckpointsIconComplete.png", - "images/mainMenu/levelSelect/Level_Locked.png", - "images/mainMenu/lockIcon.png", - "images/mainMenu/levelSelect/Star01.png", - "images/mainMenu/levelSelect/Star02.png", - "images/mainMenu/flukegames.png", - "images/mainMenu/logo.png", - "images/mainMenu/worldSelect/1.png", - "images/mainMenu/worldSelect/2.png", - "images/mainMenu/worldSelect/3.png", - "images/mainMenu/worldSelect/4.png", - "images/mainMenu/worldSelect/5.png", - "images/level/arrow-up.png", - ], - getPlayerImages: Js, - editorImages: [ - "images/editor/delete.png", - "images/editor/pointer.png", - "images/editor/eraser.png", - "images/editor/add.png", - "images/editor/select.png", - "images/editor/duplicate.png", - "images/editor/undo.png", - "images/editor/theme.png", - "images/editor/editorOnly/direction-change.png", - "images/editor/editorOnly/double-jump.png", - "images/editor/editorOnly/spring.png", - "images/editor/editorOnly/speed-change.png", - "images/themes/blank/block.png", - "images/editor/editorOnly/block-switch-button.png", - "images/editor/editorOnly/size-button.png", - "images/editor/editorOnly/color-button.png", - "images/editor/editorOnly/falling-button.png", - "images/editor/editorOnly/falling-none.png", - "images/editor/editorOnly/falling-up-down.png", - "images/editor/editorOnly/minion.png", - "images/editor/objects/miniblock.png", - "images/editor/objects/block.png", - "images/editor/objects/platform.png", - "images/editor/objects/saw.png", - "images/editor/objects/powerup.png", - "images/editor/objects/spike.png", - "images/editor/objects/minispike.png", - "images/editor/objects/flag.png", - "images/editor/objects/dirchange.png", - "images/editor/objects/speedchange.png", - "images/editor/objects/switch.png", - "images/editor/objects/portal.png", - "images/editor/objects/enemy.png", - "images/editor/objects/spring.png", - "images/editor/objects/switchplatform.png", - "images/editor/objects/collectible.png", - "images/themes/world1/flag.png", - "images/themes/world1/flagEnd.png", - ], - editorSfx: ["audio/editor/erase.wav", "audio/editor/place.wav"], - superLevelPackImages: [ - "images/superLevelPack/Default.png", - "images/superLevelPack/Aura.png", - "images/superLevelPack/Cool Friends.png", - "images/superLevelPack/Nacreous Snowmelt.png", - "images/superLevelPack/For You.png", - ], - achievementImages: [ - "images/achievement/rewards/autopilot.png", - "images/achievement/rewards/missiles.png", - "images/achievement/rewards/slowmo.png", - "images/achievement/rewards/blocks.png", - "images/achievement/rewards/bonus.png", - "images/achievement/rewards/editor.png", - "images/achievement/rewards/theme.png", - "images/achievement/rewards-hidden.png", - "images/achievement/buy-pass-marks.png", - "images/achievement/skater-screenshot.png", - ], - achievementSfx: [ - "audio/achievement/achievement-unlocked.wav", - "audio/achievement/rewards-collect.wav", - ], - globalSfx: [ - "audio/global/button.wav", - "audio/global/button-select.wav", - "audio/global/purchase-blocks.wav", - "audio/global/purchase-item.wav", - "audio/global/sync.wav", - ], - levelSfx: [ - "audio/levels/explosion1.wav", - "audio/levels/explosion2.wav", - "audio/levels/explosion3.wav", - "audio/levels/jump.wav", - "audio/levels/flag.wav", - "audio/levels/direction-change.wav", - "audio/levels/coin-collect.wav", - "audio/levels/switch-button.mp3", - "audio/levels/missile.wav", - "audio/levels/portal1.wav", - "audio/levels/portal2.wav", - "audio/levels/spring.wav", - "audio/levels/level-complete.wav", - "audio/levels/object-explosion.wav", - "audio/levels/boss4/block_explosion.mp3", - "audio/levels/enemy/shoot.wav", - "audio/levels/enemy/stomped.wav", - "audio/levels/enemy/explosion.wav", - "audio/levels/gun/pickup.wav", - "audio/levels/gun/shoot.wav", - "audio/levels/jetpack/pickup.wav", - "audio/levels/jetpack/loop.wav", - "audio/levels/jetpack/finish.wav", - "audio/levels/punch/pickup.wav", - "audio/levels/punch/use.wav", - "audio/levels/stack/1.wav", - "audio/levels/stack/2.wav", - "audio/levels/stack/3.wav", - "audio/levels/stack/4.wav", - "audio/levels/stack/5.wav", - "audio/levels/stack/6.wav", - "audio/levels/stack/7.wav", - "audio/levels/doubleJump/jump.wav", - "audio/levels/doubleJump/pickup.wav", - "audio/levels/skateboard/move.wav", - "audio/levels/skateboard/ollie.wav", - "audio/levels/skateboard/grind.wav", - "audio/levels/skateboard/score/add.wav", - "audio/levels/skateboard/score/1.wav", - "audio/levels/skateboard/score/2.wav", - "audio/levels/skateboard/score/3.wav", - "audio/levels/skateboard/score/4.wav", - "audio/levels/skateboard/score/5.wav", - "audio/levels/skateboard/score/6.wav", - "audio/levels/skateboard/score/7.wav", - "audio/levels/skateboard/score/8.wav", - "audio/levels/skateboard/score/9.wav", - "audio/levels/skateboard/score/10.wav", - "audio/levels/speedChange/up1.wav", - "audio/levels/speedChange/up2.wav", - "audio/levels/speedChange/up3.wav", - "audio/levels/speedChange/up4.wav", - "audio/levels/speedChange/up5.wav", - "audio/levels/speedChange/down1.wav", - "audio/levels/speedChange/down2.wav", - "audio/levels/speedChange/down3.wav", - "audio/levels/speedChange/down4.wav", - "audio/levels/speedChange/down5.wav", - ], - levelImages: [ - "images/themes/infinite/attempt.png", - "images/level/attempt.png", - "images/themes/classic/menu-button.png", - "images/themes/classic/menu-button-pressed.png", - "images/themes/infinite/menu-button.png", - "images/themes/infinite/menu-button-pressed.png", - "images/level/arrow-up.png", - "images/level/arrow-down-stroke.png", - "images/level/flag.png", - "images/achievement/rewards/autopilot.png", - "images/achievement/rewards/missiles.png", - "images/achievement/rewards/slowmo.png", - ], - mainMenuAudio: [ - "audio/menu/accept.wav", - "audio/menu/error.wav", - "audio/menu/send.wav", - "audio/menu/party-invite.wav", - ], - getThemeSpine: (e) => { - const t = [ - Ks.levelComplete, - Ks.doubleJump, - Ks.doubleJumpOnPlayer, - Ks.spring, - Ks.portal, - Ks.pixelPortal, - Ks.skateboard, - Ks.speedChange, - Ks.arrow, - Ks.blockSwitchButton, - Ks.sizeButton, - Ks.world4BossMinion, - Ks.world4BossFireBall, - Ks.flyingFlag, - ]; - switch (e.id) { - case "world2": - case "world2Red": - return t; - default: - return [ - ...t, - Ks.checkpointBasic, - Ks.checkpointEnd, - Ks.checkpointHit, - Ks.directionChange, - Ks.directionChangeHit, - ]; - } - }, - spineFiles: Ks, - onlineSpine: [Ks.countdownStart, Ks.countdownResume], - onlineImages: [ - "images/online/name-arrow.png", - "images/online/highlight-player.png", - "images/online/eye-icon.png", - ], - onlineSfx: [ - "audio/online/countdown-123.wav", - "audio/online/countdown-go.wav", - "audio/online/countdown-start.wav", - "audio/online/game-over.wav", - "audio/online/round-finish.wav", - "audio/online/timer-tick.wav", - "audio/online/win.wav", - "audio/online/xp.wav", - ], - }, - Zs = makeSprite({ - init: ({ props: e }) => ({ wasAlreadyHit: e.wasHit || false }), - render({ props: e, state: t, getContext: a }) { - const i = (e) => ("right" === e.direction ? -1 : 1); - return [ - conditional( - () => "world2" === e.theme, - () => [ - conditional( - () => true === e.wasHit, - () => { - var a; - return [ - triggerableSpriteSheet.Single( - { - id: "Hit", - fileName: - "images/themes/world2/direction-change-hit.png", - columns: 5, - rows: 2, - maxIndex: 9, - frameRate: 3, - width: e.directionChange.width, - height: e.directionChange.height, - startFrame: t.wasAlreadyHit ? 9 : 0, - df: null !== (a = e.df) && void 0 !== a ? a : 1, - }, - (t) => { - var a; - ((t.x = e.directionChange.x), - (t.y = getBlockFallY( - e.directionChange.x, - e.directionChange.y, - e.inGame && e.inGame.playerX, - e.inGame && e.inGame.fallTypes, - e.inGame && e.inGame.playerDir, - )), - (t.scaleX = i(e.directionChange)), - (t.width = e.directionChange.width), - (t.height = e.directionChange.height), - (t.df = - null !== (a = e.df) && void 0 !== a ? a : 1)); - }, - ), - ]; - }, - () => [ - y( + onlineSfx: [ + "audio/online/countdown-123.wav", + "audio/online/countdown-go.wav", + "audio/online/countdown-start.wav", + "audio/online/game-over.wav", + "audio/online/round-finish.wav", + "audio/online/timer-tick.wav", + "audio/online/win.wav", + "audio/online/xp.wav", + ], + }, + Zs = makeSprite({ + init: ({ props: e }) => ({ wasAlreadyHit: e.wasHit || false }), + render({ props: e, state: t, getContext: a }) { + const i = (e) => ("right" === e.direction ? -1 : 1); + return [ + conditional( + () => "world2" === e.theme, + () => [ + conditional( + () => true === e.wasHit, + () => { + var a; + return [ + triggerableSpriteSheet.Single( { + id: "Hit", fileName: - "images/themes/world2/direction-change.png", - width: e.directionChange.width, - height: e.directionChange.height, - }, - (t) => { - ((t.x = e.directionChange.x), - (t.y = getBlockFallY( - e.directionChange.x, - e.directionChange.y, - e.inGame && e.inGame.playerX, - e.inGame && e.inGame.fallTypes, - e.inGame && e.inGame.playerDir, - )), - (t.scaleX = i(e.directionChange))); - }, - ), - ], - ), - ], - () => [ - conditional( - () => - (void 0 !== e.isEditor && !e.spineContext) || bgOnly, - () => [ - y( - { - fileName: bgOnly - ? "images/themes/blank/block.png" - : "images/editor/editorOnly/direction-change.png", + "images/themes/world2/direction-change-hit.png", + columns: 5, + rows: 2, + maxIndex: 9, + frameRate: 3, width: e.directionChange.width, height: e.directionChange.height, + startFrame: t.wasAlreadyHit ? 9 : 0, + df: null !== (a = e.df) && void 0 !== a ? a : 1, }, (t) => { + var a; ((t.x = e.directionChange.x), (t.y = getBlockFallY( e.directionChange.x, @@ -31326,186 +31245,240 @@ var version = "v1.17.2"; e.inGame && e.inGame.fallTypes, e.inGame && e.inGame.playerDir, )), - (t.scaleX = i(e.directionChange))); + (t.scaleX = i(e.directionChange)), + (t.width = e.directionChange.width), + (t.height = e.directionChange.height), + (t.df = + null !== (a = e.df) && void 0 !== a ? a : 1)); }, ), - ], - () => { - let n = i(e.directionChange), - { animationAssets: s, animationRenderer: o } = - e.spineContext || a(Ws); - return [ - conditional( - () => true === e.wasHit, - () => { - var a; - return [ - Hs( - { - id: "DirectionChangeHit", - animationAssets: s, - animationRenderer: o, - fileNames: Qs.spineFiles.directionChangeHit, - animationName: "animation", - loop: false, - paused: e.paused || false, - height: 0, - x: e.directionChange.x + 22 * n, - y: getBlockFallY( + ]; + }, + () => [ + y( + { + fileName: + "images/themes/world2/direction-change.png", + width: e.directionChange.width, + height: e.directionChange.height, + }, + (t) => { + ((t.x = e.directionChange.x), + (t.y = getBlockFallY( + e.directionChange.x, + e.directionChange.y, + e.inGame && e.inGame.playerX, + e.inGame && e.inGame.fallTypes, + e.inGame && e.inGame.playerDir, + )), + (t.scaleX = i(e.directionChange))); + }, + ), + ], + ), + ], + () => [ + conditional( + () => + (void 0 !== e.isEditor && !e.spineContext) || bgOnly, + () => [ + y( + { + fileName: bgOnly + ? "images/themes/blank/block.png" + : "images/editor/editorOnly/direction-change.png", + width: e.directionChange.width, + height: e.directionChange.height, + }, + (t) => { + ((t.x = e.directionChange.x), + (t.y = getBlockFallY( + e.directionChange.x, + e.directionChange.y, + e.inGame && e.inGame.playerX, + e.inGame && e.inGame.fallTypes, + e.inGame && e.inGame.playerDir, + )), + (t.scaleX = i(e.directionChange))); + }, + ), + ], + () => { + let n = i(e.directionChange), + { animationAssets: s, animationRenderer: o } = + e.spineContext || a(Ws); + return [ + conditional( + () => true === e.wasHit, + () => { + var a; + return [ + Hs( + { + id: "DirectionChangeHit", + animationAssets: s, + animationRenderer: o, + fileNames: Qs.spineFiles.directionChangeHit, + animationName: "animation", + loop: false, + paused: e.paused || false, + height: 0, + x: e.directionChange.x + 22 * n, + y: getBlockFallY( + e.directionChange.x, + e.directionChange.y, + e.inGame && e.inGame.playerX, + e.inGame && e.inGame.fallTypes, + e.inGame && e.inGame.playerDir, + ), + scale: { x: n, y: 1 }, + startFromFrame: t.wasAlreadyHit ? 400 : 0, + df: + null !== (a = e.df) && void 0 !== a + ? a + : 1, + }, + (t) => { + var a; + ((t.paused = e.paused || false), + (t.x = e.directionChange.x + 22 * n), + (t.y = getBlockFallY( e.directionChange.x, e.directionChange.y, e.inGame && e.inGame.playerX, e.inGame && e.inGame.fallTypes, e.inGame && e.inGame.playerDir, - ), - scale: { x: n, y: 1 }, - startFromFrame: t.wasAlreadyHit ? 400 : 0, - df: + )), + (t.df = null !== (a = e.df) && void 0 !== a ? a - : 1, - }, - (t) => { - var a; - ((t.paused = e.paused || false), - (t.x = e.directionChange.x + 22 * n), - (t.y = getBlockFallY( - e.directionChange.x, - e.directionChange.y, - e.inGame && e.inGame.playerX, - e.inGame && e.inGame.fallTypes, - e.inGame && e.inGame.playerDir, - )), - (t.df = - null !== (a = e.df) && void 0 !== a - ? a - : 1)); - }, - ), - ]; - }, - () => { - var t; - return [ - Hs( - { - id: "DirectionChange", - animationAssets: s, - animationRenderer: o, - fileNames: Qs.spineFiles.directionChange, - animationName: "animation", - loop: true, - paused: e.paused || false, - height: 0, - x: e.directionChange.x + 22 * n, - y: getBlockFallY( + : 1)); + }, + ), + ]; + }, + () => { + var t; + return [ + Hs( + { + id: "DirectionChange", + animationAssets: s, + animationRenderer: o, + fileNames: Qs.spineFiles.directionChange, + animationName: "animation", + loop: true, + paused: e.paused || false, + height: 0, + x: e.directionChange.x + 22 * n, + y: getBlockFallY( + e.directionChange.x, + e.directionChange.y, + e.inGame && e.inGame.playerX, + e.inGame && e.inGame.fallTypes, + e.inGame && e.inGame.playerDir, + ), + scale: { x: n, y: 1 }, + df: + null !== (t = e.df) && void 0 !== t + ? t + : 1, + }, + (t) => { + var a; + n = i(e.directionChange); + ((t.scale = { + x: n * (e.scale || 1), + y: e.scale || 1, + }), + (t.paused = e.paused || false), + (t.x = e.directionChange.x + 22 * n), + (t.y = getBlockFallY( e.directionChange.x, e.directionChange.y, e.inGame && e.inGame.playerX, e.inGame && e.inGame.fallTypes, e.inGame && e.inGame.playerDir, - ), - scale: { x: n, y: 1 }, - df: - null !== (t = e.df) && void 0 !== t - ? t - : 1, - }, - (t) => { - var a; - n = i(e.directionChange); - ((t.scale = { - x: n * (e.scale || 1), - y: e.scale || 1, - }), - (t.paused = e.paused || false), - (t.x = e.directionChange.x + 22 * n), - (t.y = getBlockFallY( - e.directionChange.x, - e.directionChange.y, - e.inGame && e.inGame.playerX, - e.inGame && e.inGame.fallTypes, - e.inGame && e.inGame.playerDir, - )), - (t.df = - null !== (a = e.df) && void 0 !== a - ? a - : 1)); - }, - ), - ]; - }, - ), - ]; - }, - ), - ], - ), - ]; - }, - }), - eo = makeSprite({ - render: ({ props: e }) => { - const sawRatio = e.bigTheme == "world3" ? 37 / 30 : 1, - sawSpeed = e.bigTheme == "world3" ? 2 : 1; - return [ - onChange( - () => e.theme, - () => { - const t = "world2" === e.theme ? 20 / 3 : 3, - a = "world2" === e.theme ? 90 : 93; - return [ - conditional( - () => e.theme.includes("infinite"), - () => [ - f({ - props: () => ({ - thickness: 4, - color: 'red', - opacity: 1, - lineCap: "round", - path: [ - [0, 45], - [0, 0], - [0, -45], - ], - }), - update: (a, n, index) => { - ((a.x = n.x), - (a.y = n.midY), - (a.show = + )), + (t.df = + null !== (a = e.df) && void 0 !== a + ? a + : 1)); + }, + ), + ]; + }, + ), + ]; + }, + ), + ], + ), + ]; + }, + }), + eo = makeSprite({ + render: ({ props: e }) => { + const sawRatio = e.bigTheme == "world3" ? 37 / 30 : 1, + sawSpeed = e.bigTheme == "world3" ? 2 : 1; + return [ + onChange( + () => e.theme, + () => { + const t = "world2" === e.theme ? 20 / 3 : 3, + a = "world2" === e.theme ? 90 : 93; + return [ + conditional( + () => e.theme.includes("infinite"), + () => [ + f({ + props: () => ({ + thickness: 4, + color: 'red', + opacity: 1, + lineCap: "round", + path: [ + [0, 45], + [0, 0], + [0, -45], + ], + }), + update: (a, n, index) => { + ((a.x = n.x), + (a.y = n.midY), + (a.show = "upDown" === n.movement || "downUp" === n.movement), (a.color = e.bgColor || "9b2e4b")); - }, - array: () => e.saws, - }) - ], - () => [ - imageArray({ - fileName: `images/themes/${e.theme.split("/")[0]}/saw-rail.png`, - props: () => ({ width: t, height: a }), - update: (n, t) => { - ((n.x = t.x), - (n.y = getBlockFallY( - t.x, - t.midY, - e.inGame && e.inGame.playerX, - e.inGame && e.inGame.fallTypes, - e.inGame && e.inGame.playerDir, - ))); - n.show = - "upDown" === t.movement || "downUp" === t.movement; - }, - array: () => e.saws, - }), - ] - ), - ]; - }, - ), - conditional( - () => void 0 !== e.inGame, - () => [onChange( + }, + array: () => e.saws, + }) + ], + () => [ + imageArray({ + fileName: `images/themes/${e.theme.split("/")[0]}/saw-rail.png`, + props: () => ({ width: t, height: a }), + update: (n, t) => { + ((n.x = t.x), + (n.y = getBlockFallY( + t.x, + t.midY, + e.inGame && e.inGame.playerX, + e.inGame && e.inGame.fallTypes, + e.inGame && e.inGame.playerDir, + ))); + n.show = + "upDown" === t.movement || "downUp" === t.movement; + }, + array: () => e.saws, + }), + ] + ), + ]; + }, + ), + conditional( + () => void 0 !== e.inGame, + () => [onChange( () => e.theme, () => [ imageArray({ fileName: `images/themes/${e.theme}/saw.png`, @@ -31747,29 +31720,29 @@ var version = "v1.17.2"; getSprite: (destroyed, pos) => destroyed ? to.Single( - { - justDestroyed: true, - paused: e.inGame.paused, - df: e.inGame.df, - x: pos.x, - y: pos.y, - theme: e.theme, - }, - (t) => { - ((t.paused = e.inGame.paused), - (t.df = e.inGame.df)); - }, - ) + { + justDestroyed: true, + paused: e.inGame.paused, + df: e.inGame.df, + x: pos.x, + y: pos.y, + theme: e.theme, + }, + (t) => { + ((t.paused = e.inGame.paused), + (t.df = e.inGame.df)); + }, + ) : y( - { - fileName: `images/themes/${e.theme}/saw.png`, - width: t.width, - height: t.height, - }, - (a) => { - ((a.x = pos.x), (a.y = pos.y)); - }, - ), + { + fileName: `images/themes/${e.theme}/saw.png`, + width: t.width, + height: t.height, + }, + (a) => { + ((a.x = pos.x), (a.y = pos.y)); + }, + ), justDestroyed: !!i.destroyed && $a(i.destroyed.frame, e.inGame.frame), @@ -31782,7 +31755,7 @@ var version = "v1.17.2"; return ( "missile" === (null === (i = e.inGame.sawStates[a].destroyed) || - void 0 === i + void 0 === i ? void 0 : i.by) ); @@ -31802,1315 +31775,1369 @@ var version = "v1.17.2"; ))); }, })]) - ], - () => [ - onChange( - () => e.theme, - () => [ - imageArray({ - fileName: `images/themes/${e.theme}/saw.png`, - props: () => ({}), - update: (e, t) => { - ((e.width = t.width), - (e.height = t.height), - (e.x = t.x), - (e.y = t.midY - $.sawMove / 2), - (e.opacity = - "downUp" === t.movement - ? 0.3 - : "upDown" === t.movement + ], + () => [ + onChange( + () => e.theme, + () => [ + imageArray({ + fileName: `images/themes/${e.theme}/saw.png`, + props: () => ({}), + update: (e, t) => { + ((e.width = t.width), + (e.height = t.height), + (e.x = t.x), + (e.y = t.midY - $.sawMove / 2), + (e.opacity = + "downUp" === t.movement + ? 0.3 + : "upDown" === t.movement + ? 1 + : 0)); + }, + array: () => e.saws, + testId: (e, t) => `Saw-${t}`, + }), + imageArray({ + fileName: `images/themes/${e.theme}/saw.png`, + props: () => ({}), + update: (e, t) => { + ((e.width = t.width), + (e.height = t.height), + (e.x = t.x), + (e.y = t.midY + $.sawMove / 2), + (e.opacity = + "upDown" === t.movement + ? 0.3 + : "downUp" === t.movement + ? 1 + : 0)); + }, + array: () => e.saws, + }), + imageArray({ + fileName: `images/themes/${e.theme}/saw.png`, + props: () => ({}), + update: (e, t) => { + ((e.width = t.width), + (e.height = t.height), + (e.x = t.x), + (e.y = t.midY), + (e.opacity = + "downUp" === t.movement + ? 0 + : "upDown" === t.movement + ? 0 + : t.shape == "rail" ? 1 : 0)); - }, - array: () => e.saws, - testId: (e, t) => `Saw-${t}`, - }), - imageArray({ - fileName: `images/themes/${e.theme}/saw.png`, - props: () => ({}), - update: (e, t) => { - ((e.width = t.width), - (e.height = t.height), - (e.x = t.x), - (e.y = t.midY + $.sawMove / 2), - (e.opacity = - "upDown" === t.movement - ? 0.3 - : "downUp" === t.movement + }, + array: () => e.saws, + testId: (e, t) => `Saw-${t}`, + }), + imageArray({ + fileName: `images/themes/${e.bigTheme == "classic" ? "classic" : e.bigTheme.includes("infinite") ? e.bigTheme : e.bigTheme == "world3" ? "world3" : "world1"}/saw-medium.png`, + props: () => ({}), + update: (e, t) => { + ((e.width = t.width * sawRatio), + (e.height = t.height * sawRatio), + (e.x = t.x), + (e.y = t.midY), + (e.opacity = + "downUp" === t.movement + ? 0 + : "upDown" === t.movement + ? 0 + : t.shape == "small" ? 1 : 0)); - }, - array: () => e.saws, - }), - imageArray({ - fileName: `images/themes/${e.theme}/saw.png`, - props: () => ({}), - update: (e, t) => { - ((e.width = t.width), - (e.height = t.height), - (e.x = t.x), - (e.y = t.midY), - (e.opacity = - "downUp" === t.movement - ? 0 - : "upDown" === t.movement - ? 0 - : t.shape == "rail" - ? 1 - : 0)); - }, - array: () => e.saws, - testId: (e, t) => `Saw-${t}`, - }), - imageArray({ - fileName: `images/themes/${e.bigTheme == "classic" ? "classic" : e.bigTheme.includes("infinite") ? e.bigTheme : e.bigTheme == "world3" ? "world3" : "world1"}/saw-medium.png`, - props: () => ({}), - update: (e, t) => { - ((e.width = t.width * sawRatio), - (e.height = t.height * sawRatio), - (e.x = t.x), - (e.y = t.midY), - (e.opacity = - "downUp" === t.movement - ? 0 - : "upDown" === t.movement - ? 0 - : t.shape == "small" - ? 1 - : 0)); - }, - array: () => e.saws, - testId: (e, t) => `Saw-${t}`, - }), - imageArray({ - fileName: `images/themes/${e.bigTheme == "classic" ? "classic" : e.bigTheme.includes("infinite") ? e.bigTheme : e.bigTheme == "world3" ? "world3" : "world1"}/saw-big.png`, - props: () => ({}), - update: (e, t) => { - ((e.width = t.width * sawRatio), - (e.height = t.height * sawRatio), - (e.x = t.x), - (e.y = t.midY), - (e.opacity = - "downUp" === t.movement + }, + array: () => e.saws, + testId: (e, t) => `Saw-${t}`, + }), + imageArray({ + fileName: `images/themes/${e.bigTheme == "classic" ? "classic" : e.bigTheme.includes("infinite") ? e.bigTheme : e.bigTheme == "world3" ? "world3" : "world1"}/saw-big.png`, + props: () => ({}), + update: (e, t) => { + ((e.width = t.width * sawRatio), + (e.height = t.height * sawRatio), + (e.x = t.x), + (e.y = t.midY), + (e.opacity = + "downUp" === t.movement + ? 0 + : "upDown" === t.movement ? 0 - : "upDown" === t.movement - ? 0 - : t.shape == "large" - ? 1 - : 0)); - }, - array: () => e.saws, - testId: (e, t) => `Saw-${t}`, - }), - imageArray({ - fileName: `images/themes/${e.theme == "classic" ? "classic" : e.theme.includes("infinite") ? e.theme : "infinite"}/saw-bar.png`, - props: () => ({}), - update: (e, t) => { - ((e.width = t.height), - (e.height = t.width), - (e.x = t.x), - (e.y = t.y), - (e.rotation = t.offset - 90), - (e.opacity = - "downUp" === t.movement + : t.shape == "large" + ? 1 + : 0)); + }, + array: () => e.saws, + testId: (e, t) => `Saw-${t}`, + }), + imageArray({ + fileName: `images/themes/${e.theme == "classic" ? "classic" : e.theme.includes("infinite") ? e.theme : "infinite"}/saw-bar.png`, + props: () => ({}), + update: (e, t) => { + ((e.width = t.height), + (e.height = t.width), + (e.x = t.x), + (e.y = t.y), + (e.rotation = t.offset - 90), + (e.opacity = + "downUp" === t.movement + ? 0 + : "upDown" === t.movement ? 0 - : "upDown" === t.movement - ? 0 - : t.shape == "bar" - ? 1 - : 0)); - }, - array: () => e.saws, - testId: (e, t) => `Saw-${t}`, - }), - ifConditional( - () => { - var t; - return ( - void 0 !== - (null === (t = e.editor) || void 0 === t - ? void 0 - : t.previewYs) && - void 0 !== - (null === (t = e.editor) || void 0 === t - ? void 0 - : t.previewRots) - ); - }, - () => [ - circleArray({ - props: () => ({ - radius: 15, - color: "red", - opacity: 0.5, - }), - update: (t, a, i) => { - ((t.x = e.saws[i].x), - (t.y = a), - (t.radius = e.saws[i].width / 2), - (t.opacity = - e.saws[i].shape == "bar" ? 0 : 0.5)); - }, - array: () => e.editor.previewYs, + : t.shape == "bar" + ? 1 + : 0)); + }, + array: () => e.saws, + testId: (e, t) => `Saw-${t}`, + }), + ifConditional( + () => { + var t; + return ( + void 0 !== + (null === (t = e.editor) || void 0 === t + ? void 0 + : t.previewYs) && + void 0 !== + (null === (t = e.editor) || void 0 === t + ? void 0 + : t.previewRots) + ); + }, + () => [ + circleArray({ + props: () => ({ + radius: 15, + color: "red", + opacity: 0.5, }), - g({ - props: () => ({ - color: "red", - opacity: 0.5, - }), - update: (t, a, i) => { - ((t.x = e.saws[i].x), - (t.y = e.saws[i].y), - (t.width = e.saws[i].width), - (t.height = e.saws[i].height), - (t.rotation = a), - (t.opacity = - e.saws[i].shape == "bar" ? 0.5 : 0)); - }, - array: () => e.editor.previewRots, + update: (t, a, i) => { + ((t.x = e.saws[i].x), + (t.y = a), + (t.radius = e.saws[i].width / 2), + (t.opacity = + e.saws[i].shape == "bar" ? 0 : 0.5)); + }, + array: () => e.editor.previewYs, + }), + g({ + props: () => ({ + color: "red", + opacity: 0.5, }), - ], - ), - ], - ), - ], - ), - ]; - }, - }), - to = makeSprite({ - init({ props: e, device: t, getContext: a }) { - if (e.justDestroyed) { - const { settings: e } = a(Se); - Ga("audio/levels/object-explosion.wav", t, e, 0); - } - return { show: e.justDestroyed }; - }, - render: ({ state: e, props: t }) => [ - ifConditional( - () => e.show, - () => [ - triggerableSpriteSheet.Single( - { - fileName: `images/themes/${t.theme == "world1" ? "world1" : t.theme == "classic" ? "classic" : "world2"}/spike-explosion.png`, - columns: 3, - rows: 2, - frameRate: 3, - width: 80, - height: 80, - paused: t.paused, - df: t.df, - onEnd: () => { - e.show = false; - }, - }, - (e) => { - ((e.paused = t.paused), (e.df = t.df)); - }, + update: (t, a, i) => { + ((t.x = e.saws[i].x), + (t.y = e.saws[i].y), + (t.width = e.saws[i].width), + (t.height = e.saws[i].height), + (t.rotation = a), + (t.opacity = + e.saws[i].shape == "bar" ? 0.5 : 0)); + }, + array: () => e.editor.previewRots, + }), + ], + ), + ], ), ], ), - ], - }), - ao = makeSprite({ - init({ props: e }) { - var t; - return { - wasAlreadyHit: + ]; + }, + }), + to = makeSprite({ + init({ props: e, device: t, getContext: a }) { + if (e.justDestroyed) { + const { settings: e } = a(Se); + Ga("audio/levels/object-explosion.wav", t, e, 0); + } + return { show: e.justDestroyed }; + }, + render: ({ state: e, props: t }) => [ + ifConditional( + () => e.show, + () => [ + triggerableSpriteSheet.Single( + { + fileName: `images/themes/${t.theme == "world1" ? "world1" : t.theme == "classic" ? "classic" : "world2"}/spike-explosion.png`, + columns: 3, + rows: 2, + frameRate: 3, + width: 80, + height: 80, + paused: t.paused, + df: t.df, + onEnd: () => { + e.show = false; + }, + }, + (e) => { + ((e.paused = t.paused), (e.df = t.df)); + }, + ), + ], + ), + ], + }), + ao = makeSprite({ + init({ props: e }) { + var t; + return { + wasAlreadyHit: + (null === (t = e.inGame) || void 0 === t + ? void 0 + : t.wasHit) || false, + }; + }, + render: ({ props: e, getContext: t, state: a }) => [ + conditional( + () => { + var t; + return ( + true === (null === (t = e.inGame) || void 0 === t ? void 0 - : t.wasHit) || false, - }; - }, - render: ({ props: e, getContext: t, state: a }) => [ - conditional( - () => { - var t; - return ( - true === - (null === (t = e.inGame) || void 0 === t - ? void 0 - : t.isFlying) || e.flag.isFlying - ); - }, - () => { - const { animationAssets: i, animationRenderer: n } = - e.spineContext || t(Ws); - return [ - conditional( - () => (e.inGame ? !e.inGame.wasHit : true), - () => [ - Hs( - { - id: "FlagIdle", - animationAssets: i, - animationRenderer: n, - fileNames: Qs.spineFiles.flyingFlag, - animationName: "idle", - loop: true, - paused: (e.inGame && e.inGame.paused) || e.paused, - x: e.flag.x, - y: + : t.isFlying) || e.flag.isFlying + ); + }, + () => { + const { animationAssets: i, animationRenderer: n } = + e.spineContext || t(Ws); + return [ + conditional( + () => (e.inGame ? !e.inGame.wasHit : true), + () => [ + Hs( + { + id: "FlagIdle", + animationAssets: i, + animationRenderer: n, + fileNames: Qs.spineFiles.flyingFlag, + animationName: "idle", + loop: true, + paused: (e.inGame && e.inGame.paused) || e.paused, + x: e.flag.x, + y: + getBlockFallY( + e.flag.x, + e.flag.y, + e.inGame && e.inGame.playerX, + e.inGame && e.inGame.fallTypes, + e.inGame && e.inGame.playerDir, + ) - 1.5, + height: 0, + df: !e.inGame ? 1 : e.inGame.df, + }, + (t) => { + ((t.paused = + (e.inGame && e.inGame.paused) || e.paused), + (t.x = e.flag.x), + (t.y = getBlockFallY( e.flag.x, e.flag.y, e.inGame && e.inGame.playerX, e.inGame && e.inGame.fallTypes, e.inGame && e.inGame.playerDir, - ) - 1.5, - height: 0, - df: !e.inGame ? 1 : e.inGame.df, - }, - (t) => { - ((t.paused = - (e.inGame && e.inGame.paused) || e.paused), - (t.x = e.flag.x), - (t.y = - getBlockFallY( - e.flag.x, - e.flag.y, - e.inGame && e.inGame.playerX, - e.inGame && e.inGame.fallTypes, - e.inGame && e.inGame.playerDir, - ) - 1.5), - (t.df = !e.inGame ? 1 : e.inGame.df), - (t.scale = { - x: e.scale || 1, - y: e.scale || 1, - })); - }, - ), - ], - () => [ - Hs( - { - id: "FlagHit", - animationAssets: i, - animationRenderer: n, - fileNames: Qs.spineFiles.flyingFlag, - animationName: "finish", - loop: false, - startFromFrame: a.wasAlreadyHit ? 200 : 0, - paused: e.inGame.paused, - x: e.flag.x, - y: + ) - 1.5), + (t.df = !e.inGame ? 1 : e.inGame.df), + (t.scale = { + x: e.scale || 1, + y: e.scale || 1, + })); + }, + ), + ], + () => [ + Hs( + { + id: "FlagHit", + animationAssets: i, + animationRenderer: n, + fileNames: Qs.spineFiles.flyingFlag, + animationName: "finish", + loop: false, + startFromFrame: a.wasAlreadyHit ? 200 : 0, + paused: e.inGame.paused, + x: e.flag.x, + y: + getBlockFallY( + e.flag.x, + e.flag.y, + e.inGame && e.inGame.playerX, + e.inGame && e.inGame.fallTypes, + e.inGame && e.inGame.playerDir, + ) - 1.5, + height: 0, + df: e.inGame.df, + }, + (t) => { + ((t.paused = e.inGame.paused), + (t.x = e.flag.x), + (t.y = getBlockFallY( e.flag.x, e.flag.y, e.inGame && e.inGame.playerX, e.inGame && e.inGame.fallTypes, e.inGame && e.inGame.playerDir, - ) - 1.5, - height: 0, - df: e.inGame.df, - }, - (t) => { - ((t.paused = e.inGame.paused), - (t.x = e.flag.x), - (t.y = - getBlockFallY( - e.flag.x, - e.flag.y, - e.inGame && e.inGame.playerX, - e.inGame && e.inGame.fallTypes, - e.inGame && e.inGame.playerDir, - ) - 1.5), - (t.df = e.inGame.df)); + ) - 1.5), + (t.df = e.inGame.df)); + }, + ), + ], + ), + ]; + }, + () => [ + conditional( + () => "world1" === e.theme, + () => [ + conditional( + () => void 0 === e.inGame && !e.spineContext, + () => [ + onChange( + () => e.flag.role, + () => { + const t = + "endOfLevel" === e.flag.role ? "End" : ""; + return [ + y( + { + fileName: `images/themes/world1/flag${t}.png`, + width: e.flag.width, + height: e.flag.height, + }, + (t) => { + ((t.x = e.flag.x), (t.y = e.flag.y)); + }, + ), + ]; }, ), ], - ), - ]; - }, - () => [ - conditional( - () => "world1" === e.theme, - () => [ - conditional( - () => void 0 === e.inGame && !e.spineContext, - () => [ - onChange( - () => e.flag.role, - () => { - const t = - "endOfLevel" === e.flag.role ? "End" : ""; - return [ - y( - { - fileName: `images/themes/world1/flag${t}.png`, - width: e.flag.width, - height: e.flag.height, - }, - (t) => { - ((t.x = e.flag.x), (t.y = e.flag.y)); - }, - ), - ]; - }, - ), - ], - () => { - const { animationAssets: i, animationRenderer: n } = - e.spineContext || t(Ws); - return [ - conditional( - () => "endOfLevel" === e.flag.role, - () => [ - Hs( - { - id: "FlagEnd", - animationAssets: i, - animationRenderer: n, - animationName: "animation", - fileNames: Qs.spineFiles.checkpointEnd, - loop: true, - paused: - e.paused || (e.inGame && e.inGame.paused), - x: e.flag.x, - y: getBlockFallY( + () => { + const { animationAssets: i, animationRenderer: n } = + e.spineContext || t(Ws); + return [ + conditional( + () => "endOfLevel" === e.flag.role, + () => [ + Hs( + { + id: "FlagEnd", + animationAssets: i, + animationRenderer: n, + animationName: "animation", + fileNames: Qs.spineFiles.checkpointEnd, + loop: true, + paused: + e.paused || (e.inGame && e.inGame.paused), + x: e.flag.x, + y: getBlockFallY( + e.flag.x, + e.flag.y, + e.inGame && e.inGame.playerX, + e.inGame && e.inGame.fallTypes, + e.inGame && e.inGame.playerDir, + ), + height: e.flag.height, + df: e.inGame ? e.inGame.df || 1 : 1, + }, + (t) => { + ((t.scale = { + x: e.scale || 1, + y: e.scale || 1, + }), + (t.paused = + e.paused || + (e.inGame && e.inGame.paused)), + (t.x = e.flag.x), + (t.y = getBlockFallY( e.flag.x, e.flag.y, e.inGame && e.inGame.playerX, e.inGame && e.inGame.fallTypes, e.inGame && e.inGame.playerDir, - ), - height: e.flag.height, - df: e.inGame ? e.inGame.df || 1 : 1, - }, - (t) => { - ((t.scale = { - x: e.scale || 1, - y: e.scale || 1, - }), - (t.paused = + )), + (t.df = e.inGame ? e.inGame.df || 1 : 1)); + }, + ), + ], + () => [ + conditional( + () => { + var t; + return ( + true === + (null === (t = e.inGame) || void 0 === t + ? void 0 + : t.wasHit) + ); + }, + () => [ + Hs( + { + id: "FlagHit", + animationAssets: i, + animationRenderer: n, + animationName: "animation", + fileNames: Qs.spineFiles.checkpointHit, + loop: false, + startFromFrame: a.wasAlreadyHit + ? 200 + : 0, + paused: e.paused || - (e.inGame && e.inGame.paused)), - (t.x = e.flag.x), - (t.y = getBlockFallY( + (e.inGame && e.inGame.paused), + x: e.flag.x, + y: getBlockFallY( e.flag.x, e.flag.y, e.inGame && e.inGame.playerX, e.inGame && e.inGame.fallTypes, e.inGame && e.inGame.playerDir, - )), - (t.df = e.inGame ? e.inGame.df || 1 : 1)); - }, - ), - ], - () => [ - conditional( - () => { - var t; - return ( - true === - (null === (t = e.inGame) || void 0 === t - ? void 0 - : t.wasHit) - ); - }, - () => [ - Hs( - { - id: "FlagHit", - animationAssets: i, - animationRenderer: n, - animationName: "animation", - fileNames: Qs.spineFiles.checkpointHit, - loop: false, - startFromFrame: a.wasAlreadyHit - ? 200 - : 0, - paused: - e.paused || - (e.inGame && e.inGame.paused), - x: e.flag.x, - y: getBlockFallY( + ), + height: e.flag.height, + df: e.inGame ? e.inGame.df : 1, + }, + (t) => { + ((t.paused = + e.paused || + (e.inGame && e.inGame.paused)), + (t.x = e.flag.x), + (t.y = getBlockFallY( e.flag.x, e.flag.y, e.inGame && e.inGame.playerX, e.inGame && e.inGame.fallTypes, e.inGame && e.inGame.playerDir, - ), - height: e.flag.height, - df: e.inGame ? e.inGame.df : 1, - }, - (t) => { - ((t.paused = + )), + (t.df = e.inGame ? e.inGame.df : 1)); + }, + ), + ], + () => [ + Hs( + { + id: "FlagBasic", + animationAssets: i, + animationRenderer: n, + animationName: "animation", + fileNames: + Qs.spineFiles.checkpointBasic, + loop: true, + paused: + e.paused || + (e.inGame && e.inGame.paused), + x: e.flag.x, + y: getBlockFallY( + e.flag.x, + e.flag.y, + e.inGame && e.inGame.playerX, + e.inGame && e.inGame.fallTypes, + e.inGame && e.inGame.playerDir, + ), + height: e.flag.height, + df: e.inGame ? e.inGame.df : 1, + startFromFrame: e.spineContext ? 80 : 0, + }, + (t) => { + ((t.scale = { + x: e.scale || 1, + y: e.scale || 1, + }), + (t.paused = e.paused || (e.inGame && e.inGame.paused)), - (t.x = e.flag.x), - (t.y = getBlockFallY( - e.flag.x, - e.flag.y, - e.inGame && e.inGame.playerX, - e.inGame && e.inGame.fallTypes, - e.inGame && e.inGame.playerDir, - )), - (t.df = e.inGame ? e.inGame.df : 1)); - }, - ), - ], - () => [ - Hs( - { - id: "FlagBasic", - animationAssets: i, - animationRenderer: n, - animationName: "animation", - fileNames: - Qs.spineFiles.checkpointBasic, - loop: true, - paused: - e.paused || - (e.inGame && e.inGame.paused), - x: e.flag.x, - y: getBlockFallY( + (t.x = e.flag.x), + (t.y = getBlockFallY( e.flag.x, e.flag.y, e.inGame && e.inGame.playerX, e.inGame && e.inGame.fallTypes, e.inGame && e.inGame.playerDir, - ), - height: e.flag.height, - df: e.inGame ? e.inGame.df : 1, - startFromFrame: e.spineContext ? 80 : 0, - }, - (t) => { - ((t.scale = { - x: e.scale || 1, - y: e.scale || 1, - }), - (t.paused = - e.paused || - (e.inGame && e.inGame.paused)), - (t.x = e.flag.x), - (t.y = getBlockFallY( - e.flag.x, - e.flag.y, - e.inGame && e.inGame.playerX, - e.inGame && e.inGame.fallTypes, - e.inGame && e.inGame.playerDir, - )), - (t.df = e.inGame ? e.inGame.df : 1)); - }, - ), - ], - ), - ], - ), - ]; - }, - ), - ], - () => [ - conditional( - () => "endOfLevel" === e.flag.role, - () => { - var t; - return [ - loopingSpriteSheet.Single( - { - fileName: "images/themes/world2/flag/end.png", - columns: 4, - rows: 2, - frameRate: 6, - width: 190 / 3, - height: 280 / 3, - frame: - (null === (t = e.inGame) || void 0 === t - ? void 0 - : t.frame) || - e.frame || - 0, - }, - (t) => { - var a; - ((t.x = e.flag.x), - (t.y = getBlockFallY( - e.flag.x, - e.flag.y, - e.inGame && e.inGame.playerX, - e.inGame && e.inGame.fallTypes, - e.inGame && e.inGame.playerDir, - )), - (t.frame = - (null === (a = e.inGame) || void 0 === a - ? void 0 - : a.frame) || - e.frame || - 0)); - }, - ), - ]; - }, - () => [ - conditional( - () => { - var t; - return ( - true === + )), + (t.df = e.inGame ? e.inGame.df : 1)); + }, + ), + ], + ), + ], + ), + ]; + }, + ), + ], + () => [ + conditional( + () => "endOfLevel" === e.flag.role, + () => { + var t; + return [ + loopingSpriteSheet.Single( + { + fileName: "images/themes/world2/flag/end.png", + columns: 4, + rows: 2, + frameRate: 6, + width: 190 / 3, + height: 280 / 3, + frame: (null === (t = e.inGame) || void 0 === t ? void 0 - : t.wasHit) - ); + : t.frame) || + e.frame || + 0, }, - () => { - var t; - return [ - loopingSpriteSheet.Single( - { - fileName: - "images/themes/world2/flag/passed.png", - columns: 4, - rows: 2, - frameRate: 6, - width: 190 / 3, - height: 280 / 3, - frame: - (null === (t = e.inGame) || void 0 === t - ? void 0 - : t.frame) || - e.frame || - 0, - }, - (t) => { - var a; - ((t.x = e.flag.x), - (t.y = getBlockFallY( - e.flag.x, - e.flag.y, - e.inGame && e.inGame.playerX, - e.inGame && e.inGame.fallTypes, - e.inGame && e.inGame.playerDir, - )), - (t.frame = - (null === (a = e.inGame) || void 0 === a - ? void 0 - : a.frame) || - e.frame || - 0)); - }, - ), - triggerableSpriteSheet.Single( - { - fileName: - "images/themes/world2/flag/confetti.png", - startFrame: a.wasAlreadyHit ? 200 : 0, - hideOnEnd: true, - columns: 5, - rows: 2, - frameRate: 3, - df: e.inGame.df, - width: 157, - height: 100, - }, - (t) => { - ((t.x = e.flag.x), - (t.y = getBlockFallY( - e.flag.x, - e.flag.y, - e.inGame && e.inGame.playerX, - e.inGame && e.inGame.fallTypes, - e.inGame && e.inGame.playerDir, - )), - (t.df = e.inGame.df)); - }, - ), - ]; + (t) => { + var a; + ((t.x = e.flag.x), + (t.y = getBlockFallY( + e.flag.x, + e.flag.y, + e.inGame && e.inGame.playerX, + e.inGame && e.inGame.fallTypes, + e.inGame && e.inGame.playerDir, + )), + (t.frame = + (null === (a = e.inGame) || void 0 === a + ? void 0 + : a.frame) || + e.frame || + 0)); }, - () => { - var t; - return [ - loopingSpriteSheet.Single( - { - fileName: - "images/themes/world2/flag/idle.png", - columns: 4, - rows: 2, - frameRate: 6, - width: 190 / 3, - height: 280 / 3, - frame: - (null === (t = e.inGame) || void 0 === t + ), + ]; + }, + () => [ + conditional( + () => { + var t; + return ( + true === + (null === (t = e.inGame) || void 0 === t + ? void 0 + : t.wasHit) + ); + }, + () => { + var t; + return [ + loopingSpriteSheet.Single( + { + fileName: + "images/themes/world2/flag/passed.png", + columns: 4, + rows: 2, + frameRate: 6, + width: 190 / 3, + height: 280 / 3, + frame: + (null === (t = e.inGame) || void 0 === t + ? void 0 + : t.frame) || + e.frame || + 0, + }, + (t) => { + var a; + ((t.x = e.flag.x), + (t.y = getBlockFallY( + e.flag.x, + e.flag.y, + e.inGame && e.inGame.playerX, + e.inGame && e.inGame.fallTypes, + e.inGame && e.inGame.playerDir, + )), + (t.frame = + (null === (a = e.inGame) || void 0 === a ? void 0 - : t.frame) || + : a.frame) || e.frame || - 0, - }, - (t) => { - var a; - ((t.x = e.flag.x), - (t.y = getBlockFallY( - e.flag.x, - e.flag.y, - e.inGame && e.inGame.playerX, - e.inGame && e.inGame.fallTypes, - e.inGame && e.inGame.playerDir, - )), - (t.frame = - (null === (a = e.inGame) || void 0 === a - ? void 0 - : a.frame) || - e.frame || - 0)); - }, - ), - ]; - }, - ), - ], - ), - ], - ), - ], - ), - ], - }), - bulletSprite = makeSprite({ - render: ({ props: e }) => [ - conditional( - () => e.isEnemy, - () => [ - y( - { - fileName: `images/themes/world2/gun/bullet-enemy.png`, - width: e.bullet.width, - height: e.bullet.height, - }, - (t) => { - t.scaleX = Math.sign(e.bullet.speed); - }, - ), - ], - () => [ - triggerableSpriteSheet.Single( - { - fileName: "images/themes/world2/gun/bullet-destroy.png", - columns: 4, - rows: 1, - frameRate: 3, - width: 70, - height: 65, - df: Math.min(e.bullet.frame || 0, 1), - onEnd: () => e.removeBullet(), - }, - (t) => { - ((t.df = Math.min(e.bullet.frame || 0, 1)), - (t.scaleX = - Math.sign(e.bullet.speed) * (e.bullet.width / 70))); - t.scaleY = e.bullet.height / 35; - }, - ), - ], - ), - ], - }), - bossButtonSprite = makeSprite({ - init({ props: e }) { - return { - frame: e.button.pressed ? 5 : 0, - }; - }, - loop({ props: e, state: t }) { - t.frame += (e.df || 1) * (e.button.pressed ? 1 : -1); - if (t.frame < 0) { - t.frame = 0; - } else if (t.frame > 17) { - t.frame = 17; - } - }, - render({ props: e, state: t }) { - return [ - loopingSpriteSheet.Single( - { - fileName: "images/level/boss2/button.png", - columns: 3, - rows: 2, - frameRate: 3, - width: 90, - height: 30, - frame: t.frame, - }, - (a) => { - a.frame = t.frame; - }, - ), - ]; - }, - }), - no = makeSprite({ - render: ({ props: e }) => [ - onChange( - () => e.bullet.width, - () => [ - "laser" === e.bullet.type - ? so.Single({}) - : "missile" === e.bullet.type - ? y({ - fileName: "images/level/boss2/missile.png", - width: 50, - height: 22, - x: 8, - }) - : "bulletHell" === e.bullet.type && e.bullet.width < 5 - ? y({ - fileName: "images/level/boss2/bulletHell.png", - width: 7, - height: 7, - }) - : conditional( - () => e.bullet.destroyed, - () => [ + 0)); + }, + ), triggerableSpriteSheet.Single( { fileName: - "images/themes/world2/enemy-explosion.png", - columns: 4, + "images/themes/world2/flag/confetti.png", + startFrame: a.wasAlreadyHit ? 200 : 0, + hideOnEnd: true, + columns: 5, rows: 2, frameRate: 3, - width: 100, + df: e.inGame.df, + width: 157, height: 100, - paused: e.paused, - df: e.df, - hideOnEnd: true, }, (t) => { - ((t.paused = e.paused), (t.df = e.df)); + ((t.x = e.flag.x), + (t.y = getBlockFallY( + e.flag.x, + e.flag.y, + e.inGame && e.inGame.playerX, + e.inGame && e.inGame.fallTypes, + e.inGame && e.inGame.playerDir, + )), + (t.df = e.inGame.df)); }, ), - ], - () => [ - y( + ]; + }, + () => { + var t; + return [ + loopingSpriteSheet.Single( { - fileName: `images/level/boss2/${e.bullet.type}.png`, - width: e.bullet.width, - height: e.bullet.height, + fileName: + "images/themes/world2/flag/idle.png", + columns: 4, + rows: 2, + frameRate: 6, + width: 190 / 3, + height: 280 / 3, + frame: + (null === (t = e.inGame) || void 0 === t + ? void 0 + : t.frame) || + e.frame || + 0, }, (t) => { - ((t.width = e.bullet.width), - (t.height = e.bullet.height)); + var a; + ((t.x = e.flag.x), + (t.y = getBlockFallY( + e.flag.x, + e.flag.y, + e.inGame && e.inGame.playerX, + e.inGame && e.inGame.fallTypes, + e.inGame && e.inGame.playerDir, + )), + (t.frame = + (null === (a = e.inGame) || void 0 === a + ? void 0 + : a.frame) || + e.frame || + 0)); }, ), - ], - ), - ], - ), - ], - }), - so = makeSprite({ - render() { - const e = Array.from({ length: 6 }); - return [ - imageArray({ - fileName: "images/level/boss2/lasercharge/laserbody.png", - props: (e, t) => ({ - width: 100, - height: 100, - x: -95 - 100 * t, - }), - array: () => e, - }), - y({ - fileName: "images/level/boss2/lasercharge/laserbase.png", - width: 45, - height: 100, - x: -22.5, - }), - ]; - }, - }), - oo = (e, t, a) => ({ - x: e, - y: t, - width: 23, - height: 12, - speed: a, - frame: 0, - }), - ro = 3 * G.jumpDistance, - lo = { ref: false }, - co = { ref: 0 }; - function uo(e, t, a, i, n, s, o, r, l, c, bottom) { - if (a.destroyed && a.destroyed?.by == "gun") { - return a; - } - const d = be.rectTouchesRect(t), - u = c * (l / 5), - h = c * l, - p = t.x + a.direction * u, - g = t.y - h; - let m = null, - f = a.direction, - y = false; - for (const { object: e, index: a } of n) { - if ("enemy" === e.type) { - if (a === i) { - continue; - } + ]; + }, + ), + ], + ), + ], + ), + ], + ), + ], + }), + bulletSprite = makeSprite({ + render: ({ props: e }) => [ + conditional( + () => e.isEnemy, + () => [ + y( + { + fileName: `images/themes/world2/gun/bullet-enemy.png`, + width: e.bullet.width, + height: e.bullet.height, + }, + (t) => { + t.scaleX = Math.sign(e.bullet.speed); + }, + ), + ], + () => [ + triggerableSpriteSheet.Single( + { + fileName: "images/themes/world2/gun/bullet-destroy.png", + columns: 4, + rows: 1, + frameRate: 3, + width: 70, + height: 65, + df: Math.min(e.bullet.frame || 0, 1), + onEnd: () => e.removeBullet(), + }, + (t) => { + ((t.df = Math.min(e.bullet.frame || 0, 1)), + (t.scaleX = + Math.sign(e.bullet.speed) * (e.bullet.width / 70))); + t.scaleY = e.bullet.height / 35; + }, + ), + ], + ), + ], + }), + bossButtonSprite = makeSprite({ + init({ props: e }) { + return { + frame: e.button.pressed ? 5 : 0, + }; + }, + loop({ props: e, state: t }) { + t.frame += (e.df || 1) * (e.button.pressed ? 1 : -1); + if (t.frame < 0) { + t.frame = 0; + } else if (t.frame > 17) { + t.frame = 17; } - let n = e; - if ("switchPlatform" === e.type && 0 !== e.rotation) { - if (-90 !== e.rotation && 90 !== e.rotation) { - const a = be.hitObject( - p, - g + t.height / 4, - 1, - 0.5, - 0, - false, - false, - )(e); - //** - be.hitObject( - p, - g - t.height / (e.rotation > 90 ? 4 : 4), - 1, - 0.5, - 0, - false, - false, - )(e) && (e.rotation) > -45 - ? (m = be.getObjectTopY(e, t.x, t.y) + t.height / 2) - : a && (y = true); - continue; - } - n = - -90 === e.rotation - ? $.getSwitchPlatformUpRectangle(e) - : $.getSwitchPlatformDownRectangle(e); + }, + render({ props: e, state: t }) { + return [ + loopingSpriteSheet.Single( + { + fileName: "images/level/boss2/button.png", + columns: 3, + rows: 2, + frameRate: 3, + width: 90, + height: 30, + frame: t.frame, + }, + (a) => { + a.frame = t.frame; + }, + ), + ]; + }, + }), + no = makeSprite({ + render: ({ props: e }) => [ + onChange( + () => e.bullet.width, + () => [ + "laser" === e.bullet.type + ? so.Single({}) + : "missile" === e.bullet.type + ? y({ + fileName: "images/level/boss2/missile.png", + width: 50, + height: 22, + x: 8, + }) + : "bulletHell" === e.bullet.type && e.bullet.width < 5 + ? y({ + fileName: "images/level/boss2/bulletHell.png", + width: 7, + height: 7, + }) + : conditional( + () => e.bullet.destroyed, + () => [ + triggerableSpriteSheet.Single( + { + fileName: + "images/themes/world2/enemy-explosion.png", + columns: 4, + rows: 2, + frameRate: 3, + width: 100, + height: 100, + paused: e.paused, + df: e.df, + hideOnEnd: true, + }, + (t) => { + ((t.paused = e.paused), (t.df = e.df)); + }, + ), + ], + () => [ + y( + { + fileName: `images/level/boss2/${e.bullet.type}.png`, + width: e.bullet.width, + height: e.bullet.height, + }, + (t) => { + ((t.width = e.bullet.width), + (t.height = e.bullet.height)); + }, + ), + ], + ), + ], + ), + ], + }), + so = makeSprite({ + render() { + const e = Array.from({ length: 6 }); + return [ + imageArray({ + fileName: "images/level/boss2/lasercharge/laserbody.png", + props: (e, t) => ({ + width: 100, + height: 100, + x: -95 - 100 * t, + }), + array: () => e, + }), + y({ + fileName: "images/level/boss2/lasercharge/laserbase.png", + width: 45, + height: 100, + x: -22.5, + }), + ]; + }, + }), + oo = (e, t, a) => ({ + x: e, + y: t, + width: 23, + height: 12, + speed: a, + frame: 0, + }), + ro = 3 * G.jumpDistance, + lo = { ref: false }, + co = { ref: 0 }; + function uo(e, t, a, i, n, s, o, r, l, c, bottom) { + if (a.destroyed && a.destroyed?.by == "gun") { + return a; + } + const d = be.rectTouchesRect(t), + u = c * (l / 5), + h = c * l, + p = t.x + a.direction * u, + g = t.y - h; + let m = null, + f = a.direction, + y = false; + for (const { object: e, index: a } of n) { + if ("enemy" === e.type) { + if (a === i) { + continue; } - ((n.canJumpThrough && !t.isCompatible) || - (be.rectTouchesRect2( - p - t.width / 4, - g + t.height / 8, - t.width / 2, - 0.75 * t.height, - n, - ) && - (f = 1)), - (n.canJumpThrough && !t.isCompatible) || - (be.rectTouchesRect2( - p + t.width / 4, - g + t.height / 8, - t.width / 2, - 0.75 * t.height, - n, - ) && - (f = -1)), - be.rectTouchesRect2( - p, - g - t.height * (3 / 8), - t.width / 2, - t.height / 4, - n, - ) && - ((m = be.getObjectTopY(e, t.x, t.y) + t.height / 2), - n.kind == "walkerHelmet" && !t.isCompatible && (y = true))); } - const E = o[r[i]].y; - if (ho(a, e)) - return Object.assign(Object.assign({}, a), { - offsetY: null === m ? a.offsetY - h : m - E, - direction: f, - }); - for (const { object: i } of [ - ...s, - ...(bottom || []).map((x) => ({ index: 0, object: x })), - ]) - if ("saw" === i?.type && i?.shape === "bar") { - if ( - be.hitObject( - p, - g, - t.width / 30, - t.height / 30, - 0, - false, - false, - )(i) - ) { - return Object.assign(Object.assign({}, a), { - destroyed: { frame: e, x: t.x, y: t.y, by: "object" }, - }); - } - } else if ("enemy" !== i?.type && d(i)) + let n = e; + if ("switchPlatform" === e.type && 0 !== e.rotation) { + if (-90 !== e.rotation && 90 !== e.rotation) { + const a = be.hitObject( + p, + g + t.height / 4, + 1, + 0.5, + 0, + false, + false, + )(e); + //** + be.hitObject( + p, + g - t.height / (e.rotation > 90 ? 4 : 4), + 1, + 0.5, + 0, + false, + false, + )(e) && (e.rotation) > -45 + ? (m = be.getObjectTopY(e, t.x, t.y) + t.height / 2) + : a && (y = true); + continue; + } + n = + -90 === e.rotation + ? $.getSwitchPlatformUpRectangle(e) + : $.getSwitchPlatformDownRectangle(e); + } + ((n.canJumpThrough && !t.isCompatible) || + (be.rectTouchesRect2( + p - t.width / 4, + g + t.height / 8, + t.width / 2, + 0.75 * t.height, + n, + ) && + (f = 1)), + (n.canJumpThrough && !t.isCompatible) || + (be.rectTouchesRect2( + p + t.width / 4, + g + t.height / 8, + t.width / 2, + 0.75 * t.height, + n, + ) && + (f = -1)), + be.rectTouchesRect2( + p, + g - t.height * (3 / 8), + t.width / 2, + t.height / 4, + n, + ) && + ((m = be.getObjectTopY(e, t.x, t.y) + t.height / 2), + n.kind == "walkerHelmet" && !t.isCompatible && (y = true))); + } + const E = o[r[i]].y; + if (ho(a, e)) + return Object.assign(Object.assign({}, a), { + offsetY: null === m ? a.offsetY - h : m - E, + direction: f, + }); + for (const { object: i } of [ + ...s, + ...(bottom || []).map((x) => ({ index: 0, object: x })), + ]) + if ("saw" === i?.type && i?.shape === "bar") { + if ( + be.hitObject( + p, + g, + t.width / 30, + t.height / 30, + 0, + false, + false, + )(i) + ) { return Object.assign(Object.assign({}, a), { destroyed: { frame: e, x: t.x, y: t.y, by: "object" }, }); - return y - ? Object.assign(Object.assign({}, a), { - destroyed: { frame: e, x: p, y: g, by: "object" }, - }) - : Object.assign(Object.assign({}, a), { - framesSeen: a.framesSeen + c, - offsetX: a.offsetX + f * u, - offsetY: null === m ? a.offsetY - h : m - E, - direction: f, - }); + } + } else if ("enemy" !== i?.type && d(i)) + return Object.assign(Object.assign({}, a), { + destroyed: { frame: e, x: t.x, y: t.y, by: "object" }, + }); + return y + ? Object.assign(Object.assign({}, a), { + destroyed: { frame: e, x: p, y: g, by: "object" }, + }) + : Object.assign(Object.assign({}, a), { + framesSeen: a.framesSeen + c, + offsetX: a.offsetX + f * u, + offsetY: null === m ? a.offsetY - h : m - E, + direction: f, + }); + } + function bombEnemyKind( + e, + t, + state, + i, + n, + s, + o, + r, + l, + df, + bottom, + springs, + jumpHeight, + ) { + if (state.destroyed && state.destroyed?.by == "gun") { + return state; } - function bombEnemyKind( - e, - t, - state, - i, - n, - s, - o, - r, - l, - df, - bottom, - springs, - jumpHeight, - ) { - if (state.destroyed && state.destroyed?.by == "gun") { - return state; - } - // 130 BPM is 4.875 - // 1.95 - let d = be.rectTouchesRect(t), - u = df * (l / 1.625), - h = df * state.speedY, - newX = t.x + state.direction * u, - newY = t.y - h; - let edge = null, - newDirection = state.direction, - y = false; - for (const { object: e, index: index } of n) { - if ("enemy" === e.type && index === i) continue; - let n = e; - if ("switchPlatform" === e.type && 0 !== e.rotation) { - if (-90 !== e.rotation && 90 !== e.rotation) { - const a = be.hitObject( - newX, - newY + t.height / 4, - 1, - 0.5, - 0, - false, - false, - )(e); - //** - be.hitObject( - newX, - newY - t.height / (e.rotation > 90 ? 4 : 4), - 1, - 0.5, - 0, - false, - false, - )(e) && e.rotation > -45 - ? (edge = be.getObjectTopY(e, t.x, t.y) + t.height / 2) - : a && (y = true); - continue; - } - n = - -90 === e.rotation - ? $.getSwitchPlatformUpRectangle(e) - : $.getSwitchPlatformDownRectangle(e); + // 130 BPM is 4.875 + // 1.95 + let d = be.rectTouchesRect(t), + u = df * (l / 1.625), + h = df * state.speedY, + newX = t.x + state.direction * u, + newY = t.y - h; + let edge = null, + newDirection = state.direction, + y = false; + for (const { object: e, index: index } of n) { + if ("enemy" === e.type && index === i) continue; + let n = e; + if ("switchPlatform" === e.type && 0 !== e.rotation) { + if (-90 !== e.rotation && 90 !== e.rotation) { + const a = be.hitObject( + newX, + newY + t.height / 4, + 1, + 0.5, + 0, + false, + false, + )(e); + //** + be.hitObject( + newX, + newY - t.height / (e.rotation > 90 ? 4 : 4), + 1, + 0.5, + 0, + false, + false, + )(e) && e.rotation > -45 + ? (edge = be.getObjectTopY(e, t.x, t.y) + t.height / 2) + : a && (y = true); + continue; } - ( - true && - be.rectTouchesRect2( - newX, - newY - t.height * (3 / 8), - t.width / 2, - t.height / 4, - n, - ) && - ((edge = be.getObjectTopY(e, t.x, t.y) + t.height / 2), (newY = edge), - n.kind == "walkerHelmet" && !t.isCompatible && (y = true)), - !n.canJumpThrough && - be.rectTouchesRect2( - newX, - newY + t.height * (3 / 8), - t.width / 2, - t.height / 4, - n, - ) && - ((newY = be.getObjectTopY(e, t.x, t.y) - t.height / 2), (state.speedY = 0), (h = 0)), - (n.canJumpThrough && !t.isCompatible) || - (be.rectTouchesRect2( - newX - t.width / 4, - newY + t.height / 8, - t.width / 2, - 0.75 * t.height, - n, - ) && - (newDirection = 1)), - (n.canJumpThrough && !t.isCompatible) || - (be.rectTouchesRect2( - newX + t.width / 4, - newY + t.height / 8, - t.width / 2, - 0.75 * t.height, - n, - ) && - (newDirection = -1)) - ); + n = + -90 === e.rotation + ? $.getSwitchPlatformUpRectangle(e) + : $.getSwitchPlatformDownRectangle(e); } - for (const pair of springs) { - let spring = pair.object; + ( + true && be.rectTouchesRect2( - newX, - newY, - t.width, - t.height, - spring - ) && ( + newX, + newY - t.height * (3 / 8), + t.width / 2, + t.height / 4, + n, + ) && + ((edge = be.getObjectTopY(e, t.x, t.y) + t.height / 2), (newY = edge), + n.kind == "walkerHelmet" && !t.isCompatible && (y = true)), + !n.canJumpThrough && + be.rectTouchesRect2( + newX, + newY + t.height * (3 / 8), + t.width / 2, + t.height / 4, + n, + ) && + ((newY = be.getObjectTopY(e, t.x, t.y) - t.height / 2), (state.speedY = 0), (h = 0)), + (n.canJumpThrough && !t.isCompatible) || + (be.rectTouchesRect2( + newX - t.width / 4, + newY + t.height / 8, + t.width / 2, + 0.75 * t.height, + n, + ) && + (newDirection = 1)), + (n.canJumpThrough && !t.isCompatible) || + (be.rectTouchesRect2( + newX + t.width / 4, + newY + t.height / 8, + t.width / 2, + 0.75 * t.height, + n, + ) && + (newDirection = -1)) + ); + } + for (const pair of springs) { + let spring = pair.object; + be.rectTouchesRect2( + newX, + newY, + t.width, + t.height, + spring + ) && ( (state.speedY = -(spring.direction > 0 - ? Math.max(l, Math.abs((state.speedY)) * 1.25) - : Math.max(l, Math.abs(state.speedY))) * - spring.direction), + ? Math.max(l, Math.abs((state.speedY)) * 1.25) + : Math.max(l, Math.abs(state.speedY))) * + spring.direction), (h = 0), (newY = spring.y + (spring.height / 2) * spring.direction + 16 * spring.direction), (state.offsetY = newY - o[r[i]].y), (edge = null) ) + } + if (edge !== null) { + if (state.speedY > 1) { + h *= -0.25; + state.speedY *= -0.25; + newY = t.y - h; + edge = null; + } else { + state.speedY = 0; + h = 0; + newY = t.y; } - if (edge !== null) { - if (state.speedY > 1) { - h *= -0.25; - state.speedY *= -0.25; - newY = t.y - h; - edge = null; - } else { - state.speedY = 0; - h = 0; - newY = t.y; - } - } - const E = o[r[i]].y; - if (ho(state, e)) - return Object.assign(Object.assign({}, state), { - offsetY: null === edge ? state.offsetY - h : edge - E, - direction: newDirection, - }); - for (const { object: i } of [ - ...s, - ...(bottom || []).map((x) => ({ index: 0, object: x })), - ]) - if ("saw" === i?.type && i?.shape === "bar") { - if ( - be.hitObject( - newX, - newY, - t.width / 30, - t.height / 30, - 0, - false, - false, - )(i) - ) { - return Object.assign(Object.assign({}, state), { - destroyed: { frame: e, x: t.x, y: t.y, by: "object" }, - }); - } - } else if ("enemy" !== i?.type && d(i)) + } + const E = o[r[i]].y; + if (ho(state, e)) + return Object.assign(Object.assign({}, state), { + offsetY: null === edge ? state.offsetY - h : edge - E, + direction: newDirection, + }); + for (const { object: i } of [ + ...s, + ...(bottom || []).map((x) => ({ index: 0, object: x })), + ]) + if ("saw" === i?.type && i?.shape === "bar") { + if ( + be.hitObject( + newX, + newY, + t.width / 30, + t.height / 30, + 0, + false, + false, + )(i) + ) { return Object.assign(Object.assign({}, state), { destroyed: { frame: e, x: t.x, y: t.y, by: "object" }, }); - return y - ? Object.assign(Object.assign({}, state), { - destroyed: { frame: e, x: newX, y: newY, by: "object" }, - }) - : Object.assign(Object.assign({}, state), { - framesSeen: state.framesSeen + df, - offsetX: state.offsetX + newDirection * u, - offsetY: null === edge ? state.offsetY - h : edge - E, - direction: newDirection, - speedY: - null === edge - ? Math.min(state.speedY + l * (0.4 / 4.875), df * l * 2) * df - : 0, - }); + } + } else if ("enemy" !== i?.type && d(i)) + return Object.assign(Object.assign({}, state), { + destroyed: { frame: e, x: t.x, y: t.y, by: "object" }, + }); + return y + ? Object.assign(Object.assign({}, state), { + destroyed: { frame: e, x: newX, y: newY, by: "object" }, + }) + : Object.assign(Object.assign({}, state), { + framesSeen: state.framesSeen + df, + offsetX: state.offsetX + newDirection * u, + offsetY: null === edge ? state.offsetY - h : edge - E, + direction: newDirection, + speedY: + null === edge + ? Math.min(state.speedY + l * (0.4 / 4.875), df * l * 2) * df + : 0, + }); + } + + function minionEnemyKind( + e, + t, + a, + i, + n, + s, + o, + levelSpeed, + jumpFrames, + df, + d, + u, + h, + p, + g, + speed, + ) { + if (a.destroyed) { + return a; } + // overdrive levelSpeed is 6.45 + return Object.assign(Object.assign({}, a), { + framesSeen: a.framesSeen + df, + offsetX: a.offsetX + (levelSpeed / 6.45) * df * a.direction, + offsetY: a.offsetY, + direction: a.direction, + }); + } - function minionEnemyKind( - e, - t, - a, - i, - n, - s, - o, - levelSpeed, - jumpFrames, - df, - d, - u, - h, - p, - g, - speed, - ) { - if (a.destroyed) { - return a; - } - // overdrive levelSpeed is 6.45 - return Object.assign(Object.assign({}, a), { - framesSeen: a.framesSeen + df, - offsetX: a.offsetX + (levelSpeed / 6.45) * df * a.direction, - offsetY: a.offsetY, - direction: a.direction, - }); + function fireballEnemyKind( + e, + t, + a, + i, + n, + s, + o, + levelSpeed, + jumpFrames, + df, + d, + u, + h, + p, + g, + speed, + ) { + if (a.destroyed) { + return a; } + // overdrive levelSpeed is 6.45 + return Object.assign(Object.assign({}, a), { + framesSeen: a.framesSeen + df, + offsetX: a.offsetX, + offsetY: a.offsetY - (levelSpeed / 6.45) * df * 1.5, + direction: a.direction, + }); + } - function fireballEnemyKind( - e, - t, - a, - i, - n, - s, - o, - levelSpeed, - jumpFrames, - df, - d, - u, - h, - p, - g, - speed, - ) { - if (a.destroyed) { - return a; - } - // overdrive levelSpeed is 6.45 + function ho(e, t) { + return ( + e.destroyed && + ("missile" !== e.destroyed.by || e.destroyed.frame + 60 < t) + ); + } + function po( + e, + t, + a, + i, + n, + s, + o, + levelSpeed, + jumpFrames, + c, + d, + u, + h, + p, + g, + speed, + ) { + if (t.isCompatible) { + speed = 1; + } + let m = a.bullet; + if ( + (m && + ((m = oo( + m.x + m.speed * c, + m.y, + m.speed + Math.sign(m.speed) * c * (levelSpeed / 20), + )), + u(m) && ((g.ref = true), (m = null))), + a.destroyed) + ) + return Object.assign(Object.assign({}, a), { bullet: m }); + if (a.framesSeen > 20 * jumpFrames) return Object.assign(Object.assign({}, a), { - framesSeen: a.framesSeen + df, - offsetX: a.offsetX, - offsetY: a.offsetY - (levelSpeed / 6.45) * df * 1.5, - direction: a.direction, + destroyed: { frame: e, x: t.x, y: t.y, by: "outOfView" }, + bullet: null, }); + const f = d ? 2 : 3; + go(a.framesSeen, jumpFrames, c, f, o) && + (null == h || h(), (m = oo(t.x, t.y - 10, 0.5 * -levelSpeed * s))); + const y = 1 - Math.abs(Math.floor((p.ref - 1) / 2) % 2), + E = Math.floor((p.ref + 1) / 2) * (p.ref % 2 == 0 ? -1 : 1), + b = i + ro * s + t.width * y * 1.5, + S = n + t.height * E + 10; + let I = 0, + _ = 0; + if (!t.isCompatible) { + // levelSpeed *= speed } - - function ho(e, t) { - return ( - e.destroyed && - ("missile" !== e.destroyed.by || e.destroyed.frame + 60 < t) - ); - } - function po( - e, + return ( + a.framesSeen > 4 * jumpFrames * (f + 1) + ? ((I = -levelSpeed * c * s), (_ = (n + 10 - t.y) / (20 / c))) + : ((I = (b - t.x) / (10 / c)), + (_ = (S - t.y) / (10 / c)), + Math.abs(I) > 2 * levelSpeed * speed && (_ -= I / 2), + p.ref++), + Object.assign(Object.assign({}, a), { + framesSeen: a.framesSeen + c, + offsetX: a.offsetX + I, + offsetY: a.offsetY + _, + bullet: m, + direction: -s, + }) + ); + } + function go(e, t, a, i, n) { + return !n && e % (4 * t) < a && e > 0 && e <= 4 * t * i + 1; + } + const mo = { + updateEnemies: function ( + frame, t, a, i, n, s, o, - levelSpeed, - jumpFrames, + r, + l, c, d, - u, - h, - p, + levelSpeed, + jumpFrames, + df, g, + m, + f, + y, + E, + b, + bottom, speed, + springs, + jumpHeight, ) { - if (t.isCompatible) { - speed = 1; - } - let m = a.bullet; - if ( - (m && - ((m = oo( - m.x + m.speed * c, - m.y, - m.speed + Math.sign(m.speed) * c * (levelSpeed / 20), - )), - u(m) && ((g.ref = true), (m = null))), - a.destroyed) - ) - return Object.assign(Object.assign({}, a), { bullet: m }); - if (a.framesSeen > 20 * jumpFrames) - return Object.assign(Object.assign({}, a), { - destroyed: { frame: e, x: t.x, y: t.y, by: "outOfView" }, - bullet: null, - }); - const f = d ? 2 : 3; - go(a.framesSeen, jumpFrames, c, f, o) && - (null == h || h(), (m = oo(t.x, t.y - 10, 0.5 * -levelSpeed * s))); - const y = 1 - Math.abs(Math.floor((p.ref - 1) / 2) % 2), - E = Math.floor((p.ref + 1) / 2) * (p.ref % 2 == 0 ? -1 : 1), - b = i + ro * s + t.width * y * 1.5, - S = n + t.height * E + 10; - let I = 0, - _ = 0; - if (!t.isCompatible) { - // levelSpeed *= speed - } - return ( - a.framesSeen > 4 * jumpFrames * (f + 1) - ? ((I = -levelSpeed * c * s), (_ = (n + 10 - t.y) / (20 / c))) - : ((I = (b - t.x) / (10 / c)), - (_ = (S - t.y) / (10 / c)), - Math.abs(I) > 2 * levelSpeed * speed && (_ -= I / 2), - p.ref++), - Object.assign(Object.assign({}, a), { - framesSeen: a.framesSeen + c, - offsetX: a.offsetX + I, - offsetY: a.offsetY + _, - bullet: m, - direction: -s, - }) - ); - } - function go(e, t, a, i, n) { - return !n && e % (4 * t) < a && e > 0 && e <= 4 * t * i + 1; - } - const mo = { - updateEnemies: function ( - frame, - t, - a, - i, - n, - s, - o, - r, - l, - c, - d, - levelSpeed, - jumpFrames, - df, - g, - m, - f, - y, - E, - b, - bottom, - speed, - springs, - jumpHeight, - ) { - ((lo.ref = d), (co.ref = 0)); - const S = [ - ...t, - ...n - .map((t, a) => ({ - object: t, - index: a, - destroyed: ho(i[a], frame), - })) - .filter( - ({ destroyed: e, object: t }) => - "shooter" !== t.kind && - "minion" !== t.kind && - "fireball" !== t.kind && - !e, - ), - ]; - for (let t = 0; t < n.length; t++) { - const I = n[t], - _ = i[t], - v = - "fireball" === I.kind - ? fireballEnemyKind( + ((lo.ref = d), (co.ref = 0)); + const S = [ + ...t, + ...n + .map((t, a) => ({ + object: t, + index: a, + destroyed: ho(i[a], frame), + })) + .filter( + ({ destroyed: e, object: t }) => + "shooter" !== t.kind && + "minion" !== t.kind && + "fireball" !== t.kind && + !e, + ), + ]; + for (let t = 0; t < n.length; t++) { + const I = n[t], + _ = i[t], + v = + "fireball" === I.kind + ? fireballEnemyKind( + frame, + I, + _, + r, + l, + c, + d, + levelSpeed, + jumpFrames, + df, + g, + m, + f, + co, + lo, + speed, + ) + : "minion" === I.kind + ? minionEnemyKind( + frame, + I, + _, + r, + l, + c, + d, + levelSpeed, + jumpFrames, + df, + g, + m, + f, + co, + lo, + speed, + ) + : "bomb" === I.kind + ? bombEnemyKind( + frame, + I, + _, + t, + S, + a, + s, + o, + levelSpeed, + df, + bottom, + springs, + jumpHeight, + ) + : "shooter" === I.kind + ? po( frame, I, _, @@ -33128,420 +33155,496 @@ var version = "v1.17.2"; lo, speed, ) - : "minion" === I.kind - ? minionEnemyKind( - frame, - I, - _, - r, - l, - c, - d, - levelSpeed, - jumpFrames, - df, - g, - m, - f, - co, - lo, - speed, - ) - : "bomb" === I.kind - ? bombEnemyKind( - frame, - I, - _, - t, - S, - a, - s, - o, - levelSpeed, - df, - bottom, - springs, - jumpHeight, - ) - : "shooter" === I.kind - ? po( - frame, - I, - _, - r, - l, - c, - d, - levelSpeed, - jumpFrames, - df, - g, - m, - f, - co, - lo, - speed, - ) - : uo( - frame, - I, - _, - t, - S, - a, - s, - o, - levelSpeed, - df, - bottom, - ); - xa.updateLayoutStateField("enemies", t, v, y, E, b, false); - } - return lo.ref; - }, - didLandOnHead: function ( - frame, - enemy, - enemyState, - playerY, - playerGradY, - initGrad, - collide, - ) { - if (playerGradY <= 0) { - const r = { - x: enemy.x, - y: enemy.y + enemy.height / 4, - width: enemy.width, - height: enemy.height / 2, - }; - if ( - playerY > - (enemy.giant ? enemy.y + enemy.height / 2 + 3 : enemy.y) && - collide(r) - ) - return ( - (r.height /= 2), - enemy.giant && (r.y += enemy.height / 8), - collide(r) - ? 0 === playerGradY - ? { - enemyState: enemyState, - playerCrashed: true, - playerGradY: playerGradY, - } - : { - enemyState: Object.assign( - Object.assign({}, enemyState), - { - destroyed: { - frame: frame, - x: enemy.x, - y: enemy.y, - by: "stomped", + : uo( + frame, + I, + _, + t, + S, + a, + s, + o, + levelSpeed, + df, + bottom, + ); + xa.updateLayoutStateField("enemies", t, v, y, E, b, false); + } + return lo.ref; + }, + didLandOnHead: function ( + frame, + enemy, + enemyState, + playerY, + playerGradY, + initGrad, + collide, + ) { + if (playerGradY <= 0) { + const r = { + x: enemy.x, + y: enemy.y + enemy.height / 4, + width: enemy.width, + height: enemy.height / 2, + }; + if ( + playerY > + (enemy.giant ? enemy.y + enemy.height / 2 + 3 : enemy.y) && + collide(r) + ) + return ( + (r.height /= 2), + enemy.giant && (r.y += enemy.height / 8), + collide(r) + ? 0 === playerGradY + ? { + enemyState: enemyState, + playerCrashed: true, + playerGradY: playerGradY, + } + : { + enemyState: Object.assign( + Object.assign({}, enemyState), + { + destroyed: { + frame: frame, + x: enemy.x, + y: enemy.y, + by: "stomped", + }, + }, + ), + playerCrashed: false, + playerGradY: G.initGrad(initGrad), + } + : { + enemyState: enemyState, + playerCrashed: false, + playerGradY: playerGradY, + } + ); + } + return null; + }, + shouldShoot: go, + }, + fo = makeSprite({ + render: ({ props: e }) => [ + ifConditional( + () => null !== e.enemyState.bullet, + () => [ + bulletSprite.Single( + { bullet: e.enemyState.bullet, isEnemy: true }, + (t) => { + ((t.x = e.enemyState.bullet.x), + (t.y = e.enemyState.bullet.y), + (t.bullet = e.enemyState.bullet)); + }, + ), + ], + ), + onChange( + () => { + var t; + return null === (t = e.enemyState.destroyed) || void 0 === t + ? void 0 + : t.by; + }, + () => { + var t; + switch ( + null === (t = e.enemyState.destroyed) || void 0 === t + ? void 0 + : t.by + ) { + case "missile": + return [ + za.Single( + { + justDestroyed: $a( + e.enemyState.destroyed.frame, + e.frame, + ), + paused: e.paused, + playerX: e.playerX, + playerY: e.playerY, + objectX: e.enemy.x, + objectY: e.enemy.y, + getSprite: (t, a) => + t + ? bo.Single({ + x: a.x, + y: a.y, + justDestroyed: true, + paused: e.paused, + df: e.df, + giant: e.enemy.giant, + }) + : yo.Single( + { + enemy: e.enemy, + frame: e.frame, + enemyDir: e.enemyState.direction, + df: e.df, }, - }, - ), - playerCrashed: false, - playerGradY: G.initGrad(initGrad), - } - : { - enemyState: enemyState, - playerCrashed: false, - playerGradY: playerGradY, - } - ); - } - return null; - }, - shouldShoot: go, - }, - fo = makeSprite({ - render: ({ props: e }) => [ - ifConditional( - () => null !== e.enemyState.bullet, - () => [ - bulletSprite.Single( - { bullet: e.enemyState.bullet, isEnemy: true }, - (t) => { - ((t.x = e.enemyState.bullet.x), - (t.y = e.enemyState.bullet.y), - (t.bullet = e.enemyState.bullet)); - }, - ), - ], - ), - onChange( - () => { - var t; - return null === (t = e.enemyState.destroyed) || void 0 === t - ? void 0 - : t.by; - }, - () => { - var t; - switch ( - null === (t = e.enemyState.destroyed) || void 0 === t - ? void 0 - : t.by - ) { - case "missile": - return [ - za.Single( - { - justDestroyed: $a( + (t) => { + ((t.enemy = e.enemy), + (t.frame = e.frame), + (t.enemyDir = e.enemyState.direction), + (t.df = e.df)); + }, + ), + }, + (t) => { + ((t.paused = e.paused), + (t.playerX = e.playerX), + (t.playerY = e.playerY), + (t.objectX = e.enemy.x), + (t.objectY = e.enemy.y)); + }, + ), + ]; + case "object": + case "gun": + return [ + bo.Single( + { + justDestroyed: $a( + e.enemyState.destroyed.frame, + e.frame, + ), + paused: e.paused, + df: e.df, + giant: e.enemy.giant, + }, + (t) => { + ((t.x = e.enemy.x), + (t.y = getBlockFallY( + e.enemy.x, + e.enemy.y, + e.inGame && e.inGame.playerX, + e.inGame && e.inGame.fallTypes, + e.inGame && e.inGame.playerDir, + )), + (t.justDestroyed = $a( e.enemyState.destroyed.frame, e.frame, - ), - paused: e.paused, + )), + (t.paused = e.paused), + (t.df = e.df)); + }, + ), + ]; + case "stomped": + return [ + Eo.Single( + { + enemyDir: e.enemyState.direction, + justDestroyed: $a( + e.enemyState.destroyed.frame, + e.frame, + ), + df: e.df, + giant: e.enemy.giant, + }, + (t) => { + ((t.x = e.enemy.x), + (t.y = getBlockFallY( + e.enemy.x, + e.enemy.y, + e.inGame && e.inGame.playerX, + e.inGame && e.inGame.fallTypes, + e.inGame && e.inGame.playerDir, + )), + (t.justDestroyed = $a( + e.enemyState.destroyed.frame, + e.frame, + )), + (t.enemyDir = e.enemyState.direction), + (t.df = e.df)); + }, + ), + ]; + case "outOfView": + return []; + case void 0: + return [ + yo.Single( + { + enemy: e.enemy, + enemyDir: e.enemyState.direction, + aboutToShoot: false, + frame: e.frame, + df: e.df, + paused: e.paused, + inGame: { playerX: e.playerX, - playerY: e.playerY, - objectX: e.enemy.x, - objectY: e.enemy.y, - getSprite: (t, a) => - t - ? bo.Single({ - x: a.x, - y: a.y, - justDestroyed: true, - paused: e.paused, - df: e.df, - giant: e.enemy.giant, - }) - : yo.Single( + fallTypes: e.fallTypes, + playerDir: e.playerDir, + }, + }, + (t) => { + ((t.enemy = e.enemy), + (t.enemyDir = e.enemyState.direction), + (t.aboutToShoot = + "shooter" === e.enemy.kind && + mo.shouldShoot( + e.enemyState.framesSeen + 10, + e.jumpFrames, + e.df, + e.isBoss ? 2 : 3, + e.playerCrashed, + )), + (t.frame = e.frame), + (t.df = e.df), + (t.paused = e.paused), + (t.inGame.playerX = e.playerX), + (t.inGame.fallTypes = e.fallTypes), + (t.inGame.playerDir = e.playerDir)); + }, + ), + ]; + } + }, + ), + ], + }), + yo = makeSprite({ + init: () => ({ shooting: false }), + loop({ state: e, props: t }) { + t.aboutToShoot && (e.shooting = true); + }, + render: ({ props: e, state: t, getContext }) => { + let { animationRenderer: ar, animationAssets: aa } = + e.spineContext + ? e.spineContext + : e.inGame + ? getContext(Ws) + : {}; + return [ + ifConditional( + () => true === e.showArea, + () => [ + p( + { + width: 2 * Ca.inViewAreaWidth, + height: 2 * Ca.inViewAreaHeight, + color: "red", + opacity: 0.2, + }, + (t) => { + ((t.x = e.enemy.x), (t.y = e.enemy.y)); + }, + ), + ], + ), + onChange( + () => e.enemy.kind, + () => [ + onChange( + () => e.enemy.giant, + () => { + switch (e.enemy.kind) { + case "walker": { + const t = e.enemy.giant ? 175 : 175 / 3, + a = e.enemy.giant ? 110 : 110 / 3, + i = e.enemy.giant ? 5 : 2; + return [ + loopingSpriteSheet.Single( + { + fileName: + "images/themes/world2/enemy-walker.png", + columns: 4, + rows: 2, + frameRate: 6, + width: t, + height: a, + frame: e.frame || 7, + }, + (t) => { + ((t.x = e.enemy.x), + (t.y = getBlockFallY( + e.enemy.x, + e.enemy.y + i, + e.inGame && e.inGame.playerX, + e.inGame && e.inGame.fallTypes, + e.inGame && e.inGame.playerDir, + )), + (t.frame = e.frame || 7), + (t.scaleX = + e.enemyDir || e.enemy.enemyDir || -1)); + }, + ), + ]; + } + case "walkerHelmet": { + const t = e.enemy.giant ? 165 : 55, + a = e.enemy.giant ? 145 : 145 / 3; + return [ + loopingSpriteSheet.Single( + { + fileName: + "images/themes/world2/enemy-walker-helmet.png", + columns: 4, + rows: 2, + frameRate: 6, + width: t, + height: a, + frame: e.frame || 7, + }, + (t) => { + ((t.x = e.enemy.x), + (t.y = getBlockFallY( + e.enemy.x, + e.enemy.y, + e.inGame && e.inGame.playerX, + e.inGame && e.inGame.fallTypes, + e.inGame && e.inGame.playerDir, + )), + (t.frame = e.frame || 7), + (t.scaleX = + e.enemyDir || e.enemy.enemyDir || -1)); + }, + ), + ]; + } + case "bomb": + return [ + y( + { + fileName: `images/level/boss2/bomb.png`, + width: e.enemy.width, + height: e.enemy.height, + }, + (t) => { + ((t.x = e.enemy.x), + (t.y = getBlockFallY( + e.enemy.x, + e.enemy.y, + e.inGame && e.inGame.playerX, + e.inGame && e.inGame.fallTypes, + e.inGame && e.inGame.playerDir, + )), + (t.width = e.enemy.width), + (t.height = e.enemy.height), + (t.scaleX = -( + e.enemyDir || + e.enemy.enemyDir || + -1 + ))); + }, + ), + ]; + case "shooter": + return [ + conditional( + () => t.shooting, + () => { + var a; + return [ + triggerableSpriteSheet.Single( { - enemy: e.enemy, - frame: e.frame, - enemyDir: e.enemyState.direction, - df: e.df, + fileName: + "images/themes/world2/enemy-shooting.png", + columns: 2, + rows: 2, + frameRate: 6, + width: 205 / 3, + height: 115 / 3, + df: + null !== (a = e.df) && void 0 !== a + ? a + : 1, + onEnd: () => { + t.shooting = false; + }, }, (t) => { - ((t.enemy = e.enemy), - (t.frame = e.frame), - (t.enemyDir = e.enemyState.direction), - (t.df = e.df)); + var a; + ((t.x = e.enemy.x), + (t.y = e.enemy.y), + (t.df = + null !== (a = e.df) && void 0 !== a + ? a + : 1), + (t.scaleX = e.enemyDir || -1)); }, ), - }, - (t) => { - ((t.paused = e.paused), - (t.playerX = e.playerX), - (t.playerY = e.playerY), - (t.objectX = e.enemy.x), - (t.objectY = e.enemy.y)); - }, - ), - ]; - case "object": - case "gun": - return [ - bo.Single( - { - justDestroyed: $a( - e.enemyState.destroyed.frame, - e.frame, - ), - paused: e.paused, - df: e.df, - giant: e.enemy.giant, - }, - (t) => { - ((t.x = e.enemy.x), - (t.y = getBlockFallY( - e.enemy.x, - e.enemy.y, - e.inGame && e.inGame.playerX, - e.inGame && e.inGame.fallTypes, - e.inGame && e.inGame.playerDir, - )), - (t.justDestroyed = $a( - e.enemyState.destroyed.frame, - e.frame, - )), - (t.paused = e.paused), - (t.df = e.df)); - }, - ), - ]; - case "stomped": - return [ - Eo.Single( - { - enemyDir: e.enemyState.direction, - justDestroyed: $a( - e.enemyState.destroyed.frame, - e.frame, + ]; + }, + () => [ + loopingSpriteSheet.Single( + { + fileName: + "images/themes/world2/enemy-shooter.png", + columns: 2, + rows: 2, + frameRate: 6, + width: 205 / 3, + height: 115 / 3, + frame: e.frame || 7, + }, + (t) => { + ((t.x = e.enemy.x), + (t.y = e.enemy.y), + (t.frame = e.frame || 7), + (t.scaleX = e.enemyDir || -1)); + }, + ), + ], ), - df: e.df, - giant: e.enemy.giant, - }, - (t) => { - ((t.x = e.enemy.x), - (t.y = getBlockFallY( - e.enemy.x, - e.enemy.y, - e.inGame && e.inGame.playerX, - e.inGame && e.inGame.fallTypes, - e.inGame && e.inGame.playerDir, - )), - (t.justDestroyed = $a( - e.enemyState.destroyed.frame, - e.frame, - )), - (t.enemyDir = e.enemyState.direction), - (t.df = e.df)); - }, - ), - ]; - case "outOfView": - return []; - case void 0: - return [ - yo.Single( - { - enemy: e.enemy, - enemyDir: e.enemyState.direction, - aboutToShoot: false, - frame: e.frame, - df: e.df, - paused: e.paused, - inGame: { - playerX: e.playerX, - fallTypes: e.fallTypes, - playerDir: e.playerDir, - }, - }, - (t) => { - ((t.enemy = e.enemy), - (t.enemyDir = e.enemyState.direction), - (t.aboutToShoot = - "shooter" === e.enemy.kind && - mo.shouldShoot( - e.enemyState.framesSeen + 10, - e.jumpFrames, - e.df, - e.isBoss ? 2 : 3, - e.playerCrashed, - )), - (t.frame = e.frame), - (t.df = e.df), - (t.paused = e.paused), - (t.inGame.playerX = e.playerX), - (t.inGame.fallTypes = e.fallTypes), - (t.inGame.playerDir = e.playerDir)); - }, - ), - ]; - } - }, - ), - ], - }), - yo = makeSprite({ - init: () => ({ shooting: false }), - loop({ state: e, props: t }) { - t.aboutToShoot && (e.shooting = true); - }, - render: ({ props: e, state: t, getContext }) => { - let { animationRenderer: ar, animationAssets: aa } = - e.spineContext - ? e.spineContext - : e.inGame - ? getContext(Ws) - : {}; - return [ - ifConditional( - () => true === e.showArea, - () => [ - p( - { - width: 2 * Ca.inViewAreaWidth, - height: 2 * Ca.inViewAreaHeight, - color: "red", - opacity: 0.2, - }, - (t) => { - ((t.x = e.enemy.x), (t.y = e.enemy.y)); - }, - ), - ], - ), - onChange( - () => e.enemy.kind, - () => [ - onChange( - () => e.enemy.giant, - () => { - switch (e.enemy.kind) { - case "walker": { - const t = e.enemy.giant ? 175 : 175 / 3, - a = e.enemy.giant ? 110 : 110 / 3, - i = e.enemy.giant ? 5 : 2; - return [ - loopingSpriteSheet.Single( + ]; + case "minion": + return [ + e.inGame || e.spineContext + ? Hs( { - fileName: - "images/themes/world2/enemy-walker.png", - columns: 4, - rows: 2, - frameRate: 6, - width: t, - height: a, - frame: e.frame || 7, + id: "Minion", + animationAssets: aa, + animationRenderer: ar, + animationName: "animation", + fileNames: Qs.spineFiles.world4BossMinion, + loop: true, + paused: e.paused, + df: e.df || 1, + x: e.enemy.x, + y: e.enemy.y - 5, + height: 10, + scale: { + x: -( + e.enemyDir || + e.enemy.enemyDir || + -1 + ), + y: 1, + }, }, (t) => { - ((t.x = e.enemy.x), - (t.y = getBlockFallY( - e.enemy.x, - e.enemy.y + i, - e.inGame && e.inGame.playerX, - e.inGame && e.inGame.fallTypes, - e.inGame && e.inGame.playerDir, - )), - (t.frame = e.frame || 7), - (t.scaleX = - e.enemyDir || e.enemy.enemyDir || -1)); - }, - ), - ]; - } - case "walkerHelmet": { - const t = e.enemy.giant ? 165 : 55, - a = e.enemy.giant ? 145 : 145 / 3; - return [ - loopingSpriteSheet.Single( - { - fileName: - "images/themes/world2/enemy-walker-helmet.png", - columns: 4, - rows: 2, - frameRate: 6, - width: t, - height: a, - frame: e.frame || 7, - }, - (t) => { - ((t.x = e.enemy.x), - (t.y = getBlockFallY( - e.enemy.x, - e.enemy.y, - e.inGame && e.inGame.playerX, - e.inGame && e.inGame.fallTypes, - e.inGame && e.inGame.playerDir, - )), - (t.frame = e.frame || 7), - (t.scaleX = - e.enemyDir || e.enemy.enemyDir || -1)); + ((t.paused = e.paused), + (t.df = e.df || 1), + (t.scale.x = + -( + e.enemyDir || + e.enemy.enemyDir || + -1 + ) * (e.scale || 1)), + (t.scale.y = e.scale || 1), + (t.x = e.enemy.x), + (t.y = + getBlockFallY( + e.enemy.x, + e.enemy.y, + e.inGame && e.inGame.playerX, + e.inGame && e.inGame.fallTypes, + e.inGame && e.inGame.playerDir, + ) - 5)); }, - ), - ]; - } - case "bomb": - return [ - y( + ) + : y( { - fileName: `images/level/boss2/bomb.png`, - width: e.enemy.width, + fileName: `images/editor/editorOnly/minion.png`, + width: e.enemy.width * 1.6, height: e.enemy.height, }, (t) => { @@ -33553,7 +33656,7 @@ var version = "v1.17.2"; e.inGame && e.inGame.fallTypes, e.inGame && e.inGame.playerDir, )), - (t.width = e.enemy.width), + (t.width = e.enemy.width * 1.6), (t.height = e.enemy.height), (t.scaleX = -( e.enemyDir || @@ -33562,374 +33665,223 @@ var version = "v1.17.2"; ))); }, ), - ]; - case "shooter": - return [ - conditional( - () => t.shooting, - () => { - var a; - return [ - triggerableSpriteSheet.Single( - { - fileName: - "images/themes/world2/enemy-shooting.png", - columns: 2, - rows: 2, - frameRate: 6, - width: 205 / 3, - height: 115 / 3, - df: - null !== (a = e.df) && void 0 !== a - ? a - : 1, - onEnd: () => { - t.shooting = false; - }, - }, - (t) => { - var a; - ((t.x = e.enemy.x), - (t.y = e.enemy.y), - (t.df = - null !== (a = e.df) && void 0 !== a - ? a - : 1), - (t.scaleX = e.enemyDir || -1)); - }, - ), - ]; - }, - () => [ - loopingSpriteSheet.Single( - { - fileName: - "images/themes/world2/enemy-shooter.png", - columns: 2, - rows: 2, - frameRate: 6, - width: 205 / 3, - height: 115 / 3, - frame: e.frame || 7, - }, - (t) => { - ((t.x = e.enemy.x), - (t.y = e.enemy.y), - (t.frame = e.frame || 7), - (t.scaleX = e.enemyDir || -1)); - }, - ), - ], - ), - ]; - case "minion": - return [ - e.inGame || e.spineContext - ? Hs( - { - id: "Minion", - animationAssets: aa, - animationRenderer: ar, - animationName: "animation", - fileNames: Qs.spineFiles.world4BossMinion, - loop: true, - paused: e.paused, - df: e.df || 1, - x: e.enemy.x, - y: e.enemy.y - 5, - height: 10, - scale: { - x: -( - e.enemyDir || - e.enemy.enemyDir || - -1 - ), - y: 1, - }, - }, - (t) => { - ((t.paused = e.paused), - (t.df = e.df || 1), - (t.scale.x = - -( - e.enemyDir || - e.enemy.enemyDir || - -1 - ) * (e.scale || 1)), - (t.scale.y = e.scale || 1), - (t.x = e.enemy.x), - (t.y = - getBlockFallY( - e.enemy.x, - e.enemy.y, - e.inGame && e.inGame.playerX, - e.inGame && e.inGame.fallTypes, - e.inGame && e.inGame.playerDir, - ) - 5)); - }, - ) - : y( - { - fileName: `images/editor/editorOnly/minion.png`, - width: e.enemy.width * 1.6, - height: e.enemy.height, - }, - (t) => { - ((t.x = e.enemy.x), - (t.y = getBlockFallY( - e.enemy.x, - e.enemy.y, - e.inGame && e.inGame.playerX, - e.inGame && e.inGame.fallTypes, - e.inGame && e.inGame.playerDir, - )), - (t.width = e.enemy.width * 1.6), - (t.height = e.enemy.height), - (t.scaleX = -( - e.enemyDir || - e.enemy.enemyDir || - -1 - ))); - }, - ), - ]; - case "fireball": - return [ - Hs( - { - id: "Fireball", - animationAssets: aa, - animationRenderer: ar, - animationName: "animation", - fileNames: Qs.spineFiles.world4BossFireBall, - loop: true, - paused: e.paused, - df: e.df || 1, - x: e.enemy.x, - y: e.enemy.y + 3, - height: 10, - scale: { - x: 1, - y: 1, - }, - }, - (t) => { - ((t.scale.x = e.scale || 1), - (t.scale.y = e.scale || 1), - (t.paused = e.paused), - (t.df = e.df || 1), - (t.x = e.enemy.x), - (t.y = - getBlockFallY( - e.enemy.x, - e.enemy.y, - e.inGame && e.inGame.playerX, - e.inGame && e.inGame.fallTypes, - e.inGame && e.inGame.playerDir, - ) + 3)); + ]; + case "fireball": + return [ + Hs( + { + id: "Fireball", + animationAssets: aa, + animationRenderer: ar, + animationName: "animation", + fileNames: Qs.spineFiles.world4BossFireBall, + loop: true, + paused: e.paused, + df: e.df || 1, + x: e.enemy.x, + y: e.enemy.y + 3, + height: 10, + scale: { + x: 1, + y: 1, }, - ), - ]; - } - }, - ), - ], - ), - ]; - }, - }), - Eo = makeSprite({ - init({ props: e, device: t, getContext: a }) { - if (e.justDestroyed) { - const { settings: e } = a(Se); - Ga("audio/levels/enemy/stomped.wav", t, e, 0); - } - return { show: e.justDestroyed }; - }, - render({ props: e, state: t }) { - if (!t.show) return []; - const a = e.giant ? 175 : 175 / 3, - i = e.giant ? 110 : 110 / 3; - return [ - ifConditional( - () => t.show, - () => [ - triggerableSpriteSheet.Single( - { - fileName: - "images/themes/world2/enemy-walker-stomped.png", - columns: 4, - rows: 2, - frameRate: 3, - width: a, - height: i, - y: 2, - onEnd: () => { - t.show = false; - }, - df: e.df, + }, + (t) => { + ((t.scale.x = e.scale || 1), + (t.scale.y = e.scale || 1), + (t.paused = e.paused), + (t.df = e.df || 1), + (t.x = e.enemy.x), + (t.y = + getBlockFallY( + e.enemy.x, + e.enemy.y, + e.inGame && e.inGame.playerX, + e.inGame && e.inGame.fallTypes, + e.inGame && e.inGame.playerDir, + ) + 3)); + }, + ), + ]; + } + }, + ), + ], + ), + ]; + }, + }), + Eo = makeSprite({ + init({ props: e, device: t, getContext: a }) { + if (e.justDestroyed) { + const { settings: e } = a(Se); + Ga("audio/levels/enemy/stomped.wav", t, e, 0); + } + return { show: e.justDestroyed }; + }, + render({ props: e, state: t }) { + if (!t.show) return []; + const a = e.giant ? 175 : 175 / 3, + i = e.giant ? 110 : 110 / 3; + return [ + ifConditional( + () => t.show, + () => [ + triggerableSpriteSheet.Single( + { + fileName: + "images/themes/world2/enemy-walker-stomped.png", + columns: 4, + rows: 2, + frameRate: 3, + width: a, + height: i, + y: 2, + onEnd: () => { + t.show = false; }, - (t) => { - ((t.scaleX = e.enemyDir), (t.df = e.df)); + df: e.df, + }, + (t) => { + ((t.scaleX = e.enemyDir), (t.df = e.df)); + }, + ), + ], + ), + ]; + }, + }), + bo = makeSprite({ + init({ props: e, device: t, getContext: a }) { + if (e.justDestroyed && !e.mute) { + const { settings: e } = a(Se); + Ga("audio/levels/enemy/explosion.wav", t, e, 0); + } + return { show: e.justDestroyed }; + }, + render({ state: e, props: t }) { + const a = t.giant ? 300 : 100; + return [ + ifConditional( + () => e.show, + () => [ + triggerableSpriteSheet.Single( + { + fileName: "images/themes/world2/enemy-explosion.png", + columns: 4, + rows: 2, + frameRate: t.frameRate || 3, + width: a, + height: a, + paused: t.paused, + df: t.df, + onEnd: () => { + e.show = false; }, - ), - ], - ), - ]; - }, - }), - bo = makeSprite({ - init({ props: e, device: t, getContext: a }) { - if (e.justDestroyed && !e.mute) { - const { settings: e } = a(Se); - Ga("audio/levels/enemy/explosion.wav", t, e, 0); - } - return { show: e.justDestroyed }; + }, + (e) => { + ((e.paused = t.paused), (e.df = t.df)); + }, + ), + ], + ), + ]; + }, + }), + So = makeCustomSprite({ + render({ + props: { + width: e, + height: t, + raiseHeight: a, + rad: i, + isPressed: n, + topColour: s, + bottomColour: o, + stroke: r, + sprites: l, + shadowDir: c = "down", }, - render({ state: e, props: t }) { - const a = t.giant ? 300 : 100; + }) { + const d = (null == r ? void 0 : r.thickness) || 0, + u = a - 1; + if ("right" === c) return [ - ifConditional( - () => e.show, - () => [ - triggerableSpriteSheet.Single( - { - fileName: "images/themes/world2/enemy-explosion.png", - columns: 4, - rows: 2, - frameRate: t.frameRate || 3, - width: a, - height: a, - paused: t.paused, - df: t.df, - onEnd: () => { - e.show = false; - }, - }, - (e) => { - ((e.paused = t.paused), (e.df = t.df)); - }, - ), - ], - ), + We({ + width: e - d, + height: t - d - (n ? u : 0), + color: o, + strokeColor: null == r ? void 0 : r.colour, + strokeThickness: d, + rad: i, + y: n ? -u / 2 : 0, + }), + We({ + width: e - 2 * d - a, + height: t - 2 * d - (n ? u : 0), + color: s, + rad: i - d / 2, + x: -a / 2, + y: n ? -u / 2 : 0, + }), + ...(l ? l(n ? -u : 0) : []), ]; - }, - }), - So = makeCustomSprite({ - render({ - props: { - width: e, - height: t, - raiseHeight: a, + const h = a / 2 - (n ? u : 0); + return [ + We({ + width: e - d, + height: t - d - (n ? u : 0), + color: o, + strokeColor: null == r ? void 0 : r.colour, + strokeThickness: d, rad: i, - isPressed: n, - topColour: s, - bottomColour: o, - stroke: r, - sprites: l, - shadowDir: c = "down", - }, - }) { - const d = (null == r ? void 0 : r.thickness) || 0, - u = a - 1; - if ("right" === c) - return [ - We({ - width: e - d, - height: t - d - (n ? u : 0), - color: o, - strokeColor: null == r ? void 0 : r.colour, - strokeThickness: d, - rad: i, - y: n ? -u / 2 : 0, - }), - We({ - width: e - 2 * d - a, - height: t - 2 * d - (n ? u : 0), - color: s, - rad: i - d / 2, - x: -a / 2, - y: n ? -u / 2 : 0, - }), - ...(l ? l(n ? -u : 0) : []), - ]; - const h = a / 2 - (n ? u : 0); - return [ - We({ - width: e - d, - height: t - d - (n ? u : 0), - color: o, - strokeColor: null == r ? void 0 : r.colour, - strokeThickness: d, - rad: i, - y: n ? -u / 2 : 0, - }), - We({ - width: e - 2 * d, - height: t - 2 * d - a, - color: s, - rad: i - d / 2, - y: h, - }), - ...(l ? l(h) : []), - ]; - }, - }), - Io = makeSprite({ - render: ({ props: e }) => [ - onChange( - () => e.topColour, - () => [ - onChange( - () => e.bottomColour, - () => [ - onChange( - () => { - var t; - return null === (t = e.stroke) || void 0 === t - ? void 0 - : t.colour; - }, - () => [ - onChange( - () => e.isPressed, - () => { - const { - width: t, - height: a, - raiseHeight: i, - rad: n, - isPressed: s, - topColour: o, - bottomColour: r, - stroke: l, - sprites: c, - shadowDir: d = "down", - } = e, - u = (null == l ? void 0 : l.thickness) || 0, - h = i - 1; - if ("right" === d) - return [ - qe({ - width: t - u, - height: a - u - (s ? h : 0), - fillColor: r, - color: null == l ? void 0 : l.colour, - thickness: u, - rad: n, - y: s ? -h / 2 : 0, - }), - qe({ - width: t - 2 * u - i, - height: a - 2 * u - (s ? h : 0), - fillColor: o, - rad: n - u / 2, - x: -i / 2, - y: s ? -h / 2 : 0, - }), - ...(c ? c(s ? -h : 0) : []), - ]; - const p = i / 2 - (s ? h : 0); + y: n ? -u / 2 : 0, + }), + We({ + width: e - 2 * d, + height: t - 2 * d - a, + color: s, + rad: i - d / 2, + y: h, + }), + ...(l ? l(h) : []), + ]; + }, + }), + Io = makeSprite({ + render: ({ props: e }) => [ + onChange( + () => e.topColour, + () => [ + onChange( + () => e.bottomColour, + () => [ + onChange( + () => { + var t; + return null === (t = e.stroke) || void 0 === t + ? void 0 + : t.colour; + }, + () => [ + onChange( + () => e.isPressed, + () => { + const { + width: t, + height: a, + raiseHeight: i, + rad: n, + isPressed: s, + topColour: o, + bottomColour: r, + stroke: l, + sprites: c, + shadowDir: d = "down", + } = e, + u = (null == l ? void 0 : l.thickness) || 0, + h = i - 1; + if ("right" === d) return [ qe({ width: t - u, @@ -33941,40 +33893,61 @@ var version = "v1.17.2"; y: s ? -h / 2 : 0, }), qe({ - width: t - 2 * u, - height: a - 2 * u - i, + width: t - 2 * u - i, + height: a - 2 * u - (s ? h : 0), fillColor: o, rad: n - u / 2, - y: p, + x: -i / 2, + y: s ? -h / 2 : 0, }), - ...(c ? c(p) : []), + ...(c ? c(s ? -h : 0) : []), ]; - }, - ), - ], - ), - ], - ), - ], - ), - ], - }), - _o = makeCustomSprite({ - render: ({ - props: { - isFullScreen: fullScreen, - iconName: e, - iconWidth: t, - iconHeight: a, - width: i, - height: n, - noSound: s = false, - disabled: o = false, - testId: testId, - onPress: c, - }, - device: d, - }) => [ + const p = i / 2 - (s ? h : 0); + return [ + qe({ + width: t - u, + height: a - u - (s ? h : 0), + fillColor: r, + color: null == l ? void 0 : l.colour, + thickness: u, + rad: n, + y: s ? -h / 2 : 0, + }), + qe({ + width: t - 2 * u, + height: a - 2 * u - i, + fillColor: o, + rad: n - u / 2, + y: p, + }), + ...(c ? c(p) : []), + ]; + }, + ), + ], + ), + ], + ), + ], + ), + ], + }), + _o = makeCustomSprite({ + render: ({ + props: { + isFullScreen: fullScreen, + iconName: e, + iconWidth: t, + iconHeight: a, + width: i, + height: n, + noSound: s = false, + disabled: o = false, + testId: testId, + onPress: c, + }, + device: d, + }) => [ Clickable({ id: "Clickable", width: i, @@ -33997,103 +33970,107 @@ var version = "v1.17.2"; sprites: (i) => fullScreen ? [ - r({ - testId: testId, - path: [ - [-10, 3], - [-10, 10], - [-3, 10], - ], - width: t, - height: a, - color: Be, - thickness: 3, - lineCap: "round", - y: i, - }), - r({ - testId: testId, - path: [ - [10, 3], - [10, 10], - [3, 10], - ], - width: t, - height: a, - color: Be, - thickness: 3, - lineCap: "round", - y: i, - }), - r({ - testId: testId, - path: [ - [-10, -3], - [-10, -10], - [-3, -10], - ], - width: t, - height: a, - color: Be, - thickness: 3, - lineCap: "round", - y: i, - }), - r({ - testId: testId, - path: [ - [10, -3], - [10, -10], - [3, -10], - ], - width: t, - height: a, - color: Be, - thickness: 3, - lineCap: "round", - y: i, - }), - ] + r({ + testId: testId, + path: [ + [-10, 3], + [-10, 10], + [-3, 10], + ], + width: t, + height: a, + color: Be, + thickness: 3, + lineCap: "round", + y: i, + }), + r({ + testId: testId, + path: [ + [10, 3], + [10, 10], + [3, 10], + ], + width: t, + height: a, + color: Be, + thickness: 3, + lineCap: "round", + y: i, + }), + r({ + testId: testId, + path: [ + [-10, -3], + [-10, -10], + [-3, -10], + ], + width: t, + height: a, + color: Be, + thickness: 3, + lineCap: "round", + y: i, + }), + r({ + testId: testId, + path: [ + [10, -3], + [10, -10], + [3, -10], + ], + width: t, + height: a, + color: Be, + thickness: 3, + lineCap: "round", + y: i, + }), + ] : [ - l({ - testId: testId, - fileName: e, - width: t, - height: a, - y: i, - }), - ], + l({ + testId: testId, + fileName: e, + width: t, + height: a, + y: i, + }), + ], }), ], }), ], - }), - vo = makeCustomSprite({ - render({ props: e }) { - const t = e.large ? 1.2 : 1; - return [ - e.isSelected || e.isOpen - ? We({ width: 45, height: 45, color: e.isOpen ? je : De }) - : null, - _o({ - id: "IconButton", - width: 35 * t, - height: 40 * t, - testId: e.testId, - onPress: e.onPress, - disabled: e.disabled, - noSound: e.noSound, - iconName: e.fileName, - isFullScreen: e.fullScreen, - iconWidth: 25 * t, - iconHeight: 25 * t, - }), - ]; - }, - }), - To = makeSprite({ - render: ({ props: e, getContext }) => [ - conditional( + }), + + vo = makeCustomSprite({ + render({ props: e }) { + if (e.fullScreen) { + return []; + }; + const t = e.large ? 1.2 : 1; + return [ + e.isSelected || e.isOpen + ? We({ width: 45, height: 45, color: e.isOpen ? je : De }) + : null, + _o({ + id: "IconButton", + width: 35 * t, + height: 40 * t, + testId: e.testId, + onPress: e.onPress, + disabled: e.disabled, + noSound: e.noSound, + iconName: e.fileName, + isFullScreen: e.fullScreen, + iconWidth: 25 * t, + iconHeight: 25 * t, + }), + ]; + }, + }), + To = makeSprite({ + render: ({ props: e, getContext }) => [ + conditional( () => e.isInfinite && ["world1", "default", "headphone"].includes(e.skin.fileName), () => [ onChange( @@ -34167,260 +34144,313 @@ var version = "v1.17.2"; ), ], )] - ) - ], - }), - Ro = makeSprite({ - init({ props: e, device: t, getContext: a }) { + ) + ], + }), + Ro = makeSprite({ + init({ props: e, device: t, getContext: a }) { + if (e.isGameSfx) { + const { settings: i } = a(Se); + Ga(e.fileName, t, i, { + loop: e.loop, + fromPosition: e.fromPosition, + overwrite: e.overwrite, + playbackRate: e.df, + }); + } else + t.audio(e.fileName).play({ + loop: e.loop, + fromPosition: e.fromPosition, + overwrite: e.overwrite, + playbackRate: e.df, + }); + return { fileName: e.fileName, paused: false }; + }, + loop({ props: e, state: t, device: a, getContext: i }) { + if (e.paused !== t.paused) { + if (e.paused) + return (a.audio(t.fileName).pause(), void (t.paused = true)); if (e.isGameSfx) { - const { settings: i } = a(Se); - Ga(e.fileName, t, i, { - loop: e.loop, - fromPosition: e.fromPosition, - overwrite: e.overwrite, - playbackRate: e.df, - }); + const { settings: t } = i(Se); + Ga(e.fileName, a, t, { loop: e.loop, playbackRate: e.df }); } else - t.audio(e.fileName).play({ + a.audio(e.fileName).play({ loop: e.loop, - fromPosition: e.fromPosition, - overwrite: e.overwrite, playbackRate: e.df, }); - return { fileName: e.fileName, paused: false }; - }, - loop({ props: e, state: t, device: a, getContext: i }) { - if (e.paused !== t.paused) { - if (e.paused) - return (a.audio(t.fileName).pause(), void (t.paused = true)); - if (e.isGameSfx) { - const { settings: t } = i(Se); - Ga(e.fileName, a, t, { loop: e.loop, playbackRate: e.df }); - } else - a.audio(e.fileName).play({ - loop: e.loop, - playbackRate: e.df, - }); - t.paused = false; - } - }, - render: () => [], - cleanup({ state: e, device: t }) { - t.audio(e.fileName).pause(); - }, - }), - Oo = makeSprite({ - render({ getContext: e, props: t }) { - const { animationAssets: a, animationRenderer: i } = e(Ws), - n = () => 7.5 * (1 - t.playerScaleY); - return [ - conditional( - () => t.jumping, - () => { - return [ - ((e = () => { - t.didJustFinishUsing && t.setDidJustFinishUsing(false); - }), + t.paused = false; + } + }, + render: () => [], + cleanup({ state: e, device: t }) { + t.audio(e.fileName).pause(); + }, + }), + Oo = makeSprite({ + render({ getContext: e, props: t }) { + const { animationAssets: a, animationRenderer: i } = e(Ws), + n = () => 7.5 * (1 - t.playerScaleY); + return [ + conditional( + () => t.jumping, + () => { + return [ + ((e = () => { + t.didJustFinishUsing && t.setDidJustFinishUsing(false); + }), { type: "run", fn: e }), + Hs( + { + id: "SkateboardOllie", + animationAssets: a, + animationRenderer: i, + animationName: "ollie2", + fileNames: Qs.spineFiles.skateboard, + loop: false, + paused: t.paused, + df: t.df, + scale: { x: t.playerDir, y: 1 }, + x: t.powerup.x, + y: n(), + rotation: t.playerRot, + height: 0, + }, + (e) => { + ((e.paused = t.paused), + (e.df = t.df), + (e.scale.x = t.playerDir), + (e.x = t.powerup.x), + (e.y = n()), + (e.rotation = t.playerRot)); + }, + ), + ]; + var e; + }, + () => [ + conditional( + () => t.isUsing, + () => [ Hs( { - id: "SkateboardOllie", + id: "SkateboardGrindEnter", animationAssets: a, animationRenderer: i, - animationName: "ollie2", + animationName: "enter_grinding", fileNames: Qs.spineFiles.skateboard, loop: false, + scale: { x: t.playerDir, y: 1 }, paused: t.paused, df: t.df, - scale: { x: t.playerDir, y: 1 }, x: t.powerup.x, y: n(), - rotation: t.playerRot, height: 0, }, (e) => { - ((e.paused = t.paused), + ((e.scale.x = t.playerDir), + (e.paused = t.paused), (e.df = t.df), - (e.scale.x = t.playerDir), (e.x = t.powerup.x), - (e.y = n()), - (e.rotation = t.playerRot)); + (e.y = n())); }, ), - ]; - var e; - }, - () => [ - conditional( - () => t.isUsing, - () => [ - Hs( - { - id: "SkateboardGrindEnter", - animationAssets: a, - animationRenderer: i, - animationName: "enter_grinding", - fileNames: Qs.spineFiles.skateboard, - loop: false, - scale: { x: t.playerDir, y: 1 }, - paused: t.paused, - df: t.df, - x: t.powerup.x, - y: n(), - height: 0, - }, - (e) => { - ((e.scale.x = t.playerDir), - (e.paused = t.paused), - (e.df = t.df), - (e.x = t.powerup.x), - (e.y = n())); - }, - ), - Ro.Single( - { - fileName: "audio/levels/skateboard/grind.wav", - paused: t.paused, - loop: true, - isGameSfx: true, - }, - (e) => { - ((e.paused = t.paused), (e.df = t.df)); - }, - ), - ], - () => [ - conditional( - () => t.didJustFinishUsing, - () => [ - Hs( - { - id: "SkateboardGrindExit", - animationAssets: a, - animationRenderer: i, - animationName: "leave_grinding", - fileNames: Qs.spineFiles.skateboard, - loop: false, - scale: { x: t.playerDir, y: 1 }, - paused: t.paused, - df: t.df, - x: t.powerup.x, - y: n(), - height: 0, - onEnd: () => { - t.setDidJustFinishUsing(false); - }, - }, - (e) => { - ((e.scale.x = t.playerDir), - (e.paused = t.paused), - (e.df = t.df), - (e.x = t.powerup.x), - (e.y = n())); - }, - ), - ], - () => [ - Hs( - { - id: "SkateboardMove", - animationAssets: a, - animationRenderer: i, - animationName: "move", - fileNames: Qs.spineFiles.skateboard, - loop: true, - paused: t.paused, - df: t.df, - scale: { x: t.playerDir, y: 1 }, - x: t.powerup.x, - y: n(), - rotation: t.playerRot, - height: 0, - }, - (e) => { - ((e.paused = t.paused), - (e.df = t.df), - (e.scale.x = t.playerDir), - (e.x = t.powerup.x), - (e.y = n()), - (e.rotation = t.playerRot)); - }, - ), - ifConditional( - () => t.playerIsOnGround, - () => [ - Ro.Single( - { - fileName: - "audio/levels/skateboard/move.wav", - paused: t.paused, - loop: true, - isGameSfx: true, - }, - (e) => { - ((e.paused = t.paused), (e.df = t.df)); - }, - ), - ], - ), - ], - ), - ], - ), - ], - ), - ]; - }, - }), - Co = makeSprite({ - render: ({ props: e, getContext: t }) => [ - onChange( - () => e.powerup.item, - () => { - switch (e.powerup.item) { - case "doubleJump": - return [ - conditional( - () => e.theme == "world2", - () => [ - loopingSpriteSheet.Single( - { - fileName: - "images/themes/world2/double-jump.png", - columns: 4, - rows: 2, - frameRate: 6, - width: 30, - height: 30, - frame: e.frame || 0, - }, - (t) => { - ((t.x = e.powerup.x), - (t.y = getBlockFallY( - e.powerup.x, - e.powerup.y, - e.inGame && e.inGame.playerX, - e.inGame && e.inGame.fallTypes, - e.inGame && e.inGame.playerDir, - )), - (t.frame = e.frame || 0)); + Ro.Single( + { + fileName: "audio/levels/skateboard/grind.wav", + paused: t.paused, + loop: true, + isGameSfx: true, + }, + (e) => { + ((e.paused = t.paused), (e.df = t.df)); + }, + ), + ], + () => [ + conditional( + () => t.didJustFinishUsing, + () => [ + Hs( + { + id: "SkateboardGrindExit", + animationAssets: a, + animationRenderer: i, + animationName: "leave_grinding", + fileNames: Qs.spineFiles.skateboard, + loop: false, + scale: { x: t.playerDir, y: 1 }, + paused: t.paused, + df: t.df, + x: t.powerup.x, + y: n(), + height: 0, + onEnd: () => { + t.setDidJustFinishUsing(false); }, - ), - ], + }, + (e) => { + ((e.scale.x = t.playerDir), + (e.paused = t.paused), + (e.df = t.df), + (e.x = t.powerup.x), + (e.y = n())); + }, + ), + ], + () => [ + Hs( + { + id: "SkateboardMove", + animationAssets: a, + animationRenderer: i, + animationName: "move", + fileNames: Qs.spineFiles.skateboard, + loop: true, + paused: t.paused, + df: t.df, + scale: { x: t.playerDir, y: 1 }, + x: t.powerup.x, + y: n(), + rotation: t.playerRot, + height: 0, + }, + (e) => { + ((e.paused = t.paused), + (e.df = t.df), + (e.scale.x = t.playerDir), + (e.x = t.powerup.x), + (e.y = n()), + (e.rotation = t.playerRot)); + }, + ), + ifConditional( + () => t.playerIsOnGround, + () => [ + Ro.Single( + { + fileName: + "audio/levels/skateboard/move.wav", + paused: t.paused, + loop: true, + isGameSfx: true, + }, + (e) => { + ((e.paused = t.paused), (e.df = t.df)); + }, + ), + ], + ), + ], + ), + ], + ), + ], + ), + ]; + }, + }), + Co = makeSprite({ + render: ({ props: e, getContext: t }) => [ + onChange( + () => e.powerup.item, + () => { + switch (e.powerup.item) { + case "doubleJump": + return [ + conditional( + () => e.theme == "world2", + () => [ + loopingSpriteSheet.Single( + { + fileName: + "images/themes/world2/double-jump.png", + columns: 4, + rows: 2, + frameRate: 6, + width: 30, + height: 30, + frame: e.frame || 0, + }, + (t) => { + ((t.x = e.powerup.x), + (t.y = getBlockFallY( + e.powerup.x, + e.powerup.y, + e.inGame && e.inGame.playerX, + e.inGame && e.inGame.fallTypes, + e.inGame && e.inGame.playerDir, + )), + (t.frame = e.frame || 0)); + }, + ), + ], - () => [ - conditional( - () => void 0 !== e.isEditor && !e.spineContext, - () => [ - y( + () => [ + conditional( + () => void 0 !== e.isEditor && !e.spineContext, + () => [ + y( + { + fileName: + "images/editor/editorOnly/double-jump.png", + width: 29, + height: 32, + }, + (t) => { + ((t.x = e.powerup.x), + (t.y = getBlockFallY( + e.powerup.x, + e.powerup.y, + e.inGame && e.inGame.playerX, + e.inGame && e.inGame.fallTypes, + e.inGame && e.inGame.playerDir, + ))); + }, + ), + ], + () => { + var a; + const { + animationAssets: i, + animationRenderer: n, + } = e.spineContext || t(Ws); + return [ + Hs( { - fileName: - "images/editor/editorOnly/double-jump.png", - width: 29, - height: 32, + id: "DoubleJump", + animationAssets: i, + animationRenderer: n, + animationName: "animation", + fileNames: Qs.spineFiles.doubleJump, + loop: true, + paused: e.paused || false, + df: + null !== (a = e.df) && void 0 !== a + ? a + : 1, + x: e.powerup.x, + y: getBlockFallY( + e.powerup.x, + e.powerup.y, + e.inGame && e.inGame.playerX, + e.inGame && e.inGame.fallTypes, + e.inGame && e.inGame.playerDir, + ), + height: 5, + startFromFrame: e.paused ? 7 : 0, }, (t) => { - ((t.x = e.powerup.x), + var a; + ((t.scale = { + x: e.scale || 1, + y: e.scale || 1, + }), + (t.paused = e.paused || false), + (t.df = + null !== (a = e.df) && void 0 !== a + ? a + : 1), + (t.x = e.powerup.x), (t.y = getBlockFallY( e.powerup.x, e.powerup.y, @@ -34430,183 +34460,50 @@ var version = "v1.17.2"; ))); }, ), - ], - () => { - var a; - const { - animationAssets: i, - animationRenderer: n, - } = e.spineContext || t(Ws); - return [ - Hs( - { - id: "DoubleJump", - animationAssets: i, - animationRenderer: n, - animationName: "animation", - fileNames: Qs.spineFiles.doubleJump, - loop: true, - paused: e.paused || false, - df: - null !== (a = e.df) && void 0 !== a - ? a - : 1, - x: e.powerup.x, - y: getBlockFallY( - e.powerup.x, - e.powerup.y, - e.inGame && e.inGame.playerX, - e.inGame && e.inGame.fallTypes, - e.inGame && e.inGame.playerDir, - ), - height: 5, - startFromFrame: e.paused ? 7 : 0, - }, - (t) => { - var a; - ((t.scale = { - x: e.scale || 1, - y: e.scale || 1, - }), - (t.paused = e.paused || false), - (t.df = - null !== (a = e.df) && void 0 !== a - ? a - : 1), - (t.x = e.powerup.x), - (t.y = getBlockFallY( - e.powerup.x, - e.powerup.y, - e.inGame && e.inGame.playerX, - e.inGame && e.inGame.fallTypes, - e.inGame && e.inGame.playerDir, - ))); - }, - ), - ]; - }, - ), - ], - ), - ]; - case "punch": - return [ - loopingSpriteSheet.Single( - { - fileName: "images/themes/punch/ground.png", - columns: 4, - rows: 2, - frameRate: 6, - width: 35, - height: 35, - frame: e.frame || 0, - }, - (t) => { - ((t.x = e.powerup.x), - (t.y = getBlockFallY( - e.powerup.x, - e.powerup.y, - e.inGame && e.inGame.playerX, - e.inGame && e.inGame.fallTypes, - e.inGame && e.inGame.playerDir, - )), - (t.frame = e.frame || 0)); - }, - ), - ]; - case "drill": - return [ - loopingSpriteSheet.Single( - { - fileName: "images/themes/world2/drill/ground.png", - columns: 4, - rows: 2, - frameRate: 6, - width: 35, - height: 35, - frame: e.frame || 0, - }, - (t) => { - ((t.x = e.powerup.x), - (t.y = getBlockFallY( - e.powerup.x, - e.powerup.y, - e.inGame && e.inGame.playerX, - e.inGame && e.inGame.fallTypes, - e.inGame && e.inGame.playerDir, - )), - (t.frame = e.frame || 0)); - }, - ), - ]; - case "gun": - return [ - loopingSpriteSheet.Single( - { - fileName: "images/themes/world2/gun/ground.png", - columns: 4, - rows: 2, - frameRate: 6, - width: 100 / 3, - height: 100 / 3, - frame: e.frame || 0, - }, - (t) => { - ((t.x = e.powerup.x), - (t.y = getBlockFallY( - e.powerup.x, - e.powerup.y, - e.inGame && e.inGame.playerX, - e.inGame && e.inGame.fallTypes, - e.inGame && e.inGame.playerDir, - )), - (t.frame = e.frame || 0)); - }, - ), - ]; - case "jetpack": - return [ - loopingSpriteSheet.Single( - { - fileName: "images/themes/world2/jetpack/ground.png", - columns: 4, - rows: 2, - frameRate: 6, - width: 100 / 3, - height: 35, - frame: e.frame || 0, - }, - (t) => { - ((t.x = e.powerup.x), - (t.y = getBlockFallY( - e.powerup.x, - e.powerup.y, - e.inGame && e.inGame.playerX, - e.inGame && e.inGame.fallTypes, - e.inGame && e.inGame.playerDir, - )), - (t.frame = e.frame || 0)); - }, - ), - ]; - case "playerStack": - return [ - To.Single({ skin: e.skin }, (t) => { + ]; + }, + ), + ], + ), + ]; + case "punch": + return [ + loopingSpriteSheet.Single( + { + fileName: "images/themes/punch/ground.png", + columns: 4, + rows: 2, + frameRate: 6, + width: 35, + height: 35, + frame: e.frame || 0, + }, + (t) => { ((t.x = e.powerup.x), - (t.isInfinite = false), - (t.bgColor = e.bgColor), (t.y = getBlockFallY( e.powerup.x, e.powerup.y, e.inGame && e.inGame.playerX, e.inGame && e.inGame.fallTypes, e.inGame && e.inGame.playerDir, - ))); - }), - ]; - case "ghost": - return [ - To.Single({ skin: e.skin }, (t) => { + )), + (t.frame = e.frame || 0)); + }, + ), + ]; + case "drill": + return [ + loopingSpriteSheet.Single( + { + fileName: "images/themes/world2/drill/ground.png", + columns: 4, + rows: 2, + frameRate: 6, + width: 35, + height: 35, + frame: e.frame || 0, + }, + (t) => { ((t.x = e.powerup.x), (t.y = getBlockFallY( e.powerup.x, @@ -34615,1281 +34512,1364 @@ var version = "v1.17.2"; e.inGame && e.inGame.fallTypes, e.inGame && e.inGame.playerDir, )), - (t.isInfinite = false), - (t.bgColor = e.bgColor), - (t.opacity = 0.5)); - }), - ]; - case "spaceship": - return [ - y( - { - fileName: "images/themes/world3/player-ship.png", - width: 40, - height: 30, - }, - (t) => { - ((t.x = e.powerup.x), (t.y = e.powerup.y)); - }, - ), - ]; - case "skateboard": - return [ - y( - { - fileName: "images/themes/skater/skateboard.png", - width: 37, - height: 9, - }, - (t) => { - ((t.x = e.powerup.x), - (t.y = - getBlockFallY( - e.powerup.x, - e.powerup.y, - e.inGame && e.inGame.playerX, - e.inGame && e.inGame.fallTypes, - e.inGame && e.inGame.playerDir, - ) - - e.powerup.height / 2 + - 5)); - }, - ), - ]; + (t.frame = e.frame || 0)); + }, + ), + ]; + case "gun": + return [ + loopingSpriteSheet.Single( + { + fileName: "images/themes/world2/gun/ground.png", + columns: 4, + rows: 2, + frameRate: 6, + width: 100 / 3, + height: 100 / 3, + frame: e.frame || 0, + }, + (t) => { + ((t.x = e.powerup.x), + (t.y = getBlockFallY( + e.powerup.x, + e.powerup.y, + e.inGame && e.inGame.playerX, + e.inGame && e.inGame.fallTypes, + e.inGame && e.inGame.playerDir, + )), + (t.frame = e.frame || 0)); + }, + ), + ]; + case "jetpack": + return [ + loopingSpriteSheet.Single( + { + fileName: "images/themes/world2/jetpack/ground.png", + columns: 4, + rows: 2, + frameRate: 6, + width: 100 / 3, + height: 35, + frame: e.frame || 0, + }, + (t) => { + ((t.x = e.powerup.x), + (t.y = getBlockFallY( + e.powerup.x, + e.powerup.y, + e.inGame && e.inGame.playerX, + e.inGame && e.inGame.fallTypes, + e.inGame && e.inGame.playerDir, + )), + (t.frame = e.frame || 0)); + }, + ), + ]; + case "playerStack": + return [ + To.Single({ skin: e.skin }, (t) => { + ((t.x = e.powerup.x), + (t.isInfinite = false), + (t.bgColor = e.bgColor), + (t.y = getBlockFallY( + e.powerup.x, + e.powerup.y, + e.inGame && e.inGame.playerX, + e.inGame && e.inGame.fallTypes, + e.inGame && e.inGame.playerDir, + ))); + }), + ]; + case "ghost": + return [ + To.Single({ skin: e.skin }, (t) => { + ((t.x = e.powerup.x), + (t.y = getBlockFallY( + e.powerup.x, + e.powerup.y, + e.inGame && e.inGame.playerX, + e.inGame && e.inGame.fallTypes, + e.inGame && e.inGame.playerDir, + )), + (t.isInfinite = false), + (t.bgColor = e.bgColor), + (t.opacity = 0.5)); + }), + ]; + case "spaceship": + return [ + y( + { + fileName: "images/themes/world3/player-ship.png", + width: 40, + height: 30, + }, + (t) => { + ((t.x = e.powerup.x), (t.y = e.powerup.y)); + }, + ), + ]; + case "skateboard": + return [ + y( + { + fileName: "images/themes/skater/skateboard.png", + width: 37, + height: 9, + }, + (t) => { + ((t.x = e.powerup.x), + (t.y = + getBlockFallY( + e.powerup.x, + e.powerup.y, + e.inGame && e.inGame.playerX, + e.inGame && e.inGame.fallTypes, + e.inGame && e.inGame.playerDir, + ) - + e.powerup.height / 2 + + 5)); + }, + ), + ]; + } + }, + ), + ], + }), + wo = makeSprite({ + render: ({ props: e, getContext: t }) => [ + onChange( + () => e.powerup && e.powerup.item, + () => { + if (!e.powerup) { + return []; + } + switch (e.powerup.item) { + case "doubleJump": { + const { animationAssets: a, animationRenderer: i } = + t(Ws); + return [ + Hs( + { + id: "DoubleJump", + animationAssets: a, + animationRenderer: i, + animationName: "on_Player", + fileNames: Qs.spineFiles.doubleJumpOnPlayer, + loop: true, + paused: e.paused, + df: e.df, + x: e.powerup.x, + y: e.powerup.y + 60, + height: e.powerup.height, + }, + (t) => { + ((t.paused = e.paused), + (t.df = e.df), + (t.x = e.powerup.x), + (t.y = e.powerup.y + 60), + (t.height = e.powerup.height)); + }, + ), + ]; } - }, - ), - ], - }), - wo = makeSprite({ - render: ({ props: e, getContext: t }) => [ - onChange( - () => e.powerup && e.powerup.item, - () => { - if (!e.powerup) { + case "drill": + return [ + y( + { + fileName: "images/themes/world2/drill/idle.png", + width: 80, + height: 80, + }, + (t) => { + ((t.x = e.powerup.x), (t.y = e.powerup.y)); + }, + ), + ]; + case "punch": + return [ + y( + { + fileName: "images/themes/punch/idle.png", + width: 80, + height: 80, + }, + (t) => { + ((t.x = e.powerup.x), (t.y = e.powerup.y)); + }, + ), + ]; + case "gun": + return [ + y( + { + fileName: "images/themes/world2/gun/idle.png", + width: 90, + height: 90, + }, + (t) => { + ((t.x = e.powerup.x), (t.y = e.powerup.y)); + }, + ), + ]; + case "jetpack": + return [ + y( + { + fileName: "images/themes/world2/jetpack/front.png", + width: 34, + height: 32 / 3, + }, + (t) => { + ((t.x = e.powerup.x), + (t.y = e.powerup.y), + (t.rotation = e.isUsing ? e.playerRot : 0)); + }, + ), + ]; + case "playerStack": + case "skateboard": + case "ghost": + case "spaceship": return []; - } - switch (e.powerup.item) { - case "doubleJump": { - const { animationAssets: a, animationRenderer: i } = - t(Ws); - return [ - Hs( - { - id: "DoubleJump", - animationAssets: a, - animationRenderer: i, - animationName: "on_Player", - fileNames: Qs.spineFiles.doubleJumpOnPlayer, - loop: true, - paused: e.paused, - df: e.df, - x: e.powerup.x, - y: e.powerup.y + 60, - height: e.powerup.height, - }, - (t) => { - ((t.paused = e.paused), - (t.df = e.df), - (t.x = e.powerup.x), - (t.y = e.powerup.y + 60), - (t.height = e.powerup.height)); - }, - ), - ]; - } - case "drill": - return [ - y( - { - fileName: "images/themes/world2/drill/idle.png", - width: 80, - height: 80, - }, - (t) => { - ((t.x = e.powerup.x), (t.y = e.powerup.y)); - }, + } + }, + ), + ], + }), + Ao = makeSprite({ + init: () => ({ + didJustStartUsing: true, + didJustFinishUsing: false, + }), + loop({ props: e, state: t }) { + e.isUsing || t.didJustStartUsing + ? e.isUsing && + !t.didJustFinishUsing && + (t.didJustFinishUsing = true) + : (t.didJustStartUsing = true); + }, + render: ({ props: e, state: t }) => [ + onChange( + () => e.isJetpack !== e.isSkating, + () => { + let t = []; + switch (e.isJetpack ? "jetpack" : "") { + case "jetpack": + t = [ + conditional( + () => e.isUsing, + () => [ + Ro.Single( + { + fileName: "audio/levels/jetpack/loop.wav", + paused: e.paused, + loop: true, + isGameSfx: true, + }, + (t) => { + ((t.paused = e.paused), (t.df = e.df)); + }, + ), + conditional( + () => !t.didJustStartUsing, + () => [ + loopingSpriteSheet.Single( + { + fileName: + "images/themes/world2/jetpack/back-on.png", + columns: 4, + rows: 2, + frameRate: 3, + width: 73, + height: 110, + frame: e.frame, + }, + (t) => { + ((t.x = e.powerup.x), + (t.y = e.powerup.y), + (t.frame = e.frame), + (t.rotation = e.playerRot)); + }, + ), + ], + () => [ + triggerableSpriteSheet.Single( + { + fileName: + "images/themes/world2/jetpack/back-launch.png", + columns: 3, + rows: 1, + frameRate: 3, + width: 73, + height: 110, + onEnd: () => { + t.didJustFinishUsing = false; + }, + df: e.df, + }, + (t) => { + ((t.x = e.powerup.x), + (t.y = e.powerup.y), + (t.rotation = e.playerRot), + (t.df = e.df)); + }, + ), + ], + ), + ], + () => [ + y( + { + fileName: + "images/themes/world2/jetpack/back.png", + width: 73, + height: 110, + }, + (t) => { + ((t.x = e.powerup.x), + (t.y = e.powerup.y), + (t.rotation = e.playerRot)); + }, + ), + ], + ), + loopingSpriteSheet.Single( + { + fileName: "images/themes/world2/jetpack/gauge.png", + columns: 4, + rows: 2, + frameRate: 1, + width: 73, + height: 110, + frame: 0, + }, + (t) => { + ((t.x = e.powerup.x), + (t.y = e.powerup.y), + (t.rotation = e.playerRot), + (t.frame = Math.floor( + 4.1 * (1 - e.jetpackFuel / $.maxJetpackFuel), + ))); + }, + ), + ]; + break; + case "skateboard": + t = []; + break; + default: + t = []; + break; + } + e.isSkating && + t.push( + ifConditional( + () => !e.crashed, + () => [ + Oo.Single( + { + powerup: e.powerup, + isUsing: e.isUsing, + playerRot: e.playerRot, + playerDir: e.playerDir, + playerScaleY: e.playerScaleY, + paused: e.paused, + df: e.df, + jumping: e.jumping, + playerIsOnGround: e.playerIsOnGround, + didJustFinishUsing: t.didJustFinishUsing, + setDidJustFinishUsing: (e) => { + t.didJustFinishUsing = e; + }, + }, + (a) => { + ((a.powerup = e.powerup), + (a.isUsing = e.isUsing), + (a.playerRot = e.playerRot), + (a.playerDir = e.playerDir), + (a.playerScaleY = e.playerScaleY), + (a.paused = e.paused), + (a.df = e.df), + (a.jumping = e.jumping), + (a.playerIsOnGround = e.playerIsOnGround), + (a.didJustFinishUsing = t.didJustFinishUsing)); + }, ), - ]; - case "punch": + ], + ), + ); + return t; + }, + ), + ], + }), + ko = makeSprite({ + render({ props: e, getContext: t }) { + switch (e.powerup.item) { + case "doubleJump": + const { animationAssets: a, animationRenderer: i } = t(Ws); + return [ + Hs( + { + id: "DoubleJump", + animationAssets: a, + animationRenderer: i, + animationName: "on_PlayerUse_FadeOut", + fileNames: Qs.spineFiles.doubleJumpOnPlayer, + loop: false, + paused: e.paused, + df: e.df, + x: e.powerup.x, + y: e.powerup.y + 60, + height: e.powerup.height, + }, + (t) => { + ((t.paused = e.paused), + (t.df = e.df), + (t.x = e.powerup.x), + (t.y = e.powerup.y + 60), + (t.height = e.powerup.height)); + }, + ), + ]; + case "punch": + return [ + triggerableSpriteSheet.Single( + { + fileName: "images/themes/punch/punch.png", + columns: 2, + rows: 3, + frameRate: 3, + width: 170, + height: 97, + df: e.df, + hideOnEnd: true, + }, + (t) => { + ((t.x = e.powerup.x), + (t.y = e.powerup.y), + (t.df = e.df)); + }, + ), + ]; + case "drill": + return [ + triggerableSpriteSheet.Single( + { + fileName: "images/themes/punch/punch.png", + columns: 2, + rows: 3, + frameRate: 3, + width: 170, + height: 97, + df: e.df, + hideOnEnd: true, + rotation: 90, + }, + (t) => { + ((t.x = e.powerup.x), + (t.y = e.powerup.y + 30), + (t.df = e.df)); + }, + ), + ]; + case "gun": + return [ + triggerableSpriteSheet.Single( + { + fileName: "images/themes/world2/gun/shooting.png", + columns: 3, + rows: 2, + frameRate: 3, + width: 90, + height: 90, + df: e.df, + }, + (t) => { + ((t.x = e.powerup.x), + (t.y = e.powerup.y), + (t.df = e.df)); + }, + ), + ]; + case "jetpack": + return [ + triggerableSpriteSheet.Single( + { + fileName: "images/themes/world2/jetpack/front-out.png", + columns: 4, + rows: 1, + frameRate: 3, + width: 73, + height: 110, + hideOnEnd: true, + df: e.df, + }, + (t) => { + ((t.x = e.powerup.x), + (t.y = e.powerup.y), + (t.rotation = e.playerRot * e.playerDir), + (t.df = e.df)); + }, + ), + ]; + case "playerStack": + case "skateboard": + case "ghost": + case "spaceship": + return []; + } + }, + }), + No = makeSprite({ + render: ({ props: e }) => + "jetpack" === e.powerup.item + ? [ + triggerableSpriteSheet.Single( + { + fileName: "images/themes/world2/jetpack/back-out.png", + columns: 4, + rows: 1, + frameRate: 3, + width: 73, + height: 110, + hideOnEnd: true, + df: e.df, + }, + (t) => { + ((t.x = e.powerup.x), + (t.y = e.powerup.y), + (t.rotation = e.playerRot * (e.playerDir || 0)), + (t.df = e.df)); + }, + ), + ] + : [], + }), + xo = makeSprite({ + init: () => ({ justHitTimer: 0 }), + loop({ props: e, state: t }) { + (e.justHit && (t.justHitTimer = 60), + t.justHitTimer > 0 && t.justHitTimer--); + }, + render: ({ props: e, getContext: t, state: a }) => [ + onChange( + () => e.switchButton.affects, + () => { + switch (e.switchButton.affects) { + case "gravity": + return [ + onChange( + () => e.theme, + () => [ + conditional( + () => e.switchButton.gravity < 2, + () => [ + y( + { + fileName: `images/themes/${e.theme.includes("infinite") ? e.theme : e.theme == "world2" ? "world2" : "world1"}/arrow.png`, + width: e.switchButton.width, + height: e.switchButton.height, + }, + (t) => { + let time = 60 - a.justHitTimer; + let scale = + (time > 5 ? Math.max(5 - (time - 5), 0) : time) / + 7; + ((t.scaleX = 1 + scale), + (t.scaleY = 1 + scale), + (t.x = e.switchButton.x), + (t.y = getBlockFallY( + e.switchButton.x, + e.switchButton.y, + e.inGame && e.inGame.playerX, + e.inGame && e.inGame.fallTypes, + e.inGame && e.inGame.playerDir, + )), + (t.rotation = + e.switchButton.gravity == 0 + ? e.playerDir < 0 + ? -90 + : 90 + : e.switchButton.gravity > 0 + ? 180 + : 0)); + }, + ) + ], + () => [ + y( + { + fileName: `images/themes/${e.theme.includes("infinite") ? e.theme : e.orbTheme == "classic" ? "classic" : "world1"}/doubleJump.png`, + width: e.switchButton.width, + height: e.switchButton.height, + }, + (t) => { + let time = 60 - a.justHitTimer; + let scale = + (time > 5 ? Math.max(5 - (time - 5), 0) : time) / + 7; + ((t.scaleX = 1 + scale), + (t.scaleY = 1 + scale), + (t.x = e.switchButton.x), + (t.y = getBlockFallY( + e.switchButton.x, + e.switchButton.y, + e.inGame && e.inGame.playerX, + e.inGame && e.inGame.fallTypes, + e.inGame && e.inGame.playerDir, + ))); + }, + ) + ] + ) + ] + ), + ]; + case "color": + if (e.isEditor) { return [ y( { - fileName: "images/themes/punch/idle.png", - width: 80, - height: 80, + fileName: + "images/editor/editorOnly/color-button.png", + width: e.switchButton.width, + height: e.switchButton.height, }, (t) => { - ((t.x = e.powerup.x), (t.y = e.powerup.y)); + ((t.x = e.switchButton.x), + (t.y = getBlockFallY( + e.switchButton.x, + e.switchButton.y, + e.inGame && e.inGame.playerX, + e.inGame && e.inGame.fallTypes, + e.inGame && e.inGame.playerDir, + ))); }, ), ]; - case "gun": + } + return []; + case "falling": + if (e.isEditor) { return [ y( { - fileName: "images/themes/world2/gun/idle.png", - width: 90, - height: 90, + fileName: + "images/editor/editorOnly/falling-button.png", + width: e.switchButton.width, + height: e.switchButton.height, }, (t) => { - ((t.x = e.powerup.x), (t.y = e.powerup.y)); + let both = + e.switchButton.up && e.switchButton.down, + none = + !e.switchButton.up && !e.switchButton.down; + ((t.x = e.switchButton.x), + (t.y = getBlockFallY( + e.switchButton.x, + e.switchButton.y, + e.inGame && e.inGame.playerX, + e.inGame && e.inGame.fallTypes, + e.inGame && e.inGame.playerDir, + )), + (t.scaleY = + e.switchButton.up && !both ? -1 : 1), + (t.fileName = both + ? "images/editor/editorOnly/falling-up-down.png" + : none + ? "images/editor/editorOnly/falling-none.png" + : "images/editor/editorOnly/falling-button.png")); }, ), ]; - case "jetpack": + } + return []; + case "size": + if (e.isEditor && !e.spineContext) return [ y( { - fileName: "images/themes/world2/jetpack/front.png", - width: 34, - height: 32 / 3, + fileName: + "images/editor/editorOnly/size-button.png", + width: e.switchButton.width, + height: e.switchButton.height, }, (t) => { - ((t.x = e.powerup.x), - (t.y = e.powerup.y), - (t.rotation = e.isUsing ? e.playerRot : 0)); + ((t.x = e.switchButton.x), + (t.y = getBlockFallY( + e.switchButton.x, + e.switchButton.y, + e.inGame && e.inGame.playerX, + e.inGame && e.inGame.fallTypes, + e.inGame && e.inGame.playerDir, + ))); }, ), ]; - case "playerStack": - case "skateboard": - case "ghost": - case "spaceship": - return []; - } - }, - ), - ], - }), - Ao = makeSprite({ - init: () => ({ - didJustStartUsing: true, - didJustFinishUsing: false, - }), - loop({ props: e, state: t }) { - e.isUsing || t.didJustStartUsing - ? e.isUsing && - !t.didJustFinishUsing && - (t.didJustFinishUsing = true) - : (t.didJustStartUsing = true); - }, - render: ({ props: e, state: t }) => [ - onChange( - () => e.isJetpack !== e.isSkating, - () => { - let t = []; - switch (e.isJetpack ? "jetpack" : "") { - case "jetpack": - t = [ - conditional( - () => e.isUsing, - () => [ - Ro.Single( + const { animationAssets: i, animationRenderer: n } = + e.spineContext || t(Ws); + return [ + onChange( + () => e.playerScale, + () => { + var t; + return [ + Hs( { - fileName: "audio/levels/jetpack/loop.wav", - paused: e.paused, - loop: true, - isGameSfx: true, + id: "Size", + animationAssets: i, + animationRenderer: n, + fileNames: Qs.spineFiles.sizeButton, + animationName: + e.playerScale === 1 + ? "switch_1" + : "switch_2", + loop: false, + paused: e.paused || false, + startFromFrame: a.justHitTimer > 0 ? 0 : 400, + height: 0, + x: e.switchButton.x, + y: getBlockFallY( + e.switchButton.x, + e.switchButton.y, + e.inGame && e.inGame.playerX, + e.inGame && e.inGame.fallTypes, + e.inGame && e.inGame.playerDir, + ), + df: + a.justHitTimer > 0 + ? 1.5 * + (null !== (t = e.df) && void 0 !== t + ? t + : 1) + : 0, }, (t) => { - ((t.paused = e.paused), (t.df = e.df)); + var i; + ((t.scale = { + x: e.scale || 1, + y: e.scale || 1, + }), + (t.x = e.switchButton.x), + (t.y = getBlockFallY( + e.switchButton.x, + e.switchButton.y, + e.inGame && e.inGame.playerX, + e.inGame && e.inGame.fallTypes, + e.inGame && e.inGame.playerDir, + )), + (t.paused = e.paused || false), + (t.df = + a.justHitTimer > 0 + ? 1.5 * + (null !== (i = e.df) && void 0 !== i + ? i + : 1) + : 0)); }, ), - conditional( - () => !t.didJustStartUsing, - () => [ - loopingSpriteSheet.Single( - { - fileName: - "images/themes/world2/jetpack/back-on.png", - columns: 4, - rows: 2, - frameRate: 3, - width: 73, - height: 110, - frame: e.frame, - }, - (t) => { - ((t.x = e.powerup.x), - (t.y = e.powerup.y), - (t.frame = e.frame), - (t.rotation = e.playerRot)); - }, - ), - ], - () => [ - triggerableSpriteSheet.Single( - { - fileName: - "images/themes/world2/jetpack/back-launch.png", - columns: 3, - rows: 1, - frameRate: 3, - width: 73, - height: 110, - onEnd: () => { - t.didJustFinishUsing = false; - }, - df: e.df, - }, - (t) => { - ((t.x = e.powerup.x), - (t.y = e.powerup.y), - (t.rotation = e.playerRot), - (t.df = e.df)); - }, - ), - ], - ), - ], + ]; + }, + ), + ]; + case "movement": + return [ + y( + { + fileName: `images/themes/${e.theme.split("/")[0]}/switch-button.png`, + width: 32, + height: 32, + }, + (t) => { + ((t.x = e.switchButton.x), + (t.y = getBlockFallY( + e.switchButton.x, + e.switchButton.y, + e.inGame && e.inGame.playerX, + e.inGame && e.inGame.fallTypes, + e.inGame && e.inGame.playerDir, + )), + (t.rotation = e.switchRotation)); + }, + ), + ]; + case "blockSpike": { + if (false) { + //e.theme == "world2") { + return [ + onChange( + () => a.justHitTimer, () => [ - y( + triggerableSpriteSheet.Single( { fileName: - "images/themes/world2/jetpack/back.png", - width: 73, - height: 110, + "images/themes/world2/block-spike-switch.png", + columns: 4, + rows: 2, + frameRate: 3, + width: 30 * 0.9, + height: 30 * 0.9, + hideOnEnd: true, + maxFrame: 9, + df: + a.justHitTimer > 0 + ? 1.5 * + (null !== (t = e.df) && void 0 !== t + ? t + : 1) + : 0, }, (t) => { - ((t.x = e.powerup.x), - (t.y = e.powerup.y), - (t.rotation = e.playerRot)); + ((t.x = e.switchButton.x), + (t.y = e.switchButton.y), + (t.df = + a.justHitTimer > 0 + ? 1.5 * + (null !== (t = e.df) && void 0 !== t + ? t + : 1) + : 0)); }, ), ], ), - loopingSpriteSheet.Single( + ]; + } + if (e.isEditor && !e.spineContext) + return [ + y( { - fileName: "images/themes/world2/jetpack/gauge.png", - columns: 4, - rows: 2, - frameRate: 1, - width: 73, - height: 110, - frame: 0, + fileName: + "images/editor/editorOnly/block-switch-button.png", + width: e.switchButton.width, + height: e.switchButton.height, }, (t) => { - ((t.x = e.powerup.x), - (t.y = e.powerup.y), - (t.rotation = e.playerRot), - (t.frame = Math.floor( - 4.1 * (1 - e.jetpackFuel / $.maxJetpackFuel), + ((t.x = e.switchButton.x), + (t.y = getBlockFallY( + e.switchButton.x, + e.switchButton.y, + e.inGame && e.inGame.playerX, + e.inGame && e.inGame.fallTypes, + e.inGame && e.inGame.playerDir, ))); }, ), ]; - break; - case "skateboard": - t = []; - break; - default: - t = []; - break; - } - e.isSkating && - t.push( - ifConditional( - () => !e.crashed, - () => [ - Oo.Single( - { - powerup: e.powerup, - isUsing: e.isUsing, - playerRot: e.playerRot, - playerDir: e.playerDir, - playerScaleY: e.playerScaleY, - paused: e.paused, - df: e.df, - jumping: e.jumping, - playerIsOnGround: e.playerIsOnGround, - didJustFinishUsing: t.didJustFinishUsing, - setDidJustFinishUsing: (e) => { - t.didJustFinishUsing = e; - }, - }, - (a) => { - ((a.powerup = e.powerup), - (a.isUsing = e.isUsing), - (a.playerRot = e.playerRot), - (a.playerDir = e.playerDir), - (a.playerScaleY = e.playerScaleY), - (a.paused = e.paused), - (a.df = e.df), - (a.jumping = e.jumping), - (a.playerIsOnGround = e.playerIsOnGround), - (a.didJustFinishUsing = t.didJustFinishUsing)); - }, - ), - ], - ), - ); - return t; - }, - ), - ], - }), - ko = makeSprite({ - render({ props: e, getContext: t }) { - switch (e.powerup.item) { - case "doubleJump": - const { animationAssets: a, animationRenderer: i } = t(Ws); - return [ - Hs( - { - id: "DoubleJump", - animationAssets: a, - animationRenderer: i, - animationName: "on_PlayerUse_FadeOut", - fileNames: Qs.spineFiles.doubleJumpOnPlayer, - loop: false, - paused: e.paused, - df: e.df, - x: e.powerup.x, - y: e.powerup.y + 60, - height: e.powerup.height, - }, - (t) => { - ((t.paused = e.paused), - (t.df = e.df), - (t.x = e.powerup.x), - (t.y = e.powerup.y + 60), - (t.height = e.powerup.height)); - }, - ), - ]; - case "punch": - return [ - triggerableSpriteSheet.Single( - { - fileName: "images/themes/punch/punch.png", - columns: 2, - rows: 3, - frameRate: 3, - width: 170, - height: 97, - df: e.df, - hideOnEnd: true, - }, - (t) => { - ((t.x = e.powerup.x), - (t.y = e.powerup.y), - (t.df = e.df)); - }, - ), - ]; - case "drill": - return [ - triggerableSpriteSheet.Single( - { - fileName: "images/themes/punch/punch.png", - columns: 2, - rows: 3, - frameRate: 3, - width: 170, - height: 97, - df: e.df, - hideOnEnd: true, - rotation: 90, - }, - (t) => { - ((t.x = e.powerup.x), - (t.y = e.powerup.y + 30), - (t.df = e.df)); - }, - ), - ]; - case "gun": - return [ - triggerableSpriteSheet.Single( - { - fileName: "images/themes/world2/gun/shooting.png", - columns: 3, - rows: 2, - frameRate: 3, - width: 90, - height: 90, - df: e.df, - }, - (t) => { - ((t.x = e.powerup.x), - (t.y = e.powerup.y), - (t.df = e.df)); - }, - ), - ]; - case "jetpack": - return [ - triggerableSpriteSheet.Single( - { - fileName: "images/themes/world2/jetpack/front-out.png", - columns: 4, - rows: 1, - frameRate: 3, - width: 73, - height: 110, - hideOnEnd: true, - df: e.df, - }, - (t) => { - ((t.x = e.powerup.x), - (t.y = e.powerup.y), - (t.rotation = e.playerRot * e.playerDir), - (t.df = e.df)); - }, - ), - ]; - case "playerStack": - case "skateboard": - case "ghost": - case "spaceship": - return []; - } - }, - }), - No = makeSprite({ - render: ({ props: e }) => - "jetpack" === e.powerup.item - ? [ - triggerableSpriteSheet.Single( - { - fileName: "images/themes/world2/jetpack/back-out.png", - columns: 4, - rows: 1, - frameRate: 3, - width: 73, - height: 110, - hideOnEnd: true, - df: e.df, - }, - (t) => { - ((t.x = e.powerup.x), - (t.y = e.powerup.y), - (t.rotation = e.playerRot * (e.playerDir || 0)), - (t.df = e.df)); - }, - ), - ] - : [], - }), - xo = makeSprite({ - init: () => ({ justHitTimer: 0 }), - loop({ props: e, state: t }) { - (e.justHit && (t.justHitTimer = 60), - t.justHitTimer > 0 && t.justHitTimer--); - }, - render: ({ props: e, getContext: t, state: a }) => [ - onChange( - () => e.switchButton.affects, - () => { - switch (e.switchButton.affects) { - case "gravity": - return [ - onChange( - () => e.theme, - () => [ - conditional( - () => e.switchButton.gravity < 2, - () => [ - y( - { - fileName: `images/themes/${e.theme.includes("infinite") ? e.theme : e.theme == "world2" ? "world2" : "world1"}/arrow.png`, - width: e.switchButton.width, - height: e.switchButton.height, - }, - (t) => { - let time = 60 - a.justHitTimer; - let scale = - (time > 5 ? Math.max(5 - (time - 5), 0) : time) / - 7; - ((t.scaleX = 1 + scale), - (t.scaleY = 1 + scale), - (t.x = e.switchButton.x), - (t.y = getBlockFallY( - e.switchButton.x, - e.switchButton.y, - e.inGame && e.inGame.playerX, - e.inGame && e.inGame.fallTypes, - e.inGame && e.inGame.playerDir, - )), - (t.rotation = - e.switchButton.gravity == 0 - ? e.playerDir < 0 - ? -90 - : 90 - : e.switchButton.gravity > 0 - ? 180 - : 0)); - }, - ) - ], - () => [ - y( - { - fileName: `images/themes/${e.theme.includes("infinite") ? e.theme : e.orbTheme == "classic" ? "classic" : "world1"}/doubleJump.png`, - width: e.switchButton.width, - height: e.switchButton.height, - }, - (t) => { - let time = 60 - a.justHitTimer; - let scale = - (time > 5 ? Math.max(5 - (time - 5), 0) : time) / - 7; - ((t.scaleX = 1 + scale), - (t.scaleY = 1 + scale), - (t.x = e.switchButton.x), - (t.y = getBlockFallY( - e.switchButton.x, - e.switchButton.y, - e.inGame && e.inGame.playerX, - e.inGame && e.inGame.fallTypes, - e.inGame && e.inGame.playerDir, - ))); - }, - ) - ] - ) - ] - ), - ]; - case "color": - if (e.isEditor) { - return [ - y( - { - fileName: - "images/editor/editorOnly/color-button.png", - width: e.switchButton.width, - height: e.switchButton.height, - }, - (t) => { - ((t.x = e.switchButton.x), - (t.y = getBlockFallY( + const { animationAssets: i, animationRenderer: n } = + e.spineContext || t(Ws); + return [ + onChange( + () => e.switchBlockSpikes, + () => { + var t; + return [ + Hs( + { + id: "BlockSpike", + animationAssets: i, + animationRenderer: n, + fileNames: Qs.spineFiles.blockSwitchButton, + animationName: e.switchBlockSpikes + ? "switch_1" + : "switch_2", + loop: false, + paused: e.paused || false, + startFromFrame: a.justHitTimer > 0 ? 0 : 400, + height: 0, + x: e.switchButton.x, + y: getBlockFallY( e.switchButton.x, e.switchButton.y, e.inGame && e.inGame.playerX, e.inGame && e.inGame.fallTypes, e.inGame && e.inGame.playerDir, - ))); - }, - ), - ]; - } - return []; - case "falling": - if (e.isEditor) { - return [ - y( - { - fileName: - "images/editor/editorOnly/falling-button.png", - width: e.switchButton.width, - height: e.switchButton.height, - }, - (t) => { - let both = - e.switchButton.up && e.switchButton.down, - none = - !e.switchButton.up && !e.switchButton.down; - ((t.x = e.switchButton.x), - (t.y = getBlockFallY( - e.switchButton.x, - e.switchButton.y, - e.inGame && e.inGame.playerX, - e.inGame && e.inGame.fallTypes, - e.inGame && e.inGame.playerDir, - )), - (t.scaleY = - e.switchButton.up && !both ? -1 : 1), - (t.fileName = both - ? "images/editor/editorOnly/falling-up-down.png" - : none - ? "images/editor/editorOnly/falling-none.png" - : "images/editor/editorOnly/falling-button.png")); - }, - ), - ]; - } - return []; - case "size": - if (e.isEditor && !e.spineContext) - return [ - y( - { - fileName: - "images/editor/editorOnly/size-button.png", - width: e.switchButton.width, - height: e.switchButton.height, - }, - (t) => { - ((t.x = e.switchButton.x), - (t.y = getBlockFallY( - e.switchButton.x, - e.switchButton.y, - e.inGame && e.inGame.playerX, - e.inGame && e.inGame.fallTypes, - e.inGame && e.inGame.playerDir, - ))); - }, - ), - ]; - const { animationAssets: i, animationRenderer: n } = - e.spineContext || t(Ws); - return [ - onChange( - () => e.playerScale, - () => { - var t; - return [ - Hs( - { - id: "Size", - animationAssets: i, - animationRenderer: n, - fileNames: Qs.spineFiles.sizeButton, - animationName: - e.playerScale === 1 - ? "switch_1" - : "switch_2", - loop: false, - paused: e.paused || false, - startFromFrame: a.justHitTimer > 0 ? 0 : 400, - height: 0, - x: e.switchButton.x, - y: getBlockFallY( - e.switchButton.x, - e.switchButton.y, - e.inGame && e.inGame.playerX, - e.inGame && e.inGame.fallTypes, - e.inGame && e.inGame.playerDir, - ), - df: - a.justHitTimer > 0 - ? 1.5 * - (null !== (t = e.df) && void 0 !== t - ? t - : 1) - : 0, - }, - (t) => { - var i; - ((t.scale = { - x: e.scale || 1, - y: e.scale || 1, - }), - (t.x = e.switchButton.x), - (t.y = getBlockFallY( - e.switchButton.x, - e.switchButton.y, - e.inGame && e.inGame.playerX, - e.inGame && e.inGame.fallTypes, - e.inGame && e.inGame.playerDir, - )), - (t.paused = e.paused || false), - (t.df = - a.justHitTimer > 0 - ? 1.5 * - (null !== (i = e.df) && void 0 !== i - ? i - : 1) - : 0)); - }, - ), - ]; - }, - ), - ]; - case "movement": - return [ - y( - { - fileName: `images/themes/${e.theme.split("/")[0]}/switch-button.png`, - width: 32, - height: 32, - }, - (t) => { - ((t.x = e.switchButton.x), - (t.y = getBlockFallY( - e.switchButton.x, - e.switchButton.y, - e.inGame && e.inGame.playerX, - e.inGame && e.inGame.fallTypes, - e.inGame && e.inGame.playerDir, - )), - (t.rotation = e.switchRotation)); - }, - ), - ]; - case "blockSpike": { - if (false) { - //e.theme == "world2") { - return [ - onChange( - () => a.justHitTimer, - () => [ - triggerableSpriteSheet.Single( - { - fileName: - "images/themes/world2/block-spike-switch.png", - columns: 4, - rows: 2, - frameRate: 3, - width: 30 * 0.9, - height: 30 * 0.9, - hideOnEnd: true, - maxFrame: 9, - df: - a.justHitTimer > 0 - ? 1.5 * - (null !== (t = e.df) && void 0 !== t - ? t - : 1) - : 0, - }, - (t) => { - ((t.x = e.switchButton.x), - (t.y = e.switchButton.y), - (t.df = - a.justHitTimer > 0 - ? 1.5 * - (null !== (t = e.df) && void 0 !== t - ? t - : 1) - : 0)); - }, - ), - ], - ), - ]; - } - if (e.isEditor && !e.spineContext) - return [ - y( - { - fileName: - "images/editor/editorOnly/block-switch-button.png", - width: e.switchButton.width, - height: e.switchButton.height, - }, - (t) => { - ((t.x = e.switchButton.x), - (t.y = getBlockFallY( - e.switchButton.x, - e.switchButton.y, - e.inGame && e.inGame.playerX, - e.inGame && e.inGame.fallTypes, - e.inGame && e.inGame.playerDir, - ))); - }, - ), - ]; - const { animationAssets: i, animationRenderer: n } = - e.spineContext || t(Ws); - return [ - onChange( - () => e.switchBlockSpikes, - () => { - var t; - return [ - Hs( - { - id: "BlockSpike", - animationAssets: i, - animationRenderer: n, - fileNames: Qs.spineFiles.blockSwitchButton, - animationName: e.switchBlockSpikes - ? "switch_1" - : "switch_2", - loop: false, - paused: e.paused || false, - startFromFrame: a.justHitTimer > 0 ? 0 : 400, - height: 0, - x: e.switchButton.x, - y: getBlockFallY( + ), + df: + a.justHitTimer > 0 + ? 1.5 * + (null !== (t = e.df) && void 0 !== t + ? t + : 1) + : 0, + }, + (t) => { + var i; + ((t.scale = { + x: e.scale || 1, + y: e.scale || 1, + }), + (t.x = e.switchButton.x), + (t.y = getBlockFallY( e.switchButton.x, e.switchButton.y, e.inGame && e.inGame.playerX, e.inGame && e.inGame.fallTypes, e.inGame && e.inGame.playerDir, - ), - df: + )), + (t.paused = e.paused || false), + (t.df = a.justHitTimer > 0 ? 1.5 * - (null !== (t = e.df) && void 0 !== t - ? t - : 1) - : 0, - }, - (t) => { - var i; - ((t.scale = { - x: e.scale || 1, - y: e.scale || 1, - }), - (t.x = e.switchButton.x), - (t.y = getBlockFallY( - e.switchButton.x, - e.switchButton.y, - e.inGame && e.inGame.playerX, - e.inGame && e.inGame.fallTypes, - e.inGame && e.inGame.playerDir, - )), - (t.paused = e.paused || false), - (t.df = - a.justHitTimer > 0 - ? 1.5 * - (null !== (i = e.df) && void 0 !== i - ? i - : 1) - : 0)); - }, - ), - ]; - }, - ), - ]; - } + (null !== (i = e.df) && void 0 !== i + ? i + : 1) + : 0)); + }, + ), + ]; + }, + ), + ]; } - }, - ), - ], - }), - Po = makeSprite({ - render: ({ props: e }) => [ - // real switch - imageArray({ - fileName: `images/themes/${e.theme}/switch-platform.png`, - props: (e) => ({ width: e.width, height: e.height }), - update: (n, t) => { - const a = -t.width / 2 + t.height / 2; - ((n.anchorX = a), - (n.x = t.x + a), - (n.y = getBlockFallY( - t.x, - t.y, - e.inGame && e.inGame.playerX, - e.inGame && e.inGame.fallTypes, - e.inGame && e.inGame.playerDir, - ))); - n.rotation = - t.rotation; - n.scaleY = n.direction == 0 || n.direction == 180 ? 1 : -1; - }, - array: () => e.switchPlatforms, - }), - // editor only - ifConditional( - () => void 0 !== e.editor, - () => [ - imageArray({ - fileName: `images/themes/${e.theme}/switch-platform.png`, - props: (e) => ({ - width: e.width, - height: e.height, - opacity: 0.3, - }), - update: (e, t) => { - const a = -t.width / 2 + t.height / 2; - ((e.anchorX = a), - (e.x = t.x + a), - (e.y = t.y), - (e.rotation = - (0 === t.rotation - t.direction ? -90 : 0) + t.direction)); - }, - array: () => e.switchPlatforms, + } + }, + ), + ], + }), + Po = makeSprite({ + render: ({ props: e }) => [ + imageArray({ + fileName: `images/themes/${e.theme}/switch-platform.png`, + props: (e) => ({ width: e.width, height: e.height }), + update: (n, t) => { + const a = -t.width / 2 + t.height / 2; + ((n.anchorX = a), + (n.x = t.x + a), + (n.y = getBlockFallY( + t.x, + t.y, + e.inGame && e.inGame.playerX, + e.inGame && e.inGame.fallTypes, + e.inGame && e.inGame.playerDir, + )), + (n.direction = t.direction)); + ((n.scale = { + x: 1, + y: n.direction == 0 || n.direction == 180 ? 1 : -1, + }), + (n.rotation = + t.rotation + (void 0 !== n.editor ? t.direction : 0))); + n.scaleY = n.direction == 0 || n.direction == 180 ? 1 : -1; + }, + array: () => e.switchPlatforms, + }), + ifConditional( + () => void 0 !== e.editor, + () => [ + imageArray({ + fileName: `images/themes/${e.theme}/switch-platform.png`, + props: (e) => ({ + width: e.width, + height: e.height, + opacity: 0.3, }), - ifConditional( - () => void 0 !== e.editor.previewRots, - () => [ - g({ - props: () => ({ color: "blue", opacity: 0.5 }), - update: (t, a, i) => { - const n = -a.width / 2 + a.height / 2; - ((t.width = a.width), - (t.height = a.height), - (t.x = a.x + n), - (t.y = a.y), - (t.anchorX = n), - (t.rotation = e.editor.previewRots[i])); - }, - array: () => e.switchPlatforms, + update: (e, t) => { + const a = -t.width / 2 + t.height / 2; + ((e.anchorX = a), + (e.x = t.x + a), + (e.y = t.y), + (e.rotation = + (0 === t.rotation ? -90 : 0) + t.direction)); + }, + array: () => e.switchPlatforms, + }), + ifConditional( + () => void 0 !== e.editor.previewRots, + () => [ + g({ + props: () => ({ color: "blue", opacity: 0.5 }), + update: (t, a, i) => { + const n = -a.width / 2 + a.height / 2; + ((t.width = a.width), + (t.height = a.height), + (t.x = a.x + n), + (t.y = a.y), + (t.anchorX = n), + (t.rotation = e.editor.previewRots[i])); + }, + array: () => e.switchPlatforms, + }), + ], + ), + ], + ), + ], + }), + Mo = makeCustomSprite({ render: ({ props: { sprites: e } }) => e }), + Lo = makeSprite({ render: ({ props: { sprites: e } }) => e }), + ScrollContainer = makeCustomSprite({ + init({ props, updateState: i, getContext }) { + let { + initScrollY: e = 0, + containerHeight: t, + contentHeight: a, + } = props; + const { addToOnScrollQueue } = getContext(Se), + n = (e) => + addToOnScrollQueue(() => { + 1 === e.deltaMode && + i((t) => + Object.assign(Object.assign({}, t), { + scrollY: B.clamp([ + 0, + props.contentHeight - props.containerHeight, + ])(t.scrollY + e.deltaY * (100 / 6)), }), - ], - ), - ], - ), - ], - }), - Mo = makeCustomSprite({ render: ({ props: { sprites: e } }) => e }), - Lo = makeSprite({ render: ({ props: { sprites: e } }) => e }), - ScrollContainer = makeCustomSprite({ - init({ props, updateState: i, getContext }) { - let { - initScrollY: e = 0, - containerHeight: t, - contentHeight: a, - } = props; - const { addToOnScrollQueue } = getContext(Se), - n = (e) => - addToOnScrollQueue(() => { - 1 === e.deltaMode && - i((t) => - Object.assign(Object.assign({}, t), { - scrollY: B.clamp([ - 0, - props.contentHeight - props.containerHeight, - ])(t.scrollY + e.deltaY * (100 / 6)), - }), - ); - 0 === e.deltaMode && - i((t) => - Object.assign(Object.assign({}, t), { - scrollY: B.clamp([ - 0, - props.contentHeight - props.containerHeight, - ])(t.scrollY + e.deltaY), - }), - ); - }); - document.addEventListener("wheel", n, { passive: true }); - const s = a - t; - return { - scrollY: B.clamp([0, s])(e), - startScroll: null, - onScroll: n, - }; - }, - loop({ getInputs: e, state: t, props: a }) { - const { - containerHeight: i, - containerWidth: n, - contentHeight: s, - } = a; - if (s <= i) return t; - const o = e(), - { pointer: r } = o; - let { startScroll: l, scrollY: c } = t; - if ( - (r.justPressed && - r.x <= n / 2 && - r.x >= -n / 2 && - r.y > -i && - r.y <= 0 && - (l = { y: c - r.y, pointerY: r.y, moved: false }), - l) - ) { - const e = s - i; - ((c = B.clamp([0, e])(r.y + l.y)), - r.pressed || r.justReleased - ? !l.moved && - Math.abs(l.pointerY - r.y) > 10 && - (l = Object.assign(Object.assign({}, l), { moved: true })) - : (l = null)); - } - return { startScroll: l, scrollY: c, onScroll: t.onScroll }; - }, - render({ - props: { - sprites: e, - containerHeight: t, - containerWidth: a, - contentHeight: i, - showScrollBar: n, - }, - state: s, - getInputs: r, - }) { - var l; - if (i <= t) return e(false); - const c = - true === - (null === (l = s.startScroll) || void 0 === l - ? void 0 - : l.moved), - { pointer: d } = r(), - u = be.pointInBox({ x: 0, y: -t / 2, width: a, height: t })(d); - return [ - Mo({ - id: "ScrollContent", - sprites: e(c || !u), - y: s.scrollY, - mask: rectangleMask({ - width: a, - height: t, - y: -s.scrollY - t / 2, - }), - }), - n - ? o({ - color: ve, - opacity: 0.9, - width: 10, - height: 30, - y: (-s.scrollY / (i - t || 1)) * (t - 30) - 15, - x: a / 2, - }) - : null, - ]; - }, - cleanup({ state: e }) { - document.removeEventListener("wheel", e.onScroll, false); - }, - }), - Bo = makeSprite({ - init({ - props: { - initScrollY: e = 0, - containerHeight: t, - contentHeight: a, - }, - getState: i, - getContext, - }) { - const { addToOnScrollQueue } = getContext(Se); - const n = (e) => - addToOnScrollQueue(() => { - const t = i(); - 1 === e.deltaMode && - (t.scrollY = B.clamp([0, s])( - t.scrollY + e.deltaY * (100 / 6), - )); + ); 0 === e.deltaMode && - (t.scrollY = B.clamp([0, s])(t.scrollY + e.deltaY)); + i((t) => + Object.assign(Object.assign({}, t), { + scrollY: B.clamp([ + 0, + props.contentHeight - props.containerHeight, + ])(t.scrollY + e.deltaY), + }), + ); }); - document.addEventListener("wheel", n, { passive: true }); - const s = a - t; - return { - scrollY: B.clamp([0, s])(e), - startScroll: null, - noPress: { ref: false }, - onScroll: n, - }; - }, - loop({ getInputs: e, state: t, props: a }) { - var i; - const { - containerHeight: n, - containerWidth: s, - contentHeight: o, - } = a; - if (o <= n) return; - const r = e(), - { pointer: l } = r; - if ( - (l.justPressed && - l.x <= s / 2 && - l.x >= -s / 2 && - l.y > -n && - l.y <= 0 && - (t.startScroll = { - y: t.scrollY - l.y, - pointerY: l.y, - moved: false, - }), + document.addEventListener("wheel", n, { passive: true }); + const s = a - t; + return { + scrollY: B.clamp([0, s])(e), + startScroll: null, + onScroll: n, + }; + }, + loop({ getInputs: e, state: t, props: a }) { + const { + containerHeight: i, + containerWidth: n, + contentHeight: s, + } = a; + if (s <= i) return t; + const o = e(), + { pointer: r } = o; + let { startScroll: l, scrollY: c } = t; + if ( + (r.justPressed && + r.x <= n / 2 && + r.x >= -n / 2 && + r.y > -i && + r.y <= 0 && + (l = { y: c - r.y, pointerY: r.y, moved: false }), + l) + ) { + const e = s - i; + ((c = B.clamp([0, e])(r.y + l.y)), + r.pressed || r.justReleased + ? !l.moved && + Math.abs(l.pointerY - r.y) > 10 && + (l = Object.assign(Object.assign({}, l), { moved: true })) + : (l = null)); + } + return { startScroll: l, scrollY: c, onScroll: t.onScroll }; + }, + render({ + props: { + sprites: e, + containerHeight: t, + containerWidth: a, + contentHeight: i, + showScrollBar: n, + }, + state: s, + getInputs: r, + }) { + var l; + if (i <= t) return e(false); + const c = + true === + (null === (l = s.startScroll) || void 0 === l + ? void 0 + : l.moved), + { pointer: d } = r(), + u = be.pointInBox({ x: 0, y: -t / 2, width: a, height: t })(d); + return [ + Mo({ + id: "ScrollContent", + sprites: e(c || !u), + y: s.scrollY, + mask: rectangleMask({ + width: a, + height: t, + y: -s.scrollY - t / 2, + }), + }), + n + ? o({ + color: ve, + opacity: 0.9, + width: 10, + height: 30, + y: (-s.scrollY / (i - t || 1)) * (t - 30) - 15, + x: a / 2, + }) + : null, + ]; + }, + cleanup({ state: e }) { + document.removeEventListener("wheel", e.onScroll, false); + }, + }), + Bo = makeSprite({ + init({ + props: { + initScrollY: e = 0, + containerHeight: t, + contentHeight: a, + }, + getState: i, + getContext, + }) { + const { addToOnScrollQueue } = getContext(Se); + const n = (e) => + addToOnScrollQueue(() => { + const t = i(); + 1 === e.deltaMode && + (t.scrollY = B.clamp([0, s])( + t.scrollY + e.deltaY * (100 / 6), + )); + 0 === e.deltaMode && + (t.scrollY = B.clamp([0, s])(t.scrollY + e.deltaY)); + }); + document.addEventListener("wheel", n, { passive: true }); + const s = a - t; + return { + scrollY: B.clamp([0, s])(e), + startScroll: null, + noPress: { ref: false }, + onScroll: n, + }; + }, + loop({ getInputs: e, state: t, props: a }) { + var i; + const { + containerHeight: n, + containerWidth: s, + contentHeight: o, + } = a; + if (o <= n) return; + const r = e(), + { pointer: l } = r; + if ( + (l.justPressed && + l.x <= s / 2 && + l.x >= -s / 2 && + l.y > -n && + l.y <= 0 && + (t.startScroll = { + y: t.scrollY - l.y, + pointerY: l.y, + moved: false, + }), t.startScroll) - ) { - const e = o - n; - ((t.scrollY = B.clamp([0, e])(l.y + t.startScroll.y)), - l.pressed || l.justReleased - ? !t.startScroll.moved && - Math.abs(t.startScroll.pointerY - l.y) > 10 && - (t.startScroll.moved = true) - : (t.startScroll = null)); - } - const c = - true === - (null === (i = t.startScroll) || void 0 === i - ? void 0 - : i.moved), - d = be.pointInBox({ x: 0, y: -n / 2, width: s, height: n })(l); - t.noPress.ref = c || !d; - }, - render: ({ props: e, state: t }) => [ - Lo.Single( - { - sprites: e.sprites(t.noPress), - y: t.scrollY, - mask: rectangleMask({ + ) { + const e = o - n; + ((t.scrollY = B.clamp([0, e])(l.y + t.startScroll.y)), + l.pressed || l.justReleased + ? !t.startScroll.moved && + Math.abs(t.startScroll.pointerY - l.y) > 10 && + (t.startScroll.moved = true) + : (t.startScroll = null)); + } + const c = + true === + (null === (i = t.startScroll) || void 0 === i + ? void 0 + : i.moved), + d = be.pointInBox({ x: 0, y: -n / 2, width: s, height: n })(l); + t.noPress.ref = c || !d; + }, + render: ({ props: e, state: t }) => [ + Lo.Single( + { + sprites: e.sprites(t.noPress), + y: t.scrollY, + mask: rectangleMask({ + width: e.containerWidth, + height: e.containerHeight, + y: -t.scrollY - e.containerHeight / 2, + }), + }, + (a) => { + ((a.sprites = e.sprites(t.noPress)), + (a.y = t.scrollY), + (a.mask = rectangleMask({ width: e.containerWidth, height: e.containerHeight, y: -t.scrollY - e.containerHeight / 2, - }), - }, - (a) => { - ((a.sprites = e.sprites(t.noPress)), - (a.y = t.scrollY), - (a.mask = rectangleMask({ - width: e.containerWidth, - height: e.containerHeight, - y: -t.scrollY - e.containerHeight / 2, - }))); - }, - ), - ], - cleanup({ state: e }) { - document.removeEventListener("wheel", e.onScroll, false); - }, - }), - DropdownButton = makeCustomSprite({ - init: ({ props }) => { - return { - menuOpened: false, - choice: props.choice - }; - }, - render: ({ - props: { - text: e, - width: t, - height: a, - darkText: i = false, - darkBg: s = false, - disabled: disabled = false, - fontSize: fontSize = 15, - shadowDir: l, - onPress: c, - noPress: d, - strokeColor: u, - textColor: h, - textStroke: p, - textStrokeThickness: g, - options, + }))); }, - state, - device: m, - }) => { - let textLength = cy.measureTexts( - [localize(e)], - { family: "Montserrat", size: fontSize, weight: 900 })[0], + ), + ], + cleanup({ state: e }) { + document.removeEventListener("wheel", e.onScroll, false); + }, + }), + DropdownButton = makeCustomSprite({ + init: ({ props }) => { + return { + menuOpened: false, + choice: props.choice + }; + }, + render: ({ + props: { + text: e, + width: t, + height: a, + darkText: i = false, + darkBg: s = false, + disabled: disabled = false, + fontSize: fontSize = 15, + shadowDir: l, + onPress: c, + noPress: d, + strokeColor: u, + textColor: h, + textStroke: p, + textStrokeThickness: g, + options, + }, + state, + device: m, + }) => { + let textLength = cy.measureTexts( + [localize(e)], + { family: "Montserrat", size: fontSize, weight: 900 })[0], menuHeight = Math.abs((-nr * i - 20) * (options.length + 1)) + nr, menuOffset = menuHeight / 2 + a / 2; - return [ - ...(state.menuOpened ? [Clickable({ - id: "ClickOutside", - onPressOutside: () => { - state.menuOpened = false - }, + return [ + ...(state.menuOpened ? [Clickable({ + id: "ClickOutside", + onPressOutside: () => { + state.menuOpened = false + }, + width: ar, + height: menuHeight, + y: -menuOffset, + sprites: () => [], + onPress: () => null, + }), + r({ + path: [ + [-ar / 2, menuHeight / 2], + [ar / 2, menuHeight / 2], + [ar / 2, -menuHeight / 2 + 30], + [ar / 2 - 30, -menuHeight / 2], + [-ar / 2, -menuHeight / 2], + ], + y: -menuOffset, + fillColor: ve, + }), + o({ width: ar - 20, height: menuHeight - 20, x: -10, y: 10 - menuOffset, color: je }), + ScrollContainer({ + id: "ScrollContainer", + containerHeight: menuHeight - 20, + containerWidth: ar - 20, + contentHeight: menuHeight - 20, + x: -10, + y: menuHeight / 2 - menuOffset, + sprites: (a) => + options.map((t, i) => + Clickable({ + id: `OptionClickable-${i}`, + y: -nr * i - 20, width: ar, - height: menuHeight, - y: -menuOffset, - sprites: () => [], - onPress: () => null, - }), - r({ - path: [ - [-ar / 2, menuHeight / 2], - [ar / 2, menuHeight / 2], - [ar / 2, -menuHeight / 2 + 30], - [ar / 2 - 30, -menuHeight / 2], - [-ar / 2, -menuHeight / 2], - ], - y: -menuOffset, - fillColor: ve, - }), - o({ width: ar - 20, height: menuHeight - 20, x: -10, y: 10 - menuOffset, color: je }), - ScrollContainer({ - id: "ScrollContainer", - containerHeight: menuHeight - 20, - containerWidth: ar - 20, - contentHeight: menuHeight - 20, - x: -10, - y: menuHeight / 2 - menuOffset, - sprites: (a) => - options.map((t, i) => - Clickable({ - id: `OptionClickable-${i}`, - y: -nr * i - 20, - width: ar, - height: nr, - onPress: () => { - m.audio("audio/global/button.wav").play(0); - state.menuOpened = false; - state.choice = i; - c(i); - }, - disabled: false, - sprites: (c) => [ - n({ - id: `TextOption-${i}`, - text: localize(t), - weight: 500, - y: 1 - c * 3, - }), - ], - }), - ), - })] : []), - Clickable({ - id: "Clickable", - width: t, - height: a, - onPress: () => { - m.audio("audio/global/button.wav").play(0); - state.menuOpened = !state.menuOpened; - // c(); - }, - disabled: disabled || d, - sprites: (c) => [ - - So({ - id: "RaiseRects", - width: t, - height: a, - raiseHeight: 5, - rad: 5, - isPressed: c, - topColour: disabled ? Xe : c ? ke : Re, - bottomColour: s ? Be : ve, - stroke: { - thickness: 2, - colour: disabled ? ze : u || (s ? Ye : Me), + height: nr, + onPress: () => { + m.audio("audio/global/button.wav").play(0); + state.menuOpened = false; + state.choice = i; + c(i); }, - shadowDir: l, - sprites: (t) => [ + disabled: false, + sprites: (c) => [ n({ - font: { size: fontSize }, - text: localize(e), // screw it - color: disabled ? ze : c ? Ae : h || (i ? Ue : Be), - strokeColor: p, - strokeThickness: g, - y: t - 1 + 5, + id: `TextOption-${i}`, + text: localize(t), + weight: 500, + y: 1 - c * 3, }), - r({ - path: [ - [-fontSize / 2, fontSize / 2], - [fontSize / 2, fontSize / 2], - [0, -fontSize / 5], - ], - fillColor: disabled ? ze : c ? Ae : h || (i ? Ue : Be), - y: t - 3 - 10 - }) ], }), - ], - }), - ] - }, - }), - Fo = makeCustomSprite({ - render: ({ - props: { - text: e, + ), + })] : []), + Clickable({ + id: "Clickable", width: t, height: a, - darkText: i = false, - darkBg: s = false, - disabled: o = false, - fontSize: r = 15, - shadowDir: l, - onPress: c, - noPress: d, - strokeColor: u, - textColor: h, - textStroke: p, - textStrokeThickness: g, - }, - device: m, - }) => [ + onPress: () => { + m.audio("audio/global/button.wav").play(0); + state.menuOpened = !state.menuOpened; + // c(); + }, + disabled: disabled || d, + sprites: (c) => [ + + So({ + id: "RaiseRects", + width: t, + height: a, + raiseHeight: 5, + rad: 5, + isPressed: c, + topColour: disabled ? Xe : c ? ke : Re, + bottomColour: s ? Be : ve, + stroke: { + thickness: 2, + colour: disabled ? ze : u || (s ? Ye : Me), + }, + shadowDir: l, + sprites: (t) => [ + n({ + font: { size: fontSize }, + text: localize(e), // screw it + color: disabled ? ze : c ? Ae : h || (i ? Ue : Be), + strokeColor: p, + strokeThickness: g, + y: t - 1 + 5, + }), + r({ + path: [ + [-fontSize / 2, fontSize / 2], + [fontSize / 2, fontSize / 2], + [0, -fontSize / 5], + ], + fillColor: disabled ? ze : c ? Ae : h || (i ? Ue : Be), + y: t - 3 - 10 + }) + ], + }), + ], + }), + ] + }, + }), + Fo = makeCustomSprite({ + render: ({ + props: { + text: e, + width: t, + height: a, + darkText: i = false, + darkBg: s = false, + disabled: o = false, + fontSize: r = 15, + shadowDir: l, + onPress: c, + noPress: d, + strokeColor: u, + textColor: h, + textStroke: p, + textStrokeThickness: g, + }, + device: m, + }) => [ Clickable({ id: "Clickable", width: t, @@ -35927,375 +35907,430 @@ var version = "v1.17.2"; ], }), ], - }), - Yo = makeSprite({ - render: ({ props: e, device: t }) => [ - _e.Single( - { - width: e.width, - height: e.height, - onPress: () => { - (e.noSfx || t.audio("audio/global/button.wav").play(0), - e.onPress()); - }, - disabled: e.disabled || e.noPress, - sprites: (t) => [ - Io.Single( - { - width: e.width, - height: e.height, - raiseHeight: 5, - rad: 5, - isPressed: t, - topColour: e.disabled ? Xe : t ? ke : Re, - bottomColour: e.darkBg ? Be : ve, - stroke: { - thickness: 2, - colour: e.disabled - ? ze - : e.strokeColor - ? e.strokeColor - : e.darkBg - ? Ye - : Me, - }, - shadowDir: e.shadowDir, - sprites: (a) => [ - c( - { - font: { size: e.fontSize || 15 }, - strokeColor: e.textStroke, - strokeThickness: e.textStrokeThickness, - y: a - 1, - }, - (a) => { - ((a.text = e.text), - (a.color = e.disabled - ? ze - : t - ? Ae - : e.textColor - ? e.textColor - : e.darkText - ? Ue - : Be)); - }, - ), - ], - }, - (a) => { - ((a.topColour = e.disabled ? Xe : t ? ke : Re), - (a.bottomColour = e.darkBg ? Be : ve), - (a.stroke.colour = e.disabled - ? ze - : e.strokeColor - ? e.strokeColor - : e.darkBg - ? Ye - : Me)); - }, - ), - ], - }, - (t) => { - t.disabled = e.disabled || e.noPress; + }), + Yo = makeSprite({ + render: ({ props: e, device: t }) => [ + _e.Single( + { + width: e.width, + height: e.height, + onPress: () => { + (e.noSfx || t.audio("audio/global/button.wav").play(0), + e.onPress()); }, - ), - ], + disabled: e.disabled || e.noPress, + sprites: (t) => [ + Io.Single( + { + width: e.width, + height: e.height, + raiseHeight: 5, + rad: 5, + isPressed: t, + topColour: e.disabled ? Xe : t ? ke : Re, + bottomColour: e.darkBg ? Be : ve, + stroke: { + thickness: 2, + colour: e.disabled + ? ze + : e.strokeColor + ? e.strokeColor + : e.darkBg + ? Ye + : Me, + }, + shadowDir: e.shadowDir, + sprites: (a) => [ + c( + { + font: { size: e.fontSize || 15 }, + strokeColor: e.textStroke, + strokeThickness: e.textStrokeThickness, + y: a - 1, + }, + (a) => { + ((a.text = e.text), + (a.color = e.disabled + ? ze + : t + ? Ae + : e.textColor + ? e.textColor + : e.darkText + ? Ue + : Be)); + }, + ), + ], + }, + (a) => { + ((a.topColour = e.disabled ? Xe : t ? ke : Re), + (a.bottomColour = e.darkBg ? Be : ve), + (a.stroke.colour = e.disabled + ? ze + : e.strokeColor + ? e.strokeColor + : e.darkBg + ? Ye + : Me)); + }, + ), + ], + }, + (t) => { + t.disabled = e.disabled || e.noPress; + }, + ), + ], + }), + Uo = makeCustomSprite({ + init: ({ props: { initShow: e = false, fadeFrames: t = 10 } }) => ({ + fade: e ? t : 0, }), - Uo = makeCustomSprite({ - init: ({ props: { initShow: e = false, fadeFrames: t = 10 } }) => ({ - fade: e ? t : 0, - }), - loop: ({ - state: e, - props: { shouldShow: t, fadeFrames: a = 10, fadeInc: i = 1 }, - }) => - t - ? e.fade < a - ? { fade: e.fade + i } - : e - : e.fade > 0 - ? { fade: e.fade - 1 } - : e, - render: ({ props: { sprite: e, fadeFrames: t = 10 }, state: a }) => - 0 === a.fade ? [] : e(a.fade / t), - }), - jo = makeSprite({ - init({ props: { initShow: e = false, fadeFrames: t = 10 } }) { - const a = e ? t : 0; - return { fade: a, opacity: { ref: a / t } }; - }, - loop({ - state: e, - props: { shouldShow: t, fadeFrames: a = 10, fadeInc: i = 1 }, - }) { - t - ? e.fade < a && ((e.fade += i), (e.opacity.ref = e.fade / a)) - : e.fade > 0 && (e.fade--, (e.opacity.ref = e.fade / a)); + loop: ({ + state: e, + props: { shouldShow: t, fadeFrames: a = 10, fadeInc: i = 1 }, + }) => + t + ? e.fade < a + ? { fade: e.fade + i } + : e + : e.fade > 0 + ? { fade: e.fade - 1 } + : e, + render: ({ props: { sprite: e, fadeFrames: t = 10 }, state: a }) => + 0 === a.fade ? [] : e(a.fade / t), + }), + jo = makeSprite({ + init({ props: { initShow: e = false, fadeFrames: t = 10 } }) { + const a = e ? t : 0; + return { fade: a, opacity: { ref: a / t } }; + }, + loop({ + state: e, + props: { shouldShow: t, fadeFrames: a = 10, fadeInc: i = 1 }, + }) { + t + ? e.fade < a && ((e.fade += i), (e.opacity.ref = e.fade / a)) + : e.fade > 0 && (e.fade--, (e.opacity.ref = e.fade / a)); + }, + render: ({ props: e, state: t }) => [ + ifConditional( + () => t.fade > 0, + () => e.sprite(t.opacity), + ), + ], + }), + calculateRGB = function (e, t) { + var rgb = Number.parseInt(e.slice(1), 16), + r, + g, + b, + a = 1, + Z = { r: 0, g: 0, b: 0, a: 1 }; + + if (e.startsWith("rgb")) { + var values = e + .split(e.includes("rgba") ? "rgba(" : "rgb(")[1] + .split(","); + ((r = values[0] / 255), + (g = values[1] / 255), + (b = +String(values[2]).replace(")", "") / 255), + (a = +String(values[3]).replace(")", ""))); + ((Z.r = r * (t || 1)), + (Z.g = g * (t || 1)), + (Z.b = b * (t || 1)), + (Z.a = a * (t || 1))); + return Z; + } else { + ((r = rgb >> 16), (g = (rgb >> 8) & 255), (b = 255 & rgb)); + } + Z.a = 1; + return ( + void 0 !== t + ? ((Z.r = t * (r / 255)), + (Z.g = t * (g / 255)), + (Z.b = t * (b / 255))) + : ((Z.r = r / 255), (Z.g = g / 255), (Z.b = b / 255)), + Z + ); + }, + componentToHex = function (c, round) { + c = c > 255 ? 255 : c; + var hex = (round ? Math.round(c) : c).toString(16); + return hex.length == 1 ? "0" + hex : hex; + }, + Go = makeSprite({ + init: ({ props: { targetOpacity: e, targetColor: c } }) => ({ + opacity: { ref: e }, + color: { + ref: c, + trueRef: (c && calculateRGB(c, 255)) || { r: 0, g: 0, b: 0 }, }, - render: ({ props: e, state: t }) => [ - ifConditional( - () => t.fade > 0, - () => e.sprite(t.opacity), - ), - ], }), - calculateRGB = function (e, t) { - var rgb = Number.parseInt(e.slice(1), 16), - r, - g, - b, - a = 1, - Z = { r: 0, g: 0, b: 0, a: 1 }; + loop({ + state: e, + props: { targetOpacity: t, targetColor: targetColor }, + }) { + e.opacity.ref += (t - e.opacity.ref) / 10; + if (!(t == 0) && targetColor) { + if (e.opacity.ref < 0.5 && t > 0) { + e.color.ref = targetColor || "#000000"; + e.color.trueRef = calculateRGB(targetColor, 255); + } + var current = e.color.trueRef + ? e.color.trueRef + : calculateRGB(e.color.ref, 255); + var newRgb = calculateRGB(targetColor, 255); + e.color.trueRef.r += (newRgb.r - current.r) / 5; + e.color.trueRef.g += (newRgb.g - current.g) / 5; + e.color.trueRef.b += (newRgb.b - current.b) / 5; - if (e.startsWith("rgb")) { - var values = e - .split(e.includes("rgba") ? "rgba(" : "rgb(")[1] - .split(","); - ((r = values[0] / 255), - (g = values[1] / 255), - (b = +String(values[2]).replace(")", "") / 255), - (a = +String(values[3]).replace(")", ""))); - ((Z.r = r * (t || 1)), - (Z.g = g * (t || 1)), - (Z.b = b * (t || 1)), - (Z.a = a * (t || 1))); - return Z; - } else { - ((r = rgb >> 16), (g = (rgb >> 8) & 255), (b = 255 & rgb)); + e.color.ref = `#${componentToHex(e.color.trueRef.r, true)}${componentToHex(e.color.trueRef.g, true)}${componentToHex(e.color.trueRef.b, true)}`; } - Z.a = 1; - return ( - void 0 !== t - ? ((Z.r = t * (r / 255)), - (Z.g = t * (g / 255)), - (Z.b = t * (b / 255))) - : ((Z.r = r / 255), (Z.g = g / 255), (Z.b = b / 255)), - Z - ); }, - componentToHex = function (c, round) { - c = c > 255 ? 255 : c; - var hex = (round ? Math.round(c) : c).toString(16); - return hex.length == 1 ? "0" + hex : hex; + render: ({ props: e, state: t }) => e.sprite(t.opacity, t.color), + }), + Vo = 25, + Ho = makeSprite({ + init: () => ({ showArrows: [false, false, false, false] }), + loop({ state: e, props: t }) { + ((e.showArrows[0] = Xo(t.playerYRelative, 0)), + (e.showArrows[1] = Xo(t.playerYRelative, 30)), + (e.showArrows[2] = Xo(t.playerYRelative, 60)), + (e.showArrows[3] = Xo(t.playerYRelative, 90))); }, - Go = makeSprite({ - init: ({ props: { targetOpacity: e, targetColor: c } }) => ({ - opacity: { ref: e }, - color: { - ref: c, - trueRef: (c && calculateRGB(c, 255)) || { r: 0, g: 0, b: 0 }, + render: ({ state: e, props: x }) => [ + imageArray({ + fileName: "images/themes/arrows/arrow-outline.png", + props: (e, t) => { + const a = 30 * t; + return { + width: Vo, + height: Vo, + y: a, + rotation: $.getArrowRotation(a - et.initialPosition.y), + }; + }, + update: (e, t) => { + e.show = !t && !x.isBlank; }, + array: () => e.showArrows, }), - loop({ - state: e, - props: { targetOpacity: t, targetColor: targetColor }, - }) { - e.opacity.ref += (t - e.opacity.ref) / 10; - if (!(t == 0) && targetColor) { - if (e.opacity.ref < 0.5 && t > 0) { - e.color.ref = targetColor || "#000000"; - e.color.trueRef = calculateRGB(targetColor, 255); - } - var current = e.color.trueRef - ? e.color.trueRef - : calculateRGB(e.color.ref, 255); - var newRgb = calculateRGB(targetColor, 255); - e.color.trueRef.r += (newRgb.r - current.r) / 5; - e.color.trueRef.g += (newRgb.g - current.g) / 5; - e.color.trueRef.b += (newRgb.b - current.b) / 5; - - e.color.ref = `#${componentToHex(e.color.trueRef.r, true)}${componentToHex(e.color.trueRef.g, true)}${componentToHex(e.color.trueRef.b, true)}`; - } - }, - render: ({ props: e, state: t }) => e.sprite(t.opacity, t.color), - }), - Vo = 25, - Ho = makeSprite({ - init: () => ({ showArrows: [false, false, false, false] }), - loop({ state: e, props: t }) { - ((e.showArrows[0] = Xo(t.playerYRelative, 0)), - (e.showArrows[1] = Xo(t.playerYRelative, 30)), - (e.showArrows[2] = Xo(t.playerYRelative, 60)), - (e.showArrows[3] = Xo(t.playerYRelative, 90))); - }, - render: ({ state: e, props: x }) => [ - imageArray({ - fileName: "images/themes/arrows/arrow-outline.png", - props: (e, t) => { - const a = 30 * t; - return { - width: Vo, - height: Vo, - y: a, - rotation: $.getArrowRotation(a - et.initialPosition.y), - }; - }, - update: (e, t) => { - e.show = !t && !x.isBlank; - }, - array: () => e.showArrows, - }), - imageArray({ - fileName: "images/themes/arrows/arrow-outline-selected.png", - props: (e, t) => { - const a = 30 * t; - return { - width: Vo, - height: Vo, - y: a, - rotation: $.getArrowRotation(a - et.initialPosition.y), - }; - }, - update: (e, t) => { - e.show = t && !x.isBlank; - }, - array: () => e.showArrows, - }), - ], - }); - function Xo(e, t) { - return e < t + M - 1 && e > t - M + 1; - } - const zo = { - addScore: function (e, t, a) { - let { local: i, total: n, multiplier: s } = e; - a && s++; - const o = 20 * s * (t ? 100 : a ? 10 : 1); - return ( - (i += o), - (n += o), - { local: i, total: n, multiplier: s } - ); - }, - didLand: function (e) { - return { total: e.total, local: 0, multiplier: 0 }; - }, - hitArrow: function (e, t, a) { - const i = - t <= 2 * a - ? zo.arrowValues.perfect - : t <= 4 * a - ? zo.arrowValues.great - : zo.arrowValues.ok; - e.multiplier++; - const n = Math.min(8, Math.ceil(e.multiplier / 4)); - if (i < zo.arrowValues.perfect) { - e.perfectCombo = false - }; - return ((e.total += Math.round(n * i)), i); - }, - arrowValues: { perfect: 400, great: 250, ok: 100 }, - }, - Wo = makeSprite({ - render: ({ props: e }) => [ - qo.Array({ - props: (t, a) => { - const i = e.collectibleStates[a]; - return { - collectible: t, - score: i.score, - wasPickedUp: i.wasPickedUp, - playerX: e.playerX, - fallTypes: e.fallTypes, - playerDir: e.playerDir, - paused: e.paused, - df: e.df, - theme: e.theme, - }; - }, - update: (t, a, i) => { - const n = e.collectibleStates[i]; - ((t.collectible = a), - (t.score = n.score), - (t.wasPickedUp = n.wasPickedUp), - (t.playerX = e.playerX), - (t.fallTypes = e.fallTypes), - (t.playerDir = e.playerDir), - (t.paused = e.paused), - (t.df = e.df), - (t.theme = e.theme)); - }, - updateAll: (t) => { - const a = e.frame % 100, - i = Math.max(0, a > 23 ? 46 - a : a); - ((t.spinFrame = i), (t.flipX = a > 23)); - }, - array: () => e.collectibles, - key: (t, a) => e.collectibleIndexes[a], - }), - ], - }), - qo = makeSprite({ - render: ({ props: e, getContext: t }) => - e.wasPickedUp - ? [] - : [ - onChange( - () => e.collectible.form, - () => { - if ("arrow" === e.collectible.form) { - if (e.isEditor) - return [ - y( - { - fileName: `images/themes/${t.theme == "world2" ? "punch" : "arrows"}/arrow.png`, - width: Vo, - height: Vo, - }, - (t) => { - ((t.x = e.collectible.x), - (t.y = getBlockFallY( - e.collectible.x, - e.collectible.y, - e.playerX, - e.fallTypes, - e.playerDir, - )), - (t.rotation = $.getArrowRotation( - e.collectible.y, - ))); - }, - ), - p( - { - x: e.collectible.x, - y: e.collectible.y, - width: 50, - height: 30, - opacity: 0.5, - color: "green", - }, - (t) => { - t.x = e.collectible.x; - t.y = e.collectible.y; - }, - ), - ]; - const { animationAssets: a, animationRenderer: i } = - t(Ws); - return [ + imageArray({ + fileName: "images/themes/arrows/arrow-outline-selected.png", + props: (e, t) => { + const a = 30 * t; + return { + width: Vo, + height: Vo, + y: a, + rotation: $.getArrowRotation(a - et.initialPosition.y), + }; + }, + update: (e, t) => { + e.show = t && !x.isBlank; + }, + array: () => e.showArrows, + }), + ], + }); + function Xo(e, t) { + return e < t + M - 1 && e > t - M + 1; + } + const zo = { + addScore: function (e, t, a) { + let { local: i, total: n, multiplier: s } = e; + a && s++; + const o = 20 * s * (t ? 100 : a ? 10 : 1); + return ( + (i += o), + (n += o), + { local: i, total: n, multiplier: s } + ); + }, + didLand: function (e) { + return { total: e.total, local: 0, multiplier: 0 }; + }, + hitArrow: function (e, t, a) { + const i = + t <= 2 * a + ? zo.arrowValues.perfect + : t <= 4 * a + ? zo.arrowValues.great + : zo.arrowValues.ok; + e.multiplier++; + const n = Math.min(8, Math.ceil(e.multiplier / 4)); + if (i < zo.arrowValues.perfect) { + e.perfectCombo = false + }; + return ((e.total += Math.round(n * i)), i); + }, + arrowValues: { perfect: 400, great: 250, ok: 100 }, + }, + Wo = makeSprite({ + render: ({ props: e }) => [ + qo.Array({ + props: (t, a) => { + const i = e.collectibleStates[a]; + return { + collectible: t, + score: i.score, + wasPickedUp: i.wasPickedUp, + playerX: e.playerX, + fallTypes: e.fallTypes, + playerDir: e.playerDir, + paused: e.paused, + df: e.df, + theme: e.theme, + }; + }, + update: (t, a, i) => { + const n = e.collectibleStates[i]; + ((t.collectible = a), + (t.score = n.score), + (t.wasPickedUp = n.wasPickedUp), + (t.playerX = e.playerX), + (t.fallTypes = e.fallTypes), + (t.playerDir = e.playerDir), + (t.paused = e.paused), + (t.df = e.df), + (t.theme = e.theme)); + }, + updateAll: (t) => { + const a = e.frame % 100, + i = Math.max(0, a > 23 ? 46 - a : a); + ((t.spinFrame = i), (t.flipX = a > 23)); + }, + array: () => e.collectibles, + key: (t, a) => e.collectibleIndexes[a], + }), + ], + }), + qo = makeSprite({ + render: ({ props: e, getContext: t }) => + e.wasPickedUp + ? [] + : [ + onChange( + () => e.collectible.form, + () => { + if ("arrow" === e.collectible.form) { + if (e.isEditor) + return [ + y( + { + fileName: `images/themes/${t.theme == "world2" ? "punch" : "arrows"}/arrow.png`, + width: Vo, + height: Vo, + }, + (t) => { + ((t.x = e.collectible.x), + (t.y = getBlockFallY( + e.collectible.x, + e.collectible.y, + e.playerX, + e.fallTypes, + e.playerDir, + )), + (t.rotation = $.getArrowRotation( + e.collectible.y, + ))); + }, + ), + p( + { + x: e.collectible.x, + y: e.collectible.y, + width: 50, + height: 30, + opacity: 0.5, + color: "green", + }, + (t) => { + t.x = e.collectible.x; + t.y = e.collectible.y; + }, + ), + ]; + const { animationAssets: a, animationRenderer: i } = + t(Ws); + return [ + conditional( + () => e.wasPickedUp, + () => [ conditional( - () => e.wasPickedUp, - () => [ - conditional( - () => void 0 !== e.score && e.score > 0, - () => { - var t; - const n = - e.collectible.x - (e.playerX || 0); - return [ - Hs( + () => void 0 !== e.score && e.score > 0, + () => { + var t; + const n = + e.collectible.x - (e.playerX || 0); + return [ + Hs( + { + id: "ArrowHit", + animationAssets: a, + animationRenderer: i, + fileNames: Qs.spineFiles.arrow, + animationName: "animation", + loop: false, + paused: e.paused || false, + x: (e.playerX || e.collectible.x) + n, + y: getBlockFallY( + e.collectible.x, + e.collectible.y, + e.playerX, + e.fallTypes, + e.playerDir, + ), + height: 0, + rotation: $.getArrowRotation( + e.collectible.y, + ), + df: + 1.5 * + (null !== (t = e.df) && void 0 !== t + ? t + : 1), + }, + (t) => { + var a; + ((t.paused = e.paused || false), + (t.x = + e.playerX || e.collectible.x), + (t.y = getBlockFallY( + e.collectible.x, + e.collectible.y, + e.playerX, + e.fallTypes, + e.playerDir, + )), + (t.df = + 1.5 * + (null !== (a = e.df) && + void 0 !== a + ? a + : 1))); + }, + ), + jo.Single({ + shouldShow: false, + initShow: true, + fadeFrames: 50, + sprite: (t) => [ + c( { - id: "ArrowHit", - animationAssets: a, - animationRenderer: i, - fileNames: Qs.spineFiles.arrow, - animationName: "animation", - loop: false, - paused: e.paused || false, - x: (e.playerX || e.collectible.x) + n, + text: + e.score === + zo.arrowValues.perfect + ? "PERFECT!" + : e.score === + zo.arrowValues.great + ? "GREAT" + : "OK", + font: { size: 12 }, + color: ve, + x: e.collectible.x, y: getBlockFallY( e.collectible.x, e.collectible.y, @@ -36303,441 +36338,423 @@ var version = "v1.17.2"; e.fallTypes, e.playerDir, ), - height: 0, - rotation: $.getArrowRotation( - e.collectible.y, - ), - df: - 1.5 * - (null !== (t = e.df) && void 0 !== t - ? t - : 1), }, - (t) => { - var a; - ((t.paused = e.paused || false), - (t.x = - e.playerX || e.collectible.x), - (t.y = getBlockFallY( - e.collectible.x, - e.collectible.y, - e.playerX, - e.fallTypes, - e.playerDir, - )), - (t.df = - 1.5 * - (null !== (a = e.df) && - void 0 !== a - ? a - : 1))); + (a) => { + a.opacity = t.ref; + a.y = getBlockFallY( + e.collectible.x, + e.collectible.y, + e.playerX, + e.fallTypes, + e.playerDir, + ); }, ), - jo.Single({ - shouldShow: false, - initShow: true, - fadeFrames: 50, - sprite: (t) => [ - c( - { - text: - e.score === - zo.arrowValues.perfect - ? "PERFECT!" - : e.score === - zo.arrowValues.great - ? "GREAT" - : "OK", - font: { size: 12 }, - color: ve, - x: e.collectible.x, - y: getBlockFallY( - e.collectible.x, - e.collectible.y, - e.playerX, - e.fallTypes, - e.playerDir, - ), - }, - (a) => { - a.opacity = t.ref; - a.y = getBlockFallY( - e.collectible.x, - e.collectible.y, - e.playerX, - e.fallTypes, - e.playerDir, - ); - }, - ), - ], - }), - ]; - }, - () => [ - y( - { - fileName: `images/themes/${t.theme == "world2" ? "punch" : "arrows"}/arrow.png`, - width: Vo, - height: Vo, - x: e.collectible.x, - y: getBlockFallY( - e.collectible.x, - e.collectible.y, - e.playerX, - e.fallTypes, - e.playerDir, - ), - opacity: 0.5, - rotation: $.getArrowRotation( - e.collectible.y, - ), - }, - (t) => { - t.y = getBlockFallY( - e.collectible.x, - e.collectible.y, - e.playerX, - e.fallTypes, - e.playerDir, - ); - }, - ), - jo.Single({ - shouldShow: false, - initShow: true, - fadeFrames: 50, - sprite: (t) => [ - c( - { - text: "MISS", - font: { size: 12 }, - color: Ve, - x: e.collectible.x, - y: - getBlockFallY( - e.collectible.x, - e.collectible.y, - e.playerX, - e.fallTypes, - e.playerDir, - ) + 30, - }, - (a) => { - a.opacity = t.ref; - a.y = - getBlockFallY( - e.collectible.x, - e.collectible.y, - e.playerX, - e.fallTypes, - e.playerDir, - ) + 30; - }, - ), - ], - }), - ], - ), - ], + ], + }), + ]; + }, () => [ y( { - fileName: "images/themes/arrows/arrow.png", + fileName: `images/themes/${t.theme == "world2" ? "punch" : "arrows"}/arrow.png`, width: Vo, height: Vo, + x: e.collectible.x, + y: getBlockFallY( + e.collectible.x, + e.collectible.y, + e.playerX, + e.fallTypes, + e.playerDir, + ), + opacity: 0.5, + rotation: $.getArrowRotation( + e.collectible.y, + ), }, (t) => { - ((t.x = e.collectible.x), - (t.y = getBlockFallY( - e.collectible.x, - e.collectible.y, - e.playerX, - e.fallTypes, - e.playerDir, - )), - (t.rotation = $.getArrowRotation( - e.collectible.y, - ))); + t.y = getBlockFallY( + e.collectible.x, + e.collectible.y, + e.playerX, + e.fallTypes, + e.playerDir, + ); }, ), + jo.Single({ + shouldShow: false, + initShow: true, + fadeFrames: 50, + sprite: (t) => [ + c( + { + text: "MISS", + font: { size: 12 }, + color: Ve, + x: e.collectible.x, + y: + getBlockFallY( + e.collectible.x, + e.collectible.y, + e.playerX, + e.fallTypes, + e.playerDir, + ) + 30, + }, + (a) => { + a.opacity = t.ref; + a.y = + getBlockFallY( + e.collectible.x, + e.collectible.y, + e.playerX, + e.fallTypes, + e.playerDir, + ) + 30; + }, + ), + ], + }), ], ), - ]; - } - return [ + ], + () => [ + y( + { + fileName: "images/themes/arrows/arrow.png", + width: Vo, + height: Vo, + }, + (t) => { + ((t.x = e.collectible.x), + (t.y = getBlockFallY( + e.collectible.x, + e.collectible.y, + e.playerX, + e.fallTypes, + e.playerDir, + )), + (t.rotation = $.getArrowRotation( + e.collectible.y, + ))); + }, + ), + ], + ), + ]; + } + return [ + conditional( + () => e.theme === "infinite", + () => [ conditional( - () => e.theme === "infinite", + () => e.wasPickedUp, () => [ - conditional( - () => e.wasPickedUp, - () => [ - // not yet - ], - () => [ - y( - { - fileName: "images/themes/infinite/collectible.png", - width: 25, - height: 25, - }, - (t) => { - ((t.x = e.collectible.x), - (t.y = getBlockFallY( - e.collectible.x, - e.collectible.y, - e.playerX, - e.fallTypes, - e.playerDir, - ))); - }, - ), - ], + // not yet + ], + () => [ + y( + { + fileName: "images/themes/infinite/collectible.png", + width: 25, + height: 25, + }, + (t) => { + ((t.x = e.collectible.x), + (t.y = getBlockFallY( + e.collectible.x, + e.collectible.y, + e.playerX, + e.fallTypes, + e.playerDir, + ))); + }, ), ], + ), + ], + () => [ + conditional( + () => e.wasPickedUp, () => [ - conditional( - () => e.wasPickedUp, - () => [ - triggerableSpriteSheet.Single( - { - fileName: - "images/themes/synthwave/collectible-pickup.png", - columns: 4, - rows: 3, - frameRate: 3, - width: 27, - height: 52, - x: e.collectible.x, - y: getBlockFallY( - e.collectible.x, - e.collectible.y, - e.playerX, - e.fallTypes, - e.playerDir, - ), - paused: false, - df: 1, - hideOnEnd: true, - }, - (t) => { - ((t.x = e.collectible.x), - (t.y = getBlockFallY( - e.collectible.x, - e.collectible.y, - e.playerX, - e.fallTypes, - e.playerDir, - ))); - }, - ), - ], - () => [ - loopingSpriteSheet.Single( - { - fileName: `images/themes/synthwave/collectible.png`, - width: 29, - height: 29, - columns: 4, - rows: 2, - x: e.collectible.x, - y: getBlockFallY( - e.collectible.x, - e.collectible.y, - e.playerX, - e.fallTypes, - e.playerDir, - ), - scaleX: 1, - frame: 0, - frameRate: 3, - }, - (t) => { - ((t.x = e.collectible.x), - (t.y = getBlockFallY( - e.collectible.x, - e.collectible.y, - e.playerX, - e.fallTypes, - e.playerDir, - )), - (t.scaleX = e.flipX ? -1 : 1), - (t.frame = e.spinFrame || 0)); - }, + triggerableSpriteSheet.Single( + { + fileName: + "images/themes/synthwave/collectible-pickup.png", + columns: 4, + rows: 3, + frameRate: 3, + width: 27, + height: 52, + x: e.collectible.x, + y: getBlockFallY( + e.collectible.x, + e.collectible.y, + e.playerX, + e.fallTypes, + e.playerDir, ), - - ], + paused: false, + df: 1, + hideOnEnd: true, + }, + (t) => { + ((t.x = e.collectible.x), + (t.y = getBlockFallY( + e.collectible.x, + e.collectible.y, + e.playerX, + e.fallTypes, + e.playerDir, + ))); + }, ), - ] - ), - - e.isEditor - ? p( + ], + () => [ + loopingSpriteSheet.Single( { + fileName: `images/themes/synthwave/collectible.png`, + width: 29, + height: 29, + columns: 4, + rows: 2, x: e.collectible.x, - y: e.collectible.y, - width: 20, - height: 20, - color: "green", - opacity: 0.5, + y: getBlockFallY( + e.collectible.x, + e.collectible.y, + e.playerX, + e.fallTypes, + e.playerDir, + ), + scaleX: 1, + frame: 0, + frameRate: 3, }, (t) => { - t.x = e.collectible.x; - t.y = e.collectible.y; + ((t.x = e.collectible.x), + (t.y = getBlockFallY( + e.collectible.x, + e.collectible.y, + e.playerX, + e.fallTypes, + e.playerDir, + )), + (t.scaleX = e.flipX ? -1 : 1), + (t.frame = e.spinFrame || 0)); }, - ) - : null, - ]; - }, - ), - ], - }), - $o = makeSprite({ - init: () => ({ hitCount: 0 }), - loop({ props: e, state: t }) { - e.justHit && t.hitCount++; - }, - render({ props: e, state: t, getContext: a }) { - if (e.isEditor && !e.spineContext) - return [ - y( - { - fileName: "images/editor/editorOnly/spring.png", - width: 30, - height: 15 * e.spring.direction, - }, - (t) => { - ((t.x = e.spring.x), - (t.y = getBlockFallY( - e.spring.x, - e.spring.y, - e.inGame && e.inGame.playerX, - e.inGame && e.inGame.fallTypes, - e.inGame && e.inGame.playerDir, - )), - (t.height = 15 * e.spring.direction)); - }, - ), - ]; - const { animationAssets: i, animationRenderer: n } = - e.spineContext || a(Ws); - return [ - onChange( - () => t.hitCount, - () => [ - Hs( - { - id: "SpringSpine", - animationAssets: i, - animationRenderer: n, - animationName: "animation", - fileNames: Qs.spineFiles.spring, - loop: false, - df: 0 === t.hitCount ? 0 : e.df || 1, - paused: e.paused || false, - x: e.spring.x, - y: getBlockFallY( - e.spring.x, - e.spring.y, - e.inGame && e.inGame.playerX, - e.inGame && e.inGame.fallTypes, - e.inGame && e.inGame.playerDir, - ), - scale: { x: 1, y: e.spring.direction || 1 }, - height: e.spring.height, - }, - (a) => { - ((a.df = 0 === t.hitCount ? 0 : e.df || 1), - (a.paused = e.paused || false), - (a.x = e.spring.x), - (a.y = - getBlockFallY( - e.spring.x, - e.spring.y, - e.inGame && e.inGame.playerX, - e.inGame && e.inGame.fallTypes, - e.inGame && e.inGame.playerDir, - ) + (e.spring.direction < 0 ? 15 : 0))); - a.scale = { - x: e.scale || 1, - y: (e.spring.direction || 1) * (e.scale || 1), - }; - }, - ), - ], + ), + + ], + ), + ] + ), + + e.isEditor + ? p( + { + x: e.collectible.x, + y: e.collectible.y, + width: 20, + height: 20, + color: "green", + opacity: 0.5, + }, + (t) => { + t.x = e.collectible.x; + t.y = e.collectible.y; + }, + ) + : null, + ]; + }, + ), + ], + }), + $o = makeSprite({ + init: () => ({ hitCount: 0 }), + loop({ props: e, state: t }) { + e.justHit && t.hitCount++; + }, + render({ props: e, state: t, getContext: a }) { + if (e.isEditor && !e.spineContext) + return [ + y( + { + fileName: "images/editor/editorOnly/spring.png", + width: 30, + height: 15 * e.spring.direction, + }, + (t) => { + ((t.x = e.spring.x), + (t.y = getBlockFallY( + e.spring.x, + e.spring.y, + e.inGame && e.inGame.playerX, + e.inGame && e.inGame.fallTypes, + e.inGame && e.inGame.playerDir, + )), + (t.height = 15 * e.spring.direction)); + }, ), ]; - }, - }), - Jo = makeSprite({ - render({ props: e, getContext: t }) { - var a; - if (e.isEditor && !e.spineContext) - return [ - Qo.Single( - { portal: e.portal, pixel: e.theme == "world2" }, - (t) => { - ((t.portal = e.portal), - (t.x = e.portal.x), - (t.y = getBlockFallY( + const { animationAssets: i, animationRenderer: n } = + e.spineContext || a(Ws); + return [ + onChange( + () => t.hitCount, + () => [ + Hs( + { + id: "SpringSpine", + animationAssets: i, + animationRenderer: n, + animationName: "animation", + fileNames: Qs.spineFiles.spring, + loop: false, + df: 0 === t.hitCount ? 0 : e.df || 1, + paused: e.paused || false, + x: e.spring.x, + y: getBlockFallY( + e.spring.x, + e.spring.y, + e.inGame && e.inGame.playerX, + e.inGame && e.inGame.fallTypes, + e.inGame && e.inGame.playerDir, + ), + scale: { x: 1, y: e.spring.direction || 1 }, + height: e.spring.height, + }, + (a) => { + ((a.df = 0 === t.hitCount ? 0 : e.df || 1), + (a.paused = e.paused || false), + (a.x = e.spring.x), + (a.y = + getBlockFallY( + e.spring.x, + e.spring.y, + e.inGame && e.inGame.playerX, + e.inGame && e.inGame.fallTypes, + e.inGame && e.inGame.playerDir, + ) + (e.spring.direction < 0 ? 15 : 0))); + a.scale = { + x: e.scale || 1, + y: (e.spring.direction || 1) * (e.scale || 1), + }; + }, + ), + ], + ), + ]; + }, + }), + Jo = makeSprite({ + render({ props: e, getContext: t }) { + var a; + if (e.isEditor && !e.spineContext) + return [ + Qo.Single( + { portal: e.portal, pixel: e.theme == "world2" }, + (t) => { + ((t.portal = e.portal), + (t.x = e.portal.x), + (t.y = getBlockFallY( + e.portal.x, + e.portal.y, + e.inGame && e.inGame.playerX, + e.inGame && e.inGame.fallTypes, + e.inGame && e.inGame.playerDir, + )), + (t.rotation = + "right" === e.portal.direction + ? 180 + : "up" === e.portal.direction + ? 90 + : "down" === e.portal.direction + ? 270 + : 0)); + }, + ), + ]; + let { animationAssets: i, animationRenderer: n } = + e.spineContext || t(Ws), + s = Ko[e.portal.pairId % Ko.length]; + let o = 0, + r = 0, + l = 1, + c = 1, + d = ""; + switch (e.portal.direction) { + case "left": + ((d = "vertical"), (o = 1)); + break; + case "right": + ((d = "vertical"), (l = -1), (o = -1)); + break; + case "up": + ((d = "horizontal"), (r = 44)); + break; + case "down": + ((d = "horizontal"), (c = -1), (r = 52)); + } + return [ + onChange( + () => `${d}_${s}`, + () => [ + Hs( + { + id: "Portal", + animationAssets: i, + animationRenderer: n, + animationName: `${d}_${s}`, + fileNames: + e.theme == "world2" + ? Qs.spineFiles.pixelPortal + : Qs.spineFiles.portal, + loop: true, + paused: e.paused || false, + df: null !== (a = e.df) && void 0 !== a ? a : 1, + scale: { x: l, y: c }, + x: e.portal.x - o, + y: + getBlockFallY( e.portal.x, e.portal.y, e.inGame && e.inGame.playerX, e.inGame && e.inGame.fallTypes, e.inGame && e.inGame.playerDir, - )), - (t.rotation = - "right" === e.portal.direction - ? 180 - : "up" === e.portal.direction - ? 90 - : "down" === e.portal.direction - ? 270 - : 0)); + ) - + 3 + + r, + height: e.portal.height, }, - ), - ]; - let { animationAssets: i, animationRenderer: n } = - e.spineContext || t(Ws), - s = Ko[e.portal.pairId % Ko.length]; - let o = 0, - r = 0, - l = 1, - c = 1, - d = ""; - switch (e.portal.direction) { - case "left": - ((d = "vertical"), (o = 1)); - break; - case "right": - ((d = "vertical"), (l = -1), (o = -1)); - break; - case "up": - ((d = "horizontal"), (r = 44)); - break; - case "down": - ((d = "horizontal"), (c = -1), (r = 52)); - } - return [ - onChange( - () => `${d}_${s}`, - () => [ - Hs( - { - id: "Portal", - animationAssets: i, - animationRenderer: n, - animationName: `${d}_${s}`, - fileNames: - e.theme == "world2" - ? Qs.spineFiles.pixelPortal - : Qs.spineFiles.portal, - loop: true, - paused: e.paused || false, - df: null !== (a = e.df) && void 0 !== a ? a : 1, - scale: { x: l, y: c }, - x: e.portal.x - o, - y: + (t) => { + s = Ko[e.portal.pairId % Ko.length]; + var a; + ((o = 0), (r = 0), (l = 1), (c = 1), (d = "")); + switch (e.portal.direction) { + case "left": + ((d = "vertical"), (o = 1)); + break; + case "right": + ((d = "vertical"), (l = -1), (o = -1)); + break; + case "up": + ((d = "horizontal"), (r = 44)); + break; + case "down": + ((d = "horizontal"), (c = -1), (r = 52)); + } + ((t.animationName = `${d}_${s}`), + (t.scale = { + x: l * (e.scale || 1), + y: c * (e.scale || 1), + }), + (t.paused = e.paused || false), + (t.df = null !== (a = e.df) && void 0 !== a ? a : 1), + (t.x = e.portal.x - o), + (t.y = getBlockFallY( e.portal.x, e.portal.y, @@ -36746,86 +36763,158 @@ var version = "v1.17.2"; e.inGame && e.inGame.playerDir, ) - 3 + - r, - height: e.portal.height, - }, - (t) => { - s = Ko[e.portal.pairId % Ko.length]; - var a; - ((o = 0), (r = 0), (l = 1), (c = 1), (d = "")); - switch (e.portal.direction) { - case "left": - ((d = "vertical"), (o = 1)); - break; - case "right": - ((d = "vertical"), (l = -1), (o = -1)); - break; - case "up": - ((d = "horizontal"), (r = 44)); - break; - case "down": - ((d = "horizontal"), (c = -1), (r = 52)); - } - ((t.animationName = `${d}_${s}`), - (t.scale = { - x: l * (e.scale || 1), - y: c * (e.scale || 1), - }), - (t.paused = e.paused || false), - (t.df = null !== (a = e.df) && void 0 !== a ? a : 1), - (t.x = e.portal.x - o), - (t.y = - getBlockFallY( - e.portal.x, - e.portal.y, - e.inGame && e.inGame.playerX, - e.inGame && e.inGame.fallTypes, - e.inGame && e.inGame.playerDir, - ) - - 3 + - r)); - }, + r)); + }, + ), + ], + ), + ]; + }, + }), + Ko = ["green", "blue", "red", "yellow"], + Qo = makeSprite({ + render: ({ props: e }) => [ + onChange( + () => e.portal.pairId, + () => { + const t = Ko[e.portal.pairId % Ko.length]; + return [ + y({ + fileName: `images/themes/${e.pixel ? "world2" : "world4"}/portal-${t}.png`, + width: 56, + height: 97, + x: -12, + }), + ]; + }, + ), + ], + }), + Zo = (e) => e.replace(/([a-z])([A-Z])/g, "$1 $2").toLocaleUpperCase(), + er = makeSprite({ + init: () => ({ hitCount: 0 }), + loop({ props: e, state: t }) { + e.justHit && t.hitCount++; + }, + render({ props: e, state: t, getContext: a }) { + if (e.theme == "world2") { + return [ + loopingSpriteSheet.Single( + { + fileName: "images/themes/world2/speed-change.png", + width: e.speedChange.width, + height: e.speedChange.height, + columns: 4, + rows: 2, + x: e.speedChange.x, + y: getBlockFallY( + e.speedChange.x, + e.speedChange.y, + e.inGame && e.inGame.playerX, + e.inGame && e.inGame.fallTypes, + e.inGame && e.inGame.playerDir, + ), + scaleX: "right" === e.speedChange.direction ? 1 : -1, + frame: 0, + frameRate: 3, + }, + (t) => { + ((t.x = e.speedChange.x), + (t.y = getBlockFallY( + e.speedChange.x, + e.speedChange.y, + e.inGame && e.inGame.playerX, + e.inGame && e.inGame.fallTypes, + e.inGame && e.inGame.playerDir, + )), + (t.scaleX = + "right" === e.speedChange.direction ? 1 : -1), + (t.frame = 0)); + }, + ), + ifConditional( + () => t.hitCount > 0, + () => [ + onChange( + () => t.hitCount, + () => [ + triggerableSpriteSheet.Single( + { + id: "Hit", + fileName: "images/themes/world2/speed-change.png", + columns: 4, + rows: 2, + frameRate: 3, + width: e.speedChange.width, + height: e.speedChange.height, + df: 0 === t.hitCount ? 0 : e.df || 0, + hideOnEnd: true, + }, + (t) => { + var a; + ((t.paused = e.paused || false), + (t.x = e.speedChange.x), + (t.y = getBlockFallY( + e.speedChange.x, + e.speedChange.y, + e.inGame && e.inGame.playerX, + e.inGame && e.inGame.fallTypes, + e.inGame && e.inGame.playerDir, + )), + (t.scaleX = + "right" === e.speedChange.direction ? 1 : -1), + (t.width = e.speedChange.width), + (t.height = e.speedChange.height), + (t.df = 0 === t.hitCount ? 0 : e.df || 0)); + }, + ), + ], ), ], ), ]; - }, - }), - Ko = ["green", "blue", "red", "yellow"], - Qo = makeSprite({ - render: ({ props: e }) => [ + } + if (bgOnly) + return [ + y( + { + fileName: bgOnly + ? "images/themes/blank/block.png" + : "images/editor/editorOnly/speed-change.png", + width: e.speedChange.width, + height: e.speedChange.height, + }, + (t) => { + ((t.x = e.speedChange.x), + (t.y = getBlockFallY( + e.speedChange.x, + e.speedChange.y, + e.inGame && e.inGame.playerX, + e.inGame && e.inGame.fallTypes, + e.inGame && e.inGame.playerDir, + )), + (t.scaleX = + "right" === e.speedChange.direction ? 1 : -1)); + }, + ), + ]; + const { animationAssets: i, animationRenderer: n } = + e.spineContext || a(Ws); + return [ onChange( - () => e.portal.pairId, - () => { - const t = Ko[e.portal.pairId % Ko.length]; - return [ - y({ - fileName: `images/themes/${e.pixel ? "world2" : "world4"}/portal-${t}.png`, - width: 56, - height: 97, - x: -12, - }), - ]; - }, - ), - ], - }), - Zo = (e) => e.replace(/([a-z])([A-Z])/g, "$1 $2").toLocaleUpperCase(), - er = makeSprite({ - init: () => ({ hitCount: 0 }), - loop({ props: e, state: t }) { - e.justHit && t.hitCount++; - }, - render({ props: e, state: t, getContext: a }) { - if (e.theme == "world2") { - return [ - loopingSpriteSheet.Single( + () => t.hitCount, + () => [ + Hs( { - fileName: "images/themes/world2/speed-change.png", - width: e.speedChange.width, - height: e.speedChange.height, - columns: 4, - rows: 2, + id: "SpeedSpine", + animationAssets: i, + animationRenderer: n, + animationName: "animation", + fileNames: Qs.spineFiles.speedChange, + loop: false, + df: (0 === t.hitCount ? 0 : e.df || 1) / 1.2, + startFromFrame: 2, + paused: e.paused || false, x: e.speedChange.x, y: getBlockFallY( e.speedChange.x, @@ -36834,1187 +36923,864 @@ var version = "v1.17.2"; e.inGame && e.inGame.fallTypes, e.inGame && e.inGame.playerDir, ), - scaleX: "right" === e.speedChange.direction ? 1 : -1, - frame: 0, - frameRate: 3, + scale: { + x: + ("right" === e.speedChange.direction ? 1 : -1) * + (e.scale || 1), + y: e.scale || 1, + }, + height: 0, }, - (t) => { - ((t.x = e.speedChange.x), - (t.y = getBlockFallY( + (a) => { + ((a.df = (0 === t.hitCount ? 0 : e.df || 1) / 1.2), + (a.scale = { + x: + ("right" === e.speedChange.direction ? 1 : -1) * + (e.scale || 1), + y: e.scale || 1, + }), + (a.paused = e.paused || false), + (a.x = e.speedChange.x), + (a.y = getBlockFallY( e.speedChange.x, e.speedChange.y, e.inGame && e.inGame.playerX, e.inGame && e.inGame.fallTypes, e.inGame && e.inGame.playerDir, - )), - (t.scaleX = - "right" === e.speedChange.direction ? 1 : -1), - (t.frame = 0)); + ))); }, ), - ifConditional( - () => t.hitCount > 0, - () => [ - onChange( - () => t.hitCount, - () => [ - triggerableSpriteSheet.Single( - { - id: "Hit", - fileName: "images/themes/world2/speed-change.png", - columns: 4, - rows: 2, - frameRate: 3, - width: e.speedChange.width, - height: e.speedChange.height, - df: 0 === t.hitCount ? 0 : e.df || 0, - hideOnEnd: true, - }, - (t) => { - var a; - ((t.paused = e.paused || false), - (t.x = e.speedChange.x), - (t.y = getBlockFallY( - e.speedChange.x, - e.speedChange.y, - e.inGame && e.inGame.playerX, - e.inGame && e.inGame.fallTypes, - e.inGame && e.inGame.playerDir, - )), - (t.scaleX = - "right" === e.speedChange.direction ? 1 : -1), - (t.width = e.speedChange.width), - (t.height = e.speedChange.height), - (t.df = 0 === t.hitCount ? 0 : e.df || 0)); - }, - ), - ], - ), - ], - ), - ]; - } - if (bgOnly) - return [ - y( - { - fileName: bgOnly - ? "images/themes/blank/block.png" - : "images/editor/editorOnly/speed-change.png", - width: e.speedChange.width, - height: e.speedChange.height, - }, - (t) => { - ((t.x = e.speedChange.x), - (t.y = getBlockFallY( - e.speedChange.x, - e.speedChange.y, - e.inGame && e.inGame.playerX, - e.inGame && e.inGame.fallTypes, - e.inGame && e.inGame.playerDir, - )), - (t.scaleX = - "right" === e.speedChange.direction ? 1 : -1)); - }, - ), - ]; - const { animationAssets: i, animationRenderer: n } = - e.spineContext || a(Ws); - return [ - onChange( - () => t.hitCount, - () => [ - Hs( - { - id: "SpeedSpine", - animationAssets: i, - animationRenderer: n, - animationName: "animation", - fileNames: Qs.spineFiles.speedChange, - loop: false, - df: (0 === t.hitCount ? 0 : e.df || 1) / 1.2, - startFromFrame: 2, - paused: e.paused || false, - x: e.speedChange.x, - y: getBlockFallY( - e.speedChange.x, - e.speedChange.y, - e.inGame && e.inGame.playerX, - e.inGame && e.inGame.fallTypes, - e.inGame && e.inGame.playerDir, - ), - scale: { - x: - ("right" === e.speedChange.direction ? 1 : -1) * - (e.scale || 1), - y: e.scale || 1, - }, - height: 0, - }, - (a) => { - ((a.df = (0 === t.hitCount ? 0 : e.df || 1) / 1.2), - (a.scale = { - x: - ("right" === e.speedChange.direction ? 1 : -1) * - (e.scale || 1), - y: e.scale || 1, - }), - (a.paused = e.paused || false), - (a.x = e.speedChange.x), - (a.y = getBlockFallY( - e.speedChange.x, - e.speedChange.y, - e.inGame && e.inGame.playerX, - e.inGame && e.inGame.fallTypes, - e.inGame && e.inGame.playerDir, - ))); - }, - ), - ], - ), - ]; - }, - }), - tr = makeCustomSprite({ - render: ({ props: e }) => [ - So({ - id: "ToolsBg", - width: 45, - height: 270, - topColour: Fe, - bottomColour: ve, - raiseHeight: 5, - rad: 5, - stroke: { thickness: 2, colour: Ye }, - }), - vo({ - id: "Pointer", - fileName: "images/editor/pointer.png", - testId: "PointerButton", - onPress: () => { - e.selectTool({ type: "pointer" }); + ], + ), + ]; + }, + }), + tr = makeCustomSprite({ + render: ({ props: e }) => [ + So({ + id: "ToolsBg", + width: 45, + height: 270, + topColour: Fe, + bottomColour: ve, + raiseHeight: 5, + rad: 5, + stroke: { thickness: 2, colour: Ye }, + }), + vo({ + id: "Pointer", + fileName: "images/editor/pointer.png", + testId: "PointerButton", + onPress: () => { + e.selectTool({ type: "pointer" }); + }, + isSelected: "pointer" === e.selectedTool.type, + isOpen: false, + y: 120, + }), + vo({ + id: "SelectDrag", + testId: "SelectDragButton", + fileName: "images/editor/select.png", + onPress: () => { + e.selectTool({ type: "selectDrag" }); + }, + isSelected: "selectDrag" === e.selectedTool.type, + isOpen: false, + y: 76, + }), + vo({ + id: "PlaceLevelObject", + testId: "PlaceLevelObjectButton", + fileName: "images/editor/add.png", + onPress: () => { + e.setMenuOpen("objects"); + }, + isSelected: "placeLevelObject" === e.selectedTool.type, + isOpen: "objects" === e.menuView, + y: 32, + }), + vo({ + id: "Erase", + fileName: "images/editor/eraser.png", + onPress: () => { + e.selectTool({ type: "erase" }); + }, + isSelected: "erase" === e.selectedTool.type, + isOpen: false, + y: -12, + }), + vo({ + id: "Undo", + disabled: !e.canUndo, + fileName: "images/editor/undo.png", + onPress: () => { + (e.unselectAllObjects(), e.send({ type: "undo" })); + }, + isSelected: false, + isOpen: false, + y: -56, + }), + void (window.onbeforeunload = !e.canUndo + ? undefined + : () => + "You have unsaved changes. Are you sure you want to return to the main menu?"), + vo({ + id: "Theme", + fileName: "images/editor/theme.png", + onPress: () => { + e.setMenuOpen("theme"); + }, + isOpen: "theme" === e.menuView, + isSelected: false, + y: -100, + }), + "objects" === e.menuView + ? ir({ + id: "AddLevelObjectMenu", + onPress: (t) => { + (e.setMenuOpen("closed"), + e.selectTool({ type: "placeLevelObject", object: t })); }, - isSelected: "pointer" === e.selectedTool.type, - isOpen: false, - y: 120, - }), - vo({ - id: "SelectDrag", - testId: "SelectDragButton", - fileName: "images/editor/select.png", - onPress: () => { - e.selectTool({ type: "selectDrag" }); + closeMenu: () => { + e.setMenuOpen("closed"); }, - isSelected: "selectDrag" === e.selectedTool.type, - isOpen: false, - y: 76, + features: e.features, + theme: e.theme, + x: 22.5 + ar / 2, + y: 10, + }) + : "theme" === e.menuView + ? themeMenu({ + id: "ThemeMenu", + theme: e.theme, + themes: e.themes, + useGround: e.useGround, + isLoading: e.isLoading, + selectTheme: e.selectTheme, + toggleGround: e.toggleGround, + closeMenu: () => { + e.setMenuOpen("closed"); + }, + x: 22.5 + ar / 2, + y: 10, + }) + : null, + ], + }), + ar = 150, + ir = makeCustomSprite({ + init({ + props: { + features: e, + theme: { objects: t, player: a }, + }, + getContext, + }) { + const i = $.newBlock(), + n = $.newMiniBlock(), + s = $.newSpike(), + o = $.newMiniSpike(), + r = $.newPlatform(), + l = $.newDirectionChange({ fixSync: true }), + c = $.newSpeedChange(), + d = $.newFlag(), + u = $.newPowerup({ + item: e.includes("doubleJump") + ? "doubleJump" + : e.includes("gun") + ? "gun" + : e.includes("jetpack") + ? "jetpack" + : e.includes("playerStacks") + ? "playerStack" + : e.includes("skateboard") + ? "skateboard" + : e.includes("punch") + ? "punch" + : void 0, + compatible: false, }), - vo({ - id: "PlaceLevelObject", - testId: "PlaceLevelObjectButton", - fileName: "images/editor/add.png", - onPress: () => { - e.setMenuOpen("objects"); - }, - isSelected: "placeLevelObject" === e.selectedTool.type, - isOpen: "objects" === e.menuView, - y: 32, + h = $.newSaw(), + p = $.newEnemy({ + kind: + e.includes("walkingEnemy") || e.includes("giantEnemy") + ? "walker" + : e.includes("flyingEnemy") + ? "shooter" + : void 0, + giant: + e.includes("giantEnemy") && !e.includes("walkingEnemy"), + isCompatible: false, }), - vo({ - id: "Erase", - fileName: "images/editor/eraser.png", - onPress: () => { - e.selectTool({ type: "erase" }); - }, - isSelected: "erase" === e.selectedTool.type, - isOpen: false, - y: -12, + g = $.newSwitchButton({ + affects: e.includes("switchButton") + ? "movement" + : e.includes("switchBlockSpike") + ? "blockSpike" + : void 0, }), - vo({ - id: "Undo", - disabled: !e.canUndo, - fileName: "images/editor/undo.png", - onPress: () => { - (e.unselectAllObjects(), e.send({ type: "undo" })); - }, - isSelected: false, - isOpen: false, - y: -56, + m = $.newSwitchPlatform({ + initPosition: "right", + direction: 0, }), - void (window.onbeforeunload = !e.canUndo - ? undefined - : () => - "You have unsaved changes. Are you sure you want to return to the main menu?"), - vo({ - id: "Theme", - fileName: "images/editor/theme.png", + f = $.newCollectible({ + form: e.includes("collectible") + ? "coin" + : e.includes("arrows") + ? "arrow" + : void 0, + }), + y = $.newSpring(), + q = $.newSwitchBlock(), + switchSpike = $.newSwitchSpike(), + E = $.newPortal(); + return { + objects: [ + { + name: localize(Zo(i.type)), + object: i, + iconName: "images/editor/objects/block.png", + sprite: Ja.Single({ + id: "Block", + blocks: [i], + theme: t.block, + }), + unlocked: true, + }, + { + name: localize("MINI BLOCK"), + object: n, + iconName: "images/editor/objects/miniblock.png", + sprite: Ja.Single({ + id: "MiniBlock", + blocks: [n], + theme: t.block, + }), + unlocked: true, + }, + { + name: localize(Zo(s.type)), + object: s, + iconName: "images/editor/objects/spike.png", + sprite: Za.Single({ + id: "Spike", + spikes: [s], + theme: t.spike, + }), + unlocked: true, + }, + { + name: localize("MINI SPIKE"), + object: o, + iconName: "images/editor/objects/minispike.png", + sprite: Za.Single({ + id: "MiniSpike", + spikes: [o], + theme: t.spike, + }), + unlocked: true, + }, + { + name: localize(Zo(r.type)), + object: r, + iconName: "images/editor/objects/platform.png", + sprite: Qa.Single({ + id: "Platform", + platforms: [r], + theme: t.platform, + }), + unlocked: true, + }, + { + name: localize(Zo(l.type)), + object: l, + iconName: "images/editor/objects/dirchange.png", + sprite: Zs.Single({ + id: "DirectionChange", + directionChange: l, + theme: t.dirChange, + isEditor: true, + spineContext: getContext(Ws), + }), + unlocked: true, + }, + { + name: localize(Zo(d.type)), + object: d, + iconName: "images/editor/objects/flag.png", + sprite: ao.Single({ + id: "Flag", + flag: d, + theme: t.flag, + spineContext: getContext(Ws), + }), + unlocked: true, + }, + { + name: localize(Zo(h.type)), + object: h, + iconName: "images/editor/objects/saw.png", + sprite: eo.Single({ + id: "Saws", + saws: [$.newSaw()], + theme: t.saw, + bigTheme: t.spike, + }), + unlocked: e.includes("saws"), + }, + { + name: localize(Zo(u.type)), + object: u, + iconName: "images/editor/objects/powerup.png", + sprite: Co.Single({ + id: "Powerup", + powerup: u, + skin: a, + isEditor: true, + theme: t.speedChange, + spineContext: getContext(Ws), + }), + unlocked: + e.includes("gun") || + e.includes("doubleJump") || + e.includes("playerStacks") || + e.includes("skateboard") || + e.includes("punch") || + e.includes("jetpack"), + }, + { + name: localize(Zo(p.type)), + object: p, + iconName: "images/editor/objects/enemy.png", + sprite: yo.Single({ + id: "Enemy", + enemy: p, + spineContext: getContext(Ws), + }), + unlocked: + e.includes("walkingEnemy") || + e.includes("giantEnemy") || + e.includes("flyingEnemy"), + }, + { + name: localize(Zo(m.type)), + object: m, + iconName: "images/editor/objects/switchplatform.png", + sprite: Po.Single({ + id: "SwitchPlatform", + switchPlatforms: [m], + theme: t.switch, + }), + unlocked: + e.includes("moveOnJump") || e.includes("switchButton"), + }, + { + name: localize("SWITCH BLOCK"), + object: q, + iconName: "images/editor/objects/block.png", + unlocked: true, + }, + { + name: localize("SWITCH SPIKE"), + object: switchSpike, + iconName: "images/editor/objects/spike.png", + unlocked: true, + }, + { + name: localize(Zo(g.type)), + object: g, + iconName: "images/editor/objects/switch.png", + sprite: xo.Single({ + id: "SwitchButton", + switchButton: g, + switchRotation: 0, + switchBlockSpikes: false, + isEditor: true, + justHit: false, + theme: t.switch, + spineContext: getContext(Ws), + playerScale: 1, + }), + unlocked: + e.includes("switchButton") || + e.includes("switchBlockSpike"), + }, + { + name: localize(Zo(f.type)), + object: f, + iconName: "images/editor/objects/collectible.png", + sprite: qo.Single({ + id: "Collectible", + collectible: f, + wasPickedUp: false, + isEditor: true, + theme: t.switch, + }), + unlocked: e.includes("collectible") || e.includes("arrows"), + }, + { + name: localize(Zo(y.type)), + object: y, + iconName: "images/editor/objects/spring.png", + sprite: $o.Single({ + id: "Spring", + spring: y, + justHit: false, + isEditor: true, + spineContext: getContext(Ws), + }), + unlocked: e.includes("spring"), + }, + { + name: localize(Zo(E.type)), + object: E, + iconName: "images/editor/objects/portal.png", + sprite: Jo.Single({ + id: "Portal", + portal: E, + isEditor: true, + theme: t.switch, + spineContext: getContext(Ws), + }), + unlocked: e.includes("portals"), + }, + { + name: localize(Zo(c.type)), + object: c, + iconName: "images/editor/objects/speedchange.png", + sprite: er.Single({ + id: "SpeedChange", + speedChange: c, + isEditor: true, + justHit: false, + theme: t.speedChange, + spineContext: getContext(Ws), + }), + unlocked: e.includes("speedChange"), + }, + ], + }; + }, + render: ({ props: e, state: { objects: t } }) => [ + Clickable({ + id: "ClickOutside", + onPressOutside: e.closeMenu, + width: ar, + height: 300, + sprites: () => [], + onPress: () => null, + }), + r({ + path: [ + [-ar / 2, 150], + [ar / 2, 150], + [ar / 2, -120], + [ar / 2 - 30, -150], + [-ar / 2, -150], + ], + fillColor: ve, + }), + o({ width: ar - 20, height: 280, x: -10, y: 10, color: je }), + ScrollContainer({ + id: "ScrollContainer", + containerHeight: 280, + containerWidth: ar - 20, + contentHeight: t.length * nr + 20, + x: -10, + y: 150, + sprites: (a) => + t.map((t, i) => + sr({ + id: `AddLevelObjectButton-${i}`, + name: t.name, + iconName: t.iconName, + locked: !t.unlocked, + noPress: a, + onPress: () => { + e.onPress(t.object); + }, + y: -nr * i - 20, + }), + ), + }), + ], + }), + nr = 35, + sr = makeCustomSprite({ + init: () => ({ showInfoTimer: 0 }), + loop: ({ state: e }) => + e.showInfoTimer > 0 + ? Object.assign(Object.assign({}, e), { + showInfoTimer: e.showInfoTimer - 1, + }) + : e, + render({ props: e, state: t, updateState: a }) { + var i = ar - 20, + s = nr - 5, + r = (e.locked ? "LOCKED" : e.name).split(" "), + c = r.length > 1; + if (r.length == 3) { + r = [`${r[0]} ${r[1]}`, r[2]]; + } + return [ + Clickable({ + id: "Clickable", + width: i, + height: s, + disabled: e.noPress, onPress: () => { - e.setMenuOpen("theme"); + e.locked + ? a((e) => + Object.assign(Object.assign({}, e), { + showInfoTimer: 60, + }), + ) + : e.onPress(); }, - isOpen: "theme" === e.menuView, - isSelected: false, - y: -100, + sprites: (t) => [ + So({ + id: "RaisedRects", + x: -45, + width: 30, + height: s, + raiseHeight: 3, + rad: 3, + topColour: e.locked ? Xe : Re, + bottomColour: ve, + isPressed: t, + stroke: { thickness: 2, colour: e.locked ? ze : Ye }, + }), + l({ + fileName: e.iconName, + width: 15, + height: 15, + x: -45, + y: 1.5 + (t ? -3 : 0), + }), + ...r.map((t, a) => + n({ + text: t, + color: e.locked ? Xe : Be, + font: { align: "left" }, + x: -25, + y: c ? (0 === a ? 6 : -6) : 0, + }), + ), + ], }), - "objects" === e.menuView - ? ir({ - id: "AddLevelObjectMenu", - onPress: (t) => { - (e.setMenuOpen("closed"), - e.selectTool({ type: "placeLevelObject", object: t })); - }, - closeMenu: () => { - e.setMenuOpen("closed"); - }, - features: e.features, - theme: e.theme, - x: 22.5 + ar / 2, - y: 10, - }) - : "theme" === e.menuView - ? themeMenu({ - id: "ThemeMenu", - theme: e.theme, - themes: e.themes, - useGround: e.useGround, - isLoading: e.isLoading, - selectTheme: e.selectTheme, - toggleGround: e.toggleGround, - closeMenu: () => { - e.setMenuOpen("closed"); - }, - x: 22.5 + ar / 2, - y: 10, - }) - : null, - ], - }), - ar = 150, - ir = makeCustomSprite({ - init({ - props: { - features: e, - theme: { objects: t, player: a }, - }, - getContext, - }) { - const i = $.newBlock(), - n = $.newMiniBlock(), - s = $.newSpike(), - o = $.newMiniSpike(), - r = $.newPlatform(), - l = $.newDirectionChange({ fixSync: true }), - c = $.newSpeedChange(), - d = $.newFlag(), - u = $.newPowerup({ - item: e.includes("doubleJump") - ? "doubleJump" - : e.includes("gun") - ? "gun" - : e.includes("jetpack") - ? "jetpack" - : e.includes("playerStacks") - ? "playerStack" - : e.includes("skateboard") - ? "skateboard" - : e.includes("punch") - ? "punch" - : void 0, - compatible: false, - }), - h = $.newSaw(), - p = $.newEnemy({ - kind: - e.includes("walkingEnemy") || e.includes("giantEnemy") - ? "walker" - : e.includes("flyingEnemy") - ? "shooter" - : void 0, - giant: - e.includes("giantEnemy") && !e.includes("walkingEnemy"), - isCompatible: false, + ...(t.showInfoTimer + ? [ + o({ color: Fe, width: 150, height: nr - 5 }), + n({ color: ve, text: "UNLOCK IN", y: 7 }), + n({ color: ve, text: "ACHIEVEMENTS", y: -7 }), + ] + : []), + ]; + }, + }), + themeMenu = makeCustomSprite({ + render: ({ props: e }) => [ + Clickable({ + id: "ClickOutside", + onPressOutside: e.closeMenu, + width: ar, + height: 300, + sprites: () => [], + onPress: () => null, + }), + r({ + path: [ + [-ar / 2, 150], + [ar / 2, 150], + [ar / 2, -120], + [ar / 2 - 30, -150], + [-ar / 2, -150], + ], + fillColor: ve, + }), + o({ width: ar - 20, height: 280, x: -10, y: 10, color: je }), + ScrollContainer({ + id: "ScrollContainer", + containerHeight: 280, + containerWidth: ar - 20, + contentHeight: 40 * e.themes.length + 100, + x: -10, + y: 150, + sprites: (t) => [ + Tm({ + id: "UseGroundCheckbox", + text: localize("USE GROUND"), + fontSize: 10, + selected: e.useGround, + width: ar - 40, + height: 30, + y: -20, + onPress: () => { + e.toggleGround(); + }, + strokeColor: Ye, }), - g = $.newSwitchButton({ - affects: e.includes("switchButton") - ? "movement" - : e.includes("switchBlockSpike") - ? "blockSpike" - : void 0, + n({ + text: localize("THEME"), + color: Be, + x: -ar / 2 + 25, + y: -50, + font: { align: "left", weight: 800 }, }), - m = $.newSwitchPlatform({ - initPosition: "right", - direction: 0, - }), - f = $.newCollectible({ - form: e.includes("collectible") - ? "coin" - : e.includes("arrows") - ? "arrow" - : void 0, - }), - y = $.newSpring(), - q = $.newSwitchBlock(), - switchSpike = $.newSwitchSpike(), - E = $.newPortal(); - return { - objects: [ - { - name: localize(Zo(i.type)), - object: i, - iconName: "images/editor/objects/block.png", - sprite: Ja.Single({ - id: "Block", - blocks: [i], - theme: t.block, - }), - unlocked: true, - }, - { - name: localize("MINI BLOCK"), - object: n, - iconName: "images/editor/objects/miniblock.png", - sprite: Ja.Single({ - id: "MiniBlock", - blocks: [n], - theme: t.block, - }), - unlocked: true, - }, - { - name: localize(Zo(s.type)), - object: s, - iconName: "images/editor/objects/spike.png", - sprite: Za.Single({ - id: "Spike", - spikes: [s], - theme: t.spike, - }), - unlocked: true, - }, - { - name: localize("MINI SPIKE"), - object: o, - iconName: "images/editor/objects/minispike.png", - sprite: Za.Single({ - id: "MiniSpike", - spikes: [o], - theme: t.spike, - }), - unlocked: true, - }, - { - name: localize(Zo(r.type)), - object: r, - iconName: "images/editor/objects/platform.png", - sprite: Qa.Single({ - id: "Platform", - platforms: [r], - theme: t.platform, - }), - unlocked: true, - }, - { - name: localize(Zo(l.type)), - object: l, - iconName: "images/editor/objects/dirchange.png", - sprite: Zs.Single({ - id: "DirectionChange", - directionChange: l, - theme: t.dirChange, - isEditor: true, - spineContext: getContext(Ws), - }), - unlocked: true, - }, - { - name: localize(Zo(d.type)), - object: d, - iconName: "images/editor/objects/flag.png", - sprite: ao.Single({ - id: "Flag", - flag: d, - theme: t.flag, - spineContext: getContext(Ws), - }), - unlocked: true, - }, - { - name: localize(Zo(h.type)), - object: h, - iconName: "images/editor/objects/saw.png", - sprite: eo.Single({ - id: "Saws", - saws: [$.newSaw()], - theme: t.saw, - bigTheme: t.spike, - }), - unlocked: e.includes("saws"), - }, - { - name: localize(Zo(u.type)), - object: u, - iconName: "images/editor/objects/powerup.png", - sprite: Co.Single({ - id: "Powerup", - powerup: u, - skin: a, - isEditor: true, - theme: t.speedChange, - spineContext: getContext(Ws), - }), - unlocked: - e.includes("gun") || - e.includes("doubleJump") || - e.includes("playerStacks") || - e.includes("skateboard") || - e.includes("punch") || - e.includes("jetpack"), - }, - { - name: localize(Zo(p.type)), - object: p, - iconName: "images/editor/objects/enemy.png", - sprite: yo.Single({ - id: "Enemy", - enemy: p, - spineContext: getContext(Ws), - }), - unlocked: - e.includes("walkingEnemy") || - e.includes("giantEnemy") || - e.includes("flyingEnemy"), - }, - { - name: localize(Zo(m.type)), - object: m, - iconName: "images/editor/objects/switchplatform.png", - sprite: Po.Single({ - id: "SwitchPlatform", - switchPlatforms: [m], - theme: t.switch, - }), - unlocked: - e.includes("moveOnJump") || e.includes("switchButton"), - }, - { - name: localize("SWITCH BLOCK"), - object: q, - iconName: "images/editor/objects/block.png", - unlocked: true, - }, - { - name: localize("SWITCH SPIKE"), - object: switchSpike, - iconName: "images/editor/objects/spike.png", - unlocked: true, - }, - { - name: localize(Zo(g.type)), - object: g, - iconName: "images/editor/objects/switch.png", - sprite: xo.Single({ - id: "SwitchButton", - switchButton: g, - switchRotation: 0, - switchBlockSpikes: false, - isEditor: true, - justHit: false, - theme: t.switch, - spineContext: getContext(Ws), - playerScale: 1, - }), - unlocked: - e.includes("switchButton") || - e.includes("switchBlockSpike"), - }, - { - name: localize(Zo(f.type)), - object: f, - iconName: "images/editor/objects/collectible.png", - sprite: qo.Single({ - id: "Collectible", - collectible: f, - wasPickedUp: false, - isEditor: true, - theme: t.switch, - }), - unlocked: e.includes("collectible") || e.includes("arrows"), - }, - { - name: localize(Zo(y.type)), - object: y, - iconName: "images/editor/objects/spring.png", - sprite: $o.Single({ - id: "Spring", - spring: y, - justHit: false, - isEditor: true, - spineContext: getContext(Ws), - }), - unlocked: e.includes("spring"), - }, - { - name: localize(Zo(E.type)), - object: E, - iconName: "images/editor/objects/portal.png", - sprite: Jo.Single({ - id: "Portal", - portal: E, - isEditor: true, - theme: t.switch, - spineContext: getContext(Ws), - }), - unlocked: e.includes("portals"), - }, - { - name: localize(Zo(c.type)), - object: c, - iconName: "images/editor/objects/speedchange.png", - sprite: er.Single({ - id: "SpeedChange", - speedChange: c, - isEditor: true, - justHit: false, - theme: t.speedChange, - spineContext: getContext(Ws), - }), - unlocked: e.includes("speedChange"), - }, - ], - }; - }, - render: ({ props: e, state: { objects: t } }) => [ - Clickable({ - id: "ClickOutside", - onPressOutside: e.closeMenu, - width: ar, - height: 300, - sprites: () => [], - onPress: () => null, - }), - r({ - path: [ - [-ar / 2, 150], - [ar / 2, 150], - [ar / 2, -120], - [ar / 2 - 30, -150], - [-ar / 2, -150], - ], - fillColor: ve, - }), - o({ width: ar - 20, height: 280, x: -10, y: 10, color: je }), - ScrollContainer({ - id: "ScrollContainer", - containerHeight: 280, - containerWidth: ar - 20, - contentHeight: t.length * nr + 20, - x: -10, - y: 150, - sprites: (a) => - t.map((t, i) => - sr({ - id: `AddLevelObjectButton-${i}`, - name: t.name, - iconName: t.iconName, - locked: !t.unlocked, - noPress: a, - onPress: () => { - e.onPress(t.object); - }, - y: -nr * i - 20, - }), - ), - }), - ], - }), - nr = 35, - sr = makeCustomSprite({ - init: () => ({ showInfoTimer: 0 }), - loop: ({ state: e }) => - e.showInfoTimer > 0 - ? Object.assign(Object.assign({}, e), { - showInfoTimer: e.showInfoTimer - 1, - }) - : e, - render({ props: e, state: t, updateState: a }) { - var i = ar - 20, - s = nr - 5, - r = (e.locked ? "LOCKED" : e.name).split(" "), - c = r.length > 1; - if (r.length == 3) { - r = [`${r[0]} ${r[1]}`, r[2]]; - } - return [ - Clickable({ - id: "Clickable", - width: i, - height: s, - disabled: e.noPress, - onPress: () => { - e.locked - ? a((e) => - Object.assign(Object.assign({}, e), { - showInfoTimer: 60, - }), - ) - : e.onPress(); - }, - sprites: (t) => [ - So({ - id: "RaisedRects", - x: -45, - width: 30, - height: s, - raiseHeight: 3, - rad: 3, - topColour: e.locked ? Xe : Re, - bottomColour: ve, - isPressed: t, - stroke: { thickness: 2, colour: e.locked ? ze : Ye }, - }), - l({ - fileName: e.iconName, - width: 15, - height: 15, - x: -45, - y: 1.5 + (t ? -3 : 0), - }), - ...r.map((t, a) => - n({ - text: t, - color: e.locked ? Xe : Be, - font: { align: "left" }, - x: -25, - y: c ? (0 === a ? 6 : -6) : 0, - }), - ), - ], - }), - ...(t.showInfoTimer - ? [ - o({ color: Fe, width: 150, height: nr - 5 }), - n({ color: ve, text: "UNLOCK IN", y: 7 }), - n({ color: ve, text: "ACHIEVEMENTS", y: -7 }), - ] - : []), - ]; - }, - }), - themeMenu = makeCustomSprite({ - render: ({ props: e }) => [ - Clickable({ - id: "ClickOutside", - onPressOutside: e.closeMenu, - width: ar, - height: 300, - sprites: () => [], - onPress: () => null, - }), - r({ - path: [ - [-ar / 2, 150], - [ar / 2, 150], - [ar / 2, -120], - [ar / 2 - 30, -150], - [-ar / 2, -150], - ], - fillColor: ve, - }), - o({ width: ar - 20, height: 280, x: -10, y: 10, color: je }), - ScrollContainer({ - id: "ScrollContainer", - containerHeight: 280, - containerWidth: ar - 20, - contentHeight: 40 * e.themes.length + 100, - x: -10, - y: 150, - sprites: (t) => [ - Tm({ - id: "UseGroundCheckbox", - text: localize("USE GROUND"), + ...e.themes.map((a, i) => + Fo({ + id: `ThemeButton-${a.id}`, + text: localize(a.name.toLocaleUpperCase()), fontSize: 10, - selected: e.useGround, width: ar - 40, height: 30, - y: -20, + noPress: t, + disabled: e.isLoading, + y: -40 * i - 80, onPress: () => { - e.toggleGround(); + e.selectTheme(a); }, strokeColor: Ye, }), - n({ - text: localize("THEME"), - color: Be, - x: -ar / 2 + 25, - y: -50, - font: { align: "left", weight: 800 }, - }), - ...e.themes.map((a, i) => - Fo({ - id: `ThemeButton-${a.id}`, - text: localize(a.name.toLocaleUpperCase()), - fontSize: 10, - width: ar - 40, - height: 30, - noPress: t, - disabled: e.isLoading, - y: -40 * i - 80, - onPress: () => { - e.selectTheme(a); - }, - strokeColor: Ye, - }), - ), - ], - }), - ], - }), - //zooming - rr = 1.2, - lr = 0.1, - cr = 2, - dr = lr, - zoomIn = function (e) { - return { - x: e.x * rr, - y: e.y * rr, - scale: Math.min(e.scale * rr, 2), - }; - }, - zoomOut = function (e) { - return { - x: e.x / rr, - y: e.y / rr, - scale: Math.max(e.scale / rr, lr), - }; - }, - pr = function (e, t, a) { - const i = t / e.scale, - n = a.x * (i - 1), - s = a.y * (i - 1); - return { x: e.x * i - n, y: e.y * i - s, scale: t }; - }, - gr = function (e, t, a, i) { - let { x: n, y: s, scale: o } = e; - return ( - t.width * o > 0.8 * a && (o = Math.max((0.5 * a) / t.width, lr)), - t.height * o > 0.8 * i && - (o = Math.max((0.5 * i) / t.height, lr)), - ((t.x + t.width / 2) * o + n > 0.4 * a || - (t.x - t.width / 2) * o + n < 0.4 * -a) && - (n = -t.x * o), - ((t.y + t.height / 2) * o + s > 0.4 * i || - (t.y - t.height / 2) * o + s < 0.4 * -i) && - (s = -t.y * o), - { x: n, y: s, scale: o } - ); + ), + ], + }), + ], + }), + //zooming + rr = 1.2, + lr = 0.1, + cr = 2, + dr = lr, + zoomIn = function (e) { + return { + x: e.x * rr, + y: e.y * rr, + scale: Math.min(e.scale * rr, 2), + }; + }, + zoomOut = function (e) { + return { + x: e.x / rr, + y: e.y / rr, + scale: Math.max(e.scale / rr, lr), + }; + }, + pr = function (e, t, a) { + const i = t / e.scale, + n = a.x * (i - 1), + s = a.y * (i - 1); + return { x: e.x * i - n, y: e.y * i - s, scale: t }; + }, + gr = function (e, t, a, i) { + let { x: n, y: s, scale: o } = e; + return ( + t.width * o > 0.8 * a && (o = Math.max((0.5 * a) / t.width, lr)), + t.height * o > 0.8 * i && + (o = Math.max((0.5 * i) / t.height, lr)), + ((t.x + t.width / 2) * o + n > 0.4 * a || + (t.x - t.width / 2) * o + n < 0.4 * -a) && + (n = -t.x * o), + ((t.y + t.height / 2) * o + s > 0.4 * i || + (t.y - t.height / 2) * o + s < 0.4 * -i) && + (s = -t.y * o), + { x: n, y: s, scale: o } + ); + }, + mr = makeCustomSprite({ + loop({ getInputs: e, props: t, device: a }) { + const i = e(); + ((i.keysJustPressed.Backspace || i.keysJustPressed.Delete) && + eraseObjects(t, a), + i.keysJustPressed.d && + (i.keysDown.Control || i.keysDown.Meta) && + duplicateObjects(t, a)); }, - mr = makeCustomSprite({ - loop({ getInputs: e, props: t, device: a }) { - const i = e(); - ((i.keysJustPressed.Backspace || i.keysJustPressed.Delete) && - eraseObjects(t, a), - i.keysJustPressed.d && - (i.keysDown.Control || i.keysDown.Meta) && - duplicateObjects(t, a)); - }, - render: ({ props: e, device: t }) => [ - vo({ - id: "Erase", - fileName: "images/editor/delete.png", - noSound: true, - onPress: () => { - eraseObjects(e, t); - }, - isSelected: false, - isOpen: false, - large: true, - x: -25, - }), - vo({ - id: "Duplicate", - testId: "DuplicateButton", - fileName: "images/editor/duplicate.png", - noSound: true, - onPress: () => { - duplicateObjects(e, t); - }, - isSelected: false, - isOpen: false, - large: true, - x: 25, - }), - ], - }); - function eraseObjects(e, t) { - (t.audio("audio/editor/erase.wav").play(), - e.send({ - type: "eraseObjects", - objects: e.selectedObjects.map((e) => ({ - array: e.array, - index: e.index, - })), + render: ({ props: e, device: t }) => [ + vo({ + id: "Erase", + fileName: "images/editor/delete.png", + noSound: true, + onPress: () => { + eraseObjects(e, t); + }, + isSelected: false, + isOpen: false, + large: true, + x: -25, + }), + vo({ + id: "Duplicate", + testId: "DuplicateButton", + fileName: "images/editor/duplicate.png", + noSound: true, + onPress: () => { + duplicateObjects(e, t); + }, + isSelected: false, + isOpen: false, + large: true, + x: 25, }), - e.setSelectedObjects([])); - } - function duplicateObjects(e, t) { - const a = t.size.width + 2 * t.size.widthMargin, - i = t.size.height + 2 * t.size.heightMargin, - { viewOffset: n } = e, - s = Da.moveObjectsUntilCanPlace( - e.layout, - e.selectedObjects.map((t) => e.layout[t.array][t.index]), - ); - if (!s) return; - const o = $.getBorderDimensions(s); - if (!o) return; - e.setViewOffset(gr(n, o, a, i)); - let r = {}; - const l = s.map((t) => { - var a; - return ( - (r[t.array] = - (null !== (a = r[t.array]) && void 0 !== a ? a : 0) + 1), - { - array: t.array, - levelObject: t, - atIndex: e.layout[t.array].length + (r[t.array] - 1), - } - ); - }); - (t.audio("audio/editor/place.wav").play(), - e.send({ type: "placeObjects", objects: l }), - (r = {}), - e.setSelectedObjects( - l.map((t) => { - var a; - return ( - (r[t.array] = - (null !== (a = r[t.array]) && void 0 !== a ? a : 0) + 1), - { - array: t.array, - index: e.layout[t.array].length + (r[t.array] - 1), - draggingX: t.levelObject.x, - draggingY: t.levelObject.y, - startDraggingX: t.levelObject.x, - startDraggingY: t.levelObject.y, - } - ); - }), - )); - } - const Er = makePureSprite({ - shouldRerender: (e, t) => - e.height !== t.height || - e.width !== t.width || - e.noSpace !== t.noSpace, - render({ props: e }) { - const t = (e.width + 10) / 2, - a = (e.height + 10) / 2; - return [ - r({ - color: e.noSpace ? ve : Be, - opacity: 0.9, - thickness: 3, - lineCap: "round", - path: [ - [-t, -a], - [t, -a], - [t, a], - [-t, a], - [-t, -a], - ], - }), - r({ - color: e.noSpace ? "red" : Oe, - opacity: 0.9, - thickness: 4, - lineCap: "round", - path: [ - [3 - t, 3 - a], - [t - 3, 3 - a], - [t - 3, a - 3], - [3 - t, a - 3], - [3 - t, 3 - a], - ], - }), - r({ - color: e.noSpace ? "red" : Oe, - opacity: 0.9, - thickness: 4, - lineCap: "round", - path: [ - [-t - 2, -a - 2], - [t + 2, -a - 2], - [t + 2, a + 2], - [-t - 2, a + 2], - [-t - 2, -a - 2], - ], - }), - ]; - }, - }), - br = makeCustomSprite({ - render: ({ props: e }) => [ - Fo({ - id: "ZoomButton", - width: 35, - height: 40, - onPress: e.onPress, - text: e.type, - }), - ], + ], + }); + function eraseObjects(e, t) { + (t.audio("audio/editor/erase.wav").play(), + e.send({ + type: "eraseObjects", + objects: e.selectedObjects.map((e) => ({ + array: e.array, + index: e.index, + })), }), - Sr = function (e, t, a, i, n = null, s = 0) { - return { - id: e, - name: t, - layout: i || Ca.initialLayout, - song: a, - songStartSecs: s, - boss: n, - }; - }, - Ir = function (e) { - const t = Ca.removeCheckpoints(e.layout); - return Object.assign(Object.assign({}, e), { layout: t }); - }, - _r = function (e) { - const t = G.getJumpFrames(e.song.bpm); - return { - jumpFrames: t, - speed: G.getSpeed(t), - coefficients: G.getCoefficients(t), - }; - }, - vr = function (e) { - const t = Ca.sortLayout(e.layout); - return Object.assign(Object.assign({}, e), { layout: t }); - }, - Tr = [], - Rr = [], - setSwitchRotation = function (e) { - e.rotation = e.initPosition == "up" ? -90 : 0; - e.rotation += e.direction; - return e; - }, - objPropsMenu = function (e, t, a, i, debug) { - switch (t.type) { - case "spike": - return (function (e, t, a) { - if (t.init) { - return [ - { - name: "Direction", - options: [ - { - name: "Up", - selected: !t.isLaser && 0 === t.rotation, - onPress: () => { - a.map((j) => { - e({ - type: "setProperty", - array: "spikes", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - rotation: 0, - isLaser: false, - }), - }); - }); - }, - }, - { - name: "Left", - selected: !t.isLaser && 270 === t.rotation, - onPress: () => { - a.map((j) => { - e({ - type: "setProperty", - array: "spikes", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - rotation: 270, - isLaser: false, - }), - }); - }); - }, - }, - { - name: "Down", - selected: !t.isLaser && 180 === t.rotation, - onPress: () => { - a.map((j) => { - e({ - type: "setProperty", - array: "spikes", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - rotation: 180, - isLaser: false, - }), - }); - }); - }, - }, - { - name: "Right", - selected: !t.isLaser && 90 === t.rotation, - onPress: () => { - a.map((j) => { - e({ - type: "setProperty", - array: "spikes", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - rotation: 90, - isLaser: false, - }), - }); - }); - }, - }, - ], - }, - { - name: "Color", - options: [ - { - name: "Red", - selected: t.init == "red", - onPress: () => { - a.map((j) => { - e({ - type: "setProperty", - array: "spikes", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - init: "red", - }), - }); - }); - }, - }, - { - name: "Blue", - selected: t.init == "blue", - onPress: () => { - a.map((j) => { - e({ - type: "setProperty", - array: "spikes", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - init: "blue", - }), - }); - }); - }, - }, - ], - }, - { - name: "Trigger", - options: [ - { - name: "Music Beat", - selected: t.trigger == "beat", - onPress: () => { - a.map((j) => { - e({ - type: "setProperty", - array: "spikes", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - trigger: "beat", - }), - }); - }); - }, - }, - { - name: "Jump", - selected: t.trigger == "jump", - onPress: () => { - a.map((j) => { - e({ - type: "setProperty", - array: "spikes", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - trigger: "jump", - }), - }); - }); - }, - }, - { - name: "Switch", - selected: t.trigger == "switch", - onPress: () => { - a.map((j) => { - e({ - type: "setProperty", - array: "spikes", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - trigger: "switch", - }), - }); - }); - }, - }, - ], - }, - ]; - } - let di = t.isLaser - ? [ - { - name: "Up-Down", - selected: 90 === t.rotation, - onPress: () => { - a.map((j) => { - e({ - type: "setProperty", - array: "spikes", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - rotation: 90, - }), - }); - }); - }, - }, - { - name: "Left-Right", - selected: 0 === t.rotation, - onPress: () => { - a.map((j) => { - e({ - type: "setProperty", - array: "spikes", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - rotation: 0, - }), - }); - }); - }, - }, - ] - : [ + e.setSelectedObjects([])); + } + function duplicateObjects(e, t) { + const a = t.size.width + 2 * t.size.widthMargin, + i = t.size.height + 2 * t.size.heightMargin, + { viewOffset: n } = e, + s = Da.moveObjectsUntilCanPlace( + e.layout, + e.selectedObjects.map((t) => e.layout[t.array][t.index]), + ); + if (!s) return; + const o = $.getBorderDimensions(s); + if (!o) return; + e.setViewOffset(gr(n, o, a, i)); + let r = {}; + const l = s.map((t) => { + var a; + return ( + (r[t.array] = + (null !== (a = r[t.array]) && void 0 !== a ? a : 0) + 1), + { + array: t.array, + levelObject: t, + atIndex: e.layout[t.array].length + (r[t.array] - 1), + } + ); + }); + (t.audio("audio/editor/place.wav").play(), + e.send({ type: "placeObjects", objects: l }), + (r = {}), + e.setSelectedObjects( + l.map((t) => { + var a; + return ( + (r[t.array] = + (null !== (a = r[t.array]) && void 0 !== a ? a : 0) + 1), + { + array: t.array, + index: e.layout[t.array].length + (r[t.array] - 1), + draggingX: t.levelObject.x, + draggingY: t.levelObject.y, + startDraggingX: t.levelObject.x, + startDraggingY: t.levelObject.y, + } + ); + }), + )); + } + const Er = makePureSprite({ + shouldRerender: (e, t) => + e.height !== t.height || + e.width !== t.width || + e.noSpace !== t.noSpace, + render({ props: e }) { + const t = (e.width + 10) / 2, + a = (e.height + 10) / 2; + return [ + r({ + color: e.noSpace ? ve : Be, + opacity: 0.9, + thickness: 3, + lineCap: "round", + path: [ + [-t, -a], + [t, -a], + [t, a], + [-t, a], + [-t, -a], + ], + }), + r({ + color: e.noSpace ? "red" : Oe, + opacity: 0.9, + thickness: 4, + lineCap: "round", + path: [ + [3 - t, 3 - a], + [t - 3, 3 - a], + [t - 3, a - 3], + [3 - t, a - 3], + [3 - t, 3 - a], + ], + }), + r({ + color: e.noSpace ? "red" : Oe, + opacity: 0.9, + thickness: 4, + lineCap: "round", + path: [ + [-t - 2, -a - 2], + [t + 2, -a - 2], + [t + 2, a + 2], + [-t - 2, a + 2], + [-t - 2, -a - 2], + ], + }), + ]; + }, + }), + br = makeCustomSprite({ + render: ({ props: e }) => [ + Fo({ + id: "ZoomButton", + width: 35, + height: 40, + onPress: e.onPress, + text: e.type, + }), + ], + }), + Sr = function (e, t, a, i, n = null, s = 0) { + return { + id: e, + name: t, + layout: i || Ca.initialLayout, + song: a, + songStartSecs: s, + boss: n, + }; + }, + Ir = function (e) { + const t = Ca.removeCheckpoints(e.layout); + return Object.assign(Object.assign({}, e), { layout: t }); + }, + _r = function (e) { + const t = G.getJumpFrames(e.song.bpm); + return { + jumpFrames: t, + speed: G.getSpeed(t), + coefficients: G.getCoefficients(t), + }; + }, + vr = function (e) { + const t = Ca.sortLayout(e.layout); + return Object.assign(Object.assign({}, e), { layout: t }); + }, + Tr = [], + Rr = [], + objPropsMenu = function (e, t, a, i, debug) { + switch (t.type) { + case "spike": + return (function (e, t, a) { + if (t.init) { + return [ + { + name: "Direction", + options: [ { name: "Up", selected: !t.isLaser && 0 === t.rotation, @@ -38087,18 +37853,14 @@ var version = "v1.17.2"; }); }, }, - ]; - let all = [ - { - name: "Direction", - options: di, + ], }, { - name: "Type", + name: "Color", options: [ { - name: "Spike", - selected: !t.isLaser && !t.isFade, + name: "Red", + selected: t.init == "red", onPress: () => { a.map((j) => { e({ @@ -38107,16 +37869,15 @@ var version = "v1.17.2"; index: j, set: (e) => Object.assign(Object.assign({}, e), { - isLaser: false, - isFade: false, + init: "red", }), }); }); }, }, { - name: "Laser", - selected: t.isLaser, + name: "Blue", + selected: t.init == "blue", onPress: () => { a.map((j) => { e({ @@ -38125,17 +37886,20 @@ var version = "v1.17.2"; index: j, set: (e) => Object.assign(Object.assign({}, e), { - rotation: e.rotation % 90, - isLaser: true, - isFade: false, + init: "blue", }), }); }); }, }, + ], + }, + { + name: "Trigger", + options: [ { - name: "Invisible", - selected: t.isFade, + name: "Music Beat", + selected: t.trigger == "beat", onPress: () => { a.map((j) => { e({ @@ -38144,23 +37908,15 @@ var version = "v1.17.2"; index: j, set: (e) => Object.assign(Object.assign({}, e), { - isLaser: false, - isFade: true, + trigger: "beat", }), }); }); }, }, - ], - }, - ]; - if (debug) { - all.push({ - name: "Skip Missiles", - options: [ { - name: "On", - selected: t.skipMissiles, + name: "Jump", + selected: t.trigger == "jump", onPress: () => { a.map((j) => { e({ @@ -38169,15 +37925,15 @@ var version = "v1.17.2"; index: j, set: (e) => Object.assign(Object.assign({}, e), { - skipMissiles: true, + trigger: "jump", }), }); }); }, }, { - name: "Off", - selected: !t.skipMissiles, + name: "Switch", + selected: t.trigger == "switch", onPress: () => { a.map((j) => { e({ @@ -38186,405 +37942,332 @@ var version = "v1.17.2"; index: j, set: (e) => Object.assign(Object.assign({}, e), { - skipMissiles: false, + trigger: "switch", }), }); }); }, }, ], - }); - } - return all; - })(e, t, i); - case "portal": - return (function (e, t, a) { - const i = (e, t, i) => { - const n = Ca.removeObject(t, "portals", a); - return ( - Da.moveObjectUntilCanPlace( - n, - Object.assign(Object.assign({}, e), { direction: i }), - ) || null - ); - }; - return [ + }, + ]; + } + let di = t.isLaser + ? [ { - name: "Direction", - options: [ - { - name: "Left", - selected: "left" === t.direction, - onPress: () => { - a.map((j) => { - e({ - type: "setProperty", - array: "portals", - index: j, - set: (e, t) => i(e, t, "left"), - }); - }); - }, - }, - { - name: "Down", - selected: "down" === t.direction, - onPress: () => { - a.map((j) => { - e({ - type: "setProperty", - array: "portals", - index: j, - set: (e, t) => i(e, t, "down"), - }); - }); - }, - }, - { - name: "Right", - selected: "right" === t.direction, - onPress: () => { - a.map((j) => { - e({ - type: "setProperty", - array: "portals", - index: j, - set: (e, t) => i(e, t, "right"), - }); - }); - }, - }, - { - name: "Up", - selected: "up" === t.direction, - onPress: () => { - a.map((j) => { - e({ - type: "setProperty", - array: "portals", - index: j, - set: (e, t) => i(e, t, "up"), - }); - }); - }, - }, - ], + name: "Up-Down", + selected: 90 === t.rotation, + onPress: () => { + a.map((j) => { + e({ + type: "setProperty", + array: "spikes", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + rotation: 90, + }), + }); + }); + }, }, { - name: "Portal ID", - options: [ - { - name: String(t.pairId), - selected: true, - onPress: () => null, - }, - ], + name: "Left-Right", + selected: 0 === t.rotation, + onPress: () => { + a.map((j) => { + e({ + type: "setProperty", + array: "spikes", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + rotation: 0, + }), + }); + }); + }, + }, + ] + : [ + { + name: "Up", + selected: !t.isLaser && 0 === t.rotation, + onPress: () => { + a.map((j) => { + e({ + type: "setProperty", + array: "spikes", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + rotation: 0, + isLaser: false, + }), + }); + }); + }, + }, + { + name: "Left", + selected: !t.isLaser && 270 === t.rotation, + onPress: () => { + a.map((j) => { + e({ + type: "setProperty", + array: "spikes", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + rotation: 270, + isLaser: false, + }), + }); + }); + }, + }, + { + name: "Down", + selected: !t.isLaser && 180 === t.rotation, + onPress: () => { + a.map((j) => { + e({ + type: "setProperty", + array: "spikes", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + rotation: 180, + isLaser: false, + }), + }); + }); + }, + }, + { + name: "Right", + selected: !t.isLaser && 90 === t.rotation, + onPress: () => { + a.map((j) => { + e({ + type: "setProperty", + array: "spikes", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + rotation: 90, + isLaser: false, + }), + }); + }); + }, }, ]; - })(e, t, i); - case "switchButton": - return (function (e, t, a, i) { - var j = - a.includes("switchBlockSpike") && a.includes("switchButton") - ? [ - { - name: "Affects", - options: [ - { - name: "Movement", - selected: "movement" === t.affects, - onPress: () => { - i.map((j) => { - e({ - type: "setProperty", - array: "switchButtons", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - affects: "movement", - }), - }); - }); - }, - }, - { - name: "Block / Spikes", - selected: "blockSpike" === t.affects, - onPress: () => { - i.map((j) => { - e({ - type: "setProperty", - array: "switchButtons", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - affects: "blockSpike", - }), - }); - }); - }, - }, - { - name: "Size", - selected: "size" === t.affects, - onPress: () => { - i.map((j) => { - e({ - type: "setProperty", - array: "switchButtons", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - affects: "size", - }), - }); - }); - }, - }, - { - name: "BG Color", - selected: "color" === t.affects, - onPress: () => { - i.map((j) => { - e({ - type: "setProperty", - array: "switchButtons", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - affects: "color", - }), - }); - }); - }, - }, - { - name: "Fall", - selected: "falling" === t.affects, - onPress: () => { - i.map((j) => { - e({ - type: "setProperty", - array: "switchButtons", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - affects: "falling", - }), - }); - }); - }, - }, - { - name: "Gravity", - selected: "gravity" === t.affects, - onPress: () => { - i.map((j) => { - e({ - type: "setProperty", - array: "switchButtons", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - affects: "gravity", - }), - }); - }); - }, - }, - ], - }, - ] - : []; - (t.affects == "gravity" && - j.push({ - name: "Direction", - options: [ - { - name: "Up", - selected: t.gravity < 0, - onPress: () => { - i.map((j) => { - e({ - type: "setProperty", - array: "switchButtons", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - gravity: -1, - }), - }); + let all = [ + { + name: "Direction", + options: di, + }, + { + name: "Type", + options: [ + { + name: "Spike", + selected: !t.isLaser && !t.isFade, + onPress: () => { + a.map((j) => { + e({ + type: "setProperty", + array: "spikes", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + isLaser: false, + isFade: false, + }), }); - }, + }); }, - { - name: "Dash", - selected: t.gravity == 0, - onPress: () => { - i.map((j) => { - e({ - type: "setProperty", - array: "switchButtons", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - gravity: 0, - }), - }); + }, + { + name: "Laser", + selected: t.isLaser, + onPress: () => { + a.map((j) => { + e({ + type: "setProperty", + array: "spikes", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + rotation: e.rotation % 90, + isLaser: true, + isFade: false, + }), }); - }, + }); }, - { - name: "Jump", - selected: t.gravity == 2, - onPress: () => { - i.map((j) => { - e({ - type: "setProperty", - array: "switchButtons", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - gravity: 2, - }), - }); + }, + { + name: "Invisible", + selected: t.isFade, + onPress: () => { + a.map((j) => { + e({ + type: "setProperty", + array: "spikes", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + isLaser: false, + isFade: true, + }), }); - }, + }); }, - { - name: "Down", - selected: t.gravity == 1, - onPress: () => { - i.map((j) => { - e({ - type: "setProperty", - array: "switchButtons", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - gravity: 1, - }), - }); + }, + ], + }, + ]; + if (debug) { + all.push({ + name: "Skip Missiles", + options: [ + { + name: "On", + selected: t.skipMissiles, + onPress: () => { + a.map((j) => { + e({ + type: "setProperty", + array: "spikes", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + skipMissiles: true, + }), }); - }, + }); }, - ], - }), - t.affects == "falling" && - j.push({ - name: "Direction", - options: [ - { - name: "Up", - selected: t.up, - onPress: () => { - i.map((j) => { - e({ - type: "setProperty", - array: "switchButtons", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - up: !e.up, - }), - }); - }); - }, - }, - { - name: "Down", - selected: t.down, - onPress: () => { - i.map((j) => { - e({ - type: "setProperty", - array: "switchButtons", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - down: !e.down, - }), - }); - }); - }, - }, - ], - }), - t.affects == "color" && - j.push({ - name: "Color", + }, + { + name: "Off", + selected: !t.skipMissiles, + onPress: () => { + a.map((j) => { + e({ + type: "setProperty", + array: "spikes", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + skipMissiles: false, + }), + }); + }); + }, + }, + ], + }); + } + return all; + })(e, t, i); + case "portal": + return (function (e, t, a) { + const i = (e, t, i) => { + const n = Ca.removeObject(t, "portals", a); + return ( + Da.moveObjectUntilCanPlace( + n, + Object.assign(Object.assign({}, e), { direction: i }), + ) || null + ); + }; + return [ + { + name: "Direction", + options: [ + { + name: "Left", + selected: "left" === t.direction, + onPress: () => { + a.map((j) => { + e({ + type: "setProperty", + array: "portals", + index: j, + set: (e, t) => i(e, t, "left"), + }); + }); + }, + }, + { + name: "Down", + selected: "down" === t.direction, + onPress: () => { + a.map((j) => { + e({ + type: "setProperty", + array: "portals", + index: j, + set: (e, t) => i(e, t, "down"), + }); + }); + }, + }, + { + name: "Right", + selected: "right" === t.direction, + onPress: () => { + a.map((j) => { + e({ + type: "setProperty", + array: "portals", + index: j, + set: (e, t) => i(e, t, "right"), + }); + }); + }, + }, + { + name: "Up", + selected: "up" === t.direction, + onPress: () => { + a.map((j) => { + e({ + type: "setProperty", + array: "portals", + index: j, + set: (e, t) => i(e, t, "up"), + }); + }); + }, + }, + ], + }, + { + name: "Portal ID", + options: [ + { + name: String(t.pairId), + selected: true, + onPress: () => null, + }, + ], + }, + ]; + })(e, t, i); + case "switchButton": + return (function (e, t, a, i) { + var j = + a.includes("switchBlockSpike") && a.includes("switchButton") + ? [ + { + name: "Affects", options: [ { - name: "Flash", - selected: "flash" === t.color, - onPress: () => { - i.map((j) => { - e({ - type: "setProperty", - array: "switchButtons", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - color: "flash", - }), - }); - }); - }, - }, - { - name: "Red", - selected: "red" === t.color, - onPress: () => { - i.map((j) => { - e({ - type: "setProperty", - array: "switchButtons", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - color: "red", - }), - }); - }); - }, - }, - { - name: "Yellow", - selected: "yellow" === t.color, - onPress: () => { - i.map((j) => { - e({ - type: "setProperty", - array: "switchButtons", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - color: "yellow", - }), - }); - }); - }, - }, - { - name: "Green", - selected: "green" === t.color, - onPress: () => { - i.map((j) => { - e({ - type: "setProperty", - array: "switchButtons", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - color: "green", - }), - }); - }); - }, - }, - { - name: "Default", - selected: "cyan" === t.color, + name: "Movement", + selected: "movement" === t.affects, onPress: () => { i.map((j) => { e({ @@ -38593,15 +38276,15 @@ var version = "v1.17.2"; index: j, set: (e) => Object.assign(Object.assign({}, e), { - color: "cyan", + affects: "movement", }), }); }); }, }, { - name: "Blue", - selected: "blue" === t.color, + name: "Block / Spikes", + selected: "blockSpike" === t.affects, onPress: () => { i.map((j) => { e({ @@ -38610,15 +38293,15 @@ var version = "v1.17.2"; index: j, set: (e) => Object.assign(Object.assign({}, e), { - color: "blue", + affects: "blockSpike", }), }); }); }, }, { - name: "Violet", - selected: "violet" === t.color, + name: "Size", + selected: "size" === t.affects, onPress: () => { i.map((j) => { e({ @@ -38627,15 +38310,15 @@ var version = "v1.17.2"; index: j, set: (e) => Object.assign(Object.assign({}, e), { - color: "violet", + affects: "size", }), }); }); }, }, { - name: "Pink", - selected: "pink" === t.color, + name: "BG Color", + selected: "color" === t.affects, onPress: () => { i.map((j) => { e({ @@ -38644,15 +38327,15 @@ var version = "v1.17.2"; index: j, set: (e) => Object.assign(Object.assign({}, e), { - color: "pink", + affects: "color", }), }); }); }, }, { - name: "Black", - selected: "black" === t.color, + name: "Fall", + selected: "falling" === t.affects, onPress: () => { i.map((j) => { e({ @@ -38661,15 +38344,15 @@ var version = "v1.17.2"; index: j, set: (e) => Object.assign(Object.assign({}, e), { - color: "black", + affects: "falling", }), }); }); }, }, { - name: "White", - selected: "white" === t.color, + name: "Gravity", + selected: "gravity" === t.affects, onPress: () => { i.map((j) => { e({ @@ -38678,52 +38361,7 @@ var version = "v1.17.2"; index: j, set: (e) => Object.assign(Object.assign({}, e), { - color: "white", - }), - }); - }); - }, - }, - ], - })); - return j; - })(e, t, a, i); - case "block": - return (function (e, t, a) { - if (t.init) { - return [ - { - name: "Color", - options: [ - { - name: "Red", - selected: t.init == "red", - onPress: () => { - a.map((j) => { - e({ - type: "setProperty", - array: "blocks", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - init: "red", - }), - }); - }); - }, - }, - { - name: "Blue", - selected: t.init == "blue", - onPress: () => { - a.map((j) => { - e({ - type: "setProperty", - array: "blocks", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - init: "blue", + affects: "gravity", }), }); }); @@ -38731,207 +38369,392 @@ var version = "v1.17.2"; }, ], }, + ] + : []; + (t.affects == "gravity" && + j.push({ + name: "Direction", + options: [ { - name: "Trigger", - options: [ - { - name: "Music Beat", - selected: t.trigger == "beat", - onPress: () => { - a.map((j) => { - e({ - type: "setProperty", - array: "blocks", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - trigger: "beat", - }), - }); - }); - }, - }, - { - name: "Jump", - selected: t.trigger == "jump", - onPress: () => { - a.map((j) => { - e({ - type: "setProperty", - array: "blocks", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - trigger: "jump", - }), - }); - }); - }, - }, - { - name: "Switch", - selected: t.trigger == "switch", - onPress: () => { - a.map((j) => { - e({ - type: "setProperty", - array: "blocks", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - trigger: "switch", - }), - }); - }); - }, - }, - ], + name: "Up", + selected: t.gravity < 0, + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "switchButtons", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + gravity: -1, + }), + }); + }); + }, }, - ]; - } - return [ - { - name: "Type", - options: [ - { - name: "Normal", - selected: !t.steel && !t.isVoid && !t.isBoss && !t.isFade, - onPress: () => { - a.map((j) => { - e({ - type: "setProperty", - array: "blocks", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - steel: false, - isVoid: false, - isBoss: false, - isFade: false, - }), - }); + { + name: "Dash", + selected: t.gravity == 0, + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "switchButtons", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + gravity: 0, + }), }); - }, + }); }, - { - name: "Steel", - selected: t.steel && !t.isVoid, - onPress: () => { - a.map((j) => { - e({ - type: "setProperty", - array: "blocks", - index: j, - set: (l) => - Object.assign(Object.assign({}, l), { - steel: true, - isVoid: false, - isBoss: false, - isFade: false, - }), - }); + }, + { + name: "Jump", + selected: t.gravity == 2, + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "switchButtons", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + gravity: 2, + }), }); - }, + }); + }, + }, + { + name: "Down", + selected: t.gravity == 1, + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "switchButtons", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + gravity: 1, + }), + }); + }); + }, + }, + ], + }), + t.affects == "falling" && + j.push({ + name: "Direction", + options: [ + { + name: "Up", + selected: t.up, + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "switchButtons", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + up: !e.up, + }), + }); + }); + }, + }, + { + name: "Down", + selected: t.down, + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "switchButtons", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + down: !e.down, + }), + }); + }); + }, + }, + ], + }), + t.affects == "color" && + j.push({ + name: "Color", + options: [ + { + name: "Flash", + selected: "flash" === t.color, + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "switchButtons", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + color: "flash", + }), + }); + }); + }, + }, + { + name: "Red", + selected: "red" === t.color, + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "switchButtons", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + color: "red", + }), + }); + }); + }, + }, + { + name: "Yellow", + selected: "yellow" === t.color, + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "switchButtons", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + color: "yellow", + }), + }); + }); + }, + }, + { + name: "Green", + selected: "green" === t.color, + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "switchButtons", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + color: "green", + }), + }); + }); + }, + }, + { + name: "Default", + selected: "cyan" === t.color, + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "switchButtons", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + color: "cyan", + }), + }); + }); + }, + }, + { + name: "Blue", + selected: "blue" === t.color, + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "switchButtons", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + color: "blue", + }), + }); + }); + }, + }, + { + name: "Violet", + selected: "violet" === t.color, + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "switchButtons", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + color: "violet", + }), + }); + }); + }, + }, + { + name: "Pink", + selected: "pink" === t.color, + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "switchButtons", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + color: "pink", + }), + }); + }); + }, + }, + { + name: "Black", + selected: "black" === t.color, + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "switchButtons", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + color: "black", + }), + }); + }); + }, + }, + { + name: "White", + selected: "white" === t.color, + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "switchButtons", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + color: "white", + }), + }); + }); }, + }, + ], + })); + return j; + })(e, t, a, i); + case "block": + return (function (e, t, a) { + if (t.init) { + return [ + { + name: "Color", + options: [ { - name: "Void", - selected: t.isVoid, + name: "Red", + selected: t.init == "red", onPress: () => { a.map((j) => { e({ type: "setProperty", array: "blocks", index: j, - set: (l) => - Object.assign(Object.assign({}, l), { - isVoid: true, - steel: false, - isBoss: false, - isFade: false, + set: (e) => + Object.assign(Object.assign({}, e), { + init: "red", }), }); }); }, }, { - name: "Boss", - selected: t?.isBoss, + name: "Blue", + selected: t.init == "blue", onPress: () => { a.map((j) => { e({ type: "setProperty", array: "blocks", index: j, - set: (l) => - Object.assign(Object.assign({}, l), { - isVoid: false, - steel: false, - isBoss: true, - isFade: false, + set: (e) => + Object.assign(Object.assign({}, e), { + init: "blue", }), }); }); }, }, + ], + }, + { + name: "Trigger", + options: [ { - name: "Invisible", - selected: t.isFade, + name: "Music Beat", + selected: t.trigger == "beat", onPress: () => { a.map((j) => { e({ type: "setProperty", array: "blocks", index: j, - set: (l) => - Object.assign(Object.assign({}, l), { - isVoid: false, - steel: false, - isBoss: false, - isFade: true, + set: (e) => + Object.assign(Object.assign({}, e), { + trigger: "beat", }), }); }); }, }, - ], - }, - ]; - })(e, t, i); - case "spring": - return (function (e, t, a) { - return [ - { - name: "Direction", - options: [ { - name: "Up", - selected: 1 === t.direction, + name: "Jump", + selected: t.trigger == "jump", onPress: () => { a.map((j) => { e({ type: "setProperty", - array: "springs", + array: "blocks", index: j, set: (e) => Object.assign(Object.assign({}, e), { - direction: 1, + trigger: "jump", }), }); }); }, }, { - name: "Down", - selected: -1 === t.direction, + name: "Switch", + selected: t.trigger == "switch", onPress: () => { a.map((j) => { e({ type: "setProperty", - array: "springs", + array: "blocks", index: j, set: (e) => Object.assign(Object.assign({}, e), { - direction: -1, + trigger: "switch", }), }); }); @@ -38940,230 +38763,343 @@ var version = "v1.17.2"; ], }, ]; - })(e, t, i); - case "collectible": - return (function (e, t, a, i) { - const n = []; - return ( - a.includes("collectible") && - n.push({ - name: "Coin", - selected: "coin" === t.form, + } + return [ + { + name: "Type", + options: [ + { + name: "Normal", + selected: !t.steel && !t.isVoid && !t.isBoss && !t.isFade, onPress: () => { - i.map((j) => { + a.map((j) => { e({ type: "setProperty", - array: "collectibles", + array: "blocks", index: j, - set: (e) => $.changeCollectibleForm(e, "coin"), + set: (e) => + Object.assign(Object.assign({}, e), { + steel: false, + isVoid: false, + isBoss: false, + isFade: false, + }), }); }); }, - }), - a.includes("arrows") && - n.push({ - name: "Arrow", - selected: "arrow" === t.form, + }, + { + name: "Steel", + selected: t.steel && !t.isVoid, onPress: () => { - i.map((j) => { + a.map((j) => { e({ type: "setProperty", - array: "collectibles", + array: "blocks", index: j, - set: (e) => $.changeCollectibleForm(e, "arrow"), + set: (l) => + Object.assign(Object.assign({}, l), { + steel: true, + isVoid: false, + isBoss: false, + isFade: false, + }), }); }); }, - }), - n.length > 1 ? [{ name: "Type", options: n }] : [] - ); - })(e, t, a, i); - case "enemy": - return (function (e, t, a, i) { - const n = (e, t) => { - const a = Ca.removeObject(t, "enemies", i); - return Da.moveObjectUntilCanPlace(a, e, 1) || null; - }, - s = []; - (a.includes("flyingEnemy") && - s.push({ - name: "Shooter", - selected: "shooter" === t.kind, - onPress: () => { - i.map((j) => { - e({ - type: "setProperty", - array: "enemies", - index: j, - set: (e, t) => - n($.changeEnemyKind(e, "shooter"), t), + }, + { + name: "Void", + selected: t.isVoid, + onPress: () => { + a.map((j) => { + e({ + type: "setProperty", + array: "blocks", + index: j, + set: (l) => + Object.assign(Object.assign({}, l), { + isVoid: true, + steel: false, + isBoss: false, + isFade: false, + }), + }); }); - }); + }, }, - }), - (a.includes("walkingEnemy") || a.includes("giantEnemy")) && - s.push( - { - name: "Walker", - selected: "walker" === t.kind, - onPress: () => { - i.map((j) => { - e({ - type: "setProperty", - array: "enemies", - index: j, - set: (e, t) => - n($.changeEnemyKind(e, "walker"), t), - }); + { + name: "Boss", + selected: t?.isBoss, + onPress: () => { + a.map((j) => { + e({ + type: "setProperty", + array: "blocks", + index: j, + set: (l) => + Object.assign(Object.assign({}, l), { + isVoid: false, + steel: false, + isBoss: true, + isFade: false, + }), }); - }, + }); }, - { - name: "Walker H", - selected: "walkerHelmet" === t.kind, - onPress: () => { - i.map((j) => { - e({ - type: "setProperty", - array: "enemies", - index: j, - set: (e, t) => - n($.changeEnemyKind(e, "walkerHelmet"), t), - }); + }, + { + name: "Invisible", + selected: t.isFade, + onPress: () => { + a.map((j) => { + e({ + type: "setProperty", + array: "blocks", + index: j, + set: (l) => + Object.assign(Object.assign({}, l), { + isVoid: false, + steel: false, + isBoss: false, + isFade: true, + }), }); - }, + }); }, - )); - s.push({ - name: "Bomb", - selected: "bomb" === t.kind, + }, + ], + }, + ]; + })(e, t, i); + case "spring": + return (function (e, t, a) { + return [ + { + name: "Direction", + options: [ + { + name: "Up", + selected: 1 === t.direction, + onPress: () => { + a.map((j) => { + e({ + type: "setProperty", + array: "springs", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + direction: 1, + }), + }); + }); + }, + }, + { + name: "Down", + selected: -1 === t.direction, + onPress: () => { + a.map((j) => { + e({ + type: "setProperty", + array: "springs", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + direction: -1, + }), + }); + }); + }, + }, + ], + }, + ]; + })(e, t, i); + case "collectible": + return (function (e, t, a, i) { + const n = []; + return ( + a.includes("collectible") && + n.push({ + name: "Coin", + selected: "coin" === t.form, onPress: () => { i.map((j) => { e({ type: "setProperty", - array: "enemies", + array: "collectibles", index: j, - set: (e, t) => n($.changeEnemyKind(e, "bomb"), t), + set: (e) => $.changeCollectibleForm(e, "coin"), }); }); }, - }); - s.push({ - name: "Minion", - selected: "minion" === t.kind, + }), + a.includes("arrows") && + n.push({ + name: "Arrow", + selected: "arrow" === t.form, onPress: () => { i.map((j) => { e({ type: "setProperty", - array: "enemies", + array: "collectibles", index: j, - set: (e, t) => n($.changeEnemyKind(e, "minion"), t), + set: (e) => $.changeCollectibleForm(e, "arrow"), }); }); }, - }); + }), + n.length > 1 ? [{ name: "Type", options: n }] : [] + ); + })(e, t, a, i); + case "enemy": + return (function (e, t, a, i) { + const n = (e, t) => { + const a = Ca.removeObject(t, "enemies", i); + return Da.moveObjectUntilCanPlace(a, e, 1) || null; + }, + s = []; + (a.includes("flyingEnemy") && s.push({ - name: "Fireball", - selected: "fireball" === t.kind, + name: "Shooter", + selected: "shooter" === t.kind, onPress: () => { i.map((j) => { e({ type: "setProperty", array: "enemies", index: j, - set: (e, t) => n($.changeEnemyKind(e, "fireball"), t), + set: (e, t) => + n($.changeEnemyKind(e, "shooter"), t), }); }); }, - }); - const o = [{ name: "Kind", options: s }]; - return ( - "shooter" !== t.kind && - "fireball" !== t.kind && - a.includes("giantEnemy") && - a.includes("walkingEnemy") && - ("bomb" !== t.kind && - "minion" !== t.kind && - o.push({ - name: "Giant", - options: [ - { - name: "On", - selected: t.giant, - onPress: () => { - i.map((j) => { - e({ - type: "setProperty", - array: "enemies", - index: j, - set: (e, t) => - n($.changeEnemyGiant(e, true), t), - }); - }); - }, - }, - { - name: "Off", - selected: !t.giant, - onPress: () => { - i.map((j) => { - e({ - type: "setProperty", - array: "enemies", - index: j, - set: (e, t) => - n($.changeEnemyGiant(e, false), t), - }); - }); - }, - }, - ], - }), - o.push({ - name: "Direction", - options: [ - { - name: "Left", - selected: t.enemyDir < 0, - onPress: () => { - i.map((j) => { - e({ - type: "setProperty", - array: "enemies", - index: j, - set: (e, t) => - Object.assign(Object.assign({}, e), { - enemyDir: -1, - }), - }); + }), + (a.includes("walkingEnemy") || a.includes("giantEnemy")) && + s.push( + { + name: "Walker", + selected: "walker" === t.kind, + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "enemies", + index: j, + set: (e, t) => + n($.changeEnemyKind(e, "walker"), t), + }); + }); + }, + }, + { + name: "Walker H", + selected: "walkerHelmet" === t.kind, + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "enemies", + index: j, + set: (e, t) => + n($.changeEnemyKind(e, "walkerHelmet"), t), + }); + }); + }, + }, + )); + s.push({ + name: "Bomb", + selected: "bomb" === t.kind, + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "enemies", + index: j, + set: (e, t) => n($.changeEnemyKind(e, "bomb"), t), + }); + }); + }, + }); + s.push({ + name: "Minion", + selected: "minion" === t.kind, + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "enemies", + index: j, + set: (e, t) => n($.changeEnemyKind(e, "minion"), t), + }); + }); + }, + }); + s.push({ + name: "Fireball", + selected: "fireball" === t.kind, + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "enemies", + index: j, + set: (e, t) => n($.changeEnemyKind(e, "fireball"), t), + }); + }); + }, + }); + const o = [{ name: "Kind", options: s }]; + return ( + "shooter" !== t.kind && + "fireball" !== t.kind && + a.includes("giantEnemy") && + a.includes("walkingEnemy") && + ("bomb" !== t.kind && + "minion" !== t.kind && + o.push({ + name: "Giant", + options: [ + { + name: "On", + selected: t.giant, + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "enemies", + index: j, + set: (e, t) => + n($.changeEnemyGiant(e, true), t), }); - }, + }); }, - { - name: "Right", - selected: t.enemyDir > 0, - onPress: () => { - i.map((j) => { - e({ - type: "setProperty", - array: "enemies", - index: j, - set: (e, t) => - Object.assign(Object.assign({}, e), { - enemyDir: 1, - }), - }); + }, + { + name: "Off", + selected: !t.giant, + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "enemies", + index: j, + set: (e, t) => + n($.changeEnemyGiant(e, false), t), }); - }, + }); }, - ], - })), + }, + ], + }), o.push({ - name: "Compatibility", + name: "Direction", options: [ { - name: "On", - selected: t.isCompatible, + name: "Left", + selected: t.enemyDir < 0, onPress: () => { i.map((j) => { e({ @@ -39172,15 +39108,15 @@ var version = "v1.17.2"; index: j, set: (e, t) => Object.assign(Object.assign({}, e), { - isCompatible: true, + enemyDir: -1, }), }); }); }, }, { - name: "Off", - selected: !t.isCompatible, + name: "Right", + selected: t.enemyDir > 0, onPress: () => { i.map((j) => { e({ @@ -39189,72 +39125,242 @@ var version = "v1.17.2"; index: j, set: (e, t) => Object.assign(Object.assign({}, e), { - isCompatible: false, + enemyDir: 1, }), }); }); }, }, ], - }), - debug && - o.push({ - name: "Skip Missiles", - options: [ - { - name: "On", - selected: t.skipMissiles, - onPress: () => { - i.map((j) => { - e({ - type: "setProperty", - array: "enemies", - index: j, - set: (e, t) => - Object.assign(Object.assign({}, e), { - skipMissiles: true, - }), - }); - }); - }, - }, - { - name: "Off", - selected: !t.skipMissiles, - onPress: () => { - i.map((j) => { - e({ - type: "setProperty", - array: "enemies", - index: j, - set: (e, t) => - Object.assign(Object.assign({}, e), { - skipMissiles: false, - }), - }); - }); - }, - }, - ], - }), - o - ); - })(e, t, a, i); - case "platform": - return (function (e, t, a, i) { - const n = (e, t, a) => { - const n = Ca.removeObject(t, "platforms", i); - return ( - Da.moveObjectUntilCanPlace( - n, - Object.assign(Object.assign({}, e), { movement: a }), - ) || null - ); - }; - var s = [ + })), + o.push({ + name: "Compatibility", + options: [ + { + name: "On", + selected: t.isCompatible, + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "enemies", + index: j, + set: (e, t) => + Object.assign(Object.assign({}, e), { + isCompatible: true, + }), + }); + }); + }, + }, + { + name: "Off", + selected: !t.isCompatible, + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "enemies", + index: j, + set: (e, t) => + Object.assign(Object.assign({}, e), { + isCompatible: false, + }), + }); + }); + }, + }, + ], + }), + debug && + o.push({ + name: "Skip Missiles", + options: [ + { + name: "On", + selected: t.skipMissiles, + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "enemies", + index: j, + set: (e, t) => + Object.assign(Object.assign({}, e), { + skipMissiles: true, + }), + }); + }); + }, + }, + { + name: "Off", + selected: !t.skipMissiles, + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "enemies", + index: j, + set: (e, t) => + Object.assign(Object.assign({}, e), { + skipMissiles: false, + }), + }); + }); + }, + }, + ], + }), + o + ); + })(e, t, a, i); + case "platform": + return (function (e, t, a, i) { + const n = (e, t, a) => { + const n = Ca.removeObject(t, "platforms", i); + return ( + Da.moveObjectUntilCanPlace( + n, + Object.assign(Object.assign({}, e), { movement: a }), + ) || null + ); + }; + var s = [ + { + name: "Music Beat", + selected: "beat" === t.movementTrigger, + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "platforms", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + movementTrigger: "beat", + }), + }); + }); + }, + }, + ]; + a.includes("moveOnJump") && + s.push({ + name: "Jump", + selected: "jump" === t.movementTrigger, + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "platforms", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + movementTrigger: "jump", + }), + }); + }); + }, + }); + a.includes("switchButton") && + s.push({ + name: "Switch", + selected: "switch" === t.movementTrigger, + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "platforms", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + movementTrigger: "switch", + }), + }); + }); + }, + }); + const o = [ + { + name: "Static", + selected: "static" === t.movement, + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "platforms", + index: j, + set: (e, t) => n(e, t, "static"), + }); + }); + }, + }, + { + name: "Up-Down", + selected: "upDown" === t.movement, + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "platforms", + index: j, + set: (e, t) => n(e, t, "upDown"), + }); + }); + }, + }, + { + name: "Down-Up", + selected: "downUp" === t.movement, + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "platforms", + index: j, + set: (e, t) => n(e, t, "downUp"), + }); + }); + }, + }, + ]; + (a.includes("fallingPlatform") && + o.push({ + name: "Falling", + selected: "falling" === t.movement, + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "platforms", + index: j, + set: (e, t) => n(e, t, "falling"), + }); + }); + }, + }), + a.includes("skateboard") && + o.push({ + name: "Rail", + selected: "rail" === t.movement, + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "platforms", + index: j, + set: (e, t) => n(e, t, "rail"), + }); + }); + }, + })); + const r = [{ name: "Movement", options: o }]; + t.movement == "falling" && + (s = [ { - name: "Music Beat", - selected: "beat" === t.movementTrigger, + name: "Down", + selected: t?.multiplier > 0, onPress: () => { i.map((j) => { e({ @@ -39263,17 +39369,15 @@ var version = "v1.17.2"; index: j, set: (e) => Object.assign(Object.assign({}, e), { - movementTrigger: "beat", + multiplier: Math.abs(e.multiplier), }), }); }); }, }, - ]; - a.includes("moveOnJump") && - s.push({ - name: "Jump", - selected: "jump" === t.movementTrigger, + { + name: "Up", + selected: t?.multiplier < 0, onPress: () => { i.map((j) => { e({ @@ -39282,16 +39386,15 @@ var version = "v1.17.2"; index: j, set: (e) => Object.assign(Object.assign({}, e), { - movementTrigger: "jump", + multiplier: -Math.abs(e.multiplier), }), }); }); }, - }); - a.includes("switchButton") && - s.push({ - name: "Switch", - selected: "switch" === t.movementTrigger, + }, + { + name: "x2", + selected: Math.abs(t?.multiplier) == 2, onPress: () => { i.map((j) => { e({ @@ -39300,189 +39403,436 @@ var version = "v1.17.2"; index: j, set: (e) => Object.assign(Object.assign({}, e), { - movementTrigger: "switch", + multiplier: Math.sign(e.multiplier) * 2, }), }); }); }, - }); - const o = [ - { - name: "Static", - selected: "static" === t.movement, - onPress: () => { - i.map((j) => { - e({ - type: "setProperty", - array: "platforms", - index: j, - set: (e, t) => n(e, t, "static"), - }); - }); - }, }, { - name: "Up-Down", - selected: "upDown" === t.movement, + name: "/2", + selected: Math.abs(t?.multiplier) == 0.5, onPress: () => { i.map((j) => { e({ type: "setProperty", array: "platforms", index: j, - set: (e, t) => n(e, t, "upDown"), + set: (e) => + Object.assign(Object.assign({}, e), { + multiplier: Math.sign(e.multiplier) / 2, + }), }); }); }, }, { - name: "Down-Up", - selected: "downUp" === t.movement, + name: "x1", + selected: Math.abs(t?.multiplier) == 1, onPress: () => { i.map((j) => { e({ type: "setProperty", array: "platforms", index: j, - set: (e, t) => n(e, t, "downUp"), + set: (e) => + Object.assign(Object.assign({}, e), { + multiplier: Math.sign(e.multiplier), + }), }); }); }, }, - ]; - (a.includes("fallingPlatform") && - o.push({ - name: "Falling", - selected: "falling" === t.movement, - onPress: () => { - i.map((j) => { - e({ - type: "setProperty", - array: "platforms", - index: j, - set: (e, t) => n(e, t, "falling"), - }); + ]); + return ( + ("downUp" !== t.movement && + "upDown" !== t.movement && + "falling" !== t.movement) || + r.push({ name: "Trigger", options: s }), + r + ); + })(e, t, a, i); + case "saw": + return (function (e, t, a, i) { + var n = [ + { + name: "Music Beat", + selected: "beat" === t.movementTrigger, + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "saws", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + movementTrigger: "beat", + shape: "rail", + width: 30, + height: 30, + }), }); - }, - }), - a.includes("skateboard") && - o.push({ - name: "Rail", - selected: "rail" === t.movement, - onPress: () => { - i.map((j) => { - e({ - type: "setProperty", - array: "platforms", - index: j, - set: (e, t) => n(e, t, "rail"), - }); - }); - }, - })); - const r = [{ name: "Movement", options: o }]; - t.movement == "falling" && - (s = [ - { - name: "Down", - selected: t?.multiplier > 0, - onPress: () => { - i.map((j) => { - e({ - type: "setProperty", - array: "platforms", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - multiplier: Math.abs(e.multiplier), - }), + }); + }, + }, + ], + j = [ + { + name: "Movement", + options: [ + { + name: "Static", + selected: "static" === t.movement, + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "saws", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + movement: "static", + }), + }); }); - }); + }, }, - }, - { - name: "Up", - selected: t?.multiplier < 0, - onPress: () => { - i.map((j) => { - e({ - type: "setProperty", - array: "platforms", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - multiplier: -Math.abs(e.multiplier), - }), + { + name: "Up-Down", + selected: "upDown" === t.movement, + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "saws", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + movement: "upDown", + shape: "rail", + width: 30, + height: 30, + }), + }); + }); + }, + }, + { + name: "Down-Up", + selected: "downUp" === t.movement, + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "saws", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + movement: "downUp", + shape: "rail", + width: 30, + height: 30, + }), + }); + }); + }, + }, + ], + }, + ]; + return ( + a.includes("moveOnJump") && + n.push({ + name: "Jump", + selected: "jump" === t.movementTrigger, + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "saws", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + movementTrigger: "jump", + }), + }); + }); + }, + }), + n.push({ + name: "Switch", + selected: "switch" === t.movementTrigger, + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "saws", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + movementTrigger: "switch", + }), + }); + }); + }, + }), + t.movement == "falling" && + (n = [ + { + name: "Down", + selected: t?.multiplier > 0, + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "saws", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + multiplier: Math.abs(e.multiplier), + }), + }); + }); + }, + }, + { + name: "Up", + selected: t?.multiplier < 0, + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "saws", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + multiplier: -Math.abs(e.multiplier), + }), + }); + }); + }, + }, + { + name: "x2", + selected: Math.abs(t?.multiplier) == 2, + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "saws", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + multiplier: Math.sign(e.multiplier) * 2, + }), + }); + }); + }, + }, + { + name: "/2", + selected: Math.abs(t?.multiplier) == 0.5, + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "saws", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + multiplier: Math.sign(e.multiplier) / 2, + }), + }); + }); + }, + }, + { + name: "x1", + selected: Math.abs(t?.multiplier) == 1, + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "saws", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + multiplier: Math.sign(e.multiplier) * 1, + }), + }); + }); + }, + }, + ]), + t.movement == "static" && + (n = [ + { + name: "Bar", + selected: t?.shape == "bar", + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "saws", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + shape: "bar", + width: 120, + height: 20, + }), + }); + }); + }, + }, + { + name: "Large", + selected: t?.shape == "large", + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "saws", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + shape: "large", + width: 90, + height: 90, + }), + }); + }); + }, + }, + { + name: "Small", + selected: t?.shape == "small", + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "saws", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + shape: "small", + width: 60, + height: 60, + }), + }); + }); + }, + }, + { + name: "Default", + selected: t.shape == "rail", + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "saws", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + shape: "rail", + width: 30, + height: 30, + }), + }); + }); + }, + }, + ]), + j.push({ + name: + t.movement == "falling" + ? "Multiplier" + : t.movement == "static" + ? "Shape" + : "Trigger", + options: n, + }), + t.shape === "bar" && + j.push({ + name: "Offset", + options: [ + { + name: "0", + selected: t.offset === 0, + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "saws", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + offset: 0, + }), }); }); }, }, { - name: "x2", - selected: Math.abs(t?.multiplier) == 2, + name: "30", + selected: t.offset === 30, onPress: () => { i.map((j) => { e({ type: "setProperty", - array: "platforms", + array: "saws", index: j, set: (e) => Object.assign(Object.assign({}, e), { - multiplier: Math.sign(e.multiplier) * 2, + offset: 30, }), }); }); }, }, { - name: "/2", - selected: Math.abs(t?.multiplier) == 0.5, + name: "60", + selected: t.offset === 60, onPress: () => { i.map((j) => { e({ type: "setProperty", - array: "platforms", + array: "saws", index: j, set: (e) => Object.assign(Object.assign({}, e), { - multiplier: Math.sign(e.multiplier) / 2, + offset: 60, }), }); }); }, }, { - name: "x1", - selected: Math.abs(t?.multiplier) == 1, + name: "90", + selected: t.offset === 90, onPress: () => { i.map((j) => { e({ type: "setProperty", - array: "platforms", + array: "saws", index: j, set: (e) => Object.assign(Object.assign({}, e), { - multiplier: Math.sign(e.multiplier), + offset: 90, }), }); }); }, }, - ]); - return ( - ("downUp" !== t.movement && - "upDown" !== t.movement && - "falling" !== t.movement) || - r.push({ name: "Trigger", options: s }), - r - ); - })(e, t, a, i); - case "saw": - return (function (e, t, a, i) { - var n = [ + ], + }), + debug && + j.push({ + name: "Skip Missiles", + options: [ { - name: "Music Beat", - selected: "beat" === t.movementTrigger, + name: "On", + selected: t.skipMissiles, onPress: () => { i.map((j) => { e({ @@ -39491,382 +39841,627 @@ var version = "v1.17.2"; index: j, set: (e) => Object.assign(Object.assign({}, e), { - movementTrigger: "beat", - shape: "rail", - width: 30, - height: 30, + skipMissiles: true, + }), + }); + }); + }, + }, + { + name: "Off", + selected: !t.skipMissiles, + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "saws", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + skipMissiles: false, }), }); }); }, }, ], - j = [ + }), + j + ); + })(e, t, a, i); + case "directionChange": + return (function (e, t, a) { + return [ + { + name: "Direction", + options: [ { - name: "Movement", - options: [ - { - name: "Static", - selected: "static" === t.movement, - onPress: () => { - i.map((j) => { - e({ - type: "setProperty", - array: "saws", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - movement: "static", - }), - }); - }); - }, - }, - { - name: "Up-Down", - selected: "upDown" === t.movement, - onPress: () => { - i.map((j) => { - e({ - type: "setProperty", - array: "saws", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - movement: "upDown", - shape: "rail", - width: 30, - height: 30, - }), - }); - }); - }, - }, - { - name: "Down-Up", - selected: "downUp" === t.movement, - onPress: () => { - i.map((j) => { - e({ - type: "setProperty", - array: "saws", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - movement: "downUp", - shape: "rail", - width: 30, - height: 30, - }), - }); - }); - }, - }, - ], + name: "Left", + selected: "left" === t.direction, + onPress: () => { + a.map((j) => { + e({ + type: "setProperty", + array: "directionChanges", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + direction: "left", + }), + }); + }); + }, }, - ]; - return ( - a.includes("moveOnJump") && - n.push({ - name: "Jump", - selected: "jump" === t.movementTrigger, + { + name: "Right", + selected: "right" === t.direction, onPress: () => { i.map((j) => { e({ type: "setProperty", - array: "saws", + array: "directionChanges", index: j, set: (e) => Object.assign(Object.assign({}, e), { - movementTrigger: "jump", + direction: "right", }), }); }); }, - }), - n.push({ - name: "Switch", - selected: "switch" === t.movementTrigger, - onPress: () => { - i.map((j) => { - e({ - type: "setProperty", - array: "saws", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - movementTrigger: "switch", - }), + }, + ], + }, + { + name: "Usage", + options: [ + { + name: "Single-Use", + selected: !t.multiUse, + onPress: () => { + a.map((j) => { + e({ + type: "setProperty", + array: "directionChanges", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + multiUse: false, + }), + }); }); - }); + }, }, - }), - t.movement == "falling" && - (n = [ - { - name: "Down", - selected: t?.multiplier > 0, - onPress: () => { - i.map((j) => { - e({ - type: "setProperty", - array: "saws", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - multiplier: Math.abs(e.multiplier), - }), - }); + { + name: "Multi-Use", + selected: t.multiUse, + onPress: () => { + a.map((j) => { + e({ + type: "setProperty", + array: "directionChanges", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + multiUse: true, + }), }); - }, + }); }, - { - name: "Up", - selected: t?.multiplier < 0, - onPress: () => { - i.map((j) => { - e({ - type: "setProperty", - array: "saws", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - multiplier: -Math.abs(e.multiplier), - }), - }); + }, + ], + }, + { + name: "Fix Sync", + options: [ + { + name: "On", + selected: t.fixSync, + onPress: () => { + a.map((j) => { + e({ + type: "setProperty", + array: "directionChanges", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + fixSync: true, + }), }); - }, + }); }, - { - name: "x2", - selected: Math.abs(t?.multiplier) == 2, - onPress: () => { - i.map((j) => { - e({ - type: "setProperty", - array: "saws", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - multiplier: Math.sign(e.multiplier) * 2, - }), - }); + }, + { + name: "Off", + selected: !t.fixSync, + onPress: () => { + a.map((j) => { + e({ + type: "setProperty", + array: "directionChanges", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + fixSync: false, + }), }); - }, + }); + }, + }, + ], + }, + ]; + })(e, t, i); + case "speedChange": + return (function (e, t, a) { + return [ + { + name: "Speed", + options: [ + { + name: "Left", + selected: "left" === t.direction, + onPress: () => { + a.map((j) => { + e({ + type: "setProperty", + array: "speedChanges", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + direction: "left", + }), + }); + }); + }, + }, + { + name: "Right", + selected: "right" === t.direction, + onPress: () => { + a.map((j) => { + e({ + type: "setProperty", + array: "speedChanges", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + direction: "right", + }), + }); + }); + }, + }, + ], + }, + ]; + })(e, t, i); + case "flag": + return (function (e, t, a) { + var j = [ + { + name: "Role", + options: [ + { + name: "Checkpoint", + selected: "checkpoint" === t.role, + onPress: () => { + a.map((j) => { + e({ + type: "setProperty", + array: "flags", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + role: "checkpoint", + }), + }); + }); + }, + }, + { + name: "End of Level", + selected: "endOfLevel" === t.role, + onPress: () => { + a.map((j) => { + e({ + type: "setProperty", + array: "flags", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + role: "endOfLevel", + }), + }); + }); }, + }, + ], + }, + ]; + t.role == "checkpoint" && + (j = [ + ...j, + { + name: "Switches", + options: [ { - name: "/2", - selected: Math.abs(t?.multiplier) == 0.5, + name: "On", + selected: t.switchesOn, onPress: () => { - i.map((j) => { + a.map((j) => { e({ type: "setProperty", - array: "saws", + array: "flags", index: j, set: (e) => Object.assign(Object.assign({}, e), { - multiplier: Math.sign(e.multiplier) / 2, + switchesOn: true, }), }); }); }, }, { - name: "x1", - selected: Math.abs(t?.multiplier) == 1, + name: "Off", + selected: !t.switchesOn, onPress: () => { - i.map((j) => { + a.map((j) => { e({ type: "setProperty", - array: "saws", + array: "flags", index: j, set: (e) => Object.assign(Object.assign({}, e), { - multiplier: Math.sign(e.multiplier) * 1, + switchesOn: false, }), }); }); }, }, - ]), - t.movement == "static" && - (n = [ + ], + }, + { + name: "Speed", + options: [ { - name: "Bar", - selected: t?.shape == "bar", + name: "Keep", + selected: t.retainSpeed, onPress: () => { - i.map((j) => { + a.map((j) => { e({ type: "setProperty", - array: "saws", + array: "flags", index: j, set: (e) => Object.assign(Object.assign({}, e), { - shape: "bar", - width: 120, - height: 20, + retainSpeed: true, }), }); }); }, }, { - name: "Large", - selected: t?.shape == "large", + name: "Reset", + selected: !t.retainSpeed, onPress: () => { - i.map((j) => { + a.map((j) => { e({ type: "setProperty", - array: "saws", + array: "flags", index: j, set: (e) => Object.assign(Object.assign({}, e), { - shape: "large", - width: 90, - height: 90, + retainSpeed: false, }), }); }); }, }, - { - name: "Small", - selected: t?.shape == "small", - onPress: () => { - i.map((j) => { - e({ - type: "setProperty", - array: "saws", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - shape: "small", - width: 60, - height: 60, - }), - }); - }); - }, - }, - { - name: "Default", - selected: t.shape == "rail", - onPress: () => { - i.map((j) => { - e({ - type: "setProperty", - array: "saws", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - shape: "rail", - width: 30, - height: 30, - }), - }); - }); - }, - }, - ]), - j.push({ - name: - t.movement == "falling" - ? "Multiplier" - : t.movement == "static" - ? "Shape" - : "Trigger", - options: n, - }), - t.shape === "bar" && - j.push({ - name: "Offset", + ], + }, + ]); + j.push({ + name: "Shape", + options: [ + { + name: "Normal", + selected: !t.isFlying, + onPress: () => { + a.map((j) => { + e({ + type: "setProperty", + array: "flags", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + isFlying: false, + }), + }); + }); + }, + }, + { + name: "Flying", + selected: t.isFlying, + onPress: () => { + a.map((j) => { + e({ + type: "setProperty", + array: "flags", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + isFlying: true, + }), + }); + }); + }, + }, + ], + }); + return j; + })(e, t, i); + case "powerup": + return (function (e, t, a, i) { + const n = [], + l = []; + return ( + a.includes("doubleJump") && + n.push({ + name: "Double Jump", + selected: "doubleJump" === t.item, + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "powerups", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + item: "doubleJump", + }), + }); + }); + }, + }), + a.includes("gun") && + n.push({ + name: "Gun", + selected: "gun" === t.item, + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "powerups", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + item: "gun", + }), + }); + }); + }, + }), + a.includes("jetpack") && + n.push({ + name: "Jetpack", + selected: "jetpack" === t.item, + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "powerups", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + item: "jetpack", + }), + }); + }); + }, + }), + a.includes("playerStacks") && + n.push({ + name: "Player Stack", + selected: "playerStack" === t.item, + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "powerups", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + item: "playerStack", + }), + }); + }); + }, + }), + a.includes("skateboard") && + n.push({ + name: "Skateboard", + selected: "skateboard" === t.item, + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "powerups", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + item: "skateboard", + }), + }); + }); + }, + }), + a.includes("punch") && + n.push({ + name: "Punch", + selected: "punch" === t.item, + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "powerups", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + item: "punch", + }), + }); + }); + }, + }), + n.push({ + name: "Spaceship", + selected: "spaceship" === t.item, + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "powerups", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + item: "spaceship", + }), + }); + }); + }, + }), + /*n.push({ + name: "Drill", + selected: "drill" === t.item, + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "powerups", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + item: "drill", + }), + }); + }); + }, + }), */ + /* n.push({ + name: "Ghost", + selected: "ghost" === t.item, + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "powerups", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + item: "ghost", + }), + }); + }); + }, + }),*/ + ["playerStack", "punch", "skateboard"].includes(t.item) && + l.push({ + name: "On", + selected: t.compatible, + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "powerups", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + compatible: true, + }), + }); + }); + }, + }), + ["playerStack", "punch", "skateboard"].includes(t.item) && + l.push({ + name: "Off", + selected: !t.compatible, + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "powerups", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + compatible: false, + }), + }); + }); + }, + }), + l.length > 0 + ? [ + { name: "Item", options: n }, + { + name: "Override", options: [ { - name: "0", - selected: t.offset === 0, - onPress: () => { - i.map((j) => { - e({ - type: "setProperty", - array: "saws", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - offset: 0, - }), - }); - }); - }, - }, - { - name: "30", - selected: t.offset === 30, - onPress: () => { - i.map((j) => { - e({ - type: "setProperty", - array: "saws", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - offset: 30, - }), - }); - }); - }, - }, - { - name: "60", - selected: t.offset === 60, + name: "On", + selected: t.override, onPress: () => { i.map((j) => { e({ type: "setProperty", - array: "saws", + array: "powerups", index: j, set: (e) => Object.assign(Object.assign({}, e), { - offset: 60, + override: true, }), }); }); }, }, { - name: "90", - selected: t.offset === 90, + name: "Off", + selected: !t.override, onPress: () => { i.map((j) => { e({ type: "setProperty", - array: "saws", + array: "powerups", index: j, set: (e) => Object.assign(Object.assign({}, e), { - offset: 90, + override: false, }), }); }); }, }, ], - }), - debug && - j.push({ - name: "Skip Missiles", + }, + { name: "Compatible? (EXPERIMENTAL)", options: l }, + ] + : [ + { name: "Item", options: n }, + { + name: "Override", options: [ { name: "On", - selected: t.skipMissiles, + selected: t.override, onPress: () => { i.map((j) => { e({ type: "setProperty", - array: "saws", + array: "powerups", index: j, set: (e) => Object.assign(Object.assign({}, e), { - skipMissiles: true, + override: true, }), }); }); @@ -39874,849 +40469,229 @@ var version = "v1.17.2"; }, { name: "Off", - selected: !t.skipMissiles, + selected: !t.override, onPress: () => { i.map((j) => { e({ type: "setProperty", - array: "saws", + array: "powerups", index: j, set: (e) => Object.assign(Object.assign({}, e), { - skipMissiles: false, + override: false, }), }); }); }, }, ], - }), - j - ); - })(e, t, a, i); - case "directionChange": - return (function (e, t, a) { - return [ - { - name: "Direction", - options: [ - { - name: "Left", - selected: "left" === t.direction, - onPress: () => { - a.map((j) => { - e({ - type: "setProperty", - array: "directionChanges", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - direction: "left", - }), - }); + }, + ] + ); + })(e, t, a, i); + case "switchPlatform": + return (function (e, t, a) { + return [ + { + name: "Init Position", + options: [ + { + name: "Up", + selected: "up" === t.initPosition, + onPress: () => { + i.map((j) => { + e({ + type: "setProperty", + array: "switchPlatforms", + index: j, + set: (e) => + Object.assign(Object.assign({}, e), { + initPosition: "up", + rotation: -90, + }), }); - }, + }); }, - { - name: "Right", - selected: "right" === t.direction, - onPress: () => { - i.map((j) => { - e({ - type: "setProperty", - array: "directionChanges", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - direction: "right", - }), - }); - }); - }, - }, - ], - }, - { - name: "Usage", - options: [ - { - name: "Single-Use", - selected: !t.multiUse, - onPress: () => { - a.map((j) => { - e({ - type: "setProperty", - array: "directionChanges", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - multiUse: false, - }), - }); - }); - }, - }, - { - name: "Multi-Use", - selected: t.multiUse, - onPress: () => { - a.map((j) => { - e({ - type: "setProperty", - array: "directionChanges", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - multiUse: true, - }), - }); - }); - }, - }, - ], - }, - { - name: "Fix Sync", - options: [ - { - name: "On", - selected: t.fixSync, - onPress: () => { - a.map((j) => { - e({ - type: "setProperty", - array: "directionChanges", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - fixSync: true, - }), - }); - }); - }, - }, - { - name: "Off", - selected: !t.fixSync, - onPress: () => { - a.map((j) => { - e({ - type: "setProperty", - array: "directionChanges", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - fixSync: false, - }), - }); - }); - }, - }, - ], - }, - ]; - })(e, t, i); - case "speedChange": - return (function (e, t, a) { - return [ - { - name: "Speed", - options: [ - { - name: "Left", - selected: "left" === t.direction, - onPress: () => { - a.map((j) => { - e({ - type: "setProperty", - array: "speedChanges", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - direction: "left", - }), - }); - }); - }, - }, - { - name: "Right", - selected: "right" === t.direction, - onPress: () => { - a.map((j) => { - e({ - type: "setProperty", - array: "speedChanges", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - direction: "right", - }), - }); - }); - }, - }, - ], - }, - ]; - })(e, t, i); - case "flag": - return (function (e, t, a) { - var j = [ - { - name: "Role", - options: [ - { - name: "Checkpoint", - selected: "checkpoint" === t.role, - onPress: () => { - a.map((j) => { - e({ - type: "setProperty", - array: "flags", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - role: "checkpoint", - }), - }); - }); - }, - }, - { - name: "End of Level", - selected: "endOfLevel" === t.role, - onPress: () => { - a.map((j) => { - e({ - type: "setProperty", - array: "flags", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - role: "endOfLevel", - }), - }); - }); - }, - }, - ], - }, - ]; - t.role == "checkpoint" && - (j = [ - ...j, - { - name: "Switches", - options: [ - { - name: "On", - selected: t.switchesOn, - onPress: () => { - a.map((j) => { - e({ - type: "setProperty", - array: "flags", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - switchesOn: true, - }), - }); - }); - }, - }, - { - name: "Off", - selected: !t.switchesOn, - onPress: () => { - a.map((j) => { - e({ - type: "setProperty", - array: "flags", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - switchesOn: false, - }), - }); - }); - }, - }, - ], - }, - { - name: "Speed", - options: [ - { - name: "Keep", - selected: t.retainSpeed, - onPress: () => { - a.map((j) => { - e({ - type: "setProperty", - array: "flags", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - retainSpeed: true, - }), - }); - }); - }, - }, - { - name: "Reset", - selected: !t.retainSpeed, - onPress: () => { - a.map((j) => { - e({ - type: "setProperty", - array: "flags", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - retainSpeed: false, - }), - }); - }); - }, - }, - ], }, - ]); - j.push({ - name: "Shape", - options: [ { - name: "Normal", - selected: !t.isFlying, + name: "Right", + selected: "right" === t.initPosition, onPress: () => { - a.map((j) => { + i.map((j) => { e({ type: "setProperty", - array: "flags", + array: "switchPlatforms", index: j, set: (e) => Object.assign(Object.assign({}, e), { - isFlying: false, + initPosition: "right", + rotation: 0, }), }); }); }, }, + ], + }, + { + name: "Direction", + options: [ { - name: "Flying", - selected: t.isFlying, + name: "Up", + selected: 0 === t.direction, onPress: () => { - a.map((j) => { + i.map((j) => { e({ type: "setProperty", - array: "flags", + array: "switchPlatforms", index: j, set: (e) => Object.assign(Object.assign({}, e), { - isFlying: true, + direction: 0, }), }); }); }, }, - ], - }); - return j; - })(e, t, i); - case "powerup": - return (function (e, t, a, i) { - const n = [], - l = []; - return ( - a.includes("doubleJump") && - n.push({ - name: "Double Jump", - selected: "doubleJump" === t.item, + { + name: "Left", + selected: 270 === t.direction, onPress: () => { i.map((j) => { e({ type: "setProperty", - array: "powerups", + array: "switchPlatforms", index: j, set: (e) => Object.assign(Object.assign({}, e), { - item: "doubleJump", + direction: 270, }), }); }); }, - }), - a.includes("gun") && - n.push({ - name: "Gun", - selected: "gun" === t.item, + }, + { + name: "Down", + selected: 180 === t.direction, onPress: () => { i.map((j) => { e({ type: "setProperty", - array: "powerups", + array: "switchPlatforms", index: j, set: (e) => Object.assign(Object.assign({}, e), { - item: "gun", + direction: 180, }), }); }); }, - }), - a.includes("jetpack") && - n.push({ - name: "Jetpack", - selected: "jetpack" === t.item, + }, + { + name: "Right", + selected: 90 === t.direction, onPress: () => { i.map((j) => { e({ type: "setProperty", - array: "powerups", + array: "switchPlatforms", index: j, set: (e) => Object.assign(Object.assign({}, e), { - item: "jetpack", + direction: 90, }), }); }); }, - }), - a.includes("playerStacks") && - n.push({ - name: "Player Stack", - selected: "playerStack" === t.item, + }, + ], + }, + { + name: "Trigger", + options: [ + { + name: "Switch", + selected: "switch" === t.movementTrigger, onPress: () => { i.map((j) => { e({ type: "setProperty", - array: "powerups", + array: "switchPlatforms", index: j, set: (e) => Object.assign(Object.assign({}, e), { - item: "playerStack", + movementTrigger: "switch", }), }); }); }, - }), - a.includes("skateboard") && - n.push({ - name: "Skateboard", - selected: "skateboard" === t.item, + }, + { + name: "Jump", + selected: "jump" === t.movementTrigger, onPress: () => { i.map((j) => { e({ type: "setProperty", - array: "powerups", + array: "switchPlatforms", index: j, set: (e) => Object.assign(Object.assign({}, e), { - item: "skateboard", + movementTrigger: "jump", }), }); }); }, - }), - a.includes("punch") && - n.push({ - name: "Punch", - selected: "punch" === t.item, - onPress: () => { - i.map((j) => { - e({ - type: "setProperty", - array: "powerups", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - item: "punch", - }), - }); - }); - }, - }), - n.push({ - name: "Spaceship", - selected: "spaceship" === t.item, - onPress: () => { - i.map((j) => { - e({ - type: "setProperty", - array: "powerups", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - item: "spaceship", - }), - }); - }); }, - }), - /*n.push({ - name: "Drill", - selected: "drill" === t.item, - onPress: () => { - i.map((j) => { - e({ - type: "setProperty", - array: "powerups", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - item: "drill", - }), - }); - }); - }, - }), */ - /* n.push({ - name: "Ghost", - selected: "ghost" === t.item, - onPress: () => { - i.map((j) => { - e({ - type: "setProperty", - array: "powerups", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - item: "ghost", - }), - }); - }); - }, - }),*/ - ["playerStack", "punch", "skateboard"].includes(t.item) && - l.push({ - name: "On", - selected: t.compatible, - onPress: () => { - i.map((j) => { - e({ - type: "setProperty", - array: "powerups", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - compatible: true, - }), - }); - }); - }, - }), - ["playerStack", "punch", "skateboard"].includes(t.item) && - l.push({ - name: "Off", - selected: !t.compatible, - onPress: () => { - i.map((j) => { - e({ - type: "setProperty", - array: "powerups", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - compatible: false, - }), - }); - }); - }, - }), - l.length > 0 - ? [ - { name: "Item", options: n }, - { - name: "Override", - options: [ - { - name: "On", - selected: t.override, - onPress: () => { - i.map((j) => { - e({ - type: "setProperty", - array: "powerups", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - override: true, - }), - }); - }); - }, - }, - { - name: "Off", - selected: !t.override, - onPress: () => { - i.map((j) => { - e({ - type: "setProperty", - array: "powerups", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - override: false, - }), - }); - }); - }, - }, - ], - }, - { name: "Compatible? (EXPERIMENTAL)", options: l }, - ] - : [ - { name: "Item", options: n }, - { - name: "Override", - options: [ - { - name: "On", - selected: t.override, - onPress: () => { - i.map((j) => { - e({ - type: "setProperty", - array: "powerups", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - override: true, - }), - }); - }); - }, - }, - { - name: "Off", - selected: !t.override, - onPress: () => { - i.map((j) => { - e({ - type: "setProperty", - array: "powerups", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - override: false, - }), - }); - }); - }, - }, - ], - }, - ] - ); - })(e, t, a, i); - case "switchPlatform": - return (function (e, t, a) { - return [ - { - name: "Init Position", - options: [ - { - name: "Up", - selected: "up" === t.initPosition, - onPress: () => { - i.map((j) => { - e({ - type: "setProperty", - array: "switchPlatforms", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - initPosition: "up", - rotation: -90 + t.direction, - }), - }); - }); - }, - }, - { - name: "Right", - selected: "right" === t.initPosition, - onPress: () => { - i.map((j) => { - e({ - type: "setProperty", - array: "switchPlatforms", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - initPosition: "right", - rotation: 0 + t.direction, - }), - }); - }); - }, - }, - ], - }, - { - name: "Direction", - options: [ - { - name: "Up", - selected: 0 === t.direction, - onPress: () => { - i.map((j) => { - e({ - type: "setProperty", - array: "switchPlatforms", - index: j, - set: (e) => - setSwitchRotation(Object.assign(Object.assign({}, e), { - direction: 0, - })) - }); - }); - }, - }, - { - name: "Left", - selected: 270 === t.direction, - onPress: () => { - i.map((j) => { - e({ - type: "setProperty", - array: "switchPlatforms", - index: j, - set: (e) => - setSwitchRotation(Object.assign(Object.assign({}, e), { - direction: 270, - })) - }); - }); - }, - }, - { - name: "Down", - selected: 180 === t.direction, - onPress: () => { - i.map((j) => { - e({ - type: "setProperty", - array: "switchPlatforms", - index: j, - set: (e) => - setSwitchRotation(Object.assign(Object.assign({}, e), { - direction: 180, - })) - }); - }); - }, - }, - { - name: "Right", - selected: 90 === t.direction, - onPress: () => { - i.map((j) => { - e({ - type: "setProperty", - array: "switchPlatforms", - index: j, - set: (e) => - setSwitchRotation(Object.assign(Object.assign({}, e), { - direction: 90, - })) - }); - }); - }, - }, - ], - }, - { - name: "Trigger", - options: [ - { - name: "Switch", - selected: "switch" === t.movementTrigger, - onPress: () => { - i.map((j) => { - e({ - type: "setProperty", - array: "switchPlatforms", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - movementTrigger: "switch", - }), - }); - }); - }, - }, - { - name: "Jump", - selected: "jump" === t.movementTrigger, - onPress: () => { - i.map((j) => { - e({ - type: "setProperty", - array: "switchPlatforms", - index: j, - set: (e) => - Object.assign(Object.assign({}, e), { - movementTrigger: "jump", - }), - }); - }); - }, - }, - ], - }, - ]; - })(e, t, i); - } - }, - Cr = makeCustomSprite({ - render: ({ props: { onPress: e, colour: t = "black" } }) => [ - Clickable({ - id: "ClickableArrow", - width: 20, - height: 30, - sprites: (e) => [ - r({ - fillColor: t, - opacity: e ? 1 : 0.8, - path: [ - [-10, 0], - [5, 10], - [5, -10], - [-10, 0], ], - }), - ], - onPress: e, - }), - ], - }), - wr = makePureSprite({ - shouldRerender: (e, t) => - e.text !== t.text || - e.colorLeft !== t.colorLeft || - e.colorMid !== t.colorMid || - e.colorRight !== t.colorRight || - e.fontSize !== t.fontSize || - e.width !== t.width || - e.height !== t.height, - render: ({ - props: { - text: e, - colorLeft: t, - colorMid: a, - colorRight: i, - colorOpacities: s, - fontSize: o = 12, - width: r, - height: l, - }, - }) => [ + }, + ]; + })(e, t, i); + } + }, + Cr = makeCustomSprite({ + render: ({ props: { onPress: e, colour: t = "black" } }) => [ + Clickable({ + id: "ClickableArrow", + width: 20, + height: 30, + sprites: (e) => [ + r({ + fillColor: t, + opacity: e ? 1 : 0.8, + path: [ + [-10, 0], + [5, 10], + [5, -10], + [-10, 0], + ], + }), + ], + onPress: e, + }), + ], + }), + wr = makePureSprite({ + shouldRerender: (e, t) => + e.text !== t.text || + e.colorLeft !== t.colorLeft || + e.colorMid !== t.colorMid || + e.colorRight !== t.colorRight || + e.fontSize !== t.fontSize || + e.width !== t.width || + e.height !== t.height, + render: ({ + props: { + text: e, + colorLeft: t, + colorMid: a, + colorRight: i, + colorOpacities: s, + fontSize: o = 12, + width: r, + height: l, + }, + }) => [ We({ width: r, height: l, @@ -40734,27 +40709,27 @@ var version = "v1.17.2"; x: -r / 2 + 20, }), ], - }), - Ar = makeCustomSprite({ - render: ({ - props: { - selected: e, - selectedColorLeft: t, - selectedColorMid: a, - selectedColorRight: i, - colorOpacities: n, - onPress: s, - noPress: o, - colorLeft: r, - colorMid: l, - colorRight: c, - width: d, - height: u, - text: h, - fontSize: p, - }, - device: g, - }) => [ + }), + Ar = makeCustomSprite({ + render: ({ + props: { + selected: e, + selectedColorLeft: t, + selectedColorMid: a, + selectedColorRight: i, + colorOpacities: n, + onPress: s, + noPress: o, + colorLeft: r, + colorMid: l, + colorRight: c, + width: d, + height: u, + text: h, + fontSize: p, + }, + device: g, + }) => [ Clickable({ id: "Clickable", width: d, @@ -40786,298 +40761,298 @@ var version = "v1.17.2"; }, }), ], - }), - levelObjectMenu = makeCustomSprite({ - render({ - props: { - object: e, - send: t, - selectedObjectIndex: a, - features: i, - arrowMove: s, - }, - getContext, - }) { - const o = objPropsMenu( - t, - e[0], - i, - a, - getContext(Se).settings.showDebug, - ), - l = 130; - var c = Zo(e[0].type); - if (c == "BLOCK" && e[0]?.init) { - c = "SWITCH BLOCK"; - } - const d = 40 + 9 * localize(c).length; - return [ - Clickable({ - id: "LevelObjectMenuClickable", - onPress: () => null, - width: 200, - height: 260, - sprites: () => [ - r({ - fillColor: ve, - path: [ - [-100, -130], - [85, -130], - [110, -105], - [110, l], - [-75, l], - [-100, 105], - [-100, -130], - ], - y: -10, - }), - r({ - fillColor: we, - path: [ - [-100, -130], - [75, -130], - [100, -105], - [100, l], - [-75, l], - [-100, 105], - [-100, -130], - ], - }), - r({ - fillColor: ve, - path: [ - [-100, 105], - [-75, l], - [-100 + d, l], - [-100 + d, 95], - [-100, 95], - [-100, 105], - ], - }), - n({ - text: localize(c), - color: Be, - font: { align: "left", size: 13 }, - x: -75, - y: 110, - }), - ScrollContainer({ - id: "ScrollContainer", - containerHeight: 225, - containerWidth: 200, - contentHeight: o.reduce( - (e, { options: t }) => e + t.length * (Pr + Mr) + xr, - 40, - ), - y: 95, - sprites: (t) => { - let a = 40; - return [ - e.length > 1 - ? null - : Nr({ - id: "XYProperties", - currX: e[0].x, - currY: e[0].y, - width: 150, - arrowMove: s, - obj: e[0], - y: -15, - }), - ...o.map((e, i) => { - const n = -a; - return ( - (a += e.options.length * (Pr + Mr) + xr), - Lr({ - id: `PropertySelector-${i}`, - property: e, - y: n, - width: 150, - noPress: t, - }) - ); + }), + levelObjectMenu = makeCustomSprite({ + render({ + props: { + object: e, + send: t, + selectedObjectIndex: a, + features: i, + arrowMove: s, + }, + getContext, + }) { + const o = objPropsMenu( + t, + e[0], + i, + a, + getContext(Se).settings.showDebug, + ), + l = 130; + var c = Zo(e[0].type); + if (c == "BLOCK" && e[0]?.init) { + c = "SWITCH BLOCK"; + } + const d = 40 + 9 * localize(c).length; + return [ + Clickable({ + id: "LevelObjectMenuClickable", + onPress: () => null, + width: 200, + height: 260, + sprites: () => [ + r({ + fillColor: ve, + path: [ + [-100, -130], + [85, -130], + [110, -105], + [110, l], + [-75, l], + [-100, 105], + [-100, -130], + ], + y: -10, + }), + r({ + fillColor: we, + path: [ + [-100, -130], + [75, -130], + [100, -105], + [100, l], + [-75, l], + [-100, 105], + [-100, -130], + ], + }), + r({ + fillColor: ve, + path: [ + [-100, 105], + [-75, l], + [-100 + d, l], + [-100 + d, 95], + [-100, 95], + [-100, 105], + ], + }), + n({ + text: localize(c), + color: Be, + font: { align: "left", size: 13 }, + x: -75, + y: 110, + }), + ScrollContainer({ + id: "ScrollContainer", + containerHeight: 225, + containerWidth: 200, + contentHeight: o.reduce( + (e, { options: t }) => e + t.length * (Pr + Mr) + xr, + 40, + ), + y: 95, + sprites: (t) => { + let a = 40; + return [ + e.length > 1 + ? null + : Nr({ + id: "XYProperties", + currX: e[0].x, + currY: e[0].y, + width: 150, + arrowMove: s, + obj: e[0], + y: -15, }), - ]; - }, - }), - ], - }), - ]; - }, - }), - Nr = makeCustomSprite({ - render({ - props: { currX: e, currY: t, width: a, arrowMove: i, obj: obj }, - }) { - const s = -a / 4 - 10, - o = a / 4 + 10, - r = !["directionChange", "flag"].includes(obj.type) - ? [ - Cr({ - id: "ArrowLeft", - x: s - 35, - colour: Be, - onPress: () => { - i(-1, 0); - }, - }), - Cr({ - id: "ArrowRight", - x: s + 35, - rotation: 180, - colour: Be, - onPress: () => { - i(1, 0); - }, - }), - Cr({ - id: "ArrowUp", - x: o - 35, - y: -2.5, - rotation: 90, - colour: Be, - onPress: () => { - i(0, 1); - }, - }), - Cr({ - id: "ArrowDown", - x: o + 35, - y: 2.5, - rotation: -90, - colour: Be, - onPress: () => { - i(0, -1); - }, - }), - ] - : [ - Cr({ - id: "ArrowUp", - x: o - 35, - y: -2.5, - rotation: 90, - colour: Be, - onPress: () => { - i(0, 1); - }, - }), - Cr({ - id: "ArrowDown", - x: o + 35, - y: 2.5, - rotation: -90, - colour: Be, - onPress: () => { - i(0, -1); - }, - }), - ]; - return [ - n({ text: `X: ${e}`, color: Be, x: s, font: { weight: 500 } }), - n({ text: `Y: ${t}`, color: Be, x: o, font: { weight: 500 } }), - ...r, - ]; - }, - }), - xr = 30, - Pr = 30, - Mr = 5, - Lr = makeCustomSprite({ - render: ({ props: { property: e, width: t, noPress: a } }) => [ - n({ + ...o.map((e, i) => { + const n = -a; + return ( + (a += e.options.length * (Pr + Mr) + xr), + Lr({ + id: `PropertySelector-${i}`, + property: e, + y: n, + width: 150, + noPress: t, + }) + ); + }), + ]; + }, + }), + ], + }), + ]; + }, + }), + Nr = makeCustomSprite({ + render({ + props: { currX: e, currY: t, width: a, arrowMove: i, obj: obj }, + }) { + const s = -a / 4 - 10, + o = a / 4 + 10, + r = !["directionChange", "flag"].includes(obj.type) + ? [ + Cr({ + id: "ArrowLeft", + x: s - 35, + colour: Be, + onPress: () => { + i(-1, 0); + }, + }), + Cr({ + id: "ArrowRight", + x: s + 35, + rotation: 180, + colour: Be, + onPress: () => { + i(1, 0); + }, + }), + Cr({ + id: "ArrowUp", + x: o - 35, + y: -2.5, + rotation: 90, + colour: Be, + onPress: () => { + i(0, 1); + }, + }), + Cr({ + id: "ArrowDown", + x: o + 35, + y: 2.5, + rotation: -90, + colour: Be, + onPress: () => { + i(0, -1); + }, + }), + ] + : [ + Cr({ + id: "ArrowUp", + x: o - 35, + y: -2.5, + rotation: 90, + colour: Be, + onPress: () => { + i(0, 1); + }, + }), + Cr({ + id: "ArrowDown", + x: o + 35, + y: 2.5, + rotation: -90, + colour: Be, + onPress: () => { + i(0, -1); + }, + }), + ]; + return [ + n({ text: `X: ${e}`, color: Be, x: s, font: { weight: 500 } }), + n({ text: `Y: ${t}`, color: Be, x: o, font: { weight: 500 } }), + ...r, + ]; + }, + }), + xr = 30, + Pr = 30, + Mr = 5, + Lr = makeCustomSprite({ + render: ({ props: { property: e, width: t, noPress: a } }) => [ + n({ + text: localize(e.name).toLocaleUpperCase(), + color: Be, + x: -t / 2 + 5, + font: { align: "left", weight: 800 }, + }), + ...e.options.map((e, i) => + Ar({ + id: `Option-${i}`, text: localize(e.name).toLocaleUpperCase(), - color: Be, - x: -t / 2 + 5, - font: { align: "left", weight: 800 }, + width: t, + height: Pr, + y: -i * (Pr + Mr) - xr, + noPress: a, + selected: e.selected, + colorLeft: xe, + colorMid: xe, + colorRight: Ue, + selectedColorLeft: Re, + selectedColorMid: Re, + selectedColorRight: Ue, + onPress: e.onPress, }), - ...e.options.map((e, i) => - Ar({ - id: `Option-${i}`, - text: localize(e.name).toLocaleUpperCase(), - width: t, - height: Pr, - y: -i * (Pr + Mr) - xr, - noPress: a, - selected: e.selected, - colorLeft: xe, - colorMid: xe, - colorRight: Ue, - selectedColorLeft: Re, - selectedColorMid: Re, - selectedColorRight: Ue, - onPress: e.onPress, - }), - ), - ], - }), - Dr = makePureSprite({ - shouldRerender: (e, t) => - e.waveformData !== t.waveformData || - e.startFrame !== t.startFrame || - e.direction !== t.direction || - e.waveformLengthInBeats !== t.waveformLengthInBeats || - e.speedMultiplier !== t.speedMultiplier, - render({ props: e }) { - const { waveformData: t, waveformLengthInBeats: a, width: n } = e; - if (!t) return []; - const s = e.startFrame * (1 / 60), - o = 0.78125, - r = t.sample_rate / t.samples_per_pixel, - l = r / ((e.song.bpm * (e.speedMultiplier || 1)) / 60), - c = 4 * Math.floor((s * r) / 2), - d = a ? Math.min(c + l * a * 2, 2 * t.length) : 2 * t.length; - let u = G.jumpDistance / l / 2, - h = 1; - n && ((h = Math.floor(d / n / 2)), (u = n / d)); - const p = []; - for (let a = c; a < d; a += 2 * h) { - const [i, n] = t.data.slice(a, a + 2), - s = (a - c) * u * e.direction; - p.push({ - x: s, - yBottom: o * Math.min(i, -1), - yTop: o * Math.max(n, 1), - }); - } - return [ - ((g = { - props: p.map(({ x: e, yTop: t, yBottom: a }) => ({ - width: 2 * u * h, - height: t - a, - color: Be, - opacity: 0.8, - x: e, - y: (t + a) / 2, - })), - }), - { - type: "rectangleArray", - mask: g.mask || null, - props: g.props.map((e) => - i( - { - testId: e.testId, - width: e.width, - height: e.height, - color: e.color, - }, - e, - ), + ), + ], + }), + Dr = makePureSprite({ + shouldRerender: (e, t) => + e.waveformData !== t.waveformData || + e.startFrame !== t.startFrame || + e.direction !== t.direction || + e.waveformLengthInBeats !== t.waveformLengthInBeats || + e.speedMultiplier !== t.speedMultiplier, + render({ props: e }) { + const { waveformData: t, waveformLengthInBeats: a, width: n } = e; + if (!t) return []; + const s = e.startFrame * (1 / 60), + o = 0.78125, + r = t.sample_rate / t.samples_per_pixel, + l = r / ((e.song.bpm * (e.speedMultiplier || 1)) / 60), + c = 4 * Math.floor((s * r) / 2), + d = a ? Math.min(c + l * a * 2, 2 * t.length) : 2 * t.length; + let u = G.jumpDistance / l / 2, + h = 1; + n && ((h = Math.floor(d / n / 2)), (u = n / d)); + const p = []; + for (let a = c; a < d; a += 2 * h) { + const [i, n] = t.data.slice(a, a + 2), + s = (a - c) * u * e.direction; + p.push({ + x: s, + yBottom: o * Math.min(i, -1), + yTop: o * Math.max(n, 1), + }); + } + return [ + ((g = { + props: p.map(({ x: e, yTop: t, yBottom: a }) => ({ + width: 2 * u * h, + height: t - a, + color: Be, + opacity: 0.8, + x: e, + y: (t + a) / 2, + })), + }), + { + type: "rectangleArray", + mask: g.mask || null, + props: g.props.map((e) => + i( + { + testId: e.testId, + width: e.width, + height: e.height, + color: e.color, + }, + e, ), - }), - ]; - var g; - }, - }), - BlockProjection = makePureSprite({ - shouldRerender: (e, t) => - e.levelSpeeds.jumpFrames !== t.levelSpeeds.jumpFrames || - e.playerSpeedMultiplier !== t.playerSpeedMultiplier || - e.playerScale !== t.playerScale, - render: ({ - props: { levelSpeeds: e, playerSpeedMultiplier, playerScale }, - }) => [ + ), + }), + ]; + var g; + }, + }), + BlockProjection = makePureSprite({ + shouldRerender: (e, t) => + e.levelSpeeds.jumpFrames !== t.levelSpeeds.jumpFrames || + e.playerSpeedMultiplier !== t.playerSpeedMultiplier || + e.playerScale !== t.playerScale, + render: ({ + props: { levelSpeeds: e, playerSpeedMultiplier, playerScale }, + }) => [ SingleBlockProjection({ id: "SingleProjection", levelSpeeds: e, @@ -41092,61 +41067,61 @@ var version = "v1.17.2"; playerScale: playerScale, }), ], - }), - SingleBlockProjection = makePureSprite({ - shouldRerender: () => true, - render({ - props: { - levelSpeeds: { - speed: speed, - jumpFrames: jumpFrames, - coefficients: { a, b }, - }, - playerSpeedMultiplier, - playerScale, + }), + SingleBlockProjection = makePureSprite({ + shouldRerender: () => true, + render({ + props: { + levelSpeeds: { + speed: speed, + jumpFrames: jumpFrames, + coefficients: { a, b }, }, - }) { - const dots = []; - let gradY = G.initGrad(b, playerScale === 1 ? 1 : 0.75), - y = -30 + 15 + 15 * playerScale, - x = 0; - dots.push({ x: x, y: y, color: Te }); - // jumping - for (let i = 0; i < 1.5 * jumpFrames; i++) - (({ y: y, gradY: gradY } = G.stepY(y, gradY, a, 1, 1)), - (x += speed * playerSpeedMultiplier), - dots.push({ x: x, y: y, color: Te })); + playerSpeedMultiplier, + playerScale, + }, + }) { + const dots = []; + let gradY = G.initGrad(b, playerScale === 1 ? 1 : 0.75), + y = -30 + 15 + 15 * playerScale, + x = 0; + dots.push({ x: x, y: y, color: Te }); + // jumping + for (let i = 0; i < 1.5 * jumpFrames; i++) + (({ y: y, gradY: gradY } = G.stepY(y, gradY, a, 1, 1)), + (x += speed * playerSpeedMultiplier), + dots.push({ x: x, y: y, color: Te })); - // falling - ((gradY = 0), - (y = -30 + 15 + 15 * playerScale), - (x = 15 + 15 * playerScale - speed * playerSpeedMultiplier)); - dots.push({ x: x, y: y, color: Re }); - for (let i = 0; i < 1.5 * jumpFrames; i++) - (({ y: y, gradY: gradY } = G.stepY(y, gradY, a, 1, 1)), - (x += speed * playerSpeedMultiplier), - dots.push({ x: x, y: y, color: Re })); - return dots.map(({ x, y, color }) => - s({ radius: 2, color: color, x: x, y: y, opacity: 0.3 }), - ); + // falling + ((gradY = 0), + (y = -30 + 15 + 15 * playerScale), + (x = 15 + 15 * playerScale - speed * playerSpeedMultiplier)); + dots.push({ x: x, y: y, color: Re }); + for (let i = 0; i < 1.5 * jumpFrames; i++) + (({ y: y, gradY: gradY } = G.stepY(y, gradY, a, 1, 1)), + (x += speed * playerSpeedMultiplier), + dots.push({ x: x, y: y, color: Re })); + return dots.map(({ x, y, color }) => + s({ radius: 2, color: color, x: x, y: y, opacity: 0.3 }), + ); + }, + }), + SpringProjection = makePureSprite({ + shouldRerender: (e, t) => + e.levelSpeeds.jumpFrames !== t.levelSpeeds.jumpFrames || + e.playerSpeedMultiplier !== t.playerSpeedMultiplier || + e.playerScale !== t.playerScale || + e.playerGradY !== t.playerGradY || + e.direction !== t.direction, + render: ({ + props: { + levelSpeeds: e, + playerSpeedMultiplier, + playerScale, + playerGradY, + direction, }, - }), - SpringProjection = makePureSprite({ - shouldRerender: (e, t) => - e.levelSpeeds.jumpFrames !== t.levelSpeeds.jumpFrames || - e.playerSpeedMultiplier !== t.playerSpeedMultiplier || - e.playerScale !== t.playerScale || - e.playerGradY !== t.playerGradY || - e.direction !== t.direction, - render: ({ - props: { - levelSpeeds: e, - playerSpeedMultiplier, - playerScale, - playerGradY, - direction, - }, - }) => [ + }) => [ SingleSpringProjection({ id: "SingleProjection", levelSpeeds: e, @@ -41165,6843 +41140,7589 @@ var version = "v1.17.2"; direction: direction, }), ], - }), - SingleSpringProjection = makePureSprite({ - shouldRerender: () => true, - render({ - props: { - levelSpeeds: { - speed: speed, - jumpFrames: jumpFrames, - coefficients: { a, b }, - }, - playerSpeedMultiplier, - playerScale, - playerGradY, - direction: dir, + }), + SingleSpringProjection = makePureSprite({ + shouldRerender: () => true, + render({ + props: { + levelSpeeds: { + speed: speed, + jumpFrames: jumpFrames, + coefficients: { a, b }, }, - }) { - const dots = []; - let gradY = - G.initGrad(b, playerScale === 1 ? 1 : 0.75) * - (dir > 0 ? 1.5 : -1), - y = 0, - x = 0; + playerSpeedMultiplier, + playerScale, + playerGradY, + direction: dir, + }, + }) { + const dots = []; + let gradY = + G.initGrad(b, playerScale === 1 ? 1 : 0.75) * + (dir > 0 ? 1.5 : -1), + y = 0, + x = 0; + dots.push({ x: x, y: y, color: Te }); + // low jump + for (let i = 0; i < 2 * jumpFrames; i++) + (({ y: y, gradY: gradY } = G.stepY(y, gradY, a, 1, 1)), + (x += speed * playerSpeedMultiplier), + dots.push({ x: x, y: y, color: Te })); + + // current grad y jump + /* + (dir > 0 + ? Math.max(1.5 * G.initGrad(b, playerScale === 1 ? 1 : 0.75), Math.abs(playerGradY)) + : -Math.min(1 * G.initGrad(b, playerScale === 1 ? 1 : 0.75), -playerGradY)) * + dir + */ + gradY = + dir > 0 + ? Math.max( + 1.5 * G.initGrad(b, playerScale === 1 ? 1 : 0.75), + Math.abs(playerGradY), + ) + : -Math.min( + 1 * G.initGrad(b, playerScale === 1 ? 1 : 0.75), + -Math.abs(playerGradY), + ) * dir; + if (playerGradY != gradY) { + ((y = 0), (x = 0)); dots.push({ x: x, y: y, color: Te }); // low jump - for (let i = 0; i < 2 * jumpFrames; i++) + for (let i = 0; i < 3 * jumpFrames; i++) (({ y: y, gradY: gradY } = G.stepY(y, gradY, a, 1, 1)), (x += speed * playerSpeedMultiplier), - dots.push({ x: x, y: y, color: Te })); - - // current grad y jump - /* - (dir > 0 - ? Math.max(1.5 * G.initGrad(b, playerScale === 1 ? 1 : 0.75), Math.abs(playerGradY)) - : -Math.min(1 * G.initGrad(b, playerScale === 1 ? 1 : 0.75), -playerGradY)) * - dir - */ - gradY = - dir > 0 - ? Math.max( - 1.5 * G.initGrad(b, playerScale === 1 ? 1 : 0.75), - Math.abs(playerGradY), - ) - : -Math.min( - 1 * G.initGrad(b, playerScale === 1 ? 1 : 0.75), - -Math.abs(playerGradY), - ) * dir; - if (playerGradY != gradY) { - ((y = 0), (x = 0)); - dots.push({ x: x, y: y, color: Te }); - // low jump - for (let i = 0; i < 3 * jumpFrames; i++) - (({ y: y, gradY: gradY } = G.stepY(y, gradY, a, 1, 1)), - (x += speed * playerSpeedMultiplier), - dots.push({ x: x, y: y, color: Re })); - } - return dots.map(({ x, y, color }) => - s({ radius: 2, color: color, x: x, y: y, opacity: 0.3 }), - ); - }, - }); - var Yr = a(840), - Ur = a.n(Yr); - const PinchRecogniser = makeNativeSprite("PinchRecogniser"), - Gr = { - create: ({ props: e, getState: t }) => { - const a = document.getElementById("replay-canvas"), - i = new (Ur().Manager)(a), - n = new (Ur().Pinch)(); - return ( - i.add([n]), - i.on("pinchstart", () => { - e.startPinch(); - }), - i.on("pinchend", (a) => { - const i = t(), - n = Math.max(Math.min(cr, a.scale * i.initScale), dr); - ((i.initScale = n), e.endPinch()); - }), - i.on("pinch", (e) => { - const { initScale: a, didPinch: i } = t(); - i(Math.max(Math.min(cr, e.scale * a), dr)); - }), - { - initScale: e.initScale, - didPinch: e.didPinch, - cleanup: () => { - i.destroy(); - }, - } - ); - }, - loop: ({ state: e, props: t }) => { - e.didPinch = t.didPinch; - }, - cleanup: ({ state: e }) => { - e.cleanup(); - }, - }, - Vr = M, - Hr = (e, t, a, i) => { - const { x: n, y: s } = V( - { x: e.x / e.scale, y: e.y / e.scale }, - { x: M, y: M }, - ), - o = []; - for (let i = -15; i <= t / e.scale / 2 + Vr; i += Vr) { - const t = i - n, - r = -i - n, - l = -s, - c = a / e.scale / 2 + Vr; - (o.push([t, l - c]), - o.push([t, l + c]), - o.push([r, l + c]), - o.push([r, l - c])); - } - const r = []; - for (let i = -15; i <= a / e.scale / 2 + Vr; i += Vr) { - const a = -n, - o = t / e.scale / 2 + Vr, - l = i - s, - c = -i - s; - (r.push([a - o, l]), - r.push([a + o, l]), - r.push([a + o, c]), - r.push([a - o, c])); + dots.push({ x: x, y: y, color: Re })); } - const { x: l, y: c } = V( - { x: e.x / e.scale, y: e.y / e.scale }, - { x: G.jumpDistance, y: i }, - ), - d = [], - u = (function (e, t, a) { - const i = Array.from({ length: Math.ceil(e / 12) }), - n = i.flatMap((e, i) => { - const n = i % 2 == 0 ? 1 : -1, - s = 12 * i; - return [ - [t + 5 * n, a + s], - [t - 5 * n, a + (s + 12)], - ]; - }), - s = i.flatMap((e, i) => { - const n = i % 2 == 0 ? 1 : -1, - s = 12 * -i; - return [ - [t + 5 * n, a + s], - [t - 5 * n, a + (s - 12)], - ]; - }); - return [...n.reverse(), ...s]; - })(i, 15 - l, -c); - for ( - let a = 0; - a <= (t + G.jumpDistance) / e.scale / 2; - a += G.jumpDistance - ) - if (0 === a) d.push(...u); - else { - const e = u.map(([e, t]) => [e - a, t]), - t = u.map(([e, t]) => [e + a, t]); - (d.push(...e.reverse()), d.push(...t)); + return dots.map(({ x, y, color }) => + s({ radius: 2, color: color, x: x, y: y, opacity: 0.3 }), + ); + }, + }); + var Yr = a(840), + Ur = a.n(Yr); + const PinchRecogniser = makeNativeSprite("PinchRecogniser"), + Gr = { + create: ({ props: e, getState: t }) => { + const a = document.getElementById("replay-canvas"), + i = new (Ur().Manager)(a), + n = new (Ur().Pinch)(); + return ( + i.add([n]), + i.on("pinchstart", () => { + e.startPinch(); + }), + i.on("pinchend", (a) => { + const i = t(), + n = Math.max(Math.min(cr, a.scale * i.initScale), dr); + ((i.initScale = n), e.endPinch()); + }), + i.on("pinch", (e) => { + const { initScale: a, didPinch: i } = t(); + i(Math.max(Math.min(cr, e.scale * a), dr)); + }), + { + initScale: e.initScale, + didPinch: e.didPinch, + cleanup: () => { + i.destroy(); + }, } - return { gridLinesVert: o, gridLinesHoriz: r, beatLines: d }; + ); }, - GridLines = makeSprite({ - init({ props: e, device: t }) { - const a = - t.size.fullHeight / e.parentOffset.scale + 2 * G.jumpDistance, - { - gridLinesVert: i, - gridLinesHoriz: n, - beatLines: s, - } = Hr(e.parentOffset, t.size.fullWidth, t.size.fullHeight, a); - return { - beatHeight: a, + loop: ({ state: e, props: t }) => { + e.didPinch = t.didPinch; + }, + cleanup: ({ state: e }) => { + e.cleanup(); + }, + }, + Vr = M, + Hr = (e, t, a, i) => { + const { x: n, y: s } = V( + { x: e.x / e.scale, y: e.y / e.scale }, + { x: M, y: M }, + ), + o = []; + for (let i = -15; i <= t / e.scale / 2 + Vr; i += Vr) { + const t = i - n, + r = -i - n, + l = -s, + c = a / e.scale / 2 + Vr; + (o.push([t, l - c]), + o.push([t, l + c]), + o.push([r, l + c]), + o.push([r, l - c])); + } + const r = []; + for (let i = -15; i <= a / e.scale / 2 + Vr; i += Vr) { + const a = -n, + o = t / e.scale / 2 + Vr, + l = i - s, + c = -i - s; + (r.push([a - o, l]), + r.push([a + o, l]), + r.push([a + o, c]), + r.push([a - o, c])); + } + const { x: l, y: c } = V( + { x: e.x / e.scale, y: e.y / e.scale }, + { x: G.jumpDistance, y: i }, + ), + d = [], + u = (function (e, t, a) { + const i = Array.from({ length: Math.ceil(e / 12) }), + n = i.flatMap((e, i) => { + const n = i % 2 == 0 ? 1 : -1, + s = 12 * i; + return [ + [t + 5 * n, a + s], + [t - 5 * n, a + (s + 12)], + ]; + }), + s = i.flatMap((e, i) => { + const n = i % 2 == 0 ? 1 : -1, + s = 12 * -i; + return [ + [t + 5 * n, a + s], + [t - 5 * n, a + (s - 12)], + ]; + }); + return [...n.reverse(), ...s]; + })(i, 15 - l, -c); + for ( + let a = 0; + a <= (t + G.jumpDistance) / e.scale / 2; + a += G.jumpDistance + ) + if (0 === a) d.push(...u); + else { + const e = u.map(([e, t]) => [e - a, t]), + t = u.map(([e, t]) => [e + a, t]); + (d.push(...e.reverse()), d.push(...t)); + } + return { gridLinesVert: o, gridLinesHoriz: r, beatLines: d }; + }, + GridLines = makeSprite({ + init({ props: e, device: t }) { + const a = + t.size.fullHeight / e.parentOffset.scale + 2 * G.jumpDistance, + { gridLinesVert: i, gridLinesHoriz: n, beatLines: s, - parentOffset: e.parentOffset, - fullWidth: t.size.fullWidth, - fullHeight: t.size.fullHeight, - }; - }, - loop({ props: e, state: t, device: a }) { - if ( - e.parentOffset.x !== t.parentOffset.x || - e.parentOffset.y !== t.parentOffset.y || - e.parentOffset.scale !== t.parentOffset.scale || - a.size.fullWidth !== t.fullWidth || - a.size.fullHeight !== t.fullHeight - ) { - t.parentOffset = e.parentOffset; - const i = - a.size.fullHeight / e.parentOffset.scale + - 2 * G.jumpDistance, - { - gridLinesVert: n, - gridLinesHoriz: s, - beatLines: o, - } = Hr( - e.parentOffset, - a.size.fullWidth, - a.size.fullHeight, - i, - ); - ((t.gridLinesVert = n), - (t.gridLinesHoriz = s), - (t.beatLines = o), - (t.fullHeight = a.size.fullHeight), - (t.fullWidth = a.size.fullWidth)); - } - }, - render: ({ state: e, device: a }) => [ - m({ color: "#394764", thickness: 1, opacity: 0.8 }, (t) => { - t.path = e.gridLinesHoriz; - }), - m({ color: "#394764", thickness: 1, opacity: 0.8 }, (t) => { - t.path = e.gridLinesVert; - }), - /*p({ - color: "black", - width: 30 * e.parentOffset.scale, - height: a.size.fullHeight / e.parentOffset.scale, - y: -e.parentOffset.y / e.parentOffset.scale, - }, (i) => { - i.width = 30 * e.parentOffset.scale; - i.height = a.size.fullHeight / e.parentOffset.scale; - i.y = -e.parentOffset.y / e.parentOffset.scale; - }),*/ - m({ color: Ye, thickness: 2, opacity: 0.8 }, (t) => { - t.path = e.beatLines; - }), + } = Hr(e.parentOffset, t.size.fullWidth, t.size.fullHeight, a); + return { + beatHeight: a, + gridLinesVert: i, + gridLinesHoriz: n, + beatLines: s, + parentOffset: e.parentOffset, + fullWidth: t.size.fullWidth, + fullHeight: t.size.fullHeight, + }; + }, + loop({ props: e, state: t, device: a }) { + if ( + e.parentOffset.x !== t.parentOffset.x || + e.parentOffset.y !== t.parentOffset.y || + e.parentOffset.scale !== t.parentOffset.scale || + a.size.fullWidth !== t.fullWidth || + a.size.fullHeight !== t.fullHeight + ) { + t.parentOffset = e.parentOffset; + const i = + a.size.fullHeight / e.parentOffset.scale + + 2 * G.jumpDistance, + { + gridLinesVert: n, + gridLinesHoriz: s, + beatLines: o, + } = Hr( + e.parentOffset, + a.size.fullWidth, + a.size.fullHeight, + i, + ); + ((t.gridLinesVert = n), + (t.gridLinesHoriz = s), + (t.beatLines = o), + (t.fullHeight = a.size.fullHeight), + (t.fullWidth = a.size.fullWidth)); + } + }, + render: ({ state: e, device: a }) => [ + m({ color: "#394764", thickness: 1, opacity: 0.8 }, (t) => { + t.path = e.gridLinesHoriz; + }), + m({ color: "#394764", thickness: 1, opacity: 0.8 }, (t) => { + t.path = e.gridLinesVert; + }), + /*p({ + color: "black", + width: 30 * e.parentOffset.scale, + height: a.size.fullHeight / e.parentOffset.scale, + y: -e.parentOffset.y / e.parentOffset.scale, + }, (i) => { + i.width = 30 * e.parentOffset.scale; + i.height = a.size.fullHeight / e.parentOffset.scale; + i.y = -e.parentOffset.y / e.parentOffset.scale; + }),*/ + m({ color: Ye, thickness: 2, opacity: 0.8 }, (t) => { + t.path = e.beatLines; + }), + ], + }), + zr = makeCustomSprite({ + init: ({ props: e }) => ({ + selectedTool: { type: "pointer" }, + selectedObjects: [], + justPlacedObject: null, + dragStart: null, + dragSelectPos: null, + isDraggingSelected: false, + isPinching: false, + lastTwoTaps: [ + [0, 0], + [0, 0], ], + didMoveView: false, + isMultiTouching: false, + pointerReleasedAfterSelectingObject: true, + toolsMenuView: "closed", + levelSpeeds: _r(e.level), + canMoveSelectedObjects: false, + frame: 0, }), - zr = makeCustomSprite({ - init: ({ props: e }) => ({ - selectedTool: { type: "pointer" }, - selectedObjects: [], - justPlacedObject: null, - dragStart: null, - dragSelectPos: null, - isDraggingSelected: false, - isPinching: false, - lastTwoTaps: [ - [0, 0], - [0, 0], - ], - didMoveView: false, - isMultiTouching: false, - pointerReleasedAfterSelectingObject: true, - toolsMenuView: "closed", - levelSpeeds: _r(e.level), - canMoveSelectedObjects: false, - frame: 0, - }), - loop({ - props: e, - state: t, - device: a, - getInputs: i, - updateState: n, - getContext: s, - }) { - const { addToOnPressQueue: o } = s(Se), - r = i(), - { pointer: pointer } = r, - { - send: c, - settings: { viewOffset: d }, - setSettings: u, - setHistoryIndex: h, - level: { layout: p }, - } = e; - let { - selectedObjects: slctedObjs, - pointerReleasedAfterSelectingObject: m, - justPlacedObject: f, - dragStart: dragStart, - dragSelectPos: dragSelectPos, - isDraggingSelected: b, - lastTwoTaps: S, - didMoveView: I, - isMultiTouching: isMultiTouching, - canMoveSelectedObjects: v, - selectedTool: T, - toolsMenuView: toolsMenuView, - } = t; - const O = a.size.width + 2 * a.size.widthMargin, - C = { - x: (pointer.x - d.x) / d.scale, - y: (pointer.y - d.y) / d.scale, - }; - let newViewOffset = Object.assign({}, d); - (r.keysDown.a && (newViewOffset.x += (1 / d.scale) * 10)); - (r.keysDown.d && !(r.keysDown.Control || r.keysDown.Meta) && (newViewOffset.x -= (1 / d.scale) * 10)); - u({ viewOffset: newViewOffset }); - (r.keysJustPressed["="] && - (r.keysDown.Control || r.keysDown.Meta) && - u({ viewOffset: zoomIn(d) }), - r.keysJustPressed["-"] && - (r.keysDown.Control || r.keysDown.Meta) && - u({ viewOffset: zoomOut(d) }), - r.keysJustPressed[1] && - ((toolsMenuView = "closed"), (T = { type: "pointer" })), - r.keysJustPressed[2] && - ((toolsMenuView = "closed"), (T = { type: "selectDrag" })), - r.keysJustPressed[3] && (toolsMenuView = "objects"), - r.keysJustPressed[4] && - ((toolsMenuView = "closed"), (T = { type: "erase" })), - r.keysJustPressed[6] && (toolsMenuView = "theme"), - r.keysJustPressed.b && - ((toolsMenuView = "closed"), - (T = { type: "placeLevelObject", object: $.newBlock() })), - r.keysJustPressed["b"] && - (r.keysDown.Control || r.keysDown.Meta) && - ((toolsMenuView = "closed"), - (T = { type: "placeLevelObject", object: $.newMiniBlock() })), - r.keysJustPressed["s"] && - ((toolsMenuView = "closed"), - (T = { type: "placeLevelObject", object: $.newSpike() })), - r.keysJustPressed.s && - (r.keysDown.Control || r.keysDown.Meta) && - ((toolsMenuView = "closed"), - (T = { type: "placeLevelObject", object: $.newMiniSpike() })), - r.keysJustPressed.z && - (r.keysDown.Control || r.keysDown.Meta) && - ((slctedObjs = []), c({ type: "undo" }))); - const arrowDown = r.keysJustPressed.ArrowDown, - arrowUp = r.keysJustPressed.ArrowUp, - arrowLeft = r.keysJustPressed.ArrowLeft, - arrowRight = r.keysJustPressed.ArrowRight, - unitStep = r.keysDown.Shift ? 1 : 0.5; - if (arrowDown || arrowUp || arrowLeft || arrowRight) { - toolsMenuView = "closed"; - const moveHorizontal = - (arrowLeft ? -1 : arrowRight ? 1 : 0) * unitStep, - moveVertical = (arrowDown ? -1 : arrowUp ? 1 : 0) * unitStep; - Jr( - p, - slctedObjs.map((a) => { - var i, n; - const object = p[a.array][a.index]; - let o, l; - if ( - r.keysDown.Control || - (r.keysDown.Meta && - !["directionChange", "flag"].includes(object.type)) - ) - ((o = object.x + moveHorizontal), - (l = object.y + moveVertical)); - else { - const a = - Math.sign(moveHorizontal) * - ((null === (i = object.snapSize) || void 0 === i - ? void 0 - : i.x) || M), - r = - moveVertical * - ((null === (n = object.snapSize) || void 0 === n - ? void 0 - : n.y) || M); - ({ x: o, y: l } = V( - { x: object.x + a, y: object.y + r }, - object.snapSize, - )); - } - return { selectedObject: a, toX: o, toY: l }; - }), - c, + loop({ + props: e, + state: t, + device: a, + getInputs: i, + updateState: n, + getContext: s, + }) { + const { addToOnPressQueue: o } = s(Se), + r = i(), + { pointer: pointer } = r, + { + send: c, + settings: { viewOffset: d }, + setSettings: u, + setHistoryIndex: h, + level: { layout: p }, + } = e; + let { + selectedObjects: slctedObjs, + pointerReleasedAfterSelectingObject: m, + justPlacedObject: f, + dragStart: dragStart, + dragSelectPos: dragSelectPos, + isDraggingSelected: b, + lastTwoTaps: S, + didMoveView: I, + isMultiTouching: isMultiTouching, + canMoveSelectedObjects: v, + selectedTool: T, + toolsMenuView: toolsMenuView, + } = t; + const O = a.size.width + 2 * a.size.widthMargin, + C = { + x: (pointer.x - d.x) / d.scale, + y: (pointer.y - d.y) / d.scale, + }; + let newViewOffset = Object.assign({}, d); + (r.keysDown.a && (newViewOffset.x += (1 / d.scale) * 10)); + (r.keysDown.d && !(r.keysDown.Control || r.keysDown.Meta) && (newViewOffset.x -= (1 / d.scale) * 10)); + u({ viewOffset: newViewOffset }); + (r.keysJustPressed["="] && + (r.keysDown.Control || r.keysDown.Meta) && + u({ viewOffset: zoomIn(d) }), + r.keysJustPressed["-"] && + (r.keysDown.Control || r.keysDown.Meta) && + u({ viewOffset: zoomOut(d) }), + r.keysJustPressed[1] && + ((toolsMenuView = "closed"), (T = { type: "pointer" })), + r.keysJustPressed[2] && + ((toolsMenuView = "closed"), (T = { type: "selectDrag" })), + r.keysJustPressed[3] && (toolsMenuView = "objects"), + r.keysJustPressed[4] && + ((toolsMenuView = "closed"), (T = { type: "erase" })), + r.keysJustPressed[6] && (toolsMenuView = "theme"), + r.keysJustPressed.b && + ((toolsMenuView = "closed"), + (T = { type: "placeLevelObject", object: $.newBlock() })), + r.keysJustPressed["b"] && + (r.keysDown.Control || r.keysDown.Meta) && + ((toolsMenuView = "closed"), + (T = { type: "placeLevelObject", object: $.newMiniBlock() })), + r.keysJustPressed["s"] && + ((toolsMenuView = "closed"), + (T = { type: "placeLevelObject", object: $.newSpike() })), + r.keysJustPressed.s && + (r.keysDown.Control || r.keysDown.Meta) && + ((toolsMenuView = "closed"), + (T = { type: "placeLevelObject", object: $.newMiniSpike() })), + r.keysJustPressed.z && + (r.keysDown.Control || r.keysDown.Meta) && + ((slctedObjs = []), c({ type: "undo" }))); + const arrowDown = r.keysJustPressed.ArrowDown, + arrowUp = r.keysJustPressed.ArrowUp, + arrowLeft = r.keysJustPressed.ArrowLeft, + arrowRight = r.keysJustPressed.ArrowRight, + unitStep = r.keysDown.Shift ? 1 : 0.5; + if (arrowDown || arrowUp || arrowLeft || arrowRight) { + toolsMenuView = "closed"; + const moveHorizontal = + (arrowLeft ? -1 : arrowRight ? 1 : 0) * unitStep, + moveVertical = (arrowDown ? -1 : arrowUp ? 1 : 0) * unitStep; + Jr( + p, + slctedObjs.map((a) => { + var i, n; + const object = p[a.array][a.index]; + let o, l; + if ( + r.keysDown.Control || + (r.keysDown.Meta && + !["directionChange", "flag"].includes(object.type)) + ) + ((o = object.x + moveHorizontal), + (l = object.y + moveVertical)); + else { + const a = + Math.sign(moveHorizontal) * + ((null === (i = object.snapSize) || void 0 === i + ? void 0 + : i.x) || M), + r = + moveVertical * + ((null === (n = object.snapSize) || void 0 === n + ? void 0 + : n.y) || M); + ({ x: o, y: l } = V( + { x: object.x + a, y: object.y + r }, + object.snapSize, + )); + } + return { selectedObject: a, toX: o, toY: l }; + }), + c, + ); + } + if ( + (pointer.numberPressed > 1 + ? (isMultiTouching = true) + : 0 === pointer.numberPressed && (isMultiTouching = false), + pointer.justReleased && + ("pointer" === t.selectedTool.type || + "selectDrag" === t.selectedTool.type) && + !isMultiTouching) + ) { + if (!I) { + const t = e.runHistory.findIndex((e) => + be.pointInBox({ + x: e.playerX, + y: e.playerY, + width: 30, + height: 30, + })(C), ); + -1 !== t && + o(() => { + h(t); + }); } - if ( - (pointer.numberPressed > 1 - ? (isMultiTouching = true) - : 0 === pointer.numberPressed && (isMultiTouching = false), - pointer.justReleased && - ("pointer" === t.selectedTool.type || - "selectDrag" === t.selectedTool.type) && - !isMultiTouching) - ) { - if (!I) { - const t = e.runHistory.findIndex((e) => - be.pointInBox({ - x: e.playerX, - y: e.playerY, - width: 30, - height: 30, - })(C), - ); - -1 !== t && + I = false; + } + if (pointer.pressed && !t.isPinching && !isMultiTouching) + switch (t.selectedTool.type) { + case "selectDrag": + case "pointer": + pointer.justPressed && o(() => { - h(t); - }); - } - I = false; - } - if (pointer.pressed && !t.isPinching && !isMultiTouching) - switch (t.selectedTool.type) { - case "selectDrag": - case "pointer": - pointer.justPressed && - o(() => { - const e = slctedObjs.some((e) => { - return ((t = p[e.array][e.index]), + const e = slctedObjs.some((e) => { + return ((t = p[e.array][e.index]), $.getRectangles(t).map((e) => ({ x: e.x, y: e.y, width: e.width + M, height: e.height + M, }))).some((e) => be.pointInBox(e)(C)); - var t; - }); - if (((f = null), e)) - ((dragStart = { type: "dragObject", x: C.x, y: C.y }), - (slctedObjs = slctedObjs.map((e) => { - const t = p[e.array][e.index]; - return Object.assign(Object.assign({}, e), { - draggingX: t.x, - draggingY: t.y, - startDraggingX: t.x, - startDraggingY: t.y, - }); - }))); - else { - var prevObjs = slctedObjs; - slctedObjs = []; - for (const e in p) { - if ("properties" === e) continue; - const t = e, - a = p[t].findIndex((e) => - $.getRectangles(e).some((e) => - be.pointInBox(e)(C), - ), - ); - if (-1 !== a) { - const e = p[t][a]; - var want = { - array: t, - index: a, - draggingX: e.x, - draggingY: e.y, - startDraggingX: e.x, - startDraggingY: e.y, - }; - (r.keysDown.Shift - ? ((slctedObjs = prevObjs), - !slctedObjs.some( - (obj) => - JSON.stringify(obj) === - JSON.stringify(want), - ) - ? slctedObjs.push(want) - : slctedObjs.splice( - slctedObjs - .map((x) => JSON.stringify(x)) - .indexOf(JSON.stringify(want)), - 1, - )) - : (slctedObjs = [want]), - (m = false)); - } + var t; + }); + if (((f = null), e)) + ((dragStart = { type: "dragObject", x: C.x, y: C.y }), + (slctedObjs = slctedObjs.map((e) => { + const t = p[e.array][e.index]; + return Object.assign(Object.assign({}, e), { + draggingX: t.x, + draggingY: t.y, + startDraggingX: t.x, + startDraggingY: t.y, + }); + }))); + else { + var prevObjs = slctedObjs; + slctedObjs = []; + for (const e in p) { + if ("properties" === e) continue; + const t = e, + a = p[t].findIndex((e) => + $.getRectangles(e).some((e) => + be.pointInBox(e)(C), + ), + ); + if (-1 !== a) { + const e = p[t][a]; + var want = { + array: t, + index: a, + draggingX: e.x, + draggingY: e.y, + startDraggingX: e.x, + startDraggingY: e.y, + }; + (r.keysDown.Shift + ? ((slctedObjs = prevObjs), + !slctedObjs.some( + (obj) => + JSON.stringify(obj) === + JSON.stringify(want), + ) + ? slctedObjs.push(want) + : slctedObjs.splice( + slctedObjs + .map((x) => JSON.stringify(x)) + .indexOf(JSON.stringify(want)), + 1, + )) + : (slctedObjs = [want]), + (m = false)); } - dragStart = - 0 === slctedObjs.length - ? "pointer" !== t.selectedTool.type || - r.keysDown.Shift - ? { type: "dragSelect", x: C.x, y: C.y } - : { - type: "view", - x: pointer.x - d.x, - y: pointer.y - d.y, - } - : { type: "dragObject", x: C.x, y: C.y }; } + dragStart = + 0 === slctedObjs.length + ? "pointer" !== t.selectedTool.type || + r.keysDown.Shift + ? { type: "dragSelect", x: C.x, y: C.y } + : { + type: "view", + x: pointer.x - d.x, + y: pointer.y - d.y, + } + : { type: "dragObject", x: C.x, y: C.y }; + } + n((e) => + Object.assign(Object.assign({}, e), { + selectedObjects: slctedObjs, + dragStart: dragStart, + justPlacedObject: f, + pointerReleasedAfterSelectingObject: m, + }), + ); + }); + break; + case "erase": + pointer.justPressed + ? (dragStart = { type: "erase", x: C.x, y: C.y }) + : "erase" === + (null == dragStart ? void 0 : dragStart.type) && + (Math.abs(C.x - dragStart.x) > 5 || + Math.abs(C.y - dragStart.y) > 5) && + (Kr(p, C, o, a, c), (slctedObjs = [])); + break; + case "placeLevelObject": { + const e = V( + $.updateXY(t.selectedTool.object, C.x, C.y), + t.selectedTool.object.snapSize, + ), + i = $.updateXY(t.selectedTool.object, e.x, e.y); + Da.canPlaceLevelObject(p, i) && + o(() => { + (a + .audio("audio/editor/place.wav") + .play({ overwrite: true }), + c({ + type: "placeObjects", + objects: [ + { + array: i.array, + levelObject: i, + atIndex: p[i.array].length, + }, + ], + }), n((e) => Object.assign(Object.assign({}, e), { - selectedObjects: slctedObjs, - dragStart: dragStart, - justPlacedObject: f, - pointerReleasedAfterSelectingObject: m, - }), - ); - }); - break; - case "erase": - pointer.justPressed - ? (dragStart = { type: "erase", x: C.x, y: C.y }) - : "erase" === - (null == dragStart ? void 0 : dragStart.type) && - (Math.abs(C.x - dragStart.x) > 5 || - Math.abs(C.y - dragStart.y) > 5) && - (Kr(p, C, o, a, c), (slctedObjs = [])); - break; - case "placeLevelObject": { - const e = V( - $.updateXY(t.selectedTool.object, C.x, C.y), - t.selectedTool.object.snapSize, - ), - i = $.updateXY(t.selectedTool.object, e.x, e.y); - Da.canPlaceLevelObject(p, i) && - o(() => { - (a - .audio("audio/editor/place.wav") - .play({ overwrite: true }), - c({ - type: "placeObjects", - objects: [ - { - array: i.array, - levelObject: i, - atIndex: p[i.array].length, - }, - ], + selectedObject: null, + justPlacedObject: { + array: i.array, + index: p[i.array].length, + }, }), - n((e) => - Object.assign(Object.assign({}, e), { - selectedObject: null, - justPlacedObject: { - array: i.array, - index: p[i.array].length, - }, - }), - )); - }); - break; - } + )); + }); + break; } - if ( - (!pointer.justReleased || - t.isPinching || - isMultiTouching || - "erase" !== t.selectedTool.type || - (Kr(p, C, o, a, c), (slctedObjs = [])), + } + if ( + (!pointer.justReleased || + t.isPinching || + isMultiTouching || + "erase" !== t.selectedTool.type || + (Kr(p, C, o, a, c), (slctedObjs = [])), pointer.justPressed && (S = [S[1], [pointer.x, pointer.y]]), dragStart && !t.isPinching && !isMultiTouching) - ) - if (pointer.pressed) { - if ("dragSelect" === dragStart.type) - dragSelectPos = { x: C.x, y: C.y }; - else if ("view" === dragStart.type) { - const e = pointer.x - dragStart.x, - t = pointer.y - dragStart.y; - (d.x === e && d.y === t) || - ((I = true), + ) + if (pointer.pressed) { + if ("dragSelect" === dragStart.type) + dragSelectPos = { x: C.x, y: C.y }; + else if ("view" === dragStart.type) { + const e = pointer.x - dragStart.x, + t = pointer.y - dragStart.y; + (d.x === e && d.y === t) || + ((I = true), u({ viewOffset: { x: e, y: t, scale: d.scale } })); - } else if ( - "dragObject" === dragStart.type && - slctedObjs.length > 0 && - (b || dragStart.x !== C.x || dragStart.y !== C.y) - ) { - ((b = true), - (slctedObjs = slctedObjs.map((e) => { - if (!dragStart) return e; - const t = p[e.array][e.index], - { x: a, y: i } = V( - { x: C.x - dragStart.x, y: C.y - dragStart.y }, - Object.assign(Object.assign({}, t.snapSize), { - offsetX: 0, - offsetY: 0, - }), - ); - return Object.assign(Object.assign({}, e), { - draggingX: e.startDraggingX + a, - draggingY: e.startDraggingY + i, - }); - }))); - const e = slctedObjs.map((e) => - $.updateXY(p[e.array][e.index], e.draggingX, e.draggingY), - ); - v = Da.canPlaceLevelObjects( - Ca.removeObjects(p, slctedObjs), - e, - ); - } - } else if ( - (a.timer.start(() => { - n((e) => - Object.assign(Object.assign({}, e), { - dragStart: null, - dragSelectPos: null, - isDraggingSelected: false, - }), - ); - }, 0), - "dragSelect" === dragStart.type && dragSelectPos) - ) { - const e = be.pointInBox({ - width: Math.abs(dragSelectPos.x - dragStart.x), - height: Math.abs(dragSelectPos.y - dragStart.y), - x: (dragSelectPos.x + dragStart.x) / 2, - y: (dragSelectPos.y + dragStart.y) / 2, - }), - t = Ca.getAllObjects(p).filter(e); - slctedObjs = t.map((e) => ({ - array: e.array, - index: p[e.array].indexOf(e), - draggingX: e.x, - draggingY: e.y, - startDraggingX: e.x, - startDraggingY: e.y, - })); } else if ( "dragObject" === dragStart.type && slctedObjs.length > 0 && - pointer.justReleased && - (slctedObjs.some( - (e) => - e.startDraggingX !== e.draggingX || - e.startDraggingY !== e.draggingY, - ) && - o(() => { - Jr( - p, - slctedObjs.map((e) => ({ - selectedObject: e, - toX: e.draggingX, - toY: e.draggingY, - })), - c, - ); - }), - 1 === slctedObjs.length) + (b || dragStart.x !== C.x || dragStart.y !== C.y) ) { - const e = p[slctedObjs[0].array][slctedObjs[0].index].width, - t = O / 2 - 200 - 40, - a = (slctedObjs[0].draggingX + e / 2) * d.scale + d.x; - a > t && - u({ - viewOffset: Object.assign(Object.assign({}, d), { - x: d.x - (a - t) - 30, - }), - }); + ((b = true), + (slctedObjs = slctedObjs.map((e) => { + if (!dragStart) return e; + const t = p[e.array][e.index], + { x: a, y: i } = V( + { x: C.x - dragStart.x, y: C.y - dragStart.y }, + Object.assign(Object.assign({}, t.snapSize), { + offsetX: 0, + offsetY: 0, + }), + ); + return Object.assign(Object.assign({}, e), { + draggingX: e.startDraggingX + a, + draggingY: e.startDraggingY + i, + }); + }))); + const e = slctedObjs.map((e) => + $.updateXY(p[e.array][e.index], e.draggingX, e.draggingY), + ); + v = Da.canPlaceLevelObjects( + Ca.removeObjects(p, slctedObjs), + e, + ); } - return ( - m || - pointer.pressed || - a.timer.start( - () => - n((e) => - Object.assign(Object.assign({}, e), { - pointerReleasedAfterSelectingObject: true, - }), - ), - 10, - ), - Object.assign(Object.assign({}, t), { - selectedObjects: slctedObjs, - justPlacedObject: f, - dragStart: dragStart, - dragSelectPos: dragSelectPos, - viewOffset: d, - isDraggingSelected: b, - lastTwoTaps: S, - didMoveView: I, - pointerReleasedAfterSelectingObject: m, - isMultiTouching: isMultiTouching, - canMoveSelectedObjects: v, - selectedTool: T, - toolsMenuView: toolsMenuView, - frame: s(Se).settings.animateEditor ? t.frame + 1 : 0, - }) - ); - }, - render({ - props: e, - state: t, - updateState: a, - device: i, - getInputs: s, - getContext, - }) { - const r = s(), - l = i.size.width + 2 * i.size.widthMargin, - c = i.size.height + 2 * i.size.heightMargin, - { - settings: { viewOffset: d }, - setSettings: u, - send: h, - } = e, - { - selectedObjects: selectedObjects, - canMoveSelectedObjects: g, - } = t; - let m = e.level.layout, - { inViewLayout: f, inViewLayoutAtTime: inViewLayoutAtTime } = e; - const E = m.properties.theme, - usingGround = m.properties.useGround, - b = - selectedObjects.length > 0 - ? m[selectedObjects[0].array][selectedObjects[0].index] - : null; //1 === p.length ? m[p[0].array][p[0].index] : null; - var sameType = true; - if (selectedObjects.length > 1) { - for (var $o in selectedObjects) { - if ( - selectedObjects[$o].array == selectedObjects[0].array && - selectedObjects[0].array == "blocks" - ) { - if ( - m[selectedObjects[$o].array][selectedObjects[$o].index] - .init && - !b.init - ) { - sameType = false; - break; - } - } - if (selectedObjects[$o].array != selectedObjects[0].array) { + } else if ( + (a.timer.start(() => { + n((e) => + Object.assign(Object.assign({}, e), { + dragStart: null, + dragSelectPos: null, + isDraggingSelected: false, + }), + ); + }, 0), + "dragSelect" === dragStart.type && dragSelectPos) + ) { + const e = be.pointInBox({ + width: Math.abs(dragSelectPos.x - dragStart.x), + height: Math.abs(dragSelectPos.y - dragStart.y), + x: (dragSelectPos.x + dragStart.x) / 2, + y: (dragSelectPos.y + dragStart.y) / 2, + }), + t = Ca.getAllObjects(p).filter(e); + slctedObjs = t.map((e) => ({ + array: e.array, + index: p[e.array].indexOf(e), + draggingX: e.x, + draggingY: e.y, + startDraggingX: e.x, + startDraggingY: e.y, + })); + } else if ( + "dragObject" === dragStart.type && + slctedObjs.length > 0 && + pointer.justReleased && + (slctedObjs.some( + (e) => + e.startDraggingX !== e.draggingX || + e.startDraggingY !== e.draggingY, + ) && + o(() => { + Jr( + p, + slctedObjs.map((e) => ({ + selectedObject: e, + toX: e.draggingX, + toY: e.draggingY, + })), + c, + ); + }), + 1 === slctedObjs.length) + ) { + const e = p[slctedObjs[0].array][slctedObjs[0].index].width, + t = O / 2 - 200 - 40, + a = (slctedObjs[0].draggingX + e / 2) * d.scale + d.x; + a > t && + u({ + viewOffset: Object.assign(Object.assign({}, d), { + x: d.x - (a - t) - 30, + }), + }); + } + return ( + m || + pointer.pressed || + a.timer.start( + () => + n((e) => + Object.assign(Object.assign({}, e), { + pointerReleasedAfterSelectingObject: true, + }), + ), + 10, + ), + Object.assign(Object.assign({}, t), { + selectedObjects: slctedObjs, + justPlacedObject: f, + dragStart: dragStart, + dragSelectPos: dragSelectPos, + viewOffset: d, + isDraggingSelected: b, + lastTwoTaps: S, + didMoveView: I, + pointerReleasedAfterSelectingObject: m, + isMultiTouching: isMultiTouching, + canMoveSelectedObjects: v, + selectedTool: T, + toolsMenuView: toolsMenuView, + frame: s(Se).settings.animateEditor ? t.frame + 1 : 0, + }) + ); + }, + render({ + props: e, + state: t, + updateState: a, + device: i, + getInputs: s, + getContext, + }) { + const r = s(), + l = i.size.width + 2 * i.size.widthMargin, + c = i.size.height + 2 * i.size.heightMargin, + { + settings: { viewOffset: d }, + setSettings: u, + send: h, + } = e, + { + selectedObjects: selectedObjects, + canMoveSelectedObjects: g, + } = t; + let m = e.level.layout, + { inViewLayout: f, inViewLayoutAtTime: inViewLayoutAtTime } = e; + const E = m.properties.theme, + usingGround = m.properties.useGround, + b = + selectedObjects.length > 0 + ? m[selectedObjects[0].array][selectedObjects[0].index] + : null; //1 === p.length ? m[p[0].array][p[0].index] : null; + var sameType = true; + if (selectedObjects.length > 1) { + for (var $o in selectedObjects) { + if ( + selectedObjects[$o].array == selectedObjects[0].array && + selectedObjects[0].array == "blocks" + ) { + if ( + m[selectedObjects[$o].array][selectedObjects[$o].index] + .init && + !b.init + ) { sameType = false; break; } } + if (selectedObjects[$o].array != selectedObjects[0].array) { + sameType = false; + break; + } } - let S = [], - I = "", - _ = [], - v = false; - if (selectedObjects.length > 0 && t.isDraggingSelected) { - const layout = m; - m = Ca.removeObjects(m, selectedObjects); - const a = selectedObjects - .map((t) => - Object.assign(Object.assign({}, t), { - index: f[t.array].indexOf( - e.level.layout[t.array][t.index], - ), - }), - ) - .filter((e) => e.index >= 0); - ((f = Ca.removeObjects(f, a)), - (inViewLayoutAtTime = Ca.removeObjects( - inViewLayoutAtTime, - a.filter( - (e) => - "saws" === e.array || - "switchPlatforms" === e.array || - "platforms" === e.array, - ), - )), - (_ = selectedObjects.map((e) => - $.updateXY( - layout[e.array][e.index], - e.draggingX, - e.draggingY, - ), - )), - (v = !g), - (S = _.flatMap((e, a) => - $r( - e, - m, - a, - false, - t.frame, - getContext(Ws), - !getContext(Se).settings.animateEditor, - d.scale, + } + let S = [], + I = "", + _ = [], + v = false; + if (selectedObjects.length > 0 && t.isDraggingSelected) { + const layout = m; + m = Ca.removeObjects(m, selectedObjects); + const a = selectedObjects + .map((t) => + Object.assign(Object.assign({}, t), { + index: f[t.array].indexOf( + e.level.layout[t.array][t.index], ), + }), + ) + .filter((e) => e.index >= 0); + ((f = Ca.removeObjects(f, a)), + (inViewLayoutAtTime = Ca.removeObjects( + inViewLayoutAtTime, + a.filter( + (e) => + "saws" === e.array || + "switchPlatforms" === e.array || + "platforms" === e.array, + ), + )), + (_ = selectedObjects.map((e) => + $.updateXY( + layout[e.array][e.index], + e.draggingX, + e.draggingY, + ), + )), + (v = !g), + (S = _.flatMap((e, a) => + $r( + e, + m, + a, + false, + t.frame, + getContext(Ws), + !getContext(Se).settings.animateEditor, + d.scale, + ), + ))); + } + const T = { + x: (r.pointer.x - d.x) / d.scale, + y: (r.pointer.y - d.y) / d.scale, + }; + if ("placeLevelObject" === t.selectedTool.type) + if (i.isTouchScreen) I = "TAP TO PLACE"; + else { + const e = V( + $.updateXY(t.selectedTool.object, T.x, T.y), + t.selectedTool.object.snapSize, + ), + a = $.updateXY(t.selectedTool.object, e.x, e.y); + ((v = !Da.canPlaceLevelObjects(m, [a])), + (S = $r( + a, + m, + 0, + v, + t.frame, + getContext(Ws), + !getContext(Se).settings.animateEditor, + d.scale, ))); } - const T = { - x: (r.pointer.x - d.x) / d.scale, - y: (r.pointer.y - d.y) / d.scale, - }; - if ("placeLevelObject" === t.selectedTool.type) - if (i.isTouchScreen) I = "TAP TO PLACE"; - else { - const e = V( - $.updateXY(t.selectedTool.object, T.x, T.y), - t.selectedTool.object.snapSize, - ), - a = $.updateXY(t.selectedTool.object, e.x, e.y); - ((v = !Da.canPlaceLevelObjects(m, [a])), - (S = $r( - a, - m, - 0, - v, - t.frame, - getContext(Ws), - !getContext(Se).settings.animateEditor, - d.scale, - ))); - } - return [ - Wr({ - id: "LevelEditorView", + return [ + Wr({ + id: "LevelEditorView", + selectedObjects: selectedObjects, + draggingObjects: _, + isDragging: t.isDraggingSelected, + runHistoryIndex: e.runHistoryIndex, + runHistory: e.runHistory, + placingItem: S, + x: d.x, + y: d.y, + scaleX: d.scale, + scaleY: d.scale, + parentOffset: d, + level: e.level, + waveformData: e.waveformData, + levelSpeeds: t.levelSpeeds, + fullLayout: m, + inViewLayout: f, + inViewLayoutAtTime: inViewLayoutAtTime, + justPlacedObject: t.justPlacedObject, + noSpace: v, + isLoading: e.isLoading, + playerSkin: e.playerSkin, + frame: t.frame, + }), + I + ? n({ + text: localize(I), + font: { size: 20 }, + color: ve, + y: c / 2 - 20, + }) + : null, + tr({ + id: "Tools", + selectedTool: t.selectedTool, + selectTool: (e) => { + a((t) => + Object.assign(Object.assign({}, t), { selectedTool: e }), + ); + }, + canUndo: e.settings.actionHistory.length > 0, + send: h, + unselectAllObjects: () => { + a((e) => + Object.assign(Object.assign({}, e), { + selectedObjects: [], + }), + ); + }, + features: e.features, + themes: Object.values(ca).filter(theme => !theme.hidden), + isLoading: e.isLoading, + x: -l / 2 + 50, + y: -45, + menuView: t.toolsMenuView, + theme: E, + useGround: usingGround, + toggleGround: (e) => { + h({ + type: "changeTheme", + theme: E, + useGround: !usingGround, + }); + }, + setMenuOpen: (e) => { + a((t) => + Object.assign(Object.assign({}, t), { toolsMenuView: e }), + ); + }, + selectTheme: (e) => { + h({ + type: "changeTheme", + theme: e, + useGround: usingGround, + }); + }, + }), + selectedObjects.length > 0 + ? mr({ + id: "SelectedObjectTools", + layout: e.level.layout, + viewOffset: d, + setViewOffset: (e) => { + u({ viewOffset: e }); + }, selectedObjects: selectedObjects, - draggingObjects: _, - isDragging: t.isDraggingSelected, - runHistoryIndex: e.runHistoryIndex, - runHistory: e.runHistory, - placingItem: S, - x: d.x, - y: d.y, - scaleX: d.scale, - scaleY: d.scale, - parentOffset: d, - level: e.level, - waveformData: e.waveformData, - levelSpeeds: t.levelSpeeds, - fullLayout: m, - inViewLayout: f, - inViewLayoutAtTime: inViewLayoutAtTime, - justPlacedObject: t.justPlacedObject, - noSpace: v, - isLoading: e.isLoading, - playerSkin: e.playerSkin, - frame: t.frame, - }), - I - ? n({ - text: localize(I), - font: { size: 20 }, - color: ve, - y: c / 2 - 20, - }) - : null, - tr({ - id: "Tools", - selectedTool: t.selectedTool, - selectTool: (e) => { + setSelectedObjects: (e) => { a((t) => - Object.assign(Object.assign({}, t), { selectedTool: e }), + Object.assign(Object.assign({}, t), { + selectedObjects: e, + }), ); }, - canUndo: e.settings.actionHistory.length > 0, send: h, - unselectAllObjects: () => { - a((e) => - Object.assign(Object.assign({}, e), { - selectedObjects: [], + y: -c / 2 + 40, + }) + : null, + b && sameType && t.pointerReleasedAfterSelectingObject + ? levelObjectMenu({ + id: "LevelObjectMenu", + object: [b], + x: l / 2 - 100 - 40, + y: -40, + features: e.features, + send: h, + arrowMove: (e, t) => { + Jr( + m, + selectedObjects.map((a) => { + const { x: i, y: n } = m[a.array][a.index]; + return { + selectedObject: a, + toX: i + (e || 0), + toY: n + (t || 0), + }; }), + h, ); }, - features: e.features, - themes: Object.values(ca).filter(theme => !theme.hidden), - isLoading: e.isLoading, - x: -l / 2 + 50, - y: -45, - menuView: t.toolsMenuView, - theme: E, - useGround: usingGround, - toggleGround: (e) => { - h({ - type: "changeTheme", - theme: E, - useGround: !usingGround, - }); - }, - setMenuOpen: (e) => { - a((t) => - Object.assign(Object.assign({}, t), { toolsMenuView: e }), + selectedObjectIndex: selectedObjects.map((j) => { + return j.index; + }), + }) + : null, + t.dragStart && t.dragSelectPos + ? o({ + width: + Math.abs(t.dragSelectPos.x - t.dragStart.x) * d.scale, + height: + Math.abs(t.dragSelectPos.y - t.dragStart.y) * d.scale, + x: + ((t.dragSelectPos.x + t.dragStart.x) / 2) * d.scale + + d.x, + y: + ((t.dragSelectPos.y + t.dragStart.y) / 2) * d.scale + + d.y, + color: "blue", + opacity: 0.3, + }) + : null, + ...(getContext(Se).settings.showDebug ? [vo({ + id: "Autopilot", + fileName: "images/achievement/rewards/autopilot.png", + noSound: false, + onPress: () => { + if (!e.runHistory[e.runHistoryIndex].boosterDebug) { + return; + }; + let autopilot = JSON.stringify(e.runHistory[e.runHistoryIndex].boosterDebug.autopilot); + i.clipboard.copy(autopilot, (e) => { + if (e) + return ( + i.alert.ok( + `Error copying autopilot JSON to clipboard: ${e.message}`, + ), + void i.log(autopilot) + ); + i.alert.ok( + "Autopilot JSON copied to clipboard.", ); - }, - selectTheme: (e) => { - h({ - type: "changeTheme", - theme: e, - useGround: usingGround, - }); - }, - }), - selectedObjects.length > 0 - ? mr({ - id: "SelectedObjectTools", - layout: e.level.layout, - viewOffset: d, - setViewOffset: (e) => { - u({ viewOffset: e }); - }, - selectedObjects: selectedObjects, - setSelectedObjects: (e) => { - a((t) => - Object.assign(Object.assign({}, t), { - selectedObjects: e, - }), - ); - }, - send: h, - y: -c / 2 + 40, - }) - : null, - b && sameType && t.pointerReleasedAfterSelectingObject - ? levelObjectMenu({ - id: "LevelObjectMenu", - object: [b], - x: l / 2 - 100 - 40, - y: -40, - features: e.features, - send: h, - arrowMove: (e, t) => { - Jr( - m, - selectedObjects.map((a) => { - const { x: i, y: n } = m[a.array][a.index]; - return { - selectedObject: a, - toX: i + (e || 0), - toY: n + (t || 0), - }; - }), - h, - ); - }, - selectedObjectIndex: selectedObjects.map((j) => { - return j.index; - }), - }) - : null, - t.dragStart && t.dragSelectPos - ? o({ - width: - Math.abs(t.dragSelectPos.x - t.dragStart.x) * d.scale, - height: - Math.abs(t.dragSelectPos.y - t.dragStart.y) * d.scale, - x: - ((t.dragSelectPos.x + t.dragStart.x) / 2) * d.scale + - d.x, - y: - ((t.dragSelectPos.y + t.dragStart.y) / 2) * d.scale + - d.y, - color: "blue", - opacity: 0.3, - }) - : null, - ...(getContext(Se).settings.showDebug ? [vo({ - id: "Autopilot", - fileName: "images/achievement/rewards/autopilot.png", - noSound: false, - onPress: () => { - if (!e.runHistory[e.runHistoryIndex].boosterDebug) { - return; - }; - let autopilot = JSON.stringify(e.runHistory[e.runHistoryIndex].boosterDebug.autopilot); - i.clipboard.copy(autopilot, (e) => { - if (e) - return ( - i.alert.ok( - `Error copying autopilot JSON to clipboard: ${e.message}`, - ), - void i.log(autopilot) - ); + }); + }, + isSelected: false, + isOpen: false, + x: l / 2 - 210, + y: c / 2 - 50 + }), + vo({ + id: "JumpIndicator", + fileName: "images/achievement/rewards/slowmo.png", + noSound: false, + onPress: () => { + if (!e.runHistory[e.runHistoryIndex].boosterDebug) { + return; + }; + let autopilot = JSON.stringify(e.runHistory[e.runHistoryIndex].boosterDebug.jumpIndicators); + i.clipboard.copy(autopilot, (e) => { + if (e) + return ( i.alert.ok( - "Autopilot JSON copied to clipboard.", - ); + `Error copying jump indicator JSON to clipboard: ${e.message}`, + ), + void i.log(autopilot) + ); + i.alert.ok( + "Jump Indicator JSON copied to clipboard.", + ); + }); + }, + isSelected: false, + isOpen: false, + x: l / 2 - 250, + y: c / 2 - 50 + })] : []), + + ...(i.isTouchScreen + ? [ + PinchRecogniser({ + id: "PinchRecogniser", + initScale: d.scale, + startPinch: () => { + a((e) => + Object.assign(Object.assign({}, e), { + isPinching: true, + didMoveView: true, + }), + ); + }, + endPinch: () => { + a((e) => + Object.assign(Object.assign({}, e), { + isPinching: false, + }), + ); + }, + didPinch: (e) => { + const a = + (t.lastTwoTaps[0][0] + t.lastTwoTaps[1][0]) / 2, + i = (t.lastTwoTaps[0][1] + t.lastTwoTaps[1][1]) / 2; + u({ viewOffset: pr(d, e, { x: a, y: i }) }); + }, + }), + ScrollHandler.Single({ + id: "ScrollHandler", + onScaleDelta: (t) => { + e.setSettings({ + viewOffset: pr( + d, + B.clamp2(dr, cr, d.scale * (1 - t / 1000)), + { x: r.pointer.x, y: r.pointer.y }, + ), }); }, - isSelected: false, - isOpen: false, - x: l / 2 - 210, - y: c / 2 - 50 + addToOnScrollQueue: getContext(Se).addToOnScrollQueue, + }), + ] + : [ + PinchRecogniser({ + id: "PinchRecogniser", + initScale: d.scale, + startPinch: () => { + a((e) => + Object.assign(Object.assign({}, e), { + isPinching: true, + didMoveView: true, + }), + ); + }, + endPinch: () => { + a((e) => + Object.assign(Object.assign({}, e), { + isPinching: false, + }), + ); + }, + didPinch: (e) => { + const a = + (t.lastTwoTaps[0][0] + t.lastTwoTaps[1][0]) / 2, + i = (t.lastTwoTaps[0][1] + t.lastTwoTaps[1][1]) / 2; + u({ viewOffset: pr(d, e, { x: a, y: i }) }); + }, }), - vo({ - id: "JumpIndicator", - fileName: "images/achievement/rewards/slowmo.png", - noSound: false, + br({ + id: "ZoomInButton", + type: "+", + x: l / 2 - 120, + y: c / 2 - 50, onPress: () => { - if (!e.runHistory[e.runHistoryIndex].boosterDebug) { - return; - }; - let autopilot = JSON.stringify(e.runHistory[e.runHistoryIndex].boosterDebug.jumpIndicators); - i.clipboard.copy(autopilot, (e) => { - if (e) - return ( - i.alert.ok( - `Error copying jump indicator JSON to clipboard: ${e.message}`, - ), - void i.log(autopilot) - ); - i.alert.ok( - "Jump Indicator JSON copied to clipboard.", - ); - }); + u({ viewOffset: zoomIn(d) }); }, - isSelected: false, - isOpen: false, - x: l / 2 - 250, - y: c / 2 - 50 - })] : []), - - ...(i.isTouchScreen - ? [ - PinchRecogniser({ - id: "PinchRecogniser", - initScale: d.scale, - startPinch: () => { - a((e) => - Object.assign(Object.assign({}, e), { - isPinching: true, - didMoveView: true, - }), - ); - }, - endPinch: () => { - a((e) => - Object.assign(Object.assign({}, e), { - isPinching: false, - }), - ); - }, - didPinch: (e) => { - const a = - (t.lastTwoTaps[0][0] + t.lastTwoTaps[1][0]) / 2, - i = (t.lastTwoTaps[0][1] + t.lastTwoTaps[1][1]) / 2; - u({ viewOffset: pr(d, e, { x: a, y: i }) }); - }, - }), - ScrollHandler.Single({ - id: "ScrollHandler", - onScaleDelta: (t) => { - e.setSettings({ - viewOffset: pr( - d, - B.clamp2(dr, cr, d.scale * (1 - t / 1000)), - { x: r.pointer.x, y: r.pointer.y }, - ), - }); - }, - addToOnScrollQueue: getContext(Se).addToOnScrollQueue, - }), - ] - : [ - PinchRecogniser({ - id: "PinchRecogniser", - initScale: d.scale, - startPinch: () => { - a((e) => - Object.assign(Object.assign({}, e), { - isPinching: true, - didMoveView: true, - }), - ); - }, - endPinch: () => { - a((e) => - Object.assign(Object.assign({}, e), { - isPinching: false, - }), - ); - }, - didPinch: (e) => { - const a = - (t.lastTwoTaps[0][0] + t.lastTwoTaps[1][0]) / 2, - i = (t.lastTwoTaps[0][1] + t.lastTwoTaps[1][1]) / 2; - u({ viewOffset: pr(d, e, { x: a, y: i }) }); - }, - }), - br({ - id: "ZoomInButton", - type: "+", - x: l / 2 - 120, - y: c / 2 - 50, - onPress: () => { - u({ viewOffset: zoomIn(d) }); - }, - }), - br({ - id: "ZoomOutButton", - type: "-", - x: l / 2 - 160, - y: c / 2 - 50, - onPress: () => { - u({ viewOffset: zoomOut(d) }); - }, - }), - ScrollHandler.Single({ - id: "ScrollHandler", - onScaleDelta: (t) => { - e.setSettings({ - viewOffset: r.keysDown.Control - ? pr( - d, - B.clamp2(dr, cr, d.scale * (1 - t / 1000)), - { x: r.pointer.x, y: r.pointer.y }, - ) - : r.keysDown.Shift - ? { x: d.x + t * 0.9, y: d.y, scale: d.scale } - : { x: d.x, y: d.y + t * 0.9, scale: d.scale }, - }); - }, - addToOnScrollQueue: getContext(Se).addToOnScrollQueue, - }), - ]), - ]; - }, - }), - Wr = makeCustomSprite({ - render({ - props: { - selectedObjects: e, - draggingObjects: t, - isDragging: a, - runHistoryIndex: i, - placingItem: placingItem, - parentOffset: parentOffset, - runHistory: runHistory, - waveformData: waveformData, - level: { song: c, songStartSecs: d }, - levelSpeeds: u, - inViewLayout: h, - inViewLayoutAtTime: inViewLayoutAtTime, - fullLayout: g, - justPlacedObject: justPlacedObject, - noSpace: f, - isLoading: y, - playerSkin: E, - x: propsX, - y: propsY, - scaleY: propsScale, - frame: frame, - }, - state, - getContext, - }) { - let pauseAnimations = !getContext(Se).settings.animateEditor; - if (y) - return [ - GridLines.Single({ - id: "GridLines", - parentOffset: parentOffset, }), - n({ - text: `${localize("LOADING")}...`, - font: { size: 15 }, - color: ve, - scaleX: 1 / parentOffset.scale, - scaleY: 1 / parentOffset.scale, - x: -parentOffset.x / parentOffset.scale, - y: -parentOffset.y / parentOffset.scale, + br({ + id: "ZoomOutButton", + type: "-", + x: l / 2 - 160, + y: c / 2 - 50, + onPress: () => { + u({ viewOffset: zoomOut(d) }); + }, }), - ]; - const b = a ? t : e.map((e) => g[e.array][e.index]), - S = (justPlacedObject && g[justPlacedObject.array][justPlacedObject.index]) || null, - I = - e.length > 0 - ? e - .filter((t) => t.array === "enemies") - .map((t) => h.enemies.indexOf(g.enemies[t.index])) - : [], - _ = $.getBorderDimensions(b), - { objects: v, player: T } = g.properties.theme, - R = "default" === E.fileName ? T : E; - overlapObjects = getContext(Se).settings.overlapObjects; - let blockTheme = v.block === "infinite" ? getInfiniteThemePath(runHistory[i].bgColor) : v.block, - spikeTheme = v.spike === "infinite" ? getInfiniteThemePath(runHistory[i].bgColor) : v.spike, - sawTheme = v.saw === "infinite" ? getInfiniteThemePath(runHistory[i].bgColor) : v.saw, - switchTheme = v.switch === "infinite" ? getInfiniteThemePath(runHistory[i].bgColor) : v.switch; + ScrollHandler.Single({ + id: "ScrollHandler", + onScaleDelta: (t) => { + e.setSettings({ + viewOffset: r.keysDown.Control + ? pr( + d, + B.clamp2(dr, cr, d.scale * (1 - t / 1000)), + { x: r.pointer.x, y: r.pointer.y }, + ) + : r.keysDown.Shift + ? { x: d.x + t * 0.9, y: d.y, scale: d.scale } + : { x: d.x, y: d.y + t * 0.9, scale: d.scale }, + }); + }, + addToOnScrollQueue: getContext(Se).addToOnScrollQueue, + }), + ]), + ]; + }, + }), + Wr = makeCustomSprite({ + render({ + props: { + selectedObjects: e, + draggingObjects: t, + isDragging: a, + runHistoryIndex: i, + placingItem: placingItem, + parentOffset: parentOffset, + runHistory: runHistory, + waveformData: waveformData, + level: { song: c, songStartSecs: d }, + levelSpeeds: u, + inViewLayout: h, + inViewLayoutAtTime: inViewLayoutAtTime, + fullLayout: g, + justPlacedObject: m, + noSpace: f, + isLoading: y, + playerSkin: E, + x: propsX, + y: propsY, + scaleY: propsScale, + frame: frame, + }, + state, + getContext, + }) { + let pauseAnimations = !getContext(Se).settings.animateEditor; + if (y) return [ GridLines.Single({ id: "GridLines", parentOffset: parentOffset, }), - runHistory[i].bossState - ? hg.Single( - { id: "BossBackdrop", bossState: runHistory[i].bossState, playerX: -propsX / propsScale }, - ) - : null, - g.properties.useGround - ? renderGround.Single({ - id: "Ground", - theme: isSpecialTheme(g.properties.theme.id) - ? g.properties.theme.id - : v.block, - x: -propsX / propsScale, - cameraY: 0, - scaleX: 1 / propsScale, - opacity: isSpecialTheme(g.properties.theme.id) ? 1 : 0.5, - bgColor: runHistory[i].bgColor, - }) - : null, - Ja.Single({ id: "Blocks", blocks: h.blocks, theme: blockTheme }), - Za.Single({ id: "Spikes", spikes: h.spikes, theme: spikeTheme }), - Qa.Single({ - id: "Platforms", - platforms: h.platforms, - theme: v.platform, - editor: { - previewYs: inViewLayoutAtTime.platforms.map((e) => e.y), - }, + n({ + text: `${localize("LOADING")}...`, + font: { size: 15 }, + color: ve, + scaleX: 1 / parentOffset.scale, + scaleY: 1 / parentOffset.scale, + x: -parentOffset.x / parentOffset.scale, + y: -parentOffset.y / parentOffset.scale, }), + ]; + const b = a ? t : e.map((e) => g[e.array][e.index]), + S = (m && g[m.array][m.index]) || null, + I = + e.length > 0 + ? e + .filter((t) => t.array === "enemies") + .map((t) => h.enemies.indexOf(g.enemies[t.index])) + : [], + _ = $.getBorderDimensions(b), + { objects: v, player: T } = g.properties.theme, + R = "default" === E.fileName ? T : E; + overlapObjects = getContext(Se).settings.overlapObjects; + let blockTheme = v.block === "infinite" ? getInfiniteThemePath(runHistory[i].bgColor) : v.block, + spikeTheme = v.spike === "infinite" ? getInfiniteThemePath(runHistory[i].bgColor) : v.spike, + sawTheme = v.saw === "infinite" ? getInfiniteThemePath(runHistory[i].bgColor) : v.saw, + switchTheme = v.switch === "infinite" ? getInfiniteThemePath(runHistory[i].bgColor) : v.switch; + return [ + GridLines.Single({ + id: "GridLines", + parentOffset: parentOffset, + }), + runHistory[i].bossState + ? hg.Single( + { id: "BossBackdrop", bossState: runHistory[i].bossState, playerX: -propsX / propsScale }, + ) + : null, + g.properties.useGround + ? renderGround.Single({ + id: "Ground", + theme: isSpecialTheme(g.properties.theme.id) + ? g.properties.theme.id + : v.block, + x: -propsX / propsScale, + cameraY: 0, + scaleX: 1 / propsScale, + opacity: isSpecialTheme(g.properties.theme.id) ? 1 : 0.5, + bgColor: runHistory[i].bgColor, + }) + : null, + Ja.Single({ id: "Blocks", blocks: h.blocks, theme: blockTheme }), + Za.Single({ id: "Spikes", spikes: h.spikes, theme: spikeTheme }), + Qa.Single({ + id: "Platforms", + platforms: h.platforms, + theme: v.platform, + editor: { + previewYs: inViewLayoutAtTime.platforms.map((e) => e.y), + }, + }), - ...h.directionChanges.map((e, t) => - Zs.Single({ - id: `DirectionChange-${t}`, - directionChange: e, - theme: v.dirChange, - isEditor: true, - spineContext: getContext(Ws), - paused: pauseAnimations, - scale: propsScale, - }), - ), - ...h.speedChanges.map((e, t) => - er.Single({ - id: `SpeedChange-${t}`, - speedChange: e, - isEditor: true, - justHit: false, - theme: v.speedChange, - spineContext: getContext(Ws), - paused: pauseAnimations, - scale: propsScale, - }), - ), - ...h.flags.map((e, t) => - ao.Single({ - id: `Flag-${t}`, - flag: e, - theme: v.flag, - spineContext: getContext(Ws), - paused: pauseAnimations, - scale: propsScale, - frame: frame, - }), - ), - ...h.powerups.map((e, t) => - Co.Single({ - id: `Powerup-${t}`, - powerup: e, - skin: R, - isEditor: true, - theme: v.speedChange, - frame: frame, - spineContext: getContext(Ws), - paused: pauseAnimations, - scale: propsScale, - }), - ), - eo.Single({ - id: "Saws", - saws: h.saws, - theme: sawTheme, - editor: { - previewYs: inViewLayoutAtTime.saws.map((e) => e.y), - previewRots: inViewLayoutAtTime.saws.map((e) => e.rotation), - }, - bigTheme: spikeTheme, + ...h.directionChanges.map((e, t) => + Zs.Single({ + id: `DirectionChange-${t}`, + directionChange: e, + theme: v.dirChange, + isEditor: true, + spineContext: getContext(Ws), + paused: pauseAnimations, + scale: propsScale, + }), + ), + ...h.speedChanges.map((e, t) => + er.Single({ + id: `SpeedChange-${t}`, + speedChange: e, + isEditor: true, + justHit: false, + theme: v.speedChange, + spineContext: getContext(Ws), + paused: pauseAnimations, + scale: propsScale, + }), + ), + ...h.flags.map((e, t) => + ao.Single({ + id: `Flag-${t}`, + flag: e, + theme: v.flag, + spineContext: getContext(Ws), + paused: pauseAnimations, + scale: propsScale, frame: frame, - bgColor: getInfiniteThemeColors(runHistory[i].bgColor) }), - ...inViewLayoutAtTime.enemies.map((e, t) => - runHistory[i].layoutState.enemies[t].destroyed - ? null - : o({ - width: e.width, - height: e.height, - x: e.x, - y: e.y, - color: "red", - opacity: 0.5, - }), - ), - - - ...h.switchButtons.map((e, t) => - xo.Single({ - id: `SwitchButton-${t}`, - switchButton: e, - switchRotation: runHistory[i].switchButtons.rot, - switchBlockSpikes: runHistory[i].switchBlockSpikes, - playerScale: runHistory[i].playerScale, - isEditor: true, - justHit: false, - theme: switchTheme, - orbTheme: g.properties.theme.id === "classic" ? "classic" : switchTheme, - spineContext: getContext(Ws), - paused: pauseAnimations, - scale: propsScale, + ), + ...h.powerups.map((e, t) => + Co.Single({ + id: `Powerup-${t}`, + powerup: e, + skin: R, + isEditor: true, + theme: v.speedChange, + frame: frame, + spineContext: getContext(Ws), + paused: pauseAnimations, + scale: propsScale, + }), + ), + eo.Single({ + id: "Saws", + saws: h.saws, + theme: sawTheme, + editor: { + previewYs: inViewLayoutAtTime.saws.map((e) => e.y), + previewRots: inViewLayoutAtTime.saws.map((e) => e.rotation), + }, + bigTheme: spikeTheme, + frame: frame, + bgColor: getInfiniteThemeColors(runHistory[i].bgColor) + }), + ...inViewLayoutAtTime.enemies.map((e, t) => + runHistory[i].layoutState.enemies[t].destroyed + ? null + : o({ + width: e.width, + height: e.height, + x: e.x, + y: e.y, + color: "red", + opacity: 0.5, }), - ), - Po.Single({ - id: "SwitchPlatforms", - switchPlatforms: h.switchPlatforms, - editor: { - previewRots: inViewLayoutAtTime.switchPlatforms.map( - (e) => e.rotation + e.direction, - ), - }, + ), + + + ...h.switchButtons.map((e, t) => + xo.Single({ + id: `SwitchButton-${t}`, + switchButton: e, + switchRotation: runHistory[i].switchButtons.rot, + switchBlockSpikes: runHistory[i].switchBlockSpikes, + playerScale: runHistory[i].playerScale, + isEditor: true, + justHit: false, + theme: switchTheme, + orbTheme: g.properties.theme.id === "classic" ? "classic" : switchTheme, + spineContext: getContext(Ws), + paused: pauseAnimations, + scale: propsScale, + }), + ), + Po.Single({ + id: "SwitchPlatforms", + switchPlatforms: h.switchPlatforms, + editor: { + previewRots: inViewLayoutAtTime.switchPlatforms.map( + (e) => e.rotation + e.direction, + ), + }, + theme: v.switch, + }), + ...h.springs.map((e, t) => + $o.Single({ + id: `Spring-${t}`, + spring: e, + justHit: false, + isEditor: true, + spineContext: getContext(Ws), + paused: pauseAnimations, + scale: propsScale, + }), + ), + ...h.portals.map((e, t) => + Jo.Single({ + id: `Portal-${t}`, + portal: e, + paused: pauseAnimations, + isEditor: true, theme: v.switch, + spineContext: getContext(Ws), + scale: propsScale, }), - ...h.springs.map((e, t) => - $o.Single({ - id: `Spring-${t}`, - spring: e, - justHit: false, - isEditor: true, - spineContext: getContext(Ws), - paused: pauseAnimations, - scale: propsScale, - }), - ), - ...h.portals.map((e, t) => - Jo.Single({ - id: `Portal-${t}`, - portal: e, + ), + ...h.collectibles.map((e, t) => + qo.Single({ + id: `Collectible-${t}`, + collectible: e, + wasPickedUp: false, + isEditor: true, + theme: v.switch, + }), + ), + ...h.enemies.map((e, t) => + yo.Single({ + id: `Enemy-${t}`, + enemy: e, + showArea: !a && I.includes(t), + frame: frame, + spineContext: getContext(Ws), + paused: pauseAnimations, + scale: propsScale, + }), + ), + runHistory[i].bossState + ? ug.Single( + { + id: "bossStateRenderer", + bossState: runHistory[i].bossState, + frame: runHistory[i].frame, paused: pauseAnimations, - isEditor: true, - theme: v.switch, - spineContext: getContext(Ws), - scale: propsScale, - }), - ), - ...h.collectibles.map((e, t) => - qo.Single({ - id: `Collectible-${t}`, - collectible: e, - wasPickedUp: false, - isEditor: true, - theme: v.switch, - }), - ), - ...h.enemies.map((e, t) => - yo.Single({ - id: `Enemy-${t}`, - enemy: e, - showArea: !a && I.includes(t), - frame: frame, + playerX: -propsX / propsScale, + playerRot: runHistory[i].playerRot, + playerCrashed: runHistory[i].crashed, + df: runHistory[i].df, spineContext: getContext(Ws), - paused: pauseAnimations, scale: propsScale, - }), - ), - runHistory[i].bossState - ? ug.Single( - { - id: "bossStateRenderer", - bossState: runHistory[i].bossState, - frame: runHistory[i].frame, - paused: pauseAnimations, - playerX: -propsX / propsScale, - playerRot: runHistory[i].playerRot, - playerCrashed: runHistory[i].crashed, - df: runHistory[i].df, - spineContext: getContext(Ws), - scale: propsScale, - } - ) + } + ) + : null, + ...runHistory[i].playerBullets.map((e) => + e.frame == 0 + ? l({ + fileName: "images/themes/world2/gun/bullet.png", + x: e.x, + y: e.y, + width: e.width * Math.sign(e.speed), + height: e.height, + opacity: 0.5, + }) : null, - ...runHistory[i].playerBullets.map((e) => - e.frame == 0 - ? l({ - fileName: "images/themes/world2/gun/bullet.png", - x: e.x, - y: e.y, - width: e.width * Math.sign(e.speed), - height: e.height, - opacity: 0.5, - }) - : null, - ), - ...placingItem, - qr({ - id: "RunHistory", - playerSkin: R, - runHistory: runHistory, - runHistoryIndex: i, + ), + ...placingItem, + qr({ + id: "RunHistory", + playerSkin: R, + runHistory: runHistory, + runHistoryIndex: i, + }), + Dr({ + id: "Waveform", + song: c, + x: runHistory[i].playerX, + y: runHistory[i].playerY, + startFrame: runHistory[i].frame + 60 * d, + direction: runHistory[i].playerDir, + waveformData: waveformData, + waveformLengthInBeats: 10, + speedMultiplier: runHistory[i].playerSpeedMultiplier, + }), + _ && + Er( + Object.assign(Object.assign({ id: "SelectedBorder" }, _), { + noSpace: f && (!placingItem || a), }), - /*Dr({ - id: "Waveform", - song: c, - x: runHistory[i].playerX, - y: runHistory[i].playerY, - startFrame: runHistory[i].frame + 60 * d, - direction: runHistory[i].playerDir, - waveformData: waveformData, - waveformLengthInBeats: 10, - speedMultiplier: runHistory[i].playerSpeedMultiplier, - }),*/ - ...([30, 50, 70].map( (x) => m({ color: Be, - opacity: 0.8, - thickness: 5, - x: runHistory[i].playerX + x * runHistory[i].playerDir, - y: runHistory[i].playerY, - path: [ - [0, 15], - [15, 0], - [0, -15] - ], - scaleX: runHistory[i].playerDir, - }))), - _ && - Er( - Object.assign(Object.assign({ id: "SelectedBorder" }, _), { - noSpace: f && (!placingItem || a), - }), - ), - S && + ), + S && (runHistory[i].switchBlockSpikes ? "spike" : "block") === S.type - ? BlockProjection({ - id: "BlockProjection", - x: S.x, - y: S.y + S.height / 2 + 15, - levelSpeeds: u, - playerSpeedMultiplier: - runHistory[i].playerSpeedMultiplier, - playerScale: runHistory[i].playerScale, - }) - : a || - 1 !== b.length || - (runHistory[i].switchBlockSpikes ? "spike" : "block") !== - b[0].type - ? null - : BlockProjection({ - id: "BlockProjection", - x: b[0].x, - y: b[0].y + b[0].height / 2 + 15, - levelSpeeds: u, - playerSpeedMultiplier: - runHistory[i].playerSpeedMultiplier, - playerScale: runHistory[i].playerScale, - }), - S && "spring" === S.type - ? SpringProjection({ - id: "SpringProjection", - x: S.x, - y: S.y + (S.height / 2) * S.direction + 15 * S.direction, - levelSpeeds: u, - playerSpeedMultiplier: - runHistory[i].playerSpeedMultiplier, - playerScale: runHistory[i].playerScale, - playerGradY: runHistory[i].playerGradY, - direction: S.direction, - }) - : a || 1 !== b.length || "spring" !== b[0].type - ? null - : SpringProjection({ - id: "SpringProjection", - x: b[0].x, - y: - b[0].y + - (b[0].height / 2) * b[0].direction + - 15 * b[0].direction, - levelSpeeds: u, - playerSpeedMultiplier: - runHistory[i].playerSpeedMultiplier, - playerScale: runHistory[i].playerScale, - playerGradY: runHistory[i].playerGradY, - direction: b[0].direction, - }), - ]; - }, - }), - qr = makePureSprite({ - shouldRerender: (e, t) => - e.runHistoryIndex !== t.runHistoryIndex || - e.playerSkin !== t.playerSkin, - render: ({ - props: { playerSkin: e, runHistory: t, runHistoryIndex: a }, - }) => { - return [ - ((n = { - fileName: `images/player/skins/${e.fileName}.png`, - props: t.map((t, i) => ({ - width: e.size, - height: e.size, - opacity: a === i ? 1 : 0.2, - x: t.playerX, - y: t.playerY, - rotation: t.playerRot, - scaleX: t.playerScaleX * t.playerDir, - scaleY: t.playerScaleY, - })), - }), - { - type: "imageArray", - fileName: n.fileName, - mask: n.mask || null, - props: n.props.map((e) => - i( - { testId: e.testId, width: e.width, height: e.height }, - e, - ), - ), - }), - ]; - var n; - }, - }); - function $r(e, t, a, i, frame, spineContext, paused, scale) { - const { objects: n } = t.properties.theme, - s = t.properties.theme.player, - r = i - ? o({ - color: "red", - width: e.width, - height: e.height, - x: e.x, - y: e.y, - opacity: 0.5, + ? BlockProjection({ + id: "BlockProjection", + x: S.x, + y: S.y + S.height / 2 + 15, + levelSpeeds: u, + playerSpeedMultiplier: + runHistory[i].playerSpeedMultiplier, + playerScale: runHistory[i].playerScale, }) - : null; - return [ - (() => { - switch (e.type) { - case "block": - return Ja.Single({ - id: `PlacingBlock-${a}`, - blocks: [e], - theme: n.block, - }); - case "spike": - return Za.Single({ - id: `PlacingSpike-${a}`, - spikes: [e], - theme: n.spike, - }); - case "platform": - return Qa.Single({ - id: `PlacingPlatform-${a}`, - platforms: [e], - theme: n.platform, - editor: {}, - }); - case "directionChange": - return Zs.Single({ - id: `PlacingDirectionChange-${a}`, - directionChange: e, - theme: n.dirChange, - isEditor: true, - spineContext: spineContext, - paused: paused, - scale: scale, - }); - case "speedChange": - return er.Single({ - id: `PlacingSpeedChange-${a}`, - speedChange: e, - isEditor: true, - justHit: false, - theme: n.speedChange, - spineContext: spineContext, - paused: paused, - scale: scale, - }); - case "saw": - return eo.Single({ - id: `PlacingSaw-${a}`, - saws: [e], - theme: n.saw, - editor: {}, - bigTheme: n.spike, - }); - case "flag": - return ao.Single({ - id: `PlacingFlag-${a}`, - flag: e, - theme: n.flag, - spineContext: spineContext, - paused: paused, - scale: scale, - frame: frame, - }); - case "powerup": - return Co.Single({ - id: `PlacingPowerup-${a}`, - powerup: e, - skin: s, - isEditor: true, - theme: n.speedChange, - frame: frame, - spineContext: spineContext, - paused: paused, - scale: scale, - }); - case "enemy": - return yo.Single({ - id: `PlacingEnemy-${a}`, - enemy: e, - spineContext: spineContext, - frame: frame, - paused: paused, - scale: scale, - }); - case "switchButton": - return xo.Single({ - id: `PlacingSwitchButton-${a}`, - switchButton: e, - switchRotation: 0, - switchBlockSpikes: false, - isEditor: true, - justHit: false, - theme: n.switch, - orbTheme: t.properties.theme.id === "classic" ? "classic" : n.switch, - paused: paused, - spineContext: spineContext, - scale: scale, - playerScale: 1, - }); - case "switchPlatform": - return Po.Single({ - id: `PlacingSwitchPlatform-${a}`, - switchPlatforms: [e], - editor: {}, - theme: n.switch, - }); - case "collectible": - return qo.Single({ - id: `PlacingCollectible-${a}`, - wasPickedUp: false, - collectible: e, - isEditor: true, - theme: n.switch, - }); - case "spring": - return $o.Single({ - id: `PlacingSpring-${a}`, - spring: e, - justHit: false, - isEditor: true, - spineContext: spineContext, - paused: paused, - scale: scale, - }); - case "portal": - return Jo.Single({ - id: `PlacingPortal-${a}`, - portal: e, - isEditor: true, - theme: n.switch, - spineContext: spineContext, - paused: paused, - scale: scale, - }); - } - })(), - r, - ]; - } - function Jr(e, t, a) { - const i = Ca.removeObjects( - e, - t.map((e) => ({ - array: e.selectedObject.array, - index: e.selectedObject.index, - })), + : a || + 1 !== b.length || + (runHistory[i].switchBlockSpikes ? "spike" : "block") !== + b[0].type + ? null + : BlockProjection({ + id: "BlockProjection", + x: b[0].x, + y: b[0].y + b[0].height / 2 + 15, + levelSpeeds: u, + playerSpeedMultiplier: + runHistory[i].playerSpeedMultiplier, + playerScale: runHistory[i].playerScale, + }), + S && "spring" === S.type + ? SpringProjection({ + id: "SpringProjection", + x: S.x, + y: S.y + (S.height / 2) * S.direction + 15 * S.direction, + levelSpeeds: u, + playerSpeedMultiplier: + runHistory[i].playerSpeedMultiplier, + playerScale: runHistory[i].playerScale, + playerGradY: runHistory[i].playerGradY, + direction: S.direction, + }) + : a || 1 !== b.length || "spring" !== b[0].type + ? null + : SpringProjection({ + id: "SpringProjection", + x: b[0].x, + y: + b[0].y + + (b[0].height / 2) * b[0].direction + + 15 * b[0].direction, + levelSpeeds: u, + playerSpeedMultiplier: + runHistory[i].playerSpeedMultiplier, + playerScale: runHistory[i].playerScale, + playerGradY: runHistory[i].playerGradY, + direction: b[0].direction, + }), + ]; + }, + }), + qr = makePureSprite({ + shouldRerender: (e, t) => + e.runHistoryIndex !== t.runHistoryIndex || + e.playerSkin !== t.playerSkin, + render: ({ + props: { playerSkin: e, runHistory: t, runHistoryIndex: a }, + }) => { + return [ + ((n = { + fileName: `images/player/skins/${e.fileName}.png`, + props: t.map((t, i) => ({ + width: e.size, + height: e.size, + opacity: a === i ? 1 : 0.2, + x: t.playerX, + y: t.playerY, + rotation: t.playerRot, + scaleX: t.playerScaleX * t.playerDir, + scaleY: t.playerScaleY, + })), + }), + { + type: "imageArray", + fileName: n.fileName, + mask: n.mask || null, + props: n.props.map((e) => + i( + { testId: e.testId, width: e.width, height: e.height }, + e, + ), + ), + }), + ]; + var n; + }, + }); + function $r(e, t, a, i, frame, spineContext, paused, scale) { + const { objects: n } = t.properties.theme, + s = t.properties.theme.player, + r = i + ? o({ + color: "red", + width: e.width, + height: e.height, + x: e.x, + y: e.y, + opacity: 0.5, + }) + : null; + return [ + (() => { + switch (e.type) { + case "block": + return Ja.Single({ + id: `PlacingBlock-${a}`, + blocks: [e], + theme: n.block, + }); + case "spike": + return Za.Single({ + id: `PlacingSpike-${a}`, + spikes: [e], + theme: n.spike, + }); + case "platform": + return Qa.Single({ + id: `PlacingPlatform-${a}`, + platforms: [e], + theme: n.platform, + editor: {}, + }); + case "directionChange": + return Zs.Single({ + id: `PlacingDirectionChange-${a}`, + directionChange: e, + theme: n.dirChange, + isEditor: true, + spineContext: spineContext, + paused: paused, + scale: scale, + }); + case "speedChange": + return er.Single({ + id: `PlacingSpeedChange-${a}`, + speedChange: e, + isEditor: true, + justHit: false, + theme: n.speedChange, + spineContext: spineContext, + paused: paused, + scale: scale, + }); + case "saw": + return eo.Single({ + id: `PlacingSaw-${a}`, + saws: [e], + theme: n.saw, + editor: {}, + bigTheme: n.spike, + }); + case "flag": + return ao.Single({ + id: `PlacingFlag-${a}`, + flag: e, + theme: n.flag, + spineContext: spineContext, + paused: paused, + scale: scale, + frame: frame, + }); + case "powerup": + return Co.Single({ + id: `PlacingPowerup-${a}`, + powerup: e, + skin: s, + isEditor: true, + theme: n.speedChange, + frame: frame, + spineContext: spineContext, + paused: paused, + scale: scale, + }); + case "enemy": + return yo.Single({ + id: `PlacingEnemy-${a}`, + enemy: e, + spineContext: spineContext, + frame: frame, + paused: paused, + scale: scale, + }); + case "switchButton": + return xo.Single({ + id: `PlacingSwitchButton-${a}`, + switchButton: e, + switchRotation: 0, + switchBlockSpikes: false, + isEditor: true, + justHit: false, + theme: n.switch, + orbTheme: t.properties.theme.id === "classic" ? "classic" : n.switch, + paused: paused, + spineContext: spineContext, + scale: scale, + playerScale: 1, + }); + case "switchPlatform": + return Po.Single({ + id: `PlacingSwitchPlatform-${a}`, + switchPlatforms: [e], + editor: {}, + theme: n.switch, + }); + case "collectible": + return qo.Single({ + id: `PlacingCollectible-${a}`, + wasPickedUp: false, + collectible: e, + isEditor: true, + theme: n.switch, + }); + case "spring": + return $o.Single({ + id: `PlacingSpring-${a}`, + spring: e, + justHit: false, + isEditor: true, + spineContext: spineContext, + paused: paused, + scale: scale, + }); + case "portal": + return Jo.Single({ + id: `PlacingPortal-${a}`, + portal: e, + isEditor: true, + theme: n.switch, + spineContext: spineContext, + paused: paused, + scale: scale, + }); + } + })(), + r, + ]; + } + function Jr(e, t, a) { + const i = Ca.removeObjects( + e, + t.map((e) => ({ + array: e.selectedObject.array, + index: e.selectedObject.index, + })), + ), + n = t.map((t) => + $.updateXY( + e[t.selectedObject.array][t.selectedObject.index], + t.toX, + t.toY, ), - n = t.map((t) => - $.updateXY( - e[t.selectedObject.array][t.selectedObject.index], - t.toX, - t.toY, - ), + ); + Da.canPlaceLevelObjects(i, n) && + a({ + type: "moveObjects", + objects: t.map((e) => ({ + array: e.selectedObject.array, + index: e.selectedObject.index, + x: e.toX, + y: e.toY, + })), + }); + } + function Kr(e, t, a, i, n) { + for (const s in e) { + if ("properties" === s) continue; + const o = s, + r = e[o].findIndex((e) => + $.getRectangles(e).some((e) => be.pointInBox(e)(t)), ); - Da.canPlaceLevelObjects(i, n) && - a({ - type: "moveObjects", - objects: t.map((e) => ({ - array: e.selectedObject.array, - index: e.selectedObject.index, - x: e.toX, - y: e.toY, - })), + -1 !== r && + a(() => { + (i.audio("audio/editor/erase.wav").play({ overwrite: true }), + n({ + type: "eraseObjects", + objects: [{ array: o, index: r }], + })); }); } - function Kr(e, t, a, i, n) { - for (const s in e) { - if ("properties" === s) continue; - const o = s, - r = e[o].findIndex((e) => - $.getRectangles(e).some((e) => be.pointInBox(e)(t)), - ); - -1 !== r && - a(() => { - (i.audio("audio/editor/erase.wav").play({ overwrite: true }), - n({ - type: "eraseObjects", - objects: [{ array: o, index: r }], - })); - }); - } - } - const ScrollHandler = makeSprite({ - init({ props: e }) { - const t = (t) => - e.addToOnScrollQueue(() => { - 1 === t.deltaMode && e.onScaleDelta(t.deltaY * (100 / 6)); - 0 === t.deltaMode && e.onScaleDelta(t.deltaY); - }); - return ( - document.addEventListener("wheel", t, { passive: true }), - { onScroll: t } - ); - }, - render: () => [], - cleanup({ state: e }) { - document.removeEventListener("wheel", e.onScroll, { - passive: true, - }); - }, - }), - Zr = function (layout, boss, assets, state, playSound, pauseSound) { - return state - ? boss - ? Object.assign(Object.assign({}, state), { - bossState: - boss.mutatesState || !state.bossState - ? boss.initState({ - assets: assets, - checkpointState: state, - playSound: playSound, - pauseSound: pauseSound, - }) - : boss.cloneState(state.bossState), - }) - : state - : { - frame: 0, - attempt: 1, - playerScaleX: 1, - playerScaleY: 1, - justDownInputTimer: 0, - jumping: true, - playerX: et.initialPosition.x, - playerY: et.initialPosition.y, - playerOnGroundY: et.initialPosition.y, - playerWasOnGroundCooldown: 0, - playerGradY: 0, - playerRot: 0, - playerDir: 1, - playerSpeedMultiplier: 1, - playerPowerups: [], - isCompatible: true, - playerBullets: [], - playerJetpackFuel: 0, - playerUsingPowerup: false, - playerStacks: [], - playerStackIndex: 0, - explosions: [], - bottomLine: null, - collectibles: 0, - score: { local: 0, total: 0, multiplier: 0, fullCombo: true, perfectCombo: true }, - switchButtons: { on: false, rot: 0 }, - jumpSwitch: { on: false, ratio: 0, delay: 0, timeout: 0 }, - switchBlockSpikes: false, - touchingPortals: null, - justHitObject: null, - skateboardJumpCharge: 0, - checkpoint: { index: 0, state: null }, - bossState: - (null == boss - ? void 0 - : boss.initState({ - assets: assets, - checkpointState: null, - playSound: playSound, - pauseSound: pauseSound, - })) || null, - onObject: null, - cameraXOffset: 0, - cameraY: 0, - crashed: false, - finishedLevel: false, - frameCountSinceHistoryPush: 0, - layoutState: xa.getInitState(layout), - playerScale: 1, - bgColor: "#00FFFF", - flash: 0, - gravity: 1, - dashing: false, - isGravity: false, - fallTypes: [null, null], - flyingAnchor: null, - boosterDebug: { - autopilot: {}, - jumpIndicators: [], - } - }; - }, - el = function (e, t) { - return Object.assign(Object.assign({}, e), { layoutState: t }); - }, - tl = function (e, boss) { - return { - frame: e.frame, - attempt: e.attempt, - justDownInputTimer: e.justDownInputTimer, - jumping: e.jumping, - playerX: e.playerX, - playerY: e.playerY, - playerOnGroundY: e.playerOnGroundY, - playerWasOnGroundCooldown: e.playerWasOnGroundCooldown, - playerGradY: e.playerGradY, - playerRot: e.playerRot, - playerScaleX: e.playerScaleX, - playerScaleY: e.playerScaleY, - playerDir: e.playerDir, - playerSpeedMultiplier: e.playerSpeedMultiplier, - playerPowerups: [...e.playerPowerups], - isCompatible: e.isCompatible, - playerBullets: [...e.playerBullets], - playerJetpackFuel: e.playerJetpackFuel, - playerUsingPowerup: e.playerUsingPowerup, - playerStacks: [...e.playerStacks], - playerStackIndex: e.playerStackIndex, - explosions: [...e.explosions], - collectibles: e.collectibles, - score: "fullCombo" in e.score ? { - local: e.score.local, - total: e.score.total, - multiplier: e.score.multiplier, - fullCombo: e.score.fullCombo, - perfectCombo: e.score.perfectCombo - } : { - local: e.score.local, - total: e.score.total, - multiplier: e.score.multiplier, - fullCombo: true, - perfectCombo: true - }, - switchButtons: { - on: e.switchButtons.on, - rot: e.switchButtons.rot, - }, - jumpSwitch: { - on: e.jumpSwitch.on, - ratio: e.jumpSwitch.ratio, - delay: e.jumpSwitch.delay, - timeout: e.jumpSwitch.timeout, - }, - switchBlockSpikes: e.switchBlockSpikes, - bottomLine: e.bottomLine && { - minY: e.bottomLine.minY, - objects: [...e.bottomLine.objects], - }, - touchingPortals: e.touchingPortals, - justHitObject: e.justHitObject && { - array: e.justHitObject.array, - index: e.justHitObject.index, - }, - skateboardJumpCharge: e.skateboardJumpCharge, - checkpoint: { - index: e.checkpoint.index, - state: e.checkpoint.state, - }, + } + const ScrollHandler = makeSprite({ + init({ props: e }) { + const t = (t) => + e.addToOnScrollQueue(() => { + 1 === t.deltaMode && e.onScaleDelta(t.deltaY * (100 / 6)); + 0 === t.deltaMode && e.onScaleDelta(t.deltaY); + }); + return ( + document.addEventListener("wheel", t, { passive: true }), + { onScroll: t } + ); + }, + render: () => [], + cleanup({ state: e }) { + document.removeEventListener("wheel", e.onScroll, { + passive: true, + }); + }, + }), + Zr = function (layout, boss, assets, state, playSound, pauseSound) { + return state + ? boss + ? Object.assign(Object.assign({}, state), { + bossState: + boss.mutatesState || !state.bossState + ? boss.initState({ + assets: assets, + checkpointState: state, + playSound: playSound, + pauseSound: pauseSound, + }) + : boss.cloneState(state.bossState), + }) + : state + : { + frame: 0, + attempt: 1, + playerScaleX: 1, + playerScaleY: 1, + justDownInputTimer: 0, + jumping: true, + playerX: et.initialPosition.x, + playerY: et.initialPosition.y, + playerOnGroundY: et.initialPosition.y, + playerWasOnGroundCooldown: 0, + playerGradY: 0, + playerRot: 0, + playerDir: 1, + playerSpeedMultiplier: 1, + playerPowerups: [], + isCompatible: true, + playerBullets: [], + playerJetpackFuel: 0, + playerUsingPowerup: false, + playerStacks: [], + playerStackIndex: 0, + explosions: [], + bottomLine: null, + collectibles: 0, + score: { local: 0, total: 0, multiplier: 0, fullCombo: true, perfectCombo: true }, + switchButtons: { on: false, rot: 0 }, + jumpSwitch: { on: false, ratio: 0, delay: 0, timeout: 0 }, + switchBlockSpikes: false, + touchingPortals: null, + justHitObject: null, + skateboardJumpCharge: 0, + checkpoint: { index: 0, state: null }, bossState: - boss && e.bossState - ? boss.cloneState(e.bossState) - : e.bossState, - onObject: e.onObject && { - array: e.onObject.array, - index: e.onObject.index, - y: e.onObject.y, - }, - cameraXOffset: e.cameraXOffset, - cameraY: e.cameraY, - crashed: e.crashed, - finishedLevel: e.finishedLevel, - frameCountSinceHistoryPush: e.frameCountSinceHistoryPush, - layoutState: xa.clone(e.layoutState), - playerScale: e.playerScale, - bgColor: e.bgColor, - flash: e.flash, - gravity: e.gravity, - dashing: e.dashing, - isGravity: e.isGravity, - fallTypes: [e.fallTypes[0], e.fallTypes[1]], - flyingAnchor: e.flyingAnchor, - boosterDebug: e.boosterDebug && { - autopilot: Object.assign({}, e.boosterDebug.autopilot), - jumpIndicators: e.boosterDebug.jumpIndicators.map((indicator) => Object.assign({}, indicator)), + (null == boss + ? void 0 + : boss.initState({ + assets: assets, + checkpointState: null, + playSound: playSound, + pauseSound: pauseSound, + })) || null, + onObject: null, + cameraXOffset: 0, + cameraY: 0, + crashed: false, + finishedLevel: false, + frameCountSinceHistoryPush: 0, + layoutState: xa.getInitState(layout), + playerScale: 1, + bgColor: "#00FFFF", + flash: 0, + gravity: 1, + dashing: false, + isGravity: false, + fallTypes: [null, null], + flyingAnchor: null, + boosterDebug: { + autopilot: {}, + jumpIndicators: [], } }; - }, - menuButtonSprite = makeSprite({ - render: ({ props: e, device }) => [ - conditional( - () => e.hidden, - () => [ - _e.Single({ - onPress: e.onPress, - width: 50, - height: 50, - sprites: (t) => [ - bgOnly || showcaseOnly - ? null - : c({ - font: { - family: - e.theme == "classic" ? "Akashi" : "Montserrat", - size: 8, - style: "italic", - }, - text: localize("MENU"), - rotation: -8, - color: t ? Ae : Be, - strokeColor: Te, - strokeThickness: 2, - opacity: 0.3, - }), - ], - }), - ], - () => - isSpecialTheme(e.theme) - ? [ - _e.Single({ - width: 50, - height: 28, - onPress: () => { - (device.audio("audio/global/button.wav").play(0), - e.onPress()); - }, - sprites: (t) => [ - conditional( - () => e.theme === "infinite", - () => [ - p( - { - width: 50, - height: 28, - color: e.background, - }, - (a) => { - a.color = getInfiniteThemeColors(e.background); - a.opacity = t ? 0.5 : 1 - }, - ), - c({ - font: { - family: - "Poppins", - size: 10, - }, - text: "Menu", - color: infiniteBgTable(0, e.background), - }, (a) => { - a.color = infiniteBgTable(0, e.background) - }), - ], - () => [ - y({ - fileName: `images/themes/${e.theme}/menu-button.png`, - width: 50, - height: 28, - }, (a) => { - a.opacity = t ? 0.5 : 1 - }) - ] - ), + }, + el = function (e, t) { + return Object.assign(Object.assign({}, e), { layoutState: t }); + }, + tl = function (e, boss) { + return { + frame: e.frame, + attempt: e.attempt, + justDownInputTimer: e.justDownInputTimer, + jumping: e.jumping, + playerX: e.playerX, + playerY: e.playerY, + playerOnGroundY: e.playerOnGroundY, + playerWasOnGroundCooldown: e.playerWasOnGroundCooldown, + playerGradY: e.playerGradY, + playerRot: e.playerRot, + playerScaleX: e.playerScaleX, + playerScaleY: e.playerScaleY, + playerDir: e.playerDir, + playerSpeedMultiplier: e.playerSpeedMultiplier, + playerPowerups: [...e.playerPowerups], + isCompatible: e.isCompatible, + playerBullets: [...e.playerBullets], + playerJetpackFuel: e.playerJetpackFuel, + playerUsingPowerup: e.playerUsingPowerup, + playerStacks: [...e.playerStacks], + playerStackIndex: e.playerStackIndex, + explosions: [...e.explosions], + collectibles: e.collectibles, + score: "fullCombo" in e.score ? { + local: e.score.local, + total: e.score.total, + multiplier: e.score.multiplier, + fullCombo: e.score.fullCombo, + perfectCombo: e.score.perfectCombo + } : { + local: e.score.local, + total: e.score.total, + multiplier: e.score.multiplier, + fullCombo: true, + perfectCombo: true + }, + switchButtons: { + on: e.switchButtons.on, + rot: e.switchButtons.rot, + }, + jumpSwitch: { + on: e.jumpSwitch.on, + ratio: e.jumpSwitch.ratio, + delay: e.jumpSwitch.delay, + timeout: e.jumpSwitch.timeout, + }, + switchBlockSpikes: e.switchBlockSpikes, + bottomLine: e.bottomLine && { + minY: e.bottomLine.minY, + objects: [...e.bottomLine.objects], + }, + touchingPortals: e.touchingPortals, + justHitObject: e.justHitObject && { + array: e.justHitObject.array, + index: e.justHitObject.index, + }, + skateboardJumpCharge: e.skateboardJumpCharge, + checkpoint: { + index: e.checkpoint.index, + state: e.checkpoint.state, + }, + bossState: + boss && e.bossState + ? boss.cloneState(e.bossState) + : e.bossState, + onObject: e.onObject && { + array: e.onObject.array, + index: e.onObject.index, + y: e.onObject.y, + }, + cameraXOffset: e.cameraXOffset, + cameraY: e.cameraY, + crashed: e.crashed, + finishedLevel: e.finishedLevel, + frameCountSinceHistoryPush: e.frameCountSinceHistoryPush, + layoutState: xa.clone(e.layoutState), + playerScale: e.playerScale, + bgColor: e.bgColor, + flash: e.flash, + gravity: e.gravity, + dashing: e.dashing, + isGravity: e.isGravity, + fallTypes: [e.fallTypes[0], e.fallTypes[1]], + flyingAnchor: e.flyingAnchor, + boosterDebug: e.boosterDebug && { + autopilot: Object.assign({}, e.boosterDebug.autopilot), + jumpIndicators: e.boosterDebug.jumpIndicators.map((indicator) => Object.assign({}, indicator)), + } + }; + }, + menuButtonSprite = makeSprite({ + render: ({ props: e, device }) => [ + conditional( + () => e.hidden, + () => [ + _e.Single({ + onPress: e.onPress, + width: 50, + height: 50, + sprites: (t) => [ + bgOnly || showcaseOnly + ? null + : c({ + font: { + family: + e.theme == "classic" ? "Akashi" : "Montserrat", + size: 8, + style: "italic", + }, + text: localize("MENU"), + rotation: -8, + color: t ? Ae : Be, + strokeColor: Te, + strokeThickness: 2, + opacity: 0.3, + }), + ], + }), + ], + () => + isSpecialTheme(e.theme) + ? [ + _e.Single({ + width: 50, + height: 28, + onPress: () => { + (device.audio("audio/global/button.wav").play(0), + e.onPress()); + }, + sprites: (t) => [ + conditional( + () => e.theme === "infinite", + () => [ + p( + { + width: 50, + height: 28, + color: e.background, + }, + (a) => { + a.color = getInfiniteThemeColors(e.background); + a.opacity = t ? 0.5 : 1 + }, + ), + c({ + font: { + family: + "Poppins", + size: 10, + }, + text: "Menu", + color: infiniteBgTable(0, e.background), + }, (a) => { + a.color = infiniteBgTable(0, e.background) + }), ], - }), - ] - : [ - Je.Single({ - width: 50, - height: 50, - onPress: e.onPress, - text: localize("MENU"), - }), + () => [ + y({ + fileName: `images/themes/${e.theme}/menu-button.png`, + width: 50, + height: 28, + }, (a) => { + a.opacity = t ? 0.5 : 1 + }) + ] + ), ], - ), - ], - }), - il = {}, - nl = function ( - e, - t, - a, - i, - n, - grad, - o, - r, - l, - c, - d, - gravity, - isGravity, - dashing, - ) { - // n is player dir - //console.warn(n); - ((il.touchingPortals = void 0), - (il.crashed = void 0), - (il.teleport = void 0)); - const u = e.findIndex(c); - if (-1 === u) return il; - const h = e[u], - p = t.find((e) => e.pairId === h.pairId && e.pair !== h.pair); - if (!p) return il; - const g = [h, p]; - if ("left" === h.direction && a > h.x) { - if (!l || -1 === n) return ((il.crashed = true), il); - } else if ("right" === h.direction && a < h.x) { - if (!l || 1 === n) return ((il.crashed = true), il); - } else if ("up" === h.direction && i < h.y) { - if (!l) return ((il.crashed = true), il); - } else { - if (!("down" === h.direction && i > h.y)) - return ((il.touchingPortals = g), il); - if (!l) return ((il.crashed = true), il); - } - if (p.direction == "up" || p.direction == "down") { - dashing = false; - } - switch (`${h.direction}-${p.direction}`) { - case "left-right": - case "right-left": - ((a = p.x + (a - h.x)), (i = p.y + (i - h.y))); - break; - case "left-left": - case "right-right": - ((a = p.x - (a - h.x)), (i = p.y + (i - h.y)), (n *= -1)); - break; - case "left-up": - case "right-up": - ((a = p.x), - (i = p.y), - (grad = G.initGrad(r)), - (grad += G.incGrad(o) * (1 - d))); - break; - case "left-down": - case "right-down": - ((a = p.x), (i = p.y), (grad = 0)); - break; - case "up-left": - case "down-left": - ((i = p.y + (a - h.x)), - (a = p.x), - (n = -1), - (grad = - gravity > 0 - ? 0 - : -(G.initGrad(r) + G.incGrad(o) * (1 - d)))); - break; - case "up-right": - case "down-right": - ((i = p.y + (a - h.x)), (a = p.x), (n = 1), (grad = 0)); - break; - case "up-up": - case "down-up": - ((grad += G.incGrad(o) * (1 - d)), - (a = p.x + (a - h.x)), - (i = p.y), - (grad = Math.max(Math.abs(grad), G.initGrad(r)))); - isGravity && (gravity = -1); - break; - case "up-down": - case "down-down": - ((grad += G.incGrad(o) * (1 - d)), - (a = p.x + (a - h.x)), - (i = p.y), - (grad = Math.min(-Math.abs(grad), -r / 5))); - gravity = 1; - } - return ( - (il.touchingPortals = [g[1], g[0]]), - (il.teleport = { - playerGradY: grad, - playerX: a, - playerY: i, - playerDir: n, - gravity: gravity, - dashing: dashing, - portalY: p.y, - }), - il - ); - }, - sl = M, - ol = []; - function rl( - landableObjects, + }), + ] + : [ + Je.Single({ + width: 50, + height: 50, + onPress: e.onPress, + text: localize("MENU"), + }), + ], + ), + ], + }), + il = {}, + nl = function ( + e, t, a, i, n, - s, + grad, o, r, l, c, d, - u, - skating, - p, gravity, - hObj, - invincible, + isGravity, + dashing, ) { - let crashed = d, - onGroundY = u; - if (gravity < 0 && hObj?.object) { - const e = (l > 45 && l < 135) || (l > 225 && l < 315) ? o : r, - t = - be[gravity > 0 ? "getObjectTopY" : "getObjectBottomY"]( - hObj.object, - a, - i, - ) + - (15 + (skating && gravity < 0 ? $.skateboardHeight : 0)) * - e * - gravity; - return { crashed: false, onGroundY: t, hitObject: hObj }; - } - const f = de.getPlayerPoly( - a, - i, - o, - r, - l, - skating, - de.pooledPlayerPoly3, + // n is player dir + //console.warn(n); + ((il.touchingPortals = void 0), + (il.crashed = void 0), + (il.teleport = void 0)); + const u = e.findIndex(c); + if (-1 === u) return il; + const h = e[u], + p = t.find((e) => e.pairId === h.pairId && e.pair !== h.pair); + if (!p) return il; + const g = [h, p]; + if ("left" === h.direction && a > h.x) { + if (!l || -1 === n) return ((il.crashed = true), il); + } else if ("right" === h.direction && a < h.x) { + if (!l || 1 === n) return ((il.crashed = true), il); + } else if ("up" === h.direction && i < h.y) { + if (!l) return ((il.crashed = true), il); + } else { + if (!("down" === h.direction && i > h.y)) + return ((il.touchingPortals = g), il); + if (!l) return ((il.crashed = true), il); + } + if (p.direction == "up" || p.direction == "down") { + dashing = false; + } + switch (`${h.direction}-${p.direction}`) { + case "left-right": + case "right-left": + ((a = p.x + (a - h.x)), (i = p.y + (i - h.y))); + break; + case "left-left": + case "right-right": + ((a = p.x - (a - h.x)), (i = p.y + (i - h.y)), (n *= -1)); + break; + case "left-up": + case "right-up": + ((a = p.x), + (i = p.y), + (grad = G.initGrad(r)), + (grad += G.incGrad(o) * (1 - d))); + break; + case "left-down": + case "right-down": + ((a = p.x), (i = p.y), (grad = 0)); + break; + case "up-left": + case "down-left": + ((i = p.y + (a - h.x)), + (a = p.x), + (n = -1), + (grad = + gravity > 0 + ? 0 + : -(G.initGrad(r) + G.incGrad(o) * (1 - d)))); + break; + case "up-right": + case "down-right": + ((i = p.y + (a - h.x)), (a = p.x), (n = 1), (grad = 0)); + break; + case "up-up": + case "down-up": + ((grad += G.incGrad(o) * (1 - d)), + (a = p.x + (a - h.x)), + (i = p.y), + (grad = Math.max(Math.abs(grad), G.initGrad(r)))); + isGravity && (gravity = -1); + break; + case "up-down": + case "down-down": + ((grad += G.incGrad(o) * (1 - d)), + (a = p.x + (a - h.x)), + (i = p.y), + (grad = Math.min(-Math.abs(grad), -r / 5))); + gravity = 1; + } + return ( + (il.touchingPortals = [g[1], g[0]]), + (il.teleport = { + playerGradY: grad, + playerX: a, + playerY: i, + playerDir: n, + gravity: gravity, + dashing: dashing, + portalY: p.y, + }), + il ); - let y = 0; - for (let s = 0; s < landableObjects.length; s++) { - if (!ha(landableObjects[s].object, a)) { - continue; // ugh... I wish this wasn't needed. It's really just to optimize. - } - const { object: d, index: u } = landableObjects[s], - h = be.hitLandableObject( + }, + sl = M, + ol = []; + function rl( + landableObjects, + t, + a, + i, + n, + s, + o, + r, + l, + c, + d, + u, + skating, + p, + gravity, + hObj, + invincible, + ) { + let crashed = d, + onGroundY = u; + if (gravity < 0 && hObj?.object) { + const e = (l > 45 && l < 135) || (l > 225 && l < 315) ? o : r, + t = + be[gravity > 0 ? "getObjectTopY" : "getObjectBottomY"]( + hObj.object, a, i, - n, - o, - r, - l, - c, - d, - f, - p, - gravity, - invincible, - ); - if (null !== h) { - let e = d.array; - p && - ("blocks" === e - ? (e = "spikes") - : "spikes" === e && (e = "blocks")); - const a = t[e][u]; - (y >= ol.length - ? ol.push({ object: d, result: h, index: a }) - : ((ol[y].object = d), (ol[y].result = h), (ol[y].index = a)), - y++); - } + ) + + (15 + (skating && gravity < 0 ? $.skateboardHeight : 0)) * + e * + gravity; + return { crashed: false, onGroundY: t, hitObject: hObj }; + } + const f = de.getPlayerPoly( + a, + i, + o, + r, + l, + skating, + de.pooledPlayerPoly3, + ); + let y = 0; + for (let s = 0; s < landableObjects.length; s++) { + if (!ha(landableObjects[s].object, a)) { + continue; // ugh... I wish this wasn't needed. It's really just to optimize. } - (y < ol.length && (ol.length = y), - ol.sort(({ result: e, object: t }, { result: a, object: i }) => { - const n = { - crashed: 3, - hitMidLine: 2, - hitBottomEdges: 1, - noHit: 0, - }; - return "hitBottomEdges" === a.type && "hitBottomEdges" === e.type - ? a.rotatePoint.x - e.rotatePoint.x - : e.type === a.type - ? i.y - t.y - : n[a.type] - n[e.type]; - })); - const hitObject = ol[0]; - const hitBottomEdge = () => { - const e = be.handlePlayerHitBottomEdge( + const { object: d, index: u } = landableObjects[s], + h = be.hitLandableObject( a, i, + n, o, r, l, - n, - s, c, - hitObject.object, + d, f, p, gravity, invincible, ); - if (gravity > 0) { - e.crashed - ? (crashed = true) - : (onGroundY = - e.y + (skating && gravity < 0 ? $.skateboardHeight : 0)); - } else { - e.crashed - ? (crashed = false) - : (onGroundY = - e.y + (skating && gravity < 0 ? $.skateboardHeight : 0)); - } - }; - if (hitObject) { - const e = (l > 45 && l < 135) || (l > 225 && l < 315) ? o : r, - t = - be[gravity > 0 ? "getObjectTopY" : "getObjectBottomY"]( - hitObject.object, - a, - i, - ) + - (15 + (skating && gravity < 0 ? $.skateboardHeight : 0)) * - e * - gravity; - switch (hitObject.result.type) { - case "crashed": - gravity > 0 ? (crashed = true) : hitBottomEdge(); - break; - case "hitMidLine": - onGroundY = t; - break; - case "hitBottomEdges": - gravity > 0 ? hitBottomEdge() : (crashed = true); - } + if (null !== h) { + let e = d.array; + p && + ("blocks" === e + ? (e = "spikes") + : "spikes" === e && (e = "blocks")); + const a = t[e][u]; + (y >= ol.length + ? ol.push({ object: d, result: h, index: a }) + : ((ol[y].object = d), (ol[y].result = h), (ol[y].index = a)), + y++); } - return ( - (ll.crashed = !invincible && crashed), - (ll.onGroundY = onGroundY), - (ll.hitObject = hitObject), - ll + } + (y < ol.length && (ol.length = y), + ol.sort(({ result: e, object: t }, { result: a, object: i }) => { + const n = { + crashed: 3, + hitMidLine: 2, + hitBottomEdges: 1, + noHit: 0, + }; + return "hitBottomEdges" === a.type && "hitBottomEdges" === e.type + ? a.rotatePoint.x - e.rotatePoint.x + : e.type === a.type + ? i.y - t.y + : n[a.type] - n[e.type]; + })); + const hitObject = ol[0]; + const hitBottomEdge = () => { + const e = be.handlePlayerHitBottomEdge( + a, + i, + o, + r, + l, + n, + s, + c, + hitObject.object, + f, + p, + gravity, + invincible, ); + if (gravity > 0) { + e.crashed + ? (crashed = true) + : (onGroundY = + e.y + (skating && gravity < 0 ? $.skateboardHeight : 0)); + } else { + e.crashed + ? (crashed = false) + : (onGroundY = + e.y + (skating && gravity < 0 ? $.skateboardHeight : 0)); + } + }; + if (hitObject) { + const e = (l > 45 && l < 135) || (l > 225 && l < 315) ? o : r, + t = + be[gravity > 0 ? "getObjectTopY" : "getObjectBottomY"]( + hitObject.object, + a, + i, + ) + + (15 + (skating && gravity < 0 ? $.skateboardHeight : 0)) * + e * + gravity; + switch (hitObject.result.type) { + case "crashed": + gravity > 0 ? (crashed = true) : hitBottomEdge(); + break; + case "hitMidLine": + onGroundY = t; + break; + case "hitBottomEdges": + gravity > 0 ? hitBottomEdge() : (crashed = true); + } } - const ll = {}; - function cl( - e, - t, - levelSpeed, - jumpFrames, - n, - inViewLayout, - o, - r, - landableObjects, - deadlyObjects, - d, - u, - jumpHeight, - ) { - if (e.playerBullets) { - for (let a = 0; a < e.playerBullets.length; a++) { - const i = e.playerBullets[a]; - e.playerBullets[a] = Object.assign(Object.assign({}, i), { - x: i.x + (i.frame > 0 ? 0 : i.speed * t), - }); - } - lt( - e.playerBullets, - (t) => t.x < e.playerX + 950 && t.x > e.playerX - 950, - ); + return ( + (ll.crashed = !invincible && crashed), + (ll.onGroundY = onGroundY), + (ll.hitObject = hitObject), + ll + ); + } + const ll = {}; + function cl( + e, + t, + levelSpeed, + jumpFrames, + n, + inViewLayout, + o, + r, + landableObjects, + deadlyObjects, + d, + u, + jumpHeight, + ) { + if (e.playerBullets) { + for (let a = 0; a < e.playerBullets.length; a++) { + const i = e.playerBullets[a]; + e.playerBullets[a] = Object.assign(Object.assign({}, i), { + x: i.x + (i.frame > 0 ? 0 : i.speed * t), + }); } - (n.boss && - e.bossState && - (n.boss.loop({ - bossState: e.bossState, + lt( + e.playerBullets, + (t) => t.x < e.playerX + 950 && t.x > e.playerX - 950, + ); + } + (n.boss && + e.bossState && + (n.boss.loop({ + bossState: e.bossState, + playerX: e.playerX, + playerY: e.playerY, + playerBullets: e.playerBullets, + playerOnGroundY: e.playerOnGroundY, + frame: e.frame, + speed: levelSpeed, + df: t, + playSound: (null == u ? void 0 : u.playSound) || (() => null), + crashed: e.crashed, + rectangleHitPlayer: d, + }), + !e.crashed && + n.boss.crashed({ playerX: e.playerX, playerY: e.playerY, - playerBullets: e.playerBullets, - playerOnGroundY: e.playerOnGroundY, + playerRot: e.playerRot, frame: e.frame, - speed: levelSpeed, - df: t, - playSound: (null == u ? void 0 : u.playSound) || (() => null), - crashed: e.crashed, + bossState: e.bossState, rectangleHitPlayer: d, - }), - !e.crashed && - n.boss.crashed({ - playerX: e.playerX, - playerY: e.playerY, - playerRot: e.playerRot, - frame: e.frame, - bossState: e.bossState, - rectangleHitPlayer: d, - inViewLayout: inViewLayout, - inViewLayoutState: o, - fullLayoutState: e.layoutState, - fullLayoutStateIndexes: r, - }) && - (e.crashed = true)), - (e.crashed = mo.updateEnemies( - e.frame, - landableObjects, - deadlyObjects, - o.enemies, - inViewLayout.enemies, - n.layout.enemies, - r.enemies, - e.playerX, - e.playerOnGroundY, - e.playerDir, - e.crashed, - levelSpeed, - jumpFrames, - t, - null !== e.bossState, - d, - null == u ? void 0 : u.enemyShoot, - e.layoutState, - o, - r, - e.bottomLine?.objects || [], - e.playerSpeedMultiplier, - inViewLayout.springs.map((e, t) => ({ object: e, index: t })), - jumpHeight, - ))); + inViewLayout: inViewLayout, + inViewLayoutState: o, + fullLayoutState: e.layoutState, + fullLayoutStateIndexes: r, + }) && + (e.crashed = true)), + (e.crashed = mo.updateEnemies( + e.frame, + landableObjects, + deadlyObjects, + o.enemies, + inViewLayout.enemies, + n.layout.enemies, + r.enemies, + e.playerX, + e.playerOnGroundY, + e.playerDir, + e.crashed, + levelSpeed, + jumpFrames, + t, + null !== e.bossState, + d, + null == u ? void 0 : u.enemyShoot, + e.layoutState, + o, + r, + e.bottomLine?.objects || [], + e.playerSpeedMultiplier, + inViewLayout.springs.map((e, t) => ({ object: e, index: t })), + jumpHeight, + ))); + } + const dl = function (e) { + + var t, a, i, n, s, o, r, l, c, d, u, h, p, g, m, f, y, E, b, S; + const { + playerInput, + level: _, + sfx: v, + onCrash, + onReachedCheckpoint: R, + onReset: O, + levelSpeeds: { jumpFrames: C, speed: w, coefficients: A }, + df, + shouldResetOnCrash: N, + waitAtCheckpoint: x, + booster: booster, + mutValues: L, + bigMutValues: D, + animationAssets: F, + bottomLineTheme, + disableReleaseBuffer, + useBoosterDebug, + } = e, + { levelState: U } = L; + if (!useBoosterDebug || N) { + U.boosterDebug = null; + }; + if (!("fullCombo" in U.score)) { + U.score.fullCombo = true; + U.score.perfectCombo = true; } - const dl = function (e) { - - var t, a, i, n, s, o, r, l, c, d, u, h, p, g, m, f, y, E, b, S; - const { - playerInput, - level: _, - sfx: v, - onCrash, - onReachedCheckpoint: R, - onReset: O, - levelSpeeds: { jumpFrames: C, speed: w, coefficients: A }, + U.frame += df; + const { a: j, b: V } = A; + if (U.boosterDebug) { + if (playerInput === "justDown") { + U.boosterDebug.autopilot[U.frame] = 1; + } else if (playerInput === "up" && Object.values(U.boosterDebug.autopilot).at(-1) === 1) { + U.boosterDebug.autopilot[U.frame] = 0; + }; + } + L.blockJumpUntilReleased && + "up" === playerInput && + (L.blockJumpUntilReleased = false); + let isDown = + ("up" !== playerInput || U.justDownInputTimer > 0) && + !L.blockJumpUntilReleased; + const skating = U.playerPowerups.some( + (e) => e.item === "skateboard", + ); + const pastPlayerOnGroundY = U.playerOnGroundY; + (U.justDownInputTimer > 0 && + (disableReleaseBuffer + ? ("up" == playerInput && (U.justDownInputTimer = 0), + "up" !== playerInput) + : true) && + U.justDownInputTimer--, + "justDown" !== playerInput || + (skating ? void 0 : (U.justDownInputTimer = 10))); + const inViewLayout = + (null == D ? void 0 : D.inViewLayout) || + Ca.getEmptyLayout(_.layout.properties), + inViewLayoutState = + (null == D ? void 0 : D.inViewLayoutState) || + xa.getInitState(inViewLayout), + fullLayoutStateIndexes = + (null == D ? void 0 : D.fullLayoutStateIndexes) || + xa.getEmptyStateIndexes(); + if ( + (Ca.setInViewLayoutAndState( + _.layout, + U.frame, + C, + U.playerX, + U.playerY, + U.layoutState, + U.switchButtons.rot, + U.jumpSwitch.ratio, + U.switchBlockSpikes, + L.layoutFirstIndexes, + inViewLayout, + inViewLayoutState, + fullLayoutStateIndexes, + U.fallTypes, + ), + x) + ) + return void (U.frame -= df); + if (U.crashed || U.finishedLevel) { + if ( + (null !== L.resetTimer && L.resetTimer--, + cl( + U, df, - shouldResetOnCrash: N, - waitAtCheckpoint: x, - booster: booster, - mutValues: L, - bigMutValues: D, - animationAssets: F, - bottomLineTheme, - disableReleaseBuffer, - useBoosterDebug, - } = e, - { levelState: U } = L; - if (!useBoosterDebug || N) { - U.boosterDebug = null; - }; - if (!("fullCombo" in U.score)) { - U.score.fullCombo = true; - U.score.perfectCombo = true; - } - U.frame += df; - const { a: j, b: V } = A; - if (U.boosterDebug) { - if (playerInput === "justDown") { - U.boosterDebug.autopilot[U.frame] = 1; - } else if (playerInput === "up" && Object.values(U.boosterDebug.autopilot).at(-1) === 1) { - U.boosterDebug.autopilot[U.frame] = 0; - }; - } - L.blockJumpUntilReleased && - "up" === playerInput && - (L.blockJumpUntilReleased = false); - let isDown = - ("up" !== playerInput || U.justDownInputTimer > 0) && - !L.blockJumpUntilReleased; - const skating = U.playerPowerups.some( - (e) => e.item === "skateboard", + w, + C, + _, + inViewLayout, + inViewLayoutState, + fullLayoutStateIndexes, + Ca.getAllLandableObjects( + inViewLayout, + inViewLayoutState, + skating, + ), + Ca.getAllDeadlyObjects(inViewLayout, inViewLayoutState), + () => false, + v, + V, + ), + U.playerBullets && + xa.updateHitBulletState( + U.frame, + inViewLayout, + inViewLayoutState, + U.playerBullets, + U.layoutState, + fullLayoutStateIndexes, + U.switchBlockSpikes, + ), + 0 === L.resetTimer && N) + ) { + const lastCheckpointState = L.checkpoints.at(-1)?.state || {}; + const useCheckpointState = (lastCheckpointState?.frame || 0) > (U.checkpoint?.state?.frame || 0); + const e = Zr( + _.layout, + _.boss, + F, + useCheckpointState ? lastCheckpointState : U.checkpoint.state, + null == v ? void 0 : v.playSound, + null == v ? void 0 : v.pauseSound, ); - const pastPlayerOnGroundY = U.playerOnGroundY; - (U.justDownInputTimer > 0 && - (disableReleaseBuffer - ? ("up" == playerInput && (U.justDownInputTimer = 0), - "up" !== playerInput) - : true) && - U.justDownInputTimer--, - "justDown" !== playerInput || - (skating ? void 0 : (U.justDownInputTimer = 10))); - const inViewLayout = - (null == D ? void 0 : D.inViewLayout) || - Ca.getEmptyLayout(_.layout.properties), - inViewLayoutState = - (null == D ? void 0 : D.inViewLayoutState) || - xa.getInitState(inViewLayout), - fullLayoutStateIndexes = - (null == D ? void 0 : D.fullLayoutStateIndexes) || - xa.getEmptyStateIndexes(); - if ( - (Ca.setInViewLayoutAndState( + O(e.frame, U.checkpoint.index); + const t = Ca.getInitFirstIndexes(); + return ( + Ca.setInViewLayoutAndState( _.layout, - U.frame, + e.frame, C, - U.playerX, - U.playerY, - U.layoutState, - U.switchButtons.rot, - U.jumpSwitch.ratio, + e.playerX, + e.playerY, + e.layoutState, + e.switchButtons.rot, + e.jumpSwitch.ratio, U.switchBlockSpikes, - L.layoutFirstIndexes, + t, inViewLayout, inViewLayoutState, fullLayoutStateIndexes, - U.fallTypes, + e.fallTypes, ), - x) + (e.attempt = U.attempt + 1), + (useCheckpointState || (e.checkpoint = { + index: U.checkpoint.index, + state: tl(e, _.boss), + })), + (L.levelState = tl(e, _.boss)), + (L.blockJumpUntilReleased = false), + (L.landTimer = 0), + (L.resetTimer = null), + void (L.layoutFirstIndexes = t) + ); + } + return; + } + U.playerX += + w * + U.playerSpeedMultiplier * + df * + U.playerDir * + (skating ? 1.5 : 1); + let J = false; + U.playerUsingPowerup = false; + const K = U.switchBlockSpikes; + const previousJustHitObject = U.justHitObject; + U.justHitObject = null; + if ( + null === (a = _.boss) || void 0 === a + ? void 0 + : a.overrideMovement + ) { + const e = _.boss.overrideMovement( + { playerX: U.playerX, playerY: U.playerY, jumping: U.jumping }, + df, + w, + playerInput, + U.frame, + ); + ((U.playerY = e.playerY), + (U.playerX = e.playerX), + (U.jumping = e.jumping)); + } else { + if (isDown) { + const e = + U.justDownInputTimer > 0 || "justDown" === playerInput, + t = e + ? (e, t, a) => be.rectTouchesRect2(e, U.playerY, t, M, a) + : null, + a = + e && + inViewLayout.collectibles.some((e, a) => { + var i; + if ("arrow" === e.form) + return inViewLayoutState.collectibles[a].wasPickedUp + ? void 0 + : (null == t ? void 0 : t(U.playerX - 10, 70, e)) || + (U.playerPowerups.some( + (e) => e.item === "playerStack", + ) && + be.hitStack( + e, + U.playerX - 10, + U.playerStacks, + 70, + )); + }), + toggleGravity = inViewLayout.switchButtons.findIndex( + (button) => + button.affects == "gravity" && + be.hitObject( + U.playerX, + U.playerY, + U.playerScaleX * 0.99, + U.playerScaleY * 0.99, + U.dashing ? 0 : U.playerRot, + skating, + K, + )(button), + ); + U.dashing && + e && + ((U.dashing = false), + (U.jumping = true), + (U.boosterDebug && (U.boosterDebug.jumpIndicators.push({ x: U.playerX, y: U.playerY, inAir: true }))), + (U.playerPowerups.length === 0 && + !U.playerPowerups.some((e) => e.item === "playerStack") && + (L.blockJumpUntilReleased = true), + (isDown = false), + (U.justDownInputTimer = 0))); + if (a) + ((L.blockJumpUntilReleased = true), + (isDown = false), + (U.justDownInputTimer = 0), + inViewLayout.collectibles.forEach((e, a) => { + var i, n; + if (!inViewLayoutState.collectibles[a].wasPickedUp) + if ( + (null == t ? void 0 : t(U.playerX, 50, e)) || + (U.playerPowerups.some( + (e) => e.item === "playerStack", + ) && + be.hitStack(e, U.playerX, U.playerStacks, 50)) + ) { + const t = Math.abs(e.x - U.playerX), + i = zo.hitArrow(U.score, t, w); + xa.updateLayoutStateField( + "collectibles", + a, + { + type: "collectibleState", + wasPickedUp: true, + score: i, + }, + U.layoutState, + inViewLayoutState, + fullLayoutStateIndexes, + K, + ); + } else + ((null == t ? void 0 : t(U.playerX - M, M, e)) || + (U.playerPowerups.some( + (e) => e.item === "playerStack", + ) && + be.hitStack(e, U.playerX - M, U.playerStacks))) && + ((U.score.perfectCombo = false), (U.score.fullCombo = false), (U.score.multiplier = 0), + xa.updateLayoutStateField( + "collectibles", + a, + { type: "collectibleState", wasPickedUp: true }, + U.layoutState, + inViewLayoutState, + fullLayoutStateIndexes, + K, + )); + })); + else if (e && toggleGravity > -1) { + var g = inViewLayout.switchButtons[toggleGravity].gravity; + U.justHitObject = { + array: "switchButtons", + index: toggleGravity, + }; + U.dashing = false; + if (g < 2) { + (g == 0 + ? (U.dashing = true) + : ((U.gravity = g), (U.isGravity = true)), + (U.playerGradY = G.initGrad(V) * -2 * U.gravity), + (L.blockJumpUntilReleased = true), + (isDown = false), + (U.justDownInputTimer = 0)); + } else { + ( + (U.playerGradY = G.initGrad(V)), + (U.jumping = true), + (U.boosterDebug && (U.boosterDebug.jumpIndicators.push({ x: U.playerX, y: U.playerY }))), + (U.jumpSwitch.on = !U.jumpSwitch.on), + (U.jumpSwitch.delay = 2), + (U.justDownInputTimer = 0), + null == v || v.jump(false)); + }; + } else if ( + e && + "punch" === + (null === (i = U.playerPowerups[0]) || void 0 === i + ? void 0 + : i.item) ) - return void (U.frame -= df); - if (U.crashed || U.finishedLevel) { - if ( - (null !== L.resetTimer && L.resetTimer--, - cl( - U, - df, - w, - C, - _, + (null == v || v.useUpPowerup("punch"), + (U.boosterDebug && (U.boosterDebug.jumpIndicators.push({ x: U.playerX, y: U.playerY, inAir: true }))), + (L.blockJumpUntilReleased = true), + (isDown = false), + (U.justDownInputTimer = 0), + U.playerPowerups.shift(), + xa.updateHitPunchState( + U.frame, inViewLayout, inViewLayoutState, + U.playerX, + U.playerY, + U.playerDir, + U.layoutState, fullLayoutStateIndexes, - Ca.getAllLandableObjects( - inViewLayout, - inViewLayoutState, - skating, - ), - Ca.getAllDeadlyObjects(inViewLayout, inViewLayoutState), - () => false, - v, - V, + K, + U.isCompatible ? 1 : U.playerScale, ), - U.playerBullets && - xa.updateHitBulletState( + U.playerPowerups.some((e) => e.item === "playerStack") && + U.playerStacks.map((e) => + xa.updateHitPunchState( U.frame, inViewLayout, inViewLayoutState, - U.playerBullets, + U.playerX, + e.y, + U.playerDir, U.layoutState, fullLayoutStateIndexes, - U.switchBlockSpikes, + K, + U.isCompatible ? 1 : U.playerScale, ), - 0 === L.resetTimer && N) - ) { - const lastCheckpointState = L.checkpoints.at(-1)?.state || {}; - const useCheckpointState = (lastCheckpointState?.frame || 0) > (U.checkpoint?.state?.frame || 0); - const e = Zr( - _.layout, - _.boss, - F, - useCheckpointState ? lastCheckpointState : U.checkpoint.state, - null == v ? void 0 : v.playSound, - null == v ? void 0 : v.pauseSound, - ); - O(e.frame, U.checkpoint.index); - const t = Ca.getInitFirstIndexes(); - return ( - Ca.setInViewLayoutAndState( - _.layout, - e.frame, - C, - e.playerX, - e.playerY, - e.layoutState, - e.switchButtons.rot, - e.jumpSwitch.ratio, - U.switchBlockSpikes, - t, - inViewLayout, - inViewLayoutState, - fullLayoutStateIndexes, - e.fallTypes, + )); + else if ( + e && + "drill" === + (null === (i = U.playerPowerups[0]) || void 0 === i + ? void 0 + : i.item) + ) + (null == v || v.useUpPowerup("punch"), + (L.blockJumpUntilReleased = true), + (isDown = false), + (U.justDownInputTimer = 0), + (U.boosterDebug && (U.boosterDebug.jumpIndicators.push({ x: U.playerX, y: U.playerY, inAir: true }))), + U.playerPowerups.shift(), + xa.updateHitDrillState( + U.frame, + inViewLayout, + inViewLayoutState, + U.playerX, + U.playerY, + U.playerDir, + U.layoutState, + fullLayoutStateIndexes, + K, + U.playerScale, + ) > 0 + ? (U.playerGradY = G.initGrad(V) * -1) + : void 0); + else if ( + e && + "gun" === + (null === (n = U.playerPowerups[0]) || void 0 === n + ? void 0 + : n.item) + ) + (null == v || v.useUpPowerup("gun"), + (U.boosterDebug && (U.boosterDebug.jumpIndicators.push({ x: U.playerX, y: U.playerY, inAir: true }))), + (L.blockJumpUntilReleased = true), + (isDown = false), + (U.justDownInputTimer = 0), + U.playerPowerups.shift(), + U.playerBullets.push( + oo(U.playerX, U.playerY, 4 * w * U.playerDir), + ), + U.playerPowerups.some((e) => e.item === "playerStack") && + U.playerStacks.map((e) => + U.playerBullets.push( + oo(U.playerX, e.y, 4 * w * U.playerDir), ), - (e.attempt = U.attempt + 1), - (useCheckpointState || (e.checkpoint = { - index: U.checkpoint.index, - state: tl(e, _.boss), - })), - (L.levelState = tl(e, _.boss)), - (L.blockJumpUntilReleased = false), - (L.landTimer = 0), - (L.resetTimer = null), - void (L.layoutFirstIndexes = t) - ); - } - return; - } - U.playerX += - w * - U.playerSpeedMultiplier * - df * - U.playerDir * - (skating ? 1.5 : 1); - let J = false; - U.playerUsingPowerup = false; - const K = U.switchBlockSpikes; - const previousJustHitObject = U.justHitObject; - U.justHitObject = null; - if ( - null === (a = _.boss) || void 0 === a + )); + else if ( + e && + (U.jumping || 0 !== U.playerGradY) && + "doubleJump" === + (null === (s = U.playerPowerups[0]) || void 0 === s ? void 0 - : a.overrideMovement - ) { - const e = _.boss.overrideMovement( - { playerX: U.playerX, playerY: U.playerY, jumping: U.jumping }, - df, - w, - playerInput, - U.frame, - ); - ((U.playerY = e.playerY), - (U.playerX = e.playerX), - (U.jumping = e.jumping)); - } else { - if (isDown) { - const e = - U.justDownInputTimer > 0 || "justDown" === playerInput, - t = e - ? (e, t, a) => be.rectTouchesRect2(e, U.playerY, t, M, a) - : null, - a = - e && - inViewLayout.collectibles.some((e, a) => { - var i; - if ("arrow" === e.form) - return inViewLayoutState.collectibles[a].wasPickedUp - ? void 0 - : (null == t ? void 0 : t(U.playerX - 10, 70, e)) || - (U.playerPowerups.some( - (e) => e.item === "playerStack", - ) && - be.hitStack( - e, - U.playerX - 10, - U.playerStacks, - 70, - )); - }), - toggleGravity = inViewLayout.switchButtons.findIndex( - (button) => - button.affects == "gravity" && - be.hitObject( - U.playerX, - U.playerY, - U.playerScaleX * 0.99, - U.playerScaleY * 0.99, - U.dashing ? 0 : U.playerRot, - skating, - K, - )(button), - ); + : s.item) + ) + ((U.playerGradY = G.initGrad(V)), + (U.jumpSwitch.on = !U.jumpSwitch.on), + (U.jumpSwitch.delay = 2), + U.playerPowerups.shift(), + (U.justDownInputTimer = 0), + (U.boosterDebug && (U.boosterDebug.jumpIndicators.push({ x: U.playerX, y: U.playerY, inAir: true }))), + null == v || v.useUpPowerup("doubleJump"), + (U.jumping = true)); + else if (U.playerPowerups.some((e) => e.item === "jetpack")) { + if (U.jumping && U.flyingAnchor === null) { + if (U.playerGradY < V) { + const e = 1 === df ? 1 : 1.01 * df; + U.playerGradY += (e * (V - U.playerGradY)) / 5; + } + } else + (( + (U.boosterDebug && (U.boosterDebug.jumpIndicators.push({ x: U.playerX, y: U.playerY, inAir: true }))) + ), (U.jumping = true), + (U.playerGradY = G.initGrad(V) / 2), + U.playerJetpackFuel < 8 && + ((U.playerGradY = G.initGrad(V)), + (U.playerPowerups = U.playerPowerups.filter( + (e) => e.item !== "jetpack", + )), + U.playerPowerups.some( + (e) => + ![ + "jetpack", + "spaceship", + "playerStack", + "skateboard", + ].includes(e.item), + ) && + ((L.blockJumpUntilReleased = true), + (isDown = false), + (U.justDownInputTimer = 0)), + null == v || v.useUpPowerup("jetpack"))); + ((U.playerJetpackFuel -= df * (w / 5)), + (U.playerUsingPowerup = true), + U.playerJetpackFuel <= 0 && + ((U.playerPowerups = U.playerPowerups.filter( + (e) => e.item !== "jetpack", + )), + U.playerPowerups.some( + (e) => + ![ + "jetpack", + "spaceship", + "playerStack", + "skateboard", + ].includes(e.item), + ) && + ((L.blockJumpUntilReleased = true), + (isDown = false), + (U.justDownInputTimer = 0)), + null == v || v.useUpPowerup("jetpack"))); + } else if (U.gravity < 0) { + if ((U.gravityHitObject || U.dashing) && e) { + U.dashing = false; + U.gravity = 1; + U.isGravity = false; + U.jumping = U.flyingAnchor === null ? true : U.jumping; + U.playerGradY = -1; + (U.boosterDebug && (U.boosterDebug.jumpIndicators.push({ x: U.playerX, y: U.playerY, inAir: true }))); + ((L.blockJumpUntilReleased = true), + (isDown = false), + (U.justDownInputTimer = 0)); + } + } else if ( + U.playerPowerups.some((e) => e.item === "spaceship") + ) { + } else { + if (U.dashing) { U.dashing && e && ((U.dashing = false), - (U.jumping = true), - (U.boosterDebug && (U.boosterDebug.jumpIndicators.push({x: U.playerX, y: U.playerY, inAir: true}))), - (U.playerPowerups.length === 0 && - !U.playerPowerups.some((e) => e.item === "playerStack") && - (L.blockJumpUntilReleased = true), - (isDown = false), - (U.justDownInputTimer = 0))); - if (a) - ((L.blockJumpUntilReleased = true), - (isDown = false), - (U.justDownInputTimer = 0), - inViewLayout.collectibles.forEach((e, a) => { - var i, n; - if (!inViewLayoutState.collectibles[a].wasPickedUp) - if ( - (null == t ? void 0 : t(U.playerX, 50, e)) || - (U.playerPowerups.some( - (e) => e.item === "playerStack", - ) && - be.hitStack(e, U.playerX, U.playerStacks, 50)) - ) { - const t = Math.abs(e.x - U.playerX), - i = zo.hitArrow(U.score, t, w); - xa.updateLayoutStateField( - "collectibles", - a, - { - type: "collectibleState", - wasPickedUp: true, - score: i, - }, - U.layoutState, - inViewLayoutState, - fullLayoutStateIndexes, - K, - ); - } else - ((null == t ? void 0 : t(U.playerX - M, M, e)) || - (U.playerPowerups.some( - (e) => e.item === "playerStack", - ) && - be.hitStack(e, U.playerX - M, U.playerStacks))) && - ((U.score.perfectCombo = false), (U.score.fullCombo = false), (U.score.multiplier = 0), - xa.updateLayoutStateField( - "collectibles", - a, - { type: "collectibleState", wasPickedUp: true }, - U.layoutState, - inViewLayoutState, - fullLayoutStateIndexes, - K, - )); - })); - else if (e && toggleGravity > -1) { - var g = inViewLayout.switchButtons[toggleGravity].gravity; - U.justHitObject = { - array: "switchButtons", - index: toggleGravity, - }; - U.dashing = false; - if (g < 2) { - (g == 0 - ? (U.dashing = true) - : ((U.gravity = g), (U.isGravity = true)), - (U.playerGradY = G.initGrad(V) * -2 * U.gravity), + (U.boosterDebug && (U.boosterDebug.jumpIndicators.push({ x: U.playerX, y: U.playerY, inAir: true }))), (L.blockJumpUntilReleased = true), (isDown = false), (U.justDownInputTimer = 0)); - } else { - ( + } else { + U.jumping || + 0 !== U.playerGradY || + (skating + ? (U.skateboardJumpCharge += df) + : ( (U.playerGradY = G.initGrad(V)), (U.jumping = true), (U.boosterDebug && (U.boosterDebug.jumpIndicators.push({ x: U.playerX, y: U.playerY }))), (U.jumpSwitch.on = !U.jumpSwitch.on), (U.jumpSwitch.delay = 2), (U.justDownInputTimer = 0), - null == v || v.jump(false)); - }; - } else if ( - e && - "punch" === - (null === (i = U.playerPowerups[0]) || void 0 === i - ? void 0 - : i.item) - ) - (null == v || v.useUpPowerup("punch"), - (U.boosterDebug && (U.boosterDebug.jumpIndicators.push({x: U.playerX, y: U.playerY, inAir: true}))), - (L.blockJumpUntilReleased = true), - (isDown = false), - (U.justDownInputTimer = 0), - U.playerPowerups.shift(), - xa.updateHitPunchState( - U.frame, - inViewLayout, - inViewLayoutState, - U.playerX, - U.playerY, - U.playerDir, - U.layoutState, - fullLayoutStateIndexes, - K, - U.isCompatible ? 1 : U.playerScale, - ), - U.playerPowerups.some((e) => e.item === "playerStack") && - U.playerStacks.map((e) => - xa.updateHitPunchState( - U.frame, - inViewLayout, - inViewLayoutState, - U.playerX, - e.y, - U.playerDir, - U.layoutState, - fullLayoutStateIndexes, - K, - U.isCompatible ? 1 : U.playerScale, - ), - )); - else if ( - e && - "drill" === - (null === (i = U.playerPowerups[0]) || void 0 === i - ? void 0 - : i.item) - ) - (null == v || v.useUpPowerup("punch"), - (L.blockJumpUntilReleased = true), - (isDown = false), - (U.justDownInputTimer = 0), - (U.boosterDebug && (U.boosterDebug.jumpIndicators.push({x: U.playerX, y: U.playerY, inAir: true}))), - U.playerPowerups.shift(), - xa.updateHitDrillState( - U.frame, - inViewLayout, - inViewLayoutState, - U.playerX, - U.playerY, - U.playerDir, - U.layoutState, - fullLayoutStateIndexes, - K, - U.playerScale, - ) > 0 - ? (U.playerGradY = G.initGrad(V) * -1) - : void 0); - else if ( - e && - "gun" === - (null === (n = U.playerPowerups[0]) || void 0 === n - ? void 0 - : n.item) - ) - (null == v || v.useUpPowerup("gun"), - (U.boosterDebug && (U.boosterDebug.jumpIndicators.push({x: U.playerX, y: U.playerY, inAir: true}))), - (L.blockJumpUntilReleased = true), - (isDown = false), - (U.justDownInputTimer = 0), - U.playerPowerups.shift(), - U.playerBullets.push( - oo(U.playerX, U.playerY, 4 * w * U.playerDir), - ), - U.playerPowerups.some((e) => e.item === "playerStack") && - U.playerStacks.map((e) => - U.playerBullets.push( - oo(U.playerX, e.y, 4 * w * U.playerDir), - ), - )); - else if ( - e && - (U.jumping || 0 !== U.playerGradY) && - "doubleJump" === - (null === (s = U.playerPowerups[0]) || void 0 === s - ? void 0 - : s.item) - ) - ((U.playerGradY = G.initGrad(V)), - (U.jumpSwitch.on = !U.jumpSwitch.on), - (U.jumpSwitch.delay = 2), - U.playerPowerups.shift(), - (U.justDownInputTimer = 0), - (U.boosterDebug && (U.boosterDebug.jumpIndicators.push({x: U.playerX, y: U.playerY, inAir: true}))), - null == v || v.useUpPowerup("doubleJump"), - (U.jumping = true)); - else if (U.playerPowerups.some((e) => e.item === "jetpack")) { - if (U.jumping && U.flyingAnchor === null) { - if (U.playerGradY < V) { - const e = 1 === df ? 1 : 1.01 * df; - U.playerGradY += (e * (V - U.playerGradY)) / 5; - } - } else - (( - (U.boosterDebug && (U.boosterDebug.jumpIndicators.push({x: U.playerX, y: U.playerY, inAir: true}))) - ),(U.jumping = true), - (U.playerGradY = G.initGrad(V) / 2), - U.playerJetpackFuel < 8 && - ((U.playerGradY = G.initGrad(V)), - (U.playerPowerups = U.playerPowerups.filter( - (e) => e.item !== "jetpack", - )), - U.playerPowerups.some( - (e) => - ![ - "jetpack", - "spaceship", - "playerStack", - "skateboard", - ].includes(e.item), - ) && - ((L.blockJumpUntilReleased = true), - (isDown = false), - (U.justDownInputTimer = 0)), - null == v || v.useUpPowerup("jetpack"))); - ((U.playerJetpackFuel -= df * (w / 5)), - (U.playerUsingPowerup = true), - U.playerJetpackFuel <= 0 && - ((U.playerPowerups = U.playerPowerups.filter( - (e) => e.item !== "jetpack", - )), - U.playerPowerups.some( - (e) => - ![ - "jetpack", - "spaceship", - "playerStack", - "skateboard", - ].includes(e.item), - ) && - ((L.blockJumpUntilReleased = true), - (isDown = false), - (U.justDownInputTimer = 0)), - null == v || v.useUpPowerup("jetpack"))); - } else if (U.gravity < 0) { - if ((U.gravityHitObject || U.dashing) && e) { - U.dashing = false; - U.gravity = 1; - U.isGravity = false; - U.jumping = U.flyingAnchor === null ? true : U.jumping; - U.playerGradY = -1; - (U.boosterDebug && (U.boosterDebug.jumpIndicators.push({x: U.playerX, y: U.playerY, inAir: true}))); - ((L.blockJumpUntilReleased = true), - (isDown = false), - (U.justDownInputTimer = 0)); - } - } else if ( - U.playerPowerups.some((e) => e.item === "spaceship") - ) { - } else { - if (U.dashing) { - U.dashing && - e && - ((U.dashing = false), - (U.boosterDebug && (U.boosterDebug.jumpIndicators.push({x: U.playerX, y: U.playerY, inAir: true}))), - (L.blockJumpUntilReleased = true), - (isDown = false), - (U.justDownInputTimer = 0)); - } else { - U.jumping || - 0 !== U.playerGradY || - (skating - ? (U.skateboardJumpCharge += df) - : ( - (U.playerGradY = G.initGrad(V)), - (U.jumping = true), - (U.boosterDebug && (U.boosterDebug.jumpIndicators.push({ x: U.playerX, y: U.playerY }))), - (U.jumpSwitch.on = !U.jumpSwitch.on), - (U.jumpSwitch.delay = 2), - (U.justDownInputTimer = 0), - null == v || v.jump(false))); - } - } - } else - U.skateboardJumpCharge > 0 && - !U.jumping && - 0 === U.playerGradY && - ((U.jumping = true), - (U.boosterDebug && (U.boosterDebug.jumpIndicators.push({x: U.playerX, y: U.playerY}))), - (U.playerGradY = - G.initGrad(V) * - B.clamp2(1, 1.4, 1 + U.skateboardJumpCharge / 60)), - (U.jumpSwitch.on = !U.jumpSwitch.on), - (U.jumpSwitch.delay = 2), - (U.justDownInputTimer = 0), - (U.skateboardJumpCharge = 0), - null == v || v.jump(true)); - if (((J = 0 === U.playerGradY && !U.dashing), skating)) - if ( - ((U.playerScaleX = 1 * globalPlayerScale), - U.skateboardJumpCharge > 0) - ) { - const e = U.playerScaleY; - U.playerScaleY = Math.max(0.7, U.playerScaleY - 0.05 * df); - const t = U.playerScaleY - e; - U.playerY += t * sl; - } else U.playerScaleY = 1; - else et.setScaleInc(U, df, V); - if ( - U.playerPowerups.some((e) => e.item === "jetpack") && - !U.dashing - ) - U.playerRot = B.clamp2(0, 20, 2 * U.playerGradY) * U.playerDir; - else if ( - U.playerPowerups.some( - (e) => e.item === "spaceship" || e.item === "playerStack", - ) && - !U.dashing - ) - U.playerRot = 0; - else if (skating) - if (U.jumping) { - if ( - "down" === playerInput && - !(0 === U.playerRot && U.playerGradY < -G.initGrad(V) / 2) - ) { - const e = Math.sign(-U.playerRot) || U.playerDir; - ((U.playerRot -= 12 * df * e), - 276 === Math.abs(U.playerRot % 360) && - ((U.score = zo.addScore(U.score, true, true)), - null == v || v.scoreMultiplier(U.score.multiplier))); - } - } else U.playerRot = 0; - else if (U.isGravity) - U.playerRot % 90 > 89 || U.playerRot % 90 < 1 - ? (U.playerRot = et.closestFlatAngle(U.playerRot)) - : (U.playerRot += - (et.closestFlatAngle(U.playerRot) - U.playerRot) / 5); - else - (J && !U.dashing) || - ((U.playerRot += - ((90 * U.playerDir * df) / C) * - U.gravity * - (U.dashing ? 3 : 1)), - U.playerRot < 0 - ? (U.playerRot += 360) - : U.playerRot > 360 && (U.playerRot -= 360)); - const e = U.dashing - ? { y: U.playerY, gradY: 0 } - : G.stepY(U.playerY, U.playerGradY, j, df, U.gravity); - const low = U.flyingAnchor - 45, - high = U.flyingAnchor + 45, - oldY = U.playerY; - U.playerPowerups.some((e) => e.item === "spaceship") && - ("up" == playerInput || - !U.playerPowerups.some((e) => e.item === "jetpack")) - ? ("justDown" === playerInput && - !L.blockJumpUntilReleased && - ((U.jumping = !U.jumping), - (U.boosterDebug && (U.boosterDebug.jumpIndicators.push({x: U.playerX, y: U.playerY, inAir: true}))), - (U.jumpSwitch.on = !U.jumpSwitch.on), - (U.jumpSwitch.delay = 0), - (L.blockJumpUntilReleased = true), - (isDown = false), - (U.justDownInputTimer = 0)), - U.dashing || - (U.jumping - ? U.playerY > low + 1 - ? ((U.playerY += - 2 * - df * - ((-5 + low - U.playerY) / 6.6) * - (w / 6.6)), - (U.playerY = B.clamp2(low, high, U.playerY))) - : (U.playerY = low) - : U.playerY < high - 1 - ? ((U.playerY += - 2 * - df * - ((5 + high - U.playerY) / 6.6) * - (w / 6.6)), - (U.playerY = B.clamp2(low, high, U.playerY))) - : (U.playerY = high)), - (U.playerGradY = U.playerY - oldY)) - : ((U.playerY = e.y), (U.playerGradY = e.gradY)); - if (U.playerPowerups.some((e) => e.item === "ghost")) { - U.playerJetpackFuel < 8 && - (U.playerPowerups.shift(), - null == v || v.useUpPowerup("jetpack")); - ((U.playerJetpackFuel -= df * (w / 10)), - (U.playerUsingPowerup = true), - U.playerJetpackFuel <= 0 && - (U.playerPowerups.shift(), - null == v || v.useUpPowerup("jetpack"))); + null == v || v.jump(false))); } } + } else + U.skateboardJumpCharge > 0 && + !U.jumping && + 0 === U.playerGradY && + ((U.jumping = true), + (U.boosterDebug && (U.boosterDebug.jumpIndicators.push({ x: U.playerX, y: U.playerY }))), + (U.playerGradY = + G.initGrad(V) * + B.clamp2(1, 1.4, 1 + U.skateboardJumpCharge / 60)), + (U.jumpSwitch.on = !U.jumpSwitch.on), + (U.jumpSwitch.delay = 2), + (U.justDownInputTimer = 0), + (U.skateboardJumpCharge = 0), + null == v || v.jump(true)); + if (((J = 0 === U.playerGradY && !U.dashing), skating)) if ( - U.onObject && - "blocks" !== U.onObject.array && - "spikes" !== U.onObject.array + ((U.playerScaleX = 1 * globalPlayerScale), + U.skateboardJumpCharge > 0) ) { - const e = fullLayoutStateIndexes[U.onObject.array].indexOf( - U.onObject.index, - ), - t = inViewLayout[U.onObject.array][e]; - if (t) { - const e = t.y - U.onObject.y; - ((U.playerY += e), - (U.playerGradY = - U.playerGradY < 0 - ? Math.min(e / df, U.playerGradY) - : Math.max(e / df, U.playerGradY))); + const e = U.playerScaleY; + U.playerScaleY = Math.max(0.7, U.playerScaleY - 0.05 * df); + const t = U.playerScaleY - e; + U.playerY += t * sl; + } else U.playerScaleY = 1; + else et.setScaleInc(U, df, V); + if ( + U.playerPowerups.some((e) => e.item === "jetpack") && + !U.dashing + ) + U.playerRot = B.clamp2(0, 20, 2 * U.playerGradY) * U.playerDir; + else if ( + U.playerPowerups.some( + (e) => e.item === "spaceship" || e.item === "playerStack", + ) && + !U.dashing + ) + U.playerRot = 0; + else if (skating) + if (U.jumping) { + if ( + "down" === playerInput && + !(0 === U.playerRot && U.playerGradY < -G.initGrad(V) / 2) + ) { + const e = Math.sign(-U.playerRot) || U.playerDir; + ((U.playerRot -= 12 * df * e), + 276 === Math.abs(U.playerRot % 360) && + ((U.score = zo.addScore(U.score, true, true)), + null == v || v.scoreMultiplier(U.score.multiplier))); } - } - let Q = null, - Z = be.hitObject( + } else U.playerRot = 0; + else if (U.isGravity) + U.playerRot % 90 > 89 || U.playerRot % 90 < 1 + ? (U.playerRot = et.closestFlatAngle(U.playerRot)) + : (U.playerRot += + (et.closestFlatAngle(U.playerRot) - U.playerRot) / 5); + else + (J && !U.dashing) || + ((U.playerRot += + ((90 * U.playerDir * df) / C) * + U.gravity * + (U.dashing ? 3 : 1)), + U.playerRot < 0 + ? (U.playerRot += 360) + : U.playerRot > 360 && (U.playerRot -= 360)); + const e = U.dashing + ? { y: U.playerY, gradY: 0 } + : G.stepY(U.playerY, U.playerGradY, j, df, U.gravity); + const low = U.flyingAnchor - 45, + high = U.flyingAnchor + 45, + oldY = U.playerY; + U.playerPowerups.some((e) => e.item === "spaceship") && + ("up" == playerInput || + !U.playerPowerups.some((e) => e.item === "jetpack")) + ? ("justDown" === playerInput && + !L.blockJumpUntilReleased && + ((U.jumping = !U.jumping), + (U.boosterDebug && (U.boosterDebug.jumpIndicators.push({ x: U.playerX, y: U.playerY, inAir: true }))), + (U.jumpSwitch.on = !U.jumpSwitch.on), + (U.jumpSwitch.delay = 0), + (L.blockJumpUntilReleased = true), + (isDown = false), + (U.justDownInputTimer = 0)), + U.dashing || + (U.jumping + ? U.playerY > low + 1 + ? ((U.playerY += + 2 * + df * + ((-5 + low - U.playerY) / 6.6) * + (w / 6.6)), + (U.playerY = B.clamp2(low, high, U.playerY))) + : (U.playerY = low) + : U.playerY < high - 1 + ? ((U.playerY += + 2 * + df * + ((5 + high - U.playerY) / 6.6) * + (w / 6.6)), + (U.playerY = B.clamp2(low, high, U.playerY))) + : (U.playerY = high)), + (U.playerGradY = U.playerY - oldY)) + : ((U.playerY = e.y), (U.playerGradY = e.gradY)); + if (U.playerPowerups.some((e) => e.item === "ghost")) { + U.playerJetpackFuel < 8 && + (U.playerPowerups.shift(), + null == v || v.useUpPowerup("jetpack")); + ((U.playerJetpackFuel -= df * (w / 10)), + (U.playerUsingPowerup = true), + U.playerJetpackFuel <= 0 && + (U.playerPowerups.shift(), + null == v || v.useUpPowerup("jetpack"))); + } + } + if ( + U.onObject && + "blocks" !== U.onObject.array && + "spikes" !== U.onObject.array + ) { + const e = fullLayoutStateIndexes[U.onObject.array].indexOf( + U.onObject.index, + ), + t = inViewLayout[U.onObject.array][e]; + if (t) { + const e = t.y - U.onObject.y; + ((U.playerY += e), + (U.playerGradY = + U.playerGradY < 0 + ? Math.min(e / df, U.playerGradY) + : Math.max(e / df, U.playerGradY))); + } + } + let Q = null, + Z = be.hitObject( + U.playerX, + U.playerY, + U.playerScaleX, + U.playerScaleY, + U.dashing ? 0 : U.playerRot, + skating, + K, + ), + stackCollide = (stack, enemy) => + enemy + ? be.hitRectangle( + stack.x || U.playerX, + stack.y, + 1, + 1, + 0, + skating, + ) + : be.hitObject( U.playerX, - U.playerY, - U.playerScaleX, - U.playerScaleY, - U.dashing ? 0 : U.playerRot, + stack.y, + U.isCompatible ? 1 : U.playerScale, + U.isCompatible ? 1 : U.playerScale, + 0, skating, K, ), - stackCollide = (stack, enemy) => - enemy - ? be.hitRectangle( - stack.x || U.playerX, - stack.y, - 1, - 1, - 0, - skating, - ) - : be.hitObject( - U.playerX, - stack.y, - U.isCompatible ? 1 : U.playerScale, - U.isCompatible ? 1 : U.playerScale, - 0, - skating, - K, - ), - ee = null; - var ttt; - for (let e = 0; e < inViewLayout.directionChanges.length; e++) { - const t = inViewLayout.directionChanges[e], - a = t.x - U.playerX; + ee = null; + var ttt; + for (let e = 0; e < inViewLayout.directionChanges.length; e++) { + const t = inViewLayout.directionChanges[e], + a = t.x - U.playerX; - if ( - Z(t) || - (!U.isCompatible && - U.playerPowerups.some((e) => e.item === "playerStack") && - be.hitStack(t, U.playerX, U.playerStacks)) - ) { - if ( - (1 === U.playerDir && "left" === t.direction && a <= 0) || - (-1 === U.playerDir && "right" === t.direction && a >= 0) - ) { - inViewLayoutState.directionChanges[e].wasHit - ? (U.crashed = true) - : ((U.playerDir = "left" === t.direction ? -1 : 1), - t.fixSync ? (U.playerX += a) : void 0, - (U.playerX += a), - (ttt = t), - (ee = e), - null == v || v.hitDirectionChange()); - } - } + if ( + Z(t) || + (!U.isCompatible && + U.playerPowerups.some((e) => e.item === "playerStack") && + be.hitStack(t, U.playerX, U.playerStacks)) + ) { + if ( + (1 === U.playerDir && "left" === t.direction && a <= 0) || + (-1 === U.playerDir && "right" === t.direction && a >= 0) + ) { + inViewLayoutState.directionChanges[e].wasHit + ? (U.crashed = true) + : ((U.playerDir = "left" === t.direction ? -1 : 1), + t.fixSync ? (U.playerX += a) : void 0, + (U.playerX += a), + (ttt = t), + (ee = e), + null == v || v.hitDirectionChange()); } - null !== ee && - xa.updateLayoutStateField( - "directionChanges", - ee, - { type: "directionChangeState", wasHit: !ttt.multiUse }, - U.layoutState, - inViewLayoutState, - fullLayoutStateIndexes, - K, - ); + } + } + null !== ee && + xa.updateLayoutStateField( + "directionChanges", + ee, + { type: "directionChangeState", wasHit: !ttt.multiUse }, + U.layoutState, + inViewLayoutState, + fullLayoutStateIndexes, + K, + ); - for (let e = 0; e < inViewLayout.speedChanges.length; e++) { - const t = inViewLayout.speedChanges[e], - index = e, - offsetX = U.playerX - t.x; - if ( - (Z(t) || - (!U.isCompatible && - U.playerPowerups.some((e) => e.item === "playerStack") && - be.hitStack(t, U.playerX, U.playerStacks))) && - ((1 === U.playerDir && offsetX >= 0) || - (-1 === U.playerDir && offsetX <= 0)) - ) { - if (null === previousJustHitObject) { - const isFlying = (null === (a = _.boss) || void 0 === a - ? void 0 - : a.overrideMovement) - const e = - (1 === U.playerDir && "right" === t.direction) || - (-1 === U.playerDir && "left" === t.direction); - (e - ? (U.playerSpeedMultiplier *= isFlying ? 2 : 1.5) - : (U.playerSpeedMultiplier /= isFlying ? 2 : 1.5), - (U.playerX -= offsetX), - (U.playerX += offsetX * U.playerSpeedMultiplier), - null == v || v.hitSpeedChange(U.playerSpeedMultiplier, e)); - } - U.justHitObject = { array: "speedChanges", index: index }; - } + for (let e = 0; e < inViewLayout.speedChanges.length; e++) { + const t = inViewLayout.speedChanges[e], + index = e, + offsetX = U.playerX - t.x; + if ( + (Z(t) || + (!U.isCompatible && + U.playerPowerups.some((e) => e.item === "playerStack") && + be.hitStack(t, U.playerX, U.playerStacks))) && + ((1 === U.playerDir && offsetX >= 0) || + (-1 === U.playerDir && offsetX <= 0)) + ) { + if (null === previousJustHitObject) { + const isFlying = (null === (a = _.boss) || void 0 === a + ? void 0 + : a.overrideMovement) + const e = + (1 === U.playerDir && "right" === t.direction) || + (-1 === U.playerDir && "left" === t.direction); + (e + ? (U.playerSpeedMultiplier *= isFlying ? 2 : 1.5) + : (U.playerSpeedMultiplier /= isFlying ? 2 : 1.5), + (U.playerX -= offsetX), + (U.playerX += offsetX * U.playerSpeedMultiplier), + null == v || v.hitSpeedChange(U.playerSpeedMultiplier, e)); } - const ae = inViewLayout.flags.findIndex((e, a) => { - const t = e.x - U.playerX; - if (inViewLayoutState.flags[a].wasHit) { - return false; - } - return ( - (Z(e) || - (!U.isCompatible && - U.playerPowerups.some((e) => e.item === "playerStack") && - be.hitStack(e, U.playerX, U.playerStacks))) && - ((1 === U.playerDir && t <= 15) || - (-1 === U.playerDir && t >= -15)) - ); - }); - if (-1 !== ae && !inViewLayoutState.flags[ae].wasHit) { - const e = inViewLayout.flags[ae]; - if ( - (xa.updateLayoutStateField( - "flags", - ae, - { type: "flagState", wasHit: true }, - U.layoutState, - inViewLayoutState, - fullLayoutStateIndexes, - K, - ), - "endOfLevel" === inViewLayout.flags[ae].role) + U.justHitObject = { array: "speedChanges", index: index }; + } + } + const ae = inViewLayout.flags.findIndex((e, a) => { + const t = e.x - U.playerX; + if (inViewLayoutState.flags[a].wasHit) { + return false; + } + return ( + (Z(e) || + (!U.isCompatible && + U.playerPowerups.some((e) => e.item === "playerStack") && + be.hitStack(e, U.playerX, U.playerStacks))) && + ((1 === U.playerDir && t <= 15) || + (-1 === U.playerDir && t >= -15)) + ); + }); + if (-1 !== ae && !inViewLayoutState.flags[ae].wasHit) { + const e = inViewLayout.flags[ae]; + if ( + (xa.updateLayoutStateField( + "flags", + ae, + { type: "flagState", wasHit: true }, + U.layoutState, + inViewLayoutState, + fullLayoutStateIndexes, + K, + ), + "endOfLevel" === inViewLayout.flags[ae].role) + ) + ((U.finishedLevel = true), + null == v || v.fadeSong(), + R(true, U.checkpoint.index, null)); + else { + null == v || v.hitFlag(); + const t = Zr( + inViewLayout, + _.boss, + F, + null, + null == v ? void 0 : v.playSound, + null == v ? void 0 : v.pauseSound, + ); + ((U.switchButtons.on = e.switchesOn), + (U.jumpSwitch.on = e.switchesOn), + (U.dashing = false), + (U.playerScale = 1), + (U.playerScaleX = U.playerScale), + (U.playerScaleY = U.playerScale), + (U.switchBlockSpikes = false), + !e?.retainSpeed && (U.playerSpeedMultiplier = 1), + (U.playerPowerups = U.playerPowerups.filter( + (e) => e.item === "skateboard" || e.item === "spaceship", + )), + U.playerStacks.length > 0 && + (U.explosions.push( + ...U.playerStacks.map((e) => ({ + x: U.playerX, + y: e.y, + framesLeft: $.explosionTime, + })), + ), + (U.playerStacks = []))); + const a = tl(U, _.boss); + ((a.playerScaleX = t.playerScaleX), + (a.playerScaleY = t.playerScaleY), + (a.playerScale = t.playerScale), + (a.jumping = ( + null === (d = _.boss) || void 0 === d + ? void 0 + : d.overrideMovement ) - ((U.finishedLevel = true), - null == v || v.fadeSong(), - R(true, U.checkpoint.index, null)); - else { - null == v || v.hitFlag(); - const t = Zr( - inViewLayout, - _.boss, - F, - null, - null == v ? void 0 : v.playSound, - null == v ? void 0 : v.pauseSound, - ); - ((U.switchButtons.on = e.switchesOn), - (U.jumpSwitch.on = e.switchesOn), - (U.dashing = false), - (U.playerScale = 1), - (U.playerScaleX = U.playerScale), - (U.playerScaleY = U.playerScale), - (U.switchBlockSpikes = false), - !e?.retainSpeed && (U.playerSpeedMultiplier = 1), - (U.playerPowerups = U.playerPowerups.filter( - (e) => e.item === "skateboard" || e.item === "spaceship", - )), - U.playerStacks.length > 0 && - (U.explosions.push( - ...U.playerStacks.map((e) => ({ - x: U.playerX, - y: e.y, - framesLeft: $.explosionTime, - })), - ), - (U.playerStacks = []))); - const a = tl(U, _.boss); - ((a.playerScaleX = t.playerScaleX), - (a.playerScaleY = t.playerScaleY), - (a.playerScale = t.playerScale), - (a.jumping = ( - null === (d = _.boss) || void 0 === d - ? void 0 - : d.overrideMovement - ) - ? U.jumping - : t.jumping), - (a.justDownInputTimer = 0), - (a.playerY = e.y - e.height / 2 + 15), - (a.playerGradY = t.playerGradY), - (a.playerRot = t.playerRot), - (a.skateboardJumpCharge = t.skateboardJumpCharge), - (a.explosions = []), - (a.checkpoint = { - index: U.checkpoint.index + 1, - state: null, - }), - (a.onObject = t.onObject), - skating && (a.score = zo.didLand(U.score)), - (U.checkpoint = { index: U.checkpoint.index + 1, state: a }), - R(false, U.checkpoint.index, a)); - } - } - const ie = inViewLayout.switchButtons.findIndex((e) => { - var t; - return ( - Z(e) || - (U.playerPowerups.some((e) => e.item === "playerStack") && - be.hitStack(e, U.playerX, U.playerStacks)) - ); - }); - if ( - -1 !== ie && - inViewLayout.switchButtons[ie].affects != "gravity" && - inViewLayoutState.switchButtons[ie].isPressedCounter <= 0 - ) { - const e = inViewLayout.switchButtons[ie], - colors = { - red: "#FF0000", - yellow: "#ffea00", - green: "#00FF00", - cyan: "#00FFFF", - blue: "#0000ff", - violet: "#8000ff", - pink: "#ff00ff", - black: "#000000", - white: "#ffFFff", - flash: "flash", - }; - (xa.updateLayoutStateField( - "switchButtons", - ie, - { type: "switchButtonState", isPressedCounter: 10 }, + ? U.jumping + : t.jumping), + (a.justDownInputTimer = 0), + (a.playerY = e.y - e.height / 2 + 15), + (a.playerGradY = t.playerGradY), + (a.playerRot = t.playerRot), + (a.skateboardJumpCharge = t.skateboardJumpCharge), + (a.explosions = []), + (a.checkpoint = { + index: U.checkpoint.index + 1, + state: null, + }), + (a.onObject = t.onObject), + skating && (a.score = zo.didLand(U.score)), + (U.checkpoint = { index: U.checkpoint.index + 1, state: a }), + R(false, U.checkpoint.index, a)); + } + } + const ie = inViewLayout.switchButtons.findIndex((e) => { + var t; + return ( + Z(e) || + (U.playerPowerups.some((e) => e.item === "playerStack") && + be.hitStack(e, U.playerX, U.playerStacks)) + ); + }); + if ( + -1 !== ie && + inViewLayout.switchButtons[ie].affects != "gravity" && + inViewLayoutState.switchButtons[ie].isPressedCounter <= 0 + ) { + const e = inViewLayout.switchButtons[ie], + colors = { + red: "#FF0000", + yellow: "#ffea00", + green: "#00FF00", + cyan: "#00FFFF", + blue: "#0000ff", + violet: "#8000ff", + pink: "#ff00ff", + black: "#000000", + white: "#ffFFff", + flash: "flash", + }; + (xa.updateLayoutStateField( + "switchButtons", + ie, + { type: "switchButtonState", isPressedCounter: 10 }, + U.layoutState, + inViewLayoutState, + fullLayoutStateIndexes, + K, + ), + "color" === e.affects + ? e.color == "flash" + ? (U.flash = 0.3) + : (U.bgColor = colors[e.color]) + : "movement" === e.affects + ? (U.switchButtons.on = !U.switchButtons.on) + : "size" === e.affects + ? ((U.playerScale = U.playerScale === 1 ? 0.5 : 1), + ((U.playerScaleX = U.playerScale), + (U.playerScaleY = U.playerScale))) + : "blockSpike" === e.affects + ? (U.switchBlockSpikes = !U.switchBlockSpikes) + : ((U.fallTypes[0] = e.down ? "down" : null), + (U.fallTypes[1] = e.up ? "up" : null)), + null == v || "color" === e.affects || v.hitSwitch(), + "color" === e.affects || + (U.justHitObject = { array: "switchButtons", index: ie })); + } + U.flash > 0 ? (U.flash -= 0.01) : (U.flash = 0); + for (let e = 0; e < inViewLayoutState.switchButtons.length; e++) { + const t = inViewLayoutState.switchButtons[e]; + t.isPressedCounter > 0 && + ie !== e && + xa.updateLayoutStateField( + "switchButtons", + e, + { + type: "switchButtonState", + isPressedCounter: t.isPressedCounter - df, + }, + U.layoutState, + inViewLayoutState, + fullLayoutStateIndexes, + K, + ); + } + let ne = -1; + for (let e = 0; e < inViewLayout.collectibles.length; e++) { + const t = inViewLayout.collectibles[e]; + "arrow" === t.form + ? !inViewLayoutState.collectibles[e].wasPickedUp && + t.x < U.playerX - 60 && + ((U.score.perfectCombo = false), (U.score.fullCombo = false), (U.score.multiplier = 0), + xa.updateLayoutStateField( + "collectibles", + e, + { type: "collectibleState", wasPickedUp: true }, U.layoutState, inViewLayoutState, fullLayoutStateIndexes, K, - ), - "color" === e.affects - ? e.color == "flash" - ? (U.flash = 0.3) - : (U.bgColor = colors[e.color]) - : "movement" === e.affects - ? (U.switchButtons.on = !U.switchButtons.on) - : "size" === e.affects - ? ((U.playerScale = U.playerScale === 1 ? 0.5 : 1), - ((U.playerScaleX = U.playerScale), - (U.playerScaleY = U.playerScale))) - : "blockSpike" === e.affects - ? (U.switchBlockSpikes = !U.switchBlockSpikes) - : ((U.fallTypes[0] = e.down ? "down" : null), - (U.fallTypes[1] = e.up ? "up" : null)), - null == v || "color" === e.affects || v.hitSwitch(), - "color" === e.affects || - (U.justHitObject = { array: "switchButtons", index: ie })); + )) + : (Z(t) || + (U.playerPowerups.some((e) => e.item === "playerStack") && + be.hitStack(t, U.playerX, U.playerStacks))) && + !inViewLayoutState.collectibles[e].wasPickedUp && + (ne = e); + } + -1 !== ne && + (inViewLayoutState.collectibles[ne].wasPickedUp || + (xa.updateLayoutStateField( + "collectibles", + ne, + { type: "collectibleState", wasPickedUp: true }, + U.layoutState, + inViewLayoutState, + fullLayoutStateIndexes, + K, + ), + U.collectibles++, + null == v || v.hitCollectible())); + const touchedSpring = inViewLayout.springs.findIndex((e) => Z(e)); + const checkSprings = (idx, stack) => { + if (stack) { + idx = inViewLayout.springs.findIndex((e) => + stackCollide(stack)(e), + ); + } + var setY = (y) => (stack ? (stack.y = y) : (U.playerY = y)); + var setGradY = (y) => + stack ? (stack.gradY = y) : (U.playerGradY = y); + var gradY = stack + ? stack.gradY + : U.isGravity + ? G.initGrad(V) + : U.playerGradY; + if (-1 !== idx) { + const spring = inViewLayout.springs[idx]; + (stack || + (U.jumping = U.playerPowerups.some( + (e) => e.item === "spaceship", + ) + ? spring.direction < 0 + : true), + stack || (U.gravity = 1), + setGradY( + (spring.direction > 0 + ? Math.max(1.5 * G.initGrad(V), Math.abs(gradY)) + : -Math.min(1 * G.initGrad(V), -Math.abs(gradY))) * + spring.direction, + ), + setY( + spring.y + + (spring.height / 2) * spring.direction + + 15 * spring.direction, + ), + stack || (U.isGravity = false), + stack || (L.landTimer = et.landTimerLimit), + stack || (U.skateboardJumpCharge = 0), + (U.justHitObject = { array: "springs", index: idx }), + null == v || v.hitSpring()); + if (stack) { + return { y: stack.y, gradY: stack.gradY }; + } + } + }; + checkSprings(touchedSpring); + const oe = nl( + inViewLayout.portals, //e + _.layout.portals, //t + U.playerX, //a + U.playerY, //i + U.playerDir, //n + U.playerGradY, //s + j, //o + V, //r + (null === (h = U.touchingPortals) || void 0 === h + ? void 0 + : h[0]) || null, //l + Z, //c + df, //d + U.gravity, + U.isGravity, + U.dashing, + ); + ((U.touchingPortals = oe.touchingPortals || null), + (U.crashed = oe.crashed || U.crashed), + oe.teleport && + ((U.cameraXOffset += U.playerX - oe.teleport.playerX), + (U.playerX = oe.teleport.playerX), + (U.playerY = oe.teleport.playerY), + (U.flyingAnchor = U.flyingAnchor ? oe.teleport.portalY : null), + (U.jumping = U.flyingAnchor + ? U.playerGradY !== oe.teleport.playerGradY + ? oe.teleport.playerGradY <= 0 + : U.jumping + : U.jumping), + (U.playerGradY = oe.teleport.playerGradY), + (U.playerDir = oe.teleport.playerDir), + (U.gravity = oe.teleport.gravity), + (U.dashing = oe.teleport.dashing || false), + (Z = be.hitObject( + U.playerX, + U.playerY, + U.playerScaleX, + U.playerScaleY, + U.dashing ? 0 : U.playerRot, + skating, + K, + )), + null == v || v.hitPortal())); + const re = inViewLayout.powerups.findIndex((e, t) => { + return ( + (!inViewLayoutState.powerups[t].wasPickedUp || + U.isCompatible) && + (Z(e) || + (U.playerPowerups.some((e) => e.item === "playerStack") && + (!e.compatible || !U.isCompatible + ? !inViewLayoutState.powerups[t].wasPickedUp + : true) && + be.hitStack(e, U.playerX, U.playerStacks))) + ); + }); + if (-1 !== re && !inViewLayoutState.powerups[re].wasPickedUp) { + const e = inViewLayout.powerups[re]; + if (!U.isCompatible && "skateboard" === e.item) { + } + U.isCompatible = e.compatible; + if (e.override && e.item !== "spaceship") { + U.flyingAnchor = null; + } + if ( + (xa.updateLayoutStateField( + "powerups", + re, + { type: "powerupState", wasPickedUp: true }, + U.layoutState, + inViewLayoutState, + fullLayoutStateIndexes, + K, + ), + null == v || v.pickupPowerup(e.item), + "jetpack" === e.item || "ghost" === e.item) + ) + ((U.playerJetpackFuel = $.maxJetpackFuel), + (U.playerPowerups = U.playerPowerups.filter( + (t) => t.item != e.item, + )), + (U.playerRot = + e.item === "ghost" + ? U.playerRot + : B.clamp2(0, 20, 2 * U.playerGradY) * U.playerDir)); + //playerStack code + else if ("playerStack" === e.item && U.playerStacks.length < 8) { + // be.hitStackWhich(e, U.playerX, U.playerStacks) + const stacksY = [ + U.playerY, + ...U.playerStacks.map(({ y: e }) => e), + ], + t = U.isCompatible + ? stacksY.findIndex( + (t, a) => + a !== stacksY.length - 1 && stacksY[a + 1] > t + M, + ) + : be.hitStackWhich(e, U.playerX, U.playerStacks) + 1, + a = { + y: + (-1 === t ? stacksY[stacksY.length - 1] : stacksY[t]) + M, + gradY: 0, + }; + U.playerStacks.splice(t, 0, a); + U.playerPowerups = U.playerPowerups.filter( + (t) => t.item != e.item, + ); + if (false) { + //e.direction) { + U.playerY += M; + U.playerStackIndex += 1; + U.playerStacks = U.playerStacks.map((k) => { + k.y += M * 2; + return k; + }); } - U.flash > 0 ? (U.flash -= 0.01) : (U.flash = 0); - for (let e = 0; e < inViewLayoutState.switchButtons.length; e++) { - const t = inViewLayoutState.switchButtons[e]; - t.isPressedCounter > 0 && - ie !== e && + //console.log(U.playerStackIndex) + } else if (e.item === "spaceship") { + U.flyingAnchor = e.y; + U.jumping = U.playerGradY <= 0; + U.playerRot = 0; + U.playerPowerups = U.playerPowerups.filter( + (t) => t.item != e.item, + ); + } else + "skateboard" === e.item && + ((U.playerRot = 0), + (U.playerPowerups = U.playerPowerups.filter( + (t) => t.item != e.item, + ))); + // set powerup + if (e.override) { + U.playerPowerups = []; + } + U.playerPowerups[ + ["playerStack", "spaceship", "skateboard", "ghost"].includes( + e.item, + ) + ? "push" + : "unshift" + ]( + Object.assign(Object.assign({}, e), { + x: 0, + y: 0, + }), + ); + } + let le = Ca.getAllLandableObjects( + inViewLayout, + inViewLayoutState, + skating, + ), + ce = rl( + le, + fullLayoutStateIndexes, + U.playerX, + U.playerY, + U.playerGradY, + J, + U.playerScaleX, + U.playerScaleY, + U.dashing ? 0 : U.playerRot, + U.playerDir, + U.crashed, + Q, + skating, + U.switchBlockSpikes, + U.dashing ? 1 : U.gravity, + U.gravityHitObject, + U.playerPowerups.some((e) => e.item === "ghost"), + ); + ((U.crashed = + U.playerPowerups.some((e) => e.item === "spaceship") && + ce.hitObject && + !ce.hitObject.object.canJumpThrough + ? U.playerGradY < -3 || ce.crashed + : ce.crashed), + (Q = U.flyingAnchor === null ? ce.onGroundY : null)); + var de = + U.flyingAnchor === null + ? U.gravityHitObject || ce.hitObject + : null; + if (U.gravity < 0 && Math.abs(U.playerGradY) < 2) { + U.crashed = + U.crashed || + rl( + le, + fullLayoutStateIndexes, + U.playerX, + U.playerY, + U.playerGradY, + J, + U.playerScaleX, + U.playerScaleY, + U.dashing ? 0 : U.playerRot, + U.playerDir, + U.crashed, + Q, + skating, + U.switchBlockSpikes, + 1, + null, + U.playerPowerups.some((e) => e.item === "ghost"), + ).crashed; + if ( + !rl( + le, + fullLayoutStateIndexes, + U.playerX, + U.playerY + 7.5, + U.playerGradY, + J, + U.playerScaleX, + U.playerScaleY, + U.dashing ? 0 : U.playerRot, + U.playerDir, + U.crashed, + Q, + skating, + U.switchBlockSpikes, + 1, + null, + U.playerPowerups.some((e) => e.item === "ghost"), + ).crashed + ) { + U.jumping = true; + U.gravity = 1; + U.isGravity = false; + U.playerGradY = -1; + } + } + U.gravityHitObject = U.gravity > 0 ? null : ce.hitObject; + if ((null !== Q && !J) || U.crashed || -1 !== touchedSpring) { + const e = be.pointInBox({ + x: U.playerX, + y: U.playerY - 15 * U.playerScale, + width: 90 * U.playerScale, + height: 120 * U.playerScale, + }); + for (let t = 0; t < inViewLayout.blocks.length; t++) { + const a = inViewLayout.blocks[t]; + if (e(a)) { + const e = inViewLayoutState.blocks[t]; + (!e?.hitFrame || e?.hitFrame < U.frame) && + !e.isGround && xa.updateLayoutStateField( - "switchButtons", - e, - { - type: "switchButtonState", - isPressedCounter: t.isPressedCounter - df, - }, + "blocks", + t, + Object.assign(Object.assign({}, e), { + hitFrame: U.frame - Math.abs(U.playerX - a.x) / 5, + }), U.layoutState, inViewLayoutState, fullLayoutStateIndexes, K, ); } - let ne = -1; - for (let e = 0; e < inViewLayout.collectibles.length; e++) { - const t = inViewLayout.collectibles[e]; - "arrow" === t.form - ? !inViewLayoutState.collectibles[e].wasPickedUp && - t.x < U.playerX - 60 && - ((U.score.perfectCombo = false), (U.score.fullCombo = false), (U.score.multiplier = 0), - xa.updateLayoutStateField( - "collectibles", - e, - { type: "collectibleState", wasPickedUp: true }, - U.layoutState, - inViewLayoutState, - fullLayoutStateIndexes, - K, - )) - : (Z(t) || - (U.playerPowerups.some((e) => e.item === "playerStack") && - be.hitStack(t, U.playerX, U.playerStacks))) && - !inViewLayoutState.collectibles[e].wasPickedUp && - (ne = e); + } + } + const ue = Ca.getAllDeadlyObjects(inViewLayout, inViewLayoutState); + if (null !== Q) { + U.isGravity = false; + const e = G.getOvershootPercent(U.playerY - Q, U.playerGradY, j); + if (skating) { + const e = Math.abs(U.playerRot % 360); + if (e > 60 && e < 300) U.crashed = true; + else if ( + "platform" === de.object.type && + "rail" === de.object.movement + ) { + const e = 0 === U.playerWasOnGroundCooldown; + ((U.score = zo.addScore(U.score, false, e)), + e && (null == v || v.scoreMultiplier(U.score.multiplier)), + (U.playerUsingPowerup = true)); + } else + !J && + U.score.local > 0 && + ((U.score = zo.didLand(U.score)), + null == v || v.addScore()); + ((U.playerWasOnGroundCooldown = 10), (U.playerRot = 0)); + } else + U.playerRot = U.dashing + ? U.playerRot + : et.closestFlatAngle(U.playerRot); + if ( + (Math.abs(U.playerGradY) > w && + (L.landTimer = et.landTimerLimit), + U.flyingAnchor === null && + (U.jumping = U.gravity > 0 ? isDown && !skating : false), + (U.playerY = Q), + (U.playerGradY = 0), + U.jumping && + !U.playerPowerups.some((e) => e.item === "jetpack")) + ) { + Z = be.hitObject( + U.playerX, + U.playerY, + U.playerScaleX, + U.playerScaleY, + U.dashing ? 0 : U.playerRot, + skating, + K, + ); + for (let e = 0; e < ue.length; e++) { + const { object: t } = ue[e]; + Z(t) && (U.crashed = true); } - -1 !== ne && - (inViewLayoutState.collectibles[ne].wasPickedUp || - (xa.updateLayoutStateField( - "collectibles", - ne, - { type: "collectibleState", wasPickedUp: true }, + null == v || v.jump(false); + const { y: t, gradY: a } = G.stepY( + U.playerY, + G.initGrad(V), + j, + e, + 1, + ); + ((U.playerY = t), + (U.boosterDebug && (U.boosterDebug.jumpIndicators.push({ x: U.playerX, y: Q }))), + (U.playerGradY = a), + + U.jumpSwitch.timeout <= 0 && + ((U.jumpSwitch.on = !U.jumpSwitch.on), + (U.jumpSwitch.delay = 2), + (U.jumpSwitch.timeout = C / 3)), + (U.justDownInputTimer = 0)); + } + } + Z = be.hitObject( + U.playerX, + U.playerY, + U.playerScaleX, + U.playerScaleY, + U.dashing ? 0 : U.playerRot, + skating, + K, + ); + const he = be.hitRectangle( + U.playerX, + U.playerY, + U.playerScaleX, + U.playerScaleY, + U.dashing ? 0 : U.playerRot, + skating, + ); + for (let e = 0; e < ue.length; e++) { + const { object: t, index: a } = ue[e]; + if ("enemy" === t.type && "walker" === t.kind) { + const e = mo.didLandOnHead( + U.frame, + t, + inViewLayoutState.enemies[a], + U.playerY, + U.playerGradY, + V, + he, + ); + if (e) { + ((U.playerGradY = e.playerGradY), + (U.jumping = U.flyingAnchor === null ? U.jumping : false), + (U.isGravity = 0), + xa.updateLayoutStateField( + "enemies", + a, + e.enemyState, U.layoutState, inViewLayoutState, fullLayoutStateIndexes, K, ), - U.collectibles++, - null == v || v.hitCollectible())); - const touchedSpring = inViewLayout.springs.findIndex((e) => Z(e)); - const checkSprings = (idx, stack) => { - if (stack) { - idx = inViewLayout.springs.findIndex((e) => - stackCollide(stack)(e), - ); - } - var setY = (y) => (stack ? (stack.y = y) : (U.playerY = y)); - var setGradY = (y) => - stack ? (stack.gradY = y) : (U.playerGradY = y); - var gradY = stack - ? stack.gradY - : U.isGravity - ? G.initGrad(V) - : U.playerGradY; - if (-1 !== idx) { - const spring = inViewLayout.springs[idx]; - (stack || - (U.jumping = U.playerPowerups.some( - (e) => e.item === "spaceship", + e.playerCrashed && (U.crashed = true)); + continue; + } + } + Z(t) && (U.crashed = true); + } + const pe = + null !== + (m = + null === (g = U.bottomLine) || void 0 === g + ? void 0 + : g.minY) && void 0 !== m + ? m + : Ca.getMinYFromX(U.playerX, inViewLayout.properties.minY); + if (U.playerY <= pe && !inViewLayout.properties.useGround) { + const e = + null !== + (y = + null === (f = U.bottomLine) || void 0 === f + ? void 0 + : f.objects) && void 0 !== y + ? y + : ((e, t, a) => { + if ("world3" === a || "classic" === a) { + const a = []; + for ( + let i = e - Ca.inViewAreaWidth; + i <= e + Ca.inViewAreaWidth; + i += 60 ) - ? spring.direction < 0 - : true), - stack || (U.gravity = 1), - setGradY( - (spring.direction > 0 - ? Math.max(1.5 * G.initGrad(V), Math.abs(gradY)) - : -Math.min(1 * G.initGrad(V), -Math.abs(gradY))) * - spring.direction, - ), - setY( - spring.y + - (spring.height / 2) * spring.direction + - 15 * spring.direction, + a.push({ + type: "laser-line", + x: i, + y: t - 480, + width: 60, + height: 54, + }); + return a; + } + const i = [ + { type: "block-small-spike", width: 30, height: 43 }, + { type: "block-spike", width: 30, height: 53 }, + { type: "block", width: 30, height: 30 }, + { + type: "double-tall-block-spike", + width: 30, + height: 113, + }, + { type: "tall-block-spike", width: 30, height: 70 }, + ], + n = [810, 0], + s = [ + [0, -45], + [30, -60], + [60, -45], + [90, -45], + [120, -30], + [150, -30], + [180, -45], + [210, -45], + [240, -45], + [270, -60], + [300, -75], + [330, -75], + [360, -75], + [390, -90], + [420, -75], + [450, -75], + [480, -75], + [510, -60], + [540, -60], + [570, -75], + [600, -75], + [630, -90], + [660, -90], + [690, -90], + [720, -75], + [750, -60], + [780, -60], + [810, -60], + [870, 0], + [900, 0], + [930, 0], + [960, -15], + [990, -30], + [1020, -30], + [1050, -30], + [1080, -30], + [1110, -45], + [1140, -45], + [1170, -45], + [1200, -60], + [1230, -45], + [1260, -30], + [1290, -45], + [1320, -45], + ].map(([a, n], s) => { + const o = i[s % i.length]; + return Object.assign(Object.assign({}, o), { + x: e + a - Ca.inViewAreaWidth, + y: + n + + t - + 480 + + (o.type.startsWith("double") ? 15 : o.height / 2), + }); + }); + return ( + s.push( + Object.assign( + Object.assign( + {}, + { + type: "block-spike-corner", + width: 86, + height: 83, + }, + ), + { + x: e + n[0] - Ca.inViewAreaWidth + 3, + y: n[1] + t - 480 + 12, + }, + ), ), - stack || (U.isGravity = false), - stack || (L.landTimer = et.landTimerLimit), - stack || (U.skateboardJumpCharge = 0), - (U.justHitObject = { array: "springs", index: idx }), - null == v || v.hitSpring()); - if (stack) { - return { y: stack.y, gradY: stack.gradY }; + s + ); + })(U.playerX, U.playerY, bottomLineTheme); + for (let t = 0; t < e.length; t++) { + const a = e[t]; + (he(a) && (U.crashed = true), + Ca.isObjectInViewX(a, U.playerX) || + (e[t] = Object.assign(Object.assign({}, a), { + x: a.x + 2 * Ca.inViewAreaWidth * U.playerDir, + }))); + } + U.bottomLine + ? ((U.bottomLine.minY = pe), (U.bottomLine.objects = e)) + : (U.bottomLine = { minY: pe, objects: e }); + } else U.bottomLine = null; + ("missiles" === (null == booster ? void 0 : booster.type) && + xa.useMissiles( + U.frame, + inViewLayout, + inViewLayoutState, + U.playerX, + U.playerY, + U.layoutState, + fullLayoutStateIndexes, + K, + ), + U.playerPowerups.some((e) => e.item === "playerStack") && + U.playerStacks.length > 0 && + ((function (stacks, t, a, i, n, s, o, r, l, enemies, d, u) { + for (let l = 0; l < stacks.length; l++) { + const stack = stacks[l]; + let { y: d, gradY: h } = G.stepY( + stack.y, + stack.gradY, + t, + a, + 1, + ); + let onObject = stack.onObject; + var scale = U.isCompatible ? 1 : U.playerScale; + //console.log(l) + const lastStackY = 0 === l ? n : stacks[l - 1].y, + lastOnObject = + 0 === l ? U.onObject : stacks[l - 1].onObject, + checkStackY = (stackY) => + d < stackY + M * scale + 1 && + ((d = stackY + M * scale), + (h = 0), + (onObject = { array: "stack", index: l - 1, y: d })); + checkStackY(lastStackY); + if (!U.isCompatible) { + // yo, stay on those platforms!! + if ( + onObject && + "blocks" !== onObject.array && + "spikes" !== onObject.array && + "stack" !== onObject.array + ) { + const e = fullLayoutStateIndexes[ + onObject.array + ].indexOf(onObject.index), + t = inViewLayout[onObject.array][e]; + if (t) { + const e = t.y - onObject.y; + ((d += e), + (h = + h < 0 + ? Math.min(e / df, h) + : Math.max(e / df, h))); + } + } + // stay on your friends! + // TODO: only do this when player is onObject + if ( + onObject && + "stack" === onObject.array && + (lastOnObject + ? !["block", "spike"].includes(lastOnObject.array) + : false) + ) { + const e = lastStackY + M * scale - onObject.y; + ((d = lastStackY + M * scale), + (h = + h < 0 ? Math.min(e / df, h) : Math.max(e / df, h))); } } - }; - checkSprings(touchedSpring); - const oe = nl( - inViewLayout.portals, //e - _.layout.portals, //t - U.playerX, //a - U.playerY, //i - U.playerDir, //n - U.playerGradY, //s - j, //o - V, //r - (null === (h = U.touchingPortals) || void 0 === h - ? void 0 - : h[0]) || null, //l - Z, //c - df, //d - U.gravity, - U.isGravity, - U.dashing, - ); - ((U.touchingPortals = oe.touchingPortals || null), - (U.crashed = oe.crashed || U.crashed), - oe.teleport && - ((U.cameraXOffset += U.playerX - oe.teleport.playerX), - (U.playerX = oe.teleport.playerX), - (U.playerY = oe.teleport.playerY), - (U.flyingAnchor = U.flyingAnchor ? oe.teleport.portalY : null), - (U.jumping = U.flyingAnchor - ? U.playerGradY !== oe.teleport.playerGradY - ? oe.teleport.playerGradY <= 0 - : U.jumping - : U.jumping), - (U.playerGradY = oe.teleport.playerGradY), - (U.playerDir = oe.teleport.playerDir), - (U.gravity = oe.teleport.gravity), - (U.dashing = oe.teleport.dashing || false), - (Z = be.hitObject( - U.playerX, - U.playerY, - U.playerScaleX, - U.playerScaleY, - U.dashing ? 0 : U.playerRot, - skating, - K, - )), - null == v || v.hitPortal())); - const re = inViewLayout.powerups.findIndex((e, t) => { - return ( - (!inViewLayoutState.powerups[t].wasPickedUp || - U.isCompatible) && - (Z(e) || - (U.playerPowerups.some((e) => e.item === "playerStack") && - (!e.compatible || !U.isCompatible - ? !inViewLayoutState.powerups[t].wasPickedUp - : true) && - be.hitStack(e, U.playerX, U.playerStacks))) + const g = rl( + o, + r, + i, + d, + h, + false, + scale, + scale, + 0, + s, + false, + null, + false, + u, + U.gravity, ); - }); - if (-1 !== re && !inViewLayoutState.powerups[re].wasPickedUp) { - const e = inViewLayout.powerups[re]; - if (!U.isCompatible && "skateboard" === e.item) { + if (!U.isCompatible) { + g.hitObject + ? onObject + ? ((onObject.array = g.hitObject.object.array), + (onObject.index = g.hitObject.index), + (onObject.y = g.hitObject.object.y)) + : (onObject = { + array: g.hitObject.object.array, + index: g.hitObject.index, + y: g.hitObject.object.y, + }) + : onObject?.array != "stack" && (onObject = null); + if ( + onObject && + onObject.array === "stack" && + !lastOnObject + ) { + onObject = null; + } } - U.isCompatible = e.compatible; - if (e.override && e.item !== "spaceship") { - U.flyingAnchor = null; + + const touchedSpring = U.isCompatible + ? false + : checkSprings(undefined, stack); + if (touchedSpring) { + var offset = 1 * Math.sign(touchedSpring.gradY); + d = touchedSpring.y + offset; + h = touchedSpring.gradY; + if (d < lastStackY + M * scale + 1) { + var setStackFromIndex = (i) => ( + 0 === i + ? (U.playerY = d - M * scale - 1) + : (stacks[i - 1].y = d - M * scale - 1), + 0 === i + ? (U.playerGradY = h) + : (stacks[i - 1].gradY = h) + ); + } } - if ( - (xa.updateLayoutStateField( - "powerups", - re, - { type: "powerupState", wasPickedUp: true }, - U.layoutState, - inViewLayoutState, - fullLayoutStateIndexes, - K, - ), - null == v || v.pickupPowerup(e.item), - "jetpack" === e.item || "ghost" === e.item) - ) - ((U.playerJetpackFuel = $.maxJetpackFuel), - (U.playerPowerups = U.playerPowerups.filter( - (t) => t.item != e.item, - )), - (U.playerRot = - e.item === "ghost" - ? U.playerRot - : B.clamp2(0, 20, 2 * U.playerGradY) * U.playerDir)); - //playerStack code - else if ("playerStack" === e.item && U.playerStacks.length < 8) { - // be.hitStackWhich(e, U.playerX, U.playerStacks) - const stacksY = [ - U.playerY, - ...U.playerStacks.map(({ y: e }) => e), - ], - t = U.isCompatible - ? stacksY.findIndex( - (t, a) => - a !== stacksY.length - 1 && stacksY[a + 1] > t + M, - ) - : be.hitStackWhich(e, U.playerX, U.playerStacks) + 1, - a = { - y: - (-1 === t ? stacksY[stacksY.length - 1] : stacksY[t]) + M, - gradY: 0, - }; - U.playerStacks.splice(t, 0, a); - U.playerPowerups = U.playerPowerups.filter( - (t) => t.item != e.item, - ); - if (false) { - //e.direction) { - U.playerY += M; - U.playerStackIndex += 1; - U.playerStacks = U.playerStacks.map((k) => { - k.y += M * 2; - return k; - }); + // stack collision + !touchedSpring && null !== g.onGroundY + ? (stacks[l] = { + y: g.onGroundY, + gradY: 0, + scale: 1, + stackCrash: g.crashed, + onObject: onObject, + }) + : (stacks[l] = { + y: d, + gradY: h, + scale: 1, + stackCrash: g.crashed, + onObject: onObject, + }); + } + lt(stacks, (stack) => { + let crashed = false; + if (stack.stackCrash) crashed = true; + else { + const a = be.rectTouchesRect({ + x: i, + y: stack.y, + width: 25, + height: 25, + }); + // deadly objects (and enemies) + for (let e = 0; e < l.length; e++) { + const { object: i, index } = l[e]; + if ( + !U.isCompatible && + "enemy" === i.type && + "walker" === i.kind + ) { + const j = mo.didLandOnHead( + U.frame, + i, + enemies[index], + stack.y, + stack.gradY, + V, + stackCollide(stack, true), + ); + if (j) { + ((stack.gradY = j.playerGradY), + xa.updateLayoutStateField( + "enemies", + index, + j.enemyState, + U.layoutState, + inViewLayoutState, + fullLayoutStateIndexes, + K, + ), + j.playerCrashed && (crashed = true)); + continue; + } + } + a(i) && (crashed = true); } - //console.log(U.playerStackIndex) - } else if (e.item === "spaceship") { - U.flyingAnchor = e.y; - U.jumping = U.playerGradY <= 0; - U.playerRot = 0; - U.playerPowerups = U.playerPowerups.filter( - (t) => t.item != e.item, + // bullets + for (let e = 0; e < enemies.length; e++) { + const i = enemies[e].bullet; + i && a(i) && (crashed = true); + } + // portals + + const p = nl( + inViewLayout.portals, //e + _.layout.portals, //t + U.playerX, //a + stack.y, //i + 1, //n + stack.gradY, //s + j, //o + V, //r + (null === (h = U.touchingPortals) || void 0 === h + ? void 0 + : h[0]) || null, //l + stackCollide(stack), //c + df, //d + U.gravity, + false, ); - } else - "skateboard" === e.item && - ((U.playerRot = 0), - (U.playerPowerups = U.playerPowerups.filter( - (t) => t.item != e.item, - ))); - // set powerup - if (e.override) { - U.playerPowerups = []; + // (U.touchingPortals = p.touchingPortals || null), + ((crashed = p.crashed || crashed), + p.teleport && // (stack.x = p.teleport.playerX), + ((stack.y = p.teleport.playerY), + (stack.gradY = p.teleport.playerGradY), + (stack.dir = p.teleport.playerDir), + null == v || v.hitPortal())); } - U.playerPowerups[ - ["playerStack", "spaceship", "skateboard", "ghost"].includes( - e.item, - ) - ? "push" - : "unshift" - ]( - Object.assign(Object.assign({}, e), { - x: 0, - y: 0, + + return ( + crashed && + d.push({ + x: i, + y: stack.y, + framesLeft: $.explosionTime, }), + !crashed ); + }); + })( + U.playerStacks, + j, + df, + U.playerX, + U.playerY + + (skating + ? $.skateboardHeight - (15 - U.playerScaleY * 15) + : 0), + U.playerDir, + le, + fullLayoutStateIndexes, + [ + ...ue, + ...(U.bottomLine?.objects || []).map((obj, i) => ({ + object: obj, + index: i, + })), + ], + U.layoutState.enemies, + U.explosions, + U.switchBlockSpikes, + ), + 0 === U.playerStacks.length && + (U.playerPowerups = U.playerPowerups.filter( + (e) => e.item != "playerStack", + ))), + U.switchButtons.on && U.switchButtons.rot < 90 + ? (U.switchButtons.rot = Math.min( + U.switchButtons.rot + df * (180 / C), + 90, + )) + : !U.switchButtons.on && + U.switchButtons.rot > 0 && + (U.switchButtons.rot = Math.max( + U.switchButtons.rot - df * (180 / C), + 0, + )), + U.jumpSwitch.delay > 0 + ? (U.jumpSwitch.delay -= df) + : U.jumpSwitch.on && U.jumpSwitch.ratio < 1 + ? (U.jumpSwitch.ratio = Math.min( + U.jumpSwitch.ratio + df * (2.6 / C), + 1, + )) + : !U.jumpSwitch.on && + U.jumpSwitch.ratio > 0 && + (U.jumpSwitch.ratio = Math.max( + U.jumpSwitch.ratio - df * (2.6 / C), + 0, + )), + U.jumpSwitch.timeout > 0 && (U.jumpSwitch.timeout -= df), + cl( + U, + df, + w, + C, + _, + inViewLayout, + inViewLayoutState, + fullLayoutStateIndexes, + le, + ue, + he, + v, + U.bottomLine?.objects || [], + ), + U.playerBullets && + xa.updateHitBulletState( + U.frame, + inViewLayout, + inViewLayoutState, + U.playerBullets, + U.layoutState, + fullLayoutStateIndexes, + K, + ), + U.crashed && + (U.playerPowerups.some((e) => e.item === "playerStack") && + U.playerStacks.length > 0 && + U.playerStacks[U.playerStackIndex].y < U.playerY + 300 + ? (U.explosions.push({ + x: U.playerX, + y: U.playerY, + framesLeft: $.explosionTime, + }), + (U.playerY = U.playerStacks[U.playerStackIndex].y), + (U.playerGradY = U.playerStacks[U.playerStackIndex].gradY), + U.playerStacks.splice(U.playerStackIndex, 1), + (U.crashed = false), + 0 === U.playerStacks.length && + (U.playerPowerups = U.playerPowerups.filter( + (e) => e.item !== "playerStack", + ))) + : ((U.playerPowerups = U.playerPowerups.filter( + (e) => e.item === "skateboard" || e.item === "spaceship", + )), + onCrash(U.checkpoint.index), + N && (L.resetTimer = 60)))); + U.playerOnGroundY = + U.flyingAnchor === null ? U.playerOnGroundY : U.flyingAnchor; + let ge = U.explosions.length; + (ge > 0 && + ((U.explosions = U.explosions.map( + (e) => ( + e.framesLeft <= 0 && ge--, + Object.assign(Object.assign({}, e), { + framesLeft: e.framesLeft - 1, + }) + ), + )), + 0 === ge && (U.explosions.length = 0)), + L.landTimer > 0 && L.landTimer--, + U.flyingAnchor === null && + (U.playerOnGroundY = null != Q ? Q : U.playerOnGroundY), + (U.playerWasOnGroundCooldown = Math.max( + 0, + U.playerWasOnGroundCooldown - df, + )), + de + ? U.onObject + ? ((U.onObject.array = de.object.array), + (U.onObject.index = de.index), + (U.onObject.y = de.object.y)) + : (U.onObject = { + array: de.object.array, + index: de.index, + y: de.object.y, + }) + : (U.onObject = null)); + }, + ul = function ( + e, + t = "noShorten", + a, + i = [Zr(e.layout, e.boss, null, null)], + n = 0, + s = 0, + ) { + if ("noShorten" === t) + return { + level: e, + settings: { + viewOffset: a || { x: 0, y: 0, scale: 1 }, + runHistory: i, + runHistoryIndex: n, + }, + }; + const o = + "last10" === t + ? i.slice(n, n + 10) + : i.filter((e, t) => t <= s || t % 5 == 0 || t === n); + return ( + "last10" === t && n > 0 && o.unshift(i[0]), + { + level: e, + settings: { + viewOffset: a || { x: 0, y: 0, scale: 1 }, // * + runHistory: o, + runHistoryIndex: o.indexOf(i[n]), + }, } - let le = Ca.getAllLandableObjects( - inViewLayout, - inViewLayoutState, - skating, - ), - ce = rl( - le, - fullLayoutStateIndexes, - U.playerX, - U.playerY, - U.playerGradY, - J, - U.playerScaleX, - U.playerScaleY, - U.dashing ? 0 : U.playerRot, - U.playerDir, - U.crashed, - Q, - skating, - U.switchBlockSpikes, - U.dashing ? 1 : U.gravity, - U.gravityHitObject, - U.playerPowerups.some((e) => e.item === "ghost"), - ); - ((U.crashed = - U.playerPowerups.some((e) => e.item === "spaceship") && - ce.hitObject && - !ce.hitObject.object.canJumpThrough - ? U.playerGradY < -3 || ce.crashed - : ce.crashed), - (Q = U.flyingAnchor === null ? ce.onGroundY : null)); - var de = - U.flyingAnchor === null - ? U.gravityHitObject || ce.hitObject - : null; - if (U.gravity < 0 && Math.abs(U.playerGradY) < 2) { - U.crashed = - U.crashed || - rl( - le, - fullLayoutStateIndexes, - U.playerX, - U.playerY, - U.playerGradY, - J, - U.playerScaleX, - U.playerScaleY, - U.dashing ? 0 : U.playerRot, - U.playerDir, - U.crashed, - Q, - skating, - U.switchBlockSpikes, - 1, - null, - U.playerPowerups.some((e) => e.item === "ghost"), - ).crashed; - if ( - !rl( - le, - fullLayoutStateIndexes, - U.playerX, - U.playerY + 7.5, - U.playerGradY, - J, - U.playerScaleX, - U.playerScaleY, - U.dashing ? 0 : U.playerRot, - U.playerDir, - U.crashed, - Q, - skating, - U.switchBlockSpikes, - 1, - null, - U.playerPowerups.some((e) => e.item === "ghost"), - ).crashed - ) { - U.jumping = true; - U.gravity = 1; - U.isGravity = false; - U.playerGradY = -1; - } - } - U.gravityHitObject = U.gravity > 0 ? null : ce.hitObject; - if ((null !== Q && !J) || U.crashed || -1 !== touchedSpring) { - const e = be.pointInBox({ - x: U.playerX, - y: U.playerY - 15 * U.playerScale, - width: 90 * U.playerScale, - height: 120 * U.playerScale, - }); - for (let t = 0; t < inViewLayout.blocks.length; t++) { - const a = inViewLayout.blocks[t]; - if (e(a)) { - const e = inViewLayoutState.blocks[t]; - (!e?.hitFrame || e?.hitFrame < U.frame) && - !e.isGround && - xa.updateLayoutStateField( - "blocks", - t, - Object.assign(Object.assign({}, e), { - hitFrame: U.frame - Math.abs(U.playerX - a.x) / 5, - }), - U.layoutState, - inViewLayoutState, - fullLayoutStateIndexes, - K, - ); - } - } + ); + }, + hl = { + songs: { + dragonfly: { + name: "Dragonfly", + author: "Nitro Fun", + fileName: "audio/tracks/nitro-fun-dragonfly.mp3", + bpm: 130, + label: "Wolf Beats", + isBonusSong: false, + }, + stardust: { + name: "Stardust", + author: "Geoxor", + fileName: "audio/tracks/geoxor-stardust.mp3", + bpm: 110, + isBonusSong: false, + }, + solarWind: { + name: "Solar Wind", + author: "Jumper", + fileName: "audio/tracks/jumper-solar-wind.mp3", + bpm: 130, + }, + solace: { + name: "Solace", + author: "Avenza", + fileName: "audio/tracks/avenza-solace.mp3", + bpm: 115, + isBonusSong: false, + }, + solarAbyss: { + name: "Solar Abyss", + author: "Lchvasse", + fileName: "audio/tracks/lchvasse-solar-abyss.mp3", + bpm: 150, + isBonusSong: false, + }, + rockinThatBass: { + name: "Rockin' That Bass", + author: "MrCoolTrix", + bpm: 130, + fileName: "audio/tracks/mrcooltrix-rockin-that-bass.mp3" + }, + thinkDifferent: { + name: "Think Different", + author: "Panda Eyes & Gabriel Guardian", + fileName: "audio/tracks/panda-eyes-think-different.mp3", + bpm: 150, + isBonusSong: false, + }, + indestructable: { + name: "Indestructable", + author: "Aaro", + fileName: "audio/tracks/aaro-indestructable.mp3", + bpm: 128, + label: "Tasty", + isBonusSong: false, + }, + glitchedOut: { + name: "Glitched Out", + author: "FantomenK", + fileName: "audio/tracks/fantomenk-glitched-out.mp3 ", + bpm: 140, + }, + eightBitAdventure: { + name: "8 Bit Adventure", + author: "AdhesiveWombat", + fileName: "audio/tracks/adhesive-wombat-8-bit-adventure.mp3", + bpm: 153, + isBonusSong: false, + }, + eightBitShuffle: { + name: "8 Bit Shuffle", + author: "Inova", + fileName: "audio/tracks/inova-8-bit-shuffle.mp3", + bpm: 133, + label: "Argofox", + isBonusSong: false, + }, + octane: { + name: "Octane", + author: "Inova", + fileName: "audio/tracks/inova-octane.mp3", + bpm: 125, + label: "Argofox", + isBonusSong: false, + }, + milkyWays: { + name: "Milky Ways", + author: "Bossfight", + fileName: "audio/tracks/bossfight-milky-ways.mp3", + bpm: 183, + isBonusSong: false, + }, + darkSheep: { + name: "Dark Sheep", + author: "Chroma", + fileName: "audio/tracks/chroma-dark-sheep.mp3", + bpm: 177, + isBonusSong: false, + }, + daydreamer: { + name: "Daydreamer", + author: "Meganeko", + fileName: "audio/tracks/meganeko-daydreamer.mp3", + bpm: 135, + isBonusSong: false, + }, + breathe: { + name: "Breathe", + author: "meganeko & RoccoW", + fileName: "audio/tracks/meganeko-breathe.mp3", + bpm: 155, + isBonusSong: false, + }, + criticalHitExtended: { + name: "Critical Hit (Extended Cut)", + author: "MDK", + fileName: "audio/tracks/mdk-critical-hit-extended.mp3", + bpm: 130, + }, + criticalHit: { + name: "Critical Hit", + author: "MDK", + fileName: "audio/tracks/mdk-critical-hit.mp3", + bpm: 130, + isBonusSong: false, + }, + silverdust: { + name: "Silverdust", + author: "Geoxor", + fileName: "audio/tracks/geoxor-silverdust.mp3", + bpm: 140, + }, + lighthouse: { + name: "Lighthouse", + author: "Ghost'n'Ghost", + fileName: "audio/tracks/ghost-n-ghost-lighthouse.mp3", + bpm: 128, + label: "Argofox", + isBonusSong: false, + }, + frontier: { + name: "Frontier", + author: "Doctor Vox", + fileName: "audio/tracks/doctor-vox-frontier.mp3", + bpm: 124, + label: "Argofox", + isBonusSong: false, + }, + toe3: { + name: "Theory Of Everything 3", + author: "dj-Nate", + fileName: "audio/tracks/dj-nate-theory-of-everything-3.mp3", + bpm: 140, + isBonusSong: true, + }, + polymorph: { + name: "Polymorph", + author: "The Brig", + fileName: "audio/tracks/the-brig-polymorph.mp3", + bpm: 150, + isBonusSong: false, + }, + accelerated: { + name: "Accelerated", + author: "Miami Nights 1984", + fileName: "audio/tracks/miami-nights-1984-accelerated.mp3", + bpm: 130, + isBonusSong: false, + }, + skyFracture: { + name: "Sky Fracture", + author: "Getsix", + fileName: "audio/tracks/getsix-sky-fracture.mp3", + bpm: 176, + isBonusSong: false, + }, + truecolors: { + name: "True Colors", + author: "Geoxor", + fileName: "audio/tracks/geoxor-true-colors.mp3", + bpm: 128, + isBonusSong: true, + }, + blythe: { + name: "Blythe", + author: "Aika (feat. TOFIE)", + fileName: "audio/tracks/aika-blythe.mp3", + bpm: 105, + isBonusSong: false, + }, + color: { + name: "Color", + author: "Amidst", + fileName: "audio/tracks/amidst-color.mp3", + bpm: 130, + }, + awake: { + name: "Awake", + author: "Amidst", + fileName: "audio/tracks/amidst-awake.mp3", + bpm: 130, + label: "Argofox", + isBonusSong: false, + }, + coincidence: { + name: "Coincidence", + author: "3b", + fileName: "audio/tracks/3b-coincidence.mp3", + bpm: 124, + label: "Wolf Beats", + isBonusSong: false, + }, + mutant: { + name: "Mutant", + author: "Evilwave & Teminite (ft. Prey For Me)", + fileName: "audio/tracks/evilwave-mutant.mp3", + bpm: 150, + isBonusSong: false, + }, + overdrive: { + name: "Overdrive", + author: "Far Out", + fileName: "audio/tracks/far-out-overdrive.mp3", + bpm: 172, + isBonusSong: false, + }, + // official order: red shift, fire aura, heaven, minds of mad, phobos + redShift: { + name: "Red Shift", + author: "Cubed", + fileName: "audio/tracks/cubed-red-shift.mp3", + bpm: 150, + isBonusSong: true, + }, + fireAura: { + name: "Fire Aura", + author: "Kid2Will", + fileName: "audio/tracks/kid2will-fire-aura.mp3", + bpm: 180, + isBonusSong: true, + }, + heaven: { + name: "Heaven", + author: "EnV", + fileName: "audio/tracks/env-heaven.mp3", + bpm: 150, + isBonusSong: true, + }, + mindsOfTheMad: { + name: "Minds Of The Mad", + author: "Exilelord", + fileName: "audio/tracks/exilelord-minds-of-the-mad.mp3", + bpm: 150, + }, + phobos: { + name: "Phobos", + author: "Solkraig", + bpm: 140, + fileName: "audio/tracks/solkraig-phobos.mp3" + }, + cloud9: { + name: "Cloud 9", + author: "Valesco", + fileName: "audio/tracks/valesco-cloud-9.mp3", + bpm: 140, + label: "Argofox", + isBonusSong: true, + }, + virtual: { + name: "Virtual", + author: "Geoxor", + fileName: "audio/tracks/geoxor-virtual.mp3", + bpm: 128, + isBonusSong: true, + }, + aura: { + name: "Aura", + author: "Creo", + fileName: "audio/tracks/creo-aura.mp3", + bpm: 128, + isBonusSong: true, + }, + lastTile: { + name: "Last Tile", + author: "Kommisar", + bpm: 150, + fileName: "audio/tracks/kommisar-last-tile.mp3", + }, + coolFriends: { + name: "Cool Friends", + author: "Silva Hound (Murtagh & Veschell Remix)", + fileName: "audio/tracks/silva-hound-cool-friends.mp3", + bpm: 115, + isBonusSong: true, + }, + + nacreousSnowmelt: { + name: "Nacreous Snowmelt", + author: "Camellia", + fileName: "audio/tracks/camellia-nacreous-snowmelt.mp3", + bpm: 201, + isBonusSong: true, + }, + rummy: { + name: "Rum n' Bass", + author: "BoomKitty", + fileName: "audio/tracks/boomkitty-rum-and-bass.mp3", + bpm: 132, + isBonusSong: true, + }, + forYou: { + name: "For You (+ Waterfall mashup)", + author: "ColBreakz & EXODIE, SkybreakEDM", + fileName: "audio/tracks/colbreakz-for-you.mp3", + bpm: 145, + isBonusSong: true, + }, + + chaozFantasy: { + name: "Chaoz Fantasy", + author: "ParagonX9", + fileName: "audio/tracks/paragonx9-chaoz-fantasy.mp3", + bpm: 162, + isBonusSong: true, + }, + phazd: { + name: "Phazd", + author: "tobycreed", + fileName: "audio/tracks/tobycreed-phazd.mp3", + bpm: 165, + isBonusSong: true, + }, + finalTheory: { + name: "Final Theory", + author: "dj-Nate", + fileName: "audio/tracks/dj-nate-final-theory.mp3", + bpm: 132, + isBonusSong: false, + }, + piratemanners: { + name: "Pirate Manners", + author: "Bossfight", + fileName: "audio/tracks/bossfight-pirate-manners.mp3", + bpm: 116, + isBonusSong: true, + }, + + + orientalSwing: { + name: "Oriental Swing", + author: "Xe & cYsmix", + fileName: "audio/tracks/xe-cysmix-oriental-swing.mp3", + bpm: 125, + isBonusSong: false, + }, + clutterfunk: { + name: "Clutterfunk", + author: "Waterflame", + fileName: "audio/tracks/waterflame-clutterfunk.mp3", + bpm: 140, + }, + soulless2: { + name: "Mechanical Machine (Soulless 2)", + author: "Exilelord", + fileName: "audio/tracks/exilelord-mechanical-machine.mp3", + bpm: 125, + length: "5 mins", + isBonusSong: true, + }, + raceAroundTheWorld: { + name: "Race Around The World", + author: "Waterflame", + fileName: "audio/tracks/waterflame-race-around-the-world.mp3", + bpm: 180, + }, + machina: { + name: "Machina", + author: "Dex Arson", + fileName: "audio/tracks/dex-arson-machina.mp3", + bpm: 125, + }, + + soulless4: { + name: "Soulless 4", + author: "Exilelord", + fileName: "audio/tracks/exilelord-soulless-4.mp3", + bpm: 125, + length: "12 mins", + isBonusSong: true, + }, + zenith: { + name: "Zenith", + author: "Geoxor", + fileName: "audio/tracks/geoxor-zenith.mp3", + bpm: 128, + }, + superUltra: { + name: "Super Ultra", + author: "MDK", + fileName: "audio/tracks/mdk-super-ultra.mp3", + bpm: 172, + isBonusSong: false, + }, + funkyPunky: { + name: "Funky Punky", + author: "Grge & Antian Rose", + fileName: "audio/tracks/george-antian-rose-funky-punky.mp3", + bpm: 128, + }, + octaneExtended: { + name: "Octane (Full ver.)", + author: "Inova", + fileName: "audio/tracks/inova-octane-extended.mp3", + bpm: 125, + label: "Argofox", + }, + electrodynamix: { + name: "Electrodynamix", + author: "dj-Nate", + fileName: "audio/tracks/dj-nate-electrodynamix.mp3", + bpm: 127, + }, + skyFractureExtended: { + name: "Sky Fracture (extended)", + author: "Getsix", + fileName: "audio/tracks/getsix-sky-fracture-extended.mp3", + bpm: 176, + }, + plummet: { + name: "Plümmet", + author: "Onefin & Stardew", + fileName: "audio/tracks/onefin-stardew-plummet.mp3", + bpm: 134, + }, + + hellidox: { + name: "Hellidox", + author: "Exilelord", + bpm: 200, + fileName: "audio/tracks/exilelord-hellidox.mp3", + }, + jackpot: { + name: "Jackpot", + author: "TheFatRat", + bpm: 103, + fileName: "audio/tracks/the-fat-rat-jackpot.mp3", + }, + carnival: { + name: "Carnival", + author: "DJVI", + bpm: 128, + fileName: "audio/tracks/djvi-carnival.mp3", + }, + robotLanguage: { + name: "Robot Language", + author: "meganeko", + bpm: 132, + fileName: "audio/tracks/meganeko-robot-language.mp3", + }, + dryOut: { + name: "Dry Out", + author: "DJVI", + bpm: 145, + fileName: "audio/tracks/djvi-dry-out.mp3", + }, + carnivores: { + name: "Carnivores", + author: "Creo", + bpm: 120, + fileName: "audio/tracks/creo-carnivores.mp3", + }, + + }, + getSnippetName: (e) => e.replace("audio/tracks", "audio/snippets"), + }, + pl = 2.5 * G.jumpDistance, + gl = G.getJumpFrames(130); + function ml(e, t, a, data1, data2) { + switch (e) { + case "thinBullet": + return { + type: "thinBullet", + x: t, + y: a, + width: 22, + height: 8, + speedX: -3, + speedY: 0, + gradY: 0, + destroyed: false, + }; + case "missile": + return { + type: "missile", + x: t, + y: a, + width: 33, + height: 15, + speedX: -0.5, + speedY: 0 === data1 ? 3 : -3, + gradY: 0, + destroyed: false, + }; + case "cannonbomb": + return { + type: "cannonbomb", + x: t, + y: a, + width: 30, + height: 30, + speedX: data2 || 0, + speedY: data1 || 0, + gradY: -0.4, + destroyed: false, + }; + case "bomb": + return { + type: "bomb", + x: t, + y: a, + width: 30, + height: 30, + speedX: -3, + speedY: 0, + gradY: -0.4, + destroyed: false, + }; + case "bulletHell": + case "bulletHellBig": + const n = 30 * data1, + s = B.toRad(30 + n), + o = "bulletHell" === e ? 1.8 : 7, + r = "bulletHell" === e ? 3 : 15; + return { + type: "bulletHell", + x: t, + y: a, + width: r, + height: r, + speedX: ("bulletHell" === e ? 4 : -1) - 2 * Math.sin(s), + speedY: Math.cos(s) * o, + gradY: 0, + destroyed: false, + }; + case "laser": + return { + type: "laser", + x: t, + y: a, + width: 600, + height: 100, + speedX: 0, + speedY: 0, + gradY: 0, + destroyed: false, + }; + } + } + function fl(e, df, crashed, playerX) { + if ("laser" === e.type) return; + if ( + ((e.y += e.speedY * df), + (e.speedY += e.gradY * df), + "bomb" === e.type || "cannonbomb" === e.type) + ) { + const t = et.initialPosition.y - 15 + e.height / 2; + if (e.y < t && !(e.speedY > 0)) { + if ("cannonbomb" === e.type) { + e.destroyed = true; + e.speedY = 0; + e.y = t; + } else { + e.speedY *= -0.25; + e.y = t + (t - e.y); } - const ue = Ca.getAllDeadlyObjects(inViewLayout, inViewLayoutState); - if (null !== Q) { - U.isGravity = false; - const e = G.getOvershootPercent(U.playerY - Q, U.playerGradY, j); - if (skating) { - const e = Math.abs(U.playerRot % 360); - if (e > 60 && e < 300) U.crashed = true; - else if ( - "platform" === de.object.type && - "rail" === de.object.movement - ) { - const e = 0 === U.playerWasOnGroundCooldown; - ((U.score = zo.addScore(U.score, false, e)), - e && (null == v || v.scoreMultiplier(U.score.multiplier)), - (U.playerUsingPowerup = true)); - } else - !J && - U.score.local > 0 && - ((U.score = zo.didLand(U.score)), - null == v || v.addScore()); - ((U.playerWasOnGroundCooldown = 10), (U.playerRot = 0)); - } else - U.playerRot = U.dashing - ? U.playerRot - : et.closestFlatAngle(U.playerRot); - if ( - (Math.abs(U.playerGradY) > w && - (L.landTimer = et.landTimerLimit), - U.flyingAnchor === null && - (U.jumping = U.gravity > 0 ? isDown && !skating : false), - (U.playerY = Q), - (U.playerGradY = 0), - U.jumping && - !U.playerPowerups.some((e) => e.item === "jetpack")) - ) { - Z = be.hitObject( - U.playerX, - U.playerY, - U.playerScaleX, - U.playerScaleY, - U.dashing ? 0 : U.playerRot, - skating, - K, - ); - for (let e = 0; e < ue.length; e++) { - const { object: t } = ue[e]; - Z(t) && (U.crashed = true); + } + } else + "missile" === e.type && + (e.x - playerX < 160 || crashed) && + (e.speedY *= 0.85 + (df < 1 ? 0.07 : 0)); + const n = crashed + ? e.speedX === 0 + ? 0 + : Math.min(-1, e.speedX) + : e.speedX; + e.x += n * df; + } + const yl = G.getJumpFrames(176), + El = M, + bl = et.initialPosition.y + 90, + Sl = et.initialPosition.y, + Il = [ + [716, 36, 25], + [893, 45, 20], + [1206, -80, 28], + [1300, -88, 30], + [1402, -17, 17], + [1546, 44, 16], + [1585, 76, 28], + [1739, 54, 25], + [1831, -23, 11], + [1887, 81, 20], + [1982, 68, 19], + [2095, -34, 24], + [2154, 97, 20], + [2259, -45, 16], + [2417, -95, 12], + [2486, 76, 21], + [2555, -100, 20], + [2709, 75, 22], + [2797, 10, 21], + [2892, 78, 25], + [3012, -40, 26], + [3186, 13, 13], + [3279, -7, 25], + [3428, -72, 25], + [3641, -81, 17], + [3753, -66, 18], + [3868, -99, 16], + [4e3, -68, 28], + [4120, 43, 22], + [4255, -54, 23], + [4414, 6, 26], + [4623, -47, 27], + [4848, -2, 10], + [4876, 26, 11], + [4994, -69, 33], + [5247, -18, 22], + [5296, 10, 17], + [5443, 11, 19], + [5593, -51, 15], + [5645, -17, 21], + [5711, -70, 19], + [5843, 39, 12], + [5916, -13, 12], + [6059, -64, 23], + [6259, -15, 20], + [6381, 28, 21], + [6518, -90, 30], + [6685, 91, 20], + [6720, -86, 17], + [6899, -63, 25], + [6958, -64, 18], + [7051, -79, 12], + [7153, 73, 25], + [7255, 0, 18], + [7324, 28, 21], + [7487, 92, 17], + [7500, 6, 25], + [7622, -69, 14], + [7750, -49, 30], + [7907, 14, 23], + [8e3, -50, 12], + [13388, -69, 17], + [13625, 43, 22], + [13993, -37, 27], + [14414, 22, 17], + [14507, 62, 26], + [14962, 68, 19], + [15232, -49, 12], + [15707, 56, 27], + [16116, 31, 29], + [16455, 36, 20], + [16641, 23, 28], + [17324, 33, 13], + [17471, -10, 19], + [17825, 98, 15], + [18159, -49, 23], + [18333, -24, 25], + [18445, -52, 20], + [18907, 26, 17], + [19408, -41, 29], + [19518, -20, 20], + [19863, 10, 22], + [20230, -48, 17], + [20483, -32, 30], + [20889, -98, 21], + [21083, 32, 30], + [21481, -48, 17], + [21838, 7, 22], + [22004, 81, 18], + [22153, -7, 18], + [22719, -84, 35], + [22908, -16, 10], + [23129, -79, 27], + [23488, 40, 28], + [23789, 41, 12], + [24026, 24, 22], + [24249, 99, 15], + [24298, 0, 14], + [24470, 77, 12], + [24693, -93, 11], + [24885, -41, 30], + [25347, 82, 20], + [25524, -40, 17], + [25802, -25, 27], + [26166, 39, 18], + [26253, 49, 18], + [26434, 65, 24], + [26480, 30, 15], + [26859, -55, 32], + [28061, 34, 12], + [28110, 16, 10], + [28460, -29, 10], + [28711, -26, 14], + [28858, -36, 20], + [29194, 12, 26], + [29820, 17, 24], + [30142, -50, 21], + [30929, -90, 13], + [31328, 80, 14], + [31401, 32, 17], + [31835, 68, 13], + [32347, -50, 29], + [32344, 89, 17], + [32749, 92, 21], + [32902, 92, 19], + [33155, -55, 21], + [33445, 50, 24], + [33750, -14, 18], + [33950, -46, 23], + [34139, 84, 28], + [34230, -32, 11], + [34521, -61, 17], + [58180, -50, 21], + ], + _l = [ + { type: "top", count: 4 }, + { type: "middle", count: 1 }, + { type: "bottom", count: 3 }, + { type: "middle", count: 1 }, + { type: "top", count: 2 }, + { type: "middle", count: 1 }, + { type: "bottom", count: 3 }, + { type: "middle", count: 1 }, + { type: "top", count: 2 }, + { type: "middle", count: 1 }, + { type: "bottom", count: 3 }, + { type: "middle", count: 1 }, + { type: "top", count: 3 }, + { type: "middle", count: 1 }, + { type: "topStalectite", count: 1 }, + { type: "middle", count: 1 }, + { type: "bottomStalecmite", count: 1 }, + { type: "middle", count: 1 }, + { type: "topStalectite", count: 1 }, + { type: "middle", count: 1 }, + { type: "bottomStalecmite", count: 1 }, + { type: "topStalectite", count: 1 }, + { type: "middle", count: 1 }, + { type: "bottomStalecmite", count: 1 }, + { type: "topStalectite", count: 1 }, + { type: "bottomStalecmite", count: 1 }, + { type: "topStalectite", count: 1 }, + { type: "bottomStalecmite", count: 1 }, + { type: "middle", count: 1 }, + { type: "topStalectite", count: 1 }, + { type: "middle", count: 1 }, + { type: "bottomStalecmite", count: 1 }, + { type: "middle", count: 1 }, + { type: "topStalectite", count: 1 }, + { type: "middle", count: 1 }, + { type: "bottomStalecmite", count: 1 }, + { type: "middle", count: 1 }, + { type: "bottom", count: 1 }, + { type: "middle", count: 1 }, + { type: "top", count: 1 }, + { type: "middle", count: 1 }, + { type: "bottom", count: 1 }, + ], + vl = 300, + Tl = () => { + let e = 35200; + const t = _l.length - 1; + let a = 0; + return _l.flatMap((i, n) => + Array.from({ length: i.count }).map((s, o) => { + const r = i.count - 1, + l = (0 === n && 0 === o) || (n === t && o === r), + c = (() => { + switch (i.type) { + case "top": + return l + ? "topEntry" + : 1 === i.count + ? "topSingle" + : 0 === o + ? "topLeading" + : o === r + ? "topTrailing" + : "topJoin"; + case "bottom": + return l + ? "bottomExit" + : 1 === i.count + ? "bottomSingle" + : 0 === o + ? "bottomLeading" + : o === r + ? "bottomTrailing" + : "bottomJoin"; + default: + return i.type; + } + })(); + return ( + (e += vl), + a++, + { + type: c, + hitType: "middle" === i.type ? null : i.type, + x: e, + index: a, } - null == v || v.jump(false); - const { y: t, gradY: a } = G.stepY( - U.playerY, - G.initGrad(V), - j, + ); + }), + ); + }, + Rl = 5236, + Ol = 5396, + Cl = [ + { x: 635, y: -14, width: 15, height: 20, index: 0 }, + { x: 750, y: -116, width: 15, height: 20, index: 1 }, + { x: 842, y: -60, width: 15, height: 20, index: 2 }, + { x: 1020, y: -107, width: 15, height: 20, index: 4 }, + { x: 1125, y: -58, width: 15, height: 20, index: 5 }, + { x: 1210, y: -4, width: 15, height: 20, index: 6 }, + { x: 1319, y: -25, width: 15, height: 20, index: 7 }, + { x: 1450, y: -52, width: 15, height: 20, index: 8 }, + { x: 1551, y: -108, width: 15, height: 20, index: 9 }, + { x: 1630, y: -30, width: 15, height: 20, index: 10 }, + { x: 1732, y: -70, width: 15, height: 20, index: 11 }, + { x: 1830, y: -99, width: 15, height: 20, index: 12 }, + { x: 1940, y: -60, width: 15, height: 20, index: 13 }, + { x: 2038, y: -21, width: 15, height: 20, index: 14 }, + { x: 2166, y: -63, width: 15, height: 20, index: 15 }, + { x: 2201, y: -65, width: 15, height: 20, index: 16 }, + { x: 2330, y: -111, width: 15, height: 20, index: 17 }, + { x: 2436, y: -30, width: 15, height: 20, index: 18 }, + { x: 2443, y: -60, width: 15, height: 20, index: 19 }, + { x: 2618, y: -142, width: 15, height: 20, index: 20 }, + { x: 2653, y: -24, width: 15, height: 20, index: 21 }, + { x: 2804, y: -60, width: 15, height: 20, index: 22 }, + { x: 2907, y: -107, width: 15, height: 20, index: 23 }, + { x: 3046, y: -67, width: 15, height: 20, index: 24 }, + { x: 3150, y: -66, width: 15, height: 20, index: 25 }, + { x: 3227, y: -105, width: 15, height: 20, index: 26 }, + { x: 3341, y: -48, width: 15, height: 20, index: 27 }, + { x: 3407, y: -138, width: 15, height: 20, index: 28 }, + { x: 3545, y: -47, width: 15, height: 20, index: 29 }, + { x: 3643, y: -92, width: 15, height: 20, index: 30 }, + { x: 3730, y: -50, width: 15, height: 20, index: 31 }, + { x: 5510, y: -60, width: 15, height: 20, index: 32 }, + { x: 5629, y: -102, width: 15, height: 20, index: 33 }, + { x: 5678, y: -69, width: 15, height: 20, index: 34 }, + { x: 5778, y: 8, width: 15, height: 20, index: 35 }, + { x: 5853, y: -75, width: 15, height: 20, index: 36 }, + { x: 5928, y: -131, width: 15, height: 20, index: 37 }, + { x: 6e3, y: 38, width: 15, height: 20, index: 38 }, + { x: 6107, y: -98, width: 15, height: 20, index: 39 }, + { x: 6140, y: -68, width: 15, height: 20, index: 40 }, + { x: 6242, y: -17, width: 15, height: 20, index: 41 }, + { x: 6346, y: 72, width: 15, height: 20, index: 42 }, + { x: 6387, y: -55, width: 15, height: 20, index: 43 }, + { x: 6500, y: -54, width: 15, height: 20, index: 44 }, + { x: 6588, y: 28, width: 15, height: 20, index: 45 }, + { x: 6627, y: -111, width: 15, height: 20, index: 46 }, + { x: 6740, y: 89, width: 15, height: 20, index: 47 }, + { x: 6785, y: -20, width: 15, height: 20, index: 48 }, + { x: 6864, y: -65, width: 15, height: 20, index: 49 }, + { x: 6963, y: -101, width: 15, height: 20, index: 50 }, + { x: 7053, y: -19, width: 15, height: 20, index: 51 }, + { x: 7122, y: 86, width: 15, height: 20, index: 52 }, + { x: 7181, y: -53, width: 15, height: 20, index: 53 }, + { x: 7273, y: 71, width: 15, height: 20, index: 54 }, + { x: 7368, y: -65, width: 15, height: 20, index: 55 }, + { x: 7461, y: 12, width: 15, height: 20, index: 56 }, + { x: 7533, y: 71, width: 15, height: 20, index: 57 }, + { x: 7612, y: -69, width: 15, height: 20, index: 58 }, + { x: 7655, y: -62, width: 15, height: 20, index: 59 }, + { x: 7880, y: -47, width: 15, height: 20, index: 60 }, + { x: 7900, y: 50, width: 15, height: 20, index: 61 }, + { x: 7912, y: -28, width: 15, height: 20, index: 62 }, + ], + wl = [ + { x: 17633, y: 268, width: 10, height: 8, index: 142 }, + { x: 17917, y: 115, width: 10, height: 8, index: 143 }, + { x: 18225, y: 220, width: 10, height: 8, index: 144 }, + { x: 18528, y: 107, width: 10, height: 8, index: 145 }, + { x: 18845, y: 90, width: 10, height: 8, index: 146 }, + { x: 20514, y: 106, width: 10, height: 8, index: 0 }, + { x: 20605, y: 305, width: 10, height: 8, index: 2 }, + { x: 20703, y: 306, width: 10, height: 8, index: 4 }, + { x: 20840, y: 170, width: 10, height: 8, index: 6 }, + { x: 20891, y: 123, width: 10, height: 8, index: 7 }, + { x: 20994, y: 347, width: 10, height: 8, index: 9 }, + { x: 21085, y: 70, width: 10, height: 8, index: 11 }, + { x: 21159, y: 201, width: 10, height: 8, index: 13 }, + { x: 21278, y: 163, width: 10, height: 8, index: 15 }, + { x: 21513, y: 253, width: 10, height: 8, index: 20 }, + { x: 21631, y: 303, width: 10, height: 8, index: 22 }, + { x: 21660, y: 244, width: 10, height: 8, index: 23 }, + { x: 21718, y: 155, width: 10, height: 8, index: 24 }, + { x: 21802, y: 90, width: 10, height: 8, index: 26 }, + { x: 21896, y: 250, width: 10, height: 8, index: 27 }, + { x: 21990, y: 306, width: 10, height: 8, index: 29 }, + { x: 22013, y: 344, width: 10, height: 8, index: 30 }, + { x: 22083, y: 236, width: 10, height: 8, index: 31 }, + { x: 22126, y: 141, width: 10, height: 8, index: 32 }, + { x: 22180, y: 320, width: 10, height: 8, index: 33 }, + { x: 22389, y: 96, width: 10, height: 8, index: 37 }, + { x: 22418, y: 327, width: 10, height: 8, index: 38 }, + { x: 22462, y: 226, width: 10, height: 8, index: 39 }, + { x: 22527, y: 118, width: 10, height: 8, index: 40 }, + { x: 22580, y: 222, width: 10, height: 8, index: 41 }, + { x: 22639, y: 302, width: 10, height: 8, index: 42 }, + { x: 22658, y: 178, width: 10, height: 8, index: 43 }, + { x: 22745, y: 78, width: 10, height: 8, index: 44 }, + { x: 22787, y: 275, width: 10, height: 8, index: 45 }, + { x: 22839, y: 167, width: 10, height: 8, index: 46 }, + { x: 22856, y: 319, width: 10, height: 8, index: 47 }, + { x: 22900, y: 143, width: 10, height: 8, index: 48 }, + { x: 22979, y: 100, width: 10, height: 8, index: 49 }, + { x: 23085, y: 287, width: 10, height: 8, index: 51 }, + { x: 23140, y: 122, width: 10, height: 8, index: 52 }, + { x: 23182, y: 147, width: 10, height: 8, index: 53 }, + { x: 23216, y: 56, width: 10, height: 8, index: 54 }, + { x: 23272, y: 217, width: 10, height: 8, index: 55 }, + { x: 23318, y: 302, width: 10, height: 8, index: 56 }, + { x: 23364, y: 106, width: 10, height: 8, index: 57 }, + { x: 23431, y: 236, width: 10, height: 8, index: 58 }, + { x: 23474, y: 295, width: 10, height: 8, index: 59 }, + { x: 23547, y: 103, width: 10, height: 8, index: 60 }, + { x: 23588, y: 225, width: 10, height: 8, index: 61 }, + { x: 23618, y: 339, width: 10, height: 8, index: 62 }, + { x: 23684, y: 60, width: 10, height: 8, index: 63 }, + { x: 23719, y: 315, width: 10, height: 8, index: 64 }, + { x: 23805, y: 296, width: 10, height: 8, index: 66 }, + { x: 23815, y: 106, width: 10, height: 8, index: 67 }, + { x: 23927, y: 255, width: 10, height: 8, index: 68 }, + { x: 23985, y: 323, width: 10, height: 8, index: 69 }, + { x: 24030, y: 294, width: 10, height: 8, index: 70 }, + { x: 24098, y: 170, width: 10, height: 8, index: 71 }, + { x: 24110, y: 341, width: 10, height: 8, index: 72 }, + { x: 24159, y: 101, width: 10, height: 8, index: 73 }, + { x: 24207, y: 342, width: 10, height: 8, index: 74 }, + { x: 24255, y: 264, width: 10, height: 8, index: 75 }, + { x: 24312, y: 168, width: 10, height: 8, index: 76 }, + { x: 24354, y: 59, width: 10, height: 8, index: 77 }, + { x: 24413, y: 231, width: 10, height: 8, index: 78 }, + { x: 24482, y: 123, width: 10, height: 8, index: 79 }, + { x: 24505, y: 175, width: 10, height: 8, index: 80 }, + { x: 24599, y: 343, width: 10, height: 8, index: 81 }, + { x: 24643, y: 179, width: 10, height: 8, index: 82 }, + { x: 24706, y: 137, width: 10, height: 8, index: 84 }, + { x: 24789, y: 316, width: 10, height: 8, index: 85 }, + { x: 24814, y: 144, width: 10, height: 8, index: 86 }, + { x: 24865, y: 319, width: 10, height: 8, index: 87 }, + { x: 24943, y: 87, width: 10, height: 8, index: 88 }, + { x: 24998, y: 264, width: 10, height: 8, index: 89 }, + { x: 25040, y: 211, width: 10, height: 8, index: 90 }, + { x: 25062, y: 57, width: 10, height: 8, index: 91 }, + { x: 25130, y: 105, width: 10, height: 8, index: 92 }, + { x: 26508, y: 260, width: 10, height: 8, index: 93 }, + { x: 26697, y: 271, width: 10, height: 8, index: 94 }, + { x: 26808, y: 83, width: 10, height: 8, index: 95 }, + { x: 27004, y: 97, width: 10, height: 8, index: 96 }, + { x: 27120, y: 300, width: 10, height: 8, index: 97 }, + { x: 27267, y: 215, width: 10, height: 8, index: 98 }, + { x: 27439, y: 132, width: 10, height: 8, index: 99 }, + { x: 27585, y: 239, width: 10, height: 8, index: 100 }, + { x: 27706, y: 321, width: 10, height: 8, index: 101 }, + { x: 27852, y: 343, width: 10, height: 8, index: 102 }, + { x: 28003, y: 136, width: 10, height: 8, index: 103 }, + { x: 28183, y: 107, width: 10, height: 8, index: 104 }, + { x: 28315, y: 133, width: 10, height: 8, index: 105 }, + { x: 28465, y: 235, width: 10, height: 8, index: 106 }, + { x: 28647, y: 72, width: 10, height: 8, index: 107 }, + { x: 28779, y: 154, width: 10, height: 8, index: 108 }, + { x: 28908, y: 84, width: 10, height: 8, index: 109 }, + { x: 29100, y: 270, width: 10, height: 8, index: 110 }, + { x: 29235, y: 286, width: 10, height: 8, index: 111 }, + { x: 29355, y: 56, width: 10, height: 8, index: 112 }, + { x: 29523, y: 261, width: 10, height: 8, index: 113 }, + { x: 29683, y: 112, width: 10, height: 8, index: 114 }, + { x: 29824, y: 310, width: 10, height: 8, index: 115 }, + { x: 29955, y: 92, width: 10, height: 8, index: 116 }, + { x: 30112, y: 249, width: 10, height: 8, index: 117 }, + { x: 30273, y: 224, width: 10, height: 8, index: 118 }, + { x: 30403, y: 49, width: 10, height: 8, index: 119 }, + { x: 30556, y: 272, width: 10, height: 8, index: 120 }, + { x: 30715, y: 69, width: 10, height: 8, index: 121 }, + { x: 30863, y: 186, width: 10, height: 8, index: 122 }, + { x: 31046, y: 290, width: 10, height: 8, index: 123 }, + { x: 31152, y: 252, width: 10, height: 8, index: 124 }, + { x: 31327, y: 307, width: 10, height: 8, index: 125 }, + { x: 31491, y: 96, width: 10, height: 8, index: 126 }, + { x: 31638, y: 179, width: 10, height: 8, index: 127 }, + { x: 31789, y: 83, width: 10, height: 8, index: 128 }, + { x: 31923, y: 338, width: 10, height: 8, index: 129 }, + { x: 32071, y: 274, width: 10, height: 8, index: 130 }, + { x: 32246, y: 111, width: 10, height: 8, index: 131 }, + { x: 32358, y: 140, width: 10, height: 8, index: 132 }, + { x: 32519, y: 329, width: 10, height: 8, index: 133 }, + { x: 32824, y: 90, width: 10, height: 8, index: 135 }, + { x: 33047, y: 96, width: 10, height: 8, index: 136 }, + { x: 33060, y: 124, width: 10, height: 8, index: 137 }, + { x: 33077, y: 91, width: 10, height: 8, index: 138 }, + { x: 33247, y: 91, width: 10, height: 8, index: 139 }, + { x: 33260, y: 124, width: 10, height: 8, index: 140 }, + { x: 33277, y: 96, width: 10, height: 8, index: 141 }, + ], + getRobotBoss = function () { + return { + mutatesState: true, + fileNames: { + spine: [Qs.spineFiles.world1Boss], + audio: ["audio/levels/boss1/death.mp3"], + }, + initState: ({ assets: e, checkpointState: t }) => { + const { frame: a = 0 } = t || {}; + return { + type: "robot", + runtime: Ys( + Qs.spineFiles.world1Boss, e, - 1, + a, + "AnimationBoss", + false, + et.initialPosition.x + pl, + -57, + ), + dead: false, + collisionFn: () => false, + debug: [], + }; + }, + cloneState: (e) => ({ + type: "robot", + runtime: e.runtime, + collisionFn: () => false, + debug: [], + dead: e.dead, + }), + loop: ({ + bossState: e, + playerX: t, + df: a, + crashed: i, + frame: n, + playSound: s, + }) => { + Us(e, a, t - et.initialPosition.x, i, n, s); + }, + crashed: ({ + bossState: e, + playerX: t, + playerY: a, + playerRot: i, + }) => { + const n = B.toRad(45 - i), + s = 21.21 * Math.sin(n), + o = 21.21 * Math.cos(n), + r = [t - s, a + o], + l = [t + o, a + s], + c = [t - o, a - s], + d = [t + s, a - o]; + return !!( + e.collisionFn(...r) || + e.collisionFn(...l) || + e.collisionFn(...d) || + e.collisionFn(...c) + ); + }, + }; + }, + getPixelBoss = function () { + return { + mutatesState: false, + fileNames: { + pixelArtImages: [1, 2, 3, 4, 5] + .flatMap((e) => [ + `images/level/boss2/gunin/health${e}.png`, + `images/level/boss2/gunout/health${e}.png`, + `images/level/boss2/gunshot/health${e}.png`, + `images/level/boss2/idle/health${e}.png`, + `images/level/boss2/lasercharge/base/health${e}.png`, + `images/level/boss2/lasercharge/shot/health${e}.png`, + `images/level/boss2/laserdamage/health${e}.png`, + ]) + .filter(nt) + .concat([ + "images/level/boss2/thinBullet.png", + "images/level/boss2/missile.png", + "images/level/boss2/bomb.png", + "images/level/boss2/cannonbomb.png", + "images/level/boss2/button.png", + "images/level/boss2/bulletHell.png", + "images/level/boss2/bulletHellBig.png", + "images/level/boss2/healthbar.png", + "images/level/boss2/healthbar-frame.png", + "images/level/boss2/lasercharge/guncharging.png", + "images/level/boss2/lasercharge/gunout.png", + "images/level/boss2/lasercharge/laserbar.png", + "images/level/boss2/lasercharge/laserorbs.png", + "images/level/boss2/lasercharge/lasertip.png", + "images/level/boss2/lasercharge/laserbase.png", + "images/level/boss2/lasercharge/laserbody.png", + "images/level/boss2/death/death1.png", + "images/level/boss2/death/death2.png", + "images/level/boss2/death/explosion.png", + ]), + audio: [ + "audio/levels/boss2/bomb.wav", + "audio/levels/boss2/bullethell_large.wav", + "audio/levels/boss2/bullethell_small.wav", + "audio/levels/boss2/death.wav", + "audio/levels/boss2/doublemissile.wav", + "audio/levels/boss2/gun-appear.wav", + "audio/levels/boss2/gun-retract.wav", + "audio/levels/boss2/laser.wav", + "audio/levels/boss2/machinegun.wav", + "audio/levels/boss2/damage.wav", + ], + }, + initState: () => ({ + type: "pixel", + bossX: 650, + bossY: 0, + view: "idle", + isShootingFrames: 0, + startChargeFrame: null, + takingDamageTimeout: 0, + health: 10, + bullets: [], + allButtons: [ + { x: 26370, y: 0, pressed: false }, + { x: 26880, y: -15, pressed: false }, + { x: 27420, y: -15, pressed: false }, + { x: 27720, y: 15, pressed: false }, + { x: 27990, y: 45, pressed: false }, + { x: 28590, y: 90, pressed: false }, + { x: 29100, y: 75, pressed: false }, + ], + destroyed: false, + mutatesState: false, + }), + cloneState: (e) => + Object.assign(Object.assign({}, e), { + bullets: e.bullets.map((e) => Object.assign({}, e)), + }), + loop: ({ + bossState: e, + playerX: playerX, + playerY, + rectangleHitPlayer, + playerOnGroundY, + playerBullets: a, + frame: i, + df: n, + playSound: s, + crashed: o, + }) => { + e.mutatesState = false; + e.isShootingFrames > 0 && (e.isShootingFrames -= n); + for (const a of e.bullets) fl(a, n, o, playerX); + lt(e.bullets, (t) => t.x > e.bossX - 1000); + e.allButtons.forEach((button) => { + let lastPressed = button.pressed; + button.pressed = rectangleHitPlayer( + Object.assign(Object.assign({}, button), { + width: 90, + height: 30, + }), ); - ((U.playerY = t), - (U.boosterDebug && (U.boosterDebug.jumpIndicators.push({x: U.playerX, y: Q}))), - (U.playerGradY = a), - - U.jumpSwitch.timeout <= 0 && - ((U.jumpSwitch.on = !U.jumpSwitch.on), - (U.jumpSwitch.delay = 2), - (U.jumpSwitch.timeout = C / 3)), - (U.justDownInputTimer = 0)); + if (button.pressed && !lastPressed) { + e.bullets.push(ml("cannonbomb", 26370, -90, 10)); + e.bullets.push(ml("cannonbomb", 26550, -90, 11)); + e.bullets.push(ml("cannonbomb", 26790, -90, 11)); + e.bullets.push(ml("cannonbomb", 26970, -90, 12)); + e.bullets.push(ml("cannonbomb", 27120, -90, 10)); + e.bullets.push(ml("cannonbomb", 27255, -90, 15.2)); + e.bullets.push(ml("cannonbomb", 27585, -30, 6)); + e.bullets.push(ml("cannonbomb", 27720, -90, 10)); + e.bullets.push(ml("cannonbomb", 27855, 15, 10)); + e.bullets.push(ml("cannonbomb", 28110, 75, 10)); + e.bullets.push(ml("cannonbomb", 28245, 75, 13.5)); + e.bullets.push(ml("cannonbomb", 28380, 75, 10)); + + e.bullets.push(ml("cannonbomb", 28950, 90, 10, 0.5)); + + e.bullets.push(ml("cannonbomb", 29190, 30, 11)); + e.bullets.push(ml("cannonbomb", 29250, 0, 12)); + e.bullets.push(ml("cannonbomb", 29310, -30, 13)); + e.bullets.push(ml("cannonbomb", 29370, -60, 17)); + e.bullets.push(ml("cannonbomb", 29400, -60, 17)); + } + }); + let r = playerX + 350, + l = e.bossY; + const c = e.view; + switch (i) { + case 450: + case 1352: + case 2250: + case 3512: + case 4458: + (s("audio/levels/boss2/gun-appear.wav"), + (e.view = "gunOut")); + break; + case 500: + case 1402: + case 2300: + case 3562: + case 4508: + e.view = "gun"; + break; + case 1072: + case 1970: + case 2971: + case 4198: + case 4993: + (s("audio/levels/boss2/gun-retract.wav"), + (e.view = "gunIn")); + break; + case 1102: + case 2e3: + case 3342: + case 4238: + case 5083: + case 6020: + e.startChargeFrame = i; + break; + case 3021: + case 5023: + e.view = "idle"; } - } - Z = be.hitObject( - U.playerX, - U.playerY, - U.playerScaleX, - U.playerScaleY, - U.dashing ? 0 : U.playerRot, - skating, - K, - ); - const he = be.hitRectangle( - U.playerX, - U.playerY, - U.playerScaleX, - U.playerScaleY, - U.dashing ? 0 : U.playerRot, - skating, - ); - for (let e = 0; e < ue.length; e++) { - const { object: t, index: a } = ue[e]; - if ("enemy" === t.type && "walker" === t.kind) { - const e = mo.didLandOnHead( - U.frame, - t, - inViewLayoutState.enemies[a], - U.playerY, - U.playerGradY, - V, - he, - ); - if (e) { - ((U.playerGradY = e.playerGradY), - (U.jumping = U.flyingAnchor === null ? U.jumping : false), - (U.isGravity = 0), - xa.updateLayoutStateField( - "enemies", - a, - e.enemyState, - U.layoutState, - inViewLayoutState, - fullLayoutStateIndexes, - K, + if ( + (e.takingDamageTimeout > 0 && + ((e.takingDamageTimeout -= n), + 0 === e.takingDamageTimeout && + "chargeLaserDamage" === e.view && + (e.view = "idle")), + e.startChargeFrame) + ) { + if ( + ((e.view = "chargeLaser"), + i === e.startChargeFrame + 151 && + e.bullets.push( + ml("laser", e.bossX - 105, e.bossY + 5, 0), ), - e.playerCrashed && (U.crashed = true)); - continue; + !o) + ) + for (const t of a) + t.x > e.bossX - 80 && + ((e.view = "chargeLaserDamage"), + (e.startChargeFrame = null), + (e.health -= 1), + (a.length = 0), + (e.takingDamageTimeout = 30)); + (0 === e.health && ((e.view = "death"), (e.destroyed = true)), + (l = -50)); + } else if (i < 450) r = Math.max(r, e.bossX + 3.9 * n); + else if (i < 1322) { + const t = 50; + ((l = 2 * Math.abs(((i - 430) % (2 * t)) - t) - 80), + i > 500 && + i < 1072 && + i % gl < n && + ((e.isShootingFrames = 11), + s("audio/levels/boss2/machinegun.wav"), + e.bullets.push( + ml("thinBullet", e.bossX - 110, e.bossY, 0), + ))); + } else if (i < 2220) + ((l = 2 * Math.abs((i % 100) - 50) - 70), + i > 1402 && + i < 1970 && + i % (gl + 5) < n && + ((e.isShootingFrames = 35), + s("audio/levels/boss2/doublemissile.wav"), + e.bullets.push( + ml("missile", e.bossX - 120, e.bossY + 12, 0), + ), + e.bullets.push( + ml("missile", e.bossX - 120, e.bossY - 8, 1), + ))); + else if (i < 3542) + ((l = 0.5 * Math.abs((i % (2 * gl)) - gl)), + i < 3342 && ((r += 50), (l += 150)), + i > 2300 && + i < 2971 && + i % gl < n && + ((e.isShootingFrames = 17), + s("audio/levels/boss2/bomb.wav"), + e.bullets.push(ml("bomb", e.bossX - 100, e.bossY, 0)))); + else if (i < 4428) { + l = 1.6 * (Math.abs((i % 100) - 50) - 50); + const t = i > 3980; + if (i > 3562 && i < 4198 && i % gl < n) { + ((e.isShootingFrames = 23), + s("audio/levels/boss2/bullethell_small.wav")); + const a = e.bossX - 80, + o = e.bossY + 2; + (e.bullets.push( + ml("bulletHell", a, o, 0), + ml("bulletHell", a, o, 1), + ml("bulletHell", a, o, 2), + ml("bulletHell", a, o, 3), + ml("bulletHell", a, o, 4), + ), + t && + i % (2 * gl) < n && + (s("audio/levels/boss2/bullethell_large.wav"), + e.bullets.push( + ml("bulletHellBig", a, o, -0.5), + ml("bulletHellBig", a, o, 0.5), + ml("bulletHellBig", a, o, 1.5), + ml("bulletHellBig", a, o, 2.5), + ml("bulletHellBig", a, o, 3.5), + ml("bulletHellBig", a, o, 4.5), + ))); } + } else if (i > 6215) { + l = 0.5 * Math.abs((i % (2 * gl)) - gl); + l += 90 + playerOnGroundY; + } else if (i > 5269) { + l = 0.5 * Math.abs((i % (2 * gl)) - gl); + l += 150; + } else if (!e.destroyed) { + const t = 50; + ((l = 2 * Math.abs((i % (2 * t)) - t) - 80), + i > 4508 && + i < 4993 && + (i - gl / 2) % gl < n && + ((e.isShootingFrames = 11), + s("audio/levels/boss2/machinegun.wav"), + e.bullets.push( + ml("thinBullet", e.bossX - 110, e.bossY, 0), + ))); } - Z(t) && (U.crashed = true); - } - const pe = - null !== - (m = - null === (g = U.bottomLine) || void 0 === g - ? void 0 - : g.minY) && void 0 !== m - ? m - : Ca.getMinYFromX(U.playerX, inViewLayout.properties.minY); - if (U.playerY <= pe && !inViewLayout.properties.useGround) { - const e = - null !== - (y = - null === (f = U.bottomLine) || void 0 === f - ? void 0 - : f.objects) && void 0 !== y - ? y - : ((e, t, a) => { - if ("world3" === a || "classic" === a) { - const a = []; - for ( - let i = e - Ca.inViewAreaWidth; - i <= e + Ca.inViewAreaWidth; - i += 60 - ) - a.push({ - type: "laser-line", - x: i, - y: t - 480, - width: 60, - height: 54, - }); - return a; - } - const i = [ - { type: "block-small-spike", width: 30, height: 43 }, - { type: "block-spike", width: 30, height: 53 }, - { type: "block", width: 30, height: 30 }, - { - type: "double-tall-block-spike", - width: 30, - height: 113, - }, - { type: "tall-block-spike", width: 30, height: 70 }, - ], - n = [810, 0], - s = [ - [0, -45], - [30, -60], - [60, -45], - [90, -45], - [120, -30], - [150, -30], - [180, -45], - [210, -45], - [240, -45], - [270, -60], - [300, -75], - [330, -75], - [360, -75], - [390, -90], - [420, -75], - [450, -75], - [480, -75], - [510, -60], - [540, -60], - [570, -75], - [600, -75], - [630, -90], - [660, -90], - [690, -90], - [720, -75], - [750, -60], - [780, -60], - [810, -60], - [870, 0], - [900, 0], - [930, 0], - [960, -15], - [990, -30], - [1020, -30], - [1050, -30], - [1080, -30], - [1110, -45], - [1140, -45], - [1170, -45], - [1200, -60], - [1230, -45], - [1260, -30], - [1290, -45], - [1320, -45], - ].map(([a, n], s) => { - const o = i[s % i.length]; - return Object.assign(Object.assign({}, o), { - x: e + a - Ca.inViewAreaWidth, - y: - n + - t - - 480 + - (o.type.startsWith("double") ? 15 : o.height / 2), - }); - }); - return ( - s.push( - Object.assign( - Object.assign( - {}, - { - type: "block-spike-corner", - width: 86, - height: 83, - }, - ), - { - x: e + n[0] - Ca.inViewAreaWidth + 3, - y: n[1] + t - 480 + 12, - }, - ), - ), - s - ); - })(U.playerX, U.playerY, bottomLineTheme); - for (let t = 0; t < e.length; t++) { - const a = e[t]; - (he(a) && (U.crashed = true), - Ca.isObjectInViewX(a, U.playerX) || - (e[t] = Object.assign(Object.assign({}, a), { - x: a.x + 2 * Ca.inViewAreaWidth * U.playerDir, - }))); - } - U.bottomLine - ? ((U.bottomLine.minY = pe), (U.bottomLine.objects = e)) - : (U.bottomLine = { minY: pe, objects: e }); - } else U.bottomLine = null; - ("missiles" === (null == booster ? void 0 : booster.type) && - xa.useMissiles( - U.frame, - inViewLayout, - inViewLayoutState, - U.playerX, - U.playerY, - U.layoutState, - fullLayoutStateIndexes, - K, - ), - U.playerPowerups.some((e) => e.item === "playerStack") && - U.playerStacks.length > 0 && - ((function (stacks, t, a, i, n, s, o, r, l, enemies, d, u) { - for (let l = 0; l < stacks.length; l++) { - const stack = stacks[l]; - let { y: d, gradY: h } = G.stepY( - stack.y, - stack.gradY, - t, - a, - 1, - ); - let onObject = stack.onObject; - var scale = U.isCompatible ? 1 : U.playerScale; - //console.log(l) - const lastStackY = 0 === l ? n : stacks[l - 1].y, - lastOnObject = - 0 === l ? U.onObject : stacks[l - 1].onObject, - checkStackY = (stackY) => - d < stackY + M * scale + 1 && - ((d = stackY + M * scale), - (h = 0), - (onObject = { array: "stack", index: l - 1, y: d })); - checkStackY(lastStackY); - if (!U.isCompatible) { - // yo, stay on those platforms!! - if ( - onObject && - "blocks" !== onObject.array && - "spikes" !== onObject.array && - "stack" !== onObject.array - ) { - const e = fullLayoutStateIndexes[ - onObject.array - ].indexOf(onObject.index), - t = inViewLayout[onObject.array][e]; - if (t) { - const e = t.y - onObject.y; - ((d += e), - (h = - h < 0 - ? Math.min(e / df, h) - : Math.max(e / df, h))); - } - } - // stay on your friends! - // TODO: only do this when player is onObject - if ( - onObject && - "stack" === onObject.array && - (lastOnObject - ? !["block", "spike"].includes(lastOnObject.array) - : false) - ) { - const e = lastStackY + M * scale - onObject.y; - ((d = lastStackY + M * scale), - (h = - h < 0 ? Math.min(e / df, h) : Math.max(e / df, h))); - } - } - const g = rl( - o, - r, - i, - d, - h, - false, - scale, - scale, - 0, - s, - false, - null, - false, - u, - U.gravity, - ); - if (!U.isCompatible) { - g.hitObject - ? onObject - ? ((onObject.array = g.hitObject.object.array), - (onObject.index = g.hitObject.index), - (onObject.y = g.hitObject.object.y)) - : (onObject = { - array: g.hitObject.object.array, - index: g.hitObject.index, - y: g.hitObject.object.y, - }) - : onObject?.array != "stack" && (onObject = null); - if ( - onObject && - onObject.array === "stack" && - !lastOnObject - ) { - onObject = null; - } - } - - const touchedSpring = U.isCompatible - ? false - : checkSprings(undefined, stack); - if (touchedSpring) { - var offset = 1 * Math.sign(touchedSpring.gradY); - d = touchedSpring.y + offset; - h = touchedSpring.gradY; - if (d < lastStackY + M * scale + 1) { - var setStackFromIndex = (i) => ( - 0 === i - ? (U.playerY = d - M * scale - 1) - : (stacks[i - 1].y = d - M * scale - 1), - 0 === i - ? (U.playerGradY = h) - : (stacks[i - 1].gradY = h) - ); - } - } - // stack collision - !touchedSpring && null !== g.onGroundY - ? (stacks[l] = { - y: g.onGroundY, - gradY: 0, - scale: 1, - stackCrash: g.crashed, - onObject: onObject, - }) - : (stacks[l] = { - y: d, - gradY: h, - scale: 1, - stackCrash: g.crashed, - onObject: onObject, - }); - } - lt(stacks, (stack) => { - let crashed = false; - if (stack.stackCrash) crashed = true; - else { - const a = be.rectTouchesRect({ - x: i, - y: stack.y, - width: 25, - height: 25, - }); - // deadly objects (and enemies) - for (let e = 0; e < l.length; e++) { - const { object: i, index } = l[e]; - if ( - !U.isCompatible && - "enemy" === i.type && - "walker" === i.kind - ) { - const j = mo.didLandOnHead( - U.frame, - i, - enemies[index], - stack.y, - stack.gradY, - V, - stackCollide(stack, true), - ); - if (j) { - ((stack.gradY = j.playerGradY), - xa.updateLayoutStateField( - "enemies", - index, - j.enemyState, - U.layoutState, - inViewLayoutState, - fullLayoutStateIndexes, - K, - ), - j.playerCrashed && (crashed = true)); - continue; - } - } - a(i) && (crashed = true); - } - // bullets - for (let e = 0; e < enemies.length; e++) { - const i = enemies[e].bullet; - i && a(i) && (crashed = true); - } - // portals - - const p = nl( - inViewLayout.portals, //e - _.layout.portals, //t - U.playerX, //a - stack.y, //i - 1, //n - stack.gradY, //s - j, //o - V, //r - (null === (h = U.touchingPortals) || void 0 === h - ? void 0 - : h[0]) || null, //l - stackCollide(stack), //c - df, //d - U.gravity, - false, - ); - // (U.touchingPortals = p.touchingPortals || null), - ((crashed = p.crashed || crashed), - p.teleport && // (stack.x = p.teleport.playerX), - ((stack.y = p.teleport.playerY), - (stack.gradY = p.teleport.playerGradY), - (stack.dir = p.teleport.playerDir), - null == v || v.hitPortal())); - } - - return ( - crashed && - d.push({ - x: i, - y: stack.y, - framesLeft: $.explosionTime, - }), - !crashed - ); - }); - })( - U.playerStacks, - j, - df, - U.playerX, - U.playerY + - (skating - ? $.skateboardHeight - (15 - U.playerScaleY * 15) - : 0), - U.playerDir, - le, - fullLayoutStateIndexes, - [ - ...ue, - ...(U.bottomLine?.objects || []).map((obj, i) => ({ - object: obj, - index: i, - })), - ], - U.layoutState.enemies, - U.explosions, - U.switchBlockSpikes, - ), - 0 === U.playerStacks.length && - (U.playerPowerups = U.playerPowerups.filter( - (e) => e.item != "playerStack", - ))), - U.switchButtons.on && U.switchButtons.rot < 90 - ? (U.switchButtons.rot = Math.min( - U.switchButtons.rot + df * (180 / C), - 90, - )) - : !U.switchButtons.on && - U.switchButtons.rot > 0 && - (U.switchButtons.rot = Math.max( - U.switchButtons.rot - df * (180 / C), - 0, - )), - U.jumpSwitch.delay > 0 - ? (U.jumpSwitch.delay -= df) - : U.jumpSwitch.on && U.jumpSwitch.ratio < 1 - ? (U.jumpSwitch.ratio = Math.min( - U.jumpSwitch.ratio + df * (2.6 / C), - 1, - )) - : !U.jumpSwitch.on && - U.jumpSwitch.ratio > 0 && - (U.jumpSwitch.ratio = Math.max( - U.jumpSwitch.ratio - df * (2.6 / C), - 0, - )), - U.jumpSwitch.timeout > 0 && (U.jumpSwitch.timeout -= df), - cl( - U, - df, - w, - C, - _, - inViewLayout, - inViewLayoutState, - fullLayoutStateIndexes, - le, - ue, - he, - v, - U.bottomLine?.objects || [], - ), - U.playerBullets && - xa.updateHitBulletState( - U.frame, - inViewLayout, - inViewLayoutState, - U.playerBullets, - U.layoutState, - fullLayoutStateIndexes, - K, + (o && (e.view = c), + (e.bossX = r), + (e.bossY += n * ((l - e.bossY) / 10))); + }, + crashed: ({ bossState: e, rectangleHitPlayer: t }) => { + let a = false; + for (const i of e.bullets) i.destroyed || (t(i) && (a = true)); + return a; + }, + }; + }, + getFlyingBoss = function () { + return { + mutatesState: false, + fileNames: { + images: [ + "images/level/boss3/player-ship.png", + "images/level/boss3/bullet.png", + "images/level/boss3/asteroid60.png", + "images/level/boss3/asteroid120.png", + "images/level/boss3/asteroid210.png", + "images/level/boss3/star-line.png", + "images/level/boss3/star-line-stars.png", + "images/level/boss3/tiles/bottomExit.png", + "images/level/boss3/tiles/bottomExitGlow.png", + "images/level/boss3/tiles/bottomJoin.png", + "images/level/boss3/tiles/bottomLeading.png", + "images/level/boss3/tiles/bottomSingle.png", + "images/level/boss3/tiles/bottomStalecmite.png", + "images/level/boss3/tiles/bottomTrailing.png", + "images/level/boss3/tiles/middle.png", + "images/level/boss3/tiles/topEntry.png", + "images/level/boss3/tiles/topEntryGlow.png", + "images/level/boss3/tiles/topJoin.png", + "images/level/boss3/tiles/topLeading.png", + "images/level/boss3/tiles/topSingle.png", + "images/level/boss3/tiles/topStalectite.png", + "images/level/boss3/tiles/topTrailing.png", + ], + spine: [Qs.spineFiles.flyingFlag, Qs.spineFiles.bossSpaceGun], + audio: [ + "audio/levels/boss3/death.wav", + "audio/levels/boss3/rotate.wav", + "audio/levels/boss3/shoot.mp3", + ], + }, + overrideMovement: (e, df, levelSpeed, playerInput, frame) => { + let { + playerX: playerX, + playerY: playerY, + jumping: jumping, + } = e; + return ( + "justDown" === playerInput && (jumping = !jumping), + jumping + ? playerY > Sl + ? ((playerY += + 2 * df * ((-5 + Sl - playerY) / levelSpeed)), + (playerY = B.clamp2(Sl, bl, playerY))) + : (playerY = Sl) + : playerY < bl + ? ((playerY += + 2 * df * ((5 + bl - playerY) / levelSpeed)), + (playerY = B.clamp2(Sl, bl, playerY))) + : (playerY = bl), + // frame > 2600 && (playerX += levelSpeed * df), + { playerX: playerX, playerY: playerY, jumping: jumping } + ); + }, + initState: () => ({ + type: "flying", + mutatesState: false, + bossX: 1000, + bossY: 0, + gunView: "up", + shootFrames: 0, + isUp: true, + allAsteroids: Il.map(([e, t, a], i) => ({ + x: e, + y: t, + radius: a, + index: i, + destroyed: false + })), + allInsideAsteroid: Tl(), + asteroids: [], + insideAsteroid: [], + bullets: [], + destroyed: false, + moveFrames: [ + 191, 272, 379, 411, 439, 477, 587, 604, 625, 655, 695, 717, + 758, 804, 845, 875, 928, 946, 1055, 1117, 1155, 1178, 1441, + 1519, 1576, 1600, 1639, 1704, 1786, 1868, 2019, 2074, 2140, + 2264, 2334, 2654, 2711, 2748, 2783, 2811, 2875, 2906, 2933, + 2998, 3057, 3163, 3261, 3312, 3405, 3465, 3490, 3562, 3657, + 3728, 3812, 3850, 4073, 4165, 4234, 4326, 4396, 4488, 4580, + 4627, 4673, 4719, 4742, 4788, 4811, 4839, 4857, 4885, 4927, + 4973, 5019, 5065, 5111, 5157, 5204, + ], + }), + cloneState: (e) => + Object.assign(Object.assign({}, e), { + allAsteroids: e.allAsteroids.map((e) => Object.assign({}, e)), + allInsideAsteroid: e.allInsideAsteroid.map((e) => + Object.assign({}, e), ), - U.crashed && - (U.playerPowerups.some((e) => e.item === "playerStack") && - U.playerStacks.length > 0 && - U.playerStacks[U.playerStackIndex].y < U.playerY + 300 - ? (U.explosions.push({ - x: U.playerX, - y: U.playerY, - framesLeft: $.explosionTime, - }), - (U.playerY = U.playerStacks[U.playerStackIndex].y), - (U.playerGradY = U.playerStacks[U.playerStackIndex].gradY), - U.playerStacks.splice(U.playerStackIndex, 1), - (U.crashed = false), - 0 === U.playerStacks.length && - (U.playerPowerups = U.playerPowerups.filter( - (e) => e.item !== "playerStack", - ))) - : ((U.playerPowerups = U.playerPowerups.filter( - (e) => e.item === "skateboard" || e.item === "spaceship", - )), - onCrash(U.checkpoint.index), - N && (L.resetTimer = 60)))); - U.playerOnGroundY = - U.flyingAnchor === null ? U.playerOnGroundY : U.flyingAnchor; - let ge = U.explosions.length; - (ge > 0 && - ((U.explosions = U.explosions.map( - (e) => ( - e.framesLeft <= 0 && ge--, - Object.assign(Object.assign({}, e), { - framesLeft: e.framesLeft - 1, - }) + asteroids: e.asteroids.map((e) => Object.assign({}, e)), + insideAsteroid: e.insideAsteroid.map((e) => + Object.assign({}, e), ), - )), - 0 === ge && (U.explosions.length = 0)), - L.landTimer > 0 && L.landTimer--, - U.flyingAnchor === null && - (U.playerOnGroundY = null != Q ? Q : U.playerOnGroundY), - (U.playerWasOnGroundCooldown = Math.max( - 0, - U.playerWasOnGroundCooldown - df, - )), - de - ? U.onObject - ? ((U.onObject.array = de.object.array), - (U.onObject.index = de.index), - (U.onObject.y = de.object.y)) - : (U.onObject = { - array: de.object.array, - index: de.index, - y: de.object.y, - }) - : (U.onObject = null)); - }, - ul = function ( - e, - t = "noShorten", - a, - i = [Zr(e.layout, e.boss, null, null)], - n = 0, - s = 0, - ) { - if ("noShorten" === t) - return { - level: e, - settings: { - viewOffset: a || { x: 0, y: 0, scale: 1 }, - runHistory: i, - runHistoryIndex: n, - }, + bullets: e.bullets.map((e) => Object.assign({}, e)), + moveFrames: [...e.moveFrames], + }), + loop: ({ + bossState: e, + playerX: playerX, + frame: frame, + df: i, + playSound: n, + crashed: crashed, + playerY, + }) => { + const o = 3937; + crashed && e.playerDestroyed && !e.destroyed && ((n("audio/levels/boss3/death.wav")), (e.destroyed = true)); + let r = crashed && !e.playerDestroyed + ? e.bossX + 6.6 + : frame > o + ? playerX + + Math.max(0, 300 * + (function (e, t, a) { + return 1 - (a - 3937) / 1475; + })(0, 0, frame)) + : playerX + 300; + for (const t of e.bullets) { + t.x += crashed ? Math.min(-3, t.speed) : t.speed; + for (const n of e.asteroids) { + const a = be.pointInCircle(n); + n.x > t.x + n.radius + El || + n.x < t.x - n.radius - El || + !( + a({ x: t.x, y: t.y }) || + a({ x: t.x + t.width / 2, y: t.y + t.height / 2 }) || + a({ x: t.x - t.width / 2, y: t.y + t.height / 2 }) || + a({ x: t.x - t.width / 2, y: t.y - t.height / 2 }) || + a({ x: t.x + t.width / 2, y: t.y - t.height / 2 }) + ) || + (n.destroyed = true); + } + } + if ((lt(e.bullets, (t) => t.x > e.bossX - 1000), frame < 1286)) + r = Math.max(r, e.bossX + 1); + else if (frame < 2574) { + const t = yl * (frame < 1600 ? 2.5 : frame < 1950 ? 2 : 3); + (1306 === frame + ? (n("audio/levels/boss3/rotate.wav"), + (e.gunView = "toDown")) + : 1326 === frame && (e.gunView = "down"), + frame % t < i && + frame < 2514 && + frame > 1346 && + (n("audio/levels/boss3/shoot.mp3"), + (e.shootFrames = 10), + e.bullets.push({ + x: e.bossX, + y: e.bossY, + width: 30, + height: 10, + speed: -3, + }))); + } else if (frame < 5290) { + frame < o + ? (2594 === frame + ? (n("audio/levels/boss3/rotate.wav"), + (e.gunView = "toUp")) + : 2614 === frame && (e.gunView = "up"), + 3320 === frame + ? (n("audio/levels/boss3/rotate.wav"), + (e.gunView = "toDown")) + : 3340 === frame && (e.gunView = "down"), + frame > 3300 && + frame < 3877 && + frame % (4 * yl) < i && + (n("audio/levels/boss3/shoot.mp3"), + (e.shootFrames = 10), + e.bullets.push({ + x: e.bossX, + y: e.bossY, + width: 30, + height: 10, + speed: 1, + }))) + : 3957 === frame + ? (n("audio/levels/boss3/rotate.wav"), + (e.gunView = "toUp")) + : 3977 === frame && (e.gunView = "up"); + } else { + true//a < o + ? (5840 === frame + ? (n("audio/levels/boss3/rotate.wav"), + (e.gunView = "toDown")) + : 5860 === frame && (e.gunView = "down"), + frame > 5900 && + //frame < 3877 && + frame % (4 * yl) < i && + (n("audio/levels/boss3/shoot.mp3"), + (e.shootFrames = 10), + e.bullets.push({ + x: e.bossX, + y: e.bossY, + width: 30, + height: 10, + speed: 20, + isPlayer: true + }))) + : 3957 === frame + ? (n("audio/levels/boss3/rotate.wav"), + (e.gunView = "toUp")) + : 3977 === frame && (e.gunView = "up"); }; - const o = - "last10" === t - ? i.slice(n, n + 10) - : i.filter((e, t) => t <= s || t % 5 == 0 || t === n); - return ( - "last10" === t && n > 0 && o.unshift(i[0]), - { - level: e, - settings: { - viewOffset: a || { x: 0, y: 0, scale: 1 }, // * - runHistory: o, - runHistoryIndex: o.indexOf(i[n]), - }, + if ( + (e.moveFrames[0] <= frame && + ((e.isUp = !e.isUp), e.moveFrames.shift()), + e.asteroids.length > 0 && + e.asteroids[0].x < playerX - 1000 && + e.asteroids.shift(), + e.insideAsteroid.length > 0 && + e.insideAsteroid[0].x < playerX - 1000 && + e.insideAsteroid.shift(), + e.allAsteroids.length > 0) + ) { + const a = e.allAsteroids[0]; + a.x < playerX + 1000 && + (e.asteroids.push(a), e.allAsteroids.shift()); } - ); + if (e.allInsideAsteroid.length > 0) { + const a = e.allInsideAsteroid[0]; + a.x < playerX + 1000 && + (e.insideAsteroid.push(a), e.allInsideAsteroid.shift()); + } + (e.isUp + ? e.bossY < bl + ? ((e.bossY += 2 * i * ((5 + bl - e.bossY) / 6)), + (e.bossY = B.clamp2(Sl, bl, e.bossY))) + : (e.bossY = bl) + : e.bossY > Sl + ? ((e.bossY += 2 * i * ((-5 + Sl - e.bossY) / 6)), + (e.bossY = B.clamp2(Sl, bl, e.bossY))) + : (e.bossY = Sl), + r < playerX + 38 && + !e.playerDestroyed && + ((e.playerDestroyed = true)), + e.shootFrames > 0 && (e.shootFrames -= i), + (e.playerDestroyed && (e.bossY = playerY)), + e.destroyed || (e.bossX = r) + ); + }, + crashed: ({ playerX: e, playerY: t, bossState: a }) => { + let i = false; + for (const n of a.asteroids) { + const a = be.pointInCircle(n); + n.destroyed || + n.x > e + n.radius + El || + n.x < e - n.radius - El || + !( + a({ x: e, y: t }) || + a({ x: e + 15, y: t + 15 }) || + a({ x: e - 15, y: t + 15 }) || + a({ x: e - 15, y: t - 15 }) || + a({ x: e + 15, y: t - 15 }) + ) || + (i = true); + } + const n = be.rectTouchesRect({ + x: e, + y: t, + width: El, + height: El, + }); + for (const e of a.insideAsteroid) + (("top" === e.hitType && + n({ + x: e.x, + y: (bl + Sl) / 2 - 10, + width: vl, + height: bl - Sl - 20, + })) || + ("bottom" === e.hitType && + n({ + x: e.x, + y: (bl + Sl) / 2 + 10, + width: vl, + height: bl - Sl - 20, + })) || + ("topStalectite" === e.hitType && + n({ x: e.x, y: bl + 25 - 45, width: 40, height: 90 })) || + ("bottomStalecmite" === e.hitType && + n({ x: e.x, y: Sl - 25 + 45, width: 40, height: 90 }))) && + (i = true); + for (const e of a.bullets) !e.isPlayer && n(e) && (i = true); + return i; + }, + }; + }, + getDemonBoss = function () { + return { + fileNames: { + images: [], + spine: [ + Qs.spineFiles.world4Boss, + Qs.spineFiles.world4BossFistCollision, + Qs.spineFiles.world4BossFireBall, + Qs.spineFiles.world4BossMinion, + Qs.spineFiles.world4BossPlayerHit, + ], + audio: [ + "audio/levels/boss4/claw_attack.mp3", + "audio/levels/boss4/tail_attack.mp3", + "audio/levels/boss4/death.mp3", + "audio/levels/boss4/fireball.mp3", + "audio/levels/boss4/footstep1.wav", + "audio/levels/boss4/footstep2.wav", + "audio/levels/boss4/footstep3.wav", + "audio/levels/boss4/laser.mp3", + "audio/levels/boss4/laugh.mp3", + "audio/levels/boss4/minion.mp3", + "audio/levels/boss4/block_explosion.mp3", + ], + }, + mutatesState: true, + initState: ({ + assets: e, + checkpointState: t, + playSound: a, + pauseSound: i, + }) => { + const { frame: n = 0, bossState: s } = t || {}, + { + allMinions: o = [...Cl.map((e) => Object.assign({}, e))], + minions: r = [], + allFireballs: l = [...wl.map((e) => Object.assign({}, e))], + fireballs: c = [], + } = s || {}; + return ( + i && + (i("audio/levels/boss4/laugh.mp3"), + i("audio/levels/boss4/laser.mp3"), + i("audio/levels/boss4/tail_attack.mp3"), + i("audio/levels/boss4/claw_attack.mp3")), + { + type: "demon", + runtime: Ys( + Qs.spineFiles.world4Boss, + e, + n, + "animation", + false, + -100, + -243, + void 0, + void 0, + (e) => { + if (a) + switch (e) { + case "Step1": + a("audio/levels/boss4/footstep1.wav"); + break; + case "Step2": + a("audio/levels/boss4/footstep2.wav"); + break; + case "Step3": + a("audio/levels/boss4/footstep3.wav"); + break; + case "Laugh": + a("audio/levels/boss4/laugh.mp3"); + break; + case "Laser": + a("audio/levels/boss4/laser.mp3"); + break; + case "Claw_flash": + a("audio/levels/boss4/claw_attack.mp3"); + break; + case "Tail_flash": + a("audio/levels/boss4/tail_attack.mp3"); + } + }, + ), + fistRuntime: Ys( + Qs.spineFiles.world4BossFistCollision, + e, + n, + "animation", + false, + -100, + -243, + ), + collisionFn: () => false, + blockCollisionFn: () => false, + allMinions: o, + minions: r, + allFireballs: l, + fireballs: c, + } + ); + }, + cloneState: (e) => ({ + type: "demon", + runtime: e.runtime, + fistRuntime: e.fistRuntime, + collisionFn: () => false, + blockCollisionFn: () => false, + allMinions: e.allMinions.map((e) => Object.assign({}, e)), + minions: e.minions.map((e) => Object.assign({}, e)), + allFireballs: e.allFireballs.map((e) => Object.assign({}, e)), + fireballs: e.fireballs.map((e) => Object.assign({}, e)), + }), + loop: ({ bossState: e, playerX: t, df: a }) => { + const { collisionFn: i, blockCollisionFn: n } = js( + e.runtime, + e.fistRuntime, + a, + t - et.initialPosition.x, + ); + if ( + ((e.collisionFn = i), + (e.blockCollisionFn = n), + e.minions.length > 0 && + e.minions[0].x < t - 400 && + e.minions.shift(), + e.fireballs.length > 0 && + e.fireballs[0].x < t - 400 && + e.fireballs.shift(), + e.allMinions.length > 0) + ) { + const a = e.allMinions[0]; + a.x < t + 650 && (e.minions.push(a), e.allMinions.shift()); + } + if (e.allFireballs.length > 0) { + const a = e.allFireballs[0]; + a.x < t + 650 && + (e.fireballs.push(a), e.allFireballs.shift()); + } + for (const t of e.minions) t.x -= a; + for (const t of e.fireballs) t.y -= 1.5 * a; + }, + crashed: ({ + bossState: e, + playerX: t, + playerY: a, + frame: i, + rectangleHitPlayer: n, + inViewLayout: s, + inViewLayoutState: o, + fullLayoutState: r, + fullLayoutStateIndexes: l, + }) => { + let c = false; + (e.collisionFn(t, a) || + e.collisionFn(t - 15, a + 15) || + e.collisionFn(t + 15, a + 15) || + e.collisionFn(t + 15, a - 15) || + e.collisionFn(t - 15, a - 15)) && + (c = true); + const d = e.blockCollisionFn; + for (let e = 0; e < s.blocks.length; e++) { + const t = s.blocks[e], + a = o.blocks[e]; + !a.destroyed && + d(t.x, t.y + t.height / 2) && + xa.updateLayoutStateField( + "blocks", + e, + Object.assign(Object.assign({}, a), { + destroyed: { frame: i, x: t.x, y: t.y, by: "stomped" }, + }), + r, + o, + l, + false, + ); + } + for (const t of e.minions) n(t) && (c = true); + for (const t of e.fireballs) n(t) && (c = true); + return c; + }, + }; + }, + Pl = function (e, t) { + return ( + "demon" === (null == e ? void 0 : e.type) && t > 5226 && t < Ol + ); + }, + Ml = function (e) { + return "demon" === (null == e ? void 0 : e.type); + }, + Ll = function (e, t, a) { + return ( + "demon" === (null == e ? void 0 : e.type) && + t > Rl && + t < Ol && + !a + ); + }, + Dl = [ + { + levelName: "Dragonfly", + levelFileName: "dragonfly", + song: hl.songs.dragonfly, + unlockedByIndex: null, + x: -250, + y: 20, + pathToLevel: [], + maxFrames: 8862, + difficulty: 2, }, - hl = { - songs: { - dragonfly: { - name: "Dragonfly", - author: "Nitro Fun", - fileName: "audio/tracks/nitro-fun-dragonfly.mp3", - bpm: 130, - label: "Wolf Beats", - isBonusSong: false, - }, - stardust: { - name: "Stardust", - author: "Geoxor", - fileName: "audio/tracks/geoxor-stardust.mp3", - bpm: 110, - isBonusSong: false, - }, - solarWind: { - name: "Solar Wind", - author: "Jumper", - fileName: "audio/tracks/jumper-solar-wind.mp3", - bpm: 130, - }, - solace: { - name: "Solace", - author: "Avenza", - fileName: "audio/tracks/avenza-solace.mp3", - bpm: 115, - isBonusSong: false, - }, - solarAbyss: { - name: "Solar Abyss", - author: "Lchvasse", - fileName: "audio/tracks/lchvasse-solar-abyss.mp3", - bpm: 150, - isBonusSong: false, - }, - rockinThatBass: { - name: "Rockin' That Bass", - author: "MrCoolTrix", - bpm: 130, - fileName: "audio/tracks/mrcooltrix-rockin-that-bass.mp3" - }, - thinkDifferent: { - name: "Think Different", - author: "Panda Eyes & Gabriel Guardian", - fileName: "audio/tracks/panda-eyes-think-different.mp3", - bpm: 150, - isBonusSong: false, - }, - indestructable: { - name: "Indestructable", - author: "Aaro", - fileName: "audio/tracks/aaro-indestructable.mp3", - bpm: 128, - label: "Tasty", - isBonusSong: false, - }, - glitchedOut: { - name: "Glitched Out", - author: "FantomenK", - fileName: "audio/tracks/fantomenk-glitched-out.mp3 ", - bpm: 140, - }, - eightBitAdventure: { - name: "8 Bit Adventure", - author: "AdhesiveWombat", - fileName: "audio/tracks/adhesive-wombat-8-bit-adventure.mp3", - bpm: 153, - isBonusSong: false, - }, - eightBitShuffle: { - name: "8 Bit Shuffle", - author: "Inova", - fileName: "audio/tracks/inova-8-bit-shuffle.mp3", - bpm: 133, - label: "Argofox", - isBonusSong: false, - }, - octane: { - name: "Octane", - author: "Inova", - fileName: "audio/tracks/inova-octane.mp3", - bpm: 125, - label: "Argofox", - isBonusSong: false, - }, - milkyWays: { - name: "Milky Ways", - author: "Bossfight", - fileName: "audio/tracks/bossfight-milky-ways.mp3", - bpm: 183, - isBonusSong: false, - }, - darkSheep: { - name: "Dark Sheep", - author: "Chroma", - fileName: "audio/tracks/chroma-dark-sheep.mp3", - bpm: 177, - isBonusSong: false, - }, - daydreamer: { - name: "Daydreamer", - author: "Meganeko", - fileName: "audio/tracks/meganeko-daydreamer.mp3", - bpm: 135, - isBonusSong: false, - }, - breathe: { - name: "Breathe", - author: "meganeko & RoccoW", - fileName: "audio/tracks/meganeko-breathe.mp3", - bpm: 155, - isBonusSong: false, - }, - criticalHitExtended: { - name: "Critical Hit (Extended Cut)", - author: "MDK", - fileName: "audio/tracks/mdk-critical-hit-extended.mp3", - bpm: 130, - }, - criticalHit: { - name: "Critical Hit", - author: "MDK", - fileName: "audio/tracks/mdk-critical-hit.mp3", - bpm: 130, - isBonusSong: false, - }, - silverdust: { - name: "Silverdust", - author: "Geoxor", - fileName: "audio/tracks/geoxor-silverdust.mp3", - bpm: 140, - }, - lighthouse: { - name: "Lighthouse", - author: "Ghost'n'Ghost", - fileName: "audio/tracks/ghost-n-ghost-lighthouse.mp3", - bpm: 128, - label: "Argofox", - isBonusSong: false, - }, - frontier: { - name: "Frontier", - author: "Doctor Vox", - fileName: "audio/tracks/doctor-vox-frontier.mp3", - bpm: 124, - label: "Argofox", - isBonusSong: false, - }, - toe3: { - name: "Theory Of Everything 3", - author: "dj-Nate", - fileName: "audio/tracks/dj-nate-theory-of-everything-3.mp3", - bpm: 140, - isBonusSong: true, - }, - polymorph: { - name: "Polymorph", - author: "The Brig", - fileName: "audio/tracks/the-brig-polymorph.mp3", - bpm: 150, - isBonusSong: false, - }, - accelerated: { - name: "Accelerated", - author: "Miami Nights 1984", - fileName: "audio/tracks/miami-nights-1984-accelerated.mp3", - bpm: 130, - isBonusSong: false, - }, - skyFracture: { - name: "Sky Fracture", - author: "Getsix", - fileName: "audio/tracks/getsix-sky-fracture.mp3", - bpm: 176, - isBonusSong: false, - }, - truecolors: { - name: "True Colors", - author: "Geoxor", - fileName: "audio/tracks/geoxor-true-colors.mp3", - bpm: 128, - isBonusSong: true, - }, - blythe: { - name: "Blythe", - author: "Aika (feat. TOFIE)", - fileName: "audio/tracks/aika-blythe.mp3", - bpm: 105, - isBonusSong: false, - }, - color: { - name: "Color", - author: "Amidst", - fileName: "audio/tracks/amidst-color.mp3", - bpm: 130, - }, - awake: { - name: "Awake", - author: "Amidst", - fileName: "audio/tracks/amidst-awake.mp3", - bpm: 130, - label: "Argofox", - isBonusSong: false, - }, - coincidence: { - name: "Coincidence", - author: "3b", - fileName: "audio/tracks/3b-coincidence.mp3", - bpm: 124, - label: "Wolf Beats", - isBonusSong: false, - }, - mutant: { - name: "Mutant", - author: "Evilwave & Teminite (ft. Prey For Me)", - fileName: "audio/tracks/evilwave-mutant.mp3", - bpm: 150, - isBonusSong: false, - }, - overdrive: { - name: "Overdrive", - author: "Far Out", - fileName: "audio/tracks/far-out-overdrive.mp3", - bpm: 172, - isBonusSong: false, - }, - // official order: red shift, fire aura, heaven, minds of mad, phobos - redShift: { - name: "Red Shift", - author: "Cubed", - fileName: "audio/tracks/cubed-red-shift.mp3", - bpm: 150, - isBonusSong: true, - }, - fireAura: { - name: "Fire Aura", - author: "Kid2Will", - fileName: "audio/tracks/kid2will-fire-aura.mp3", - bpm: 180, - isBonusSong: true, - }, - heaven: { - name: "Heaven", - author: "EnV", - fileName: "audio/tracks/env-heaven.mp3", - bpm: 150, - isBonusSong: true, - }, - mindsOfTheMad: { - name: "Minds Of The Mad", - author: "Exilelord", - fileName: "audio/tracks/exilelord-minds-of-the-mad.mp3", - bpm: 150, - }, - phobos: { - name: "Phobos", - author: "Solkraig", - bpm: 140, - fileName: "audio/tracks/solkraig-phobos.mp3" - }, - cloud9: { - name: "Cloud 9", - author: "Valesco", - fileName: "audio/tracks/valesco-cloud-9.mp3", - bpm: 140, - label: "Argofox", - isBonusSong: true, - }, - virtual: { - name: "Virtual", - author: "Geoxor", - fileName: "audio/tracks/geoxor-virtual.mp3", - bpm: 128, - isBonusSong: true, - }, - aura: { - name: "Aura", - author: "Creo", - fileName: "audio/tracks/creo-aura.mp3", - bpm: 128, - isBonusSong: true, - }, - lastTile: { - name: "Last Tile", - author: "Kommisar", - bpm: 150, - fileName: "audio/tracks/kommisar-last-tile.mp3", - }, - coolFriends: { - name: "Cool Friends", - author: "Silva Hound (Murtagh & Veschell Remix)", - fileName: "audio/tracks/silva-hound-cool-friends.mp3", - bpm: 115, - isBonusSong: true, - }, - - nacreousSnowmelt: { - name: "Nacreous Snowmelt", - author: "Camellia", - fileName: "audio/tracks/camellia-nacreous-snowmelt.mp3", - bpm: 201, - isBonusSong: true, - }, - rummy: { - name: "Rum n' Bass", - author: "BoomKitty", - fileName: "audio/tracks/boomkitty-rum-and-bass.mp3", - bpm: 132, - isBonusSong: true, - }, - - forYou: { - name: "For You (+ Waterfall mashup)", - author: "ColBreakz & EXODIE, SkybreakEDM", - fileName: "audio/tracks/colbreakz-for-you.mp3", - bpm: 145, - isBonusSong: true, - }, - zenith: { - name: "Nana", - author: "Geoxor", - fileName: "audio/tracks/geoxor-nana.mp3", - bpm: 128, - }, + { + levelName: "Solar Wind", + levelFileName: "solar-wind", + song: hl.songs.solarWind, + unlockedByIndex: 0, + x: -100, + y: 70, + pathToLevel: [ + [-220, 10], + [-130, 60], + ], + maxFrames: 8762, + difficulty: 3, + comingSoon: true, + }, + { + levelName: "Think Different", + levelFileName: "think-different", + song: hl.songs.thinkDifferent, + unlockedByIndex: 1, + x: 120, + y: -50, + pathToLevel: [ + [-70, 60], + [80, -30], + ], + maxFrames: 10054, + difficulty: 5, + }, + { + levelName: "Solar Abyss", + levelFileName: "solar-abyss", + song: hl.songs.solarAbyss, - chaozFantasy: { - name: "Chaoz Fantasy", - author: "ParagonX9", - fileName: "audio/tracks/paragonx9-chaoz-fantasy.mp3", - bpm: 162, - isBonusSong: true, - }, - phazd: { - name: "Phazd", - author: "tobycreed", - fileName: "audio/tracks/tobycreed-phazd.mp3", - bpm: 165, - isBonusSong: true, - }, - finalTheory: { - name: "Final Theory", - author: "dj-Nate", - fileName: "audio/tracks/dj-nate-final-theory.mp3", - bpm: 132, - isBonusSong: false, - }, - piratemanners: { - name: "Pirate Manners", - author: "Bossfight", - fileName: "audio/tracks/bossfight-pirate-manners.mp3", - bpm: 116, - isBonusSong: true, - }, - + unlockedByIndex: 2, + x: 150, + y: 100, + pathToLevel: [ + [120, 10], + [140, 45], + ], + maxFrames: 9738, + difficulty: 8, + }, + { + levelName: "Indestructable", + levelFileName: "indestructable", + song: hl.songs.indestructable, + unlockedByIndex: null, //2, + x: 250, + y: 20, + pathToLevel: [ + [150, -20], + [220, 20], + ], + maxFrames: 5647, + difficulty: 4, + boss: getRobotBoss(), + }, + ], + Bl = [ + { + levelName: "Glitched Out", + levelFileName: "glitched-out", + song: hl.songs.glitchedOut, + unlockedByIndex: null, + x: -250, + y: 30, + pathToLevel: [], + maxFrames: 10643, + difficulty: 4, + }, + { + levelName: "8 Bit Shuffle", + levelFileName: "8-bit-shuffle", + song: hl.songs.eightBitShuffle, + unlockedByIndex: 0, + x: -50, + y: 50, + pathToLevel: [ + [-220, 30], + [-80, 50], + ], + maxFrames: 8407, + difficulty: 4, + }, + { + levelName: "Milky Ways", + levelFileName: "milky-ways", + song: hl.songs.milkyWays, + unlockedByIndex: 1, + x: -110, + y: -100, + pathToLevel: [ + [-60, -10], + [-80, -70], + ], + maxFrames: 9638, + difficulty: 9, + }, + { + levelName: "Daydreamer", + levelFileName: "daydreamer", + song: hl.songs.daydreamer, + unlockedByIndex: 1, + x: 90, + y: -20, + pathToLevel: [ + [-20, 50], + [60, -20], + ], + maxFrames: 7477, + difficulty: 5, + comingSoon: true, + }, + { + levelName: "Critical Hit (Extended)", + levelFileName: "critical-hit", + song: hl.songs.criticalHitExtended, + unlockedByIndex: 3, + x: 250, + y: 50, + pathToLevel: [ + [120, 0], + [220, 50], + ], + maxFrames: 5343, + difficulty: 5, + boss: getPixelBoss(), + comingSoon: true, + }, + ], + Fl = [ + { + levelName: "Silverdust", + levelFileName: "silverdust", + song: hl.songs.silverdust, + unlockedByIndex: null, + x: -240, + y: -30, + pathToLevel: [], + maxFrames: 7986, + difficulty: 2, + }, + { + levelName: "Frontier", + levelFileName: "frontier", + song: hl.songs.frontier, + unlockedByIndex: 0, + x: -140, + y: 40, + pathToLevel: [ + [-220, 0], + [-180, 40], + ], + maxFrames: 9377, + difficulty: 5, + }, + { + levelName: "Theory Of Everything 3", + levelFileName: "toeiii", + song: hl.songs.toe3, + unlockedByIndex: 1, + x: -60, + y: -100, + pathToLevel: [ + [-120, -20], + [-100, -80], + ], + maxFrames: 9156, + difficulty: 8, + }, + { + levelName: "Accelerated", + levelFileName: "accelerated", + song: hl.songs.accelerated, + unlockedByIndex: 1, + x: 110, + y: 10, + pathToLevel: [ + [-100, 40], + [70, 10], + ], + maxFrames: 7530, + difficulty: 2, + }, + { + levelName: "Sky Fracture", + levelFileName: "sky-fracture", + song: hl.songs.skyFracture, + unlockedByIndex: 3, + x: 250, + y: 50, + pathToLevel: [ + [150, 10], + [220, 40], + ], + maxFrames: 5460, + difficulty: 5, + boss: getFlyingBoss(), + }, + ], + Yl = [ + { + levelName: "True Colors", + levelFileName: "true-colors", + song: hl.songs.truecolors, + unlockedByIndex: null, + x: -240, + y: 30, + pathToLevel: [], + maxFrames: 10420, + difficulty: 3, + }, + { + levelName: "Color", + levelFileName: "color", + song: hl.songs.color, + unlockedByIndex: 0, + x: -100, + y: 0, + pathToLevel: [ + [-220, 30], + [-130, 0], + ], + maxFrames: 10111, + difficulty: 4, + }, + { + levelName: "Coincidence", + levelFileName: "coincidence", + song: hl.songs.coincidence, + unlockedByIndex: 1, + x: 120, + y: 60, + pathToLevel: [ + [-70, 0], + [90, 50], + ], + maxFrames: 8685, + difficulty: 5, + }, + { + levelName: "Mutant", + levelFileName: "mutant", + song: hl.songs.mutant, + unlockedByIndex: 2, + x: 140, + y: -120, + pathToLevel: [ + [120, 5], + [130, -20], + ], + maxFrames: 11714, + difficulty: 10, + }, + { + levelName: "Overdrive", + levelFileName: "overdrive", + song: hl.songs.overdrive, + unlockedByIndex: null, //2, + x: 250, + y: 0, + pathToLevel: [ + [160, 50], + [220, 0], + ], + maxFrames: 5597, + difficulty: 6, + boss: getDemonBoss(), + }, + ], + world5levels = [ + { + levelName: "Fire Aura 2", + levelFileName: "fire-aura", + author: "Alfredo Gamer", + song: hl.songs.fireAura, + unlockedByIndex: null, + x: -240, + y: 20, + pathToLevel: [], + maxFrames: 9877, + difficulty: 7, + }, + { + levelName: "Heaven 2", + levelFileName: "heaven", + song: hl.songs.heaven, + unlockedByIndex: 0, + x: -100, + y: -30, + pathToLevel: [], + maxFrames: 9877, + difficulty: 7, + }, + ], + Ul = [ + /*{ + levelName: "Cloud 9", + levelFileName: "cloud-9", + song: hl.songs.cloud9, + unlockedByIndex: null, + x: 0, + y: 0, + pathToLevel: [], + maxFrames: 9070, + difficulty: 5, + },*/ + { + levelName: "Virtual", + levelFileName: "virtual", + song: hl.songs.virtual, + unlockedByIndex: null, + x: 0, + y: 0, + pathToLevel: [], + maxFrames: 9637, + difficulty: 7, + }, + { + levelName: "Normal Polymorph", + levelFileName: "polymorph", + author: "Fluke Games, d016", + song: hl.songs.polymorph, + unlockedByIndex: null, + x: 0, + y: 0, + pathToLevel: [], + maxFrames: 8782, + difficulty: 8, + }, + /*{ + levelName: "For You", + levelFileName: "for-you", + author: "Fluke Games", + song: hl.songs.forYou, + unlockedByIndex: null, + x: 0, + y: 0, + pathToLevel: [], + maxFrames: 8836, + difficulty: 5, + },*/ + { + levelName: "Rum n' Bass", + levelFileName: "rum-and-bass", + song: hl.songs.rummy, + unlockedByIndex: null, + x: 0, + y: 0, + pathToLevel: [], + maxFrames: 11577, + difficulty: 6, + }, + /*{ + levelName: "Cool Friends", + levelFileName: "cool-friends", + song: hl.songs.coolFriends, - orientalSwing: { - name: "Oriental Swing", - author: "Xe & cYsmix", - fileName: "audio/tracks/xe-cysmix-oriental-swing.mp3", - bpm: 125, - isBonusSong: false, - }, - clutterfunk: { - name: "Clutterfunk", - author: "Waterflame", - fileName: "audio/tracks/waterflame-clutterfunk.mp3", - bpm: 140, - }, - soulless2: { - name: "Mechanical Machine (Soulless 2)", - author: "Exilelord", - fileName: "audio/tracks/exilelord-mechanical-machine.mp3", - bpm: 125, - length: "5 mins", - isBonusSong: true, - }, - raceAroundTheWorld: { - name: "Race Around The World", - author: "Waterflame", - fileName: "audio/tracks/waterflame-race-around-the-world.mp3", - bpm: 180, - }, - machina: { - name: "Machina", - author: "Dex Arson", - fileName: "audio/tracks/dex-arson-machina.mp3", - bpm: 125, - }, - - soulless4: { - name: "Soulless 4", - author: "Exilelord", - fileName: "audio/tracks/exilelord-soulless-4.mp3", - bpm: 125, - length: "12 mins", - isBonusSong: true, - }, - superUltra: { - name: "Super Ultra", - author: "MDK", - fileName: "audio/tracks/mdk-super-ultra.mp3", - bpm: 172, - isBonusSong: false, - }, - funkyPunky: { - name: "Funky Punky", - author: "Grge & Antian Rose", - fileName: "audio/tracks/george-antian-rose-funky-punky.mp3", - bpm: 128, - }, - octaneExtended: { - name: "Octane (Full ver.)", - author: "Inova", - fileName: "audio/tracks/inova-octane-extended.mp3", - bpm: 125, - label: "Argofox", - }, - electrodynamix: { - name: "Electrodynamix", - author: "dj-Nate", - fileName: "audio/tracks/dj-nate-electrodynamix.mp3", - bpm: 127, - }, - skyFractureExtended: { - name: "Sky Fracture (extended)", - author: "Getsix", - fileName: "audio/tracks/getsix-sky-fracture-extended.mp3", - bpm: 176, - }, - plummet: { - name: "Plümmet", - author: "Onefin & Stardew", - fileName: "audio/tracks/onefin-stardew-plummet.mp3", - bpm: 134, - }, - - hellidox: { - name: "Hellidox", - author: "Exilelord", - bpm: 200, - fileName: "audio/tracks/exilelord-hellidox.mp3", - }, - jackpot: { - name: "Jackpot", - author: "TheFatRat", - bpm: 103, - fileName: "audio/tracks/the-fat-rat-jackpot.mp3", - }, - carnival: { - name: "Carnival", - author: "DJVI", - bpm: 128, - fileName: "audio/tracks/djvi-carnival.mp3", - }, - robotLanguage: { - name: "Robot Language", - author: "meganeko", - bpm: 132, - fileName: "audio/tracks/meganeko-robot-language.mp3", - }, - dryOut: { - name: "Dry Out", - author: "DJVI", - bpm: 145, - fileName: "audio/tracks/djvi-dry-out.mp3", + author: "Fluke Games", + unlockedByIndex: null, + x: 0, + y: 0, + pathToLevel: [], + maxFrames: 10740, + difficulty: 5, + }, + { + levelName: "Nacreous Snowmelt", + levelFileName: "nacreous-snowmelt", + song: hl.songs.nacreousSnowmelt, + author: "Fluke Games", + unlockedByIndex: null, + x: 0, + y: 0, + pathToLevel: [], + maxFrames: 10996, + difficulty: 6, + },*/ + { + levelName: "Aurora", + levelFileName: "aurora", + author: "d016", + song: hl.songs.aura, + unlockedByIndex: null, + x: 0, + y: 0, + pathToLevel: [], + maxFrames: 9877, + difficulty: 11, + }, + { + levelName: "Octane (Full Version)", + levelFileName: "octane-extended", + author: "WaterFire", + song: hl.songs.octaneExtended, + unlockedByIndex: null, + x: 0, + y: 0, + pathToLevel: [], + maxFrames: 15960, + difficulty: 6, + }, + { + levelName: "Challenge 2", + levelFileName: "challenge-2", + author: "lkjhasdf", + song: hl.songs.aura, + unlockedByIndex: null, + x: 0, + y: 0, + pathToLevel: [], + maxFrames: 9877, + difficulty: 10, + }, + { + levelName: "ClutterFunk?", + levelFileName: "clutterfunk-whaike3", + author: "HIimaburger", + song: hl.songs.clutterfunk, + unlockedByIndex: null, + x: 0, + y: 0, + pathToLevel: [], + maxFrames: 9420, + difficulty: 7, + }, + { + levelName: "Another World", + levelFileName: "another-world", + author: "Mincofficial", + song: hl.songs.heaven, + unlockedByIndex: null, + x: 0, + y: 0, + pathToLevel: [], + maxFrames: 5697, + difficulty: 6, + }, + { + levelName: "Funky Adventures", + levelFileName: "funky-adventures", + author: "Outline Gamer", + song: hl.songs.color, + unlockedByIndex: null, + x: 0, + y: 0, + pathToLevel: [], + maxFrames: 5314, + difficulty: 4, + } + ], + jl = [Dl, Bl, Fl, Yl, world5levels], + Gl = Dl[0].levelName, + Vl = "",//Ul[0].levelName, + Hl = { + getWorlds: () => jl, + getWorld: (e) => (0 === e ? Ul : jl[e - 1]), + firstLevelName: Gl, + bonusLevels: Ul, + skateboardLevelName: Vl, + }, + Xl = (e, t, a, i, n, s, o, r, l, c = 0, d = 0) => { + const u = e.findIndex((e) => e.levelName === t); + if (-1 === u) { + const d = n + ? { + didFinish: s, + furthestFrame: o, + lastCheckpointState: l || null, + } + : { + didFinish: false, + furthestFrame: 0, + lastCheckpointState: null, }, - carnivores: { - name: "Carnivores", - author: "Creo", - bpm: 120, - fileName: "audio/tracks/creo-carnivores.mp3", + u = n + ? { didFinish: false, furthestFrame: 0 } + : { didFinish: s, furthestFrame: o }; + return [ + ...e, + { + levelName: t, + levelIndex: a, + world: i, + checkpoints: d, + noCheckpoints: u, + highScore: s ? c : 0, + totalAttempts: 1, + bestAttempts: s ? r : null, }, - - }, - getSnippetName: (e) => e.replace("audio/tracks", "audio/snippets"), - }, - pl = 2.5 * G.jumpDistance, - gl = G.getJumpFrames(130); - function ml(e, t, a, data1, data2) { - switch (e) { - case "thinBullet": - return { - type: "thinBullet", - x: t, - y: a, - width: 22, - height: 8, - speedX: -3, - speedY: 0, - gradY: 0, - destroyed: false, - }; - case "missile": - return { - type: "missile", - x: t, - y: a, - width: 33, - height: 15, - speedX: -0.5, - speedY: 0 === data1 ? 3 : -3, - gradY: 0, - destroyed: false, - }; - case "cannonbomb": - return { - type: "cannonbomb", - x: t, - y: a, - width: 30, - height: 30, - speedX: data2 || 0, - speedY: data1 || 0, - gradY: -0.4, - destroyed: false, - }; - case "bomb": - return { - type: "bomb", - x: t, - y: a, - width: 30, - height: 30, - speedX: -3, - speedY: 0, - gradY: -0.4, - destroyed: false, - }; - case "bulletHell": - case "bulletHellBig": - const n = 30 * data1, - s = B.toRad(30 + n), - o = "bulletHell" === e ? 1.8 : 7, - r = "bulletHell" === e ? 3 : 15; - return { - type: "bulletHell", - x: t, - y: a, - width: r, - height: r, - speedX: ("bulletHell" === e ? 4 : -1) - 2 * Math.sin(s), - speedY: Math.cos(s) * o, - gradY: 0, - destroyed: false, - }; - case "laser": - return { - type: "laser", - x: t, - y: a, - width: 600, - height: 100, - speedX: 0, - speedY: 0, - gradY: 0, - destroyed: false, - }; + ]; } - } - function fl(e, df, crashed, playerX) { - if ("laser" === e.type) return; - if ( - ((e.y += e.speedY * df), - (e.speedY += e.gradY * df), - "bomb" === e.type || "cannonbomb" === e.type) - ) { - const t = et.initialPosition.y - 15 + e.height / 2; - if (e.y < t && !(e.speedY > 0)) { - if ("cannonbomb" === e.type) { - e.destroyed = true; - e.speedY = 0; - e.y = t; - } else { - e.speedY *= -0.25; - e.y = t + (t - e.y); + const h = e[u], + p = n + ? { + didFinish: h.checkpoints.didFinish || s, + furthestFrame: Math.max(h.checkpoints.furthestFrame, o), + lastCheckpointState: (() => { + const e = + void 0 === l ? h.checkpoints.lastCheckpointState : l; + return null === e + ? e + : Object.assign(Object.assign({}, e), { attempt: r }); + })(), } - } - } else - "missile" === e.type && - (e.x - playerX < 160 || crashed) && - (e.speedY *= 0.85 + (df < 1 ? 0.07 : 0)); - const n = crashed - ? e.speedX === 0 - ? 0 - : Math.min(-1, e.speedX) - : e.speedX; - e.x += n * df; - } - const yl = G.getJumpFrames(176), - El = M, - bl = et.initialPosition.y + 90, - Sl = et.initialPosition.y, - Il = [ - [716, 36, 25], - [893, 45, 20], - [1206, -80, 28], - [1300, -88, 30], - [1402, -17, 17], - [1546, 44, 16], - [1585, 76, 28], - [1739, 54, 25], - [1831, -23, 11], - [1887, 81, 20], - [1982, 68, 19], - [2095, -34, 24], - [2154, 97, 20], - [2259, -45, 16], - [2417, -95, 12], - [2486, 76, 21], - [2555, -100, 20], - [2709, 75, 22], - [2797, 10, 21], - [2892, 78, 25], - [3012, -40, 26], - [3186, 13, 13], - [3279, -7, 25], - [3428, -72, 25], - [3641, -81, 17], - [3753, -66, 18], - [3868, -99, 16], - [4e3, -68, 28], - [4120, 43, 22], - [4255, -54, 23], - [4414, 6, 26], - [4623, -47, 27], - [4848, -2, 10], - [4876, 26, 11], - [4994, -69, 33], - [5247, -18, 22], - [5296, 10, 17], - [5443, 11, 19], - [5593, -51, 15], - [5645, -17, 21], - [5711, -70, 19], - [5843, 39, 12], - [5916, -13, 12], - [6059, -64, 23], - [6259, -15, 20], - [6381, 28, 21], - [6518, -90, 30], - [6685, 91, 20], - [6720, -86, 17], - [6899, -63, 25], - [6958, -64, 18], - [7051, -79, 12], - [7153, 73, 25], - [7255, 0, 18], - [7324, 28, 21], - [7487, 92, 17], - [7500, 6, 25], - [7622, -69, 14], - [7750, -49, 30], - [7907, 14, 23], - [8e3, -50, 12], - [13388, -69, 17], - [13625, 43, 22], - [13993, -37, 27], - [14414, 22, 17], - [14507, 62, 26], - [14962, 68, 19], - [15232, -49, 12], - [15707, 56, 27], - [16116, 31, 29], - [16455, 36, 20], - [16641, 23, 28], - [17324, 33, 13], - [17471, -10, 19], - [17825, 98, 15], - [18159, -49, 23], - [18333, -24, 25], - [18445, -52, 20], - [18907, 26, 17], - [19408, -41, 29], - [19518, -20, 20], - [19863, 10, 22], - [20230, -48, 17], - [20483, -32, 30], - [20889, -98, 21], - [21083, 32, 30], - [21481, -48, 17], - [21838, 7, 22], - [22004, 81, 18], - [22153, -7, 18], - [22719, -84, 35], - [22908, -16, 10], - [23129, -79, 27], - [23488, 40, 28], - [23789, 41, 12], - [24026, 24, 22], - [24249, 99, 15], - [24298, 0, 14], - [24470, 77, 12], - [24693, -93, 11], - [24885, -41, 30], - [25347, 82, 20], - [25524, -40, 17], - [25802, -25, 27], - [26166, 39, 18], - [26253, 49, 18], - [26434, 65, 24], - [26480, 30, 15], - [26859, -55, 32], - [28061, 34, 12], - [28110, 16, 10], - [28460, -29, 10], - [28711, -26, 14], - [28858, -36, 20], - [29194, 12, 26], - [29820, 17, 24], - [30142, -50, 21], - [30929, -90, 13], - [31328, 80, 14], - [31401, 32, 17], - [31835, 68, 13], - [32347, -50, 29], - [32344, 89, 17], - [32749, 92, 21], - [32902, 92, 19], - [33155, -55, 21], - [33445, 50, 24], - [33750, -14, 18], - [33950, -46, 23], - [34139, 84, 28], - [34230, -32, 11], - [34521, -61, 17], - [58180, -50, 21], - ], - _l = [ - { type: "top", count: 4 }, - { type: "middle", count: 1 }, - { type: "bottom", count: 3 }, - { type: "middle", count: 1 }, - { type: "top", count: 2 }, - { type: "middle", count: 1 }, - { type: "bottom", count: 3 }, - { type: "middle", count: 1 }, - { type: "top", count: 2 }, - { type: "middle", count: 1 }, - { type: "bottom", count: 3 }, - { type: "middle", count: 1 }, - { type: "top", count: 3 }, - { type: "middle", count: 1 }, - { type: "topStalectite", count: 1 }, - { type: "middle", count: 1 }, - { type: "bottomStalecmite", count: 1 }, - { type: "middle", count: 1 }, - { type: "topStalectite", count: 1 }, - { type: "middle", count: 1 }, - { type: "bottomStalecmite", count: 1 }, - { type: "topStalectite", count: 1 }, - { type: "middle", count: 1 }, - { type: "bottomStalecmite", count: 1 }, - { type: "topStalectite", count: 1 }, - { type: "bottomStalecmite", count: 1 }, - { type: "topStalectite", count: 1 }, - { type: "bottomStalecmite", count: 1 }, - { type: "middle", count: 1 }, - { type: "topStalectite", count: 1 }, - { type: "middle", count: 1 }, - { type: "bottomStalecmite", count: 1 }, - { type: "middle", count: 1 }, - { type: "topStalectite", count: 1 }, - { type: "middle", count: 1 }, - { type: "bottomStalecmite", count: 1 }, - { type: "middle", count: 1 }, - { type: "bottom", count: 1 }, - { type: "middle", count: 1 }, - { type: "top", count: 1 }, - { type: "middle", count: 1 }, - { type: "bottom", count: 1 }, - ], - vl = 300, - Tl = () => { - let e = 35200; - const t = _l.length - 1; - let a = 0; - return _l.flatMap((i, n) => - Array.from({ length: i.count }).map((s, o) => { - const r = i.count - 1, - l = (0 === n && 0 === o) || (n === t && o === r), - c = (() => { - switch (i.type) { - case "top": - return l - ? "topEntry" - : 1 === i.count - ? "topSingle" - : 0 === o - ? "topLeading" - : o === r - ? "topTrailing" - : "topJoin"; - case "bottom": - return l - ? "bottomExit" - : 1 === i.count - ? "bottomSingle" - : 0 === o - ? "bottomLeading" - : o === r - ? "bottomTrailing" - : "bottomJoin"; - default: - return i.type; - } - })(); - return ( - (e += vl), - a++, - { - type: c, - hitType: "middle" === i.type ? null : i.type, - x: e, - index: a, - } - ); - }), + : h.checkpoints, + g = n + ? h.noCheckpoints + : { + didFinish: h.noCheckpoints.didFinish || s, + furthestFrame: Math.max(h.noCheckpoints.furthestFrame, o), + }; + return tt( + e, + Object.assign(Object.assign({}, h), { + checkpoints: p, + noCheckpoints: g, + highScore: s ? Math.max(h.highScore, c) : h.highScore, + totalAttempts: h.totalAttempts + d, + bestAttempts: s + ? null === h.bestAttempts + ? r + : Math.min(h.bestAttempts, r) + : h.bestAttempts, + }), + u, + ); + }, + zl = function (e, t, a) { + return { + checkpoints: { + furthestFrame: 0, + didFinish: false, + lastCheckpointState: null, + }, + noCheckpoints: { furthestFrame: 0, didFinish: false }, + levelIndex: t, + levelName: a, + world: e, + highScore: 0, + totalAttempts: 0, + bestAttempts: null, + }; + }, + Wl = function (e) { + const t = Hl.getWorlds().flat(), + a = e + .map((e) => { + const a = t.find((t) => t.levelName === e.levelName); + return !a || a.boss + ? null + : { + levelName: a.levelName, + fileName: a.levelFileName, + snippetFileName: hl.getSnippetName(a.song.fileName), + author: a.song.author, + }; + }) + .filter(nt); + return ( + 0 === a.length && + a.push({ + levelName: "Dragonfly", + fileName: "dragonfly", + author: hl.songs.dragonfly.author, + snippetFileName: hl.getSnippetName( + hl.songs.dragonfly.fileName, + ), + }), + a + ); + }, + ql = function (e) { + return [ + ...Object.values(hl.songs) /*, + { + name: `${"Custom song"}...`, + author: "", + fileName: "", + bpm: "120", + label: "", + isBonusSong: false, + custom: true, + },*/, + ]; + }, + $l = function (e) { }, + Jl = function (e, t, a, i) { }, + Kl = function (e, t, a, i, n) { }, + Ql = function (e) { }; + var Zl, + ec, + tc = function (e) { + return "Left" === e._tag; + }, + ac = function (e) { + return function (t) { + return tc(t) ? e(t.left) : t.right; + }; + }, + ic = + ((Zl = function (e, t) { + return ( + (Zl = + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && + function (e, t) { + e.__proto__ = t; + }) || + function (e, t) { + for (var a in t) + Object.prototype.hasOwnProperty.call(t, a) && + (e[a] = t[a]); + }), + Zl(e, t) ); - }, - Rl = 5236, - Ol = 5396, - Cl = [ - { x: 635, y: -14, width: 15, height: 20, index: 0 }, - { x: 750, y: -116, width: 15, height: 20, index: 1 }, - { x: 842, y: -60, width: 15, height: 20, index: 2 }, - { x: 1020, y: -107, width: 15, height: 20, index: 4 }, - { x: 1125, y: -58, width: 15, height: 20, index: 5 }, - { x: 1210, y: -4, width: 15, height: 20, index: 6 }, - { x: 1319, y: -25, width: 15, height: 20, index: 7 }, - { x: 1450, y: -52, width: 15, height: 20, index: 8 }, - { x: 1551, y: -108, width: 15, height: 20, index: 9 }, - { x: 1630, y: -30, width: 15, height: 20, index: 10 }, - { x: 1732, y: -70, width: 15, height: 20, index: 11 }, - { x: 1830, y: -99, width: 15, height: 20, index: 12 }, - { x: 1940, y: -60, width: 15, height: 20, index: 13 }, - { x: 2038, y: -21, width: 15, height: 20, index: 14 }, - { x: 2166, y: -63, width: 15, height: 20, index: 15 }, - { x: 2201, y: -65, width: 15, height: 20, index: 16 }, - { x: 2330, y: -111, width: 15, height: 20, index: 17 }, - { x: 2436, y: -30, width: 15, height: 20, index: 18 }, - { x: 2443, y: -60, width: 15, height: 20, index: 19 }, - { x: 2618, y: -142, width: 15, height: 20, index: 20 }, - { x: 2653, y: -24, width: 15, height: 20, index: 21 }, - { x: 2804, y: -60, width: 15, height: 20, index: 22 }, - { x: 2907, y: -107, width: 15, height: 20, index: 23 }, - { x: 3046, y: -67, width: 15, height: 20, index: 24 }, - { x: 3150, y: -66, width: 15, height: 20, index: 25 }, - { x: 3227, y: -105, width: 15, height: 20, index: 26 }, - { x: 3341, y: -48, width: 15, height: 20, index: 27 }, - { x: 3407, y: -138, width: 15, height: 20, index: 28 }, - { x: 3545, y: -47, width: 15, height: 20, index: 29 }, - { x: 3643, y: -92, width: 15, height: 20, index: 30 }, - { x: 3730, y: -50, width: 15, height: 20, index: 31 }, - { x: 5510, y: -60, width: 15, height: 20, index: 32 }, - { x: 5629, y: -102, width: 15, height: 20, index: 33 }, - { x: 5678, y: -69, width: 15, height: 20, index: 34 }, - { x: 5778, y: 8, width: 15, height: 20, index: 35 }, - { x: 5853, y: -75, width: 15, height: 20, index: 36 }, - { x: 5928, y: -131, width: 15, height: 20, index: 37 }, - { x: 6e3, y: 38, width: 15, height: 20, index: 38 }, - { x: 6107, y: -98, width: 15, height: 20, index: 39 }, - { x: 6140, y: -68, width: 15, height: 20, index: 40 }, - { x: 6242, y: -17, width: 15, height: 20, index: 41 }, - { x: 6346, y: 72, width: 15, height: 20, index: 42 }, - { x: 6387, y: -55, width: 15, height: 20, index: 43 }, - { x: 6500, y: -54, width: 15, height: 20, index: 44 }, - { x: 6588, y: 28, width: 15, height: 20, index: 45 }, - { x: 6627, y: -111, width: 15, height: 20, index: 46 }, - { x: 6740, y: 89, width: 15, height: 20, index: 47 }, - { x: 6785, y: -20, width: 15, height: 20, index: 48 }, - { x: 6864, y: -65, width: 15, height: 20, index: 49 }, - { x: 6963, y: -101, width: 15, height: 20, index: 50 }, - { x: 7053, y: -19, width: 15, height: 20, index: 51 }, - { x: 7122, y: 86, width: 15, height: 20, index: 52 }, - { x: 7181, y: -53, width: 15, height: 20, index: 53 }, - { x: 7273, y: 71, width: 15, height: 20, index: 54 }, - { x: 7368, y: -65, width: 15, height: 20, index: 55 }, - { x: 7461, y: 12, width: 15, height: 20, index: 56 }, - { x: 7533, y: 71, width: 15, height: 20, index: 57 }, - { x: 7612, y: -69, width: 15, height: 20, index: 58 }, - { x: 7655, y: -62, width: 15, height: 20, index: 59 }, - { x: 7880, y: -47, width: 15, height: 20, index: 60 }, - { x: 7900, y: 50, width: 15, height: 20, index: 61 }, - { x: 7912, y: -28, width: 15, height: 20, index: 62 }, - ], - wl = [ - { x: 17633, y: 268, width: 10, height: 8, index: 142 }, - { x: 17917, y: 115, width: 10, height: 8, index: 143 }, - { x: 18225, y: 220, width: 10, height: 8, index: 144 }, - { x: 18528, y: 107, width: 10, height: 8, index: 145 }, - { x: 18845, y: 90, width: 10, height: 8, index: 146 }, - { x: 20514, y: 106, width: 10, height: 8, index: 0 }, - { x: 20605, y: 305, width: 10, height: 8, index: 2 }, - { x: 20703, y: 306, width: 10, height: 8, index: 4 }, - { x: 20840, y: 170, width: 10, height: 8, index: 6 }, - { x: 20891, y: 123, width: 10, height: 8, index: 7 }, - { x: 20994, y: 347, width: 10, height: 8, index: 9 }, - { x: 21085, y: 70, width: 10, height: 8, index: 11 }, - { x: 21159, y: 201, width: 10, height: 8, index: 13 }, - { x: 21278, y: 163, width: 10, height: 8, index: 15 }, - { x: 21513, y: 253, width: 10, height: 8, index: 20 }, - { x: 21631, y: 303, width: 10, height: 8, index: 22 }, - { x: 21660, y: 244, width: 10, height: 8, index: 23 }, - { x: 21718, y: 155, width: 10, height: 8, index: 24 }, - { x: 21802, y: 90, width: 10, height: 8, index: 26 }, - { x: 21896, y: 250, width: 10, height: 8, index: 27 }, - { x: 21990, y: 306, width: 10, height: 8, index: 29 }, - { x: 22013, y: 344, width: 10, height: 8, index: 30 }, - { x: 22083, y: 236, width: 10, height: 8, index: 31 }, - { x: 22126, y: 141, width: 10, height: 8, index: 32 }, - { x: 22180, y: 320, width: 10, height: 8, index: 33 }, - { x: 22389, y: 96, width: 10, height: 8, index: 37 }, - { x: 22418, y: 327, width: 10, height: 8, index: 38 }, - { x: 22462, y: 226, width: 10, height: 8, index: 39 }, - { x: 22527, y: 118, width: 10, height: 8, index: 40 }, - { x: 22580, y: 222, width: 10, height: 8, index: 41 }, - { x: 22639, y: 302, width: 10, height: 8, index: 42 }, - { x: 22658, y: 178, width: 10, height: 8, index: 43 }, - { x: 22745, y: 78, width: 10, height: 8, index: 44 }, - { x: 22787, y: 275, width: 10, height: 8, index: 45 }, - { x: 22839, y: 167, width: 10, height: 8, index: 46 }, - { x: 22856, y: 319, width: 10, height: 8, index: 47 }, - { x: 22900, y: 143, width: 10, height: 8, index: 48 }, - { x: 22979, y: 100, width: 10, height: 8, index: 49 }, - { x: 23085, y: 287, width: 10, height: 8, index: 51 }, - { x: 23140, y: 122, width: 10, height: 8, index: 52 }, - { x: 23182, y: 147, width: 10, height: 8, index: 53 }, - { x: 23216, y: 56, width: 10, height: 8, index: 54 }, - { x: 23272, y: 217, width: 10, height: 8, index: 55 }, - { x: 23318, y: 302, width: 10, height: 8, index: 56 }, - { x: 23364, y: 106, width: 10, height: 8, index: 57 }, - { x: 23431, y: 236, width: 10, height: 8, index: 58 }, - { x: 23474, y: 295, width: 10, height: 8, index: 59 }, - { x: 23547, y: 103, width: 10, height: 8, index: 60 }, - { x: 23588, y: 225, width: 10, height: 8, index: 61 }, - { x: 23618, y: 339, width: 10, height: 8, index: 62 }, - { x: 23684, y: 60, width: 10, height: 8, index: 63 }, - { x: 23719, y: 315, width: 10, height: 8, index: 64 }, - { x: 23805, y: 296, width: 10, height: 8, index: 66 }, - { x: 23815, y: 106, width: 10, height: 8, index: 67 }, - { x: 23927, y: 255, width: 10, height: 8, index: 68 }, - { x: 23985, y: 323, width: 10, height: 8, index: 69 }, - { x: 24030, y: 294, width: 10, height: 8, index: 70 }, - { x: 24098, y: 170, width: 10, height: 8, index: 71 }, - { x: 24110, y: 341, width: 10, height: 8, index: 72 }, - { x: 24159, y: 101, width: 10, height: 8, index: 73 }, - { x: 24207, y: 342, width: 10, height: 8, index: 74 }, - { x: 24255, y: 264, width: 10, height: 8, index: 75 }, - { x: 24312, y: 168, width: 10, height: 8, index: 76 }, - { x: 24354, y: 59, width: 10, height: 8, index: 77 }, - { x: 24413, y: 231, width: 10, height: 8, index: 78 }, - { x: 24482, y: 123, width: 10, height: 8, index: 79 }, - { x: 24505, y: 175, width: 10, height: 8, index: 80 }, - { x: 24599, y: 343, width: 10, height: 8, index: 81 }, - { x: 24643, y: 179, width: 10, height: 8, index: 82 }, - { x: 24706, y: 137, width: 10, height: 8, index: 84 }, - { x: 24789, y: 316, width: 10, height: 8, index: 85 }, - { x: 24814, y: 144, width: 10, height: 8, index: 86 }, - { x: 24865, y: 319, width: 10, height: 8, index: 87 }, - { x: 24943, y: 87, width: 10, height: 8, index: 88 }, - { x: 24998, y: 264, width: 10, height: 8, index: 89 }, - { x: 25040, y: 211, width: 10, height: 8, index: 90 }, - { x: 25062, y: 57, width: 10, height: 8, index: 91 }, - { x: 25130, y: 105, width: 10, height: 8, index: 92 }, - { x: 26508, y: 260, width: 10, height: 8, index: 93 }, - { x: 26697, y: 271, width: 10, height: 8, index: 94 }, - { x: 26808, y: 83, width: 10, height: 8, index: 95 }, - { x: 27004, y: 97, width: 10, height: 8, index: 96 }, - { x: 27120, y: 300, width: 10, height: 8, index: 97 }, - { x: 27267, y: 215, width: 10, height: 8, index: 98 }, - { x: 27439, y: 132, width: 10, height: 8, index: 99 }, - { x: 27585, y: 239, width: 10, height: 8, index: 100 }, - { x: 27706, y: 321, width: 10, height: 8, index: 101 }, - { x: 27852, y: 343, width: 10, height: 8, index: 102 }, - { x: 28003, y: 136, width: 10, height: 8, index: 103 }, - { x: 28183, y: 107, width: 10, height: 8, index: 104 }, - { x: 28315, y: 133, width: 10, height: 8, index: 105 }, - { x: 28465, y: 235, width: 10, height: 8, index: 106 }, - { x: 28647, y: 72, width: 10, height: 8, index: 107 }, - { x: 28779, y: 154, width: 10, height: 8, index: 108 }, - { x: 28908, y: 84, width: 10, height: 8, index: 109 }, - { x: 29100, y: 270, width: 10, height: 8, index: 110 }, - { x: 29235, y: 286, width: 10, height: 8, index: 111 }, - { x: 29355, y: 56, width: 10, height: 8, index: 112 }, - { x: 29523, y: 261, width: 10, height: 8, index: 113 }, - { x: 29683, y: 112, width: 10, height: 8, index: 114 }, - { x: 29824, y: 310, width: 10, height: 8, index: 115 }, - { x: 29955, y: 92, width: 10, height: 8, index: 116 }, - { x: 30112, y: 249, width: 10, height: 8, index: 117 }, - { x: 30273, y: 224, width: 10, height: 8, index: 118 }, - { x: 30403, y: 49, width: 10, height: 8, index: 119 }, - { x: 30556, y: 272, width: 10, height: 8, index: 120 }, - { x: 30715, y: 69, width: 10, height: 8, index: 121 }, - { x: 30863, y: 186, width: 10, height: 8, index: 122 }, - { x: 31046, y: 290, width: 10, height: 8, index: 123 }, - { x: 31152, y: 252, width: 10, height: 8, index: 124 }, - { x: 31327, y: 307, width: 10, height: 8, index: 125 }, - { x: 31491, y: 96, width: 10, height: 8, index: 126 }, - { x: 31638, y: 179, width: 10, height: 8, index: 127 }, - { x: 31789, y: 83, width: 10, height: 8, index: 128 }, - { x: 31923, y: 338, width: 10, height: 8, index: 129 }, - { x: 32071, y: 274, width: 10, height: 8, index: 130 }, - { x: 32246, y: 111, width: 10, height: 8, index: 131 }, - { x: 32358, y: 140, width: 10, height: 8, index: 132 }, - { x: 32519, y: 329, width: 10, height: 8, index: 133 }, - { x: 32824, y: 90, width: 10, height: 8, index: 135 }, - { x: 33047, y: 96, width: 10, height: 8, index: 136 }, - { x: 33060, y: 124, width: 10, height: 8, index: 137 }, - { x: 33077, y: 91, width: 10, height: 8, index: 138 }, - { x: 33247, y: 91, width: 10, height: 8, index: 139 }, - { x: 33260, y: 124, width: 10, height: 8, index: 140 }, - { x: 33277, y: 96, width: 10, height: 8, index: 141 }, - ], - getRobotBoss = function () { - return { - mutatesState: true, - fileNames: { - spine: [Qs.spineFiles.world1Boss], - audio: ["audio/levels/boss1/death.mp3"], - }, - initState: ({ assets: e, checkpointState: t }) => { - const { frame: a = 0 } = t || {}; - return { - type: "robot", - runtime: Ys( - Qs.spineFiles.world1Boss, - e, - a, - "AnimationBoss", - false, - et.initialPosition.x + pl, - -57, - ), - dead: false, - collisionFn: () => false, - debug: [], - }; - }, - cloneState: (e) => ({ - type: "robot", - runtime: e.runtime, - collisionFn: () => false, - debug: [], - dead: e.dead, + }), + function (e, t) { + function a() { + this.constructor = e; + } + (Zl(e, t), + (e.prototype = + null === t + ? Object.create(t) + : ((a.prototype = t.prototype), new a()))); + }), + nc = function () { + return ( + (nc = + Object.assign || + function (e) { + for (var t, a = 1, i = arguments.length; a < i; a++) + for (var n in (t = arguments[a])) + Object.prototype.hasOwnProperty.call(t, n) && + (e[n] = t[n]); + return e; }), - loop: ({ - bossState: e, - playerX: t, - df: a, - crashed: i, - frame: n, - playSound: s, - }) => { - Us(e, a, t - et.initialPosition.x, i, n, s); - }, - crashed: ({ - bossState: e, - playerX: t, - playerY: a, - playerRot: i, - }) => { - const n = B.toRad(45 - i), - s = 21.21 * Math.sin(n), - o = 21.21 * Math.cos(n), - r = [t - s, a + o], - l = [t + o, a + s], - c = [t - o, a - s], - d = [t + s, a - o]; - return !!( - e.collisionFn(...r) || - e.collisionFn(...l) || - e.collisionFn(...d) || - e.collisionFn(...c) + nc.apply(this, arguments) + ); + }, + sc = (function () { + function e(e, t, a, i) { + ((this.name = e), + (this.is = t), + (this.validate = a), + (this.encode = i), + (this.decode = this.decode.bind(this))); + } + return ( + (e.prototype.pipe = function (t, a) { + var i = this; + return ( + void 0 === a && + (a = "pipe(" + this.name + ", " + t.name + ")"), + new e( + a, + t.is, + function (e, a) { + var n = i.validate(e, a); + return tc(n) ? n : t.validate(n.right, a); + }, + this.encode === oc && t.encode === oc + ? oc + : function (e) { + return i.encode(t.encode(e)); + }, + ) + ); + }), + (e.prototype.asDecoder = function () { + return this; + }), + (e.prototype.asEncoder = function () { + return this; + }), + (e.prototype.decode = function (e) { + return this.validate(e, [{ key: "", type: this, actual: e }]); + }), + e + ); + })(), + oc = function (e) { + return e; + }, + rc = function (e, t, a, i) { + for (var n = e.length, s = Array(n + 1), o = 0; o < n; o++) + s[o] = e[o]; + return ((s[n] = { key: t, type: a, actual: i }), s); + }, + lc = function (e) { + return { _tag: "Left", left: e }; + }, + cc = function (e, t, a) { + return lc([{ value: e, context: t, message: a }]); + }, + dc = function (e) { + return { _tag: "Right", right: e }; + }, + uc = function (e, t) { + for (var a = t.length, i = 0; i < a; i++) e.push(t[i]); + }, + hc = new ((function (e) { + function t() { + var t = + e.call( + this, + "null", + function (e) { + return null === e; + }, + function (e, a) { + return t.is(e) ? dc(e) : cc(e, a); + }, + oc, + ) || this; + return ((t._tag = "NullType"), t); + } + return (ic(t, e), t); + })(sc))(), + pc = new ((function (e) { + function t() { + var t = + e.call( + this, + "undefined", + function (e) { + return void 0 === e; + }, + function (e, a) { + return t.is(e) ? dc(e) : cc(e, a); + }, + oc, + ) || this; + return ((t._tag = "UndefinedType"), t); + } + return (ic(t, e), t); + })(sc))(), + gc = + (new ((function (e) { + function t() { + var t = e.call(this, "void", pc.is, pc.validate, oc) || this; + return ((t._tag = "VoidType"), t); + } + return (ic(t, e), t); + })(sc))(), + new ((function (e) { + function t() { + var t = + e.call( + this, + "unknown", + function (e) { + return true; + }, + dc, + oc, + ) || this; + return ((t._tag = "UnknownType"), t); + } + return (ic(t, e), t); + })(sc))()), + mc = new ((function (e) { + function t() { + var t = + e.call( + this, + "string", + function (e) { + return "string" == typeof e; + }, + function (e, a) { + return t.is(e) ? dc(e) : cc(e, a); + }, + oc, + ) || this; + return ((t._tag = "StringType"), t); + } + return (ic(t, e), t); + })(sc))(), + fc = new ((function (e) { + function t() { + var t = + e.call( + this, + "number", + function (e) { + return "number" == typeof e; + }, + function (e, a) { + return t.is(e) ? dc(e) : cc(e, a); + }, + oc, + ) || this; + return ((t._tag = "NumberType"), t); + } + return (ic(t, e), t); + })(sc))(), + yc = + (new ((function (e) { + function t() { + var t = + e.call( + this, + "bigint", + function (e) { + return "bigint" == typeof e; + }, + function (e, a) { + return t.is(e) ? dc(e) : cc(e, a); + }, + oc, + ) || this; + return ((t._tag = "BigIntType"), t); + } + return (ic(t, e), t); + })(sc))(), + new ((function (e) { + function t() { + var t = + e.call( + this, + "boolean", + function (e) { + return "boolean" == typeof e; + }, + function (e, a) { + return t.is(e) ? dc(e) : cc(e, a); + }, + oc, + ) || this; + return ((t._tag = "BooleanType"), t); + } + return (ic(t, e), t); + })(sc))()), + Ec = new ((function (e) { + function t() { + var t = + e.call( + this, + "UnknownArray", + Array.isArray, + function (e, a) { + return t.is(e) ? dc(e) : cc(e, a); + }, + oc, + ) || this; + return ((t._tag = "AnyArrayType"), t); + } + return (ic(t, e), t); + })(sc))(), + bc = new ((function (e) { + function t() { + var t = + e.call( + this, + "UnknownRecord", + function (e) { + var t = Object.prototype.toString.call(e); + return "[object Object]" === t || "[object Window]" === t; + }, + function (e, a) { + return t.is(e) ? dc(e) : cc(e, a); + }, + oc, + ) || this; + return ((t._tag = "AnyDictionaryType"), t); + } + return (ic(t, e), t); + })(sc))(), + Sc = + (new ((function (e) { + function t() { + var t = + e.call( + this, + "Function", + function (e) { + return "function" == typeof e; + }, + function (e, a) { + return t.is(e) ? dc(e) : cc(e, a); + }, + oc, + ) || this; + return ((t._tag = "FunctionType"), t); + } + return (ic(t, e), t); + })(sc))(), + (function (e) { + function t(t, a, i, n, s, o) { + var r = e.call(this, t, a, i, n) || this; + return ( + (r.type = s), + (r.predicate = o), + (r._tag = "RefinementType"), + r ); + } + return (ic(t, e), t); + })(sc)), + Ic = + (Xc( + fc, + function (e) { + return Number.isInteger(e); + }, + "Int", + ), + (function (e) { + function t(t, a, i, n, s) { + var o = e.call(this, t, a, i, n) || this; + return ((o.value = s), (o._tag = "LiteralType"), o); + } + return (ic(t, e), t); + })(sc)), + _c = function (e, t) { + void 0 === t && (t = JSON.stringify(e)); + var a = function (t) { + return t === e; + }; + return new Ic( + t, + a, + function (t, i) { + return a(t) ? dc(e) : cc(t, i); + }, + oc, + e, + ); + }, + vc = + (ic( + function (e, t, a, i, n) { + var s = ec.call(this, e, t, a, i) || this; + return ((s.keys = n), (s._tag = "KeyofType"), s); + }, + (ec = sc), + ), + Object.prototype.hasOwnProperty), + Tc = (function (e) { + function t(t, a, i, n, s) { + var o = e.call(this, t, a, i, n) || this; + return ((o.runDefinition = s), (o._tag = "RecursiveType"), o); + } + return (ic(t, e), t); + })(sc); + Object.defineProperty(Tc.prototype, "type", { + get: function () { + return this.runDefinition(); + }, + enumerable: true, + configurable: true, + }); + var Rc = (function (e) { + function t(t, a, i, n, s) { + var o = e.call(this, t, a, i, n) || this; + return ((o.type = s), (o._tag = "ArrayType"), o); + } + return (ic(t, e), t); + })(sc), + Oc = function (e, t) { + return ( + void 0 === t && (t = "Array<" + e.name + ">"), + new Rc( + t, + function (t) { + return Ec.is(t) && t.every(e.is); }, - }; - }, - getPixelBoss = function () { - return { - mutatesState: false, - fileNames: { - pixelArtImages: [1, 2, 3, 4, 5] - .flatMap((e) => [ - `images/level/boss2/gunin/health${e}.png`, - `images/level/boss2/gunout/health${e}.png`, - `images/level/boss2/gunshot/health${e}.png`, - `images/level/boss2/idle/health${e}.png`, - `images/level/boss2/lasercharge/base/health${e}.png`, - `images/level/boss2/lasercharge/shot/health${e}.png`, - `images/level/boss2/laserdamage/health${e}.png`, - ]) - .filter(nt) - .concat([ - "images/level/boss2/thinBullet.png", - "images/level/boss2/missile.png", - "images/level/boss2/bomb.png", - "images/level/boss2/cannonbomb.png", - "images/level/boss2/button.png", - "images/level/boss2/bulletHell.png", - "images/level/boss2/bulletHellBig.png", - "images/level/boss2/healthbar.png", - "images/level/boss2/healthbar-frame.png", - "images/level/boss2/lasercharge/guncharging.png", - "images/level/boss2/lasercharge/gunout.png", - "images/level/boss2/lasercharge/laserbar.png", - "images/level/boss2/lasercharge/laserorbs.png", - "images/level/boss2/lasercharge/lasertip.png", - "images/level/boss2/lasercharge/laserbase.png", - "images/level/boss2/lasercharge/laserbody.png", - "images/level/boss2/death/death1.png", - "images/level/boss2/death/death2.png", - "images/level/boss2/death/explosion.png", - ]), - audio: [ - "audio/levels/boss2/bomb.wav", - "audio/levels/boss2/bullethell_large.wav", - "audio/levels/boss2/bullethell_small.wav", - "audio/levels/boss2/death.wav", - "audio/levels/boss2/doublemissile.wav", - "audio/levels/boss2/gun-appear.wav", - "audio/levels/boss2/gun-retract.wav", - "audio/levels/boss2/laser.wav", - "audio/levels/boss2/machinegun.wav", - "audio/levels/boss2/damage.wav", - ], - }, - initState: () => ({ - type: "pixel", - bossX: 650, - bossY: 0, - view: "idle", - isShootingFrames: 0, - startChargeFrame: null, - takingDamageTimeout: 0, - health: 10, - bullets: [], - allButtons: [ - { x: 26370, y: 0, pressed: false }, - { x: 26880, y: -15, pressed: false }, - { x: 27420, y: -15, pressed: false }, - { x: 27720, y: 15, pressed: false }, - { x: 27990, y: 45, pressed: false }, - { x: 28590, y: 90, pressed: false }, - { x: 29100, y: 75, pressed: false }, - ], - destroyed: false, - mutatesState: false, - }), - cloneState: (e) => - Object.assign(Object.assign({}, e), { - bullets: e.bullets.map((e) => Object.assign({}, e)), - }), - loop: ({ - bossState: e, - playerX: playerX, - playerY, - rectangleHitPlayer, - playerOnGroundY, - playerBullets: a, - frame: i, - df: n, - playSound: s, - crashed: o, - }) => { - e.mutatesState = false; - e.isShootingFrames > 0 && (e.isShootingFrames -= n); - for (const a of e.bullets) fl(a, n, o, playerX); - lt(e.bullets, (t) => t.x > e.bossX - 1000); - e.allButtons.forEach((button) => { - let lastPressed = button.pressed; - button.pressed = rectangleHitPlayer( - Object.assign(Object.assign({}, button), { - width: 90, - height: 30, - }), - ); - if (button.pressed && !lastPressed) { - e.bullets.push(ml("cannonbomb", 26370, -90, 10)); - e.bullets.push(ml("cannonbomb", 26550, -90, 11)); - e.bullets.push(ml("cannonbomb", 26790, -90, 11)); - e.bullets.push(ml("cannonbomb", 26970, -90, 12)); - e.bullets.push(ml("cannonbomb", 27120, -90, 10)); - e.bullets.push(ml("cannonbomb", 27255, -90, 15.2)); - e.bullets.push(ml("cannonbomb", 27585, -30, 6)); - e.bullets.push(ml("cannonbomb", 27720, -90, 10)); - e.bullets.push(ml("cannonbomb", 27855, 15, 10)); - e.bullets.push(ml("cannonbomb", 28110, 75, 10)); - e.bullets.push(ml("cannonbomb", 28245, 75, 13.5)); - e.bullets.push(ml("cannonbomb", 28380, 75, 10)); - - e.bullets.push(ml("cannonbomb", 28950, 90, 10, 0.5)); - - e.bullets.push(ml("cannonbomb", 29190, 30, 11)); - e.bullets.push(ml("cannonbomb", 29250, 0, 12)); - e.bullets.push(ml("cannonbomb", 29310, -30, 13)); - e.bullets.push(ml("cannonbomb", 29370, -60, 17)); - e.bullets.push(ml("cannonbomb", 29400, -60, 17)); - } - }); - let r = playerX + 350, - l = e.bossY; - const c = e.view; - switch (i) { - case 450: - case 1352: - case 2250: - case 3512: - case 4458: - (s("audio/levels/boss2/gun-appear.wav"), - (e.view = "gunOut")); - break; - case 500: - case 1402: - case 2300: - case 3562: - case 4508: - e.view = "gun"; - break; - case 1072: - case 1970: - case 2971: - case 4198: - case 4993: - (s("audio/levels/boss2/gun-retract.wav"), - (e.view = "gunIn")); - break; - case 1102: - case 2e3: - case 3342: - case 4238: - case 5083: - case 6020: - e.startChargeFrame = i; - break; - case 3021: - case 5023: - e.view = "idle"; - } - if ( - (e.takingDamageTimeout > 0 && - ((e.takingDamageTimeout -= n), - 0 === e.takingDamageTimeout && - "chargeLaserDamage" === e.view && - (e.view = "idle")), - e.startChargeFrame) + function (t, a) { + var i = Ec.validate(t, a); + if (tc(i)) return i; + for ( + var n = i.right, s = n.length, o = n, r = [], l = 0; + l < s; + l++ ) { - if ( - ((e.view = "chargeLaser"), - i === e.startChargeFrame + 151 && - e.bullets.push( - ml("laser", e.bossX - 105, e.bossY + 5, 0), - ), - !o) - ) - for (const t of a) - t.x > e.bossX - 80 && - ((e.view = "chargeLaserDamage"), - (e.startChargeFrame = null), - (e.health -= 1), - (a.length = 0), - (e.takingDamageTimeout = 30)); - (0 === e.health && ((e.view = "death"), (e.destroyed = true)), - (l = -50)); - } else if (i < 450) r = Math.max(r, e.bossX + 3.9 * n); - else if (i < 1322) { - const t = 50; - ((l = 2 * Math.abs(((i - 430) % (2 * t)) - t) - 80), - i > 500 && - i < 1072 && - i % gl < n && - ((e.isShootingFrames = 11), - s("audio/levels/boss2/machinegun.wav"), - e.bullets.push( - ml("thinBullet", e.bossX - 110, e.bossY, 0), - ))); - } else if (i < 2220) - ((l = 2 * Math.abs((i % 100) - 50) - 70), - i > 1402 && - i < 1970 && - i % (gl + 5) < n && - ((e.isShootingFrames = 35), - s("audio/levels/boss2/doublemissile.wav"), - e.bullets.push( - ml("missile", e.bossX - 120, e.bossY + 12, 0), - ), - e.bullets.push( - ml("missile", e.bossX - 120, e.bossY - 8, 1), - ))); - else if (i < 3542) - ((l = 0.5 * Math.abs((i % (2 * gl)) - gl)), - i < 3342 && ((r += 50), (l += 150)), - i > 2300 && - i < 2971 && - i % gl < n && - ((e.isShootingFrames = 17), - s("audio/levels/boss2/bomb.wav"), - e.bullets.push(ml("bomb", e.bossX - 100, e.bossY, 0)))); - else if (i < 4428) { - l = 1.6 * (Math.abs((i % 100) - 50) - 50); - const t = i > 3980; - if (i > 3562 && i < 4198 && i % gl < n) { - ((e.isShootingFrames = 23), - s("audio/levels/boss2/bullethell_small.wav")); - const a = e.bossX - 80, - o = e.bossY + 2; - (e.bullets.push( - ml("bulletHell", a, o, 0), - ml("bulletHell", a, o, 1), - ml("bulletHell", a, o, 2), - ml("bulletHell", a, o, 3), - ml("bulletHell", a, o, 4), - ), - t && - i % (2 * gl) < n && - (s("audio/levels/boss2/bullethell_large.wav"), - e.bullets.push( - ml("bulletHellBig", a, o, -0.5), - ml("bulletHellBig", a, o, 0.5), - ml("bulletHellBig", a, o, 1.5), - ml("bulletHellBig", a, o, 2.5), - ml("bulletHellBig", a, o, 3.5), - ml("bulletHellBig", a, o, 4.5), - ))); + var c = n[l], + d = e.validate(c, rc(a, String(l), e, c)); + if (tc(d)) uc(r, d.left); + else { + var u = d.right; + u !== c && (o === n && (o = n.slice()), (o[l] = u)); } - } else if (i > 6215) { - l = 0.5 * Math.abs((i % (2 * gl)) - gl); - l += 90 + playerOnGroundY; - } else if (i > 5269) { - l = 0.5 * Math.abs((i % (2 * gl)) - gl); - l += 150; - } else if (!e.destroyed) { - const t = 50; - ((l = 2 * Math.abs((i % (2 * t)) - t) - 80), - i > 4508 && - i < 4993 && - (i - gl / 2) % gl < n && - ((e.isShootingFrames = 11), - s("audio/levels/boss2/machinegun.wav"), - e.bullets.push( - ml("thinBullet", e.bossX - 110, e.bossY, 0), - ))); } - (o && (e.view = c), - (e.bossX = r), - (e.bossY += n * ((l - e.bossY) / 10))); - }, - crashed: ({ bossState: e, rectangleHitPlayer: t }) => { - let a = false; - for (const i of e.bullets) i.destroyed || (t(i) && (a = true)); - return a; - }, - }; - }, - getFlyingBoss = function () { - return { - mutatesState: false, - fileNames: { - images: [ - "images/level/boss3/player-ship.png", - "images/level/boss3/bullet.png", - "images/level/boss3/asteroid60.png", - "images/level/boss3/asteroid120.png", - "images/level/boss3/asteroid210.png", - "images/level/boss3/star-line.png", - "images/level/boss3/star-line-stars.png", - "images/level/boss3/tiles/bottomExit.png", - "images/level/boss3/tiles/bottomExitGlow.png", - "images/level/boss3/tiles/bottomJoin.png", - "images/level/boss3/tiles/bottomLeading.png", - "images/level/boss3/tiles/bottomSingle.png", - "images/level/boss3/tiles/bottomStalecmite.png", - "images/level/boss3/tiles/bottomTrailing.png", - "images/level/boss3/tiles/middle.png", - "images/level/boss3/tiles/topEntry.png", - "images/level/boss3/tiles/topEntryGlow.png", - "images/level/boss3/tiles/topJoin.png", - "images/level/boss3/tiles/topLeading.png", - "images/level/boss3/tiles/topSingle.png", - "images/level/boss3/tiles/topStalectite.png", - "images/level/boss3/tiles/topTrailing.png", - ], - spine: [Qs.spineFiles.flyingFlag, Qs.spineFiles.bossSpaceGun], - audio: [ - "audio/levels/boss3/death.wav", - "audio/levels/boss3/rotate.wav", - "audio/levels/boss3/shoot.mp3", - ], - }, - overrideMovement: (e, df, levelSpeed, playerInput, frame) => { - let { - playerX: playerX, - playerY: playerY, - jumping: jumping, - } = e; - return ( - "justDown" === playerInput && (jumping = !jumping), - jumping - ? playerY > Sl - ? ((playerY += - 2 * df * ((-5 + Sl - playerY) / levelSpeed)), - (playerY = B.clamp2(Sl, bl, playerY))) - : (playerY = Sl) - : playerY < bl - ? ((playerY += - 2 * df * ((5 + bl - playerY) / levelSpeed)), - (playerY = B.clamp2(Sl, bl, playerY))) - : (playerY = bl), - // frame > 2600 && (playerX += levelSpeed * df), - { playerX: playerX, playerY: playerY, jumping: jumping } - ); + return r.length > 0 ? lc(r) : dc(o); }, - initState: () => ({ - type: "flying", - mutatesState: false, - bossX: 1000, - bossY: 0, - gunView: "up", - shootFrames: 0, - isUp: true, - allAsteroids: Il.map(([e, t, a], i) => ({ - x: e, - y: t, - radius: a, - index: i, - destroyed: false - })), - allInsideAsteroid: Tl(), - asteroids: [], - insideAsteroid: [], - bullets: [], - destroyed: false, - moveFrames: [ - 191, 272, 379, 411, 439, 477, 587, 604, 625, 655, 695, 717, - 758, 804, 845, 875, 928, 946, 1055, 1117, 1155, 1178, 1441, - 1519, 1576, 1600, 1639, 1704, 1786, 1868, 2019, 2074, 2140, - 2264, 2334, 2654, 2711, 2748, 2783, 2811, 2875, 2906, 2933, - 2998, 3057, 3163, 3261, 3312, 3405, 3465, 3490, 3562, 3657, - 3728, 3812, 3850, 4073, 4165, 4234, 4326, 4396, 4488, 4580, - 4627, 4673, 4719, 4742, 4788, 4811, 4839, 4857, 4885, 4927, - 4973, 5019, 5065, 5111, 5157, 5204, - ], - }), - cloneState: (e) => - Object.assign(Object.assign({}, e), { - allAsteroids: e.allAsteroids.map((e) => Object.assign({}, e)), - allInsideAsteroid: e.allInsideAsteroid.map((e) => - Object.assign({}, e), - ), - asteroids: e.asteroids.map((e) => Object.assign({}, e)), - insideAsteroid: e.insideAsteroid.map((e) => - Object.assign({}, e), - ), - bullets: e.bullets.map((e) => Object.assign({}, e)), - moveFrames: [...e.moveFrames], - }), - loop: ({ - bossState: e, - playerX: playerX, - frame: frame, - df: i, - playSound: n, - crashed: crashed, - playerY, - }) => { - const o = 3937; - crashed && e.playerDestroyed && !e.destroyed && ((n("audio/levels/boss3/death.wav")), (e.destroyed = true)); - let r = crashed && !e.playerDestroyed - ? e.bossX + 6.6 - : frame > o - ? playerX + - Math.max(0, 300 * - (function (e, t, a) { - return 1 - (a - 3937) / 1475; - })(0, 0, frame)) - : playerX + 300; - for (const t of e.bullets) { - t.x += crashed ? Math.min(-3, t.speed) : t.speed; - for (const n of e.asteroids) { - const a = be.pointInCircle(n); - n.x > t.x + n.radius + El || - n.x < t.x - n.radius - El || - !( - a({ x: t.x, y: t.y }) || - a({ x: t.x + t.width / 2, y: t.y + t.height / 2 }) || - a({ x: t.x - t.width / 2, y: t.y + t.height / 2 }) || - a({ x: t.x - t.width / 2, y: t.y - t.height / 2 }) || - a({ x: t.x + t.width / 2, y: t.y - t.height / 2 }) - ) || - (n.destroyed = true); - } + e.encode === oc + ? oc + : function (t) { + return t.map(e.encode); + }, + e, + ) + ); + }, + Cc = (function (e) { + function t(t, a, i, n, s) { + var o = e.call(this, t, a, i, n) || this; + return ((o.props = s), (o._tag = "InterfaceType"), o); + } + return (ic(t, e), t); + })(sc), + wc = function (e) { + for (var t = 0; t < e.length; t++) + if (e[t].encode !== oc) return false; + return true; + }, + Ac = function (e) { + return ( + "{ " + + (function (e) { + return Object.keys(e) + .map(function (t) { + return t + ": " + e[t].name; + }) + .join(", "); + })(e) + + " }" + ); + }, + kc = function (e, t) { + void 0 === t && (t = Ac(e)); + var a = Object.keys(e), + i = a.map(function (t) { + return e[t]; + }), + n = a.length; + return new Cc( + t, + function (e) { + if (bc.is(e)) { + for (var t = 0; t < n; t++) { + var s = a[t], + o = e[s]; + if ((void 0 === o && !vc.call(e, s)) || !i[t].is(o)) + return false; } - if ((lt(e.bullets, (t) => t.x > e.bossX - 1000), frame < 1286)) - r = Math.max(r, e.bossX + 1); - else if (frame < 2574) { - const t = yl * (frame < 1600 ? 2.5 : frame < 1950 ? 2 : 3); - (1306 === frame - ? (n("audio/levels/boss3/rotate.wav"), - (e.gunView = "toDown")) - : 1326 === frame && (e.gunView = "down"), - frame % t < i && - frame < 2514 && - frame > 1346 && - (n("audio/levels/boss3/shoot.mp3"), - (e.shootFrames = 10), - e.bullets.push({ - x: e.bossX, - y: e.bossY, - width: 30, - height: 10, - speed: -3, - }))); - } else if (frame < 5290) { - frame < o - ? (2594 === frame - ? (n("audio/levels/boss3/rotate.wav"), - (e.gunView = "toUp")) - : 2614 === frame && (e.gunView = "up"), - 3320 === frame - ? (n("audio/levels/boss3/rotate.wav"), - (e.gunView = "toDown")) - : 3340 === frame && (e.gunView = "down"), - frame > 3300 && - frame < 3877 && - frame % (4 * yl) < i && - (n("audio/levels/boss3/shoot.mp3"), - (e.shootFrames = 10), - e.bullets.push({ - x: e.bossX, - y: e.bossY, - width: 30, - height: 10, - speed: 1, - }))) - : 3957 === frame - ? (n("audio/levels/boss3/rotate.wav"), - (e.gunView = "toUp")) - : 3977 === frame && (e.gunView = "up"); - } else { - true//a < o - ? (5840 === frame - ? (n("audio/levels/boss3/rotate.wav"), - (e.gunView = "toDown")) - : 5860 === frame && (e.gunView = "down"), - frame > 5900 && - //frame < 3877 && - frame % (4 * yl) < i && - (n("audio/levels/boss3/shoot.mp3"), - (e.shootFrames = 10), - e.bullets.push({ - x: e.bossX, - y: e.bossY, - width: 30, - height: 10, - speed: 20, - isPlayer: true - }))) - : 3957 === frame - ? (n("audio/levels/boss3/rotate.wav"), - (e.gunView = "toUp")) - : 3977 === frame && (e.gunView = "up"); - }; - if ( - (e.moveFrames[0] <= frame && - ((e.isUp = !e.isUp), e.moveFrames.shift()), - e.asteroids.length > 0 && - e.asteroids[0].x < playerX - 1000 && - e.asteroids.shift(), - e.insideAsteroid.length > 0 && - e.insideAsteroid[0].x < playerX - 1000 && - e.insideAsteroid.shift(), - e.allAsteroids.length > 0) - ) { - const a = e.allAsteroids[0]; - a.x < playerX + 1000 && - (e.asteroids.push(a), e.allAsteroids.shift()); + return true; + } + return false; + }, + function (e, t) { + var s = bc.validate(e, t); + if (tc(s)) return s; + for (var o = s.right, r = o, l = [], c = 0; c < n; c++) { + var d = a[c], + u = r[d], + h = i[c], + p = h.validate(u, rc(t, d, h, u)); + if (tc(p)) uc(l, p.left); + else { + var g = p.right; + (g !== u || (void 0 === g && !vc.call(r, d))) && + (r === o && (r = nc({}, o)), (r[d] = g)); } - if (e.allInsideAsteroid.length > 0) { - const a = e.allInsideAsteroid[0]; - a.x < playerX + 1000 && - (e.insideAsteroid.push(a), e.allInsideAsteroid.shift()); + } + return l.length > 0 ? lc(l) : dc(r); + }, + wc(i) + ? oc + : function (e) { + for (var t = nc({}, e), s = 0; s < n; s++) { + var o = a[s], + r = i[s].encode; + r !== oc && (t[o] = r(e[o])); } - (e.isUp - ? e.bossY < bl - ? ((e.bossY += 2 * i * ((5 + bl - e.bossY) / 6)), - (e.bossY = B.clamp2(Sl, bl, e.bossY))) - : (e.bossY = bl) - : e.bossY > Sl - ? ((e.bossY += 2 * i * ((-5 + Sl - e.bossY) / 6)), - (e.bossY = B.clamp2(Sl, bl, e.bossY))) - : (e.bossY = Sl), - r < playerX + 38 && - !e.playerDestroyed && - ((e.playerDestroyed = true)), - e.shootFrames > 0 && (e.shootFrames -= i), - (e.playerDestroyed && (e.bossY = playerY)), - e.destroyed || (e.bossX = r) - ); + return t; }, - crashed: ({ playerX: e, playerY: t, bossState: a }) => { - let i = false; - for (const n of a.asteroids) { - const a = be.pointInCircle(n); - n.destroyed || - n.x > e + n.radius + El || - n.x < e - n.radius - El || - !( - a({ x: e, y: t }) || - a({ x: e + 15, y: t + 15 }) || - a({ x: e - 15, y: t + 15 }) || - a({ x: e - 15, y: t - 15 }) || - a({ x: e + 15, y: t - 15 }) - ) || - (i = true); + e, + ); + }, + Nc = (function (e) { + function t(t, a, i, n, s) { + var o = e.call(this, t, a, i, n) || this; + return ((o.props = s), (o._tag = "PartialType"), o); + } + return (ic(t, e), t); + })(sc), + xc = function (e, t) { + void 0 === t && (t = "Partial<" + Ac(e) + ">"); + var a = Object.keys(e), + i = a.map(function (t) { + return e[t]; + }), + n = a.length; + return new Nc( + t, + function (t) { + if (bc.is(t)) { + for (var i = 0; i < n; i++) { + var s = a[i], + o = t[s]; + if (void 0 !== o && !e[s].is(o)) return false; } - const n = be.rectTouchesRect({ - x: e, - y: t, - width: El, - height: El, - }); - for (const e of a.insideAsteroid) - (("top" === e.hitType && - n({ - x: e.x, - y: (bl + Sl) / 2 - 10, - width: vl, - height: bl - Sl - 20, - })) || - ("bottom" === e.hitType && - n({ - x: e.x, - y: (bl + Sl) / 2 + 10, - width: vl, - height: bl - Sl - 20, - })) || - ("topStalectite" === e.hitType && - n({ x: e.x, y: bl + 25 - 45, width: 40, height: 90 })) || - ("bottomStalecmite" === e.hitType && - n({ x: e.x, y: Sl - 25 + 45, width: 40, height: 90 }))) && - (i = true); - for (const e of a.bullets) !e.isPlayer && n(e) && (i = true); - return i; - }, - }; - }, - getDemonBoss = function () { - return { - fileNames: { - images: [], - spine: [ - Qs.spineFiles.world4Boss, - Qs.spineFiles.world4BossFistCollision, - Qs.spineFiles.world4BossFireBall, - Qs.spineFiles.world4BossMinion, - Qs.spineFiles.world4BossPlayerHit, - ], - audio: [ - "audio/levels/boss4/claw_attack.mp3", - "audio/levels/boss4/tail_attack.mp3", - "audio/levels/boss4/death.mp3", - "audio/levels/boss4/fireball.mp3", - "audio/levels/boss4/footstep1.wav", - "audio/levels/boss4/footstep2.wav", - "audio/levels/boss4/footstep3.wav", - "audio/levels/boss4/laser.mp3", - "audio/levels/boss4/laugh.mp3", - "audio/levels/boss4/minion.mp3", - "audio/levels/boss4/block_explosion.mp3", - ], + return true; + } + return false; + }, + function (t, i) { + var s = bc.validate(t, i); + if (tc(s)) return s; + for (var o = s.right, r = o, l = [], c = 0; c < n; c++) { + var d = a[c], + u = r[d], + h = e[d], + p = h.validate(u, rc(i, d, h, u)); + if (tc(p)) void 0 !== u && uc(l, p.left); + else { + var g = p.right; + g !== u && (r === o && (r = nc({}, o)), (r[d] = g)); + } + } + return l.length > 0 ? lc(l) : dc(r); + }, + wc(i) + ? oc + : function (e) { + for (var t = nc({}, e), s = 0; s < n; s++) { + var o = a[s], + r = e[o]; + void 0 !== r && (t[o] = i[s].encode(r)); + } + return t; }, - mutatesState: true, - initState: ({ - assets: e, - checkpointState: t, - playSound: a, - pauseSound: i, - }) => { - const { frame: n = 0, bossState: s } = t || {}, - { - allMinions: o = [...Cl.map((e) => Object.assign({}, e))], - minions: r = [], - allFireballs: l = [...wl.map((e) => Object.assign({}, e))], - fireballs: c = [], - } = s || {}; + e, + ); + }, + Pc = (function (e) { + function t(t, a, i, n, s, o) { + var r = e.call(this, t, a, i, n) || this; + return ( + (r.domain = s), + (r.codomain = o), + (r._tag = "DictionaryType"), + r + ); + } + return (ic(t, e), t); + })(sc); + function Mc(e) { + var t; + if ($c(e)) { + var a = e.value; + if (mc.is(a)) return (((t = {})[a] = null), t); + } else { + if ("KeyofType" === e._tag) return e.keys; + if (Jc(e)) { + var i = e.types.map(function (e) { + return Mc(e); + }); + return i.some(pc.is) + ? void 0 + : Object.assign.apply( + Object, + (function () { + for (var e = 0, t = 0, a = arguments.length; t < a; t++) + e += arguments[t].length; + var i = Array(e), + n = 0; + for (t = 0; t < a; t++) + for ( + var s = arguments[t], o = 0, r = s.length; + o < r; + o++, n++ + ) + i[n] = s[o]; + return i; + })([{}], i), + ); + } + } + } + function Lc(e, t, a) { + var i = Mc(e); + return i + ? (function (e, t, a, i) { + void 0 === i && + (i = "{ [K in " + t.name + "]: " + a.name + " }"); + var n = e.length; + return new Pc( + i, + function (t) { return ( - i && - (i("audio/levels/boss4/laugh.mp3"), - i("audio/levels/boss4/laser.mp3"), - i("audio/levels/boss4/tail_attack.mp3"), - i("audio/levels/boss4/claw_attack.mp3")), - { - type: "demon", - runtime: Ys( - Qs.spineFiles.world4Boss, - e, - n, - "animation", - false, - -100, - -243, - void 0, - void 0, - (e) => { - if (a) - switch (e) { - case "Step1": - a("audio/levels/boss4/footstep1.wav"); - break; - case "Step2": - a("audio/levels/boss4/footstep2.wav"); - break; - case "Step3": - a("audio/levels/boss4/footstep3.wav"); - break; - case "Laugh": - a("audio/levels/boss4/laugh.mp3"); - break; - case "Laser": - a("audio/levels/boss4/laser.mp3"); - break; - case "Claw_flash": - a("audio/levels/boss4/claw_attack.mp3"); - break; - case "Tail_flash": - a("audio/levels/boss4/tail_attack.mp3"); - } - }, - ), - fistRuntime: Ys( - Qs.spineFiles.world4BossFistCollision, - e, - n, - "animation", - false, - -100, - -243, - ), - collisionFn: () => false, - blockCollisionFn: () => false, - allMinions: o, - minions: r, - allFireballs: l, - fireballs: c, - } + bc.is(t) && + e.every(function (e) { + return a.is(t[e]); + }) ); }, - cloneState: (e) => ({ - type: "demon", - runtime: e.runtime, - fistRuntime: e.fistRuntime, - collisionFn: () => false, - blockCollisionFn: () => false, - allMinions: e.allMinions.map((e) => Object.assign({}, e)), - minions: e.minions.map((e) => Object.assign({}, e)), - allFireballs: e.allFireballs.map((e) => Object.assign({}, e)), - fireballs: e.fireballs.map((e) => Object.assign({}, e)), - }), - loop: ({ bossState: e, playerX: t, df: a }) => { - const { collisionFn: i, blockCollisionFn: n } = js( - e.runtime, - e.fistRuntime, - a, - t - et.initialPosition.x, - ); - if ( - ((e.collisionFn = i), - (e.blockCollisionFn = n), - e.minions.length > 0 && - e.minions[0].x < t - 400 && - e.minions.shift(), - e.fireballs.length > 0 && - e.fireballs[0].x < t - 400 && - e.fireballs.shift(), - e.allMinions.length > 0) + function (t, i) { + var s = bc.validate(t, i); + if (tc(s)) return s; + for ( + var o = s.right, r = {}, l = [], c = false, d = 0; + d < n; + d++ ) { - const a = e.allMinions[0]; - a.x < t + 650 && (e.minions.push(a), e.allMinions.shift()); + var u = e[d], + h = o[u], + p = a.validate(h, rc(i, u, a, h)); + if (tc(p)) uc(l, p.left); + else { + var g = p.right; + ((c = c || g !== h), (r[u] = g)); + } } - if (e.allFireballs.length > 0) { - const a = e.allFireballs[0]; - a.x < t + 650 && - (e.fireballs.push(a), e.allFireballs.shift()); + return l.length > 0 + ? lc(l) + : dc(c || Object.keys(o).length !== n ? r : o); + }, + a.encode === oc + ? oc + : function (t) { + for (var i = {}, s = 0; s < n; s++) { + var o = e[s]; + i[o] = a.encode(t[o]); + } + return i; + }, + t, + a, + ); + })(Object.keys(i), e, t, a) + : (function (e, t, a) { + return ( + void 0 === a && + (a = "{ [K in " + e.name + "]: " + t.name + " }"), + new Pc( + a, + function (a) { + return bc.is(a) + ? Object.keys(a).every(function (i) { + return e.is(i) && t.is(a[i]); + }) + : qc(t) && Array.isArray(a); + }, + function (a, i) { + if (bc.is(a)) { + for ( + var n = {}, + s = [], + o = Object.keys(a), + r = o.length, + l = false, + c = 0; + c < r; + c++ + ) { + var d = o[c], + u = a[d], + h = e.validate(d, rc(i, d, e, d)); + if (tc(h)) uc(s, h.left); + else { + var p = h.right; + ((l = l || p !== d), (d = p)); + var g = t.validate(u, rc(i, d, t, u)); + if (tc(g)) uc(s, g.left); + else { + var m = g.right; + ((l = l || m !== u), (n[d] = m)); + } + } + } + return s.length > 0 ? lc(s) : dc(l ? n : a); + } + return qc(t) && Array.isArray(a) ? dc(a) : cc(a, i); + }, + e.encode === oc && t.encode === oc + ? oc + : function (a) { + for ( + var i = {}, n = Object.keys(a), s = n.length, o = 0; + o < s; + o++ + ) { + var r = n[o]; + i[String(e.encode(r))] = t.encode(a[r]); + } + return i; + }, + e, + t, + ) + ); + })(e, t, a); + } + var Dc = (function (e) { + function t(t, a, i, n, s) { + var o = e.call(this, t, a, i, n) || this; + return ((o.types = s), (o._tag = "UnionType"), o); + } + return (ic(t, e), t); + })(sc), + Bc = function (e, t) { + void 0 === t && + (t = (function (e) { + return ( + "(" + + e + .map(function (e) { + return e.name; + }) + .join(" | ") + + ")" + ); + })(e)); + var a = (function (e) { + for ( + var t = Qc(e[0]), + a = Object.keys(t), + i = e.length, + n = function (a) { + for (var n = t[a].slice(), s = [t[a]], o = 1; o < i; o++) { + var r = Qc(e[o])[a]; + if (void 0 === r) return "continue-keys"; + if ( + r.some(function (e) { + return -1 !== n.indexOf(e); + }) + ) + return "continue-keys"; + (n.push.apply(n, r), s.push(r)); } - for (const t of e.minions) t.x -= a; - for (const t of e.fireballs) t.y -= 1.5 * a; + return { value: [a, s] }; }, - crashed: ({ - bossState: e, - playerX: t, - playerY: a, - frame: i, - rectangleHitPlayer: n, - inViewLayout: s, - inViewLayoutState: o, - fullLayoutState: r, - fullLayoutStateIndexes: l, - }) => { - let c = false; - (e.collisionFn(t, a) || - e.collisionFn(t - 15, a + 15) || - e.collisionFn(t + 15, a + 15) || - e.collisionFn(t + 15, a - 15) || - e.collisionFn(t - 15, a - 15)) && - (c = true); - const d = e.blockCollisionFn; - for (let e = 0; e < s.blocks.length; e++) { - const t = s.blocks[e], - a = o.blocks[e]; - !a.destroyed && - d(t.x, t.y + t.height / 2) && - xa.updateLayoutStateField( - "blocks", - e, - Object.assign(Object.assign({}, a), { - destroyed: { frame: i, x: t.x, y: t.y, by: "stomped" }, - }), - r, - o, - l, - false, - ); + s = 0, + o = a; + s < o.length; + s++ + ) { + var r = n(o[s]); + if ("object" == typeof r) return r.value; + } + })(e); + if (void 0 !== a && e.length > 0) { + var i = a[0], + n = a[1], + s = n.length, + o = function (e) { + for (var t = 0; t < s; t++) + if (-1 !== n[t].indexOf(e)) return t; + }; + return new Vc( + t, + function (t) { + if (bc.is(t)) { + var a = o(t[i]); + return void 0 !== a && e[a].is(t); } - for (const t of e.minions) n(t) && (c = true); - for (const t of e.fireballs) n(t) && (c = true); - return c; + return false; }, - }; - }, - Pl = function (e, t) { - return ( - "demon" === (null == e ? void 0 : e.type) && t > 5226 && t < Ol - ); - }, - Ml = function (e) { - return "demon" === (null == e ? void 0 : e.type); - }, - Ll = function (e, t, a) { - return ( - "demon" === (null == e ? void 0 : e.type) && - t > Rl && - t < Ol && - !a + function (t, a) { + var n = bc.validate(t, a); + if (tc(n)) return n; + var s = n.right, + r = o(s[i]); + if (void 0 === r) return cc(t, a); + var l = e[r]; + return l.validate(s, rc(a, String(r), l, s)); + }, + wc(e) + ? oc + : function (a) { + var n = o(a[i]); + if (void 0 === n) + throw new Error( + "no codec found to encode value in union codec " + t, + ); + return e[n].encode(a); + }, + e, + i, ); - }, - Dl = [ - { - levelName: "Dragonfly", - levelFileName: "dragonfly", - song: hl.songs.dragonfly, - unlockedByIndex: null, - x: -250, - y: 20, - pathToLevel: [], - maxFrames: 8862, - difficulty: 2, + } + return new Dc( + t, + function (t) { + return e.some(function (e) { + return e.is(t); + }); }, - { - levelName: "Solar Wind", - levelFileName: "solar-wind", - song: hl.songs.solarWind, - unlockedByIndex: 0, - x: -100, - y: 70, - pathToLevel: [ - [-220, 10], - [-130, 60], - ], - maxFrames: 8762, - difficulty: 3, - comingSoon: true, + function (t, a) { + for (var i = [], n = 0; n < e.length; n++) { + var s = e[n], + o = s.validate(t, rc(a, String(n), s, t)); + if (!tc(o)) return dc(o.right); + uc(i, o.left); + } + return lc(i); }, - { - levelName: "Think Different", - levelFileName: "think-different", - song: hl.songs.thinkDifferent, - unlockedByIndex: 1, - x: 120, - y: -50, - pathToLevel: [ - [-70, 60], - [80, -30], - ], - maxFrames: 10054, - difficulty: 5, - }, - { - levelName: "Solar Abyss", - levelFileName: "solar-abyss", - song: hl.songs.solarAbyss, - - unlockedByIndex: 2, - x: 150, - y: 100, - pathToLevel: [ - [120, 10], - [140, 45], - ], - maxFrames: 9738, - difficulty: 8, - }, - { - levelName: "Indestructable", - levelFileName: "indestructable", - song: hl.songs.indestructable, - unlockedByIndex: null, //2, - x: 250, - y: 20, - pathToLevel: [ - [150, -20], - [220, 20], - ], - maxFrames: 5647, - difficulty: 4, - boss: getRobotBoss(), - }, - ], - Bl = [ - { - levelName: "Glitched Out", - levelFileName: "glitched-out", - song: hl.songs.glitchedOut, - unlockedByIndex: null, - x: -250, - y: 30, - pathToLevel: [], - maxFrames: 10643, - difficulty: 4, - }, - { - levelName: "8 Bit Shuffle", - levelFileName: "8-bit-shuffle", - song: hl.songs.eightBitShuffle, - unlockedByIndex: 0, - x: -50, - y: 50, - pathToLevel: [ - [-220, 30], - [-80, 50], - ], - maxFrames: 8407, - difficulty: 4, - }, - { - levelName: "Milky Ways", - levelFileName: "milky-ways", - song: hl.songs.milkyWays, - unlockedByIndex: 1, - x: -110, - y: -100, - pathToLevel: [ - [-60, -10], - [-80, -70], - ], - maxFrames: 9638, - difficulty: 9, - }, - { - levelName: "Daydreamer", - levelFileName: "daydreamer", - song: hl.songs.daydreamer, - unlockedByIndex: 1, - x: 90, - y: -20, - pathToLevel: [ - [-20, 50], - [60, -20], - ], - maxFrames: 7477, - difficulty: 5, - comingSoon: true, - }, - { - levelName: "Critical Hit (Extended)", - levelFileName: "critical-hit", - song: hl.songs.criticalHitExtended, - unlockedByIndex: 3, - x: 250, - y: 50, - pathToLevel: [ - [120, 0], - [220, 50], - ], - maxFrames: 5343, - difficulty: 5, - boss: getPixelBoss(), - comingSoon: true, - }, - ], - Fl = [ - { - levelName: "Silverdust", - levelFileName: "silverdust", - song: hl.songs.silverdust, - unlockedByIndex: null, - x: -240, - y: -30, - pathToLevel: [], - maxFrames: 7986, - difficulty: 2, - }, - { - levelName: "Frontier", - levelFileName: "frontier", - song: hl.songs.frontier, - unlockedByIndex: 0, - x: -140, - y: 40, - pathToLevel: [ - [-220, 0], - [-180, 40], - ], - maxFrames: 9377, - difficulty: 5, - }, - { - levelName: "Theory Of Everything 3", - levelFileName: "toeiii", - song: hl.songs.toe3, - unlockedByIndex: 1, - x: -60, - y: -100, - pathToLevel: [ - [-120, -20], - [-100, -80], - ], - maxFrames: 9156, - difficulty: 8, - }, - { - levelName: "Accelerated", - levelFileName: "accelerated", - song: hl.songs.accelerated, - unlockedByIndex: 1, - x: 110, - y: 10, - pathToLevel: [ - [-100, 40], - [70, 10], - ], - maxFrames: 7530, - difficulty: 2, - }, - { - levelName: "Sky Fracture", - levelFileName: "sky-fracture", - song: hl.songs.skyFracture, - unlockedByIndex: 3, - x: 250, - y: 50, - pathToLevel: [ - [150, 10], - [220, 40], - ], - maxFrames: 5460, - difficulty: 5, - boss: getFlyingBoss(), - }, - ], - Yl = [ - { - levelName: "True Colors", - levelFileName: "true-colors", - song: hl.songs.truecolors, - unlockedByIndex: null, - x: -240, - y: 30, - pathToLevel: [], - maxFrames: 10420, - difficulty: 3, - }, - { - levelName: "Color", - levelFileName: "color", - song: hl.songs.color, - unlockedByIndex: 0, - x: -100, - y: 0, - pathToLevel: [ - [-220, 30], - [-130, 0], - ], - maxFrames: 10111, - difficulty: 4, - }, - { - levelName: "Coincidence", - levelFileName: "coincidence", - song: hl.songs.coincidence, - unlockedByIndex: 1, - x: 120, - y: 60, - pathToLevel: [ - [-70, 0], - [90, 50], - ], - maxFrames: 8685, - difficulty: 5, - }, - { - levelName: "Mutant", - levelFileName: "mutant", - song: hl.songs.mutant, - unlockedByIndex: 2, - x: 140, - y: -120, - pathToLevel: [ - [120, 5], - [130, -20], - ], - maxFrames: 11714, - difficulty: 10, - }, - { - levelName: "Overdrive", - levelFileName: "overdrive", - song: hl.songs.overdrive, - unlockedByIndex: null, //2, - x: 250, - y: 0, - pathToLevel: [ - [160, 50], - [220, 0], - ], - maxFrames: 5597, - difficulty: 6, - boss: getDemonBoss(), - }, - ], - world5levels = [ - { - levelName: "Fire Aura 2", - levelFileName: "fire-aura", - author: "Alfredo Gamer", - song: hl.songs.fireAura, - unlockedByIndex: null, - x: -240, - y: 20, - pathToLevel: [], - maxFrames: 9877, - difficulty: 7, - }, - { - levelName: "Heaven 2", - levelFileName: "heaven", - song: hl.songs.heaven, - unlockedByIndex: 0, - x: -100, - y: -30, - pathToLevel: [], - maxFrames: 9877, - difficulty: 7, - }, - ], - Ul = [ - /*{ - levelName: "Cloud 9", - levelFileName: "cloud-9", - song: hl.songs.cloud9, - unlockedByIndex: null, - x: 0, - y: 0, - pathToLevel: [], - maxFrames: 9070, - difficulty: 5, - },*/ - { - levelName: "Virtual", - levelFileName: "virtual", - song: hl.songs.virtual, - unlockedByIndex: null, - x: 0, - y: 0, - pathToLevel: [], - maxFrames: 9637, - difficulty: 7, - }, - { - levelName: "Normal Polymorph", - levelFileName: "polymorph", - author: "Fluke Games, d016", - song: hl.songs.polymorph, - unlockedByIndex: null, - x: 0, - y: 0, - pathToLevel: [], - maxFrames: 8782, - difficulty: 8, - }, - /*{ - levelName: "For You", - levelFileName: "for-you", - author: "Fluke Games", - song: hl.songs.forYou, - unlockedByIndex: null, - x: 0, - y: 0, - pathToLevel: [], - maxFrames: 8836, - difficulty: 5, - },*/ - { - levelName: "Rum n' Bass", - levelFileName: "rum-and-bass", - song: hl.songs.rummy, - unlockedByIndex: null, - x: 0, - y: 0, - pathToLevel: [], - maxFrames: 11577, - difficulty: 6, - }, - /*{ - levelName: "Cool Friends", - levelFileName: "cool-friends", - song: hl.songs.coolFriends, - - author: "Fluke Games", - unlockedByIndex: null, - x: 0, - y: 0, - pathToLevel: [], - maxFrames: 10740, - difficulty: 5, - }, - { - levelName: "Nacreous Snowmelt", - levelFileName: "nacreous-snowmelt", - song: hl.songs.nacreousSnowmelt, - author: "Fluke Games", - unlockedByIndex: null, - x: 0, - y: 0, - pathToLevel: [], - maxFrames: 10996, - difficulty: 6, - },*/ - { - levelName: "Aurora", - levelFileName: "aurora", - author: "d016", - song: hl.songs.aura, - unlockedByIndex: null, - x: 0, - y: 0, - pathToLevel: [], - maxFrames: 9877, - difficulty: 11, - }, - { - levelName: "Octane (Full Version)", - levelFileName: "octane-extended", - author: "WaterFire", - song: hl.songs.octaneExtended, - unlockedByIndex: null, - x: 0, - y: 0, - pathToLevel: [], - maxFrames: 15960, - difficulty: 6, - }, - { - levelName: "Challenge 2", - levelFileName: "challenge-2", - author: "lkjhasdf", - song: hl.songs.aura, - unlockedByIndex: null, - x: 0, - y: 0, - pathToLevel: [], - maxFrames: 9877, - difficulty: 10, - }, - { - levelName: "ClutterFunk?", - levelFileName: "clutterfunk-whaike3", - author: "HIimaburger", - song: hl.songs.clutterfunk, - unlockedByIndex: null, - x: 0, - y: 0, - pathToLevel: [], - maxFrames: 9420, - difficulty: 7, - }, - { - levelName: "Another World", - levelFileName: "another-world", - author: "Mincofficial", - song: hl.songs.heaven, - unlockedByIndex: null, - x: 0, - y: 0, - pathToLevel: [], - maxFrames: 5697, - difficulty: 6, - }, - { - levelName: "Funky Adventures", - levelFileName: "funky-adventures", - author: "Outline Gamer", - song: hl.songs.color, - unlockedByIndex: null, - x: 0, - y: 0, - pathToLevel: [], - maxFrames: 5314, - difficulty: 4, - } - ], - jl = [Dl, Bl, Fl, Yl, world5levels], - Gl = Dl[0].levelName, - Vl = "",//Ul[0].levelName, - Hl = { - getWorlds: () => jl, - getWorld: (e) => (0 === e ? Ul : jl[e - 1]), - firstLevelName: Gl, - bonusLevels: Ul, - skateboardLevelName: Vl, - }, - Xl = (e, t, a, i, n, s, o, r, l, c = 0, d = 0) => { - const u = e.findIndex((e) => e.levelName === t); - if (-1 === u) { - const d = n - ? { - didFinish: s, - furthestFrame: o, - lastCheckpointState: l || null, - } - : { - didFinish: false, - furthestFrame: 0, - lastCheckpointState: null, - }, - u = n - ? { didFinish: false, furthestFrame: 0 } - : { didFinish: s, furthestFrame: o }; - return [ - ...e, - { - levelName: t, - levelIndex: a, - world: i, - checkpoints: d, - noCheckpoints: u, - highScore: s ? c : 0, - totalAttempts: 1, - bestAttempts: s ? r : null, - }, - ]; - } - const h = e[u], - p = n - ? { - didFinish: h.checkpoints.didFinish || s, - furthestFrame: Math.max(h.checkpoints.furthestFrame, o), - lastCheckpointState: (() => { - const e = - void 0 === l ? h.checkpoints.lastCheckpointState : l; - return null === e - ? e - : Object.assign(Object.assign({}, e), { attempt: r }); - })(), - } - : h.checkpoints, - g = n - ? h.noCheckpoints - : { - didFinish: h.noCheckpoints.didFinish || s, - furthestFrame: Math.max(h.noCheckpoints.furthestFrame, o), - }; - return tt( - e, - Object.assign(Object.assign({}, h), { - checkpoints: p, - noCheckpoints: g, - highScore: s ? Math.max(h.highScore, c) : h.highScore, - totalAttempts: h.totalAttempts + d, - bestAttempts: s - ? null === h.bestAttempts - ? r - : Math.min(h.bestAttempts, r) - : h.bestAttempts, - }), - u, - ); - }, - zl = function (e, t, a) { - return { - checkpoints: { - furthestFrame: 0, - didFinish: false, - lastCheckpointState: null, + wc(e) + ? oc + : function (a) { + for (var i = 0, n = e; i < n.length; i++) { + var s = n[i]; + if (s.is(a)) return s.encode(a); + } + throw new Error( + "no codec found to encode value in union type " + t, + ); }, - noCheckpoints: { furthestFrame: 0, didFinish: false }, - levelIndex: t, - levelName: a, - world: e, - highScore: 0, - totalAttempts: 0, - bestAttempts: null, - }; + e, + ); + }, + Fc = (function (e) { + function t(t, a, i, n, s) { + var o = e.call(this, t, a, i, n) || this; + return ((o.types = s), (o._tag = "IntersectionType"), o); + } + return (ic(t, e), t); + })(sc), + Yc = function (e, t) { + for ( + var a = true, i = true, n = !bc.is(e), s = 0, o = t; + s < o.length; + s++ + ) + ((d = o[s]) !== e && (a = false), bc.is(d) && (i = false)); + if (a) return e; + if (i) return t[t.length - 1]; + for (var r = {}, l = 0, c = t; l < c.length; l++) { + var d = c[l]; + for (var u in d) + (r.hasOwnProperty(u) && !n && d[u] === e[u]) || (r[u] = d[u]); + } + return r; + }; + function Uc(e, t) { + void 0 === t && + (t = + "(" + + e + .map(function (e) { + return e.name; + }) + .join(" & ") + + ")"); + var a = e.length; + return new Fc( + t, + function (t) { + return e.every(function (e) { + return e.is(t); + }); }, - Wl = function (e) { - const t = Hl.getWorlds().flat(), - a = e - .map((e) => { - const a = t.find((t) => t.levelName === e.levelName); - return !a || a.boss - ? null - : { - levelName: a.levelName, - fileName: a.levelFileName, - snippetFileName: hl.getSnippetName(a.song.fileName), - author: a.song.author, - }; - }) - .filter(nt); - return ( - 0 === a.length && - a.push({ - levelName: "Dragonfly", - fileName: "dragonfly", - author: hl.songs.dragonfly.author, - snippetFileName: hl.getSnippetName( - hl.songs.dragonfly.fileName, - ), + 0 === e.length + ? dc + : function (t, i) { + for (var n = [], s = [], o = 0; o < a; o++) { + var r = e[o], + l = r.validate(t, rc(i, String(o), r, t)); + tc(l) ? uc(s, l.left) : n.push(l.right); + } + return s.length > 0 ? lc(s) : dc(Yc(t, n)); + }, + 0 === e.length + ? oc + : function (t) { + return Yc( + t, + e.map(function (e) { + return e.encode(t); }), - a - ); - }, - ql = function (e) { - return [ - ...Object.values(hl.songs) /*, - { - name: `${"Custom song"}...`, - author: "", - fileName: "", - bpm: "120", - label: "", - isBonusSong: false, - custom: true, - },*/, - ]; - }, - $l = function (e) {}, - Jl = function (e, t, a, i) {}, - Kl = function (e, t, a, i, n) {}, - Ql = function (e) {}; - var Zl, - ec, - tc = function (e) { - return "Left" === e._tag; - }, - ac = function (e) { - return function (t) { - return tc(t) ? e(t.left) : t.right; - }; - }, - ic = - ((Zl = function (e, t) { - return ( - (Zl = - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && - function (e, t) { - e.__proto__ = t; - }) || - function (e, t) { - for (var a in t) - Object.prototype.hasOwnProperty.call(t, a) && - (e[a] = t[a]); - }), - Zl(e, t) ); - }), - function (e, t) { - function a() { - this.constructor = e; - } - (Zl(e, t), - (e.prototype = - null === t - ? Object.create(t) - : ((a.prototype = t.prototype), new a()))); - }), - nc = function () { + }, + e, + ); + } + var jc = (function (e) { + function t(t, a, i, n, s) { + var o = e.call(this, t, a, i, n) || this; + return ((o.types = s), (o._tag = "TupleType"), o); + } + return (ic(t, e), t); + })(sc); + function Gc(e, t) { + void 0 === t && + (t = + "[" + + e + .map(function (e) { + return e.name; + }) + .join(", ") + + "]"); + var a = e.length; + return new jc( + t, + function (t) { return ( - (nc = - Object.assign || - function (e) { - for (var t, a = 1, i = arguments.length; a < i; a++) - for (var n in (t = arguments[a])) - Object.prototype.hasOwnProperty.call(t, n) && - (e[n] = t[n]); - return e; - }), - nc.apply(this, arguments) + Ec.is(t) && + t.length === a && + e.every(function (e, a) { + return e.is(t[a]); + }) ); }, - sc = (function () { - function e(e, t, a, i) { - ((this.name = e), - (this.is = t), - (this.validate = a), - (this.encode = i), - (this.decode = this.decode.bind(this))); + function (t, i) { + var n = Ec.validate(t, i); + if (tc(n)) return n; + for ( + var s = n.right, + o = s.length > a ? s.slice(0, a) : s, + r = [], + l = 0; + l < a; + l++ + ) { + var c = s[l], + d = e[l], + u = d.validate(c, rc(i, String(l), d, c)); + if (tc(u)) uc(r, u.left); + else { + var h = u.right; + h !== c && (o === s && (o = s.slice()), (o[l] = h)); + } } - return ( - (e.prototype.pipe = function (t, a) { - var i = this; - return ( - void 0 === a && - (a = "pipe(" + this.name + ", " + t.name + ")"), - new e( - a, - t.is, - function (e, a) { - var n = i.validate(e, a); - return tc(n) ? n : t.validate(n.right, a); - }, - this.encode === oc && t.encode === oc - ? oc - : function (e) { - return i.encode(t.encode(e)); - }, - ) - ); - }), - (e.prototype.asDecoder = function () { - return this; - }), - (e.prototype.asEncoder = function () { - return this; - }), - (e.prototype.decode = function (e) { - return this.validate(e, [{ key: "", type: this, actual: e }]); - }), - e - ); - })(), - oc = function (e) { - return e; - }, - rc = function (e, t, a, i) { - for (var n = e.length, s = Array(n + 1), o = 0; o < n; o++) - s[o] = e[o]; - return ((s[n] = { key: t, type: a, actual: i }), s); + return r.length > 0 ? lc(r) : dc(o); }, - lc = function (e) { - return { _tag: "Left", left: e }; - }, - cc = function (e, t, a) { - return lc([{ value: e, context: t, message: a }]); - }, - dc = function (e) { - return { _tag: "Right", right: e }; - }, - uc = function (e, t) { - for (var a = t.length, i = 0; i < a; i++) e.push(t[i]); - }, - hc = new ((function (e) { - function t() { - var t = - e.call( - this, - "null", - function (e) { - return null === e; - }, - function (e, a) { - return t.is(e) ? dc(e) : cc(e, a); - }, - oc, - ) || this; - return ((t._tag = "NullType"), t); - } - return (ic(t, e), t); - })(sc))(), - pc = new ((function (e) { - function t() { - var t = - e.call( - this, - "undefined", - function (e) { - return void 0 === e; - }, - function (e, a) { - return t.is(e) ? dc(e) : cc(e, a); - }, - oc, - ) || this; - return ((t._tag = "UndefinedType"), t); - } - return (ic(t, e), t); - })(sc))(), - gc = - (new ((function (e) { - function t() { - var t = e.call(this, "void", pc.is, pc.validate, oc) || this; - return ((t._tag = "VoidType"), t); - } - return (ic(t, e), t); - })(sc))(), + wc(e) + ? oc + : function (t) { + return e.map(function (e, a) { + return e.encode(t[a]); + }); + }, + e, + ); + } + ((function (e) { + ic(function (t, a, i, n, s) { + var o = e.call(this, t, a, i, n) || this; + return ((o.type = s), (o._tag = "ReadonlyType"), o); + }, e); + })(sc), + (function (e) { + ic(function (t, a, i, n, s) { + var o = e.call(this, t, a, i, n) || this; + return ((o.type = s), (o._tag = "ReadonlyArrayType"), o); + }, e); + })(sc)); + var Vc = (function (e) { + function t(t, a, i, n, s, o) { + var r = e.call(this, t, a, i, n, s) || this; + return ((r.tag = o), r); + } + return (ic(t, e), t); + })(Dc), + Hc = + ((function (e) { + ic(function (t, a, i, n, s) { + var o = e.call(this, t, a, i, n) || this; + return ((o.type = s), (o._tag = "ExactType"), o); + }, e); + })(sc), new ((function (e) { function t() { var t = e.call( this, - "unknown", + "never", function (e) { - return true; + return false; }, - dc, - oc, - ) || this; - return ((t._tag = "UnknownType"), t); - } - return (ic(t, e), t); - })(sc))()), - mc = new ((function (e) { - function t() { - var t = - e.call( - this, - "string", - function (e) { - return "string" == typeof e; - }, - function (e, a) { - return t.is(e) ? dc(e) : cc(e, a); - }, - oc, - ) || this; - return ((t._tag = "StringType"), t); - } - return (ic(t, e), t); - })(sc))(), - fc = new ((function (e) { - function t() { - var t = - e.call( - this, - "number", - function (e) { - return "number" == typeof e; - }, - function (e, a) { - return t.is(e) ? dc(e) : cc(e, a); - }, - oc, - ) || this; - return ((t._tag = "NumberType"), t); - } - return (ic(t, e), t); - })(sc))(), - yc = - (new ((function (e) { - function t() { - var t = - e.call( - this, - "bigint", - function (e) { - return "bigint" == typeof e; + function (e, t) { + return cc(e, t); }, - function (e, a) { - return t.is(e) ? dc(e) : cc(e, a); + function () { + throw new Error("cannot encode never"); }, - oc, ) || this; - return ((t._tag = "BigIntType"), t); + return ((t._tag = "NeverType"), t); } return (ic(t, e), t); })(sc))(), @@ -48010,3955 +48731,3181 @@ var version = "v1.17.2"; var t = e.call( this, - "boolean", - function (e) { - return "boolean" == typeof e; - }, - function (e, a) { - return t.is(e) ? dc(e) : cc(e, a); - }, - oc, - ) || this; - return ((t._tag = "BooleanType"), t); - } - return (ic(t, e), t); - })(sc))()), - Ec = new ((function (e) { - function t() { - var t = - e.call( - this, - "UnknownArray", - Array.isArray, - function (e, a) { - return t.is(e) ? dc(e) : cc(e, a); - }, - oc, - ) || this; - return ((t._tag = "AnyArrayType"), t); - } - return (ic(t, e), t); - })(sc))(), - bc = new ((function (e) { - function t() { - var t = - e.call( - this, - "UnknownRecord", - function (e) { - var t = Object.prototype.toString.call(e); - return "[object Object]" === t || "[object Window]" === t; - }, - function (e, a) { - return t.is(e) ? dc(e) : cc(e, a); - }, - oc, - ) || this; - return ((t._tag = "AnyDictionaryType"), t); - } - return (ic(t, e), t); - })(sc))(), - Sc = - (new ((function (e) { - function t() { - var t = - e.call( - this, - "Function", + "any", function (e) { - return "function" == typeof e; - }, - function (e, a) { - return t.is(e) ? dc(e) : cc(e, a); + return true; }, + dc, oc, ) || this; - return ((t._tag = "FunctionType"), t); - } - return (ic(t, e), t); - })(sc))(), - (function (e) { - function t(t, a, i, n, s, o) { - var r = e.call(this, t, a, i, n) || this; - return ( - (r.type = s), - (r.predicate = o), - (r._tag = "RefinementType"), - r - ); + return ((t._tag = "AnyType"), t); } return (ic(t, e), t); - })(sc)), - Ic = - (Xc( - fc, + })(sc))()); + function Xc(e, t, a) { + return ( + void 0 === a && + (a = + "(" + + e.name + + " | " + + (((i = t).displayName || + i.name || + "") + + ")")), + new Sc( + a, + function (a) { + return e.is(a) && t(a); + }, + function (a, i) { + var n = e.validate(a, i); + if (tc(n)) return n; + var s = n.right; + return t(s) ? dc(s) : cc(s, i); + }, + e.encode, + e, + t, + ) + ); + var i; + } + (new ((function (e) { + function t() { + var t = + e.call( + this, + "object", function (e) { - return Number.isInteger(e); + return null !== e && "object" == typeof e; }, - "Int", - ), - (function (e) { - function t(t, a, i, n, s) { - var o = e.call(this, t, a, i, n) || this; - return ((o.value = s), (o._tag = "LiteralType"), o); - } - return (ic(t, e), t); - })(sc)), - _c = function (e, t) { - void 0 === t && (t = JSON.stringify(e)); - var a = function (t) { - return t === e; - }; - return new Ic( - t, - a, - function (t, i) { - return a(t) ? dc(e) : cc(t, i); + function (e, a) { + return t.is(e) ? dc(e) : cc(e, a); }, oc, - e, - ); - }, - vc = - (ic( - function (e, t, a, i, n) { - var s = ec.call(this, e, t, a, i) || this; - return ((s.keys = n), (s._tag = "KeyofType"), s); - }, - (ec = sc), - ), - Object.prototype.hasOwnProperty), - Tc = (function (e) { - function t(t, a, i, n, s) { - var o = e.call(this, t, a, i, n) || this; - return ((o.runDefinition = s), (o._tag = "RecursiveType"), o); - } - return (ic(t, e), t); - })(sc); - Object.defineProperty(Tc.prototype, "type", { - get: function () { - return this.runDefinition(); - }, - enumerable: true, - configurable: true, - }); - var Rc = (function (e) { - function t(t, a, i, n, s) { - var o = e.call(this, t, a, i, n) || this; - return ((o.type = s), (o._tag = "ArrayType"), o); - } - return (ic(t, e), t); - })(sc), - Oc = function (e, t) { - return ( - void 0 === t && (t = "Array<" + e.name + ">"), - new Rc( - t, - function (t) { - return Ec.is(t) && t.every(e.is); - }, - function (t, a) { - var i = Ec.validate(t, a); - if (tc(i)) return i; - for ( - var n = i.right, s = n.length, o = n, r = [], l = 0; - l < s; - l++ - ) { - var c = n[l], - d = e.validate(c, rc(a, String(l), e, c)); - if (tc(d)) uc(r, d.left); - else { - var u = d.right; - u !== c && (o === n && (o = n.slice()), (o[l] = u)); - } + ) || this; + return ((t._tag = "ObjectType"), t); + } + return (ic(t, e), t); + })(sc))(), + Xc(fc, Number.isInteger, "Integer"), + (function (e) { + ic(function (t, a, i, n, s) { + var o = e.call(this, t, a, i, n) || this; + return ((o.props = s), (o._tag = "StrictType"), o); + }, e); + })(sc)); + var zc = {}; + function Wc(e, t) { + for (var a = [], i = 0, n = e; i < n.length; i++) { + var s = n[i]; + -1 !== t.indexOf(s) && a.push(s); + } + return a; + } + function qc(e) { + return "AnyType" === e._tag; + } + function $c(e) { + return "LiteralType" === e._tag; + } + function Jc(e) { + return "UnionType" === e._tag; + } + var Kc = []; + function Qc(e) { + if (-1 !== Kc.indexOf(e)) return zc; + if ( + (function (e) { + return "InterfaceType" === e._tag; + })(e) || + (function (e) { + return "StrictType" === e._tag; + })(e) + ) { + var t = zc; + for (var a in e.props) { + var i = e.props[a]; + $c(i) && (t === zc && (t = {}), (t[a] = [i.value])); + } + return t; + } + if ( + (function (e) { + return "ExactType" === e._tag; + })(e) || + (function (e) { + return "RefinementType" === e._tag; + })(e) + ) + return Qc(e.type); + if ( + (function (e) { + return "IntersectionType" === e._tag; + })(e) + ) + return e.types.reduce(function (e, t) { + return (function (e, t) { + if (e === zc) return t; + if (t === zc) return e; + var a = Object.assign({}, e); + for (var i in t) + if (e.hasOwnProperty(i)) { + var n = Wc(e[i], t[i]); + if (!(n.length > 0)) { + a = zc; + break; } - return r.length > 0 ? lc(r) : dc(o); - }, - e.encode === oc - ? oc - : function (t) { - return t.map(e.encode); - }, - e, + a[i] = n; + } else a[i] = t[i]; + return a; + })(e, Qc(t)); + }, zc); + if (Jc(e)) + return e.types.slice(1).reduce(function (e, t) { + return (function (e, t) { + if (e === zc || t === zc) return zc; + var a = zc; + for (var i in e) + t.hasOwnProperty(i) && + 0 === Wc(e[i], t[i]).length && + (a === zc && (a = {}), (a[i] = e[i].concat(t[i]))); + return a; + })(e, Qc(t)); + }, Qc(e.types[0])); + if ( + (function (e) { + return "RecursiveType" === e._tag; + })(e) + ) { + Kc.push(e); + var n = Qc(e.type); + return (Kc.pop(), n); + } + return zc; + } + const Zc = Gc, + ed = Bc([_c(0), _c(1)]), + td = Bc([ed, _c(2)]), + ad = Bc([td, _c(3)]), + id = Bc([ad, _c(4)]), + e6 = Bc([id, _c(5)]), + nd = { + tuple: Zc, + enum2: ed, + enum3: td, + enum4: ad, + enum5: id, + enum6: Bc([id, _c(5)]), + enum7: Bc([_c(0), _c(1), _c(2), _c(3), _c(4), _c(5), _c(6)]), + enum8: Bc([_c(0), _c(1), _c(2), _c(3), _c(4), _c(5), _c(6), _c(7)]), + enum9: Bc([ + _c(0), + _c(1), + _c(2), + _c(3), + _c(4), + _c(5), + _c(6), + _c(7), + _c(8), + ]), + enum10: Bc([ + _c(0), + _c(1), + _c(2), + _c(3), + _c(4), + _c(5), + _c(6), + _c(7), + _c(8), + _c(9), + ]), + }; + var sd, + od, + rd, + ld, + cd, + dd, + ud, + usage, + hd, + pd, + gd, + md, + fd, + yd, + Ed, + bd, + Sd, + Id, + _d, + vd, + Td, + Rd, + Od, + Cd, + wd, + clrs2, + Ad, + kd, + Nd, + xd, + Pd = function ( + e, + t, + a, + i, + n, + s, + o, + r, + l, + c, + d, + u, + h, + p, + g, + m, + f, + y, + E, + b, + ) { + switch (arguments.length) { + case 1: + return e; + case 2: + return t(e); + case 3: + return a(t(e)); + case 4: + return i(a(t(e))); + case 5: + return n(i(a(t(e)))); + case 6: + return s(n(i(a(t(e))))); + case 7: + return o(s(n(i(a(t(e)))))); + case 8: + return r(o(s(n(i(a(t(e))))))); + case 9: + return l(r(o(s(n(i(a(t(e)))))))); + case 10: + return c(l(r(o(s(n(i(a(t(e))))))))); + case 11: + return d(c(l(r(o(s(n(i(a(t(e)))))))))); + case 12: + return u(d(c(l(r(o(s(n(i(a(t(e))))))))))); + case 13: + return h(u(d(c(l(r(o(s(n(i(a(t(e)))))))))))); + case 14: + return p(h(u(d(c(l(r(o(s(n(i(a(t(e))))))))))))); + case 15: + return g(p(h(u(d(c(l(r(o(s(n(i(a(t(e)))))))))))))); + case 16: + return m(g(p(h(u(d(c(l(r(o(s(n(i(a(t(e))))))))))))))); + case 17: + return f(m(g(p(h(u(d(c(l(r(o(s(n(i(a(t(e)))))))))))))))); + case 18: + return y(f(m(g(p(h(u(d(c(l(r(o(s(n(i(a(t(e))))))))))))))))); + case 19: + return E(y(f(m(g(p(h(u(d(c(l(r(o(s(n(i(a(t(e)))))))))))))))))); + case 20: + return b( + E(y(f(m(g(p(h(u(d(c(l(r(o(s(n(i(a(t(e)))))))))))))))))), + ); + } + }; + function Md(e, t) { + return Pd( + t.decode(e), + ac( + (a) => ( + console.error("Decode error schema", t.name), + console.error( + "Decode error keys", + a + .map((e) => e.context.map((e) => e.key).join(",")) + .join(" --- "), + ), + console.error( + `Couldn't decode JSON ${void 0 === e ? String(e) : JSON.stringify(e).slice(0, 10) + }`, ) - ); + ) /*, + new Error( + `Couldn't decode JSON ${ + void 0 === e ? String(e) : JSON.stringify(e).slice(0, 10) + }` + )*/, + ), + ); + } + function Ld({ + mappers: e, + finalSchema: t, + uncompress: a, + compress: i, + }) { + return { + getDefaultData: function () { + return a(e.reduce((e, t) => t(e), void 0)); }, - Cc = (function (e) { - function t(t, a, i, n, s) { - var o = e.call(this, t, a, i, n) || this; - return ((o.props = s), (o._tag = "InterfaceType"), o); - } - return (ic(t, e), t); - })(sc), - wc = function (e) { - for (var t = 0; t < e.length; t++) - if (e[t].encode !== oc) return false; - return true; + jsonToData: function (i) { + if ( + Array.isArray(i) && + 3 === i.length && + "number" == typeof i[0] && + "number" == typeof i[1] + ) { + let [n, s, o] = i, + r = false; + try { + for (; n < e.length;) ((o = e[n](o)), n++, (r = true)); + } catch (e) { + return Error("Unable to map data to latest version"); + } + const l = Md(o, t); + return l instanceof Error + ? l + : { data: a(l), didUpdate: r, dateUpdated: s }; + } + return Error("Couldn't read version"); }, - Ac = function (e) { - return ( - "{ " + - (function (e) { - return Object.keys(e) - .map(function (t) { - return t + ": " + e[t].name; - }) - .join(", "); - })(e) + - " }" - ); + dataToJson: function (t, a) { + return [e.length, Dd(a), i(t)]; }, - kc = function (e, t) { - void 0 === t && (t = Ac(e)); - var a = Object.keys(e), - i = a.map(function (t) { - return e[t]; + }; + } + function Dd(e) { + return Math.round((e().getTime() - 16094592e5) / 6e4); + } + (!(function (e) { + ((e[(e.True = 0)] = "True"), (e[(e.False = 1)] = "False")); + })(sd || (sd = {})), + (function (e) { + ((e[(e.Dragonfly = 0)] = "Dragonfly"), + (e[(e.Solace = 1)] = "Solace"), + (e[(e.Lighthouse = 2)] = "Lighthouse"), + (e[(e.Octane = 3)] = "Octane"), + (e[(e.Stardust = 4)] = "Stardust"), + (e[(e.ThinkDifferent = 5)] = "ThinkDifferent"), + (e[(e.DarkSheep = 6)] = "DarkSheep"), + (e[(e.EightBitAdventure = 7)] = "EightBitAdventure"), + (e[(e.Indestructable = 8)] = "Indestructable"), + (e[(e.Frontier = 9)] = "Frontier"), + (e[(e.Polymorph = 10)] = "Polymorph"), + (e[(e.Accelerated = 11)] = "Accelerated"), + (e[(e.CriticalHit = 12)] = "CriticalHit"), + (e[(e.SkyFracture = 13)] = "SkyFracture"), + (e[(e.Breathe = 14)] = "Breathe"), + (e[(e.Blythe = 15)] = "Blythe"), + (e[(e.Awake = 16)] = "Awake"), + (e[(e.Coincidence = 17)] = "Coincidence"), + (e[(e.Mutant = 18)] = "Mutant"), + (e[(e.Overdrive = 19)] = "Overdrive"), + (e[(e.Cloud9 = 20)] = "Cloud9")); + })(od || (od = {})), + (function (e) { + ((e[(e.World1 = 0)] = "World1"), + (e[(e.World1Boss = 1)] = "World1Boss"), + (e[(e.World1Red = 2)] = "World1Red"), + (e[(e.World2 = 3)] = "World2"), + (e[(e.World2Red = 4)] = "World2Red"), + (e[(e.World3 = 5)] = "World3"), + (e[(e.Synthwave = 6)] = "Synthwave"), + (e[(e.World4 = 7)] = "World4"), + (e[(e.World4Red = 8)] = "World4Red"), + (e[(e.World4Boss = 9)] = "World4Boss"), + (e[(e.World3Red = 10)] = "World3Red"), + (e[(e.Skater = 11)] = "Skater")); + })(rd || (rd = {})), + (function (e) { + ((e[(e.Rot0 = 0)] = "Rot0"), + (e[(e.Rot90 = 1)] = "Rot90"), + (e[(e.Rot180 = 2)] = "Rot180"), + (e[(e.Rot270 = 3)] = "Rot270")); + })(ld || (ld = {})), + (function (e) { + ((e[(e.Static = 0)] = "Static"), + (e[(e.UpDown = 1)] = "UpDown"), + (e[(e.DownUp = 2)] = "DownUp"), + (e[(e.Falling = 3)] = "Falling"), + (e[(e.Rail = 4)] = "Rail")); + })(cd || (cd = {})), + (function (e) { + ((e[(e.Beat = 0)] = "Beat"), + (e[(e.Jump = 1)] = "Jump"), + (e[(e.Switch = 2)] = "Switch")); + })(dd || (dd = {})), + (function (e) { + ((e[(e.Left = 0)] = "Left"), (e[(e.Right = 1)] = "Right")); + })(ud || (ud = {})), + (function (e) { + ((e[(e.SingleUse = 0)] = "SingleUse"), + (e[(e.MultiUse = 1)] = "MultiUse")); + })(usage || (usage = {})), + (function (e) { + ((e[(e.Static = -1)] = "Static"), + (e[(e.UpDown = 0)] = "UpDown"), + (e[(e.DownUp = 1)] = "DownUp"), + (e[(e.Falling = 2)] = "Falling")); + })(hd || (hd = {})), + (function (e) { + ((e[(e.Beat = 0)] = "Beat"), + (e[(e.Jump = 1)] = "Jump"), + (e[(e.Switch = 2)] = "Switch")); + })(pd || (pd = {})), + (function (e) { + ((e[(e.Checkpoint = 0)] = "Checkpoint"), + (e[(e.EndOfLevel = 1)] = "EndOfLevel")); + })(gd || (gd = {})), + (function (e) { + ((e[(e.Gun = 0)] = "Gun"), + (e[(e.DoubleJump = 1)] = "DoubleJump"), + (e[(e.Jetpack = 2)] = "Jetpack"), + (e[(e.PlayerStack = 3)] = "PlayerStack"), + (e[(e.Skateboard = 4)] = "Skateboard")); + })(md || (md = {})), + (function (e) { + ((e[(e.Shooter = 0)] = "Shooter"), + (e[(e.Walker = 1)] = "Walker"), + (e[(e.WalkerHelmet = 2)] = "WalkerHelmet")); + e[(e.Bomb = 3)] = "Bomb"; + e[(e.Minion = 4)] = "Minion"; + e[(e.Fireball = 5)] = "Fireball"; + })(fd || (fd = {})), + (function (e) { + ((e[(e.Up = 0)] = "Up"), (e[(e.Right = 1)] = "Right")); + })(yd || (yd = {})), + (function (e) { + ((e[(e.Switch = 0)] = "Switch"), (e[(e.Jump = 1)] = "Jump")); + })(Ed || (Ed = {})), + (function (e) { + ((e[(e.A = 0)] = "A"), (e[(e.B = 1)] = "B")); + })(bd || (bd = {})), + (function (e) { + ((e[(e.Left = 0)] = "Left"), + (e[(e.Right = 1)] = "Right"), + (e[(e.Up = 2)] = "Up"), + (e[(e.Down = 3)] = "Down")); + })(Sd || (Sd = {})), + (function (e) { + ((e[(e.Gun = 0)] = "Gun"), + (e[(e.DoubleJump = 1)] = "DoubleJump"), + (e[(e.Jetpack = 2)] = "Jetpack"), + (e[(e.PlayerStack = 3)] = "PlayerStack"), + (e[(e.Skateboard = 4)] = "Skateboard"), + (e[(e.Punch = 5)] = "Punch")); + e[(e.Drill = 6)] = "Drill"; + e[(e.Ghost = 7)] = "Ghost"; + e[(e.Spaceship = 8)] = "Spaceship"; + })(Id || (Id = {})), + (function (e) { + ((e[(e.Movement = 0)] = "Movement"), + (e[(e.BlockSpike = 1)] = "BlockSpike")); + e[(e.Size = 2)] = "Size"; + e[(e.Color = 3)] = "Color"; + e[(e.Gravity = 4)] = "Gravity"; + e[(e.Falling = 5)] = "Falling"; + })(_d || (_d = {})), + (function (e) { + ((e[(e.Coin = 0)] = "Coin"), (e[(e.Arrows = 1)] = "Arrows")); + })(vd || (vd = {})), + (function (e) { + ((e[(e.Left = 0)] = "Left"), (e[(e.Right = 1)] = "Right")); + })(Td || (Td = {})), + (function (e) { + ((e[(e.Dragonfly = 0)] = "Dragonfly"), + (e[(e.Solace = 1)] = "Solace"), + (e[(e.Lighthouse = 2)] = "Lighthouse"), + (e[(e.Octane = 3)] = "Octane"), + (e[(e.Stardust = 4)] = "Stardust"), + (e[(e.ThinkDifferent = 5)] = "ThinkDifferent"), + (e[(e.DarkSheep = 6)] = "DarkSheep"), + (e[(e.EightBitAdventure = 7)] = "EightBitAdventure"), + (e[(e.Indestructable = 8)] = "Indestructable"), + (e[(e.Frontier = 9)] = "Frontier"), + (e[(e.Polymorph = 10)] = "Polymorph"), + (e[(e.Accelerated = 11)] = "Accelerated"), + (e[(e.CriticalHit = 12)] = "CriticalHit"), + (e[(e.SkyFracture = 13)] = "SkyFracture"), + (e[(e.Breathe = 14)] = "Breathe"), + (e[(e.Blythe = 15)] = "Blythe"), + (e[(e.Awake = 16)] = "Awake"), + (e[(e.Coincidence = 17)] = "Coincidence"), + (e[(e.Mutant = 18)] = "Mutant"), + (e[(e.Overdrive = 19)] = "Overdrive"), + (e[(e.Cloud9 = 20)] = "Cloud9"), + (e[(e.ForYou = 21)] = "ForYou"), + (e[(e.Aura = 22)] = "Aura"), + (e[(e.CoolFriends = 23)] = "CoolFriends"), + (e[(e.NacreousSnowmelt = 24)] = "NacreousSnowmelt")); + e[(e.FireAura = 25)] = "FireAura"; + e[(e.ChaozFantasy = 26)] = "ChaozFantasy"; + e[(e.Heaven = 27)] = "Heaven"; + e[(e.Phazd = 28)] = "Phazd"; + e[(e.Virtual = 29)] = "Virtual"; + e[(e.SolarAbyss = 30)] = "SolarAbyss"; + e[(e.Toe3 = 31)] = "Toe3"; + e[(e.Silverdust = 32)] = "Silverdust"; + e[(e.Truecolors = 33)] = "Truecolors"; + e[(e.Soulless2 = 34)] = "Soulless2"; + e[(e.PirateManners = 35)] = "PirateManners"; + e[(e.EightBitShuffle = 36)] = "EightBitShuffle"; + e[(e.FinalTheory = 37)] = "FinalTheory"; + e[(e.SuperUltra = 38)] = "SuperUltra"; + e[(e.Rummy = 39)] = "Rummy"; + e[(e.Daydreamer = 40)] = "Daydreamer"; + e[(e.OrientalSwing = 41)] = "OrientalSwing"; + e[(e.RedShift = 42)] = "RedShift"; + e[(e.RaceAroundTheWorld = 43)] = "RaceAroundTheWorld"; + e[(e.Machina = 44)] = "Machina"; + e[(e.Clutterfunk = 45)] = "Clutterfunk"; + e[(e.Soulless4 = 46)] = "Soulless4"; + e[(e.Zenith = 47)] = "Zenith"; + e[(e.Color = 48)] = "Color"; + e[(e.FunkyPunky = 49)] = "FunkyPunky"; + e[(e.OctaneExtended = 50)] = "OctaneExtended"; + e[(e.CriticalHitExtended = 51)] = "CriticalHitExtended"; + e[(e.MindsOfTheMad = 52)] = "MindsOfTheMad"; + e[(e.Electrodynamix = 53)] = "Electrodynamix"; + e[(e.SkyFractureExtended = 54)] = "SkyFractureExtended"; + e[(e.Plummet = 55)] = "Plummet"; + e[(e.SolarWind = 56)] = "SolarWind"; + e[(e.GlitchedOut = 57)] = "GlitchedOut"; + e[(e.LastTile = 58)] = "LastTile"; + // you know what? I'm not gonna put songs here. This variable (Rd) isn't even used anywhere. + })(Rd || (Rd = {})), + (function (e) { + ((e[(e.World1 = 0)] = "World1"), + (e[(e.World1Boss = 1)] = "World1Boss"), + (e[(e.World1Red = 2)] = "World1Red"), + (e[(e.World2 = 3)] = "World2"), + (e[(e.World2Red = 4)] = "World2Red"), + (e[(e.World3 = 5)] = "World3"), + (e[(e.Synthwave = 6)] = "Synthwave"), + (e[(e.World4 = 7)] = "World4"), + (e[(e.World4Red = 8)] = "World4Red"), + (e[(e.World4Boss = 9)] = "World4Boss"), + (e[(e.World3Red = 10)] = "World3Red"), + (e[(e.Skater = 11)] = "Skater"), + (e[(e.Arrows = 12)] = "Arrows"), + (e[(e.Dreamy = 13)] = "Dreamy"), + (e[(e.Speed = 14)] = "Speed"), + (e[(e.Fighter = 15)] = "Fighter")); + e[(e.Classic = 16)] = "Classic"; + e[(e.Infinite = 17)] = "Infinite"; + e[(e.Virtual = 18)] = "Virtual"; + })(Od || (Od = {})), + (function (e) { + ((e[(e.Gun = 0)] = "Gun"), + (e[(e.DoubleJump = 1)] = "DoubleJump"), + (e[(e.Jetpack = 2)] = "Jetpack"), + (e[(e.PlayerStack = 3)] = "PlayerStack"), + (e[(e.Skateboard = 4)] = "Skateboard"), + (e[(e.Punch = 5)] = "Punch")); + e[(e.Drill = 6)] = "Drill"; + e[(e.Ghost = 7)] = "Ghost"; + e[(e.Spaceship = 8)] = "Spaceship"; + })(Cd || (Cd = {})), + (function (e) { + ((e[(e.Movement = 0)] = "Movement"), + (e[(e.BlockSpike = 1)] = "BlockSpike")); + e[(e.Size = 2)] = "Size"; + e[(e.Color = 3)] = "Color"; + e[(e.Gravity = 4)] = "Gravity"; + e[(e.Falling = 5)] = "Falling"; + })(wd || (wd = {})), + (function (e) { + ((e[(e.Red = 0)] = "Red"), (e[(e.Yellow = 1)] = "Yellow")); + e[(e.Green = 2)] = "Green"; + e[(e.Cyan = 3)] = "Cyan"; + ((e[(e.Blue = 4)] = "Blue"), (e[(e.Violet = 5)] = "Violet")); + e[(e.Pink = 6)] = "Pink"; + e[(e.Black = 7)] = "Black"; + e[(e.White = 8)] = "White"; + e[(e.Flash = 9)] = "Flash"; + })(clrs2 || (clrs2 = {})), + (function (e) { + ((e[(e.Coin = 0)] = "Coin"), (e[(e.Arrows = 1)] = "Arrows")); + })(Ad || (Ad = {})), + (function (e) { + ((e[(e.Left = 0)] = "Left"), (e[(e.Right = 1)] = "Right")); + })(kd || (kd = {})), + (function (e) { + ((e[(e.Dragonfly = 0)] = "Dragonfly"), + (e[(e.Solace = 1)] = "Solace"), + (e[(e.Lighthouse = 2)] = "Lighthouse"), + (e[(e.Octane = 3)] = "Octane"), + (e[(e.Stardust = 4)] = "Stardust"), + (e[(e.ThinkDifferent = 5)] = "ThinkDifferent"), + (e[(e.DarkSheep = 6)] = "DarkSheep"), + (e[(e.EightBitAdventure = 7)] = "EightBitAdventure"), + (e[(e.Indestructable = 8)] = "Indestructable"), + (e[(e.Frontier = 9)] = "Frontier"), + (e[(e.Polymorph = 10)] = "Polymorph"), + (e[(e.Accelerated = 11)] = "Accelerated"), + (e[(e.CriticalHit = 12)] = "CriticalHit"), + (e[(e.SkyFracture = 13)] = "SkyFracture"), + (e[(e.Breathe = 14)] = "Breathe"), + (e[(e.Blythe = 15)] = "Blythe"), + (e[(e.Awake = 16)] = "Awake"), + (e[(e.Coincidence = 17)] = "Coincidence"), + (e[(e.Mutant = 18)] = "Mutant"), + (e[(e.Overdrive = 19)] = "Overdrive"), + (e[(e.Cloud9 = 20)] = "Cloud9"), + (e[(e.ForYou = 21)] = "ForYou"), + (e[(e.Aura = 22)] = "Aura"), + (e[(e.CoolFriends = 23)] = "CoolFriends"), + (e[(e.NacreousSnowmelt = 24)] = "NacreousSnowmelt")); + e[(e.FireAura = 25)] = "FireAura"; + e[(e.ChaozFantasy = 26)] = "ChaozFantasy"; + e[(e.Heaven = 27)] = "Heaven"; + e[(e.Phazd = 28)] = "Phazd"; + e[(e.Virtual = 29)] = "Virtual"; + e[(e.SolarAbyss = 30)] = "SolarAbyss"; + e[(e.Toe3 = 31)] = "Toe3"; + e[(e.Silverdust = 32)] = "Silverdust"; + e[(e.Truecolors = 33)] = "Truecolors"; + e[(e.Soulless2 = 34)] = "Souless2"; + e[(e.PirateManners = 35)] = "PirateManners"; + e[(e.EightBitShuffle = 36)] = "EightBitShuffle"; + e[(e.FinalTheory = 37)] = "FinalTheory"; + e[(e.SuperUltra = 38)] = "SuperUltra"; + e[(e.Rummy = 39)] = "Rummy"; + e[(e.Daydreamer = 40)] = "Daydreamer"; + e[(e.OrientalSwing = 41)] = "OrientalSwing"; + e[(e.RedShift = 42)] = "RedShift"; + e[(e.RaceAroundTheWorld = 43)] = "RaceAroundTheWorld"; + e[(e.Machina = 44)] = "Machina"; + e[(e.Clutterfunk = 45)] = "Clutterfunk"; + e[(e.Soulless4 = 46)] = "Soulless4"; + e[(e.Zenith = 47)] = "Zenith"; + e[(e.Color = 48)] = "Color"; + e[(e.FunkyPunky = 49)] = "FunkyPunky"; + e[(e.OctaneExtended = 50)] = "OctaneExtended"; + e[(e.CriticalHitExtended = 51)] = "CriticalHitExtended"; + e[(e.MindsOfTheMad = 52)] = "MindsOfTheMad"; + e[(e.Electrodynamix = 53)] = "Electrodynamix"; + e[(e.SkyFractureExtended = 54)] = "SkyFractureExtended"; + e[(e.Plummet = 55)] = "Plummet"; + e[(e.SolarWind = 56)] = "SolarWind"; + e[(e.GlitchedOut = 57)] = "GlitchedOut"; + e[(e.LastTile = 58)] = "LastTile"; + e[(e.Hellidox = 59)] = "Hellidox"; + e[(e.Jackpot = 60)] = "Jackpot"; + e[(e.Carnival = 61)] = "Carnival"; + e[(e.RobotLanguage = 62)] = "RobotLanguage"; + e[(e.DryOut = 63)] = "DryOut"; + e[(e.Carnivores = 64)] = "Carnivores"; + e[(e.Phobos = 65)] = "Phobos"; + e[(e.RockinThatBass = 66)] = "RockinThatBass"; + e[(e.MilkyWays = 67)] = "MilkyWays"; + })(Nd || (Nd = {})), + (function (e) { + ((e[(e.World1 = 0)] = "World1"), + (e[(e.World1Boss = 1)] = "World1Boss"), + (e[(e.World1Red = 2)] = "World1Red"), + (e[(e.World2 = 3)] = "World2"), + (e[(e.World2Red = 4)] = "World2Red"), + (e[(e.World3 = 5)] = "World3"), + (e[(e.Synthwave = 6)] = "Synthwave"), + (e[(e.World4 = 7)] = "World4"), + (e[(e.World4Red = 8)] = "World4Red"), + (e[(e.World4Boss = 9)] = "World4Boss"), + (e[(e.World3Red = 10)] = "World3Red"), + (e[(e.Skater = 11)] = "Skater"), + (e[(e.Arrows = 12)] = "Arrows"), + (e[(e.Dreamy = 13)] = "Dreamy"), + (e[(e.Speed = 14)] = "Speed"), + (e[(e.Fighter = 15)] = "Fighter")); + e[(e.Classic = 16)] = "Classic"; + e[(e.Infinite = 17)] = "Infinite"; + e[(e.Virtual = 18)] = "Virtual"; + })(xd || (xd = {}))); + const Bd = Gc([ + mc, + mc, + Bc([Gc(mc, fc, mc, mc), fc]), + Bc([ + nd.tuple([ + Bc([Gc([mc, fc]), Gc([mc])]), + Oc( + Bc([ + Gc([fc, fc, _c(1), _c(0), nd.enum5]), + Gc([fc, fc, _c(0), nd.enum5]), + Gc([fc, fc, _c(1)]), + Gc([fc, fc]), + ]), + ), + Oc( + Bc([ + Gc([ + fc, + fc, + nd.enum4, + nd.enum2, + nd.enum2, + nd.enum3, + nd.enum2, + nd.enum3, + ]), + Gc([fc, fc, nd.enum4, nd.enum2, nd.enum2, nd.enum3]), + Gc([fc, fc, nd.enum4, _c(0), _c(1)]), + Gc([fc, fc, nd.enum4, _c(1), _c(1)]), + Gc([fc, fc, nd.enum4, _c(1)]), + Gc([fc, fc, nd.enum4]), + ]), + ), + Oc( + Gc([ + fc, + fc, + nd.enum5, + Bc([ + _c(-2), + _c(-1), + _c(-0.5), + _c(0), + _c(0.5), + _c(1), + _c(2), + ]), + ]), + ), + Oc( + Bc([ + Gc([fc, fc, nd.enum2, nd.enum2, nd.enum2]), + Gc([fc, fc, nd.enum2, nd.enum2]), + Gc([fc, fc, nd.enum2]), + ]), + ), + Oc( + Bc([ + Gc([ + fc, + fc, + Bc([_c(-1), _c(0), _c(1), _c(2)]), + Bc([ + _c(-2), + _c(-1), + _c(-0.5), + _c(0), + _c(0.5), + _c(1), + _c(2), + ]), + nd.enum4, + nd.enum4, + ]), + Gc([ + fc, + fc, + Bc([_c(-1), _c(0), _c(1), _c(2)]), + Bc([ + _c(-2), + _c(-1), + _c(-0.5), + _c(0), + _c(0.5), + _c(1), + _c(2), + ]), + nd.enum4, + ]), + Gc([ + fc, + fc, + Bc([_c(-1), _c(0), _c(1), _c(2)]), + Bc([ + _c(-2), + _c(-1), + _c(-0.5), + _c(0), + _c(0.5), + _c(1), + _c(2), + ]), + ]), + ]), + ), + Oc( + Bc([ + Gc([fc, fc, nd.enum2, nd.enum2, nd.enum2, nd.enum2]), + Gc([fc, fc, nd.enum2, nd.enum2, nd.enum2]), + Gc([fc, fc, nd.enum2, nd.enum2]), + ]), + ), + Oc( + Bc([ + Gc([fc, fc, nd.enum9, nd.enum2, nd.enum2]), + Gc([fc, fc, nd.enum9, nd.enum2]), + Gc([fc, fc, nd.enum9]), + ]), + ), + Oc( + Bc([ + Gc([ + fc, + fc, + nd.enum6, + nd.enum2, + nd.enum3, + nd.enum2, + nd.enum2, + ]), + Gc([fc, fc, nd.enum6, nd.enum2, nd.enum2, nd.enum3]), + Gc([fc, fc, nd.enum6, nd.enum2, nd.enum2]), + Gc([fc, fc, nd.enum6, nd.enum2, nd.enum2]), + Gc([fc, fc, nd.enum6, nd.enum2]), + Gc([fc, fc, nd.enum6, nd.enum2]), + ]), + ), + Oc( + Bc([ + Gc([fc, fc, nd.enum6, nd.enum2, nd.enum2]), + Gc([fc, fc, nd.enum6, nd.enum10]), + Gc([fc, fc, nd.enum6]), + ]), + ), + Oc( + Bc([ + Gc([fc, fc, nd.enum2, nd.enum2, nd.enum4]), + Gc([fc, fc, nd.enum2, nd.enum2]), + ]), + ), + Oc(Gc([fc, fc, nd.enum2])), + Oc(Bc([Gc([fc, fc, nd.enum2]), Gc([fc, fc])])), + Oc(nd.tuple([fc, fc, nd.enum4, fc, nd.enum2])), + Oc(Gc([fc, fc, nd.enum2])), + Oc(Gc([fc, fc, nd.enum2, nd.enum3])), + ]), + nd.tuple([ + Bc([Gc([mc, fc]), Gc([mc])]), + Oc( + Bc([ + Gc([fc, fc, _c(1), _c(0), nd.enum5]), + Gc([fc, fc, _c(0), nd.enum5]), + Gc([fc, fc, _c(1)]), + Gc([fc, fc]), + ]), + ), + Oc( + Bc([ + Gc([ + fc, + fc, + nd.enum4, + nd.enum2, + nd.enum2, + nd.enum2, + nd.enum2, + nd.enum3, + ]), + Gc([fc, fc, nd.enum4, nd.enum2, nd.enum2, _c(1)]), + Gc([fc, fc, nd.enum4, _c(0), _c(1)]), + Gc([fc, fc, nd.enum4, _c(1), _c(1)]), + Gc([fc, fc, nd.enum4, _c(1)]), + Gc([fc, fc, nd.enum4]), + ]), + ), + Oc( + Gc([ + fc, + fc, + nd.enum5, + Bc([ + _c(-2), + _c(-1), + _c(-0.5), + _c(0), + _c(0.5), + _c(1), + _c(2), + ]), + ]), + ), + Oc( + Bc([ + Gc([fc, fc, nd.enum2, nd.enum2, nd.enum2]), + Gc([fc, fc, nd.enum2, nd.enum2]), + Gc([fc, fc, nd.enum2]), + ]), + ), + Oc( + Bc([ + Gc([ + fc, + fc, + Bc([_c(-1), _c(0), _c(1), _c(2)]), + Bc([ + _c(-2), + _c(-1), + _c(-0.5), + _c(0), + _c(0.5), + _c(1), + _c(2), + ]), + nd.enum4, + nd.enum4, + ]), + Gc([ + fc, + fc, + Bc([_c(-1), _c(0), _c(1), _c(2)]), + Bc([ + _c(-2), + _c(-1), + _c(-0.5), + _c(0), + _c(0.5), + _c(1), + _c(2), + ]), + nd.enum4, + ]), + Gc([ + fc, + fc, + Bc([_c(-1), _c(0), _c(1), _c(2)]), + Bc([ + _c(-2), + _c(-1), + _c(-0.5), + _c(0), + _c(0.5), + _c(1), + _c(2), + ]), + ]), + ]), + ), + Oc( + Bc([ + Gc([fc, fc, nd.enum2, nd.enum2, nd.enum2, nd.enum2]), + Gc([fc, fc, nd.enum2, nd.enum2, nd.enum2]), + Gc([fc, fc, nd.enum2, nd.enum2]), + ]), + ), + Oc( + Bc([ + Gc([fc, fc, nd.enum9, nd.enum2, nd.enum2]), + Gc([fc, fc, nd.enum9, nd.enum2]), + Gc([fc, fc, nd.enum9]), + ]), + ), + Oc( + Bc([ + Gc([ + fc, + fc, + nd.enum6, + nd.enum2, + nd.enum3, + nd.enum2, + nd.enum2, + ]), + Gc([fc, fc, nd.enum6, nd.enum2, nd.enum2, nd.enum3]), + Gc([fc, fc, nd.enum6, nd.enum2, nd.enum2]), + Gc([fc, fc, nd.enum6, nd.enum2, nd.enum2]), + Gc([fc, fc, nd.enum6, nd.enum2]), + Gc([fc, fc, nd.enum6, nd.enum2]), + ]), + ), + Oc( + Bc([ + Gc([fc, fc, nd.enum6, nd.enum2, nd.enum2]), + Gc([fc, fc, nd.enum6, nd.enum10]), + Gc([fc, fc, nd.enum6]), + ]), + ), + Oc( + Bc([ + Gc([fc, fc, nd.enum2, nd.enum2, nd.enum4]), + Gc([fc, fc, nd.enum2, nd.enum2]), + ]), + ), + Oc(Gc([fc, fc, nd.enum2])), + Oc(Bc([Gc([fc, fc, nd.enum2]), Gc([fc, fc])])), + Oc(nd.tuple([fc, fc, nd.enum4, fc, nd.enum2])), + Oc(Gc([fc, fc, nd.enum2])), + ]), + ]), + + fc, + ]), + Fd = Ld({ + mappers: [ + () => [], + (e) => + e.map((e) => { + const [t, a, i, n] = e; + return [t, a, i, [...n, []]]; }), - n = a.length; - return new Cc( - t, - function (e) { - if (bc.is(e)) { - for (var t = 0; t < n; t++) { - var s = a[t], - o = e[s]; - if ((void 0 === o && !vc.call(e, s)) || !i[t].is(o)) - return false; - } - return true; - } - return false; - }, - function (e, t) { - var s = bc.validate(e, t); - if (tc(s)) return s; - for (var o = s.right, r = o, l = [], c = 0; c < n; c++) { - var d = a[c], - u = r[d], - h = i[c], - p = h.validate(u, rc(t, d, h, u)); - if (tc(p)) uc(l, p.left); - else { - var g = p.right; - (g !== u || (void 0 === g && !vc.call(r, d))) && - (r === o && (r = nc({}, o)), (r[d] = g)); - } - } - return l.length > 0 ? lc(l) : dc(r); - }, - wc(i) - ? oc - : function (e) { - for (var t = nc({}, e), s = 0; s < n; s++) { - var o = a[s], - r = i[s].encode; - r !== oc && (t[o] = r(e[o])); - } - return t; - }, - e, - ); - }, - Nc = (function (e) { - function t(t, a, i, n, s) { - var o = e.call(this, t, a, i, n) || this; - return ((o.props = s), (o._tag = "PartialType"), o); - } - return (ic(t, e), t); - })(sc), - xc = function (e, t) { - void 0 === t && (t = "Partial<" + Ac(e) + ">"); - var a = Object.keys(e), - i = a.map(function (t) { - return e[t]; + (e) => + e.map((e) => { + const [t, a, i, n] = e; + return [t, a, i, [...n, [], []]]; }), - n = a.length; - return new Nc( - t, - function (t) { - if (bc.is(t)) { - for (var i = 0; i < n; i++) { - var s = a[i], - o = t[s]; - if (void 0 !== o && !e[s].is(o)) return false; - } - return true; - } - return false; - }, - function (t, i) { - var s = bc.validate(t, i); - if (tc(s)) return s; - for (var o = s.right, r = o, l = [], c = 0; c < n; c++) { - var d = a[c], - u = r[d], - h = e[d], - p = h.validate(u, rc(i, d, h, u)); - if (tc(p)) void 0 !== u && uc(l, p.left); - else { - var g = p.right; - g !== u && (r === o && (r = nc({}, o)), (r[d] = g)); - } - } - return l.length > 0 ? lc(l) : dc(r); - }, - wc(i) - ? oc - : function (e) { - for (var t = nc({}, e), s = 0; s < n; s++) { - var o = a[s], - r = e[o]; - void 0 !== r && (t[o] = i[s].encode(r)); - } - return t; - }, - e, - ); - }, - Pc = (function (e) { - function t(t, a, i, n, s, o) { - var r = e.call(this, t, a, i, n) || this; - return ( - (r.domain = s), - (r.codomain = o), - (r._tag = "DictionaryType"), - r - ); - } - return (ic(t, e), t); - })(sc); - function Mc(e) { - var t; - if ($c(e)) { - var a = e.value; - if (mc.is(a)) return (((t = {})[a] = null), t); - } else { - if ("KeyofType" === e._tag) return e.keys; - if (Jc(e)) { - var i = e.types.map(function (e) { - return Mc(e); - }); - return i.some(pc.is) - ? void 0 - : Object.assign.apply( - Object, - (function () { - for (var e = 0, t = 0, a = arguments.length; t < a; t++) - e += arguments[t].length; - var i = Array(e), - n = 0; - for (t = 0; t < a; t++) - for ( - var s = arguments[t], o = 0, r = s.length; - o < r; - o++, n++ - ) - i[n] = s[o]; - return i; - })([{}], i), - ); - } - } - } - function Lc(e, t, a) { - var i = Mc(e); - return i - ? (function (e, t, a, i) { - void 0 === i && - (i = "{ [K in " + t.name + "]: " + a.name + " }"); - var n = e.length; - return new Pc( - i, - function (t) { - return ( - bc.is(t) && - e.every(function (e) { - return a.is(t[e]); - }) - ); - }, - function (t, i) { - var s = bc.validate(t, i); - if (tc(s)) return s; - for ( - var o = s.right, r = {}, l = [], c = false, d = 0; - d < n; - d++ - ) { - var u = e[d], - h = o[u], - p = a.validate(h, rc(i, u, a, h)); - if (tc(p)) uc(l, p.left); - else { - var g = p.right; - ((c = c || g !== h), (r[u] = g)); - } - } - return l.length > 0 - ? lc(l) - : dc(c || Object.keys(o).length !== n ? r : o); - }, - a.encode === oc - ? oc - : function (t) { - for (var i = {}, s = 0; s < n; s++) { - var o = e[s]; - i[o] = a.encode(t[o]); - } - return i; - }, + (e) => e.map((e) => [...e, 0]), + (e) => + e.map((e) => { + const [t, a, i, n, s] = e, + [[o], r, l, c, d, u, h, p, g, m, f, y, E, b] = n; + return [ t, a, - ); - })(Object.keys(i), e, t, a) - : (function (e, t, a) { - return ( - void 0 === a && - (a = "{ [K in " + e.name + "]: " + t.name + " }"), - new Pc( - a, - function (a) { - return bc.is(a) - ? Object.keys(a).every(function (i) { - return e.is(i) && t.is(a[i]); - }) - : qc(t) && Array.isArray(a); - }, - function (a, i) { - if (bc.is(a)) { - for ( - var n = {}, - s = [], - o = Object.keys(a), - r = o.length, - l = false, - c = 0; - c < r; - c++ - ) { - var d = o[c], - u = a[d], - h = e.validate(d, rc(i, d, e, d)); - if (tc(h)) uc(s, h.left); - else { - var p = h.right; - ((l = l || p !== d), (d = p)); - var g = t.validate(u, rc(i, d, t, u)); - if (tc(g)) uc(s, g.left); - else { - var m = g.right; - ((l = l || m !== u), (n[d] = m)); - } - } - } - return s.length > 0 ? lc(s) : dc(l ? n : a); - } - return qc(t) && Array.isArray(a) ? dc(a) : cc(a, i); - }, - e.encode === oc && t.encode === oc - ? oc - : function (a) { - for ( - var i = {}, n = Object.keys(a), s = n.length, o = 0; - o < s; - o++ - ) { - var r = n[o]; - i[String(e.encode(r))] = t.encode(a[r]); - } - return i; - }, - e, - t, - ) - ); - })(e, t, a); - } - var Dc = (function (e) { - function t(t, a, i, n, s) { - var o = e.call(this, t, a, i, n) || this; - return ((o.types = s), (o._tag = "UnionType"), o); - } - return (ic(t, e), t); - })(sc), - Bc = function (e, t) { - void 0 === t && - (t = (function (e) { - return ( - "(" + - e - .map(function (e) { - return e.name; - }) - .join(" | ") + - ")" - ); - })(e)); - var a = (function (e) { - for ( - var t = Qc(e[0]), - a = Object.keys(t), - i = e.length, - n = function (a) { - for (var n = t[a].slice(), s = [t[a]], o = 1; o < i; o++) { - var r = Qc(e[o])[a]; - if (void 0 === r) return "continue-keys"; - if ( - r.some(function (e) { - return -1 !== n.indexOf(e); - }) - ) - return "continue-keys"; - (n.push.apply(n, r), s.push(r)); - } - return { value: [a, s] }; - }, - s = 0, - o = a; - s < o.length; - s++ - ) { - var r = n(o[s]); - if ("object" == typeof r) return r.value; - } - })(e); - if (void 0 !== a && e.length > 0) { - var i = a[0], - n = a[1], - s = n.length, - o = function (e) { - for (var t = 0; t < s; t++) - if (-1 !== n[t].indexOf(e)) return t; - }; - return new Vc( - t, - function (t) { - if (bc.is(t)) { - var a = o(t[i]); - return void 0 !== a && e[a].is(t); - } - return false; - }, - function (t, a) { - var n = bc.validate(t, a); - if (tc(n)) return n; - var s = n.right, - r = o(s[i]); - if (void 0 === r) return cc(t, a); - var l = e[r]; - return l.validate(s, rc(a, String(r), l, s)); - }, - wc(e) - ? oc - : function (a) { - var n = o(a[i]); - if (void 0 === n) - throw new Error( - "no codec found to encode value in union codec " + t, - ); - return e[n].encode(a); - }, - e, - i, - ); - } - return new Dc( - t, - function (t) { - return e.some(function (e) { - return e.is(t); - }); - }, - function (t, a) { - for (var i = [], n = 0; n < e.length; n++) { - var s = e[n], - o = s.validate(t, rc(a, String(n), s, t)); - if (!tc(o)) return dc(o.right); - uc(i, o.left); - } - return lc(i); - }, - wc(e) - ? oc - : function (a) { - for (var i = 0, n = e; i < n.length; i++) { - var s = n[i]; - if (s.is(a)) return s.encode(a); - } - throw new Error( - "no codec found to encode value in union type " + t, - ); + i, + [ + [o], + r, + l, + c, + d, + u, + h, + p, + g.map((e) => + 3 === e.length + ? [...e, sd.False] + : [e[0], e[1], e[2], sd.False, e[3]], + ), + m.map(([e, t]) => [e, t, wd.Movement]), + f, + y.map((e) => [...e, Ad.Coin]), + E, + b, + [], + ], + s, + ]; + }), + (e) => e, + (e) => e, + ], + finalSchema: Oc(Bd), + uncompress: (e) => + e.map((e) => { + const [t, a, i, n, s] = e, + [ + [o, useGround], + r, + l, + c, + d, + u, + h, + p, + g, + m, + f, + y, + E, + b, + S, + switchBlocks, + ] = n, + I = + Vd[i] || { + fileName: i.fileName, + bpm: i.bpm, + name: i.name, + author: i.author, + } || + hl.songs.dragonfly, + _ = G.getJumpFrames(I.bpm), + v = jd(o, r.length + c.length + f.length), + T = { + properties: { + minY: { minYsByXDiv1000: [], minX: 0, minY: 0 }, + theme: ca[Gd[v] || "world1"], + useGround: !!useGround, }, - e, - ); - }, - Fc = (function (e) { - function t(t, a, i, n, s) { - var o = e.call(this, t, a, i, n) || this; - return ((o.types = s), (o._tag = "IntersectionType"), o); - } - return (ic(t, e), t); - })(sc), - Yc = function (e, t) { - for ( - var a = true, i = true, n = !bc.is(e), s = 0, o = t; - s < o.length; - s++ - ) - ((d = o[s]) !== e && (a = false), bc.is(d) && (i = false)); - if (a) return e; - if (i) return t[t.length - 1]; - for (var r = {}, l = 0, c = t; l < c.length; l++) { - var d = c[l]; - for (var u in d) - (r.hasOwnProperty(u) && !n && d[u] === e[u]) || (r[u] = d[u]); - } - return r; - }; - function Uc(e, t) { - void 0 === t && - (t = - "(" + - e - .map(function (e) { - return e.name; - }) - .join(" & ") + - ")"); - var a = e.length; - return new Fc( - t, - function (t) { - return e.every(function (e) { - return e.is(t); - }); - }, - 0 === e.length - ? dc - : function (t, i) { - for (var n = [], s = [], o = 0; o < a; o++) { - var r = e[o], - l = r.validate(t, rc(i, String(o), r, t)); - tc(l) ? uc(s, l.left) : n.push(l.right); - } - return s.length > 0 ? lc(s) : dc(Yc(t, n)); - }, - 0 === e.length - ? oc - : function (t) { - return Yc( - t, - e.map(function (e) { - return e.encode(t); + blocks: r + .map(([e, t, a, g, s]) => { + return a + ? $.newMiniBlock({ + x: e, + y: t, + steel: s == 1 ? true : false, + isVoid: s == 2 ? true : false, + isBoss: s == 3 ? true : false, + isFade: s == 4 ? true : false, + }) + : $.newBlock({ + x: e, + y: t, + steel: g == 1 ? true : false, + isVoid: g == 2 ? true : false, + isBoss: g == 3 ? true : false, + isFade: g == 4 ? true : false, + }); + }) + .concat( + switchBlocks + ? switchBlocks.map(([x, Y, ini, tr]) => { + return $.newSwitchBlock({ + x: x, + y: Y, + init: ini == 0 ? "blue" : "red", + trigger: zd[tr], + }); + }) + : [], + ), + spikes: l.map(([e, t, a, i, n, laser, ini, tr]) => + ini === undefined + ? n + ? $.newMiniSpike({ + x: e, + y: t, + rotation: Hd[a], + skipMissiles: 1 === i, + isLaser: 1 === laser, + isFade: 2 === laser, + }) + : $.newSpike({ + x: e, + y: t, + rotation: Hd[a], + skipMissiles: 1 === i, + isLaser: 1 === laser, + isFade: 2 === laser, + }) + : $.newSwitchSpike({ + x: e, + y: t, + rotation: Hd[a], + skipMissiles: 1 === i, + isLaser: false, + isFade: false, + init: ini == 0 ? "blue" : "red", + trigger: zd[tr], + }), + ), + platforms: c.map(([e, t, a, i]) => + $.newPlatform({ + x: e, + y: t, + movement: Xd[a], + movementTrigger: zd[i], + multiplier: i, }), - ); - }, - e, - ); - } - var jc = (function (e) { - function t(t, a, i, n, s) { - var o = e.call(this, t, a, i, n) || this; - return ((o.types = s), (o._tag = "TupleType"), o); - } - return (ic(t, e), t); - })(sc); - function Gc(e, t) { - void 0 === t && - (t = - "[" + - e - .map(function (e) { - return e.name; - }) - .join(", ") + - "]"); - var a = e.length; - return new jc( - t, - function (t) { - return ( - Ec.is(t) && - t.length === a && - e.every(function (e, a) { - return e.is(t[a]); - }) - ); - }, - function (t, i) { - var n = Ec.validate(t, i); - if (tc(n)) return n; - for ( - var s = n.right, - o = s.length > a ? s.slice(0, a) : s, - r = [], - l = 0; - l < a; - l++ - ) { - var c = s[l], - d = e[l], - u = d.validate(c, rc(i, String(l), d, c)); - if (tc(u)) uc(r, u.left); - else { - var h = u.right; - h !== c && (o === s && (o = s.slice()), (o[l] = h)); - } - } - return r.length > 0 ? lc(r) : dc(o); - }, - wc(e) - ? oc - : function (t) { - return e.map(function (e, a) { - return e.encode(t[a]); - }); - }, - e, - ); - } - ((function (e) { - ic(function (t, a, i, n, s) { - var o = e.call(this, t, a, i, n) || this; - return ((o.type = s), (o._tag = "ReadonlyType"), o); - }, e); - })(sc), - (function (e) { - ic(function (t, a, i, n, s) { - var o = e.call(this, t, a, i, n) || this; - return ((o.type = s), (o._tag = "ReadonlyArrayType"), o); - }, e); - })(sc)); - var Vc = (function (e) { - function t(t, a, i, n, s, o) { - var r = e.call(this, t, a, i, n, s) || this; - return ((r.tag = o), r); - } - return (ic(t, e), t); - })(Dc), - Hc = - ((function (e) { - ic(function (t, a, i, n, s) { - var o = e.call(this, t, a, i, n) || this; - return ((o.type = s), (o._tag = "ExactType"), o); - }, e); - })(sc), - new ((function (e) { - function t() { - var t = - e.call( - this, - "never", - function (e) { - return false; - }, - function (e, t) { - return cc(e, t); - }, - function () { - throw new Error("cannot encode never"); - }, - ) || this; - return ((t._tag = "NeverType"), t); - } - return (ic(t, e), t); - })(sc))(), - new ((function (e) { - function t() { - var t = - e.call( - this, - "any", - function (e) { - return true; + ), + directionChanges: d.map(([e, t, a, b, n]) => + $.newDirectionChange({ + x: e, + y: t, + direction: Wd[a], + multiUse: b === undefined ? false : multUse[b || 0], + fixSync: 1 == n, + }), + ), + saws: u.map(([e, t, a, i, n, o]) => + $.newSaw({ + x: e, + y: t, + movement: $d[a], + movementTrigger: Jd[i], + multiplier: i, + shape: + n == 3 + ? "bar" + : n == 2 + ? "large" + : n == 1 + ? "small" + : "rail", + offset: (o || 0) * 30, + }), + ), + flags: h.map(([e, t, a, i, b, o]) => + $.newFlag({ + x: e, + y: t, + role: Kd[a], + switchesOn: ou[i], + retainSpeed: ou[b] || false, + isFlying: ou[o] || false, + }), + ), + powerups: p.map(([e, t, a, n, i]) => + $.newPowerup({ + x: e, + y: t, + item: Qd[a], + compatible: n != 1, + override: i != 1, + }), + ), + //****** + enemies: g.map( + ([ + e, + t, + a, // kind + i, // giant + o, // skipMissiles + n, // enemyDir + s, + ]) => { + return $.newEnemy({ + x: e, + y: t, + kind: Zd[a], + giant: ou[i], + skipMissiles: 1 === o, + enemyDir: n || -1, + isCompatible: s != 1, + }); }, - dc, - oc, - ) || this; - return ((t._tag = "AnyType"), t); - } - return (ic(t, e), t); - })(sc))()); - function Xc(e, t, a) { - return ( - void 0 === a && - (a = - "(" + - e.name + - " | " + - (((i = t).displayName || - i.name || - "") + - ")")), - new Sc( - a, - function (a) { - return e.is(a) && t(a); - }, - function (a, i) { - var n = e.validate(a, i); - if (tc(n)) return n; - var s = n.right; - return t(s) ? dc(s) : cc(s, i); - }, - e.encode, - e, - t, - ) - ); - var i; - } - (new ((function (e) { - function t() { - var t = - e.call( - this, - "object", - function (e) { - return null !== e && "object" == typeof e; - }, - function (e, a) { - return t.is(e) ? dc(e) : cc(e, a); - }, - oc, - ) || this; - return ((t._tag = "ObjectType"), t); - } - return (ic(t, e), t); - })(sc))(), - Xc(fc, Number.isInteger, "Integer"), - (function (e) { - ic(function (t, a, i, n, s) { - var o = e.call(this, t, a, i, n) || this; - return ((o.props = s), (o._tag = "StrictType"), o); - }, e); - })(sc)); - var zc = {}; - function Wc(e, t) { - for (var a = [], i = 0, n = e; i < n.length; i++) { - var s = n[i]; - -1 !== t.indexOf(s) && a.push(s); - } - return a; - } - function qc(e) { - return "AnyType" === e._tag; - } - function $c(e) { - return "LiteralType" === e._tag; - } - function Jc(e) { - return "UnionType" === e._tag; - } - var Kc = []; - function Qc(e) { - if (-1 !== Kc.indexOf(e)) return zc; - if ( - (function (e) { - return "InterfaceType" === e._tag; - })(e) || - (function (e) { - return "StrictType" === e._tag; - })(e) - ) { - var t = zc; - for (var a in e.props) { - var i = e.props[a]; - $c(i) && (t === zc && (t = {}), (t[a] = [i.value])); - } - return t; - } - if ( - (function (e) { - return "ExactType" === e._tag; - })(e) || - (function (e) { - return "RefinementType" === e._tag; - })(e) - ) - return Qc(e.type); - if ( - (function (e) { - return "IntersectionType" === e._tag; - })(e) - ) - return e.types.reduce(function (e, t) { - return (function (e, t) { - if (e === zc) return t; - if (t === zc) return e; - var a = Object.assign({}, e); - for (var i in t) - if (e.hasOwnProperty(i)) { - var n = Wc(e[i], t[i]); - if (!(n.length > 0)) { - a = zc; - break; - } - a[i] = n; - } else a[i] = t[i]; - return a; - })(e, Qc(t)); - }, zc); - if (Jc(e)) - return e.types.slice(1).reduce(function (e, t) { - return (function (e, t) { - if (e === zc || t === zc) return zc; - var a = zc; - for (var i in e) - t.hasOwnProperty(i) && - 0 === Wc(e[i], t[i]).length && - (a === zc && (a = {}), (a[i] = e[i].concat(t[i]))); - return a; - })(e, Qc(t)); - }, Qc(e.types[0])); - if ( - (function (e) { - return "RecursiveType" === e._tag; - })(e) - ) { - Kc.push(e); - var n = Qc(e.type); - return (Kc.pop(), n); - } - return zc; - } - const Zc = Gc, - ed = Bc([_c(0), _c(1)]), - td = Bc([ed, _c(2)]), - ad = Bc([td, _c(3)]), - id = Bc([ad, _c(4)]), - e6 = Bc([id, _c(5)]), - nd = { - tuple: Zc, - enum2: ed, - enum3: td, - enum4: ad, - enum5: id, - enum6: Bc([id, _c(5)]), - enum7: Bc([_c(0), _c(1), _c(2), _c(3), _c(4), _c(5), _c(6)]), - enum8: Bc([_c(0), _c(1), _c(2), _c(3), _c(4), _c(5), _c(6), _c(7)]), - enum9: Bc([ - _c(0), - _c(1), - _c(2), - _c(3), - _c(4), - _c(5), - _c(6), - _c(7), - _c(8), - ]), - enum10: Bc([ - _c(0), - _c(1), - _c(2), - _c(3), - _c(4), - _c(5), - _c(6), - _c(7), - _c(8), - _c(9), - ]), - }; - var sd, - od, - rd, - ld, - cd, - dd, - ud, - usage, - hd, - pd, - gd, - md, - fd, - yd, - Ed, - bd, - Sd, - Id, - _d, - vd, - Td, - Rd, - Od, - Cd, - wd, - clrs2, - Ad, - kd, - Nd, - xd, - Pd = function ( - e, - t, - a, - i, - n, - s, - o, - r, - l, - c, - d, - u, - h, - p, - g, - m, - f, - y, - E, - b, - ) { - switch (arguments.length) { - case 1: - return e; - case 2: - return t(e); - case 3: - return a(t(e)); - case 4: - return i(a(t(e))); - case 5: - return n(i(a(t(e)))); - case 6: - return s(n(i(a(t(e))))); - case 7: - return o(s(n(i(a(t(e)))))); - case 8: - return r(o(s(n(i(a(t(e))))))); - case 9: - return l(r(o(s(n(i(a(t(e)))))))); - case 10: - return c(l(r(o(s(n(i(a(t(e))))))))); - case 11: - return d(c(l(r(o(s(n(i(a(t(e)))))))))); - case 12: - return u(d(c(l(r(o(s(n(i(a(t(e))))))))))); - case 13: - return h(u(d(c(l(r(o(s(n(i(a(t(e)))))))))))); - case 14: - return p(h(u(d(c(l(r(o(s(n(i(a(t(e))))))))))))); - case 15: - return g(p(h(u(d(c(l(r(o(s(n(i(a(t(e)))))))))))))); - case 16: - return m(g(p(h(u(d(c(l(r(o(s(n(i(a(t(e))))))))))))))); - case 17: - return f(m(g(p(h(u(d(c(l(r(o(s(n(i(a(t(e)))))))))))))))); - case 18: - return y(f(m(g(p(h(u(d(c(l(r(o(s(n(i(a(t(e))))))))))))))))); - case 19: - return E(y(f(m(g(p(h(u(d(c(l(r(o(s(n(i(a(t(e)))))))))))))))))); - case 20: - return b( - E(y(f(m(g(p(h(u(d(c(l(r(o(s(n(i(a(t(e)))))))))))))))))), + ), + switchButtons: m.map( + (j) => { + const [e, t, a, n, i] = j; + return $.newSwitchButton({ + x: e, + y: t, + affects: eu[a], + color: clrs[n] || 0, + gravity: n > 2 ? 2 : n > 1 ? 0 : n > 0 ? -1 : 1, + up: !!n, + down: !!i, + }); + }, //color: clrs[n] })) + ), + switchPlatforms: f.map(([e, t, a, i, n]) => + $.newSwitchPlatform({ + x: e, + y: t, + initPosition: au[a], + movementTrigger: iu[i], + direction: Hd[n] || 0, + }), + ), + collectibles: y.map(([e, t, a]) => + $.newCollectible({ x: e, y: t, form: su[a] }), + ), + springs: E.map(([e, t, a]) => + $.newSpring({ x: e, y: t, direction: a ? -1 : 1 }), + ), + portals: b.map(([e, t, a, i, n]) => + $.newPortal({ + x: e, + y: t, + direction: qd[a], + pairId: i, + pair: nu[n], + }), + ), + speedChanges: S.map(([e, t, a]) => + $.newSpeedChange({ x: e, y: t, direction: tu[a] }), + ), + }; + return { + id: t, + name: a, + song: I, + coefficients: G.getCoefficients(_), + layout: Ca.updateMinY(T), + boss: null, + songStartSecs: s, + }; + }), + compress: (e) => + e.map((e) => { + const { + id: t, + name: a, + layout: i, + song: n, + songStartSecs: s, + } = e, + theme = Ud( + ru(i.properties.theme.id, Gd), + i.blocks.filter((b) => { + return !b.init; + }).length + + i.platforms.length + + i.switchPlatforms.length, ); - } - }; - function Md(e, t) { - return Pd( - t.decode(e), - ac( - (a) => ( - console.error("Decode error schema", t.name), - console.error( - "Decode error keys", - a - .map((e) => e.context.map((e) => e.key).join(",")) - .join(" --- "), - ), - console.error( - `Couldn't decode JSON ${ - void 0 === e ? String(e) : JSON.stringify(e).slice(0, 10) - }`, - ) - ) /*, - new Error( - `Couldn't decode JSON ${ - void 0 === e ? String(e) : JSON.stringify(e).slice(0, 10) - }` - )*/, - ), - ); - } - function Ld({ - mappers: e, - finalSchema: t, - uncompress: a, - compress: i, - }) { - return { - getDefaultData: function () { - return a(e.reduce((e, t) => t(e), void 0)); - }, - jsonToData: function (i) { - if ( - Array.isArray(i) && - 3 === i.length && - "number" == typeof i[0] && - "number" == typeof i[1] - ) { - let [n, s, o] = i, - r = false; - try { - for (; n < e.length; ) ((o = e[n](o)), n++, (r = true)); - } catch (e) { - return Error("Unable to map data to latest version"); - } - const l = Md(o, t); - return l instanceof Error - ? l - : { data: a(l), didUpdate: r, dateUpdated: s }; - } - return Error("Couldn't read version"); - }, - dataToJson: function (t, a) { - return [e.length, Dd(a), i(t)]; - }, - }; - } - function Dd(e) { - return Math.round((e().getTime() - 16094592e5) / 6e4); - } - (!(function (e) { - ((e[(e.True = 0)] = "True"), (e[(e.False = 1)] = "False")); - })(sd || (sd = {})), - (function (e) { - ((e[(e.Dragonfly = 0)] = "Dragonfly"), - (e[(e.Solace = 1)] = "Solace"), - (e[(e.Lighthouse = 2)] = "Lighthouse"), - (e[(e.Octane = 3)] = "Octane"), - (e[(e.Stardust = 4)] = "Stardust"), - (e[(e.ThinkDifferent = 5)] = "ThinkDifferent"), - (e[(e.DarkSheep = 6)] = "DarkSheep"), - (e[(e.EightBitAdventure = 7)] = "EightBitAdventure"), - (e[(e.Indestructable = 8)] = "Indestructable"), - (e[(e.Frontier = 9)] = "Frontier"), - (e[(e.Polymorph = 10)] = "Polymorph"), - (e[(e.Accelerated = 11)] = "Accelerated"), - (e[(e.CriticalHit = 12)] = "CriticalHit"), - (e[(e.SkyFracture = 13)] = "SkyFracture"), - (e[(e.Breathe = 14)] = "Breathe"), - (e[(e.Blythe = 15)] = "Blythe"), - (e[(e.Awake = 16)] = "Awake"), - (e[(e.Coincidence = 17)] = "Coincidence"), - (e[(e.Mutant = 18)] = "Mutant"), - (e[(e.Overdrive = 19)] = "Overdrive"), - (e[(e.Cloud9 = 20)] = "Cloud9")); - })(od || (od = {})), - (function (e) { - ((e[(e.World1 = 0)] = "World1"), - (e[(e.World1Boss = 1)] = "World1Boss"), - (e[(e.World1Red = 2)] = "World1Red"), - (e[(e.World2 = 3)] = "World2"), - (e[(e.World2Red = 4)] = "World2Red"), - (e[(e.World3 = 5)] = "World3"), - (e[(e.Synthwave = 6)] = "Synthwave"), - (e[(e.World4 = 7)] = "World4"), - (e[(e.World4Red = 8)] = "World4Red"), - (e[(e.World4Boss = 9)] = "World4Boss"), - (e[(e.World3Red = 10)] = "World3Red"), - (e[(e.Skater = 11)] = "Skater")); - })(rd || (rd = {})), - (function (e) { - ((e[(e.Rot0 = 0)] = "Rot0"), - (e[(e.Rot90 = 1)] = "Rot90"), - (e[(e.Rot180 = 2)] = "Rot180"), - (e[(e.Rot270 = 3)] = "Rot270")); - })(ld || (ld = {})), - (function (e) { - ((e[(e.Static = 0)] = "Static"), - (e[(e.UpDown = 1)] = "UpDown"), - (e[(e.DownUp = 2)] = "DownUp"), - (e[(e.Falling = 3)] = "Falling"), - (e[(e.Rail = 4)] = "Rail")); - })(cd || (cd = {})), - (function (e) { - ((e[(e.Beat = 0)] = "Beat"), - (e[(e.Jump = 1)] = "Jump"), - (e[(e.Switch = 2)] = "Switch")); - })(dd || (dd = {})), - (function (e) { - ((e[(e.Left = 0)] = "Left"), (e[(e.Right = 1)] = "Right")); - })(ud || (ud = {})), - (function (e) { - ((e[(e.SingleUse = 0)] = "SingleUse"), - (e[(e.MultiUse = 1)] = "MultiUse")); - })(usage || (usage = {})), - (function (e) { - ((e[(e.Static = -1)] = "Static"), - (e[(e.UpDown = 0)] = "UpDown"), - (e[(e.DownUp = 1)] = "DownUp"), - (e[(e.Falling = 2)] = "Falling")); - })(hd || (hd = {})), - (function (e) { - ((e[(e.Beat = 0)] = "Beat"), - (e[(e.Jump = 1)] = "Jump"), - (e[(e.Switch = 2)] = "Switch")); - })(pd || (pd = {})), - (function (e) { - ((e[(e.Checkpoint = 0)] = "Checkpoint"), - (e[(e.EndOfLevel = 1)] = "EndOfLevel")); - })(gd || (gd = {})), - (function (e) { - ((e[(e.Gun = 0)] = "Gun"), - (e[(e.DoubleJump = 1)] = "DoubleJump"), - (e[(e.Jetpack = 2)] = "Jetpack"), - (e[(e.PlayerStack = 3)] = "PlayerStack"), - (e[(e.Skateboard = 4)] = "Skateboard")); - })(md || (md = {})), - (function (e) { - ((e[(e.Shooter = 0)] = "Shooter"), - (e[(e.Walker = 1)] = "Walker"), - (e[(e.WalkerHelmet = 2)] = "WalkerHelmet")); - e[(e.Bomb = 3)] = "Bomb"; - e[(e.Minion = 4)] = "Minion"; - e[(e.Fireball = 5)] = "Fireball"; - })(fd || (fd = {})), - (function (e) { - ((e[(e.Up = 0)] = "Up"), (e[(e.Right = 1)] = "Right")); - })(yd || (yd = {})), - (function (e) { - ((e[(e.Switch = 0)] = "Switch"), (e[(e.Jump = 1)] = "Jump")); - })(Ed || (Ed = {})), - (function (e) { - ((e[(e.A = 0)] = "A"), (e[(e.B = 1)] = "B")); - })(bd || (bd = {})), - (function (e) { - ((e[(e.Left = 0)] = "Left"), - (e[(e.Right = 1)] = "Right"), - (e[(e.Up = 2)] = "Up"), - (e[(e.Down = 3)] = "Down")); - })(Sd || (Sd = {})), - (function (e) { - ((e[(e.Gun = 0)] = "Gun"), - (e[(e.DoubleJump = 1)] = "DoubleJump"), - (e[(e.Jetpack = 2)] = "Jetpack"), - (e[(e.PlayerStack = 3)] = "PlayerStack"), - (e[(e.Skateboard = 4)] = "Skateboard"), - (e[(e.Punch = 5)] = "Punch")); - e[(e.Drill = 6)] = "Drill"; - e[(e.Ghost = 7)] = "Ghost"; - e[(e.Spaceship = 8)] = "Spaceship"; - })(Id || (Id = {})), - (function (e) { - ((e[(e.Movement = 0)] = "Movement"), - (e[(e.BlockSpike = 1)] = "BlockSpike")); - e[(e.Size = 2)] = "Size"; - e[(e.Color = 3)] = "Color"; - e[(e.Gravity = 4)] = "Gravity"; - e[(e.Falling = 5)] = "Falling"; - })(_d || (_d = {})), - (function (e) { - ((e[(e.Coin = 0)] = "Coin"), (e[(e.Arrows = 1)] = "Arrows")); - })(vd || (vd = {})), - (function (e) { - ((e[(e.Left = 0)] = "Left"), (e[(e.Right = 1)] = "Right")); - })(Td || (Td = {})), - (function (e) { - ((e[(e.Dragonfly = 0)] = "Dragonfly"), - (e[(e.Solace = 1)] = "Solace"), - (e[(e.Lighthouse = 2)] = "Lighthouse"), - (e[(e.Octane = 3)] = "Octane"), - (e[(e.Stardust = 4)] = "Stardust"), - (e[(e.ThinkDifferent = 5)] = "ThinkDifferent"), - (e[(e.DarkSheep = 6)] = "DarkSheep"), - (e[(e.EightBitAdventure = 7)] = "EightBitAdventure"), - (e[(e.Indestructable = 8)] = "Indestructable"), - (e[(e.Frontier = 9)] = "Frontier"), - (e[(e.Polymorph = 10)] = "Polymorph"), - (e[(e.Accelerated = 11)] = "Accelerated"), - (e[(e.CriticalHit = 12)] = "CriticalHit"), - (e[(e.SkyFracture = 13)] = "SkyFracture"), - (e[(e.Breathe = 14)] = "Breathe"), - (e[(e.Blythe = 15)] = "Blythe"), - (e[(e.Awake = 16)] = "Awake"), - (e[(e.Coincidence = 17)] = "Coincidence"), - (e[(e.Mutant = 18)] = "Mutant"), - (e[(e.Overdrive = 19)] = "Overdrive"), - (e[(e.Cloud9 = 20)] = "Cloud9"), - (e[(e.ForYou = 21)] = "ForYou"), - (e[(e.Aura = 22)] = "Aura"), - (e[(e.CoolFriends = 23)] = "CoolFriends"), - (e[(e.NacreousSnowmelt = 24)] = "NacreousSnowmelt")); - e[(e.FireAura = 25)] = "FireAura"; - e[(e.ChaozFantasy = 26)] = "ChaozFantasy"; - e[(e.Heaven = 27)] = "Heaven"; - e[(e.Phazd = 28)] = "Phazd"; - e[(e.Virtual = 29)] = "Virtual"; - e[(e.SolarAbyss = 30)] = "SolarAbyss"; - e[(e.Toe3 = 31)] = "Toe3"; - e[(e.Silverdust = 32)] = "Silverdust"; - e[(e.Truecolors = 33)] = "Truecolors"; - e[(e.Soulless2 = 34)] = "Soulless2"; - e[(e.PirateManners = 35)] = "PirateManners"; - e[(e.EightBitShuffle = 36)] = "EightBitShuffle"; - e[(e.FinalTheory = 37)] = "FinalTheory"; - e[(e.SuperUltra = 38)] = "SuperUltra"; - e[(e.Rummy = 39)] = "Rummy"; - e[(e.Daydreamer = 40)] = "Daydreamer"; - e[(e.OrientalSwing = 41)] = "OrientalSwing"; - e[(e.RedShift = 42)] = "RedShift"; - e[(e.RaceAroundTheWorld = 43)] = "RaceAroundTheWorld"; - e[(e.Machina = 44)] = "Machina"; - e[(e.Clutterfunk = 45)] = "Clutterfunk"; - e[(e.Soulless4 = 46)] = "Soulless4"; - e[(e.Zenith = 47)] = "Zenith"; - e[(e.Color = 48)] = "Color"; - e[(e.FunkyPunky = 49)] = "FunkyPunky"; - e[(e.OctaneExtended = 50)] = "OctaneExtended"; - e[(e.CriticalHitExtended = 51)] = "CriticalHitExtended"; - e[(e.MindsOfTheMad = 52)] = "MindsOfTheMad"; - e[(e.Electrodynamix = 53)] = "Electrodynamix"; - e[(e.SkyFractureExtended = 54)] = "SkyFractureExtended"; - e[(e.Plummet = 55)] = "Plummet"; - e[(e.SolarWind = 56)] = "SolarWind"; - e[(e.GlitchedOut = 57)] = "GlitchedOut"; - e[(e.LastTile = 58)] = "LastTile"; - // you know what? I'm not gonna put songs here. This variable (Rd) isn't even used anywhere. - })(Rd || (Rd = {})), - (function (e) { - ((e[(e.World1 = 0)] = "World1"), - (e[(e.World1Boss = 1)] = "World1Boss"), - (e[(e.World1Red = 2)] = "World1Red"), - (e[(e.World2 = 3)] = "World2"), - (e[(e.World2Red = 4)] = "World2Red"), - (e[(e.World3 = 5)] = "World3"), - (e[(e.Synthwave = 6)] = "Synthwave"), - (e[(e.World4 = 7)] = "World4"), - (e[(e.World4Red = 8)] = "World4Red"), - (e[(e.World4Boss = 9)] = "World4Boss"), - (e[(e.World3Red = 10)] = "World3Red"), - (e[(e.Skater = 11)] = "Skater"), - (e[(e.Arrows = 12)] = "Arrows"), - (e[(e.Dreamy = 13)] = "Dreamy"), - (e[(e.Speed = 14)] = "Speed"), - (e[(e.Fighter = 15)] = "Fighter")); - e[(e.Classic = 16)] = "Classic"; - e[(e.Infinite = 17)] = "Infinite"; - e[(e.Virtual = 18)] = "Virtual"; - })(Od || (Od = {})), - (function (e) { - ((e[(e.Gun = 0)] = "Gun"), - (e[(e.DoubleJump = 1)] = "DoubleJump"), - (e[(e.Jetpack = 2)] = "Jetpack"), - (e[(e.PlayerStack = 3)] = "PlayerStack"), - (e[(e.Skateboard = 4)] = "Skateboard"), - (e[(e.Punch = 5)] = "Punch")); - e[(e.Drill = 6)] = "Drill"; - e[(e.Ghost = 7)] = "Ghost"; - e[(e.Spaceship = 8)] = "Spaceship"; - })(Cd || (Cd = {})), - (function (e) { - ((e[(e.Movement = 0)] = "Movement"), - (e[(e.BlockSpike = 1)] = "BlockSpike")); - e[(e.Size = 2)] = "Size"; - e[(e.Color = 3)] = "Color"; - e[(e.Gravity = 4)] = "Gravity"; - e[(e.Falling = 5)] = "Falling"; - })(wd || (wd = {})), - (function (e) { - ((e[(e.Red = 0)] = "Red"), (e[(e.Yellow = 1)] = "Yellow")); - e[(e.Green = 2)] = "Green"; - e[(e.Cyan = 3)] = "Cyan"; - ((e[(e.Blue = 4)] = "Blue"), (e[(e.Violet = 5)] = "Violet")); - e[(e.Pink = 6)] = "Pink"; - e[(e.Black = 7)] = "Black"; - e[(e.White = 8)] = "White"; - e[(e.Flash = 9)] = "Flash"; - })(clrs2 || (clrs2 = {})), - (function (e) { - ((e[(e.Coin = 0)] = "Coin"), (e[(e.Arrows = 1)] = "Arrows")); - })(Ad || (Ad = {})), - (function (e) { - ((e[(e.Left = 0)] = "Left"), (e[(e.Right = 1)] = "Right")); - })(kd || (kd = {})), - (function (e) { - ((e[(e.Dragonfly = 0)] = "Dragonfly"), - (e[(e.Solace = 1)] = "Solace"), - (e[(e.Lighthouse = 2)] = "Lighthouse"), - (e[(e.Octane = 3)] = "Octane"), - (e[(e.Stardust = 4)] = "Stardust"), - (e[(e.ThinkDifferent = 5)] = "ThinkDifferent"), - (e[(e.DarkSheep = 6)] = "DarkSheep"), - (e[(e.EightBitAdventure = 7)] = "EightBitAdventure"), - (e[(e.Indestructable = 8)] = "Indestructable"), - (e[(e.Frontier = 9)] = "Frontier"), - (e[(e.Polymorph = 10)] = "Polymorph"), - (e[(e.Accelerated = 11)] = "Accelerated"), - (e[(e.CriticalHit = 12)] = "CriticalHit"), - (e[(e.SkyFracture = 13)] = "SkyFracture"), - (e[(e.Breathe = 14)] = "Breathe"), - (e[(e.Blythe = 15)] = "Blythe"), - (e[(e.Awake = 16)] = "Awake"), - (e[(e.Coincidence = 17)] = "Coincidence"), - (e[(e.Mutant = 18)] = "Mutant"), - (e[(e.Overdrive = 19)] = "Overdrive"), - (e[(e.Cloud9 = 20)] = "Cloud9"), - (e[(e.ForYou = 21)] = "ForYou"), - (e[(e.Aura = 22)] = "Aura"), - (e[(e.CoolFriends = 23)] = "CoolFriends"), - (e[(e.NacreousSnowmelt = 24)] = "NacreousSnowmelt")); - e[(e.FireAura = 25)] = "FireAura"; - e[(e.ChaozFantasy = 26)] = "ChaozFantasy"; - e[(e.Heaven = 27)] = "Heaven"; - e[(e.Phazd = 28)] = "Phazd"; - e[(e.Virtual = 29)] = "Virtual"; - e[(e.SolarAbyss = 30)] = "SolarAbyss"; - e[(e.Toe3 = 31)] = "Toe3"; - e[(e.Silverdust = 32)] = "Silverdust"; - e[(e.Truecolors = 33)] = "Truecolors"; - e[(e.Soulless2 = 34)] = "Souless2"; - e[(e.PirateManners = 35)] = "PirateManners"; - e[(e.EightBitShuffle = 36)] = "EightBitShuffle"; - e[(e.FinalTheory = 37)] = "FinalTheory"; - e[(e.SuperUltra = 38)] = "SuperUltra"; - e[(e.Rummy = 39)] = "Rummy"; - e[(e.Daydreamer = 40)] = "Daydreamer"; - e[(e.OrientalSwing = 41)] = "OrientalSwing"; - e[(e.RedShift = 42)] = "RedShift"; - e[(e.RaceAroundTheWorld = 43)] = "RaceAroundTheWorld"; - e[(e.Machina = 44)] = "Machina"; - e[(e.Clutterfunk = 45)] = "Clutterfunk"; - e[(e.Soulless4 = 46)] = "Soulless4"; - e[(e.Zenith = 47)] = "Zenith"; - e[(e.Color = 48)] = "Color"; - e[(e.FunkyPunky = 49)] = "FunkyPunky"; - e[(e.OctaneExtended = 50)] = "OctaneExtended"; - e[(e.CriticalHitExtended = 51)] = "CriticalHitExtended"; - e[(e.MindsOfTheMad = 52)] = "MindsOfTheMad"; - e[(e.Electrodynamix = 53)] = "Electrodynamix"; - e[(e.SkyFractureExtended = 54)] = "SkyFractureExtended"; - e[(e.Plummet = 55)] = "Plummet"; - e[(e.SolarWind = 56)] = "SolarWind"; - e[(e.GlitchedOut = 57)] = "GlitchedOut"; - e[(e.LastTile = 58)] = "LastTile"; - e[(e.Hellidox = 59)] = "Hellidox"; - e[(e.Jackpot = 60)] = "Jackpot"; - e[(e.Carnival = 61)] = "Carnival"; - e[(e.RobotLanguage = 62)] = "RobotLanguage"; - e[(e.DryOut = 63)] = "DryOut"; - e[(e.Carnivores = 64)] = "Carnivores"; - e[(e.Phobos = 65)] = "Phobos"; - e[(e.RockinThatBass = 66)] = "RockinThatBass"; - e[(e.MilkyWays = 67)] = "MilkyWays"; - })(Nd || (Nd = {})), - (function (e) { - ((e[(e.World1 = 0)] = "World1"), - (e[(e.World1Boss = 1)] = "World1Boss"), - (e[(e.World1Red = 2)] = "World1Red"), - (e[(e.World2 = 3)] = "World2"), - (e[(e.World2Red = 4)] = "World2Red"), - (e[(e.World3 = 5)] = "World3"), - (e[(e.Synthwave = 6)] = "Synthwave"), - (e[(e.World4 = 7)] = "World4"), - (e[(e.World4Red = 8)] = "World4Red"), - (e[(e.World4Boss = 9)] = "World4Boss"), - (e[(e.World3Red = 10)] = "World3Red"), - (e[(e.Skater = 11)] = "Skater"), - (e[(e.Arrows = 12)] = "Arrows"), - (e[(e.Dreamy = 13)] = "Dreamy"), - (e[(e.Speed = 14)] = "Speed"), - (e[(e.Fighter = 15)] = "Fighter")); - e[(e.Classic = 16)] = "Classic"; - e[(e.Infinite = 17)] = "Infinite"; - e[(e.Virtual = 18)] = "Virtual"; - })(xd || (xd = {}))); - const Bd = Gc([ - mc, - mc, - Bc([Gc(mc, fc, mc, mc), fc]), - Bc([ - nd.tuple([ - Bc([Gc([mc, fc]), Gc([mc])]), - Oc( - Bc([ - Gc([fc, fc, _c(1), _c(0), nd.enum5]), - Gc([fc, fc, _c(0), nd.enum5]), - Gc([fc, fc, _c(1)]), - Gc([fc, fc]), - ]), - ), - Oc( - Bc([ - Gc([ - fc, - fc, - nd.enum4, - nd.enum2, - nd.enum2, - nd.enum3, - nd.enum2, - nd.enum3, - ]), - Gc([fc, fc, nd.enum4, nd.enum2, nd.enum2, nd.enum3]), - Gc([fc, fc, nd.enum4, _c(0), _c(1)]), - Gc([fc, fc, nd.enum4, _c(1), _c(1)]), - Gc([fc, fc, nd.enum4, _c(1)]), - Gc([fc, fc, nd.enum4]), - ]), - ), - Oc( - Gc([ - fc, - fc, - nd.enum5, - Bc([ - _c(-2), - _c(-1), - _c(-0.5), - _c(0), - _c(0.5), - _c(1), - _c(2), - ]), - ]), - ), - Oc( - Bc([ - Gc([fc, fc, nd.enum2, nd.enum2, nd.enum2]), - Gc([fc, fc, nd.enum2, nd.enum2]), - Gc([fc, fc, nd.enum2]), - ]), - ), - Oc( - Bc([ - Gc([ - fc, - fc, - Bc([_c(-1), _c(0), _c(1), _c(2)]), - Bc([ - _c(-2), - _c(-1), - _c(-0.5), - _c(0), - _c(0.5), - _c(1), - _c(2), - ]), - nd.enum4, - nd.enum4, - ]), - Gc([ - fc, - fc, - Bc([_c(-1), _c(0), _c(1), _c(2)]), - Bc([ - _c(-2), - _c(-1), - _c(-0.5), - _c(0), - _c(0.5), - _c(1), - _c(2), - ]), - nd.enum4, - ]), - Gc([ - fc, - fc, - Bc([_c(-1), _c(0), _c(1), _c(2)]), - Bc([ - _c(-2), - _c(-1), - _c(-0.5), - _c(0), - _c(0.5), - _c(1), - _c(2), - ]), - ]), - ]), + return [ + t, + a, + Number( + (Object.entries(Vd).find(([, e]) => e.name === n.name) || [ + [n.fileName, n.bpm, n.name, n.author], + ])[0], ), - Oc( - Bc([ - Gc([fc, fc, nd.enum2, nd.enum2, nd.enum2, nd.enum2]), - Gc([fc, fc, nd.enum2, nd.enum2, nd.enum2]), - Gc([fc, fc, nd.enum2, nd.enum2]), + [ + i.properties.useGround ? [theme, 1] : [theme], + i.blocks + .filter((b) => { + return !b.init; + }) + .map((e) => + e.steel || e.isVoid || e.isBoss || e.isFade + ? e.width === $.miniBlockWidth + ? [ + e.x, + e.y, + 1, + 0, + +e.steel + +e.isVoid * 2 + +e.isBoss * 3 + +e.isFade * 4, + ] + : [ + e.x, + e.y, + 0, + +e.steel + +e.isVoid * 2 + +e.isBoss * 3 + +e.isFade * 4, + ] + : e.width === $.miniBlockWidth + ? [e.x, e.y, 1] + : [e.x, e.y], + ), + i.spikes.map((e) => + e.init + ? [ + e.x, + e.y, + ru(e.rotation, Hd), + e.skipMissiles ? 1 : 0, + +(e.width === $.miniSpikeWidth), + 0, + ru(e.init == "blue", ou), + ru(e.trigger, zd), + ] + : e.isLaser || e.isFade + ? [ + e.x, + e.y, + ru(e.rotation, Hd), + e.skipMissiles ? 1 : 0, + +(e.width === $.miniSpikeWidth), + e.isLaser ? 1 : 2, + ] + : e.width === $.miniSpikeWidth + ? [ + e.x, + e.y, + ru(e.rotation, Hd), + e.skipMissiles ? 1 : 0, + 1, + ] + : e.skipMissiles + ? [e.x, e.y, ru(e.rotation, Hd), 1] + : [e.x, e.y, ru(e.rotation, Hd)], + ), + i.platforms.map((e) => [ + e.x, + e.y, + ru(e.movement, Xd), + e.movement == "falling" + ? e.multiplier + : ru(e.movementTrigger, zd), //ru(e.movementTrigger, zd), ]), - ), - Oc( - Bc([ - Gc([fc, fc, nd.enum9, nd.enum2, nd.enum2]), - Gc([fc, fc, nd.enum9, nd.enum2]), - Gc([fc, fc, nd.enum9]), + i.directionChanges.map((e) => { + var j = e.multiUse + ? e.fixSync + ? [ + e.x, + e.y, + ru(e.direction, Wd), + ru(!e.multiUse, ou), + 1, + ] + : [e.x, e.y, ru(e.direction, Wd), ru(!e.multiUse, ou)] + : e.fixSync + ? [e.x, e.y, ru(e.direction, Wd), 0, 1] + : [e.x, e.y, ru(e.direction, Wd)]; + + return j; + }), + i.saws.map((e) => + e.shape === "bar" + ? [ + e.x, + e.y, + ru(e.movement, $d), + e.movement == "falling" + ? e.multiplier + : ru(e.movementTrigger, Jd), + 3, + e.offset / 30, + ] + : e.shape != "rail" + ? [ + e.x, + e.y, + ru(e.movement, $d), + e.movement == "falling" + ? e.multiplier + : ru(e.movementTrigger, Jd), + e.shape == "bar" ? 3 : e.shape == "large" ? 2 : 1, + ] + : [ + e.x, + e.y, + ru(e.movement, $d), + e.movement == "falling" + ? e.multiplier + : ru(e.movementTrigger, Jd), + ], + ), + i.flags.map((e) => + e.isFlying + ? [ + e.x, + e.y, + ru(e.role, Kd), + ru(e.switchesOn, ou), + ru(e.retainSpeed, ou), + ru(e.isFlying, ou), + ] + : e.retainSpeed + ? [ + e.x, + e.y, + ru(e.role, Kd), + ru(e.switchesOn, ou), + ru(e.retainSpeed, ou), + ] + : [e.x, e.y, ru(e.role, Kd), ru(e.switchesOn, ou)], + ), + i.powerups.map((e) => + !e.override + ? [e.x, e.y, ru(e.item, Qd), +!e.compatible, 1] + : e.compatible + ? [e.x, e.y, ru(e.item, Qd)] + : [e.x, e.y, ru(e.item, Qd), 1], + ), + i.enemies.map((e) => + !e.isCompatible + ? [ + e.x, + e.y, + ru(e.kind, Zd), + ru(e.giant, ou), + e.skipMissiles ? 1 : 0, + e.enemyDir > 0 ? 1 : 0, + 1, + ] + : e.enemyDir > 0 + ? [ + e.x, + e.y, + ru(e.kind, Zd), + ru(e.giant, ou), + e.skipMissiles ? 1 : 0, + e.enemyDir > 0 ? 1 : 0, + ] + : e.skipMissiles + ? [e.x, e.y, ru(e.kind, Zd), ru(e.giant, ou), 1] + : [e.x, e.y, ru(e.kind, Zd), ru(e.giant, ou)], + ), + i.switchButtons.map((e) => + //console.log(clrs, e.color), + e.affects == "falling" + ? [e.x, e.y, ru(e.affects, eu), +e.up, +e.down] + : e.affects == "gravity" + ? [ + e.x, + e.y, + ru(e.affects, eu), + e.gravity == 2 ? 3 : e.gravity == 0 ? 2 : e.gravity > 0 ? 0 : 1, + ] + : e.affects == "color" + ? [e.x, e.y, ru(e.affects, eu), ru(e.color, clrs)] + : [e.x, e.y, ru(e.affects, eu)], + ), + i.switchPlatforms.map((e) => { + return e.direction != 0 + ? [ + e.x, + e.y, + ru(e.initPosition, au), + ru(e.movementTrigger, iu), + ru(e.direction, Hd), + ] + : [ + e.x, + e.y, + ru(e.initPosition, au), + ru(e.movementTrigger, iu), + ]; + }), + i.collectibles.map((e) => [e.x, e.y, ru(e.form, su)]), + i.springs.map((e) => + e.direction < 0 ? [e.x, e.y, 1] : [e.x, e.y], + ), + i.portals.map((e) => [ + e.x, + e.y, + ru(e.direction, qd), + e.pairId, + ru(e.pair, nu), ]), - ), - Oc( - Bc([ - Gc([ - fc, - fc, - nd.enum6, - nd.enum2, - nd.enum3, - nd.enum2, - nd.enum2, + i.speedChanges.map((e) => [e.x, e.y, ru(e.direction, tu)]), + i.blocks + .filter((b) => { + return !!b.init; + }) + .map((e) => [ + e.x, + e.y, + ru(e.init == "blue", ou), + ru(e.trigger, zd), ]), - Gc([fc, fc, nd.enum6, nd.enum2, nd.enum2, nd.enum3]), - Gc([fc, fc, nd.enum6, nd.enum2, nd.enum2]), - Gc([fc, fc, nd.enum6, nd.enum2, nd.enum2]), - Gc([fc, fc, nd.enum6, nd.enum2]), - Gc([fc, fc, nd.enum6, nd.enum2]), - ]), - ), - Oc( - Bc([ - Gc([fc, fc, nd.enum6, nd.enum2, nd.enum2]), - Gc([fc, fc, nd.enum6, nd.enum10]), - Gc([fc, fc, nd.enum6]), - ]), - ), - Oc( - Bc([ - Gc([fc, fc, nd.enum2, nd.enum2, nd.enum4]), - Gc([fc, fc, nd.enum2, nd.enum2]), - ]), - ), - Oc(Gc([fc, fc, nd.enum2])), - Oc(Bc([Gc([fc, fc, nd.enum2]), Gc([fc, fc])])), - Oc(nd.tuple([fc, fc, nd.enum4, fc, nd.enum2])), - Oc(Gc([fc, fc, nd.enum2])), - Oc(Gc([fc, fc, nd.enum2, nd.enum3])), + ], + B.roundTo(2)(s), + ]; + }), + }), + Yd = Object.assign(Object.assign({}, Fd), { + merge: function (e, t) { + return rt([ + ...e.map((e) => e.level.id), + ...t.map((e) => e.level.id), + ]).map((a) => { + const i = e.find((e) => e.level.id === a), + n = t.find((e) => e.level.id === a); + return i || n; + }); + }, + }), + Ud = (e, t) => (e * (t || 1)).toString(32), + jd = (e, t) => parseInt(e, 32) / (t || 1), + Gd = { + [xd.World1]: "world1", + [xd.World1Boss]: "world1Boss", + [xd.World1Red]: "red", + [xd.World2]: "world2", + [xd.World2Red]: "world2Red", + [xd.World3]: "world3", + [xd.World3Red]: "world3Red", + [xd.Synthwave]: "synthwave", + [xd.World4]: "world4", + [xd.World4Red]: "world4Red", + [xd.World4Boss]: "world4Boss", + [xd.Skater]: "skater", + [xd.Arrows]: "arrows", + [xd.Dreamy]: "dreamy", + [xd.Speed]: "speed", + [xd.Fighter]: "fighter", + [xd.Classic]: "classic", + [xd.Infinite]: "infinite", + [xd.Virtual]: "virtual", + }, + Vd = { + [Nd.Dragonfly]: hl.songs.dragonfly, + [Nd.Solace]: hl.songs.solace, + [Nd.Lighthouse]: hl.songs.lighthouse, + [Nd.Octane]: hl.songs.octane, + [Nd.Stardust]: hl.songs.stardust, + [Nd.ThinkDifferent]: hl.songs.thinkDifferent, + [Nd.DarkSheep]: hl.songs.darkSheep, + [Nd.EightBitAdventure]: hl.songs.eightBitAdventure, + [Nd.Indestructable]: hl.songs.indestructable, + [Nd.Frontier]: hl.songs.frontier, + [Nd.Polymorph]: hl.songs.polymorph, + [Nd.Accelerated]: hl.songs.accelerated, + [Nd.CriticalHit]: hl.songs.criticalHit, + [Nd.SkyFracture]: hl.songs.skyFracture, + [Nd.Breathe]: hl.songs.breathe, + [Nd.Blythe]: hl.songs.blythe, + [Nd.Awake]: hl.songs.awake, + [Nd.Coincidence]: hl.songs.coincidence, + [Nd.Mutant]: hl.songs.mutant, + [Nd.ChaozFantasy]: hl.songs.chaozFantasy, + [Nd.Overdrive]: hl.songs.overdrive, + [Nd.Cloud9]: hl.songs.cloud9, + [Nd.ForYou]: hl.songs.forYou, + [Nd.Aura]: hl.songs.aura, + [Nd.CoolFriends]: hl.songs.coolFriends, + [Nd.NacreousSnowmelt]: hl.songs.nacreousSnowmelt, + [Nd.FireAura]: hl.songs.fireAura, + [Nd.Heaven]: hl.songs.heaven, + [Nd.Phazd]: hl.songs.phazd, + [Nd.Virtual]: hl.songs.virtual, + [Nd.SolarAbyss]: hl.songs.solarAbyss, + [Nd.Toe3]: hl.songs.toe3, + [Nd.Silverdust]: hl.songs.silverdust, + [Nd.Truecolors]: hl.songs.truecolors, + [Nd.Soulless2]: hl.songs.soulless2, + [Nd.PirateManners]: hl.songs.piratemanners, + [Nd.EightBitShuffle]: hl.songs.eightBitShuffle, + [Nd.FinalTheory]: hl.songs.finalTheory, + [Nd.SuperUltra]: hl.songs.superUltra, + [Nd.Rummy]: hl.songs.rummy, + [Nd.Daydreamer]: hl.songs.daydreamer, + [Nd.OrientalSwing]: hl.songs.orientalSwing, + [Nd.RedShift]: hl.songs.redShift, + [Nd.RaceAroundTheWorld]: hl.songs.raceAroundTheWorld, + [Nd.Machina]: hl.songs.machina, + [Nd.Clutterfunk]: hl.songs.clutterfunk, + [Nd.Soulless4]: hl.songs.soulless4, + [Nd.Zenith]: hl.songs.zenith, + [Nd.Color]: hl.songs.color, + [Nd.FunkyPunky]: hl.songs.funkyPunky, + [Nd.OctaneExtended]: hl.songs.octaneExtended, + [Nd.CriticalHitExtended]: hl.songs.criticalHitExtended, + [Nd.MindsOfTheMad]: hl.songs.mindsOfTheMad, + [Nd.Electrodynamix]: hl.songs.electrodynamix, + [Nd.SkyFractureExtended]: hl.songs.skyFractureExtended, + [Nd.Plummet]: hl.songs.plummet, + [Nd.SolarWind]: hl.songs.solarWind, + [Nd.GlitchedOut]: hl.songs.glitchedOut, + [Nd.LastTile]: hl.songs.lastTile, + [Nd.Hellidox]: hl.songs.hellidox, + [Nd.Jackpot]: hl.songs.jackpot, + [Nd.Carnival]: hl.songs.carnival, + [Nd.RobotLanguage]: hl.songs.robotLanguage, + [Nd.DryOut]: hl.songs.dryOut, + [Nd.Carnivores]: hl.songs.carnivores, + [Nd.Phobos]: hl.songs.phobos, + [Nd.RockinThatBass]: hl.songs.rockinThatBass, + [Nd.MilkyWays]: hl.songs.milkyWays + }, + Hd = { + [ld.Rot0]: 0, + [ld.Rot90]: 90, + [ld.Rot180]: 180, + [ld.Rot270]: 270, + }, + Xd = { + [cd.Static]: "static", + [cd.UpDown]: "upDown", + [cd.DownUp]: "downUp", + [cd.Falling]: "falling", + [cd.Rail]: "rail", + }, + zd = { [dd.Beat]: "beat", [dd.Jump]: "jump", [dd.Switch]: "switch" }, + Wd = { [ud.Left]: "left", [ud.Right]: "right" }, + multUse = { [usage.SingleUse]: false, [usage.MultiUse]: true }, + qd = { + [Sd.Left]: "left", + [Sd.Right]: "right", + [Sd.Up]: "up", + [Sd.Down]: "down", + }, + $d = { + [hd.Static]: "static", + [hd.UpDown]: "upDown", + [hd.DownUp]: "downUp", + [hd.Falling]: "falling", + }, + Jd = { [pd.Beat]: "beat", [pd.Jump]: "jump", [pd.Switch]: "switch" }, + shapes = { 0: "rail", 1: "small", 2: "large" }, + Kd = { [gd.Checkpoint]: "checkpoint", [gd.EndOfLevel]: "endOfLevel" }, + Qd = { + [Cd.Gun]: "gun", + [Cd.DoubleJump]: "doubleJump", + [Cd.Jetpack]: "jetpack", + [Cd.PlayerStack]: "playerStack", + [Cd.Skateboard]: "skateboard", + [Cd.Punch]: "punch", + [Cd.Drill]: "drill", + [Cd.Ghost]: "ghost", + [Cd.Spaceship]: "spaceship", + }, + Zd = { + [fd.Shooter]: "shooter", + [fd.Walker]: "walker", + [fd.WalkerHelmet]: "walkerHelmet", + [fd.Bomb]: "bomb", + [fd.Minion]: "minion", + [fd.Fireball]: "fireball", + }, + eu = { + [wd.Movement]: "movement", + [wd.BlockSpike]: "blockSpike", + [wd.Size]: "size", + [wd.Color]: "color", + [wd.Gravity]: "gravity", + [wd.Falling]: "falling", + }, + clrs = { + [clrs2.Red]: "red", + [clrs2.Yellow]: "yellow", + [clrs2.Green]: "green", + [clrs2.Cyan]: "cyan", + [clrs2.Blue]: "blue", + [clrs2.Violet]: "violet", + [clrs2.Pink]: "pink", + [clrs2.Black]: "black", + [clrs2.White]: "white", + [clrs2.Flash]: "flash", + }, + tu = { [kd.Left]: "left", [kd.Right]: "right" }, + au = { [yd.Up]: "up", [yd.Right]: "right" }, + iu = { [Ed.Switch]: "switch", [Ed.Jump]: "jump" }, + nu = { [bd.A]: "a", [bd.B]: "b" }, + su = { [Ad.Coin]: "coin", [Ad.Arrows]: "arrow" }, + ou = { [sd.True]: true, [sd.False]: false }; + function ru(e, t) { + return Number(Object.entries(t).find(([, t]) => t === e)[0]); + } + const lu = xc({ x: fc, y: fc, offsetX: fc, offsetY: fc }), + cu = Uc([ + kc({ + type: _c("powerup"), + array: _c("powerups"), + x: fc, + y: fc, + width: fc, + height: fc, + item: Bc([ + _c("gun"), + _c("doubleJump"), + _c("jetpack"), + _c("playerStack"), + _c("skateboard"), + _c("punch"), + _c("drill"), + _c("ghost"), + _c("spaceship"), + ]), + }), + xc({ snapSize: lu }), + ]), + du = kc({ + x: fc, + y: fc, + width: fc, + height: fc, + speed: fc, + frame: fc, + }), + uu = Uc([ + kc({ + type: _c("portal"), + array: _c("portals"), + x: fc, + y: fc, + width: fc, + height: fc, + direction: Bc([_c("left"), _c("right"), _c("up"), _c("down")]), + pairId: fc, + pair: Bc([_c("a"), _c("b")]), + }), + xc({ snapSize: lu }), + ]), + hu = kc({ + x: fc, + y: fc, + frame: fc, + by: Bc([ + _c("stomped"), + _c("gun"), + _c("object"), + _c("missile"), + _c("outOfView"), + ]), + }), + pu = kc({ + blocks: Oc( + Uc([kc({ type: _c("blockSpikeState") }), xc({ destroyed: hu })]), + ), + spikes: Oc( + Uc([kc({ type: _c("blockSpikeState") }), xc({ destroyed: hu })]), + ), + saws: Oc(Uc([kc({ type: _c("sawState") }), xc({ destroyed: hu })])), + platforms: Oc(kc({ type: _c("platformState") })), + switchPlatforms: Oc(kc({ type: _c("switchPlatformState") })), + switchButtons: Oc( + kc({ type: _c("switchButtonState"), isPressedCounter: fc }), + ), + directionChanges: Oc( + kc({ type: _c("directionChangeState"), wasHit: yc }), + ), + speedChanges: Oc(kc({ type: _c("speedChangeState") })), + flags: Oc(kc({ type: _c("flagState"), wasHit: yc })), + enemies: Oc( + Uc([ + kc({ + type: _c("enemyState"), + framesSeen: fc, + offsetX: fc, + offsetY: fc, + bullet: Bc([du, hc]), + direction: Bc([_c(1), _c(-1)]), + speedY: fc, + }), + xc({ destroyed: hu }), + ]), + ), + powerups: Oc(kc({ type: _c("powerupState"), wasPickedUp: yc })), + springs: Oc(kc({ type: _c("springState") })), + collectibles: Oc( + Uc([ + kc({ type: _c("collectibleState"), wasPickedUp: yc }), + xc({ score: fc }), + ]), + ), + portals: Oc(kc({ type: _c("portalState") })), + }), + gu = kc({ + type: _c("pixel"), + bossX: fc, + bossY: fc, + view: Bc([ + _c("idle"), + _c("gunOut"), + _c("gun"), + _c("gunIn"), + _c("chargeLaser"), + _c("chargeLaserDamage"), + _c("death"), + ]), + isShootingFrames: fc, + startChargeFrame: Bc([fc, hc]), + takingDamageTimeout: fc, + health: fc, + bullets: Oc( + kc({ + type: Bc([ + _c("thinBullet"), + _c("missile"), + _c("bomb"), + _c("cannonbomb"), + _c("bulletHell"), + _c("bulletHellBig"), + _c("laser"), ]), - nd.tuple([ - Bc([Gc([mc, fc]), Gc([mc])]), - Oc( - Bc([ - Gc([fc, fc, _c(1), _c(0), nd.enum5]), - Gc([fc, fc, _c(0), nd.enum5]), - Gc([fc, fc, _c(1)]), - Gc([fc, fc]), - ]), - ), - Oc( - Bc([ - Gc([ - fc, - fc, - nd.enum4, - nd.enum2, - nd.enum2, - nd.enum2, - nd.enum2, - nd.enum3, - ]), - Gc([fc, fc, nd.enum4, nd.enum2, nd.enum2, _c(1)]), - Gc([fc, fc, nd.enum4, _c(0), _c(1)]), - Gc([fc, fc, nd.enum4, _c(1), _c(1)]), - Gc([fc, fc, nd.enum4, _c(1)]), - Gc([fc, fc, nd.enum4]), - ]), - ), - Oc( - Gc([ - fc, - fc, - nd.enum5, - Bc([ - _c(-2), - _c(-1), - _c(-0.5), - _c(0), - _c(0.5), - _c(1), - _c(2), - ]), - ]), - ), - Oc( - Bc([ - Gc([fc, fc, nd.enum2, nd.enum2, nd.enum2]), - Gc([fc, fc, nd.enum2, nd.enum2]), - Gc([fc, fc, nd.enum2]), - ]), - ), - Oc( - Bc([ - Gc([ - fc, - fc, - Bc([_c(-1), _c(0), _c(1), _c(2)]), - Bc([ - _c(-2), - _c(-1), - _c(-0.5), - _c(0), - _c(0.5), - _c(1), - _c(2), - ]), - nd.enum4, - nd.enum4, - ]), - Gc([ - fc, - fc, - Bc([_c(-1), _c(0), _c(1), _c(2)]), - Bc([ - _c(-2), - _c(-1), - _c(-0.5), - _c(0), - _c(0.5), - _c(1), - _c(2), - ]), - nd.enum4, - ]), - Gc([ - fc, - fc, - Bc([_c(-1), _c(0), _c(1), _c(2)]), - Bc([ - _c(-2), - _c(-1), - _c(-0.5), - _c(0), - _c(0.5), - _c(1), - _c(2), - ]), - ]), - ]), - ), - Oc( - Bc([ - Gc([fc, fc, nd.enum2, nd.enum2, nd.enum2, nd.enum2]), - Gc([fc, fc, nd.enum2, nd.enum2, nd.enum2]), - Gc([fc, fc, nd.enum2, nd.enum2]), - ]), - ), - Oc( - Bc([ - Gc([fc, fc, nd.enum9, nd.enum2, nd.enum2]), - Gc([fc, fc, nd.enum9, nd.enum2]), - Gc([fc, fc, nd.enum9]), - ]), - ), - Oc( - Bc([ - Gc([ - fc, - fc, - nd.enum6, - nd.enum2, - nd.enum3, - nd.enum2, - nd.enum2, - ]), - Gc([fc, fc, nd.enum6, nd.enum2, nd.enum2, nd.enum3]), - Gc([fc, fc, nd.enum6, nd.enum2, nd.enum2]), - Gc([fc, fc, nd.enum6, nd.enum2, nd.enum2]), - Gc([fc, fc, nd.enum6, nd.enum2]), - Gc([fc, fc, nd.enum6, nd.enum2]), - ]), - ), - Oc( - Bc([ - Gc([fc, fc, nd.enum6, nd.enum2, nd.enum2]), - Gc([fc, fc, nd.enum6, nd.enum10]), - Gc([fc, fc, nd.enum6]), - ]), - ), - Oc( - Bc([ - Gc([fc, fc, nd.enum2, nd.enum2, nd.enum4]), - Gc([fc, fc, nd.enum2, nd.enum2]), - ]), - ), - Oc(Gc([fc, fc, nd.enum2])), - Oc(Bc([Gc([fc, fc, nd.enum2]), Gc([fc, fc])])), - Oc(nd.tuple([fc, fc, nd.enum4, fc, nd.enum2])), - Oc(Gc([fc, fc, nd.enum2])), - ]), - ]), - - fc, - ]), - Fd = Ld({ - mappers: [ - () => [], - (e) => - e.map((e) => { - const [t, a, i, n] = e; - return [t, a, i, [...n, []]]; - }), - (e) => - e.map((e) => { - const [t, a, i, n] = e; - return [t, a, i, [...n, [], []]]; - }), - (e) => e.map((e) => [...e, 0]), - (e) => - e.map((e) => { - const [t, a, i, n, s] = e, - [[o], r, l, c, d, u, h, p, g, m, f, y, E, b] = n; - return [ - t, - a, - i, - [ - [o], - r, - l, - c, - d, - u, - h, - p, - g.map((e) => - 3 === e.length - ? [...e, sd.False] - : [e[0], e[1], e[2], sd.False, e[3]], - ), - m.map(([e, t]) => [e, t, wd.Movement]), - f, - y.map((e) => [...e, Ad.Coin]), - E, - b, - [], - ], - s, - ]; - }), - (e) => e, - (e) => e, - ], - finalSchema: Oc(Bd), - uncompress: (e) => - e.map((e) => { - const [t, a, i, n, s] = e, - [ - [o, useGround], - r, - l, - c, - d, - u, - h, - p, - g, - m, - f, - y, - E, - b, - S, - switchBlocks, - ] = n, - I = - Vd[i] || { - fileName: i.fileName, - bpm: i.bpm, - name: i.name, - author: i.author, - } || - hl.songs.dragonfly, - _ = G.getJumpFrames(I.bpm), - v = jd(o, r.length + c.length + f.length), - T = { - properties: { - minY: { minYsByXDiv1000: [], minX: 0, minY: 0 }, - theme: ca[Gd[v] || "world1"], - useGround: !!useGround, - }, - blocks: r - .map(([e, t, a, g, s]) => { - return a - ? $.newMiniBlock({ - x: e, - y: t, - steel: s == 1 ? true : false, - isVoid: s == 2 ? true : false, - isBoss: s == 3 ? true : false, - isFade: s == 4 ? true : false, - }) - : $.newBlock({ - x: e, - y: t, - steel: g == 1 ? true : false, - isVoid: g == 2 ? true : false, - isBoss: g == 3 ? true : false, - isFade: g == 4 ? true : false, - }); - }) - .concat( - switchBlocks - ? switchBlocks.map(([x, Y, ini, tr]) => { - return $.newSwitchBlock({ - x: x, - y: Y, - init: ini == 0 ? "blue" : "red", - trigger: zd[tr], - }); - }) - : [], - ), - spikes: l.map(([e, t, a, i, n, laser, ini, tr]) => - ini === undefined - ? n - ? $.newMiniSpike({ - x: e, - y: t, - rotation: Hd[a], - skipMissiles: 1 === i, - isLaser: 1 === laser, - isFade: 2 === laser, - }) - : $.newSpike({ - x: e, - y: t, - rotation: Hd[a], - skipMissiles: 1 === i, - isLaser: 1 === laser, - isFade: 2 === laser, - }) - : $.newSwitchSpike({ - x: e, - y: t, - rotation: Hd[a], - skipMissiles: 1 === i, - isLaser: false, - isFade: false, - init: ini == 0 ? "blue" : "red", - trigger: zd[tr], - }), - ), - platforms: c.map(([e, t, a, i]) => - $.newPlatform({ - x: e, - y: t, - movement: Xd[a], - movementTrigger: zd[i], - multiplier: i, - }), - ), - directionChanges: d.map(([e, t, a, b, n]) => - $.newDirectionChange({ - x: e, - y: t, - direction: Wd[a], - multiUse: b === undefined ? false : multUse[b || 0], - fixSync: 1 == n, - }), - ), - saws: u.map(([e, t, a, i, n, o]) => - $.newSaw({ - x: e, - y: t, - movement: $d[a], - movementTrigger: Jd[i], - multiplier: i, - shape: - n == 3 - ? "bar" - : n == 2 - ? "large" - : n == 1 - ? "small" - : "rail", - offset: (o || 0) * 30, - }), - ), - flags: h.map(([e, t, a, i, b, o]) => - $.newFlag({ - x: e, - y: t, - role: Kd[a], - switchesOn: ou[i], - retainSpeed: ou[b] || false, - isFlying: ou[o] || false, - }), - ), - powerups: p.map(([e, t, a, n, i]) => - $.newPowerup({ - x: e, - y: t, - item: Qd[a], - compatible: n != 1, - override: i != 1, - }), - ), - //****** - enemies: g.map( - ([ - e, - t, - a, // kind - i, // giant - o, // skipMissiles - n, // enemyDir - s, - ]) => { - return $.newEnemy({ - x: e, - y: t, - kind: Zd[a], - giant: ou[i], - skipMissiles: 1 === o, - enemyDir: n || -1, - isCompatible: s != 1, - }); - }, - ), - switchButtons: m.map( - (j) => { - const [e, t, a, n, i] = j; - return $.newSwitchButton({ - x: e, - y: t, - affects: eu[a], - color: clrs[n] || 0, - gravity: n > 2 ? 2 : n > 1 ? 0 : n > 0 ? -1 : 1, - up: !!n, - down: !!i, - }); - }, //color: clrs[n] })) - ), - switchPlatforms: f.map(([e, t, a, i, n]) => - $.newSwitchPlatform({ - x: e, - y: t, - initPosition: au[a], - movementTrigger: iu[i], - direction: Hd[n] || 0, - }), - ), - collectibles: y.map(([e, t, a]) => - $.newCollectible({ x: e, y: t, form: su[a] }), - ), - springs: E.map(([e, t, a]) => - $.newSpring({ x: e, y: t, direction: a ? -1 : 1 }), - ), - portals: b.map(([e, t, a, i, n]) => - $.newPortal({ - x: e, - y: t, - direction: qd[a], - pairId: i, - pair: nu[n], - }), - ), - speedChanges: S.map(([e, t, a]) => - $.newSpeedChange({ x: e, y: t, direction: tu[a] }), - ), - }; - return { - id: t, - name: a, - song: I, - coefficients: G.getCoefficients(_), - layout: Ca.updateMinY(T), - boss: null, - songStartSecs: s, - }; - }), - compress: (e) => - e.map((e) => { - const { - id: t, - name: a, - layout: i, - song: n, - songStartSecs: s, - } = e, - theme = Ud( - ru(i.properties.theme.id, Gd), - i.blocks.filter((b) => { - return !b.init; - }).length + - i.platforms.length + - i.switchPlatforms.length, - ); - return [ - t, - a, - Number( - (Object.entries(Vd).find(([, e]) => e.name === n.name) || [ - [n.fileName, n.bpm, n.name, n.author], - ])[0], - ), - [ - i.properties.useGround ? [theme, 1] : [theme], - i.blocks - .filter((b) => { - return !b.init; - }) - .map((e) => - e.steel || e.isVoid || e.isBoss || e.isFade - ? e.width === $.miniBlockWidth - ? [ - e.x, - e.y, - 1, - 0, - +e.steel + +e.isVoid * 2 + +e.isBoss * 3 + +e.isFade * 4, - ] - : [ - e.x, - e.y, - 0, - +e.steel + +e.isVoid * 2 + +e.isBoss * 3 + +e.isFade * 4, - ] - : e.width === $.miniBlockWidth - ? [e.x, e.y, 1] - : [e.x, e.y], - ), - i.spikes.map((e) => - e.init - ? [ - e.x, - e.y, - ru(e.rotation, Hd), - e.skipMissiles ? 1 : 0, - +(e.width === $.miniSpikeWidth), - 0, - ru(e.init == "blue", ou), - ru(e.trigger, zd), - ] - : e.isLaser || e.isFade - ? [ - e.x, - e.y, - ru(e.rotation, Hd), - e.skipMissiles ? 1 : 0, - +(e.width === $.miniSpikeWidth), - e.isLaser ? 1 : 2, - ] - : e.width === $.miniSpikeWidth - ? [ - e.x, - e.y, - ru(e.rotation, Hd), - e.skipMissiles ? 1 : 0, - 1, - ] - : e.skipMissiles - ? [e.x, e.y, ru(e.rotation, Hd), 1] - : [e.x, e.y, ru(e.rotation, Hd)], - ), - i.platforms.map((e) => [ - e.x, - e.y, - ru(e.movement, Xd), - e.movement == "falling" - ? e.multiplier - : ru(e.movementTrigger, zd), //ru(e.movementTrigger, zd), - ]), - i.directionChanges.map((e) => { - var j = e.multiUse - ? e.fixSync - ? [ - e.x, - e.y, - ru(e.direction, Wd), - ru(!e.multiUse, ou), - 1, - ] - : [e.x, e.y, ru(e.direction, Wd), ru(!e.multiUse, ou)] - : e.fixSync - ? [e.x, e.y, ru(e.direction, Wd), 0, 1] - : [e.x, e.y, ru(e.direction, Wd)]; - - return j; - }), - i.saws.map((e) => - e.shape === "bar" - ? [ - e.x, - e.y, - ru(e.movement, $d), - e.movement == "falling" - ? e.multiplier - : ru(e.movementTrigger, Jd), - 3, - e.offset / 30, - ] - : e.shape != "rail" - ? [ - e.x, - e.y, - ru(e.movement, $d), - e.movement == "falling" - ? e.multiplier - : ru(e.movementTrigger, Jd), - e.shape == "bar" ? 3 : e.shape == "large" ? 2 : 1, - ] - : [ - e.x, - e.y, - ru(e.movement, $d), - e.movement == "falling" - ? e.multiplier - : ru(e.movementTrigger, Jd), - ], - ), - i.flags.map((e) => - e.isFlying - ? [ - e.x, - e.y, - ru(e.role, Kd), - ru(e.switchesOn, ou), - ru(e.retainSpeed, ou), - ru(e.isFlying, ou), - ] - : e.retainSpeed - ? [ - e.x, - e.y, - ru(e.role, Kd), - ru(e.switchesOn, ou), - ru(e.retainSpeed, ou), - ] - : [e.x, e.y, ru(e.role, Kd), ru(e.switchesOn, ou)], - ), - i.powerups.map((e) => - !e.override - ? [e.x, e.y, ru(e.item, Qd), +!e.compatible, 1] - : e.compatible - ? [e.x, e.y, ru(e.item, Qd)] - : [e.x, e.y, ru(e.item, Qd), 1], - ), - i.enemies.map((e) => - !e.isCompatible - ? [ - e.x, - e.y, - ru(e.kind, Zd), - ru(e.giant, ou), - e.skipMissiles ? 1 : 0, - e.enemyDir > 0 ? 1 : 0, - 1, - ] - : e.enemyDir > 0 - ? [ - e.x, - e.y, - ru(e.kind, Zd), - ru(e.giant, ou), - e.skipMissiles ? 1 : 0, - e.enemyDir > 0 ? 1 : 0, - ] - : e.skipMissiles - ? [e.x, e.y, ru(e.kind, Zd), ru(e.giant, ou), 1] - : [e.x, e.y, ru(e.kind, Zd), ru(e.giant, ou)], - ), - i.switchButtons.map((e) => - //console.log(clrs, e.color), - e.affects == "falling" - ? [e.x, e.y, ru(e.affects, eu), +e.up, +e.down] - : e.affects == "gravity" - ? [ - e.x, - e.y, - ru(e.affects, eu), - e.gravity == 2 ? 3 : e.gravity == 0 ? 2 : e.gravity > 0 ? 0 : 1, - ] - : e.affects == "color" - ? [e.x, e.y, ru(e.affects, eu), ru(e.color, clrs)] - : [e.x, e.y, ru(e.affects, eu)], - ), - i.switchPlatforms.map((e) => { - return e.direction != 0 - ? [ - e.x, - e.y, - ru(e.initPosition, au), - ru(e.movementTrigger, iu), - ru(e.direction, Hd), - ] - : [ - e.x, - e.y, - ru(e.initPosition, au), - ru(e.movementTrigger, iu), - ]; - }), - i.collectibles.map((e) => [e.x, e.y, ru(e.form, su)]), - i.springs.map((e) => - e.direction < 0 ? [e.x, e.y, 1] : [e.x, e.y], - ), - i.portals.map((e) => [ - e.x, - e.y, - ru(e.direction, qd), - e.pairId, - ru(e.pair, nu), - ]), - i.speedChanges.map((e) => [e.x, e.y, ru(e.direction, tu)]), - i.blocks - .filter((b) => { - return !!b.init; - }) - .map((e) => [ - e.x, - e.y, - ru(e.init == "blue", ou), - ru(e.trigger, zd), - ]), - ], - B.roundTo(2)(s), - ]; - }), - }), - Yd = Object.assign(Object.assign({}, Fd), { - merge: function (e, t) { - return rt([ - ...e.map((e) => e.level.id), - ...t.map((e) => e.level.id), - ]).map((a) => { - const i = e.find((e) => e.level.id === a), - n = t.find((e) => e.level.id === a); - return i || n; - }); - }, - }), - Ud = (e, t) => (e * (t || 1)).toString(32), - jd = (e, t) => parseInt(e, 32) / (t || 1), - Gd = { - [xd.World1]: "world1", - [xd.World1Boss]: "world1Boss", - [xd.World1Red]: "red", - [xd.World2]: "world2", - [xd.World2Red]: "world2Red", - [xd.World3]: "world3", - [xd.World3Red]: "world3Red", - [xd.Synthwave]: "synthwave", - [xd.World4]: "world4", - [xd.World4Red]: "world4Red", - [xd.World4Boss]: "world4Boss", - [xd.Skater]: "skater", - [xd.Arrows]: "arrows", - [xd.Dreamy]: "dreamy", - [xd.Speed]: "speed", - [xd.Fighter]: "fighter", - [xd.Classic]: "classic", - [xd.Infinite]: "infinite", - [xd.Virtual]: "virtual", - }, - Vd = { - [Nd.Dragonfly]: hl.songs.dragonfly, - [Nd.Solace]: hl.songs.solace, - [Nd.Lighthouse]: hl.songs.lighthouse, - [Nd.Octane]: hl.songs.octane, - [Nd.Stardust]: hl.songs.stardust, - [Nd.ThinkDifferent]: hl.songs.thinkDifferent, - [Nd.DarkSheep]: hl.songs.darkSheep, - [Nd.EightBitAdventure]: hl.songs.eightBitAdventure, - [Nd.Indestructable]: hl.songs.indestructable, - [Nd.Frontier]: hl.songs.frontier, - [Nd.Polymorph]: hl.songs.polymorph, - [Nd.Accelerated]: hl.songs.accelerated, - [Nd.CriticalHit]: hl.songs.criticalHit, - [Nd.SkyFracture]: hl.songs.skyFracture, - [Nd.Breathe]: hl.songs.breathe, - [Nd.Blythe]: hl.songs.blythe, - [Nd.Awake]: hl.songs.awake, - [Nd.Coincidence]: hl.songs.coincidence, - [Nd.Mutant]: hl.songs.mutant, - [Nd.ChaozFantasy]: hl.songs.chaozFantasy, - [Nd.Overdrive]: hl.songs.overdrive, - [Nd.Cloud9]: hl.songs.cloud9, - [Nd.ForYou]: hl.songs.forYou, - [Nd.Aura]: hl.songs.aura, - [Nd.CoolFriends]: hl.songs.coolFriends, - [Nd.NacreousSnowmelt]: hl.songs.nacreousSnowmelt, - [Nd.FireAura]: hl.songs.fireAura, - [Nd.Heaven]: hl.songs.heaven, - [Nd.Phazd]: hl.songs.phazd, - [Nd.Virtual]: hl.songs.virtual, - [Nd.SolarAbyss]: hl.songs.solarAbyss, - [Nd.Toe3]: hl.songs.toe3, - [Nd.Silverdust]: hl.songs.silverdust, - [Nd.Truecolors]: hl.songs.truecolors, - [Nd.Soulless2]: hl.songs.soulless2, - [Nd.PirateManners]: hl.songs.piratemanners, - [Nd.EightBitShuffle]: hl.songs.eightBitShuffle, - [Nd.FinalTheory]: hl.songs.finalTheory, - [Nd.SuperUltra]: hl.songs.superUltra, - [Nd.Rummy]: hl.songs.rummy, - [Nd.Daydreamer]: hl.songs.daydreamer, - [Nd.OrientalSwing]: hl.songs.orientalSwing, - [Nd.RedShift]: hl.songs.redShift, - [Nd.RaceAroundTheWorld]: hl.songs.raceAroundTheWorld, - [Nd.Machina]: hl.songs.machina, - [Nd.Clutterfunk]: hl.songs.clutterfunk, - [Nd.Soulless4]: hl.songs.soulless4, - [Nd.Zenith]: hl.songs.zenith, - [Nd.Color]: hl.songs.color, - [Nd.FunkyPunky]: hl.songs.funkyPunky, - [Nd.OctaneExtended]: hl.songs.octaneExtended, - [Nd.CriticalHitExtended]: hl.songs.criticalHitExtended, - [Nd.MindsOfTheMad]: hl.songs.mindsOfTheMad, - [Nd.Electrodynamix]: hl.songs.electrodynamix, - [Nd.SkyFractureExtended]: hl.songs.skyFractureExtended, - [Nd.Plummet]: hl.songs.plummet, - [Nd.SolarWind]: hl.songs.solarWind, - [Nd.GlitchedOut]: hl.songs.glitchedOut, - [Nd.LastTile]: hl.songs.lastTile, - [Nd.Hellidox]: hl.songs.hellidox, - [Nd.Jackpot]: hl.songs.jackpot, - [Nd.Carnival]: hl.songs.carnival, - [Nd.RobotLanguage]: hl.songs.robotLanguage, - [Nd.DryOut]: hl.songs.dryOut, - [Nd.Carnivores]: hl.songs.carnivores, - [Nd.Phobos]: hl.songs.phobos, - [Nd.RockinThatBass]: hl.songs.rockinThatBass, - [Nd.MilkyWays]: hl.songs.milkyWays - }, - Hd = { - [ld.Rot0]: 0, - [ld.Rot90]: 90, - [ld.Rot180]: 180, - [ld.Rot270]: 270, - }, - Xd = { - [cd.Static]: "static", - [cd.UpDown]: "upDown", - [cd.DownUp]: "downUp", - [cd.Falling]: "falling", - [cd.Rail]: "rail", - }, - zd = { [dd.Beat]: "beat", [dd.Jump]: "jump", [dd.Switch]: "switch" }, - Wd = { [ud.Left]: "left", [ud.Right]: "right" }, - multUse = { [usage.SingleUse]: false, [usage.MultiUse]: true }, - qd = { - [Sd.Left]: "left", - [Sd.Right]: "right", - [Sd.Up]: "up", - [Sd.Down]: "down", - }, - $d = { - [hd.Static]: "static", - [hd.UpDown]: "upDown", - [hd.DownUp]: "downUp", - [hd.Falling]: "falling", - }, - Jd = { [pd.Beat]: "beat", [pd.Jump]: "jump", [pd.Switch]: "switch" }, - shapes = { 0: "rail", 1: "small", 2: "large" }, - Kd = { [gd.Checkpoint]: "checkpoint", [gd.EndOfLevel]: "endOfLevel" }, - Qd = { - [Cd.Gun]: "gun", - [Cd.DoubleJump]: "doubleJump", - [Cd.Jetpack]: "jetpack", - [Cd.PlayerStack]: "playerStack", - [Cd.Skateboard]: "skateboard", - [Cd.Punch]: "punch", - [Cd.Drill]: "drill", - [Cd.Ghost]: "ghost", - [Cd.Spaceship]: "spaceship", - }, - Zd = { - [fd.Shooter]: "shooter", - [fd.Walker]: "walker", - [fd.WalkerHelmet]: "walkerHelmet", - [fd.Bomb]: "bomb", - [fd.Minion]: "minion", - [fd.Fireball]: "fireball", - }, - eu = { - [wd.Movement]: "movement", - [wd.BlockSpike]: "blockSpike", - [wd.Size]: "size", - [wd.Color]: "color", - [wd.Gravity]: "gravity", - [wd.Falling]: "falling", - }, - clrs = { - [clrs2.Red]: "red", - [clrs2.Yellow]: "yellow", - [clrs2.Green]: "green", - [clrs2.Cyan]: "cyan", - [clrs2.Blue]: "blue", - [clrs2.Violet]: "violet", - [clrs2.Pink]: "pink", - [clrs2.Black]: "black", - [clrs2.White]: "white", - [clrs2.Flash]: "flash", - }, - tu = { [kd.Left]: "left", [kd.Right]: "right" }, - au = { [yd.Up]: "up", [yd.Right]: "right" }, - iu = { [Ed.Switch]: "switch", [Ed.Jump]: "jump" }, - nu = { [bd.A]: "a", [bd.B]: "b" }, - su = { [Ad.Coin]: "coin", [Ad.Arrows]: "arrow" }, - ou = { [sd.True]: true, [sd.False]: false }; - function ru(e, t) { - return Number(Object.entries(t).find(([, t]) => t === e)[0]); - } - const lu = xc({ x: fc, y: fc, offsetX: fc, offsetY: fc }), - cu = Uc([ - kc({ - type: _c("powerup"), - array: _c("powerups"), x: fc, y: fc, width: fc, height: fc, - item: Bc([ - _c("gun"), - _c("doubleJump"), - _c("jetpack"), - _c("playerStack"), - _c("skateboard"), - _c("punch"), - _c("drill"), - _c("ghost"), - _c("spaceship"), - ]), + speedX: fc, + speedY: fc, + gradY: fc, + destroyed: yc, }), - xc({ snapSize: lu }), - ]), - du = kc({ - x: fc, - y: fc, - width: fc, - height: fc, - speed: fc, - frame: fc, - }), - uu = Uc([ + ), + allButtons: Oc( kc({ - type: _c("portal"), - array: _c("portals"), x: fc, y: fc, - width: fc, - height: fc, - direction: Bc([_c("left"), _c("right"), _c("up"), _c("down")]), - pairId: fc, - pair: Bc([_c("a"), _c("b")]), + pressed: yc, }), - xc({ snapSize: lu }), + ), + mutatesState: yc, + destroyed: yc, + }), + mu = kc({ + type: Bc([ + _c("bottomExit"), + _c("bottomJoin"), + _c("bottomLeading"), + _c("bottomSingle"), + _c("bottomStalecmite"), + _c("bottomTrailing"), + _c("middle"), + _c("topEntry"), + _c("topJoin"), + _c("topLeading"), + _c("topSingle"), + _c("topStalectite"), + _c("topTrailing"), ]), - hu = kc({ - x: fc, - y: fc, - frame: fc, - by: Bc([ - _c("stomped"), - _c("gun"), - _c("object"), - _c("missile"), - _c("outOfView"), - ]), - }), - pu = kc({ - blocks: Oc( - Uc([kc({ type: _c("blockSpikeState") }), xc({ destroyed: hu })]), - ), - spikes: Oc( - Uc([kc({ type: _c("blockSpikeState") }), xc({ destroyed: hu })]), - ), - saws: Oc(Uc([kc({ type: _c("sawState") }), xc({ destroyed: hu })])), - platforms: Oc(kc({ type: _c("platformState") })), - switchPlatforms: Oc(kc({ type: _c("switchPlatformState") })), - switchButtons: Oc( - kc({ type: _c("switchButtonState"), isPressedCounter: fc }), - ), - directionChanges: Oc( - kc({ type: _c("directionChangeState"), wasHit: yc }), - ), - speedChanges: Oc(kc({ type: _c("speedChangeState") })), - flags: Oc(kc({ type: _c("flagState"), wasHit: yc })), - enemies: Oc( - Uc([ - kc({ - type: _c("enemyState"), - framesSeen: fc, - offsetX: fc, - offsetY: fc, - bullet: Bc([du, hc]), - direction: Bc([_c(1), _c(-1)]), - speedY: fc, + hitType: Bc([ + _c("top"), + _c("topStalectite"), + _c("bottom"), + _c("bottomStalecmite"), + hc, + ]), + x: fc, + index: fc, + }), + fu = kc({ + type: _c("flying"), + bossX: fc, + bossY: fc, + isUp: yc, + gunView: Bc([_c("up"), _c("down"), _c("toDown"), _c("toUp")]), + shootFrames: fc, + bullets: Oc(kc({ x: fc, y: fc, width: fc, height: fc, speed: fc })), + destroyed: yc, + allAsteroids: Oc(kc({ x: fc, y: fc, radius: fc, index: fc })), + allInsideAsteroid: Oc(mu), + asteroids: Oc(kc({ x: fc, y: fc, radius: fc, index: fc })), + insideAsteroid: Oc(mu), + moveFrames: Oc(fc), + }), + yu = kc({ + type: _c("demon"), + runtime: Hc, + fistRuntime: Hc, + collisionFn: Hc, + blockCollisionFn: Hc, + minions: Oc(kc({ x: fc, y: fc, width: fc, height: fc, index: fc })), + allMinions: Oc( + kc({ x: fc, y: fc, width: fc, height: fc, index: fc }), + ), + fireballs: Oc( + kc({ x: fc, y: fc, width: fc, height: fc, index: fc }), + ), + allFireballs: Oc( + kc({ x: fc, y: fc, width: fc, height: fc, index: fc }), + ), + }), + Eu = Ld({ + mappers: [ + () => { + throw Error( + "getDefaultData not supported for levelState storage", + ); + }, + (e) => + Object.assign(Object.assign({}, e), { + justHitSpringIndex: null, + }), + (e) => e, + (e) => + Object.assign(Object.assign({}, e), { + jumpSwitch: Object.assign(Object.assign({}, e.jumpSwitch), { + timeout: 0, }), - xc({ destroyed: hu }), - ]), - ), - powerups: Oc(kc({ type: _c("powerupState"), wasPickedUp: yc })), - springs: Oc(kc({ type: _c("springState") })), - collectibles: Oc( - Uc([ - kc({ type: _c("collectibleState"), wasPickedUp: yc }), - xc({ score: fc }), - ]), - ), - portals: Oc(kc({ type: _c("portalState") })), - }), - gu = kc({ - type: _c("pixel"), - bossX: fc, - bossY: fc, - view: Bc([ - _c("idle"), - _c("gunOut"), - _c("gun"), - _c("gunIn"), - _c("chargeLaser"), - _c("chargeLaserDamage"), - _c("death"), - ]), - isShootingFrames: fc, - startChargeFrame: Bc([fc, hc]), - takingDamageTimeout: fc, - health: fc, - bullets: Oc( + }), + (e) => e, + (e) => { + var t; + return Object.assign(Object.assign({}, e), { + bossState: + "flying" === + (null === (t = e.bossState) || void 0 === t + ? void 0 + : t.type) + ? Object.assign(Object.assign({}, e.bossState), { + asteroids: e.bossState.asteroids.map((e, t) => + Object.assign(Object.assign({}, e), { index: t }), + ), + allAsteroids: e.bossState.allAsteroids.map((e, t) => + Object.assign(Object.assign({}, e), { index: t }), + ), + insideAsteroid: e.bossState.insideAsteroid.map( + (e, t) => + Object.assign(Object.assign({}, e), { index: t }), + ), + allInsideAsteroid: e.bossState.allInsideAsteroid.map( + (e, t) => + Object.assign(Object.assign({}, e), { index: t }), + ), + }) + : e.bossState, + }); + }, + (e) => + Object.assign(Object.assign({}, e), { + switchBlockSpikes: false, + playerSpeedMultiplier: 1, + justHitObject: null, + layoutState: Object.assign(Object.assign({}, e.layoutState), { + blocks: e.layoutState.blocks.map((e) => + Object.assign(Object.assign({}, e), { + type: "blockSpikeState", + }), + ), + spikes: e.layoutState.spikes.map((e) => + Object.assign(Object.assign({}, e), { + type: "blockSpikeState", + }), + ), + speedChanges: [], + }), + }), + (e) => + Object.assign(Object.assign({}, e), { + gravity: 1, + }), + (e) => + Object.assign(Object.assign({}, e), { + isCompatible: true, + }), + (e) => + Object.assign(Object.assign({}, e), { + dashing: false, + isGravity: false, + bullets: e.bullets.map((bullet) => ({ ...bullet, frame: 0 })), + }), + (e) => + Object.assign(Object.assign({}, e), { + playerStacks: e.playerStacks.map((stack) => + Object.assign(Object.assign({}, stack), { onObject: null }), + ), + }), + (e) => + Object.assign(Object.assign({}, e), { + layoutState: Object.assign(Object.assign({}, e.layoutState), { + enemies: Object.assign(e.layoutState.enemies, { + speedY: 0, + }), + }), + }), + (e) => + Object.assign(Object.assign({}, e), { + fallTypes: [null, null], + }), + (e) => + Object.assign(Object.assign({}, e), { + flyingAnchor: null, + }), + (e) => + Object.assign(Object.assign({}, e), { + playerPowerups: e.playerPowerup ? [e.playerPowerup] : [], + }), + (e) => + Object.assign(Object.assign({}, e), { + boosterDebug: { + autopilot: {}, + jumpIndicators: [] + } + }), + ], + finalSchema: kc({ + frame: fc, + attempt: fc, + jumping: yc, + justDownInputTimer: fc, + playerX: fc, + playerY: fc, + playerOnGroundY: fc, + playerWasOnGroundCooldown: fc, + playerGradY: fc, + playerRot: fc, + playerScaleX: fc, + playerScaleY: fc, + playerDir: Bc([_c(1), _c(-1)]), + playerSpeedMultiplier: fc, + playerPowerups: Oc(Bc([hc, cu])), + isCompatible: yc, + playerJetpackFuel: fc, + playerUsingPowerup: yc, + playerBullets: Oc(du), + playerStacks: Oc( kc({ - type: Bc([ - _c("thinBullet"), - _c("missile"), - _c("bomb"), - _c("cannonbomb"), - _c("bulletHell"), - _c("bulletHellBig"), - _c("laser"), - ]), - x: fc, y: fc, - width: fc, - height: fc, - speedX: fc, - speedY: fc, gradY: fc, - destroyed: yc, + onObject: Bc([hc, kc({ array: Hc, index: fc, y: fc })]), }), ), - allButtons: Oc( + playerStackIndex: fc, + explosions: Oc(kc({ x: fc, y: fc, framesLeft: fc })), + touchingPortals: Bc([hc, Gc([uu, uu])]), + justHitObject: Bc([ + hc, kc({ - x: fc, - y: fc, - pressed: yc, + array: Bc([ + _c("springs"), + _c("speedChanges"), + _c("switchButtons"), + ]), + index: fc, }), - ), - mutatesState: yc, - destroyed: yc, - }), - mu = kc({ - type: Bc([ - _c("bottomExit"), - _c("bottomJoin"), - _c("bottomLeading"), - _c("bottomSingle"), - _c("bottomStalecmite"), - _c("bottomTrailing"), - _c("middle"), - _c("topEntry"), - _c("topJoin"), - _c("topLeading"), - _c("topSingle"), - _c("topStalectite"), - _c("topTrailing"), ]), - hitType: Bc([ - _c("top"), - _c("topStalectite"), - _c("bottom"), - _c("bottomStalecmite"), + skateboardJumpCharge: fc, + bottomLine: Bc([ hc, + kc({ + minY: fc, + objects: Oc( + kc({ type: mc, x: fc, y: fc, width: fc, height: fc }), + ), + }), ]), - x: fc, - index: fc, - }), - fu = kc({ - type: _c("flying"), - bossX: fc, - bossY: fc, - isUp: yc, - gunView: Bc([_c("up"), _c("down"), _c("toDown"), _c("toUp")]), - shootFrames: fc, - bullets: Oc(kc({ x: fc, y: fc, width: fc, height: fc, speed: fc })), - destroyed: yc, - allAsteroids: Oc(kc({ x: fc, y: fc, radius: fc, index: fc })), - allInsideAsteroid: Oc(mu), - asteroids: Oc(kc({ x: fc, y: fc, radius: fc, index: fc })), - insideAsteroid: Oc(mu), - moveFrames: Oc(fc), - }), - yu = kc({ - type: _c("demon"), - runtime: Hc, - fistRuntime: Hc, - collisionFn: Hc, - blockCollisionFn: Hc, - minions: Oc(kc({ x: fc, y: fc, width: fc, height: fc, index: fc })), - allMinions: Oc( - kc({ x: fc, y: fc, width: fc, height: fc, index: fc }), - ), - fireballs: Oc( - kc({ x: fc, y: fc, width: fc, height: fc, index: fc }), - ), - allFireballs: Oc( - kc({ x: fc, y: fc, width: fc, height: fc, index: fc }), - ), + collectibles: fc, + score: Hc, // kc({ local: fc, total: fc, multiplier: fc, fullCombo: yc }), + bossState: Bc([hc, gu, fu, yu]), + switchButtons: kc({ on: yc, rot: fc }), + jumpSwitch: kc({ on: yc, ratio: fc, delay: fc, timeout: fc }), + switchBlockSpikes: yc, + checkpoint: kc({ index: fc, state: Hc }), + onObject: Bc([hc, kc({ array: Hc, index: fc, y: fc })]), + cameraXOffset: fc, + cameraY: fc, + crashed: yc, + finishedLevel: yc, + frameCountSinceHistoryPush: fc, + layoutState: pu, + playerScale: fc, + bgColor: mc, + flash: fc, + gravity: fc, + dashing: yc, + isGravity: Bc([Hc, yc, hc]), + fallTypes: Hc, //kc(Bc([hc, mc]), Bc([hc, mc])) + flyingAnchor: Bc([fc, hc]), + boosterDebug: Bc([kc({ autopilot: Hc, jumpIndicators: Hc }), hc]), }), - Eu = Ld({ - mappers: [ - () => { - throw Error( - "getDefaultData not supported for levelState storage", - ); + uncompress: (e) => e, + compress: (e) => + Object.assign(Object.assign({}, e), { + checkpoint: Object.assign(Object.assign({}, e.checkpoint), { + state: null, + }), + bossState: bu(e.bossState), + }), + }); + function bu(e) { + if (!e) return null; + switch (e.type) { + case "robot": + return null; + case "pixel": + case "flying": + return e; + case "demon": + return Object.assign(Object.assign({}, e), { + runtime: null, + fistRuntime: null, + collisionFn: null, + blockCollisionFn: null, + }); + } + } + const Su = Ld({ + mappers: [ + () => ["Player", []], + (e) => [e[0], e[1], 1], + (e) => [ + e[0], + e[1].map(([e, t, a, [i, n, s], o, r]) => [ + e, + t, + a, + [i, n, s ? [1, 0, s] : null], + o, + r, + ]), + e[2], + ], + (e) => [ + e[0], + e[1], + e[2], + [false, false, false, false, false, false], + ], + (e) => [e[1], e[2], e[3]], + (e) => [e[0].map((e) => [...e, 0, null]), e[1], e[2]], + (e) => [...e, []], + (e) => [e[0], e[1], [...e[2], 0], e[3]], + (e) => [e[0], e[1], [...e[2], false, false], e[3]], + (e) => [e[0], e[1], [...e[2], false], e[3]], + (e) => [e[0], e[1], [...e[2], false], e[3]], + (e) => [e[0], e[1], [...e[2], false, false], e[3]], + ], + finalSchema: Gc([ + Oc( + nd.tuple([ + mc, + fc, + fc, + Gc([yc, fc, Bc([hc, Gc([fc, fc, gc])])]), + Gc([yc, fc]), + fc, + fc, + Bc([hc, fc]), + ]), + ), + fc, + Bc([ + nd.tuple([ + yc, + yc, + yc, + yc, + yc, + yc, + fc, + yc, + yc, + yc, + yc, + yc, + yc, + yc, + yc, + yc, + yc, + ]), + nd.tuple([yc, yc, yc, yc, yc, yc, fc, yc, yc, yc, yc, yc, yc]), + nd.tuple([yc, yc, yc, yc, yc, yc, fc]), + ]), + Oc(Gc([mc, mc])), + ]), + uncompress: (e) => { + const [ + t, + a, + [ + i, + n, + s, + o, + r, + l, + c, + overlap, + tm, + mirror, + att, + glow, + flying, + debug, + release, + animate, + mouse, + ], + d, + ] = e; + return { + levelsProgress: t.map( + ([e, t, a, [i, n, s], [o, r], l, c, d]) => { + const u = Eu.jsonToData(s); + return { + levelName: e, + levelIndex: t, + world: a, + checkpoints: { + didFinish: i, + furthestFrame: n, + lastCheckpointState: u instanceof Error ? null : u.data, + }, + noCheckpoints: { didFinish: o, furthestFrame: r }, + highScore: l, + totalAttempts: c, + bestAttempts: d, + }; }, - (e) => + ), + lastOpenedWorld: a, + settings: { + plainBackground: i, + hidePlayerTrail: n, + muteJump: s, + muteSfx: o, + hideUi: r, + muteMenuMusic: l, + headphonesDelay: c, + overlapObjects: overlap || false, + tig1menu: tm || false, + mirrorMenuButton: mirror || false, + fadeOutAttempts: att || false, + hidePlayerGlow: glow || false, + flyingTrail: flying || false, + showDebug: debug || false, + disableReleaseBuffer: release || false, + animateEditor: animate || false, + hideMouseWhenPlaying: mouse || false, + }, + friendRequests: d.map(([e, t]) => ({ + playerName: t, + profileId: e, + })), + }; + }, + compress: (e) => [ + e.levelsProgress.map((e) => [ + e.levelName, + e.levelIndex, + e.world, + [ + e.checkpoints.didFinish, + e.checkpoints.furthestFrame, + e.checkpoints.lastCheckpointState && + Eu.dataToJson( + e.checkpoints.lastCheckpointState, + () => new Date(), + ), + ], + [e.noCheckpoints.didFinish, e.noCheckpoints.furthestFrame], + e.highScore, + e.totalAttempts, + e.bestAttempts, + ]), + e.lastOpenedWorld, + [ + e.settings.plainBackground, + e.settings.hidePlayerTrail, + e.settings.muteJump, + e.settings.muteSfx, + e.settings.hideUi, + e.settings.muteMenuMusic, + e.settings.headphonesDelay, + e.settings.overlapObjects || false, + e.settings.tig1menu || false, + e.settings.mirrorMenuButton || false, + e.settings.fadeOutAttempts || false, + e.settings.hidePlayerGlow || false, + e.settings.flyingTrail || false, + e.settings.showDebug || false, + e.settings.disableReleaseBuffer || false, + e.settings.animateEditor || false, + e.settings.hideMouseWhenPlaying || false, + ], + e.friendRequests.map((e) => [e.profileId, e.playerName]), + ], + }), + Iu = Object.assign(Object.assign({}, Su), { + merge: function (e, t) { + return { + levelsProgress: rt([ + ...e.levelsProgress.map((e) => e.levelName), + ...t.levelsProgress.map((e) => e.levelName), + ]).map((a) => { + const i = e.levelsProgress.find((e) => e.levelName === a), + n = t.levelsProgress.find((e) => e.levelName === a); + return i && n + ? Object.assign(Object.assign({}, i), { + checkpoints: { + didFinish: + i.checkpoints.didFinish || n.checkpoints.didFinish, + furthestFrame: Math.max( + i.checkpoints.furthestFrame, + n.checkpoints.furthestFrame, + ), + lastCheckpointState: + i.checkpoints.lastCheckpointState || + n.checkpoints.lastCheckpointState, + }, + noCheckpoints: { + didFinish: + i.noCheckpoints.didFinish || + n.noCheckpoints.didFinish, + furthestFrame: Math.max( + i.noCheckpoints.furthestFrame, + n.noCheckpoints.furthestFrame, + ), + }, + highScore: Math.max(i.highScore, n.highScore), + }) + : i || n; + }), + lastOpenedWorld: e.lastOpenedWorld, + settings: e.settings, + friendRequests: e.friendRequests, + }; + }, + removeCheckpointData: function (e) { + return Object.assign(Object.assign({}, e), { + levelsProgress: e.levelsProgress.map((e) => Object.assign(Object.assign({}, e), { - justHitSpringIndex: null, + checkpoints: Object.assign( + Object.assign({}, e.checkpoints), + { lastCheckpointState: null }, + ), }), - (e) => e, - (e) => + ), + }); + }, + removeNonSerialBossData: function (e) { + return Object.assign(Object.assign({}, e), { + levelsProgress: e.levelsProgress.map((e) => Object.assign(Object.assign({}, e), { - jumpSwitch: Object.assign(Object.assign({}, e.jumpSwitch), { - timeout: 0, - }), - }), - (e) => e, - (e) => { - var t; - return Object.assign(Object.assign({}, e), { - bossState: - "flying" === - (null === (t = e.bossState) || void 0 === t - ? void 0 - : t.type) - ? Object.assign(Object.assign({}, e.bossState), { - asteroids: e.bossState.asteroids.map((e, t) => - Object.assign(Object.assign({}, e), { index: t }), - ), - allAsteroids: e.bossState.allAsteroids.map((e, t) => - Object.assign(Object.assign({}, e), { index: t }), - ), - insideAsteroid: e.bossState.insideAsteroid.map( - (e, t) => - Object.assign(Object.assign({}, e), { index: t }), - ), - allInsideAsteroid: e.bossState.allInsideAsteroid.map( - (e, t) => - Object.assign(Object.assign({}, e), { index: t }), + checkpoints: Object.assign( + Object.assign({}, e.checkpoints), + { + lastCheckpointState: + null === e.checkpoints.lastCheckpointState + ? null + : Object.assign( + Object.assign( + {}, + e.checkpoints.lastCheckpointState, + ), + { + bossState: bu( + e.checkpoints.lastCheckpointState.bossState, + ), + }, ), - }) - : e.bossState, - }); - }, - (e) => - Object.assign(Object.assign({}, e), { - switchBlockSpikes: false, - playerSpeedMultiplier: 1, - justHitObject: null, - layoutState: Object.assign(Object.assign({}, e.layoutState), { - blocks: e.layoutState.blocks.map((e) => - Object.assign(Object.assign({}, e), { - type: "blockSpikeState", - }), - ), - spikes: e.layoutState.spikes.map((e) => - Object.assign(Object.assign({}, e), { - type: "blockSpikeState", - }), - ), - speedChanges: [], - }), - }), - (e) => - Object.assign(Object.assign({}, e), { - gravity: 1, - }), - (e) => - Object.assign(Object.assign({}, e), { - isCompatible: true, - }), - (e) => - Object.assign(Object.assign({}, e), { - dashing: false, - isGravity: false, - bullets: e.bullets.map((bullet) => ({ ...bullet, frame: 0 })), - }), - (e) => - Object.assign(Object.assign({}, e), { - playerStacks: e.playerStacks.map((stack) => - Object.assign(Object.assign({}, stack), { onObject: null }), + }, ), }), - (e) => - Object.assign(Object.assign({}, e), { - layoutState: Object.assign(Object.assign({}, e.layoutState), { - enemies: Object.assign(e.layoutState.enemies, { - speedY: 0, - }), - }), - }), - (e) => - Object.assign(Object.assign({}, e), { - fallTypes: [null, null], - }), - (e) => - Object.assign(Object.assign({}, e), { - flyingAnchor: null, - }), - (e) => - Object.assign(Object.assign({}, e), { - playerPowerups: e.playerPowerup ? [e.playerPowerup] : [], - }), - (e) => - Object.assign(Object.assign({}, e), { - boosterDebug: { - autopilot: {}, - jumpIndicators: [] - } - }), - ], - finalSchema: kc({ - frame: fc, - attempt: fc, - jumping: yc, - justDownInputTimer: fc, - playerX: fc, - playerY: fc, - playerOnGroundY: fc, - playerWasOnGroundCooldown: fc, - playerGradY: fc, - playerRot: fc, - playerScaleX: fc, - playerScaleY: fc, - playerDir: Bc([_c(1), _c(-1)]), - playerSpeedMultiplier: fc, - playerPowerups: Oc(Bc([hc, cu])), - isCompatible: yc, - playerJetpackFuel: fc, - playerUsingPowerup: yc, - playerBullets: Oc(du), - playerStacks: Oc( - kc({ - y: fc, - gradY: fc, - onObject: Bc([hc, kc({ array: Hc, index: fc, y: fc })]), - }), ), - playerStackIndex: fc, - explosions: Oc(kc({ x: fc, y: fc, framesLeft: fc })), - touchingPortals: Bc([hc, Gc([uu, uu])]), - justHitObject: Bc([ - hc, + }); + }, + }), + _u = JSON.parse( + '[{"id":"8_bit_adventure_checkpoints","name":"Beat 8 Bit Adventure","unlocked":false,"category":"bronze","rewards":{"collected":false,"blocks":10,"items":[{"name":"Walking Enemies in Level Editor","blocksPrice":0,"defId":"editor_walking_enemy"},{"name":"Pixel Skin","blocksPrice":0,"defId":"skin_pixel"}]}},{"id":"accelerated_checkpoints","name":"Beat Accelerated","unlocked":false,"category":"bronze","rewards":{"collected":false,"blocks":10,"items":[{"name":"Synthwave Theme","blocksPrice":0,"defId":"theme_synthwave"}]}},{"id":"accelerated_nocheckpoints","name":"Beat Accelerated without checkpoints","unlocked":false,"category":"bronze","rewards":{"collected":false,"blocks":10,"items":[{"name":"Glow Skin","blocksPrice":0,"defId":"skin_glow"}]}},{"id":"awake_checkpoints","name":"Beat Awake","unlocked":false,"category":"bronze","rewards":{"collected":false,"blocks":10,"items":[{"name":"Portals in Level Editor","blocksPrice":0,"defId":"editor_portals"},{"name":"World 4 Theme","blocksPrice":0,"defId":"theme_world4"}]}},{"id":"blythe_checkpoints","name":"Beat Blythe","unlocked":false,"category":"bronze","rewards":{"collected":false,"blocks":10,"items":[{"name":"Springs in Level Editor","blocksPrice":0,"defId":"editor_spring"},{"name":"Falling Platforms in Level Editor","blocksPrice":0,"defId":"editor_falling_platform"}]}},{"id":"breathe_checkpoints","name":"Beat Breathe","unlocked":false,"category":"bronze","rewards":{"collected":false,"blocks":10,"items":[{"name":"Jetpack in Level Editor","blocksPrice":0,"defId":"editor_jetpack"},{"name":"1 Missile Booster","blocksPrice":0,"defId":"missiles1"}]}},{"id":"cloud_9_checkpoints","name":"Beat Cloud 9","unlocked":false,"category":"bronze","rewards":{"collected":false,"blocks":10,"items":[{"name":"Skateboard and Rails in Level Editor","blocksPrice":0,"defId":"editor_skateboard"}]}},{"id":"coincidence_checkpoints","name":"Beat Coincidence","unlocked":false,"category":"bronze","rewards":{"collected":false,"blocks":10,"items":[{"name":"World 4 Skin","blocksPrice":0,"defId":"skin_world4"},{"name":"1 Slow Motion Booster","blocksPrice":0,"defId":"slowmo1"}]}},{"id":"critical_hit_checkpoints","name":"Beat Critical Hit","unlocked":false,"category":"bronze","rewards":{"collected":false,"blocks":10,"items":[{"name":"World 2 Theme","blocksPrice":0,"defId":"theme_world2"}]}},{"id":"dragonfly_checkpoints","name":"Beat Dragonfly","unlocked":false,"category":"bronze","rewards":{"collected":false,"blocks":10,"items":[{"name":"Saws in Level Editor","blocksPrice":0,"defId":"editor_saws"},{"name":"1 Slow Motion Booster","blocksPrice":0,"defId":"slowmo1"}]}},{"id":"dragonfly_nocheckpoints","name":"Beat Dragonfly without checkpoints","unlocked":false,"category":"bronze","rewards":{"collected":false,"blocks":10,"items":[{"name":"Cloud 9 Bonus Level","blocksPrice":0,"defId":"bonus_level_cloud9"}]}},{"id":"frontier_checkpoints","name":"Beat Frontier","unlocked":false,"category":"bronze","rewards":{"collected":false,"blocks":10,"items":[{"name":"Switch Button and Platform in Level Editor","blocksPrice":0,"defId":"editor_switch_button"},{"name":"1 Slow Motion Booster","blocksPrice":0,"defId":"slowmo1"}]}},{"id":"indestructable_checkpoints","name":"Beat Indestructable","unlocked":false,"category":"bronze","rewards":{"collected":false,"blocks":10,"items":[{"name":"World 1 Boss Theme","blocksPrice":0,"defId":"theme_world1Boss"}]}},{"id":"lighthouse_checkpoints","name":"Beat Lighthouse","unlocked":false,"category":"bronze","rewards":{"collected":false,"blocks":10,"items":[{"name":"Player Stacks in Level Editor","blocksPrice":0,"defId":"editor_player_stacks"},{"name":"1 Missile Booster","blocksPrice":0,"defId":"missiles1"}]}},{"id":"octane_checkpoints","name":"Beat Octane","unlocked":false,"category":"bronze","rewards":{"collected":false,"blocks":10,"items":[{"name":"Gun in Level Editor","blocksPrice":0,"defId":"editor_gun"},{"name":"1 Missile Booster","blocksPrice":0,"defId":"missiles1"}]}},{"id":"sky_fracture_checkpoints","name":"Beat Sky Fracture","unlocked":false,"category":"bronze","rewards":{"collected":false,"blocks":10,"items":[{"name":"Spaceship Skin","blocksPrice":0,"defId":"skin_spaceship"},{"name":"World 3 Theme","blocksPrice":0,"defId":"theme_world3"}]}},{"id":"solace_checkpoints","name":"Beat Solace","unlocked":false,"category":"bronze","rewards":{"collected":false,"blocks":10,"items":[{"name":"Double Jump in Level Editor","blocksPrice":0,"defId":"editor_double_jump"},{"name":"1 Missile Booster","blocksPrice":0,"defId":"missiles1"}]}},{"id":"solace_nocheckpoints","name":"Beat Solace without checkpoints","unlocked":false,"category":"bronze","rewards":{"collected":false,"blocks":10,"items":[{"name":"Dino Skin","blocksPrice":0,"defId":"skin_dino"}]}},{"id":"think_different_checkpoints","name":"Beat Think Different","unlocked":false,"category":"bronze","rewards":{"collected":false,"blocks":10,"items":[{"name":"Move on Jump in Level Editor","blocksPrice":0,"defId":"editor_move_on_jump"},{"name":"1 Missile Booster","blocksPrice":0,"defId":"missiles1"}]}},{"id":"xp_rank10","name":"Reach Level 10 online","unlocked":true,"category":"bronze","rewards":{"collected":false,"blocks":10,"items":[{"name":"Chicken Skin","blocksPrice":0,"defId":"skin_chicken"}]}},{"id":"cloud_9_high_score","name":"Score 200,000 beating Cloud 9","unlocked":false,"category":"bronze","rewards":{"collected":false,"blocks":10,"items":[{"name":"Skater Theme","blocksPrice":0,"defId":"theme_skater"}]}},{"id":"accelerated_avoid_collectibles","name":"Avoid all Collectibles in Accelerated","unlocked":false,"category":"silver","rewards":{"collected":false,"blocks":20,"items":[{"name":"Green Bot Skin","blocksPrice":0,"defId":"skin_greenbot"}]}},{"id":"8_bit_adventure_nocheckpoints","name":"Beat 8 Bit Adventure without checkpoints","unlocked":false,"category":"silver","rewards":{"collected":false,"blocks":20,"items":[{"name":"Pixel Cheese Skin","blocksPrice":0,"defId":"skin_pixelcheese"}]}},{"id":"awake_nocheckpoints","name":"Beat Awake without checkpoints","unlocked":false,"category":"silver","rewards":{"collected":false,"blocks":20,"items":[{"name":"Mushroom Skin","blocksPrice":0,"defId":"skin_mushroom"}]}},{"id":"blythe_nocheckpoints","name":"Beat Blythe without checkpoints","unlocked":false,"category":"silver","rewards":{"collected":false,"blocks":20,"items":[{"name":"Worm Skin","blocksPrice":0,"defId":"skin_worm"}]}},{"id":"breathe_nocheckpoints","name":"Beat Breathe without checkpoints","unlocked":false,"category":"silver","rewards":{"collected":false,"blocks":20,"items":[{"name":"Pixel Robot Skin","blocksPrice":0,"defId":"skin_pixelrobot"}]}},{"id":"cloud_9_nocheckpoints","name":"Beat Cloud 9 without checkpoints","unlocked":false,"category":"silver","rewards":{"collected":false,"blocks":20,"items":[{"name":"Skater Skin","blocksPrice":0,"defId":"skin_skater"}]}},{"id":"coincidence_nocheckpoints","name":"Beat Coincidence without checkpoints","unlocked":false,"category":"silver","rewards":{"collected":false,"blocks":20,"items":[{"name":"Burger Skin","blocksPrice":0,"defId":"skin_burger"}]}},{"id":"critical_hit_nocheckpoints","name":"Beat Critical Hit without checkpoints","unlocked":false,"category":"silver","rewards":{"collected":false,"blocks":20,"items":[{"name":"Boss 2 Skin","blocksPrice":0,"defId":"skin_boss2"}]}},{"id":"dark_sheep_checkpoints","name":"Beat Dark Sheep","unlocked":false,"category":"silver","rewards":{"collected":false,"blocks":20,"items":[{"name":"Flying Enemies in Level Editor","blocksPrice":0,"defId":"editor_flying_enemy"},{"name":"World 2 Red Theme","blocksPrice":0,"defId":"theme_world2Red"}]}},{"id":"frontier_nocheckpoints","name":"Beat Frontier without checkpoints","unlocked":false,"category":"silver","rewards":{"collected":false,"blocks":20,"items":[{"name":"Machine Skin","blocksPrice":0,"defId":"skin_machine"}]}},{"id":"indestructable_nocheckpoints","name":"Beat Indestructable without checkpoints","unlocked":false,"category":"silver","rewards":{"collected":false,"blocks":20,"items":[{"name":"Boss 1 Skin","blocksPrice":0,"defId":"skin_boss1"}]}},{"id":"lighthouse_nocheckpoints","name":"Beat Lighthouse without checkpoints","unlocked":false,"category":"silver","rewards":{"collected":false,"blocks":20,"items":[{"name":"Alien Skin","blocksPrice":0,"defId":"skin_alien"}]}},{"id":"mutant_checkpoints","name":"Beat Mutant","unlocked":false,"category":"silver","rewards":{"collected":false,"blocks":20,"items":[{"name":"Bull Skin","blocksPrice":0,"defId":"skin_bull"},{"name":"World 4 Red Theme","blocksPrice":0,"defId":"theme_world4Red"}]}},{"id":"octane_nocheckpoints","name":"Beat Octane without checkpoints","unlocked":false,"category":"silver","rewards":{"collected":false,"blocks":20,"items":[{"name":"Pixel Skull Skin","blocksPrice":0,"defId":"skin_pixelskull"}]}},{"id":"overdrive_checkpoints","name":"Beat Overdrive","unlocked":false,"category":"silver","rewards":{"collected":false,"blocks":20,"items":[{"name":"World 4 Boss Theme","blocksPrice":0,"defId":"theme_world4Boss"}]}},{"id":"polymorph_checkpoints","name":"Beat Polymorph","unlocked":false,"category":"silver","rewards":{"collected":false,"blocks":20,"items":[{"name":"Yak Skin","blocksPrice":0,"defId":"skin_yak"},{"name":"World 3 Red Theme","blocksPrice":0,"defId":"theme_world3Red"}]}},{"id":"sky_fracture_nocheckpoints","name":"Beat Sky Fracture without checkpoints","unlocked":false,"category":"silver","rewards":{"collected":false,"blocks":20,"items":[{"name":"Boss 3 Skin","blocksPrice":0,"defId":"skin_boss3"}]}},{"id":"solar_abyss_checkpoints","name":"Beat Solar Abyss","unlocked":false,"category":"silver","rewards":{"collected":false,"blocks":20,"items":[{"name":"World 1 Red Theme","blocksPrice":0,"defId":"theme_virtual"},{"name":"1 Autopilot Booster","blocksPrice":0,"defId":"autopilot1"}]}},{"id":"think_different_nocheckpoints","name":"Beat Think Different without checkpoints","unlocked":false,"category":"silver","rewards":{"collected":false,"blocks":20,"items":[{"name":"Monkey Skin","blocksPrice":0,"defId":"skin_monkey"}]}},{"id":"accelerated_collectibles","name":"Picked up all 75 Collectibles beating Accelerated","unlocked":false,"category":"silver","rewards":{"collected":false,"blocks":20,"items":[{"name":"Collectibles in Level Editor","blocksPrice":0,"defId":"editor_collectibles"}]}},{"id":"xp_rank100","name":"Reach Level 100 online","unlocked":false,"category":"silver","rewards":{"collected":false,"blocks":20,"items":[{"name":"Dog Skin","blocksPrice":0,"defId":"skin_dog"}]}},{"id":"cloud_9_very_high_score","name":"Score 1,000,000 beating Cloud 9","unlocked":false,"category":"silver","rewards":{"collected":false,"blocks":20,"items":[{"name":"Mr Cool Skin","blocksPrice":0,"defId":"skin_mrcool"}]}},{"id":"all_bronze_achievements","name":"Unlocked All Bronze Achievements","unlocked":false,"category":"silver","rewards":{"collected":false,"blocks":20,"items":[{"name":"Parrot Skin","blocksPrice":0,"defId":"skin_parrot"}]}},{"id":"dark_sheep_nocheckpoints","name":"Beat Dark Sheep without checkpoints","unlocked":false,"category":"gold","rewards":{"collected":false,"blocks":60,"items":[{"name":"Pixel Crown Skin","blocksPrice":0,"defId":"skin_pixelcrown"}]}},{"id":"mutant_nocheckpoints","name":"Beat Mutant without checkpoints","unlocked":false,"category":"gold","rewards":{"collected":false,"blocks":60,"items":[{"name":"Knight Skin","blocksPrice":0,"defId":"skin_knight"}]}},{"id":"overdrive_nocheckpoints","name":"Beat Overdrive without checkpoints","unlocked":false,"category":"gold","rewards":{"collected":false,"blocks":60,"items":[{"name":"Boss 4 Skin","blocksPrice":0,"defId":"skin_boss4"}]}},{"id":"polymorph_nocheckpoints","name":"Beat Polymorph without checkpoints","unlocked":false,"category":"gold","rewards":{"collected":false,"blocks":60,"items":[{"name":"Mummy Skin","blocksPrice":0,"defId":"skin_mummy"}]}},{"id":"solar_abyss_nocheckpoints","name":"Beat Solar Abyss without checkpoints","unlocked":false,"category":"gold","rewards":{"collected":false,"blocks":60,"items":[{"name":"Samurai Skin","blocksPrice":0,"defId":"skin_samurai"}]}},{"id":"all_silver_achievements","name":"Unlocked All Silver Achievements","unlocked":false,"category":"gold","rewards":{"collected":false,"blocks":60,"items":[{"name":"Superhero Skin","blocksPrice":0,"defId":"skin_superhero"}]}},{"id":"aura_checkpoints","name":"Beat Aura","unlocked":false,"category":"levelPack","rewards":{"collected":false,"blocks":0,"items":[{"name":"Speed Change in Level Editor","blocksPrice":0,"defId":"editor_speed_change"},{"name":"Moon Theme","blocksPrice":0,"defId":"theme_speed"}]}},{"id":"aura_nocheckpoints","name":"Beat Aura without checkpoints","unlocked":false,"category":"levelPack","rewards":{"collected":false,"blocks":0,"items":[{"name":"Astronaut Skin","blocksPrice":0,"defId":"skin_space"}]}},{"id":"cool_friends_checkpoints","name":"Beat Cool Friends","unlocked":false,"category":"levelPack","rewards":{"collected":false,"blocks":0,"items":[{"name":"Punch in Level Editor","blocksPrice":0,"defId":"editor_punch"},{"name":"Giant Enemy in Level Editor","blocksPrice":0,"defId":"editor_giant_enemy"}]}},{"id":"cool_friends_nocheckpoints","name":"Beat Cool Friends without checkpoints","unlocked":false,"category":"levelPack","rewards":{"collected":false,"blocks":0,"items":[{"name":"Fighter Theme","blocksPrice":0,"defId":"theme_fighter"},{"name":"Fighter Skin","blocksPrice":0,"defId":"skin_fighter"}]}},{"id":"for_you_checkpoints","name":"Beat For You","unlocked":false,"category":"levelPack","rewards":{"collected":false,"blocks":0,"items":[{"name":"Switch Block Spikes in Level Editor","blocksPrice":0,"defId":"editor_switch_block_spike"},{"name":"Dreamy Theme","blocksPrice":0,"defId":"theme_dreamy"}]}},{"id":"for_you_nocheckpoints","name":"Beat For You without checkpoints","unlocked":false,"category":"levelPack","rewards":{"collected":false,"blocks":0,"items":[{"name":"Dreamy Skin","blocksPrice":0,"defId":"skin_dreamy"}]}},{"id":"nacreous_snowmelt_checkpoints","name":"Beat Nacreous Snowmelt","unlocked":false,"category":"levelPack","rewards":{"collected":false,"blocks":0,"items":[{"name":"Arrows in Level Editor","blocksPrice":0,"defId":"editor_arrows"}]}},{"id":"nacreous_snowmelt_nocheckpoints","name":"Beat Nacreous Snowmelt without checkpoints","unlocked":false,"category":"levelPack","rewards":{"collected":false,"blocks":0,"items":[{"name":"Arrows Theme","blocksPrice":0,"defId":"theme_arrows"}]}},{"id":"nacreous_snowmelt_high_score","name":"Score 600,000 beating Nacreous Snowmelt","unlocked":false,"category":"levelPack","rewards":{"collected":false,"blocks":0,"items":[{"name":"Outline Skin","blocksPrice":0,"defId":"skin_arrows"}]}}]', + ), + vu = Ld({ + mappers: [ + () => ({ auth: { type: "none" } }), + (e) => + "apple" === e.auth.type + ? Object.assign(Object.assign({}, e), { + auth: { type: "apple" }, + }) + : e, + (e) => + Object.assign(Object.assign({}, e), { + offlineCache: { achievements: [] }, + }), + (e) => + Object.assign(Object.assign({}, e), { + hasRegisteredNotifications: false, + }), + (e) => + Object.assign(Object.assign({}, e), { + hasAskedForReview: false, + }), + (e) => + Object.assign(Object.assign({}, e), { + hasVisitedSuperLevelPack: false, + offlineCache: { achievements: _u }, + }), + (e) => + Object.assign(Object.assign({}, e), { + auth: + "apple" === e.auth.type + ? { type: "apple", id: "" } + : "google" === e.auth.type + ? { type: "google", id: "" } + : e.auth, + }), + ], + finalSchema: kc({ + auth: Bc([ + kc({ type: _c("none") }), + kc({ type: _c("anon") }), + kc({ type: _c("google"), id: mc }), + kc({ type: _c("apple"), id: mc }), + ]), + offlineCache: kc({ + achievements: Oc( kc({ - array: Bc([ - _c("springs"), - _c("speedChanges"), - _c("switchButtons"), + id: mc, + name: mc, + unlocked: yc, + category: Bc([ + _c("bronze"), + _c("silver"), + _c("gold"), + _c("levelPack"), ]), - index: fc, - }), - ]), - skateboardJumpCharge: fc, - bottomLine: Bc([ - hc, - kc({ - minY: fc, - objects: Oc( - kc({ type: mc, x: fc, y: fc, width: fc, height: fc }), - ), + rewards: kc({ + collected: yc, + blocks: fc, + items: Oc(kc({ name: mc, blocksPrice: fc, defId: mc })), + }), }), - ]), - collectibles: fc, - score: Hc, // kc({ local: fc, total: fc, multiplier: fc, fullCombo: yc }), - bossState: Bc([hc, gu, fu, yu]), - switchButtons: kc({ on: yc, rot: fc }), - jumpSwitch: kc({ on: yc, ratio: fc, delay: fc, timeout: fc }), - switchBlockSpikes: yc, - checkpoint: kc({ index: fc, state: Hc }), - onObject: Bc([hc, kc({ array: Hc, index: fc, y: fc })]), - cameraXOffset: fc, - cameraY: fc, - crashed: yc, - finishedLevel: yc, - frameCountSinceHistoryPush: fc, - layoutState: pu, - playerScale: fc, - bgColor: mc, - flash: fc, - gravity: fc, - dashing: yc, - isGravity: Bc([Hc, yc, hc]), - fallTypes: Hc, //kc(Bc([hc, mc]), Bc([hc, mc])) - flyingAnchor: Bc([fc, hc]), - boosterDebug: Bc([kc({ autopilot: Hc, jumpIndicators: Hc }), hc]), + ), }), - uncompress: (e) => e, - compress: (e) => - Object.assign(Object.assign({}, e), { - checkpoint: Object.assign(Object.assign({}, e.checkpoint), { - state: null, - }), - bossState: bu(e.bossState), + hasRegisteredNotifications: Bc([_c(false), fc]), + hasAskedForReview: yc, + hasVisitedSuperLevelPack: yc, + }), + uncompress: (e) => e, + compress: (e) => e, + }), + Tu = kc({ + viewOffset: kc({ x: fc, y: fc, scale: fc }), + runHistory: Oc(Gc([fc, fc, gc])), + runHistoryIndex: fc, + }), + Ru = Ld({ + mappers: [() => ({})], + finalSchema: Lc(mc, Bc([pc, Tu])), + uncompress: (e) => { + const t = {}; + return ( + Object.entries(e).forEach(([e, a]) => { + if (!a) return; + const i = a.runHistory + .map((e) => { + const t = Eu.jsonToData(e); + return t instanceof Error ? null : t.data; + }) + .filter(nt); + 0 !== i.length && + (t[e] = Object.assign(Object.assign({}, a), { + runHistory: i, + })); }), - }); - function bu(e) { - if (!e) return null; - switch (e.type) { - case "robot": + t + ); + }, + compress: (e) => { + const t = {}; + return ( + Object.entries(e).forEach(([e, a]) => { + if (!a) return; + const i = a.runHistory.map((e) => + Eu.dataToJson(e, () => new Date()), + ); + t[e] = Object.assign(Object.assign({}, a), { runHistory: i }); + }), + t + ); + }, + }), + Ou = Oc( + kc({ + type: _c("completedLevel"), + levelFileName: mc, + isCheckpoints: yc, + collectibles: fc, + highScore: fc, + }), + ), + Cu = function (e) { + return (function (e, t, a) { + return Pd( + t.decode(e), + ac(() => (console.error("Outdated requests schema"), [])), + ); + })(e, Ou); + }, + wu = JSON.parse( + '[{"itemId":"4970130c-e2e6-4645-b0fc-4e9f725cef6a","defId":"slowmo1","quantity":1,"usesLeft":3,"version":1},{"itemId":"5bf96b70-cd18-41c4-8323-c64623da8517","defId":"autopilot1","quantity":1,"usesLeft":3,"version":1},{"itemId":"d74933fe-9d90-4e26-96ec-2578764a8437","defId":"missiles1","quantity":1,"usesLeft":3,"version":1}]', + ); + var Au = a(8465); + const ku = "1.2.6"; + function Nu(e) { + return 20 * Math.pow(e - 1, 1.3); + } + const xu = function (e) { + const t = (function (e) { + const t = Math.max(e, 0); + return Math.floor(Math.pow(t / 20, 1 / 1.3) + 1); + })(e), + a = Nu(t); + return { rank: t, rankPercent: (e - a) / (Nu(t + 1) - a) }; + }, + Pu = () => ({ type: "autopilot", playerInput: "up" }), + Mu = () => ({ type: "missiles" }), + Lu = () => ({ type: "slowmo" }), + canUseMissiles = function (e) { + return ( + null !== e.boss || + !!e.layout.switchButtons.some((e) => "blockSpike" === e.affects) + ); + }, + Bu = function (e) { + switch (e) { + case "editor_double_jump": + return "doubleJump"; + case "editor_flying_enemy": + return "flyingEnemy"; + case "editor_gun": + return "gun"; + case "editor_jetpack": + return "jetpack"; + case "editor_move_on_jump": + return "moveOnJump"; + case "editor_saws": + return "saws"; + case "editor_walking_enemy": + return "walkingEnemy"; + case "editor_switch_button": + return "switchButton"; + case "editor_player_stacks": + return "playerStacks"; + case "editor_collectibles": + return "collectible"; + case "editor_spring": + return "spring"; + case "editor_falling_platform": + return "fallingPlatform"; + case "editor_portals": + return "portals"; + case "editor_skateboard": + return "skateboard"; + case "editor_switch_block_spike": + return "switchBlockSpike"; + case "editor_punch": + return "punch"; + case "editor_giant_enemy": + return "giantEnemy"; + case "editor_speed_change": + return "speedChange"; + case "editor_arrows": + return "arrows"; + default: return null; - case "pixel": - case "flying": - return e; - case "demon": - return Object.assign(Object.assign({}, e), { - runtime: null, - fistRuntime: null, - collisionFn: null, - blockCollisionFn: null, - }); } - } - const Su = Ld({ - mappers: [ - () => ["Player", []], - (e) => [e[0], e[1], 1], - (e) => [ - e[0], - e[1].map(([e, t, a, [i, n, s], o, r]) => [ - e, - t, - a, - [i, n, s ? [1, 0, s] : null], - o, - r, - ]), - e[2], - ], - (e) => [ - e[0], - e[1], - e[2], - [false, false, false, false, false, false], - ], - (e) => [e[1], e[2], e[3]], - (e) => [e[0].map((e) => [...e, 0, null]), e[1], e[2]], - (e) => [...e, []], - (e) => [e[0], e[1], [...e[2], 0], e[3]], - (e) => [e[0], e[1], [...e[2], false, false], e[3]], - (e) => [e[0], e[1], [...e[2], false], e[3]], - (e) => [e[0], e[1], [...e[2], false], e[3]], - (e) => [e[0], e[1], [...e[2], false, false], e[3]], - ], - finalSchema: Gc([ - Oc( - nd.tuple([ - mc, - fc, - fc, - Gc([yc, fc, Bc([hc, Gc([fc, fc, gc])])]), - Gc([yc, fc]), - fc, - fc, - Bc([hc, fc]), - ]), - ), - fc, - Bc([ - nd.tuple([ - yc, - yc, - yc, - yc, - yc, - yc, - fc, - yc, - yc, - yc, - yc, - yc, - yc, - yc, - yc, - yc, - yc, - ]), - nd.tuple([yc, yc, yc, yc, yc, yc, fc, yc, yc, yc, yc, yc, yc]), - nd.tuple([yc, yc, yc, yc, yc, yc, fc]), - ]), - Oc(Gc([mc, mc])), - ]), - uncompress: (e) => { - const [ - t, - a, - [ - i, - n, - s, - o, - r, - l, - c, - overlap, - tm, - mirror, - att, - glow, - flying, - debug, - release, - animate, - ], - d, - ] = e; - return { - levelsProgress: t.map( - ([e, t, a, [i, n, s], [o, r], l, c, d]) => { - const u = Eu.jsonToData(s); - return { - levelName: e, - levelIndex: t, - world: a, - checkpoints: { - didFinish: i, - furthestFrame: n, - lastCheckpointState: u instanceof Error ? null : u.data, - }, - noCheckpoints: { didFinish: o, furthestFrame: r }, - highScore: l, - totalAttempts: c, - bestAttempts: d, - }; - }, - ), - lastOpenedWorld: a, - settings: { - plainBackground: i, - hidePlayerTrail: n, - muteJump: s, - muteSfx: o, - hideUi: r, - muteMenuMusic: l, - headphonesDelay: c, - overlapObjects: overlap || false, - tig1menu: tm || false, - mirrorMenuButton: mirror || false, - fadeOutAttempts: att || false, - hidePlayerGlow: glow || false, - flyingTrail: flying || false, - showDebug: debug || false, - disableReleaseBuffer: release || false, - animateEditor: animate || false, - }, - friendRequests: d.map(([e, t]) => ({ - playerName: t, - profileId: e, - })), - }; - }, - compress: (e) => [ - e.levelsProgress.map((e) => [ - e.levelName, - e.levelIndex, - e.world, - [ - e.checkpoints.didFinish, - e.checkpoints.furthestFrame, - e.checkpoints.lastCheckpointState && - Eu.dataToJson( - e.checkpoints.lastCheckpointState, - () => new Date(), - ), - ], - [e.noCheckpoints.didFinish, e.noCheckpoints.furthestFrame], - e.highScore, - e.totalAttempts, - e.bestAttempts, - ]), - e.lastOpenedWorld, - [ - e.settings.plainBackground, - e.settings.hidePlayerTrail, - e.settings.muteJump, - e.settings.muteSfx, - e.settings.hideUi, - e.settings.muteMenuMusic, - e.settings.headphonesDelay, - e.settings.overlapObjects || false, - e.settings.tig1menu || false, - e.settings.mirrorMenuButton || false, - e.settings.fadeOutAttempts || false, - e.settings.hidePlayerGlow || false, - e.settings.flyingTrail || false, - e.settings.showDebug || false, - e.settings.disableReleaseBuffer || false, - e.settings.animateEditor || false, - false, - ], - e.friendRequests.map((e) => [e.profileId, e.playerName]), - ], - }), - Iu = Object.assign(Object.assign({}, Su), { - merge: function (e, t) { - return { - levelsProgress: rt([ - ...e.levelsProgress.map((e) => e.levelName), - ...t.levelsProgress.map((e) => e.levelName), - ]).map((a) => { - const i = e.levelsProgress.find((e) => e.levelName === a), - n = t.levelsProgress.find((e) => e.levelName === a); - return i && n - ? Object.assign(Object.assign({}, i), { - checkpoints: { - didFinish: - i.checkpoints.didFinish || n.checkpoints.didFinish, - furthestFrame: Math.max( - i.checkpoints.furthestFrame, - n.checkpoints.furthestFrame, - ), - lastCheckpointState: - i.checkpoints.lastCheckpointState || - n.checkpoints.lastCheckpointState, - }, - noCheckpoints: { - didFinish: - i.noCheckpoints.didFinish || - n.noCheckpoints.didFinish, - furthestFrame: Math.max( - i.noCheckpoints.furthestFrame, - n.noCheckpoints.furthestFrame, - ), - }, - highScore: Math.max(i.highScore, n.highScore), - }) - : i || n; - }), - lastOpenedWorld: e.lastOpenedWorld, - settings: e.settings, - friendRequests: e.friendRequests, - }; - }, - removeCheckpointData: function (e) { - return Object.assign(Object.assign({}, e), { - levelsProgress: e.levelsProgress.map((e) => - Object.assign(Object.assign({}, e), { - checkpoints: Object.assign( - Object.assign({}, e.checkpoints), - { lastCheckpointState: null }, - ), - }), - ), - }); - }, - removeNonSerialBossData: function (e) { - return Object.assign(Object.assign({}, e), { - levelsProgress: e.levelsProgress.map((e) => - Object.assign(Object.assign({}, e), { - checkpoints: Object.assign( - Object.assign({}, e.checkpoints), - { - lastCheckpointState: - null === e.checkpoints.lastCheckpointState - ? null - : Object.assign( - Object.assign( - {}, - e.checkpoints.lastCheckpointState, - ), - { - bossState: bu( - e.checkpoints.lastCheckpointState.bossState, - ), - }, - ), - }, - ), - }), - ), - }); - }, - }), - _u = JSON.parse( - '[{"id":"8_bit_adventure_checkpoints","name":"Beat 8 Bit Adventure","unlocked":false,"category":"bronze","rewards":{"collected":false,"blocks":10,"items":[{"name":"Walking Enemies in Level Editor","blocksPrice":0,"defId":"editor_walking_enemy"},{"name":"Pixel Skin","blocksPrice":0,"defId":"skin_pixel"}]}},{"id":"accelerated_checkpoints","name":"Beat Accelerated","unlocked":false,"category":"bronze","rewards":{"collected":false,"blocks":10,"items":[{"name":"Synthwave Theme","blocksPrice":0,"defId":"theme_synthwave"}]}},{"id":"accelerated_nocheckpoints","name":"Beat Accelerated without checkpoints","unlocked":false,"category":"bronze","rewards":{"collected":false,"blocks":10,"items":[{"name":"Glow Skin","blocksPrice":0,"defId":"skin_glow"}]}},{"id":"awake_checkpoints","name":"Beat Awake","unlocked":false,"category":"bronze","rewards":{"collected":false,"blocks":10,"items":[{"name":"Portals in Level Editor","blocksPrice":0,"defId":"editor_portals"},{"name":"World 4 Theme","blocksPrice":0,"defId":"theme_world4"}]}},{"id":"blythe_checkpoints","name":"Beat Blythe","unlocked":false,"category":"bronze","rewards":{"collected":false,"blocks":10,"items":[{"name":"Springs in Level Editor","blocksPrice":0,"defId":"editor_spring"},{"name":"Falling Platforms in Level Editor","blocksPrice":0,"defId":"editor_falling_platform"}]}},{"id":"breathe_checkpoints","name":"Beat Breathe","unlocked":false,"category":"bronze","rewards":{"collected":false,"blocks":10,"items":[{"name":"Jetpack in Level Editor","blocksPrice":0,"defId":"editor_jetpack"},{"name":"1 Missile Booster","blocksPrice":0,"defId":"missiles1"}]}},{"id":"cloud_9_checkpoints","name":"Beat Cloud 9","unlocked":false,"category":"bronze","rewards":{"collected":false,"blocks":10,"items":[{"name":"Skateboard and Rails in Level Editor","blocksPrice":0,"defId":"editor_skateboard"}]}},{"id":"coincidence_checkpoints","name":"Beat Coincidence","unlocked":false,"category":"bronze","rewards":{"collected":false,"blocks":10,"items":[{"name":"World 4 Skin","blocksPrice":0,"defId":"skin_world4"},{"name":"1 Slow Motion Booster","blocksPrice":0,"defId":"slowmo1"}]}},{"id":"critical_hit_checkpoints","name":"Beat Critical Hit","unlocked":false,"category":"bronze","rewards":{"collected":false,"blocks":10,"items":[{"name":"World 2 Theme","blocksPrice":0,"defId":"theme_world2"}]}},{"id":"dragonfly_checkpoints","name":"Beat Dragonfly","unlocked":false,"category":"bronze","rewards":{"collected":false,"blocks":10,"items":[{"name":"Saws in Level Editor","blocksPrice":0,"defId":"editor_saws"},{"name":"1 Slow Motion Booster","blocksPrice":0,"defId":"slowmo1"}]}},{"id":"dragonfly_nocheckpoints","name":"Beat Dragonfly without checkpoints","unlocked":false,"category":"bronze","rewards":{"collected":false,"blocks":10,"items":[{"name":"Cloud 9 Bonus Level","blocksPrice":0,"defId":"bonus_level_cloud9"}]}},{"id":"frontier_checkpoints","name":"Beat Frontier","unlocked":false,"category":"bronze","rewards":{"collected":false,"blocks":10,"items":[{"name":"Switch Button and Platform in Level Editor","blocksPrice":0,"defId":"editor_switch_button"},{"name":"1 Slow Motion Booster","blocksPrice":0,"defId":"slowmo1"}]}},{"id":"indestructable_checkpoints","name":"Beat Indestructable","unlocked":false,"category":"bronze","rewards":{"collected":false,"blocks":10,"items":[{"name":"World 1 Boss Theme","blocksPrice":0,"defId":"theme_world1Boss"}]}},{"id":"lighthouse_checkpoints","name":"Beat Lighthouse","unlocked":false,"category":"bronze","rewards":{"collected":false,"blocks":10,"items":[{"name":"Player Stacks in Level Editor","blocksPrice":0,"defId":"editor_player_stacks"},{"name":"1 Missile Booster","blocksPrice":0,"defId":"missiles1"}]}},{"id":"octane_checkpoints","name":"Beat Octane","unlocked":false,"category":"bronze","rewards":{"collected":false,"blocks":10,"items":[{"name":"Gun in Level Editor","blocksPrice":0,"defId":"editor_gun"},{"name":"1 Missile Booster","blocksPrice":0,"defId":"missiles1"}]}},{"id":"sky_fracture_checkpoints","name":"Beat Sky Fracture","unlocked":false,"category":"bronze","rewards":{"collected":false,"blocks":10,"items":[{"name":"Spaceship Skin","blocksPrice":0,"defId":"skin_spaceship"},{"name":"World 3 Theme","blocksPrice":0,"defId":"theme_world3"}]}},{"id":"solace_checkpoints","name":"Beat Solace","unlocked":false,"category":"bronze","rewards":{"collected":false,"blocks":10,"items":[{"name":"Double Jump in Level Editor","blocksPrice":0,"defId":"editor_double_jump"},{"name":"1 Missile Booster","blocksPrice":0,"defId":"missiles1"}]}},{"id":"solace_nocheckpoints","name":"Beat Solace without checkpoints","unlocked":false,"category":"bronze","rewards":{"collected":false,"blocks":10,"items":[{"name":"Dino Skin","blocksPrice":0,"defId":"skin_dino"}]}},{"id":"think_different_checkpoints","name":"Beat Think Different","unlocked":false,"category":"bronze","rewards":{"collected":false,"blocks":10,"items":[{"name":"Move on Jump in Level Editor","blocksPrice":0,"defId":"editor_move_on_jump"},{"name":"1 Missile Booster","blocksPrice":0,"defId":"missiles1"}]}},{"id":"xp_rank10","name":"Reach Level 10 online","unlocked":true,"category":"bronze","rewards":{"collected":false,"blocks":10,"items":[{"name":"Chicken Skin","blocksPrice":0,"defId":"skin_chicken"}]}},{"id":"cloud_9_high_score","name":"Score 200,000 beating Cloud 9","unlocked":false,"category":"bronze","rewards":{"collected":false,"blocks":10,"items":[{"name":"Skater Theme","blocksPrice":0,"defId":"theme_skater"}]}},{"id":"accelerated_avoid_collectibles","name":"Avoid all Collectibles in Accelerated","unlocked":false,"category":"silver","rewards":{"collected":false,"blocks":20,"items":[{"name":"Green Bot Skin","blocksPrice":0,"defId":"skin_greenbot"}]}},{"id":"8_bit_adventure_nocheckpoints","name":"Beat 8 Bit Adventure without checkpoints","unlocked":false,"category":"silver","rewards":{"collected":false,"blocks":20,"items":[{"name":"Pixel Cheese Skin","blocksPrice":0,"defId":"skin_pixelcheese"}]}},{"id":"awake_nocheckpoints","name":"Beat Awake without checkpoints","unlocked":false,"category":"silver","rewards":{"collected":false,"blocks":20,"items":[{"name":"Mushroom Skin","blocksPrice":0,"defId":"skin_mushroom"}]}},{"id":"blythe_nocheckpoints","name":"Beat Blythe without checkpoints","unlocked":false,"category":"silver","rewards":{"collected":false,"blocks":20,"items":[{"name":"Worm Skin","blocksPrice":0,"defId":"skin_worm"}]}},{"id":"breathe_nocheckpoints","name":"Beat Breathe without checkpoints","unlocked":false,"category":"silver","rewards":{"collected":false,"blocks":20,"items":[{"name":"Pixel Robot Skin","blocksPrice":0,"defId":"skin_pixelrobot"}]}},{"id":"cloud_9_nocheckpoints","name":"Beat Cloud 9 without checkpoints","unlocked":false,"category":"silver","rewards":{"collected":false,"blocks":20,"items":[{"name":"Skater Skin","blocksPrice":0,"defId":"skin_skater"}]}},{"id":"coincidence_nocheckpoints","name":"Beat Coincidence without checkpoints","unlocked":false,"category":"silver","rewards":{"collected":false,"blocks":20,"items":[{"name":"Burger Skin","blocksPrice":0,"defId":"skin_burger"}]}},{"id":"critical_hit_nocheckpoints","name":"Beat Critical Hit without checkpoints","unlocked":false,"category":"silver","rewards":{"collected":false,"blocks":20,"items":[{"name":"Boss 2 Skin","blocksPrice":0,"defId":"skin_boss2"}]}},{"id":"dark_sheep_checkpoints","name":"Beat Dark Sheep","unlocked":false,"category":"silver","rewards":{"collected":false,"blocks":20,"items":[{"name":"Flying Enemies in Level Editor","blocksPrice":0,"defId":"editor_flying_enemy"},{"name":"World 2 Red Theme","blocksPrice":0,"defId":"theme_world2Red"}]}},{"id":"frontier_nocheckpoints","name":"Beat Frontier without checkpoints","unlocked":false,"category":"silver","rewards":{"collected":false,"blocks":20,"items":[{"name":"Machine Skin","blocksPrice":0,"defId":"skin_machine"}]}},{"id":"indestructable_nocheckpoints","name":"Beat Indestructable without checkpoints","unlocked":false,"category":"silver","rewards":{"collected":false,"blocks":20,"items":[{"name":"Boss 1 Skin","blocksPrice":0,"defId":"skin_boss1"}]}},{"id":"lighthouse_nocheckpoints","name":"Beat Lighthouse without checkpoints","unlocked":false,"category":"silver","rewards":{"collected":false,"blocks":20,"items":[{"name":"Alien Skin","blocksPrice":0,"defId":"skin_alien"}]}},{"id":"mutant_checkpoints","name":"Beat Mutant","unlocked":false,"category":"silver","rewards":{"collected":false,"blocks":20,"items":[{"name":"Bull Skin","blocksPrice":0,"defId":"skin_bull"},{"name":"World 4 Red Theme","blocksPrice":0,"defId":"theme_world4Red"}]}},{"id":"octane_nocheckpoints","name":"Beat Octane without checkpoints","unlocked":false,"category":"silver","rewards":{"collected":false,"blocks":20,"items":[{"name":"Pixel Skull Skin","blocksPrice":0,"defId":"skin_pixelskull"}]}},{"id":"overdrive_checkpoints","name":"Beat Overdrive","unlocked":false,"category":"silver","rewards":{"collected":false,"blocks":20,"items":[{"name":"World 4 Boss Theme","blocksPrice":0,"defId":"theme_world4Boss"}]}},{"id":"polymorph_checkpoints","name":"Beat Polymorph","unlocked":false,"category":"silver","rewards":{"collected":false,"blocks":20,"items":[{"name":"Yak Skin","blocksPrice":0,"defId":"skin_yak"},{"name":"World 3 Red Theme","blocksPrice":0,"defId":"theme_world3Red"}]}},{"id":"sky_fracture_nocheckpoints","name":"Beat Sky Fracture without checkpoints","unlocked":false,"category":"silver","rewards":{"collected":false,"blocks":20,"items":[{"name":"Boss 3 Skin","blocksPrice":0,"defId":"skin_boss3"}]}},{"id":"solar_abyss_checkpoints","name":"Beat Solar Abyss","unlocked":false,"category":"silver","rewards":{"collected":false,"blocks":20,"items":[{"name":"World 1 Red Theme","blocksPrice":0,"defId":"theme_virtual"},{"name":"1 Autopilot Booster","blocksPrice":0,"defId":"autopilot1"}]}},{"id":"think_different_nocheckpoints","name":"Beat Think Different without checkpoints","unlocked":false,"category":"silver","rewards":{"collected":false,"blocks":20,"items":[{"name":"Monkey Skin","blocksPrice":0,"defId":"skin_monkey"}]}},{"id":"accelerated_collectibles","name":"Picked up all 75 Collectibles beating Accelerated","unlocked":false,"category":"silver","rewards":{"collected":false,"blocks":20,"items":[{"name":"Collectibles in Level Editor","blocksPrice":0,"defId":"editor_collectibles"}]}},{"id":"xp_rank100","name":"Reach Level 100 online","unlocked":false,"category":"silver","rewards":{"collected":false,"blocks":20,"items":[{"name":"Dog Skin","blocksPrice":0,"defId":"skin_dog"}]}},{"id":"cloud_9_very_high_score","name":"Score 1,000,000 beating Cloud 9","unlocked":false,"category":"silver","rewards":{"collected":false,"blocks":20,"items":[{"name":"Mr Cool Skin","blocksPrice":0,"defId":"skin_mrcool"}]}},{"id":"all_bronze_achievements","name":"Unlocked All Bronze Achievements","unlocked":false,"category":"silver","rewards":{"collected":false,"blocks":20,"items":[{"name":"Parrot Skin","blocksPrice":0,"defId":"skin_parrot"}]}},{"id":"dark_sheep_nocheckpoints","name":"Beat Dark Sheep without checkpoints","unlocked":false,"category":"gold","rewards":{"collected":false,"blocks":60,"items":[{"name":"Pixel Crown Skin","blocksPrice":0,"defId":"skin_pixelcrown"}]}},{"id":"mutant_nocheckpoints","name":"Beat Mutant without checkpoints","unlocked":false,"category":"gold","rewards":{"collected":false,"blocks":60,"items":[{"name":"Knight Skin","blocksPrice":0,"defId":"skin_knight"}]}},{"id":"overdrive_nocheckpoints","name":"Beat Overdrive without checkpoints","unlocked":false,"category":"gold","rewards":{"collected":false,"blocks":60,"items":[{"name":"Boss 4 Skin","blocksPrice":0,"defId":"skin_boss4"}]}},{"id":"polymorph_nocheckpoints","name":"Beat Polymorph without checkpoints","unlocked":false,"category":"gold","rewards":{"collected":false,"blocks":60,"items":[{"name":"Mummy Skin","blocksPrice":0,"defId":"skin_mummy"}]}},{"id":"solar_abyss_nocheckpoints","name":"Beat Solar Abyss without checkpoints","unlocked":false,"category":"gold","rewards":{"collected":false,"blocks":60,"items":[{"name":"Samurai Skin","blocksPrice":0,"defId":"skin_samurai"}]}},{"id":"all_silver_achievements","name":"Unlocked All Silver Achievements","unlocked":false,"category":"gold","rewards":{"collected":false,"blocks":60,"items":[{"name":"Superhero Skin","blocksPrice":0,"defId":"skin_superhero"}]}},{"id":"aura_checkpoints","name":"Beat Aura","unlocked":false,"category":"levelPack","rewards":{"collected":false,"blocks":0,"items":[{"name":"Speed Change in Level Editor","blocksPrice":0,"defId":"editor_speed_change"},{"name":"Moon Theme","blocksPrice":0,"defId":"theme_speed"}]}},{"id":"aura_nocheckpoints","name":"Beat Aura without checkpoints","unlocked":false,"category":"levelPack","rewards":{"collected":false,"blocks":0,"items":[{"name":"Astronaut Skin","blocksPrice":0,"defId":"skin_space"}]}},{"id":"cool_friends_checkpoints","name":"Beat Cool Friends","unlocked":false,"category":"levelPack","rewards":{"collected":false,"blocks":0,"items":[{"name":"Punch in Level Editor","blocksPrice":0,"defId":"editor_punch"},{"name":"Giant Enemy in Level Editor","blocksPrice":0,"defId":"editor_giant_enemy"}]}},{"id":"cool_friends_nocheckpoints","name":"Beat Cool Friends without checkpoints","unlocked":false,"category":"levelPack","rewards":{"collected":false,"blocks":0,"items":[{"name":"Fighter Theme","blocksPrice":0,"defId":"theme_fighter"},{"name":"Fighter Skin","blocksPrice":0,"defId":"skin_fighter"}]}},{"id":"for_you_checkpoints","name":"Beat For You","unlocked":false,"category":"levelPack","rewards":{"collected":false,"blocks":0,"items":[{"name":"Switch Block Spikes in Level Editor","blocksPrice":0,"defId":"editor_switch_block_spike"},{"name":"Dreamy Theme","blocksPrice":0,"defId":"theme_dreamy"}]}},{"id":"for_you_nocheckpoints","name":"Beat For You without checkpoints","unlocked":false,"category":"levelPack","rewards":{"collected":false,"blocks":0,"items":[{"name":"Dreamy Skin","blocksPrice":0,"defId":"skin_dreamy"}]}},{"id":"nacreous_snowmelt_checkpoints","name":"Beat Nacreous Snowmelt","unlocked":false,"category":"levelPack","rewards":{"collected":false,"blocks":0,"items":[{"name":"Arrows in Level Editor","blocksPrice":0,"defId":"editor_arrows"}]}},{"id":"nacreous_snowmelt_nocheckpoints","name":"Beat Nacreous Snowmelt without checkpoints","unlocked":false,"category":"levelPack","rewards":{"collected":false,"blocks":0,"items":[{"name":"Arrows Theme","blocksPrice":0,"defId":"theme_arrows"}]}},{"id":"nacreous_snowmelt_high_score","name":"Score 600,000 beating Nacreous Snowmelt","unlocked":false,"category":"levelPack","rewards":{"collected":false,"blocks":0,"items":[{"name":"Outline Skin","blocksPrice":0,"defId":"skin_arrows"}]}}]', - ), - vu = Ld({ - mappers: [ - () => ({ auth: { type: "none" } }), - (e) => - "apple" === e.auth.type - ? Object.assign(Object.assign({}, e), { - auth: { type: "apple" }, - }) - : e, - (e) => - Object.assign(Object.assign({}, e), { - offlineCache: { achievements: [] }, - }), - (e) => - Object.assign(Object.assign({}, e), { - hasRegisteredNotifications: false, - }), - (e) => - Object.assign(Object.assign({}, e), { - hasAskedForReview: false, - }), - (e) => - Object.assign(Object.assign({}, e), { - hasVisitedSuperLevelPack: false, - offlineCache: { achievements: _u }, - }), - (e) => - Object.assign(Object.assign({}, e), { - auth: - "apple" === e.auth.type - ? { type: "apple", id: "" } - : "google" === e.auth.type - ? { type: "google", id: "" } - : e.auth, - }), - ], - finalSchema: kc({ - auth: Bc([ - kc({ type: _c("none") }), - kc({ type: _c("anon") }), - kc({ type: _c("google"), id: mc }), - kc({ type: _c("apple"), id: mc }), - ]), - offlineCache: kc({ - achievements: Oc( - kc({ - id: mc, - name: mc, - unlocked: yc, - category: Bc([ - _c("bronze"), - _c("silver"), - _c("gold"), - _c("levelPack"), - ]), - rewards: kc({ - collected: yc, - blocks: fc, - items: Oc(kc({ name: mc, blocksPrice: fc, defId: mc })), - }), - }), - ), - }), - hasRegisteredNotifications: Bc([_c(false), fc]), - hasAskedForReview: yc, - hasVisitedSuperLevelPack: yc, - }), - uncompress: (e) => e, - compress: (e) => e, - }), - Tu = kc({ - viewOffset: kc({ x: fc, y: fc, scale: fc }), - runHistory: Oc(Gc([fc, fc, gc])), - runHistoryIndex: fc, - }), - Ru = Ld({ - mappers: [() => ({})], - finalSchema: Lc(mc, Bc([pc, Tu])), - uncompress: (e) => { - const t = {}; - return ( - Object.entries(e).forEach(([e, a]) => { - if (!a) return; - const i = a.runHistory - .map((e) => { - const t = Eu.jsonToData(e); - return t instanceof Error ? null : t.data; - }) - .filter(nt); - 0 !== i.length && - (t[e] = Object.assign(Object.assign({}, a), { - runHistory: i, - })); - }), - t - ); - }, - compress: (e) => { - const t = {}; - return ( - Object.entries(e).forEach(([e, a]) => { - if (!a) return; - const i = a.runHistory.map((e) => - Eu.dataToJson(e, () => new Date()), - ); - t[e] = Object.assign(Object.assign({}, a), { runHistory: i }); - }), - t - ); - }, + }; + function Fu({ + id: e, + message: t = "", + message2: a = "", + message3: i = "", + message4: n = "", + message5: s = "", + }) { + return new Promise((o) => { + (new Promise((t) => { + let a = window.__replayGlobalCallbacks__; + (a || ((a = {}), (window.__replayGlobalCallbacks__ = a)), + (a[e] = (e) => { + t(e); + })); + }).then((t) => { + ((window.__replayGlobalCallbacks__[e] = void 0), o(t)); }), - Ou = Oc( - kc({ - type: _c("completedLevel"), - levelFileName: mc, - isCheckpoints: yc, - collectibles: fc, - highScore: fc, - }), - ), - Cu = function (e) { - return (function (e, t, a) { - return Pd( - t.decode(e), - ac(() => (console.error("Outdated requests schema"), [])), - ); - })(e, Ou); - }, - wu = JSON.parse( - '[{"itemId":"4970130c-e2e6-4645-b0fc-4e9f725cef6a","defId":"slowmo1","quantity":1,"usesLeft":3,"version":1},{"itemId":"5bf96b70-cd18-41c4-8323-c64623da8517","defId":"autopilot1","quantity":1,"usesLeft":3,"version":1},{"itemId":"d74933fe-9d90-4e26-96ec-2578764a8437","defId":"missiles1","quantity":1,"usesLeft":3,"version":1}]', - ); - var Au = a(8465); - const ku = "1.2.6"; - function Nu(e) { - return 20 * Math.pow(e - 1, 1.3); - } - const xu = function (e) { - const t = (function (e) { - const t = Math.max(e, 0); - return Math.floor(Math.pow(t / 20, 1 / 1.3) + 1); - })(e), - a = Nu(t); - return { rank: t, rankPercent: (e - a) / (Nu(t + 1) - a) }; - }, - Pu = () => ({ type: "autopilot", playerInput: "up" }), - Mu = () => ({ type: "missiles" }), - Lu = () => ({ type: "slowmo" }), - canUseMissiles = function (e) { - return ( - null !== e.boss || - !!e.layout.switchButtons.some((e) => "blockSpike" === e.affects) - ); - }, - Bu = function (e) { - switch (e) { - case "editor_double_jump": - return "doubleJump"; - case "editor_flying_enemy": - return "flyingEnemy"; - case "editor_gun": - return "gun"; - case "editor_jetpack": - return "jetpack"; - case "editor_move_on_jump": - return "moveOnJump"; - case "editor_saws": - return "saws"; - case "editor_walking_enemy": - return "walkingEnemy"; - case "editor_switch_button": - return "switchButton"; - case "editor_player_stacks": - return "playerStacks"; - case "editor_collectibles": - return "collectible"; - case "editor_spring": - return "spring"; - case "editor_falling_platform": - return "fallingPlatform"; - case "editor_portals": - return "portals"; - case "editor_skateboard": - return "skateboard"; - case "editor_switch_block_spike": - return "switchBlockSpike"; - case "editor_punch": - return "punch"; - case "editor_giant_enemy": - return "giantEnemy"; - case "editor_speed_change": - return "speedChange"; - case "editor_arrows": - return "arrows"; - default: - return null; - } - }; - function Fu({ - id: e, - message: t = "", - message2: a = "", - message3: i = "", - message4: n = "", - message5: s = "", - }) { - return new Promise((o) => { - (new Promise((t) => { - let a = window.__replayGlobalCallbacks__; - (a || ((a = {}), (window.__replayGlobalCallbacks__ = a)), - (a[e] = (e) => { - t(e); - })); - }).then((t) => { - ((window.__replayGlobalCallbacks__[e] = void 0), o(t)); - }), - window.Android.bridge(e, t, a, i, n, s)); - }); - } - var Yu = function (e, t, a, i) { - return new (a || (a = Promise))(function (n, s) { - function o(e) { - try { - l(i.next(e)); - } catch (e) { - s(e); - } - } - function r(e) { - try { - l(i.throw(e)); - } catch (e) { - s(e); - } + window.Android.bridge(e, t, a, i, n, s)); + }); + } + var Yu = function (e, t, a, i) { + return new (a || (a = Promise))(function (n, s) { + function o(e) { + try { + l(i.next(e)); + } catch (e) { + s(e); } - function l(e) { - var t; - e.done - ? n(e.value) - : ((t = e.value), - t instanceof a - ? t - : new a(function (e) { - e(t); - })).then(o, r); + } + function r(e) { + try { + l(i.throw(e)); + } catch (e) { + s(e); } - l((i = i.apply(e, t || [])).next()); - }); - }; - function Uu() { + } + function l(e) { + var t; + e.done + ? n(e.value) + : ((t = e.value), + t instanceof a + ? t + : new a(function (e) { + e(t); + })).then(o, r); + } + l((i = i.apply(e, t || [])).next()); + }); + }; + function Uu() { + return Yu(this, void 0, void 0, function* () { + const e = yield Fu({ id: "CheckForPreviousPurchases" }); + if (null === e) return null; + if ("error" in e) throw Error(e.error); + return e; + }); + } + const ju = { + googleSignIn: function () { return Yu(this, void 0, void 0, function* () { - const e = yield Fu({ id: "CheckForPreviousPurchases" }); - if (null === e) return null; + const e = yield Fu({ id: "GoogleSignIn" }); if ("error" in e) throw Error(e.error); return e; }); - } - const ju = { - googleSignIn: function () { - return Yu(this, void 0, void 0, function* () { - const e = yield Fu({ id: "GoogleSignIn" }); - if ("error" in e) throw Error(e.error); - return e; - }); - }, - googleSignOut: function () { - return Yu(this, void 0, void 0, function* () { - yield Fu({ id: "GoogleSignOut" }); - }); - }, - checkPreviousPurchases: Uu, - playStoreProductInfo: function (e) { - return Yu(this, void 0, void 0, function* () { - const t = e.map((e) => e.productId).join("$"); - return (yield Fu({ - id: "RequestPlayStoreProductInfo", - message: t, - })) - .map((t) => { - const a = e.find((e) => e.productId === t.productId); - return a - ? Object.assign(Object.assign({}, a), { price: t.price }) - : null; - }) - .filter(nt); + }, + googleSignOut: function () { + return Yu(this, void 0, void 0, function* () { + yield Fu({ id: "GoogleSignOut" }); + }); + }, + checkPreviousPurchases: Uu, + playStoreProductInfo: function (e) { + return Yu(this, void 0, void 0, function* () { + const t = e.map((e) => e.productId).join("$"); + return (yield Fu({ + id: "RequestPlayStoreProductInfo", + message: t, + })) + .map((t) => { + const a = e.find((e) => e.productId === t.productId); + return a + ? Object.assign(Object.assign({}, a), { price: t.price }) + : null; + }) + .filter(nt); + }); + }, + playStoreBuy: function (e) { + return Yu(this, void 0, void 0, function* () { + const t = yield Fu({ + id: "BuyPlayStoreProduct", + message: e.productId, }); - }, - playStoreBuy: function (e) { - return Yu(this, void 0, void 0, function* () { - const t = yield Fu({ - id: "BuyPlayStoreProduct", - message: e.productId, - }); - if (null === t) return null; - if ("alreadyOwned" === t) return yield Uu(); - if ("error" in t) throw Error(t.error); - return t; + if (null === t) return null; + if ("alreadyOwned" === t) return yield Uu(); + if ("error" in t) throw Error(t.error); + return t; + }); + }, + playStoreAcknowledge: function e(t, a = 5) { + return Yu(this, void 0, void 0, function* () { + const i = yield Fu({ + id: "AcknowledgePlayStoreProduct", + message: t, }); - }, - playStoreAcknowledge: function e(t, a = 5) { - return Yu(this, void 0, void 0, function* () { - const i = yield Fu({ - id: "AcknowledgePlayStoreProduct", - message: t, - }); - if ("string" == typeof i) { - if ( - (console.error(`Error acknowledging Play Store: ${i}`), + if ("string" == typeof i) { + if ( + (console.error(`Error acknowledging Play Store: ${i}`), 1 === a) - ) { - const e = "Failed to acknowledge with Play Store"; - return (Ql(`${e}: ${i}`), void console.error(e)); - } - yield new Promise((i) => { - setTimeout(() => { - e(t, a - 1).then(i); - }, 1000); - }); + ) { + const e = "Failed to acknowledge with Play Store"; + return (Ql(`${e}: ${i}`), void console.error(e)); } - }); - }, - secureStorage: { - getItem: (e) => - Yu(void 0, void 0, void 0, function* () { - return localStorage.getItem(`SecureStorage-${e}`); - }), - setItem: (e, t) => - Yu(void 0, void 0, void 0, function* () { - null !== t - ? localStorage.setItem(`SecureStorage-${e}`, t) - : localStorage.removeItem(`SecureStorage-${e}`); - }), - }, - clearSecureStorage: () => - Yu(void 0, void 0, void 0, function* () { - Object.keys(localStorage).forEach((k) => { - if (String(k).includes("SecureStorage-")) { - localStorage.removeItem(k); - } + yield new Promise((i) => { + setTimeout(() => { + e(t, a - 1).then(i); + }, 1000); }); + } + }); + }, + secureStorage: { + getItem: (e) => + Yu(void 0, void 0, void 0, function* () { + return localStorage.getItem(`SecureStorage-${e}`); }), - registerNotifications: function () { - return Yu(this, void 0, void 0, function* () { - const e = yield Fu({ - id: "RegisterNotifications", - message: "RegisterNotifications", - }); - if ("error" in e) throw Error(e.error); - return e.deviceToken; + setItem: (e, t) => + Yu(void 0, void 0, void 0, function* () { + null !== t + ? localStorage.setItem(`SecureStorage-${e}`, t) + : localStorage.removeItem(`SecureStorage-${e}`); + }), + }, + clearSecureStorage: () => + Yu(void 0, void 0, void 0, function* () { + Object.keys(localStorage).forEach((k) => { + if (String(k).includes("SecureStorage-")) { + localStorage.removeItem(k); + } }); - }, - requestReview: function () { - return Yu(this, void 0, void 0, function* () { - yield Fu({ id: "RequestReview", message: "RequestReview" }); + }), + registerNotifications: function () { + return Yu(this, void 0, void 0, function* () { + const e = yield Fu({ + id: "RegisterNotifications", + message: "RegisterNotifications", }); - }, - }; - function Gu({ id: e, message: t }) { - return new Promise((a) => { - (new Promise((t) => { - let a = window.__replayGlobalCallbacks__; - (a || ((a = {}), (window.__replayGlobalCallbacks__ = a)), - (a[e] = (e) => { - t(e); - })); - }).then((t) => { - ((window.__replayGlobalCallbacks__[e] = void 0), a(t)); - }), - window.webkit.messageHandlers.jsCallback.postMessage(t)); + if ("error" in e) throw Error(e.error); + return e.deviceToken; }); - } - var Vu = function (e, t, a, i) { - return new (a || (a = Promise))(function (n, s) { - function o(e) { - try { - l(i.next(e)); - } catch (e) { - s(e); - } + }, + requestReview: function () { + return Yu(this, void 0, void 0, function* () { + yield Fu({ id: "RequestReview", message: "RequestReview" }); + }); + }, + }; + function Gu({ id: e, message: t }) { + return new Promise((a) => { + (new Promise((t) => { + let a = window.__replayGlobalCallbacks__; + (a || ((a = {}), (window.__replayGlobalCallbacks__ = a)), + (a[e] = (e) => { + t(e); + })); + }).then((t) => { + ((window.__replayGlobalCallbacks__[e] = void 0), a(t)); + }), + window.webkit.messageHandlers.jsCallback.postMessage(t)); + }); + } + var Vu = function (e, t, a, i) { + return new (a || (a = Promise))(function (n, s) { + function o(e) { + try { + l(i.next(e)); + } catch (e) { + s(e); } - function r(e) { - try { - l(i.throw(e)); - } catch (e) { - s(e); - } + } + function r(e) { + try { + l(i.throw(e)); + } catch (e) { + s(e); } - function l(e) { - var t; - e.done - ? n(e.value) - : ((t = e.value), - t instanceof a - ? t - : new a(function (e) { - e(t); - })).then(o, r); - } - l((i = i.apply(e, t || [])).next()); - }); - }; - const Hu = { - googleSignIn: function () { - return Vu(this, void 0, void 0, function* () { - const e = yield Gu({ - id: "GoogleSignIn", - message: "GoogleSignIn", - }); - if ("error" in e) throw Error(e.error); - return e; - }); - }, - googleSignOut: function () { - return Vu(this, void 0, void 0, function* () { - yield Gu({ id: "GoogleSignOut", message: "GoogleSignOut" }); - }); - }, - appleSignIn: function (e) { - return Vu(this, void 0, void 0, function* () { - const t = yield Gu({ - id: "SignInWithApple", - message: "SignInWithApple" + (e ? "Existing" : "Init"), - }); - if ("error" in t) throw Error(t.error); - return { userId: t.appleUserId, idToken: t.identityToken }; - }); - }, - appStoreProductInfo: function (e) { - return Vu(this, void 0, void 0, function* () { - const t = `RequestAppStoreProductInfo$${e - .map((e) => e.productId) - .join("$")}`; - return (yield Gu({ - id: "RequestAppStoreProductInfo", - message: t, - })) - .map((t) => { - const a = e.find((e) => e.productId === t.productId); - return a - ? Object.assign(Object.assign({}, a), { price: t.price }) - : null; - }) - .filter(nt); - }); - }, - appStoreBuy: function (e) { - return Vu(this, void 0, void 0, function* () { - const t = `BuyAppStoreProduct$${e.productId}`, - a = yield Gu({ id: "BuyAppStoreProduct", message: t }); - if ("error" in a) throw Error(a.error); - return a; - }); - }, - openLink: function (e) { - return Vu(this, void 0, void 0, function* () { - const t = `OpenLink$${e}`; - yield Gu({ id: "OpenLink", message: t }); + } + function l(e) { + var t; + e.done + ? n(e.value) + : ((t = e.value), + t instanceof a + ? t + : new a(function (e) { + e(t); + })).then(o, r); + } + l((i = i.apply(e, t || [])).next()); + }); + }; + const Hu = { + googleSignIn: function () { + return Vu(this, void 0, void 0, function* () { + const e = yield Gu({ + id: "GoogleSignIn", + message: "GoogleSignIn", }); - }, - requestReview: function () { - return Vu(this, void 0, void 0, function* () { - yield Gu({ id: "RequestReview", message: "RequestReview" }); + if ("error" in e) throw Error(e.error); + return e; + }); + }, + googleSignOut: function () { + return Vu(this, void 0, void 0, function* () { + yield Gu({ id: "GoogleSignOut", message: "GoogleSignOut" }); + }); + }, + appleSignIn: function (e) { + return Vu(this, void 0, void 0, function* () { + const t = yield Gu({ + id: "SignInWithApple", + message: "SignInWithApple" + (e ? "Existing" : "Init"), }); - }, - secureStorage: { - getItem: (e) => - Vu(void 0, void 0, void 0, function* () { - return localStorage.getItem(`SecureStorage`); - }), - setItem: (e, t) => - Vu(void 0, void 0, void 0, function* () { - null !== t - ? localStorage.setItem(`SecureStorage-${e}`, t) - : localStorage.removeItem(`SecureStorage-${e}`); - }), - }, - clearSecureStorage: () => + if ("error" in t) throw Error(t.error); + return { userId: t.appleUserId, idToken: t.identityToken }; + }); + }, + appStoreProductInfo: function (e) { + return Vu(this, void 0, void 0, function* () { + const t = `RequestAppStoreProductInfo$${e + .map((e) => e.productId) + .join("$")}`; + return (yield Gu({ + id: "RequestAppStoreProductInfo", + message: t, + })) + .map((t) => { + const a = e.find((e) => e.productId === t.productId); + return a + ? Object.assign(Object.assign({}, a), { price: t.price }) + : null; + }) + .filter(nt); + }); + }, + appStoreBuy: function (e) { + return Vu(this, void 0, void 0, function* () { + const t = `BuyAppStoreProduct$${e.productId}`, + a = yield Gu({ id: "BuyAppStoreProduct", message: t }); + if ("error" in a) throw Error(a.error); + return a; + }); + }, + openLink: function (e) { + return Vu(this, void 0, void 0, function* () { + const t = `OpenLink$${e}`; + yield Gu({ id: "OpenLink", message: t }); + }); + }, + requestReview: function () { + return Vu(this, void 0, void 0, function* () { + yield Gu({ id: "RequestReview", message: "RequestReview" }); + }); + }, + secureStorage: { + getItem: (e) => Vu(void 0, void 0, void 0, function* () { - Object.keys(localStorage).forEach((k) => { - if (String(k).includes("SecureStorage-")) { - localStorage.removeItem(k); - } - }); + return localStorage.getItem(`SecureStorage`); }), - registerNotifications: function () { - return Vu(this, void 0, void 0, function* () { - const e = yield Gu({ - id: "RegisterNotifications", - message: "RegisterNotifications", - }); - if ("error" in e) throw Error(e.error); - return e.deviceToken; - }); - }, - }; - var Xu = function (e, t, a, i) { - return new (a || (a = Promise))(function (n, s) { - function o(e) { - try { - l(i.next(e)); - } catch (e) { - s(e); - } - } - function r(e) { - try { - l(i.throw(e)); - } catch (e) { - s(e); + setItem: (e, t) => + Vu(void 0, void 0, void 0, function* () { + null !== t + ? localStorage.setItem(`SecureStorage-${e}`, t) + : localStorage.removeItem(`SecureStorage-${e}`); + }), + }, + clearSecureStorage: () => + Vu(void 0, void 0, void 0, function* () { + Object.keys(localStorage).forEach((k) => { + if (String(k).includes("SecureStorage-")) { + localStorage.removeItem(k); } + }); + }), + registerNotifications: function () { + return Vu(this, void 0, void 0, function* () { + const e = yield Gu({ + id: "RegisterNotifications", + message: "RegisterNotifications", + }); + if ("error" in e) throw Error(e.error); + return e.deviceToken; + }); + }, + }; + var Xu = function (e, t, a, i) { + return new (a || (a = Promise))(function (n, s) { + function o(e) { + try { + l(i.next(e)); + } catch (e) { + s(e); } - function l(e) { - var t; - e.done - ? n(e.value) - : ((t = e.value), - t instanceof a - ? t - : new a(function (e) { - e(t); - })).then(o, r); + } + function r(e) { + try { + l(i.throw(e)); + } catch (e) { + s(e); } - l((i = i.apply(e, t || [])).next()); + } + function l(e) { + var t; + e.done + ? n(e.value) + : ((t = e.value), + t instanceof a + ? t + : new a(function (e) { + e(t); + })).then(o, r); + } + l((i = i.apply(e, t || [])).next()); + }); + }; + const zu = { + openLink: function (e) { + window.open(e); + }, + requestReview: function () { + ju.requestReview(); + }, + hasIAP: function () { + return false; + }, + supportsFiles: function () { + return true; + }, + openFile: function () { + var input = document.createElement("input"); + var file = null; + input.type = "file"; + input.accepts = ".json"; + input.click(); + let filePromise = new Promise((resolve) => { + input.addEventListener("change", function () { + file = this.files[0]; + var reader = new FileReader(); + + reader.onload = function (evt) { + resolve(evt.target.result); + }; + + reader.readAsText(file); + }); }); - }; - const zu = { - openLink: function (e) { - window.open(e); - }, - requestReview: function () { - ju.requestReview(); - }, - hasIAP: function () { - return false; - }, - supportsFiles: function () { + return filePromise; + }, + saveFile: function (name, data, mime) { + return Xu(this, void 0, void 0, function* () { + let blob = new Blob([data], { type: mime }); + saveAs(blob, name) return true; - }, - openFile: function () { - var input = document.createElement("input"); - var file = null; - input.type = "file"; - input.accepts = ".json"; - input.click(); - let filePromise = new Promise((resolve) => { - input.addEventListener("change", function () { - file = this.files[0]; - var reader = new FileReader(); - - reader.onload = function (evt) { - resolve(evt.target.result); - }; - - reader.readAsText(file); - }); - }); - return filePromise; - }, - saveFile: function (name, data, mime) { - return Xu(this, void 0, void 0, function* () { - let blob = new Blob([data], { type: mime }); - saveAs(blob, name) - return true; - }); - }, - googleSignIn: function () { - return ju.googleSignIn(); - }, - googleSignOut: function () { - return ju.googleSignOut(); - }, - cancelGoogleSignIn: function () { - return Xu(this, void 0, void 0, function* () {}); - }, - }; - var Wu = function (e, t, a, i) { - return new (a || (a = Promise))(function (n, s) { - function o(e) { - try { - l(i.next(e)); - } catch (e) { - s(e); - } - } - function r(e) { - try { - l(i.throw(e)); - } catch (e) { - s(e); - } + }); + }, + googleSignIn: function () { + return ju.googleSignIn(); + }, + googleSignOut: function () { + return ju.googleSignOut(); + }, + cancelGoogleSignIn: function () { + return Xu(this, void 0, void 0, function* () { }); + }, + }; + var Wu = function (e, t, a, i) { + return new (a || (a = Promise))(function (n, s) { + function o(e) { + try { + l(i.next(e)); + } catch (e) { + s(e); } - function l(e) { - var t; - e.done - ? n(e.value) - : ((t = e.value), - t instanceof a - ? t - : new a(function (e) { - e(t); - })).then(o, r); + } + function r(e) { + try { + l(i.throw(e)); + } catch (e) { + s(e); } - l((i = i.apply(e, t || [])).next()); - }); - }; - const qu = "blocks", - $u = Bc([hc, xc({ skin: mc })]), - Ju = Lc(mc, Bc([pc, kc({ balance: fc })])), - Ku = kc({ - profileId: mc, - playerName: mc, - currency: Ju, - experiencePoints: fc, - summaryFriendData: $u, - }), - Qu = kc({ status: _c(200), data: Ku }), - Zu = (e, t) => - Md( - e, - Bc([ - kc({ - status: Bc([_c(202), _c(400), _c(403), _c(900)]), - reason_code: fc, - }), - t, - ]), - ), - eh = (e) => - 40303 === e.reason_code || - 40426 === e.reason_code || - 40304 === e.reason_code, - th = "offline", - ah = "update", - ih = "expired", - nh = "userNotFound"; - function sh(e) { - return new Promise((t, a) => { - e.authenticateAnonymous((e) => { - const i = Zu(e, Qu); - if (i instanceof Error) - return (a(i), void console.error("Auth error", i)); - 200 === i.status ? t(ch(i.data)) : a(dh(i.reason_code)); - }); + } + function l(e) { + var t; + e.done + ? n(e.value) + : ((t = e.value), + t instanceof a + ? t + : new a(function (e) { + e(t); + })).then(o, r); + } + l((i = i.apply(e, t || [])).next()); + }); + }; + const qu = "blocks", + $u = Bc([hc, xc({ skin: mc })]), + Ju = Lc(mc, Bc([pc, kc({ balance: fc })])), + Ku = kc({ + profileId: mc, + playerName: mc, + currency: Ju, + experiencePoints: fc, + summaryFriendData: $u, + }), + Qu = kc({ status: _c(200), data: Ku }), + Zu = (e, t) => + Md( + e, + Bc([ + kc({ + status: Bc([_c(202), _c(400), _c(403), _c(900)]), + reason_code: fc, + }), + t, + ]), + ), + eh = (e) => + 40303 === e.reason_code || + 40426 === e.reason_code || + 40304 === e.reason_code, + th = "offline", + ah = "update", + ih = "expired", + nh = "userNotFound"; + function sh(e) { + return new Promise((t, a) => { + e.authenticateAnonymous((e) => { + const i = Zu(e, Qu); + if (i instanceof Error) + return (a(i), void console.error("Auth error", i)); + 200 === i.status ? t(ch(i.data)) : a(dh(i.reason_code)); }); - } - const oh = kc({ status: _c(200) }), - rh = kc({ status: _c(200) }); - function lh(e) { - return new Promise((t, a) => { - e.reconnectRef().then((e) => { - const i = Zu(e, Qu); - if (i instanceof Error) - return (a(i), void console.error("Reconnect error", i)); - 200 === i.status ? t(ch(i.data)) : a(dh(i.reason_code)); - }); + }); + } + const oh = kc({ status: _c(200) }), + rh = kc({ status: _c(200) }); + function lh(e) { + return new Promise((t, a) => { + e.reconnectRef().then((e) => { + const i = Zu(e, Qu); + if (i instanceof Error) + return (a(i), void console.error("Reconnect error", i)); + 200 === i.status ? t(ch(i.data)) : a(dh(i.reason_code)); }); - } - function ch(e) { - var t, a; - return { - profileId: e.profileId, - playerName: e.playerName, - blocksBalance: - (null === (t = e.currency.blocks) || void 0 === t - ? void 0 - : t.balance) || 0, - xpPoints: e.experiencePoints, - playerSkin: Wt.getSkin( - null === (a = e.summaryFriendData) || void 0 === a - ? void 0 - : a.skin, - ), - }; - } - function dh(e) { - return 40206 === e - ? nh - : 40307 === e || 40426 === e || 40356 === e - ? ih - : 40322 === e - ? ah - : 0 === e - ? th - : `Error ${e}`; - } - function uh(e) { - (e.resetStoredProfileId(), e.resetStoredAnonymousId()); - } - kc({ status: _c(200), data: kc({ profileId: mc }) }); - const hh = kc({ status: _c(200) }), - ph = kc({ status: _c(200) }), - gh = kc({ status: _c(200) }), - mh = kc({ status: _c(200) }), - fh = "account", - yh = "levels", - Eh = Oc( - kc({ - itemId: mc, - version: fc, - usesLeft: Bc([hc, fc]), - quantity: fc, - defId: mc, - }), + }); + } + function ch(e) { + var t, a; + return { + profileId: e.profileId, + playerName: e.playerName, + blocksBalance: + (null === (t = e.currency.blocks) || void 0 === t + ? void 0 + : t.balance) || 0, + xpPoints: e.experiencePoints, + playerSkin: Wt.getSkin( + null === (a = e.summaryFriendData) || void 0 === a + ? void 0 + : a.skin, ), - bh = kc({ - status: _c(200), - data: kc({ - response: Bc([ - mc, - kc({ - allUserItems: Eh, - entities: Lc( - mc, - Bc([hc, kc({ entityId: mc, data: kc({ data: gc }) })]), - ), - attributes: Lc(mc, mc), - }), - ]), - }), - }), - Sh = kc({ - status: _c(200), - data: Bc([hc, kc({ entityId: mc, data: kc({ data: gc }) })]), - }), - Ih = kc({ status: _c(200) }), - _h = kc({ - status: _c(200), - data: kc({ - productInventory: Oc( - kc({ - itemId: mc, - title: mc, - priceData: Bc([ - kc({ - ids: Oc( - Bc([kc({ appId: _c("iphone"), itunesId: mc }), kc({})]), - ), - }), - kc({ id: mc }), - ]), - }), - ), - }), - }), - vh = kc({ - status: _c(200), - data: xc({ - resultCode: fc, - currency: Ju, - transactionSummary: kc({ - transactionDetails: Oc(xc({ errorMessage: mc })), - }), - }), - }), - Th = kc({ - name: Bc([mc, hc]), - buyPrice: xc({ [qu]: fc }), + }; + } + function dh(e) { + return 40206 === e + ? nh + : 40307 === e || 40426 === e || 40356 === e + ? ih + : 40322 === e + ? ah + : 0 === e + ? th + : `Error ${e}`; + } + function uh(e) { + (e.resetStoredProfileId(), e.resetStoredAnonymousId()); + } + kc({ status: _c(200), data: kc({ profileId: mc }) }); + const hh = kc({ status: _c(200) }), + ph = kc({ status: _c(200) }), + gh = kc({ status: _c(200) }), + mh = kc({ status: _c(200) }), + fh = "account", + yh = "levels", + Eh = Oc( + kc({ + itemId: mc, + version: fc, + usesLeft: Bc([hc, fc]), + quantity: fc, defId: mc, }), - Rh = kc({ - status: _c(200), - data: kc({ results: kc({ items: Oc(Th) }) }), - }), - Oh = Bc([ - kc({ - status: _c(200), - data: kc({ - currencyBalances: kc({ currencyMap: Ju }), - items: Lc( + ), + bh = kc({ + status: _c(200), + data: kc({ + response: Bc([ + mc, + kc({ + allUserItems: Eh, + entities: Lc( mc, + Bc([hc, kc({ entityId: mc, data: kc({ data: gc }) })]), + ), + attributes: Lc(mc, mc), + }), + ]), + }), + }), + Sh = kc({ + status: _c(200), + data: Bc([hc, kc({ entityId: mc, data: kc({ data: gc }) })]), + }), + Ih = kc({ status: _c(200) }), + _h = kc({ + status: _c(200), + data: kc({ + productInventory: Oc( + kc({ + itemId: mc, + title: mc, + priceData: Bc([ kc({ - defId: mc, - itemId: mc, - version: fc, - usesLeft: Bc([hc, fc]), - quantity: fc, + ids: Oc( + Bc([kc({ appId: _c("iphone"), itunesId: mc }), kc({})]), + ), }), - ), + kc({ id: mc }), + ]), }), + ), + }), + }), + vh = kc({ + status: _c(200), + data: xc({ + resultCode: fc, + currency: Ju, + transactionSummary: kc({ + transactionDetails: Oc(xc({ errorMessage: mc })), }), - kc({ status: _c(400), reason_code: fc }), - ]), - Ch = kc({ + }), + }), + Th = kc({ + name: Bc([mc, hc]), + buyPrice: xc({ [qu]: fc }), + defId: mc, + }), + Rh = kc({ + status: _c(200), + data: kc({ results: kc({ items: Oc(Th) }) }), + }), + Oh = Bc([ + kc({ status: _c(200), data: kc({ - item: Bc([ + currencyBalances: kc({ currencyMap: Ju }), + items: Lc( + mc, kc({ defId: mc, itemId: mc, @@ -51966,22425 +51913,22479 @@ var version = "v1.17.2"; usesLeft: Bc([hc, fc]), quantity: fc, }), - kc({}), - ]), + ), }), - }); - function wh( - e, // itemId - t, // itemVersion - a, // name - i, // defId - n = 1, //usesLeft - ) { - console.info("name:", a); - if (a.startsWith("editor_")) { - const i = Bu(a); - return i - ? { - type: "editorItem", - itemId: e, - itemVersion: t, - defId: a, - feature: i, - } - : null; - } - if (a.startsWith("skin_")) - return { - type: "skinItem", + }), + kc({ status: _c(400), reason_code: fc }), + ]), + Ch = kc({ + status: _c(200), + data: kc({ + item: Bc([ + kc({ + defId: mc, + itemId: mc, + version: fc, + usesLeft: Bc([hc, fc]), + quantity: fc, + }), + kc({}), + ]), + }), + }); + function wh( + e, // itemId + t, // itemVersion + a, // name + i, // defId + n = 1, //usesLeft + ) { + console.info("name:", a); + if (a.startsWith("editor_")) { + const i = Bu(a); + return i + ? { + type: "editorItem", itemId: e, itemVersion: t, defId: a, - skinName: a.split("_").slice(1).join("_"), - }; - if (a.startsWith("theme_")) { - const i = ca[a.split("_")[1]]; - return i - ? { - type: "themeItem", - itemId: e, - itemVersion: t, - defId: a, - theme: i, - } - : null; - } - return a.startsWith("bonus_level_") - ? { - type: "bonusLevelItem", - itemId: e, - itemVersion: t, + feature: i, + } + : null; + } + if (a.startsWith("skin_")) + return { + type: "skinItem", + itemId: e, + itemVersion: t, + defId: a, + skinName: a.split("_").slice(1).join("_"), + }; + if (a.startsWith("theme_")) { + const i = ca[a.split("_")[1]]; + return i + ? { + type: "themeItem", + itemId: e, + itemVersion: t, + defId: a, + theme: i, + } + : null; + } + return a.startsWith("bonus_level_") + ? { + type: "bonusLevelItem", + itemId: e, + itemVersion: t, + defId: a, + name: + "bonus_level_super_level_pack" === a + ? "superLevelPack" + : "cloud9", + } + : a.endsWith("_pass") + ? { + type: "passItem", + itemId: e, + defId: a, + itemVersion: t, + passType: "achievement", + } + : a.startsWith("slowmo") || + a.startsWith("missiles") || + a.startsWith("autopilot") + ? { + type: "boosterItem", + itemId: e, + itemVersion: t, defId: a, - name: - "bonus_level_super_level_pack" === a - ? "superLevelPack" - : "cloud9", + booster: a.startsWith("autopilot") + ? Pu() + : a.startsWith("missiles") + ? Mu() + : Lu(), + usesLeft: n * i, } - : a.endsWith("_pass") - ? { - type: "passItem", - itemId: e, - defId: a, - itemVersion: t, - passType: "achievement", - } - : a.startsWith("slowmo") || - a.startsWith("missiles") || - a.startsWith("autopilot") - ? { - type: "boosterItem", - itemId: e, - itemVersion: t, - defId: a, - booster: a.startsWith("autopilot") - ? Pu() - : a.startsWith("missiles") - ? Mu() - : Lu(), - usesLeft: n * i, - } - : null; - } - const Ah = kc({ - status: _c(200), - data: kc({ - results: kc({ - items: Oc( - kc({ - itemId: mc, - version: fc, - usesLeft: Bc([hc, fc]), - quantity: fc, - defId: mc, - }), - ), + : null; + } + const Ah = kc({ + status: _c(200), + data: kc({ + results: kc({ + items: Oc( + kc({ + itemId: mc, + version: fc, + usesLeft: Bc([hc, fc]), + quantity: fc, + defId: mc, }), - }), + ), }), - kh = kc({ status: _c(200), data: kc({ response: mc }) }), - Nh = kc({ - status: mc, - id: mc, - title: mc, - extraData: Bc([ - xc({ - items: Oc(Th), - blocks: mc, - category: Bc([ - _c("bronze"), - _c("silver"), - _c("gold"), - _c("levelPack"), - ]), + }), + }), + kh = kc({ status: _c(200), data: kc({ response: mc }) }), + Nh = kc({ + status: mc, + id: mc, + title: mc, + extraData: Bc([ + xc({ + items: Oc(Th), + blocks: mc, + category: Bc([ + _c("bronze"), + _c("silver"), + _c("gold"), + _c("levelPack"), + ]), + }), + hc, + ]), + }), + xh = (e) => e.id.startsWith("reward_"), + Ph = (e, t) => { + var a, i, n, s; + return { + id: e.id, + name: e.title, + unlocked: "AWARDED" === e.status, + category: + (null === (a = e.extraData) || void 0 === a + ? void 0 + : a.category) || "bronze", + rewards: { + collected: + "AWARDED" === + (null === (i = t.find((t) => t.id === `reward_${e.id}`)) || + void 0 === i + ? void 0 + : i.status), + blocks: Number( + (null === (n = e.extraData) || void 0 === n + ? void 0 + : n.blocks) || "0", + ), + items: ( + (null === (s = e.extraData) || void 0 === s + ? void 0 + : s.items) || [] + ).map((e) => ({ + name: e.name || e.defId, + blocksPrice: 0, + defId: e.defId, + })), + }, + }; + }, + Mh = kc({ + status: _c(200), + data: kc({ response: Bc([mc, Oc(Nh)]) }), + }), + Lh = kc({ + status: _c(200), + data: kc({ + response: Bc([ + mc, + kc({ + hasPass: yc, + achievements: Oc( + kc({ justUnlocked: yc, achievement: Nh, reward: Nh }), + ), }), - hc, ]), }), - xh = (e) => e.id.startsWith("reward_"), - Ph = (e, t) => { - var a, i, n, s; - return { - id: e.id, - name: e.title, - unlocked: "AWARDED" === e.status, - category: - (null === (a = e.extraData) || void 0 === a - ? void 0 - : a.category) || "bronze", - rewards: { - collected: - "AWARDED" === - (null === (i = t.find((t) => t.id === `reward_${e.id}`)) || - void 0 === i - ? void 0 - : i.status), - blocks: Number( - (null === (n = e.extraData) || void 0 === n - ? void 0 - : n.blocks) || "0", - ), - items: ( - (null === (s = e.extraData) || void 0 === s - ? void 0 - : s.items) || [] - ).map((e) => ({ - name: e.name || e.defId, - blocksPrice: 0, - defId: e.defId, - })), + }); + function Dh(e, t) { + return Wu(this, void 0, void 0, function* () { + return new Promise((a, i) => { + e.script.runScript( + "client/AwardAchievement", + { + achievementId: `${t}#${t.charCodeAt(1)}`, + lego: !zu.hasIAP(), }, - }; - }, - Mh = kc({ - status: _c(200), - data: kc({ response: Bc([mc, Oc(Nh)]) }), - }), - Lh = kc({ - status: _c(200), - data: kc({ - response: Bc([ - mc, - kc({ - hasPass: yc, - achievements: Oc( - kc({ justUnlocked: yc, achievement: Nh, reward: Nh }), - ), - }), - ]), - }), - }); - function Dh(e, t) { - return Wu(this, void 0, void 0, function* () { - return new Promise((a, i) => { - e.script.runScript( - "client/AwardAchievement", - { - achievementId: `${t}#${t.charCodeAt(1)}`, - lego: !zu.hasIAP(), - }, - (n) => { - const s = Zu(n, Lh); - if (!(s instanceof Error)) - return 200 !== s.status - ? eh(s) - ? lh(e) - .then(() => Dh(e, t)) - .then(a) - .catch(i) - : void i(Error(String(s.reason_code))) - : void ("string" != typeof s.data.response - ? a({ - hasPass: s.data.response.hasPass, - achievements: s.data.response.achievements.map( - (e) => ({ - justUnlocked: e.justUnlocked, - achievement: Ph(e.achievement, [e.reward]), - }), - ), - }) - : i(Error(s.data.response))); - i(s); - }, - ); - }); + (n) => { + const s = Zu(n, Lh); + if (!(s instanceof Error)) + return 200 !== s.status + ? eh(s) + ? lh(e) + .then(() => Dh(e, t)) + .then(a) + .catch(i) + : void i(Error(String(s.reason_code))) + : void ("string" != typeof s.data.response + ? a({ + hasPass: s.data.response.hasPass, + achievements: s.data.response.achievements.map( + (e) => ({ + justUnlocked: e.justUnlocked, + achievement: Ph(e.achievement, [e.reward]), + }), + ), + }) + : i(Error(s.data.response))); + i(s); + }, + ); }); - } - const Bh = kc({ + }); + } + const Bh = kc({ + status: _c(200), + data: kc({ + response: Bc([mc, kc({ allUserItems: Eh, balance: fc })]), + }), + }); + function Fh(e) { + e.rttService.disableRTT(); + } + const Yh = kc({ + status: _c(200), + data: kc({ profileId: mc, profileName: mc }), + }), + Uh = kc({ + status: _c(200), + data: kc({ matches: Oc(kc({ profileId: mc, profileName: mc })) }), + }), + jh = kc({ status: _c(200) }), + Gh = kc({ status: _c(200) }), + Vh = kc({ status: _c(200) }), + Hh = "inviteToParty", + Xh = kc({ fromPlayerName: mc, lobbyId: mc }), + zh = "sendFriendRequest", + Wh = kc({ fromPlayerName: mc }), + qh = "acceptFriendRequest", + $h = kc({ fromPlayerName: mc }), + Jh = Uc([ + kc({ fromPlayerId: mc }), + Bc([ + kc({ eventType: _c(Hh), eventData: Xh }), + kc({ eventType: _c(zh), eventData: Wh }), + kc({ eventType: _c(qh), eventData: $h }), + ]), + ]), + Kh = kc({ service: _c("event"), data: Jh }), + Qh = kc({ status: _c(200), data: kc({ - response: Bc([mc, kc({ allUserItems: Eh, balance: fc })]), + response: Bc([ + mc, + kc({ + allFriends: Oc(kc({ name: mc, playerId: mc })), + allEvents: Oc(Jh), + properties: kc({ down_for_maintenance: kc({ value: mc }) }), + }), + ]), }), }); - function Fh(e) { - e.rttService.disableRTT(); - } - const Yh = kc({ - status: _c(200), - data: kc({ profileId: mc, profileName: mc }), - }), - Uh = kc({ - status: _c(200), - data: kc({ matches: Oc(kc({ profileId: mc, profileName: mc })) }), - }), - jh = kc({ status: _c(200) }), - Gh = kc({ status: _c(200) }), - Vh = kc({ status: _c(200) }), - Hh = "inviteToParty", - Xh = kc({ fromPlayerName: mc, lobbyId: mc }), - zh = "sendFriendRequest", - Wh = kc({ fromPlayerName: mc }), - qh = "acceptFriendRequest", - $h = kc({ fromPlayerName: mc }), - Jh = Uc([ - kc({ fromPlayerId: mc }), - Bc([ - kc({ eventType: _c(Hh), eventData: Xh }), - kc({ eventType: _c(zh), eventData: Wh }), - kc({ eventType: _c(qh), eventData: $h }), - ]), - ]), - Kh = kc({ service: _c("event"), data: Jh }), - Qh = kc({ - status: _c(200), - data: kc({ - response: Bc([ - mc, - kc({ - allFriends: Oc(kc({ name: mc, playerId: mc })), - allEvents: Oc(Jh), - properties: kc({ down_for_maintenance: kc({ value: mc }) }), - }), - ]), - }), - }); - function Zh(e) { - return Wu(this, void 0, void 0, function* () { - return new Promise((t, a) => { - e.script.runScript("client/SetupOnline", {}, (i) => { - const n = Zu(i, Qh); - if (n instanceof Error) return void a(n); - if (200 !== n.status) - return eh(n) - ? lh(e) - .then(() => Zh(e)) - .then(t) - .catch(a) - : void a(Error(String(n.reason_code))); - if ("string" == typeof n.data.response) - return void a(Error(n.data.response)); - const s = n.data.response.allFriends.map((e) => e.playerId), - o = []; - t({ - friends: n.data.response.allFriends.map((e) => ({ - playerName: e.name, - profileId: e.playerId, + function Zh(e) { + return Wu(this, void 0, void 0, function* () { + return new Promise((t, a) => { + e.script.runScript("client/SetupOnline", {}, (i) => { + const n = Zu(i, Qh); + if (n instanceof Error) return void a(n); + if (200 !== n.status) + return eh(n) + ? lh(e) + .then(() => Zh(e)) + .then(t) + .catch(a) + : void a(Error(String(n.reason_code))); + if ("string" == typeof n.data.response) + return void a(Error(n.data.response)); + const s = n.data.response.allFriends.map((e) => e.playerId), + o = []; + t({ + friends: n.data.response.allFriends.map((e) => ({ + playerName: e.name, + profileId: e.playerId, + })), + friendRequests: n.data.response.allEvents + .filter( + (e) => + !( + e.eventType !== zh || + s.includes(e.fromPlayerId) || + o.includes(e.fromPlayerId) || + (o.push(e.fromPlayerId), 0) + ), + ) + .map((e) => ({ + profileId: e.fromPlayerId, + playerName: e.eventData.fromPlayerName, })), - friendRequests: n.data.response.allEvents - .filter( - (e) => - !( - e.eventType !== zh || - s.includes(e.fromPlayerId) || - o.includes(e.fromPlayerId) || - (o.push(e.fromPlayerId), 0) - ), - ) - .map((e) => ({ - profileId: e.fromPlayerId, - playerName: e.eventData.fromPlayerName, - })), - globalProperties: { - downForMaintenance: - "true" === - n.data.response.properties.down_for_maintenance.value, - }, - }); + globalProperties: { + downForMaintenance: + "true" === + n.data.response.properties.down_for_maintenance.value, + }, }); }); }); - } - const ep = {}, - tp = {}, - ap = { - strategy: "ranged-absolute", - alignment: "center", - ranges: [1000], - }, - ip = {}, - np = (e, t) => ({ type: "joinedPlayer", skin: e.fileName, rank: t }), - sp = kc({ status: _c(200) }), - op = kc({ status: _c(200) }), - rp = kc({ status: _c(200) }), - lp = kc({ status: _c(200) }), - cp = kc({ status: _c(200) }), - dp = kc({ - service: _c("lobby"), - operation: Bc([ - _c("MEMBER_JOIN"), - _c("MEMBER_LEFT"), - _c("MEMBER_UPDATE"), - _c("STATUS_UPDATE"), - _c("STARTING"), - _c("JOIN_FAIL"), + }); + } + const ep = {}, + tp = {}, + ap = { + strategy: "ranged-absolute", + alignment: "center", + ranges: [1000], + }, + ip = {}, + np = (e, t) => ({ type: "joinedPlayer", skin: e.fileName, rank: t }), + sp = kc({ status: _c(200) }), + op = kc({ status: _c(200) }), + rp = kc({ status: _c(200) }), + lp = kc({ status: _c(200) }), + cp = kc({ status: _c(200) }), + dp = kc({ + service: _c("lobby"), + operation: Bc([ + _c("MEMBER_JOIN"), + _c("MEMBER_LEFT"), + _c("MEMBER_UPDATE"), + _c("STATUS_UPDATE"), + _c("STARTING"), + _c("JOIN_FAIL"), + ]), + data: kc({ + lobbyId: mc, + lobby: Uc([ + kc({ + members: Oc( + kc({ + profileId: mc, + name: mc, + cxId: mc, + extra: Bc([ + hc, + kc({}), + kc({ type: _c("joinedPlayer"), rank: fc, skin: mc }), + kc({ + type: _c("allMembers"), + skins: Lc(mc, kc({ rank: fc, skin: mc })), + }), + ]), + }), + ), + owner: mc, + }), + xc({ + lobbyTypeDef: kc({ teams: Lc(mc, kc({ maxUsers: fc })) }), + }), ]), - data: kc({ - lobbyId: mc, - lobby: Uc([ - kc({ - members: Oc( - kc({ - profileId: mc, - name: mc, - cxId: mc, - extra: Bc([ - hc, - kc({}), - kc({ type: _c("joinedPlayer"), rank: fc, skin: mc }), - kc({ - type: _c("allMembers"), - skins: Lc(mc, kc({ rank: fc, skin: mc })), - }), - ]), - }), - ), - owner: mc, - }), - xc({ - lobbyTypeDef: kc({ teams: Lc(mc, kc({ maxUsers: fc })) }), - }), - ]), - }), - }), - up = kc({ - service: _c("lobby"), - operation: _c("MATCHMAKING_IN_PROGRESS"), - data: kc({ lobbyType: mc }), - }), - hp = kc({ - service: _c("lobby"), - operation: Bc([_c("ROOM_ASSIGNED"), _c("ROOM_READY")]), - data: kc({ - lobbyId: mc, - connectData: kc({ address: mc, ports: Lc(mc, fc) }), - passcode: mc, - }), }), - pp = kc({ - service: _c("lobby"), - operation: _c("DISBANDED"), - data: kc({ lobbyId: mc, reason: kc({ code: fc, desc: mc }) }), + }), + up = kc({ + service: _c("lobby"), + operation: _c("MATCHMAKING_IN_PROGRESS"), + data: kc({ lobbyType: mc }), + }), + hp = kc({ + service: _c("lobby"), + operation: Bc([_c("ROOM_ASSIGNED"), _c("ROOM_READY")]), + data: kc({ + lobbyId: mc, + connectData: kc({ address: mc, ports: Lc(mc, fc) }), + passcode: mc, }), - gp = Bc([dp, up, hp, pp]), - mp = (e) => { - setTimeout(e, 150 + 150 * Math.random()); + }), + pp = kc({ + service: _c("lobby"), + operation: _c("DISBANDED"), + data: kc({ lobbyId: mc, reason: kc({ code: fc, desc: mc }) }), + }), + gp = Bc([dp, up, hp, pp]), + mp = (e) => { + setTimeout(e, 150 + 150 * Math.random()); + }, + fp = [ + { + name: "1 Missile Booster", + buyPrice: { [qu]: 50 }, + defId: "missiles1", }, - fp = [ - { - name: "1 Missile Booster", - buyPrice: { [qu]: 50 }, - defId: "missiles1", - }, - { - name: "5 Slow Motion Boosters", - buyPrice: { [qu]: 180 }, - defId: "slowmo5", - }, - { - name: "20 Autopilot Boosters", - buyPrice: { [qu]: 300 }, - defId: "autopilot20", - }, - { - name: "Achievement Pass", - buyPrice: { [qu]: 400 }, - defId: "achievement_pass", - }, - { - name: "Switch button and platform in level editor", - buyPrice: {}, - defId: "editor_switch_button", - }, - { name: null, buyPrice: { [qu]: 250 }, defId: "skin_superhero" }, - { - name: "Super Level Pack", - buyPrice: { [qu]: 400 }, - defId: "bonus_level_super_level_pack", + { + name: "5 Slow Motion Boosters", + buyPrice: { [qu]: 180 }, + defId: "slowmo5", + }, + { + name: "20 Autopilot Boosters", + buyPrice: { [qu]: 300 }, + defId: "autopilot20", + }, + { + name: "Achievement Pass", + buyPrice: { [qu]: 400 }, + defId: "achievement_pass", + }, + { + name: "Switch button and platform in level editor", + buyPrice: {}, + defId: "editor_switch_button", + }, + { name: null, buyPrice: { [qu]: 250 }, defId: "skin_superhero" }, + { + name: "Super Level Pack", + buyPrice: { [qu]: 400 }, + defId: "bonus_level_super_level_pack", + }, + ], + yp = { + initialize() { }, + brainCloudClient: { registerGlobalErrorCallback() { } }, + authenticateAnonymous(e) { + const t = { + status: 200, + data: { + profileId: "k4f7ca4d-cb9e-4694-8582-194dc6ddb373", + playerName: "Player", + currency: { blocks: { balance: 200 } }, + experiencePoints: 100, + summaryFriendData: null, + }, + }; + mp(() => { + e(t); + }); + }, + authenticateEmailPassword(e, t, a, i) { + i({}); + }, + authenticateApple(e, t, a, i) { + const n = { + status: 200, + data: { + profileId: "k4f7ca4d-cb9e-4694-8582-194dc6ddb373", + playerName: "Player", + currency: { blocks: { balance: 200 } }, + experiencePoints: 100, + summaryFriendData: null, + }, + }; + mp(() => { + i(n); + }); + }, + authenticateGoogleOpenId(e, t, a, i) { + const n = { + status: 200, + data: { + profileId: "k4f7ca4d-cb9e-4694-8582-194dc6ddb373", + playerName: "Player", + currency: { blocks: { balance: 200 } }, + experiencePoints: 100, + summaryFriendData: null, + }, + }; + mp(() => { + i(n); + }); + }, + identity: { + attachAppleIdentity(e, t, a) { + const i = { status: 200 }; + mp(() => { + a(i); + }); }, - ], - yp = { - initialize() {}, - brainCloudClient: { registerGlobalErrorCallback() {} }, - authenticateAnonymous(e) { - const t = { + mergeAppleIdentity(e, t, a) { + const i = { status: 200, - data: { - profileId: "k4f7ca4d-cb9e-4694-8582-194dc6ddb373", - playerName: "Player", - currency: { blocks: { balance: 200 } }, - experiencePoints: 100, - summaryFriendData: null, - }, + data: { profileId: "f94f7e2d-3cdd-4fd6-9c28-392f7875e9df" }, }; mp(() => { - e(t); + a(i); }); }, - authenticateEmailPassword(e, t, a, i) { - i({}); + detachAppleIdentity(e, t, a) { + const i = { status: 200 }; + mp(() => { + a(i); + }); }, - authenticateApple(e, t, a, i) { - const n = { - status: 200, - data: { - profileId: "k4f7ca4d-cb9e-4694-8582-194dc6ddb373", - playerName: "Player", - currency: { blocks: { balance: 200 } }, - experiencePoints: 100, - summaryFriendData: null, - }, - }; + attachGoogleOpenIdIdentity(e, t, a) { + const i = { status: 200 }; mp(() => { - i(n); + a(i); }); }, - authenticateGoogleOpenId(e, t, a, i) { - const n = { + mergeGoogleOpenIdIdentity(e, t, a) { + const i = { status: 200, - data: { - profileId: "k4f7ca4d-cb9e-4694-8582-194dc6ddb373", - playerName: "Player", - currency: { blocks: { balance: 200 } }, - experiencePoints: 100, - summaryFriendData: null, - }, + data: { profileId: "f94f7e2d-3cdd-4fd6-9c28-392f7875e9df" }, }; mp(() => { - i(n); + a(i); }); }, - identity: { - attachAppleIdentity(e, t, a) { - const i = { status: 200 }; - mp(() => { - a(i); - }); - }, - mergeAppleIdentity(e, t, a) { - const i = { - status: 200, - data: { profileId: "f94f7e2d-3cdd-4fd6-9c28-392f7875e9df" }, - }; - mp(() => { - a(i); - }); - }, - detachAppleIdentity(e, t, a) { - const i = { status: 200 }; - mp(() => { - a(i); - }); - }, - attachGoogleOpenIdIdentity(e, t, a) { - const i = { status: 200 }; - mp(() => { - a(i); - }); - }, - mergeGoogleOpenIdIdentity(e, t, a) { - const i = { - status: 200, - data: { profileId: "f94f7e2d-3cdd-4fd6-9c28-392f7875e9df" }, - }; - mp(() => { - a(i); - }); - }, - detachGoogleOpenIdIdentity(e, t, a) { - const i = { status: 200 }; - mp(() => { - a(i); - }); - }, - }, - reconnectRef() { - return ( - void 0 === this.mockReconnect && - (this.mockReconnect = new Promise((e) => { - this.reconnect(e); - }).then((e) => ((this.mockReconnect = void 0), e))), - new Promise((e) => { - var t; - return null === (t = this.mockReconnect) || void 0 === t - ? void 0 - : t.then((t) => e(t)); - }) - ); - }, - reconnect(e) { - const t = { - status: 200, - data: { - profileId: "k4f7ca4d-cb9e-4694-8582-194dc6ddb373", - playerName: "Player", - currency: { blocks: { balance: 200 } }, - experiencePoints: 100, - summaryFriendData: null, - }, - }; + detachGoogleOpenIdIdentity(e, t, a) { + const i = { status: 200 }; mp(() => { - e(t); + a(i); }); }, - setStoredProfileId() {}, - resetStoredAnonymousId() {}, - resetStoredProfileId() {}, - playerState: { - deleteUser(e) { - mp(() => { - e({ status: 200 }); - }); - }, - logout(e) { - mp(() => { - e({}); - }); - }, - updateUserName(e, t) { - mp(() => { - t({ status: 200 }); - }); - }, - updateAttributes(e, t, a) { - mp(() => { - a({ status: 200 }); - }); + }, + reconnectRef() { + return ( + void 0 === this.mockReconnect && + (this.mockReconnect = new Promise((e) => { + this.reconnect(e); + }).then((e) => ((this.mockReconnect = void 0), e))), + new Promise((e) => { + var t; + return null === (t = this.mockReconnect) || void 0 === t + ? void 0 + : t.then((t) => e(t)); + }) + ); + }, + reconnect(e) { + const t = { + status: 200, + data: { + profileId: "k4f7ca4d-cb9e-4694-8582-194dc6ddb373", + playerName: "Player", + currency: { blocks: { balance: 200 } }, + experiencePoints: 100, + summaryFriendData: null, }, + }; + mp(() => { + e(t); + }); + }, + setStoredProfileId() { }, + resetStoredAnonymousId() { }, + resetStoredProfileId() { }, + playerState: { + deleteUser(e) { + mp(() => { + e({ status: 200 }); + }); }, - pushNotification: { - registerPushNotificationDeviceToken(e, t, a) { - mp(() => { - a({ status: 200 }); - }); - }, + logout(e) { + mp(() => { + e({}); + }); }, - globalApp: { - readProperties(e) { - mp(() => { - e({}); - }); - }, + updateUserName(e, t) { + mp(() => { + t({ status: 200 }); + }); }, - entity: { - getSingleton(e, t) { - const a = { status: 200, data: null }; - mp(() => { - t(a); - }); - }, - updateSingleton(e, t, a, i, n) { - const s = { status: 200 }; - mp(() => { - n(s); - }); - }, + updateAttributes(e, t, a) { + mp(() => { + a({ status: 200 }); + }); }, - script: { - runScript(e, t, a) { - if ("client/AwardAchievement" !== e) - if ("client/CollectRewards" !== e) - if ("client/EquipSkin" !== e) - if ("client/SyncProfile" !== e) - if ("client/ReadAchievements" !== e) - if ("client/SetupOnline" !== e); - else { - const e = { - status: 200, - data: { - response: { - allFriends: [ - { - playerId: - "b3f7ca4d-cb9e-4694-8582-194dc6ddb373", - name: "TestPlayer1", - }, - { - playerId: - "2230cb6d-b102-4ded-a31a-6cf5cc6e64ad", - name: "TestPlayer2", - }, - ], - allEvents: [], - properties: { - down_for_maintenance: { value: "false" }, - }, - }, - }, - }; - mp(() => { - a(e); - }); - } + }, + pushNotification: { + registerPushNotificationDeviceToken(e, t, a) { + mp(() => { + a({ status: 200 }); + }); + }, + }, + globalApp: { + readProperties(e) { + mp(() => { + e({}); + }); + }, + }, + entity: { + getSingleton(e, t) { + const a = { status: 200, data: null }; + mp(() => { + t(a); + }); + }, + updateSingleton(e, t, a, i, n) { + const s = { status: 200 }; + mp(() => { + n(s); + }); + }, + }, + script: { + runScript(e, t, a) { + if ("client/AwardAchievement" !== e) + if ("client/CollectRewards" !== e) + if ("client/EquipSkin" !== e) + if ("client/SyncProfile" !== e) + if ("client/ReadAchievements" !== e) + if ("client/SetupOnline" !== e); else { - const e = Math.random(), - t = Math.random(), - i = { - status: 200, - data: { - response: [ - { - id: "test1", - title: - "Picked up all 100 collectibles beating accelerated", - status: "AWARDED", - extraData: { - blocks: "100", - items: [fp[5], fp[4]], - category: - e < 0.2 - ? "bronze" - : e < 0.4 - ? "silver" - : e < 0.6 - ? "gold" - : "levelPack", - }, - }, - { - id: "reward_test1", - title: "Reward for Test 1", - status: "NOT AWARDED", - extraData: null, - }, + const e = { + status: 200, + data: { + response: { + allFriends: [ { - id: "test2", - title: "Test 2", - status: "NOT_AWARDED", - extraData: { - blocks: "100", - items: [fp[2]], - category: - t < 0.2 - ? "bronze" - : t < 0.4 - ? "silver" - : t < 0.6 - ? "gold" - : "levelPack", - }, + playerId: + "b3f7ca4d-cb9e-4694-8582-194dc6ddb373", + name: "TestPlayer1", }, - ...Array.from({ length: 2 }).map((e, t) => ({ - id: `id_test${t}`, - title: `Test ${t}`, - status: "NOT_AWARDED", - extraData: { - blocks: "100", - items: [], - category: "levelPack", - }, - })), { - id: "reward_test2", - title: "Reward for Test 2", - status: "AWARDED", - extraData: null, + playerId: + "2230cb6d-b102-4ded-a31a-6cf5cc6e64ad", + name: "TestPlayer2", }, ], + allEvents: [], + properties: { + down_for_maintenance: { value: "false" }, + }, }, - }; + }, + }; mp(() => { - a(i); + a(e); }); } - else - mp(() => { - a({ + else { + const e = Math.random(), + t = Math.random(), + i = { status: 200, data: { - response: { - allUserItems: [], - attributes: { notifySuperLevelPack: "false" }, - entities: { [fh]: null, [yh]: null }, - }, + response: [ + { + id: "test1", + title: + "Picked up all 100 collectibles beating accelerated", + status: "AWARDED", + extraData: { + blocks: "100", + items: [fp[5], fp[4]], + category: + e < 0.2 + ? "bronze" + : e < 0.4 + ? "silver" + : e < 0.6 + ? "gold" + : "levelPack", + }, + }, + { + id: "reward_test1", + title: "Reward for Test 1", + status: "NOT AWARDED", + extraData: null, + }, + { + id: "test2", + title: "Test 2", + status: "NOT_AWARDED", + extraData: { + blocks: "100", + items: [fp[2]], + category: + t < 0.2 + ? "bronze" + : t < 0.4 + ? "silver" + : t < 0.6 + ? "gold" + : "levelPack", + }, + }, + ...Array.from({ length: 2 }).map((e, t) => ({ + id: `id_test${t}`, + title: `Test ${t}`, + status: "NOT_AWARDED", + extraData: { + blocks: "100", + items: [], + category: "levelPack", + }, + })), + { + id: "reward_test2", + title: "Reward for Test 2", + status: "AWARDED", + extraData: null, + }, + ], }, - }); + }; + mp(() => { + a(i); }); + } else mp(() => { - a({ status: 200, data: { response: "" } }); + a({ + status: 200, + data: { + response: { + allUserItems: [], + attributes: { notifySuperLevelPack: "false" }, + entities: { [fh]: null, [yh]: null }, + }, + }, + }); }); else mp(() => { - a({ - status: 200, - data: { response: { allUserItems: [], balance: 120 } }, - }); + a({ status: 200, data: { response: "" } }); }); - else { - const e = Math.random(), - t = { + else + mp(() => { + a({ status: 200, - data: { - response: { - hasPass: !zu.hasIAP(), - achievements: [ - { - justUnlocked: true, - achievement: { - id: "test", - title: - "Picked up all 100 collectibles beating accelerated", - status: "AWARDED", - extraData: { - blocks: "100", - items: [fp[5], fp[4]], - category: - e < 0.2 - ? "bronze" - : e < 0.4 - ? "silver" - : e < 0.6 - ? "gold" - : "levelPack", - }, - }, - reward: { - id: "reward_test", - title: "Reward for Completed level", - status: "NOT_AWARDED", - extraData: null, + data: { response: { allUserItems: [], balance: 120 } }, + }); + }); + else { + const e = Math.random(), + t = { + status: 200, + data: { + response: { + hasPass: !zu.hasIAP(), + achievements: [ + { + justUnlocked: true, + achievement: { + id: "test", + title: + "Picked up all 100 collectibles beating accelerated", + status: "AWARDED", + extraData: { + blocks: "100", + items: [fp[5], fp[4]], + category: + e < 0.2 + ? "bronze" + : e < 0.4 + ? "silver" + : e < 0.6 + ? "gold" + : "levelPack", }, }, - ], - }, - }, - }; - mp(() => { - a(t); - }); - } - }, - }, - friend: { - listFriends(e, t, a) { - mp(() => { - a({}); - }); - }, - addFriends(e, t) { - const a = { status: 200 }; - mp(() => { - t(a); - }); - }, - removeFriends(e, t) { - const a = { status: 200 }; - mp(() => { - t(a); - }); - }, - getSummaryDataForProfileId(e, t) { - const a = { - status: 200, - data: { profileId: e, profileName: "" }, - }; - mp(() => { - t(a); - }); - }, - findUsersByExactName(e, t, a) { - const i = { - status: 200, - data: { - matches: [ - { - profileId: "b3f7ca4d-cb9e-4694-8582-194dc6ddb373", - profileName: "TestPlayer", - }, - { - profileId: "2230cb6d-b102-4ded-a31a-6cf5cc6e64ad", - profileName: "TestPlayer", + reward: { + id: "reward_test", + title: "Reward for Completed level", + status: "NOT_AWARDED", + extraData: null, + }, + }, + ], }, - ], - }, - }; + }, + }; mp(() => { - a(i); + a(t); }); - }, + } }, - appStore: { - getSalesInventory(e, t, a) { - const i = { - status: 200, - data: { - productInventory: [ - { - itemId: "id.blocks1000", - title: "1000 Blocks", - priceData: { - ids: [{ appId: "iphone", itunesId: "blocks1000" }], - }, - }, - { - itemId: "id.blocks100", - title: "100 Blocks", - priceData: { - ids: [{ appId: "iphone", itunesId: "blocks100" }], - }, - }, - ], - }, - }; - mp(() => { - a(i); - }); - }, - verifyPurchase(e, t, a) { - const i = { - status: 200, - data: { - resultCode: 0, - currency: { blocks: { balance: 1000 } }, - }, - }; - mp(() => { - a(i); - }); - }, + }, + friend: { + listFriends(e, t, a) { + mp(() => { + a({}); + }); }, - gamification: { - readAchievements(e) { - mp(() => { - e({}); - }); - }, - awardAchievements: (e, t) => { - const a = { - status_message: - "Processing exception (message): VIOLATION: Not allowed to call gamification:AWARD_ACHIEVEMENTS from client.", - reason_code: 99999, - status: 403, - }; - mp(() => { - t(a); - }); - }, + addFriends(e, t) { + const a = { status: 200 }; + mp(() => { + t(a); + }); }, - userItems: { - getUserItemsPage(e, t, a) { - const i = { status: 200, data: { results: { items: [] } } }; - mp(() => { - a(i); - }); - }, - purchaseUserItem(e, t, a, i, n) { - const s = { - status: 200, - data: { - currencyBalances: { - currencyMap: { [qu]: { balance: 50 } }, + removeFriends(e, t) { + const a = { status: 200 }; + mp(() => { + t(a); + }); + }, + getSummaryDataForProfileId(e, t) { + const a = { + status: 200, + data: { profileId: e, profileName: "" }, + }; + mp(() => { + t(a); + }); + }, + findUsersByExactName(e, t, a) { + const i = { + status: 200, + data: { + matches: [ + { + profileId: "b3f7ca4d-cb9e-4694-8582-194dc6ddb373", + profileName: "TestPlayer", + }, + { + profileId: "2230cb6d-b102-4ded-a31a-6cf5cc6e64ad", + profileName: "TestPlayer", + }, + ], + }, + }; + mp(() => { + a(i); + }); + }, + }, + appStore: { + getSalesInventory(e, t, a) { + const i = { + status: 200, + data: { + productInventory: [ + { + itemId: "id.blocks1000", + title: "1000 Blocks", + priceData: { + ids: [{ appId: "iphone", itunesId: "blocks1000" }], + }, }, - items: { - itemId: { - itemId: "itemId-xcs2g", - defId: e, - version: 1, - quantity: 1, - usesLeft: 5, + { + itemId: "id.blocks100", + title: "100 Blocks", + priceData: { + ids: [{ appId: "iphone", itunesId: "blocks100" }], }, }, + ], + }, + }; + mp(() => { + a(i); + }); + }, + verifyPurchase(e, t, a) { + const i = { + status: 200, + data: { + resultCode: 0, + currency: { blocks: { balance: 1000 } }, + }, + }; + mp(() => { + a(i); + }); + }, + }, + gamification: { + readAchievements(e) { + mp(() => { + e({}); + }); + }, + awardAchievements: (e, t) => { + const a = { + status_message: + "Processing exception (message): VIOLATION: Not allowed to call gamification:AWARD_ACHIEVEMENTS from client.", + reason_code: 99999, + status: 403, + }; + mp(() => { + t(a); + }); + }, + }, + userItems: { + getUserItemsPage(e, t, a) { + const i = { status: 200, data: { results: { items: [] } } }; + mp(() => { + a(i); + }); + }, + purchaseUserItem(e, t, a, i, n) { + const s = { + status: 200, + data: { + currencyBalances: { + currencyMap: { [qu]: { balance: 50 } }, }, - }; - mp(() => { - n(s); - }); - }, - useUserItem(e, t, a, i, n) { - const s = { - status: 200, - data: { - item: { - defId: "defId", - itemId: "itemId", + items: { + itemId: { + itemId: "itemId-xcs2g", + defId: e, version: 1, quantity: 1, usesLeft: 5, }, }, - }; - mp(() => { - n(s); - }); - }, - }, - itemCatalog: { - getCatalogItemsPage(e, t) { - const a = { status: 200, data: { results: { items: fp } } }; - mp(() => { - t(a); - }); - }, + }, + }; + mp(() => { + n(s); + }); }, - rttService: { - enableRTT(e) { - mp(e); - }, - disableRTT() {}, - registerRTTLobbyCallback(e) { - Ep.sendLobbyCallback = e; - }, - deregisterRTTLobbyCallback() {}, - registerRTTEventCallback(e) { - Ep.sendEventCallback = e; - }, - deregisterRTTEventCallback() {}, - }, - event: { - sendEvent(e, t, a, i) { - const n = { status: 200 }; - mp(() => { - i(n); - }); - }, - getEvents(e) { - mp(() => { - e({}); - }); - }, + useUserItem(e, t, a, i, n) { + const s = { + status: 200, + data: { + item: { + defId: "defId", + itemId: "itemId", + version: 1, + quantity: 1, + usesLeft: 5, + }, + }, + }; + mp(() => { + n(s); + }); }, - lobby: { - createLobby(e, t, a, i, n, s, o, r) { - const l = { status: 200 }; - mp(() => { - r(l); - }); - }, - joinLobby(e, t, a, i, n, s) { - const o = { status: 200 }; - mp(() => { - s(o); - }); - }, - findOrCreateLobby(e, t, a, i, n, s, o, r, l, c, d) { - const u = { status: 200 }; - mp(() => { - d(u); - }); - }, - leaveLobby(e, t) { - const a = { status: 200 }; - mp(() => { - t(a); - }); - }, + }, + itemCatalog: { + getCatalogItemsPage(e, t) { + const a = { status: 200, data: { results: { items: fp } } }; + mp(() => { + t(a); + }); }, }, - Ep = { sendLobbyCallback: () => null, sendEventCallback: () => null }; - const bp = { - getBackend: function (e) { - { - const t = new Au.RX("loginWrapper"); - (t.initialize( - "13731", - "6e0ce653-68f8-4c53-9449-a5ebf6887772", - ku, - ), - t.brainCloudClient.registerGlobalErrorCallback((t) => { - "string" == typeof t && "" === t && e(); - })); - let a = null; - return ( - (t.reconnectRef = () => ( - null === a && - (a = new Promise((e) => { - t.reconnect(e); - }).then((e) => ((a = null), e))), - a - )), - t - ); - } + rttService: { + enableRTT(e) { + mp(e); }, - setupOnline: function (e, t, a) { - return Wu(this, void 0, void 0, function* () { - const i = new Promise((t, a) => { - e.rttService.enableRTT(t, a); - }).then(() => { - (e.rttService.registerRTTEventCallback( - ((e) => (t) => { - const a = Md(t, Kh); - a instanceof Error || - e( - (function (e) { - const t = e.data.fromPlayerId; - switch (e.data.eventType) { - case "inviteToParty": - return { - type: "invite", - from: { - profileId: t, - playerName: - e.data.eventData.fromPlayerName, - }, - lobbyId: e.data.eventData.lobbyId, - }; - case "sendFriendRequest": - return { - type: "friendRequest", - from: { - profileId: t, - playerName: - e.data.eventData.fromPlayerName, - }, - }; - case "acceptFriendRequest": - return { - type: "friendRequestAccept", - from: { - profileId: t, - playerName: - e.data.eventData.fromPlayerName, - }, - }; - } - })(a), - ); - })(t), - ), - e.rttService.registerRTTLobbyCallback( - ((e) => (t) => { - var a, i; - const n = Md(t, gp); - if (n instanceof Error) - return void console.error("Lobby event error", n); - const s = - "lobbyId" in n.data && - n.data.lobbyId.includes("friends") - ? n.data.lobbyId.includes("server") - ? "friendsServer" - : "friendsLobby" - : "royaleLobby", - o = "friendsServer" === s || "royaleLobby" === s; - switch (n.operation) { - case "MEMBER_JOIN": - case "STATUS_UPDATE": - case "MEMBER_LEFT": - case "MEMBER_UPDATE": - const t = - (null === - (i = - null === (a = n.data.lobby.lobbyTypeDef) || - void 0 === a - ? void 0 - : a.teams.all) || void 0 === i - ? void 0 - : i.maxUsers) || 0; - e( - "royaleLobby" === s - ? { - type: s, - lobby: { - type: "royale", - id: n.data.lobbyId, - maxMembers: t, - totalMembers: - n.data.lobby.members.length, - }, - } - : { - type: s, - lobby: { - type: "party", - id: n.data.lobbyId, - maxMembers: t, - members: n.data.lobby.members - .map((e) => { - var t; - const a = - e.extra && "type" in e.extra - ? "joinedPlayer" === - e.extra.type - ? e.extra - : e.extra.skins[e.profileId] - : null; - return { - profileId: e.profileId, - playerName: e.name, - cxId: e.cxId, - rank: - null !== - (t = - null == a - ? void 0 - : a.rank) && void 0 !== t - ? t - : 1, - skin: Wt.getSkin( - null == a ? void 0 : a.skin, - ), - }; - }) - .sort((e, t) => { - const a = - e.playerName.toLowerCase(), - i = t.playerName.toLowerCase(); - return a < i ? -1 : a > i ? 1 : 0; - }), - ownerId: n.data.lobby.owner, - }, - }, - ); - break; - case "JOIN_FAIL": - e({ type: "failedJoin" }); - break; - case "DISBANDED": - 80101 === n.data.reason.code && o - ? e({ type: "startGame" }) - : 80100 === n.data.reason.code && - "friendsLobby" === s - ? e({ type: "restartFriendsLobby" }) - : e({ - type: "exit", - reason: n.data.reason.desc, - }); - break; - case "ROOM_ASSIGNED": - case "ROOM_READY": - o && - e({ - type: "server", - server: { - address: n.data.connectData.address, - port: n.data.connectData.ports["9313/tcp"], - passcode: n.data.passcode, - }, - }); - } - })(a), - )); - }), - [{ friends: n, globalProperties: s, friendRequests: o }] = - yield Promise.all([Zh(e), i]); - if (s.downForMaintenance) - throw ( - Fh(e), - Error("We're down for maintenance, we'll be back soon!") - ); - return { friends: n, friendRequests: o }; - }); + disableRTT() { }, + registerRTTLobbyCallback(e) { + Ep.sendLobbyCallback = e; }, - deregisterOnline: Fh, - relogin: lh, - authenticate: sh, - attachIdentity: function (e, t, a) { - const i = - "This login already has an account for this game. Would you still like to sign in to it? WARNING: This will permanently replace ALL data on the current device for this game, including any progress, currency and items collected."; - return new Promise((n, s) => { - switch (t.type) { - case "apple": - e.identity.attachAppleIdentity(t.userId, t.idToken, (o) => { - const r = Zu(o, oh); - if (r instanceof Error) - return ( - s(r), - void console.error(`Login apple error: ${r.message}`) - ); - 202 !== r.status || 40212 !== r.reason_code - ? n({ didCancel: false, newProfile: null }) - : a(i, (a) => { - a - ? e.authenticateApple( - t.userId, - t.idToken, - false, - (e) => { - const t = Zu(e, Qu); - if (t instanceof Error) - return ( - s(t), - void console.error( - `Auth apple error: ${t.message}`, - ) - ); - 200 === t.status - ? n({ - didCancel: false, - newProfile: ch(t.data), - }) - : s(dh(t.reason_code)); - }, - ) - : n({ didCancel: true, newProfile: null }); - }); - }); - break; - case "google": - e.identity.attachGoogleOpenIdIdentity( - t.id, - t.idToken, - (o) => { - const r = Zu(o, oh); - if (r instanceof Error) - return ( - s(r), - void console.error( - `Login google error: ${r.message}`, - ) - ); - 202 !== r.status || 40212 !== r.reason_code - ? n({ didCancel: false, newProfile: null }) - : a(i, (a) => { - a - ? e.authenticateGoogleOpenId( - t.id, - t.idToken, - false, - (e) => { - const t = Zu(e, Qu); - if (t instanceof Error) - return ( - s(t), - void console.error( - `Auth google error: ${t.message}`, - ) - ); - 200 === t.status - ? n({ - didCancel: false, - newProfile: ch(t.data), - }) - : s(dh(t.reason_code)); - }, - ) - : n({ didCancel: true, newProfile: null }); - }); - }, - ); - } + deregisterRTTLobbyCallback() { }, + registerRTTEventCallback(e) { + Ep.sendEventCallback = e; + }, + deregisterRTTEventCallback() { }, + }, + event: { + sendEvent(e, t, a, i) { + const n = { status: 200 }; + mp(() => { + i(n); }); }, - detachIdentity: function (e, t) { - return new Promise((a, i) => { - switch (t.type) { - case "apple": - e.identity.detachAppleIdentity(t.userId, true, (e) => { - const t = Zu(e, rh); - if (t instanceof Error) - return ( - i(t), - void console.error(`Detach apple error: ${t.message}`) - ); - a(); - }); - break; - case "google": - e.identity.detachGoogleOpenIdIdentity(t.id, true, (e) => { - const t = Zu(e, rh); - if (t instanceof Error) - return ( - i(t), - void console.error( - `Detach google error: ${t.message}`, - ) - ); - a(); - }); - } + getEvents(e) { + mp(() => { + e({}); }); }, - resetUser: uh, - logout: function (e) { - return new Promise((t, a) => { - e.playerState.logout(() => { - (uh(e), sh(e).then(t).catch(a)); - }); + }, + lobby: { + createLobby(e, t, a, i, n, s, o, r) { + const l = { status: 200 }; + mp(() => { + r(l); }); }, - deleteAccount: function e(t) { - return new Promise((a, i) => { - t.playerState.deleteUser((n) => { - const s = Zu(n, hh); - if (s instanceof Error) i(s); - else { - if (200 !== s.status) - return eh(s) - ? lh(t) - .then(() => e(t)) - .then(a) - .catch(i) - : (i(Error(String(s.reason_code))), - void console.error("Failed to delete user", s)); - (uh(t), sh(t).then(a).catch(i)); - } - }); + joinLobby(e, t, a, i, n, s) { + const o = { status: 200 }; + mp(() => { + s(o); }); }, - updatePlayerName: function e(t, a) { - return new Promise((i, n) => { - t.playerState.updateUserName(a, (s) => { - const o = Zu(s, ph); - if (!(o instanceof Error)) - return 200 !== o.status - ? eh(o) - ? lh(t) - .then(() => e(t, a)) - .then(i) - .catch(n) - : void n(Error(String(o.reason_code))) - : void i(); - n(o); - }); + findOrCreateLobby(e, t, a, i, n, s, o, r, l, c, d) { + const u = { status: 200 }; + mp(() => { + d(u); }); }, - syncProfile: function e(t) { - const a = [fh, yh]; - return new Promise((i, n) => { - t.script.runScript( - "client/SyncProfile", - { entities: a.join(",") }, - (a) => { - const s = Zu(a, bh); - if (s instanceof Error) return void n(s); - if (200 !== s.status) - return eh(s) - ? lh(t) - .then(() => e(t)) - .then(i) - .catch(n) - : void n(Error(String(s.reason_code))); - if ("string" == typeof s.data.response) - return void n(Error(s.data.response)); - const o = s.data.response.entities.account, - r = s.data.response.entities.levels; - let l, c; - if (o) { - if ( - ((l = Iu.jsonToData(o.data.data)), l instanceof Error) - ) - return ( - n(l), - void console.error( - "Online account storage decode error", - s, - ) - ); - } else l = { data: Iu.getDefaultData(), dateUpdated: 0 }; - if (r) { - if ( - ((c = Yd.jsonToData(r.data.data)), c instanceof Error) - ) - return ( - n(c), - void console.error( - "Online levels storage decode error", - s, - ) - ); - } else c = { data: Yd.getDefaultData(), dateUpdated: 0 }; - var d; - i({ - account: l, - levels: c, - ownedItems: s.data.response.allUserItems - .map((e) => { - var t; - return wh( - e.itemId, - e.version, - e.defId, - e.quantity, - null !== (t = e.usesLeft) && void 0 !== t - ? t - : void 0, - ); - }) - .filter(nt), - attributes: - ((d = s.data.response.attributes), - { - notifySuperLevelPack: - "true" === d.notifySuperLevelPack, - }), - }); - }, - ); + leaveLobby(e, t) { + const a = { status: 200 }; + mp(() => { + t(a); }); }, - updateAttributes: function e(t, a) { - return new Promise((i, n) => { - t.playerState.updateAttributes( - ((e) => { - const t = {}; - return ( - Object.entries(e).forEach(([e, a]) => { - t[e] = String(a); - }), - t + }, + }, + Ep = { sendLobbyCallback: () => null, sendEventCallback: () => null }; + const bp = { + getBackend: function (e) { + { + const t = new Au.RX("loginWrapper"); + (t.initialize( + "13731", + "6e0ce653-68f8-4c53-9449-a5ebf6887772", + ku, + ), + t.brainCloudClient.registerGlobalErrorCallback((t) => { + "string" == typeof t && "" === t && e(); + })); + let a = null; + return ( + (t.reconnectRef = () => ( + null === a && + (a = new Promise((e) => { + t.reconnect(e); + }).then((e) => ((a = null), e))), + a + )), + t + ); + } + }, + setupOnline: function (e, t, a) { + return Wu(this, void 0, void 0, function* () { + const i = new Promise((t, a) => { + e.rttService.enableRTT(t, a); + }).then(() => { + (e.rttService.registerRTTEventCallback( + ((e) => (t) => { + const a = Md(t, Kh); + a instanceof Error || + e( + (function (e) { + const t = e.data.fromPlayerId; + switch (e.data.eventType) { + case "inviteToParty": + return { + type: "invite", + from: { + profileId: t, + playerName: + e.data.eventData.fromPlayerName, + }, + lobbyId: e.data.eventData.lobbyId, + }; + case "sendFriendRequest": + return { + type: "friendRequest", + from: { + profileId: t, + playerName: + e.data.eventData.fromPlayerName, + }, + }; + case "acceptFriendRequest": + return { + type: "friendRequestAccept", + from: { + profileId: t, + playerName: + e.data.eventData.fromPlayerName, + }, + }; + } + })(a), ); + })(t), + ), + e.rttService.registerRTTLobbyCallback( + ((e) => (t) => { + var a, i; + const n = Md(t, gp); + if (n instanceof Error) + return void console.error("Lobby event error", n); + const s = + "lobbyId" in n.data && + n.data.lobbyId.includes("friends") + ? n.data.lobbyId.includes("server") + ? "friendsServer" + : "friendsLobby" + : "royaleLobby", + o = "friendsServer" === s || "royaleLobby" === s; + switch (n.operation) { + case "MEMBER_JOIN": + case "STATUS_UPDATE": + case "MEMBER_LEFT": + case "MEMBER_UPDATE": + const t = + (null === + (i = + null === (a = n.data.lobby.lobbyTypeDef) || + void 0 === a + ? void 0 + : a.teams.all) || void 0 === i + ? void 0 + : i.maxUsers) || 0; + e( + "royaleLobby" === s + ? { + type: s, + lobby: { + type: "royale", + id: n.data.lobbyId, + maxMembers: t, + totalMembers: + n.data.lobby.members.length, + }, + } + : { + type: s, + lobby: { + type: "party", + id: n.data.lobbyId, + maxMembers: t, + members: n.data.lobby.members + .map((e) => { + var t; + const a = + e.extra && "type" in e.extra + ? "joinedPlayer" === + e.extra.type + ? e.extra + : e.extra.skins[e.profileId] + : null; + return { + profileId: e.profileId, + playerName: e.name, + cxId: e.cxId, + rank: + null !== + (t = + null == a + ? void 0 + : a.rank) && void 0 !== t + ? t + : 1, + skin: Wt.getSkin( + null == a ? void 0 : a.skin, + ), + }; + }) + .sort((e, t) => { + const a = + e.playerName.toLowerCase(), + i = t.playerName.toLowerCase(); + return a < i ? -1 : a > i ? 1 : 0; + }), + ownerId: n.data.lobby.owner, + }, + }, + ); + break; + case "JOIN_FAIL": + e({ type: "failedJoin" }); + break; + case "DISBANDED": + 80101 === n.data.reason.code && o + ? e({ type: "startGame" }) + : 80100 === n.data.reason.code && + "friendsLobby" === s + ? e({ type: "restartFriendsLobby" }) + : e({ + type: "exit", + reason: n.data.reason.desc, + }); + break; + case "ROOM_ASSIGNED": + case "ROOM_READY": + o && + e({ + type: "server", + server: { + address: n.data.connectData.address, + port: n.data.connectData.ports["9313/tcp"], + passcode: n.data.passcode, + }, + }); + } })(a), - true, - (s) => { - const o = Zu(s, gh); - if (!(o instanceof Error)) - return 200 !== o.status - ? eh(o) - ? lh(t) - .then(() => e(t, a)) - .then(i) - .catch(n) - : void n(Error(String(o.reason_code))) - : void i(); - n(o); - }, - ); - }); - }, - registerNotifications: function e(t, a, i) { - return new Promise((n, s) => { - t.pushNotification.registerPushNotificationDeviceToken( - a, - i, + )); + }), + [{ friends: n, globalProperties: s, friendRequests: o }] = + yield Promise.all([Zh(e), i]); + if (s.downForMaintenance) + throw ( + Fh(e), + Error("We're down for maintenance, we'll be back soon!") + ); + return { friends: n, friendRequests: o }; + }); + }, + deregisterOnline: Fh, + relogin: lh, + authenticate: sh, + attachIdentity: function (e, t, a) { + const i = + "This login already has an account for this game. Would you still like to sign in to it? WARNING: This will permanently replace ALL data on the current device for this game, including any progress, currency and items collected."; + return new Promise((n, s) => { + switch (t.type) { + case "apple": + e.identity.attachAppleIdentity(t.userId, t.idToken, (o) => { + const r = Zu(o, oh); + if (r instanceof Error) + return ( + s(r), + void console.error(`Login apple error: ${r.message}`) + ); + 202 !== r.status || 40212 !== r.reason_code + ? n({ didCancel: false, newProfile: null }) + : a(i, (a) => { + a + ? e.authenticateApple( + t.userId, + t.idToken, + false, + (e) => { + const t = Zu(e, Qu); + if (t instanceof Error) + return ( + s(t), + void console.error( + `Auth apple error: ${t.message}`, + ) + ); + 200 === t.status + ? n({ + didCancel: false, + newProfile: ch(t.data), + }) + : s(dh(t.reason_code)); + }, + ) + : n({ didCancel: true, newProfile: null }); + }); + }); + break; + case "google": + e.identity.attachGoogleOpenIdIdentity( + t.id, + t.idToken, (o) => { - const r = Zu(o, mh); - if (!(r instanceof Error)) - return 200 !== r.status - ? eh(r) - ? lh(t) - .then(() => e(t, a, i)) - .then(n) - .catch(s) - : void s(Error(String(r.reason_code))) - : void n(); - s(r); + const r = Zu(o, oh); + if (r instanceof Error) + return ( + s(r), + void console.error( + `Login google error: ${r.message}`, + ) + ); + 202 !== r.status || 40212 !== r.reason_code + ? n({ didCancel: false, newProfile: null }) + : a(i, (a) => { + a + ? e.authenticateGoogleOpenId( + t.id, + t.idToken, + false, + (e) => { + const t = Zu(e, Qu); + if (t instanceof Error) + return ( + s(t), + void console.error( + `Auth google error: ${t.message}`, + ) + ); + 200 === t.status + ? n({ + didCancel: false, + newProfile: ch(t.data), + }) + : s(dh(t.reason_code)); + }, + ) + : n({ didCancel: true, newProfile: null }); + }); }, ); - }); - }, - getAccountStorage: function e(t) { - return new Promise((a, i) => { - t.entity.getSingleton(fh, (n) => { - const s = Zu(n, Sh); - if (s instanceof Error) return void i(s); - if (200 !== s.status) - return eh(s) - ? lh(t) - .then(() => e(t)) - .then(a) - .catch(i) - : (i(Error(String(s.reason_code))), - void console.error("Online account storage error", s)); - if (null === s.data) { - const e = Iu.getDefaultData(); - return void a({ data: e, dateUpdated: 0 }); - } - const o = Iu.jsonToData(s.data.data.data); - if (o instanceof Error) + } + }); + }, + detachIdentity: function (e, t) { + return new Promise((a, i) => { + switch (t.type) { + case "apple": + e.identity.detachAppleIdentity(t.userId, true, (e) => { + const t = Zu(e, rh); + if (t instanceof Error) return ( - i(o), - void console.error( - "Online account storage decode error", - s, - ) + i(t), + void console.error(`Detach apple error: ${t.message}`) ); - a(o); + a(); }); - }); - }, - getLevelsStorage: function e(t) { - return new Promise((a, i) => { - t.entity.getSingleton(yh, (n) => { - const s = Zu(n, Sh); - if (s instanceof Error) return void i(s); - if (200 !== s.status) - return eh(s) - ? lh(t) - .then(() => e(t)) - .then(a) - .catch(i) - : (i(Error(String(s.reason_code))), - void console.error("Online account storage error", s)); - if (null === s.data) - return void a({ data: [], dateUpdated: 0 }); - const o = Yd.jsonToData(s.data.data.data); - if (o instanceof Error) + break; + case "google": + e.identity.detachGoogleOpenIdIdentity(t.id, true, (e) => { + const t = Zu(e, rh); + if (t instanceof Error) return ( - i(o), + i(t), void console.error( - "Online levels storage decode error", - s, + `Detach google error: ${t.message}`, ) ); - a(o); - }); - }); - }, - updateAccountStorage: function e(t, a, i) { - return new Promise((n, s) => { - const o = Iu.dataToJson(Iu.removeCheckpointData(a), i); - t.entity.updateSingleton(fh, { data: o }, null, -1, (o) => { - const r = Zu(o, Ih); - if (r instanceof Error) s(r); - else if (200 !== r.status) { - if (eh(r)) - return lh(t) - .then(() => e(t, a, i)) - .then(n) - .catch(s); - s(Error("")); - } else n(); - }); - }); - }, - updateLevelsStorage: function e(t, a, i) { - return new Promise((n, s) => { - const o = Yd.dataToJson(a, i); - t.entity.updateSingleton(yh, { data: o }, null, -1, (o) => { - const r = Zu(o, Ih); - if (r instanceof Error) s(r); - else if (200 !== r.status) { - if (eh(r)) - return lh(t) - .then(() => e(t, a, i)) - .then(n) - .catch(s); - s(Error("")); - } else n(); + a(); }); - }); - }, - awardAchievementsFail: function (e) { - return Wu(this, void 0, void 0, function* () { - e.gamification.awardAchievements( - [], - (e) => { - console.log(e); - }, - false, - ); - }); - }, - getPurchases: function e(t, a) { - return Wu(this, void 0, void 0, function* () { - return new Promise((i, n) => { - t.appStore.getSalesInventory(a, qu, (s) => { - const o = Zu(s, _h); - if (o instanceof Error) n(o); - else if (200 !== o.status) { - if (eh(o)) - return lh(t) - .then(() => e(t, a)) - .then(i) - .catch(n); - n(Error("")); - } else - i( - o.data.productInventory - .map((e) => { - switch (a) { - case "itunes": - if (!("ids" in e.priceData)) return null; - const t = e.priceData.ids.find( - (e) => "appId" in e && "iphone" === e.appId, - ); - return t && "itunesId" in t - ? { - type: "ios", - title: e.title, - productId: t.itunesId, - price: "", - } - : null; - case "googlePlay": - return "id" in e.priceData - ? { - type: "android", - title: e.title, - productId: e.priceData.id, - price: "", - } - : null; - default: - return null; - } - }) - .filter(nt), - ); - }); - }); - }); - }, - verifyPurchase: function e(t, a, i) { - return Wu(this, void 0, void 0, function* () { - return new Promise((n, s) => { - t.appStore.verifyPurchase(i, a, (o) => { - var r, l, c, d; - const u = Zu(o, vh); - if (u instanceof Error) return void s(u); - if (200 !== u.status) - return eh(u) - ? lh(t) - .then(() => e(t, a, i)) - .then(n) - .catch(s) - : void s(Error(String(u.reason_code))); - if (0 !== u.data.resultCode) - return 100 === u.data.resultCode - ? void s(Error("Already processed")) - : void s( - Error( - `Failed to purchase. Code: ${u.data.resultCode}`, - ), - ); - const h = - null === - (l = - null === (r = u.data.currency) || void 0 === r - ? void 0 - : r.blocks) || void 0 === l - ? void 0 - : l.balance; - if (h) return void n(h); - const p = - null === - (d = - null === (c = u.data.transactionSummary) || - void 0 === c - ? void 0 - : c.transactionDetails.find((e) => - Boolean(e.errorMessage), - )) || void 0 === d - ? void 0 - : d.errorMessage; - s(p ? Error(p) : Error("Couldn't read balance")); - }); - }); - }); - }, - getAchievements: function e(t) { - return Wu(this, void 0, void 0, function* () { - return new Promise((a, i) => { - t.script.runScript("client/ReadAchievements", {}, (n) => { - const s = Zu(n, Mh); - if (s instanceof Error) return void i(s); - if (200 !== s.status) - return eh(s) - ? void lh(t) - .then(() => e(t)) - .then(a) - .catch(i) - : void i(Error(String(s.reason_code))); - if ("string" == typeof s.data.response) - return void i(Error(s.data.response)); - const o = s.data.response.filter(xh), - r = s.data.response - .filter((e) => !xh(e)) - .map((e) => Ph(e, o)); - a(r); - }); - }); - }); - }, - getUserItems: function e(t, a) { - return Wu(this, void 0, void 0, function* () { - return new Promise((i, n) => { - t.userItems.getUserItemsPage( - { - pagination: { rowsPerPage: 500, pageNumber: 1 }, - searchCriteria: - "booster" === a - ? { - defId: { - $regex: "^(autopilot|missiles|slowmo)\\d+$", - }, - } - : "pass" === a - ? { defId: { $regex: "^.+_pass$" } } - : "editor" === a - ? { defId: { $regex: "^(editor|theme)_.+$" } } - : "skin" === a - ? { defId: { $regex: "^skin_.+$" } } - : "bonusLevel" === a - ? { defId: { $regex: "^bonus_level_.+$" } } - : {}, - sortCriteria: {}, - }, - false, - (s) => { - const o = Zu(s, Ah); - if (o instanceof Error) return void n(o); - if (200 !== o.status) - return eh(o) - ? lh(t) - .then(() => e(t, a)) - .then(i) - .catch(n) - : void n(Error(String(o.reason_code))); - const { items: r } = o.data.results; - i( - r - .map((e) => { - var t; - return wh( - e.itemId, - e.version, - e.defId, - e.quantity, - null !== (t = e.usesLeft) && void 0 !== t - ? t - : void 0, - ); - }) - .filter(nt), + } + }); + }, + resetUser: uh, + logout: function (e) { + return new Promise((t, a) => { + e.playerState.logout(() => { + (uh(e), sh(e).then(t).catch(a)); + }); + }); + }, + deleteAccount: function e(t) { + return new Promise((a, i) => { + t.playerState.deleteUser((n) => { + const s = Zu(n, hh); + if (s instanceof Error) i(s); + else { + if (200 !== s.status) + return eh(s) + ? lh(t) + .then(() => e(t)) + .then(a) + .catch(i) + : (i(Error(String(s.reason_code))), + void console.error("Failed to delete user", s)); + (uh(t), sh(t).then(a).catch(i)); + } + }); + }); + }, + updatePlayerName: function e(t, a) { + return new Promise((i, n) => { + t.playerState.updateUserName(a, (s) => { + const o = Zu(s, ph); + if (!(o instanceof Error)) + return 200 !== o.status + ? eh(o) + ? lh(t) + .then(() => e(t, a)) + .then(i) + .catch(n) + : void n(Error(String(o.reason_code))) + : void i(); + n(o); + }); + }); + }, + syncProfile: function e(t) { + const a = [fh, yh]; + return new Promise((i, n) => { + t.script.runScript( + "client/SyncProfile", + { entities: a.join(",") }, + (a) => { + const s = Zu(a, bh); + if (s instanceof Error) return void n(s); + if (200 !== s.status) + return eh(s) + ? lh(t) + .then(() => e(t)) + .then(i) + .catch(n) + : void n(Error(String(s.reason_code))); + if ("string" == typeof s.data.response) + return void n(Error(s.data.response)); + const o = s.data.response.entities.account, + r = s.data.response.entities.levels; + let l, c; + if (o) { + if ( + ((l = Iu.jsonToData(o.data.data)), l instanceof Error) + ) + return ( + n(l), + void console.error( + "Online account storage decode error", + s, + ) + ); + } else l = { data: Iu.getDefaultData(), dateUpdated: 0 }; + if (r) { + if ( + ((c = Yd.jsonToData(r.data.data)), c instanceof Error) + ) + return ( + n(c), + void console.error( + "Online levels storage decode error", + s, + ) + ); + } else c = { data: Yd.getDefaultData(), dateUpdated: 0 }; + var d; + i({ + account: l, + levels: c, + ownedItems: s.data.response.allUserItems + .map((e) => { + var t; + return wh( + e.itemId, + e.version, + e.defId, + e.quantity, + null !== (t = e.usesLeft) && void 0 !== t + ? t + : void 0, ); - }, - ); - }); - }); - }, - getBuyableItems: function e(t, a) { - return Wu(this, void 0, void 0, function* () { - return new Promise((i, n) => { - t.itemCatalog.getCatalogItemsPage( + }) + .filter(nt), + attributes: + ((d = s.data.response.attributes), { - pagination: { rowsPerPage: 500, pageNumber: 1 }, - searchCriteria: a - ? { defId: { $regex: `^${a}\\d+$` } } - : {}, - sortCriteria: {}, - }, - (s) => { - const o = Zu(s, Rh); - if (!(o instanceof Error)) - return 200 !== o.status - ? eh(o) - ? lh(t) - .then(() => e(t, a)) - .then(i) - .catch(n) - : void n(Error(String(o.reason_code))) - : void i( - o.data.results.items - .map((e) => { - const t = e.buyPrice.blocks; - return void 0 === t - ? null - : { - name: e.name || e.defId, - blocksPrice: t, - defId: e.defId, - }; - }) - .filter(nt) - .sort((e, t) => e.blocksPrice - t.blocksPrice), - ); - n(o); - }, - ); - }); - }); - }, - getItemFromResponse: wh, - //bp.getItemFromResponse - buyItem: function e(t, a) { - return Wu(this, void 0, void 0, function* () { - return new Promise((i, n) => { - t.userItems.purchaseUserItem(a.defId, 1, null, false, (s) => { - var o, r; - const l = Zu(s, Oh); - if (l instanceof Error) return void n(l); - if (403 === l.status) - return eh(l) - ? lh(t) - .then(() => e(t, a)) - .then(i) - .catch(n) - : void n(Error(String(l.reason_code))); - if (200 !== l.status) - return 40385 === l.reason_code - ? void n(Error("Insufficient balance")) - : (console.error(l), - void n(Error("Server error, please try again"))); - const c = Object.values(l.data.items)[0], - d = wh( - c.itemId, - c.version, - c.defId, - c.quantity, - null !== (o = c.usesLeft) && void 0 !== o ? o : void 0, - ); - d - ? i({ - balance: - (null === - (r = - l.data.currencyBalances.currencyMap.blocks) || - void 0 === r - ? void 0 - : r.balance) || 0, - item: d, - }) - : n(Error("Unknown item")); - }); - }); - }); - }, - useItem: function e(t, a) { - return Wu(this, void 0, void 0, function* () { - return new Promise((i, n) => { - t.userItems.useUserItem( - a.itemId, - a.itemVersion, - null, - false, - (s) => { - var o; - const r = Zu(s, Ch); - if (r instanceof Error) return void n(r); - if (200 !== r.status) - return eh(r) - ? lh(t) - .then(() => e(t, a)) - .then(i) - .catch(n) - : void n(Error(String(r.reason_code))); - const l = r.data.item; - i( - "itemId" in l - ? wh( - l.itemId, - l.version, - l.defId, - l.quantity, - null !== (o = l.usesLeft) && void 0 !== o - ? o - : void 0, - ) - : null, - ); - }, - ); - }); - }); - }, - equipSkin: function e(t, a, i) { - return Wu(this, void 0, void 0, function* () { - return new Promise((n, s) => { - t.script.runScript( - "client/EquipSkin", - { skinName: a.fileName, profileId: i }, - (o) => { - const r = Zu(o, kh); - if (!(r instanceof Error)) - return 200 !== r.status - ? eh(r) - ? lh(t) - .then(() => e(t, a, i)) - .then(n) - .catch(s) - : void s(Error(String(r.reason_code))) - : void ("string" != typeof r.data.response || - "" === r.data.response - ? n() - : s(Error(r.data.response))); - s(r); - }, - ); + notifySuperLevelPack: + "true" === d.notifySuperLevelPack, + }), }); - }); - }, - completedLevel: function (e, t, a, i, n) { - return Wu(this, void 0, void 0, function* () { - const s = yield Dh( - e, - t + "_" + (a ? "" : "no") + "checkpoints", + }, + ); + }); + }, + updateAttributes: function e(t, a) { + return new Promise((i, n) => { + t.playerState.updateAttributes( + ((e) => { + const t = {}; + return ( + Object.entries(e).forEach(([e, a]) => { + t[e] = String(a); + }), + t ); - if ("accelerated" === t) - if (0 === i) { - const t = yield Dh(e, "accelerated_avoid_collectibles"); - s.achievements.push(...t.achievements); - } else if (75 === i) { - const t = yield Dh(e, "accelerated_collectibles"); - s.achievements.push(...t.achievements); - } - if ("cloud_9" === t) { - if (n >= 2e5) { - const t = yield Dh(e, "cloud_9_high_score"); - s.achievements.push(...t.achievements); - } - if (n >= 1e6) { - const t = yield Dh(e, "cloud_9_very_high_score"); - s.achievements.push(...t.achievements); - } - } - if ("nacreous_snowmelt" === t && n >= 6e5) { - const t = yield Dh(e, "nacreous_snowmelt_high_score"); - s.achievements.push(...t.achievements); - } - return s; - }); - }, - reachedRank: function (e, t) { - return Wu(this, void 0, void 0, function* () { - return Dh(e, "xp_rank" + t); - }); - }, - collectAchievementRewards: function e(t, a) { - return Wu(this, void 0, void 0, function* () { - return new Promise((i, n) => { - t.script.runScript( - "client/CollectRewards", - { achievementId: a.id, lego: !zu.hasIAP() }, - (s) => { - const o = Zu(s, Bh); - if (!(o instanceof Error)) - return 200 !== o.status - ? eh(o) - ? lh(t) - .then(() => e(t, a)) - .then(i) - .catch(n) - : void n(Error(String(o.reason_code))) - : void ("string" != typeof o.data.response - ? i({ - items: o.data.response.allUserItems - .map((e) => { - var t; - return wh( - e.itemId, - e.version, - e.defId, - e.quantity, - null !== (t = e.usesLeft) && - void 0 !== t - ? t - : void 0, - ); - }) - .filter(nt), - balance: o.data.response.balance, - }) - : n(Error(o.data.response))); - n(o); - }, + })(a), + true, + (s) => { + const o = Zu(s, gh); + if (!(o instanceof Error)) + return 200 !== o.status + ? eh(o) + ? lh(t) + .then(() => e(t, a)) + .then(i) + .catch(n) + : void n(Error(String(o.reason_code))) + : void i(); + n(o); + }, + ); + }); + }, + registerNotifications: function e(t, a, i) { + return new Promise((n, s) => { + t.pushNotification.registerPushNotificationDeviceToken( + a, + i, + (o) => { + const r = Zu(o, mh); + if (!(r instanceof Error)) + return 200 !== r.status + ? eh(r) + ? lh(t) + .then(() => e(t, a, i)) + .then(n) + .catch(s) + : void s(Error(String(r.reason_code))) + : void n(); + s(r); + }, + ); + }); + }, + getAccountStorage: function e(t) { + return new Promise((a, i) => { + t.entity.getSingleton(fh, (n) => { + const s = Zu(n, Sh); + if (s instanceof Error) return void i(s); + if (200 !== s.status) + return eh(s) + ? lh(t) + .then(() => e(t)) + .then(a) + .catch(i) + : (i(Error(String(s.reason_code))), + void console.error("Online account storage error", s)); + if (null === s.data) { + const e = Iu.getDefaultData(); + return void a({ data: e, dateUpdated: 0 }); + } + const o = Iu.jsonToData(s.data.data.data); + if (o instanceof Error) + return ( + i(o), + void console.error( + "Online account storage decode error", + s, + ) + ); + a(o); + }); + }); + }, + getLevelsStorage: function e(t) { + return new Promise((a, i) => { + t.entity.getSingleton(yh, (n) => { + const s = Zu(n, Sh); + if (s instanceof Error) return void i(s); + if (200 !== s.status) + return eh(s) + ? lh(t) + .then(() => e(t)) + .then(a) + .catch(i) + : (i(Error(String(s.reason_code))), + void console.error("Online account storage error", s)); + if (null === s.data) + return void a({ data: [], dateUpdated: 0 }); + const o = Yd.jsonToData(s.data.data.data); + if (o instanceof Error) + return ( + i(o), + void console.error( + "Online levels storage decode error", + s, + ) + ); + a(o); + }); + }); + }, + updateAccountStorage: function e(t, a, i) { + return new Promise((n, s) => { + const o = Iu.dataToJson(Iu.removeCheckpointData(a), i); + t.entity.updateSingleton(fh, { data: o }, null, -1, (o) => { + const r = Zu(o, Ih); + if (r instanceof Error) s(r); + else if (200 !== r.status) { + if (eh(r)) + return lh(t) + .then(() => e(t, a, i)) + .then(n) + .catch(s); + s(Error("")); + } else n(); + }); + }); + }, + updateLevelsStorage: function e(t, a, i) { + return new Promise((n, s) => { + const o = Yd.dataToJson(a, i); + t.entity.updateSingleton(yh, { data: o }, null, -1, (o) => { + const r = Zu(o, Ih); + if (r instanceof Error) s(r); + else if (200 !== r.status) { + if (eh(r)) + return lh(t) + .then(() => e(t, a, i)) + .then(n) + .catch(s); + s(Error("")); + } else n(); + }); + }); + }, + awardAchievementsFail: function (e) { + return Wu(this, void 0, void 0, function* () { + e.gamification.awardAchievements( + [], + (e) => { + console.log(e); + }, + false, + ); + }); + }, + getPurchases: function e(t, a) { + return Wu(this, void 0, void 0, function* () { + return new Promise((i, n) => { + t.appStore.getSalesInventory(a, qu, (s) => { + const o = Zu(s, _h); + if (o instanceof Error) n(o); + else if (200 !== o.status) { + if (eh(o)) + return lh(t) + .then(() => e(t, a)) + .then(i) + .catch(n); + n(Error("")); + } else + i( + o.data.productInventory + .map((e) => { + switch (a) { + case "itunes": + if (!("ids" in e.priceData)) return null; + const t = e.priceData.ids.find( + (e) => "appId" in e && "iphone" === e.appId, + ); + return t && "itunesId" in t + ? { + type: "ios", + title: e.title, + productId: t.itunesId, + price: "", + } + : null; + case "googlePlay": + return "id" in e.priceData + ? { + type: "android", + title: e.title, + productId: e.priceData.id, + price: "", + } + : null; + default: + return null; + } + }) + .filter(nt), ); - }); }); - }, - findLobby: function e(t, a) { - return new Promise((i, n) => { - const s = 0 === a.length ? null : a.map((e) => e.cxId); - t.lobby.findOrCreateLobby( - "matchmaking", - 0, - 2, - ap, - ip, - s, - ep, - true, - tp, - "", - (s) => { - const o = Zu(s, lp); - if (!(o instanceof Error)) - return 200 !== o.status - ? eh(o) - ? lh(t) - .then(() => e(t, a)) - .then(i) - .catch(n) - : void n(Error(String(o.reason_code))) - : void i(o); - n(o); - }, - ); + }); + }); + }, + verifyPurchase: function e(t, a, i) { + return Wu(this, void 0, void 0, function* () { + return new Promise((n, s) => { + t.appStore.verifyPurchase(i, a, (o) => { + var r, l, c, d; + const u = Zu(o, vh); + if (u instanceof Error) return void s(u); + if (200 !== u.status) + return eh(u) + ? lh(t) + .then(() => e(t, a, i)) + .then(n) + .catch(s) + : void s(Error(String(u.reason_code))); + if (0 !== u.data.resultCode) + return 100 === u.data.resultCode + ? void s(Error("Already processed")) + : void s( + Error( + `Failed to purchase. Code: ${u.data.resultCode}`, + ), + ); + const h = + null === + (l = + null === (r = u.data.currency) || void 0 === r + ? void 0 + : r.blocks) || void 0 === l + ? void 0 + : l.balance; + if (h) return void n(h); + const p = + null === + (d = + null === (c = u.data.transactionSummary) || + void 0 === c + ? void 0 + : c.transactionDetails.find((e) => + Boolean(e.errorMessage), + )) || void 0 === d + ? void 0 + : d.errorMessage; + s(p ? Error(p) : Error("Couldn't read balance")); }); - }, - joinFriendsLobby: function e(t, a, i, n) { - return new Promise((s, o) => { - t.lobby.joinLobby(a, false, np(i, n), "", null, (r) => { - const l = Zu(r, rp); - if (!(l instanceof Error)) - return 200 !== l.status - ? eh(l) - ? lh(t) - .then(() => e(t, a, i, n)) - .then(s) - .catch(o) - : void o(Error(String(l.reason_code))) - : void s(); - o(l); - }); + }); + }); + }, + getAchievements: function e(t) { + return Wu(this, void 0, void 0, function* () { + return new Promise((a, i) => { + t.script.runScript("client/ReadAchievements", {}, (n) => { + const s = Zu(n, Mh); + if (s instanceof Error) return void i(s); + if (200 !== s.status) + return eh(s) + ? void lh(t) + .then(() => e(t)) + .then(a) + .catch(i) + : void i(Error(String(s.reason_code))); + if ("string" == typeof s.data.response) + return void i(Error(s.data.response)); + const o = s.data.response.filter(xh), + r = s.data.response + .filter((e) => !xh(e)) + .map((e) => Ph(e, o)); + a(r); }); - }, - createFriendsLobby: function e(t, a, i, n) { - return new Promise((s, o) => { - const r = 0 === a.length ? null : a.map((e) => e.cxId), - l = xu(i.xpPoints).rank; - t.lobby.createLobby( - "friends", - 0, - r, - false, - null === r - ? np(n, l) - : ((e, t, a, i) => { - const n = { [e]: { skin: t.fileName, rank: a } }; - return ( - i.forEach((e) => { - n[e.profileId] = { - skin: e.skin.fileName, - rank: e.rank, - }; - }), - { type: "allMembers", skins: n } + }); + }); + }, + getUserItems: function e(t, a) { + return Wu(this, void 0, void 0, function* () { + return new Promise((i, n) => { + t.userItems.getUserItemsPage( + { + pagination: { rowsPerPage: 500, pageNumber: 1 }, + searchCriteria: + "booster" === a + ? { + defId: { + $regex: "^(autopilot|missiles|slowmo)\\d+$", + }, + } + : "pass" === a + ? { defId: { $regex: "^.+_pass$" } } + : "editor" === a + ? { defId: { $regex: "^(editor|theme)_.+$" } } + : "skin" === a + ? { defId: { $regex: "^skin_.+$" } } + : "bonusLevel" === a + ? { defId: { $regex: "^bonus_level_.+$" } } + : {}, + sortCriteria: {}, + }, + false, + (s) => { + const o = Zu(s, Ah); + if (o instanceof Error) return void n(o); + if (200 !== o.status) + return eh(o) + ? lh(t) + .then(() => e(t, a)) + .then(i) + .catch(n) + : void n(Error(String(o.reason_code))); + const { items: r } = o.data.results; + i( + r + .map((e) => { + var t; + return wh( + e.itemId, + e.version, + e.defId, + e.quantity, + null !== (t = e.usesLeft) && void 0 !== t + ? t + : void 0, ); - })(i.profileId, n, l, a), - "", - ep, - (r) => { - const l = Zu(r, sp); - if (!(l instanceof Error)) - return 200 !== l.status - ? eh(l) - ? lh(t) - .then(() => e(t, a, i, n)) - .then(s) - .catch(o) - : void o(Error(String(l.reason_code))) - : void s(); - o(l); - }, - ); - }); - }, - startFriendsServerLobby: function e(t, a, i) { - return new Promise((n, s) => { - const o = a.map((e) => e.cxId); - (t.lobby.createLobby( - "friends_server", - 0, - o, - true, - tp, - "", - i, - (o) => { - const r = Zu(o, op); - if (r instanceof Error) s(r); - else if (200 !== r.status) { - if (eh(r)) - return lh(t) - .then(() => e(t, a, i)) - .then(n) - .catch(s); - throw r; - } - }, - ), - n()); - }); - }, - leaveLobby: function e(t, a) { - return new Promise((i, n) => { - t.lobby.leaveLobby(a, (s) => { - const o = Zu(s, cp); + }) + .filter(nt), + ); + }, + ); + }); + }); + }, + getBuyableItems: function e(t, a) { + return Wu(this, void 0, void 0, function* () { + return new Promise((i, n) => { + t.itemCatalog.getCatalogItemsPage( + { + pagination: { rowsPerPage: 500, pageNumber: 1 }, + searchCriteria: a + ? { defId: { $regex: `^${a}\\d+$` } } + : {}, + sortCriteria: {}, + }, + (s) => { + const o = Zu(s, Rh); if (!(o instanceof Error)) return 200 !== o.status ? eh(o) ? lh(t) - .then(() => e(t, a)) - .then(i) - .catch(n) + .then(() => e(t, a)) + .then(i) + .catch(n) : void n(Error(String(o.reason_code))) - : void i(); + : void i( + o.data.results.items + .map((e) => { + const t = e.buyPrice.blocks; + return void 0 === t + ? null + : { + name: e.name || e.defId, + blocksPrice: t, + defId: e.defId, + }; + }) + .filter(nt) + .sort((e, t) => e.blocksPrice - t.blocksPrice), + ); n(o); - }); - }); - }, - findUserById: function e(t, a) { - return Wu(this, void 0, void 0, function* () { - return new Promise((i, n) => { - 36 === a.length - ? t.friend.getSummaryDataForProfileId(a, (s) => { - const o = Zu(s, Yh); - if (o instanceof Error) n(o); - else if (200 !== o.status) { - if (eh(o)) - return lh(t) - .then(() => e(t, a)) - .then(i) - .catch(n); - n(Error(String(o.reason_code))); - } else - i({ - profileId: o.data.profileId, - playerName: o.data.profileName, - }); - }) - : n(Error("Invalid ID")); - }); - }); - }, - findUsersByName: function e(t, a) { - return Wu(this, void 0, void 0, function* () { - return new Promise((i, n) => { - t.friend.findUsersByExactName(a, 50, (s) => { - const o = Zu(s, Uh); - if (o instanceof Error) n(o); - else if (200 !== o.status) { - if (eh(o)) - return lh(t) - .then(() => e(t, a)) - .then(i) - .catch(n); - n(Error(String(o.reason_code))); - } else - i( - o.data.matches.map((e) => ({ - profileId: e.profileId, - playerName: e.profileName, - })), - ); - }); - }); - }); - }, - addFriend: function e(t, a) { - return Wu(this, void 0, void 0, function* () { - return new Promise((i, n) => { - t.friend.addFriends([a], (s) => { - const o = Zu(s, jh); - if (o instanceof Error) n(o); - else if (200 !== o.status) { - if (eh(o)) - return lh(t) - .then(() => e(t, a)) - .then(i) - .catch(n); - n(Error("")); - } else i(); - }); - }); - }); - }, - removeFriend: function e(t, a) { - return Wu(this, void 0, void 0, function* () { - return new Promise((i, n) => { - t.friend.removeFriends([a], (s) => { - const o = Zu(s, Gh); - if (o instanceof Error) n(o); - else if (200 !== o.status) { - if (eh(o)) - return lh(t) - .then(() => e(t, a)) - .then(i) - .catch(n); - n(Error("")); - } else i(); - }); - }); - }); - }, - inviteToParty: function e(t, a, i, n) { - return Wu(this, void 0, void 0, function* () { - const s = { fromPlayerName: a.playerName, lobbyId: n.id }; - return new Promise((o, r) => { - t.event.sendEvent(i.profileId, Hh, s, (s) => { - const l = Zu(s, Vh); - if (l instanceof Error) r(l); - else if (200 !== l.status) { - if (eh(l)) - return lh(t) - .then(() => e(t, a, i, n)) - .then(o) - .catch(r); - r(Error("")); - } else o(); - }); - }); - }); - }, - sendFriendRequest: function e(t, a, i) { - return Wu(this, void 0, void 0, function* () { - const n = { fromPlayerName: a.playerName }; - return new Promise((s, o) => { - t.event.sendEvent(i, zh, n, (n) => { - const r = Zu(n, Vh); - if (r instanceof Error) o(r); - else if (200 !== r.status) { - if (eh(r)) - return lh(t) - .then(() => e(t, a, i)) - .then(s) - .catch(o); - o(Error("")); - } else s(); - }); - }); - }); - }, - acceptFriendRequest: function e(t, a, i) { - return Wu(this, void 0, void 0, function* () { - const n = { fromPlayerName: a.playerName }; - return new Promise((s, o) => { - t.event.sendEvent(i, qh, n, (n) => { - const r = Zu(n, Vh); - if (r instanceof Error) o(r); - else if (200 !== r.status) { - if (eh(r)) - return lh(t) - .then(() => e(t, a, i)) - .then(s) - .catch(o); - o(Error("")); - } else s(); - }); - }); + }, + ); + }); + }); + }, + getItemFromResponse: wh, + //bp.getItemFromResponse + buyItem: function e(t, a) { + return Wu(this, void 0, void 0, function* () { + return new Promise((i, n) => { + t.userItems.purchaseUserItem(a.defId, 1, null, false, (s) => { + var o, r; + const l = Zu(s, Oh); + if (l instanceof Error) return void n(l); + if (403 === l.status) + return eh(l) + ? lh(t) + .then(() => e(t, a)) + .then(i) + .catch(n) + : void n(Error(String(l.reason_code))); + if (200 !== l.status) + return 40385 === l.reason_code + ? void n(Error("Insufficient balance")) + : (console.error(l), + void n(Error("Server error, please try again"))); + const c = Object.values(l.data.items)[0], + d = wh( + c.itemId, + c.version, + c.defId, + c.quantity, + null !== (o = c.usesLeft) && void 0 !== o ? o : void 0, + ); + d + ? i({ + balance: + (null === + (r = + l.data.currencyBalances.currencyMap.blocks) || + void 0 === r + ? void 0 + : r.balance) || 0, + item: d, + }) + : n(Error("Unknown item")); }); - }, - mockBackend: yp, - sendMockLobbyEvent: function (e) { - switch (e.type) { - case "royaleLobby": - Ep.sendLobbyCallback({ - service: "lobby", - operation: "MEMBER_JOIN", - data: { - lobbyId: e.lobby.id, - lobby: { - members: Array.from({ - length: e.lobby.totalMembers, - }).map((e, t) => ({ - profileId: `id-${t}`, - name: `Player${t}`, - cxId: `098213-${t}`, - extra: {}, - })), - owner: "id-0", - lobbyTypeDef: { - teams: { all: { maxUsers: e.lobby.maxMembers } }, - }, - }, - }, - }); - break; - case "friendsLobby": - Ep.sendLobbyCallback({ - service: "lobby", - operation: "MEMBER_JOIN", - data: { - lobbyId: e.lobby.id, - lobby: { - members: e.lobby.members.map((e) => ({ - profileId: e.profileId, - name: e.playerName, - cxId: "098213", - extra: { skin: e.skin.fileName, rank: e.rank }, - })), - owner: e.lobby.ownerId, - lobbyTypeDef: { - teams: { all: { maxUsers: e.lobby.maxMembers } }, - }, - }, - }, - }); - break; - case "server": - Ep.sendLobbyCallback({ - service: "lobby", - operation: "ROOM_ASSIGNED", - data: { - lobbyId: "", - connectData: { - address: e.server.address, - ports: { "9313/tcp": e.server.port }, - }, - passcode: e.server.passcode, - }, - }); - break; - case "startGame": - Ep.sendLobbyCallback({ - service: "lobby", - operation: "DISBANDED", - data: { - lobbyId: "", - reason: { code: 80101, desc: "Start game" }, - }, - }); - } - }, - sendMockGeneralEvent: function (e) { - switch (e.type) { - case "invite": - Ep.sendEventCallback({ - service: "event", - data: { - fromPlayerId: e.from.profileId, - eventType: Hh, - eventData: { - fromPlayerName: e.from.playerName, - lobbyId: e.lobbyId, - }, - }, - }); - break; - case "friendRequest": - Ep.sendEventCallback({ - service: "event", - data: { - fromPlayerId: e.from.profileId, - eventType: zh, - eventData: { fromPlayerName: e.from.playerName }, - }, - }); - break; - case "friendRequestAccept": - Ep.sendEventCallback({ - service: "event", - data: { - fromPlayerId: e.from.profileId, - eventType: qh, - eventData: { fromPlayerName: e.from.playerName }, - }, - }); - } - }, - ACCOUNT_ENTITY: fh, - LEVELS_ENTITY: yh, - UPDATE_LOGIN_ERROR: ah, - EXPIRED_LOGIN_ERROR: ih, - USER_NOT_FOUND: nh, - OFFLINE: th, - }, - Sp = kc({ - itemId: mc, - version: fc, - usesLeft: Bc([hc, fc]), - defId: mc, - }), - Ip = Ld({ - mappers: [ - () => ({ - booster: wu, - pass: [], - editor: [], - skin: [], - bonusLevel: [], - all: [], - spentItemDefIds: [], - }), - (e) => ({ - ownedItems: - 0 === e.all.length - ? [ - ...e.booster, - ...e.pass, - ...e.editor, - ...e.skin, - ...e.bonusLevel, - ] - : e.all, - spentItemDefIds: e.spentItemDefIds, - }), - (e) => - Object.assign(Object.assign({}, e), { playerSkin: "default" }), - ], - finalSchema: kc({ - ownedItems: Oc(Sp), - spentItemDefIds: Oc(mc), - playerSkin: mc, - }), - uncompress: (e) => ({ - ownedItems: e.ownedItems - .map((e) => { - var t; - return bp.getItemFromResponse( - e.itemId, - e.version, - e.defId, - 1, - null !== (t = e.usesLeft) && void 0 !== t ? t : void 0, + }); + }); + }, + useItem: function e(t, a) { + return Wu(this, void 0, void 0, function* () { + return new Promise((i, n) => { + t.userItems.useUserItem( + a.itemId, + a.itemVersion, + null, + false, + (s) => { + var o; + const r = Zu(s, Ch); + if (r instanceof Error) return void n(r); + if (200 !== r.status) + return eh(r) + ? lh(t) + .then(() => e(t, a)) + .then(i) + .catch(n) + : void n(Error(String(r.reason_code))); + const l = r.data.item; + i( + "itemId" in l + ? wh( + l.itemId, + l.version, + l.defId, + l.quantity, + null !== (o = l.usesLeft) && void 0 !== o + ? o + : void 0, + ) + : null, ); - }) - .filter(nt), - spentItemDefIds: e.spentItemDefIds, - playerSkin: Wt.getSkin(e.playerSkin), - }), - compress: (e) => ({ - ownedItems: e.ownedItems.map((e) => ({ - itemId: e.itemId, - version: e.itemVersion, - usesLeft: "boosterItem" === e.type ? e.usesLeft : null, - defId: e.defId, - })), - spentItemDefIds: e.spentItemDefIds, - playerSkin: e.playerSkin.fileName, - }), - }), - _p = { - getItem: (e) => ju.secureStorage.getItem(e), - setItem: (e, t) => ju.secureStorage.setItem(e, t), - clear: () => ju.clearSecureStorage(), - }; - function vp(e) { - return "editorItem" === e.type; - } - function Tp(e) { - return "themeItem" === e.type; - } - function Rp(e) { - return "boosterItem" === e.type; - } - function Op(e) { - if (!e) return []; - switch (e.name) { - case "cloud9": - return [hl.songs.cloud9]; - case "superLevelPack": - return [ - hl.songs.aura, - hl.songs.coolFriends, - hl.songs.forYou, - hl.songs.nacreousSnowmelt, - ]; - } - } - function Cp(e) { - if (!e) return []; - switch (e.name) { - case "cloud9": - return [ca.skater]; - case "superLevelPack": - return [ca.arrows, ca.speed, ca.dreamy, ca.fighter]; - } - } - function wp(e) { - if (!e) return []; - switch (e.name) { - case "cloud9": - return ["skateboard"]; - case "superLevelPack": - return [ - "switchBlockSpike", - "giantEnemy", - "punch", - "speedChange", - "arrows", - ]; - } - } - function Ap(e, t, a) { - const i = rt(t.layout.powerups.map((e) => e.item)); - if (i.includes("skateboard") && !e.includes("skateboard")) - return a - ? "Cloud 9 bonus level needs to be unlocked to use skateboard" - : "Skateboard not unlocked"; - const n = a ? "Super Level Pack required: " : ""; - return t.layout.collectibles.some((e) => "arrow" === e.form) && - !e.includes("arrows") - ? n + "Arrows not unlocked" - : i.includes("punch") && !e.includes("punch") - ? n + "Punch not unlocked" - : t.layout.enemies.some((e) => e.giant) && - !e.includes("giantEnemy") - ? n + "Giant enemies not unlocked" - : t.layout.speedChanges.length > 0 && !e.includes("speedChange") - ? n + "Speed changes not unlocked" - : t.layout.switchButtons.filter( - (e) => "blockSpike" === e.affects, - ).length > 0 && !e.includes("switchBlockSpike") - ? n + "Switch block / spike buttons not unlocked" - : null; - } - const kp = { - calculateNumberBoosters: function (e) { - let t = 0, - a = 0, - i = 0; - return ( - e.forEach((e) => { - "autopilot" === e.booster.type - ? (t += e.usesLeft) - : "missiles" === e.booster.type - ? (a += e.usesLeft) - : "slowmo" === e.booster.type && (i += e.usesLeft); - }), - { numAutopilots: t, numMissiles: a, numSlowMotions: i } + }, ); - }, - removeBoughtItems: function (e, t) { - const a = t - .filter((e) => "passItem" === e.type) - .map((e) => e.defId); - return e.filter((e) => !a.includes(e.defId)); - }, - getBoosterItems: function (e) { - return e.filter((e) => "boosterItem" === e.type); - }, - useUpOneBooster: function (e, t) { - const a = t.findIndex((t) => t.defId === e.defId); - if (-1 === a) return t; - const i = t[a]; - return Rp(i) - ? i.usesLeft > 1 - ? tt( - t, - Object.assign(Object.assign({}, i), { - usesLeft: i.usesLeft - 1, - itemVersion: e.itemVersion, - }), - a, - ) - : at(t, a) - : t; - }, - isEditorOrThemeItem: function (e) { - return vp(e) || Tp(e); - }, - isEditorItem: vp, - isThemeItem: Tp, - canPlayLevel: function (e, t) { - return null; - return zu.hasIAP() - ? e.song.isBonusSong && !t.flatMap(Op).includes(e.song) - ? `${e.song.name} is a bonus level song you haven't unlocked` - : e.layout.properties.theme.isBonusTheme && - !t - .flatMap(Cp) - .map((e) => e.id) - .includes(e.layout.properties.theme.id) - ? `${e.layout.properties.theme.name} is a bonus level theme you haven't unlocked` - : Ap(t.flatMap(wp), e, true) - : null; - }, - canEditLevel: function (e, t, a, i) { - return null; - if (!i.includes(e.song)) - return `${e.song.name} song not unlocked`; - if ( - ![ - ca.world1.id, - ...a.map((e) => e.theme.id), - ...Rr.map((e) => e.id), - ].includes(e.layout.properties.theme.id) - ) - return `${e.layout.properties.theme.name} theme not unlocked`; - const n = [...t.map((e) => e.feature), ...Tr], - s = rt(e.layout.powerups.map((e) => e.item)); - if (s.includes("doubleJump") && !n.includes("doubleJump")) - return "Double jump not unlocked"; - if (s.includes("gun") && !n.includes("gun")) - return "Gun not unlocked"; - if (s.includes("jetpack") && !n.includes("jetpack")) - return "Jetpack not unlocked"; - if (s.includes("playerStack") && !n.includes("playerStacks")) - return "Player stacks not unlocked"; - if (s.includes("punch") && !n.includes("punch")) - return "Punch not unlocked"; - const o = rt( - e.layout.enemies.filter((e) => !e.giant).map((e) => e.kind), + }); + }); + }, + equipSkin: function e(t, a, i) { + return Wu(this, void 0, void 0, function* () { + return new Promise((n, s) => { + t.script.runScript( + "client/EquipSkin", + { skinName: a.fileName, profileId: i }, + (o) => { + const r = Zu(o, kh); + if (!(r instanceof Error)) + return 200 !== r.status + ? eh(r) + ? lh(t) + .then(() => e(t, a, i)) + .then(n) + .catch(s) + : void s(Error(String(r.reason_code))) + : void ("string" != typeof r.data.response || + "" === r.data.response + ? n() + : s(Error(r.data.response))); + s(r); + }, ); - return (!o.includes("walker") && !o.includes("walkerHelmet")) || - n.includes("walkingEnemy") - ? o.includes("shooter") && !n.includes("flyingEnemy") - ? "Flying enemy not unlocked" - : e.layout.saws.length > 0 && !n.includes("saws") - ? "Saws not unlocked" - : e.layout.switchButtons.filter( - (e) => "movement" === e.affects, - ).length > 0 && !n.includes("switchButton") - ? "Switch buttons not unlocked" - : e.layout.collectibles.some((e) => "coin" === e.form) && - !n.includes("collectible") - ? "Collectible Coins not unlocked" - : e.layout.springs.length > 0 && !n.includes("spring") - ? "Springs not unlocked" - : e.layout.portals.length > 0 && - !n.includes("portals") - ? "Portals not unlocked" - : e.layout.platforms.some( - (e) => "falling" === e.movement, - ) && !n.includes("fallingPlatform") - ? "Falling platforms not unlocked" - : (e.layout.platforms.some( - (e) => "jump" === e.movementTrigger, - ) || - e.layout.saws.some( - (e) => "jump" === e.movementTrigger, - ) || - e.layout.switchPlatforms.some( - (e) => "jump" === e.movementTrigger, - )) && - !n.includes("moveOnJump") - ? "Move on jump not unlocked" - : Ap(n, e, false) - : "Walking enemy not unlocked"; - }, - isPassItem: function (e) { - return "passItem" === e.type; - }, - isBoosterItem: Rp, - isSkinItem: function (e) { - return "skinItem" === e.type; - }, - isBonusLevelItem: function (e) { - return "bonusLevelItem" === e.type; - }, - }, - Np = function () { - return (window.Worker, null); - }, - xp = function (e, t) { - return new Promise((a) => { - if (!e) { - const e = JSON.parse(t), - i = Iu.jsonToData(e); - return void a(i); - } - const i = { type: "jsonToData", accountStorageString: t }; - (e.postMessage(i), - (e.onmessage = ({ data: e }) => { - a(e.accountStorage); - })); }); - }, - Pp = function (e, t, a) { - return new Promise((i) => { - if (!e) { - const e = Iu.dataToJson(t, a), - n = JSON.stringify(e); - return void i(n); + }); + }, + completedLevel: function (e, t, a, i, n) { + return Wu(this, void 0, void 0, function* () { + const s = yield Dh( + e, + t + "_" + (a ? "" : "no") + "checkpoints", + ); + if ("accelerated" === t) + if (0 === i) { + const t = yield Dh(e, "accelerated_avoid_collectibles"); + s.achievements.push(...t.achievements); + } else if (75 === i) { + const t = yield Dh(e, "accelerated_collectibles"); + s.achievements.push(...t.achievements); } - const n = { - type: "dataToJson", - accountStorage: Iu.removeNonSerialBossData(t), - }; - (e.postMessage(n), - (e.onmessage = ({ data: e }) => { - i(e.accountStorageString); - })); - }); - }, - Mp = function (e) { - null == e || e.terminate(); - }; - var Lp = function (e, t, a, i) { - return new (a || (a = Promise))(function (n, s) { - function o(e) { - try { - l(i.next(e)); - } catch (e) { - s(e); + if ("cloud_9" === t) { + if (n >= 2e5) { + const t = yield Dh(e, "cloud_9_high_score"); + s.achievements.push(...t.achievements); } - } - function r(e) { - try { - l(i.throw(e)); - } catch (e) { - s(e); + if (n >= 1e6) { + const t = yield Dh(e, "cloud_9_very_high_score"); + s.achievements.push(...t.achievements); } } - function l(e) { - var t; - e.done - ? n(e.value) - : ((t = e.value), - t instanceof a - ? t - : new a(function (e) { - e(t); - })).then(o, r); + if ("nacreous_snowmelt" === t && n >= 6e5) { + const t = yield Dh(e, "nacreous_snowmelt_high_score"); + s.achievements.push(...t.achievements); } - l((i = i.apply(e, t || [])).next()); + return s; }); - }; - const Dp = "savedLevels", - Bp = "savedLevelsSettings", - Fp = "savedAccount", - Yp = "savedLocal", - Up = "savedOfflineRequests", - jp = "savedOfflineCache"; - function Gp(e, t, a) { - return Lp(this, void 0, void 0, function* () { - let i = {}; - try { - const t = yield e.getItem(Bp); - if (null !== t) { - const e = Ru.jsonToData(JSON.parse(t)); - e instanceof Error || (i = e.data); - } - } catch (e) {} - try { - const n = yield e.getItem(Dp); - if (null === n) return { data: [], dateUpdated: 0 }; - const s = JSON.parse(n), - o = Yd.jsonToData(s); - if (o instanceof Error) - return ( - null == a || a.ok(`Error loading levels: ${o.message}`), - { data: [], dateUpdated: 0 } - ); - const r = o.data.map((e) => { - const t = i[e.id]; - return t - ? ul( - e, - "noShorten", - t.viewOffset, - t.runHistory, - Math.min(t.runHistoryIndex, t.runHistory.length - 1), - ) - : ul(e); - }); - return ( - o.didUpdate && (yield Vp(e, r, t)), - { data: r, dateUpdated: o.dateUpdated } - ); - } catch (e) { - const t = `Error loading levels: ${e.message}`; - return ( - Ql(t), - null == a || a.ok(t), - { data: [], dateUpdated: 0 } + }, + reachedRank: function (e, t) { + return Wu(this, void 0, void 0, function* () { + return Dh(e, "xp_rank" + t); + }); + }, + collectAchievementRewards: function e(t, a) { + return Wu(this, void 0, void 0, function* () { + return new Promise((i, n) => { + t.script.runScript( + "client/CollectRewards", + { achievementId: a.id, lego: !zu.hasIAP() }, + (s) => { + const o = Zu(s, Bh); + if (!(o instanceof Error)) + return 200 !== o.status + ? eh(o) + ? lh(t) + .then(() => e(t, a)) + .then(i) + .catch(n) + : void n(Error(String(o.reason_code))) + : void ("string" != typeof o.data.response + ? i({ + items: o.data.response.allUserItems + .map((e) => { + var t; + return wh( + e.itemId, + e.version, + e.defId, + e.quantity, + null !== (t = e.usesLeft) && + void 0 !== t + ? t + : void 0, + ); + }) + .filter(nt), + balance: o.data.response.balance, + }) + : n(Error(o.data.response))); + n(o); + }, ); - } + }); }); - } - function Vp(e, t, a) { - return Lp(this, void 0, void 0, function* () { - yield e.setItem( - Dp, - JSON.stringify( - Yd.dataToJson( - t.map(({ level: e }) => e), - a, - ), - ), - ); - const i = t.reduce( - (e, { level: t, settings: a }) => - Object.assign(Object.assign({}, e), { [t.id]: a }), - {}, + }, + findLobby: function e(t, a) { + return new Promise((i, n) => { + const s = 0 === a.length ? null : a.map((e) => e.cxId); + t.lobby.findOrCreateLobby( + "matchmaking", + 0, + 2, + ap, + ip, + s, + ep, + true, + tp, + "", + (s) => { + const o = Zu(s, lp); + if (!(o instanceof Error)) + return 200 !== o.status + ? eh(o) + ? lh(t) + .then(() => e(t, a)) + .then(i) + .catch(n) + : void n(Error(String(o.reason_code))) + : void i(o); + n(o); + }, ); - yield e.setItem(Bp, JSON.stringify(Ru.dataToJson(i, a))); }); - } - function Hp(e, t) { - return Lp(this, void 0, void 0, function* () { - const a = yield e.getItem(Yp); - if (null === a) - return { data: vu.getDefaultData(), firstTimePlaying: true }; - try { - const e = JSON.parse(a), - i = vu.jsonToData(e); - if (i instanceof Error) { - const e = `Error loading local saved data: ${i.message}`; - return ( - null == t || t.ok(e), - Ql(e), - { data: vu.getDefaultData(), firstTimePlaying: false } - ); - } - return { data: i.data, firstTimePlaying: false }; - } catch (e) { - const a = `Error loading local saved data: ${e.message}`; - return ( - null == t || t.ok(a), - Ql(a), - { data: vu.getDefaultData(), firstTimePlaying: false } - ); - } + }, + joinFriendsLobby: function e(t, a, i, n) { + return new Promise((s, o) => { + t.lobby.joinLobby(a, false, np(i, n), "", null, (r) => { + const l = Zu(r, rp); + if (!(l instanceof Error)) + return 200 !== l.status + ? eh(l) + ? lh(t) + .then(() => e(t, a, i, n)) + .then(s) + .catch(o) + : void o(Error(String(l.reason_code))) + : void s(); + o(l); + }); }); - } - function Xp(e, t, a) { - return Lp(this, void 0, void 0, function* () { - const i = yield e.getItem(Fp); - if (null === i) - return { data: Iu.getDefaultData(), dateUpdated: 0 }; - try { - const e = yield xp(t, i); - if (e instanceof Error) { - const t = `Error loading saved data: ${e.message}`; - console.error(e); - return ( - null == a || a.ok(t), - Ql(t), - { data: Iu.getDefaultData(), dateUpdated: 0 } - ); - } - return { data: e.data, dateUpdated: e.dateUpdated }; - } catch (e) { - const t = `Error loading saved data: ${e.message}`; - console.error(e); + }, + createFriendsLobby: function e(t, a, i, n) { + return new Promise((s, o) => { + const r = 0 === a.length ? null : a.map((e) => e.cxId), + l = xu(i.xpPoints).rank; + t.lobby.createLobby( + "friends", + 0, + r, + false, + null === r + ? np(n, l) + : ((e, t, a, i) => { + const n = { [e]: { skin: t.fileName, rank: a } }; + return ( + i.forEach((e) => { + n[e.profileId] = { + skin: e.skin.fileName, + rank: e.rank, + }; + }), + { type: "allMembers", skins: n } + ); + })(i.profileId, n, l, a), + "", + ep, + (r) => { + const l = Zu(r, sp); + if (!(l instanceof Error)) + return 200 !== l.status + ? eh(l) + ? lh(t) + .then(() => e(t, a, i, n)) + .then(s) + .catch(o) + : void o(Error(String(l.reason_code))) + : void s(); + o(l); + }, + ); + }); + }, + startFriendsServerLobby: function e(t, a, i) { + return new Promise((n, s) => { + const o = a.map((e) => e.cxId); + (t.lobby.createLobby( + "friends_server", + 0, + o, + true, + tp, + "", + i, + (o) => { + const r = Zu(o, op); + if (r instanceof Error) s(r); + else if (200 !== r.status) { + if (eh(r)) + return lh(t) + .then(() => e(t, a, i)) + .then(n) + .catch(s); + throw r; + } + }, + ), + n()); + }); + }, + leaveLobby: function e(t, a) { + return new Promise((i, n) => { + t.lobby.leaveLobby(a, (s) => { + const o = Zu(s, cp); + if (!(o instanceof Error)) + return 200 !== o.status + ? eh(o) + ? lh(t) + .then(() => e(t, a)) + .then(i) + .catch(n) + : void n(Error(String(o.reason_code))) + : void i(); + n(o); + }); + }); + }, + findUserById: function e(t, a) { + return Wu(this, void 0, void 0, function* () { + return new Promise((i, n) => { + 36 === a.length + ? t.friend.getSummaryDataForProfileId(a, (s) => { + const o = Zu(s, Yh); + if (o instanceof Error) n(o); + else if (200 !== o.status) { + if (eh(o)) + return lh(t) + .then(() => e(t, a)) + .then(i) + .catch(n); + n(Error(String(o.reason_code))); + } else + i({ + profileId: o.data.profileId, + playerName: o.data.profileName, + }); + }) + : n(Error("Invalid ID")); + }); + }); + }, + findUsersByName: function e(t, a) { + return Wu(this, void 0, void 0, function* () { + return new Promise((i, n) => { + t.friend.findUsersByExactName(a, 50, (s) => { + const o = Zu(s, Uh); + if (o instanceof Error) n(o); + else if (200 !== o.status) { + if (eh(o)) + return lh(t) + .then(() => e(t, a)) + .then(i) + .catch(n); + n(Error(String(o.reason_code))); + } else + i( + o.data.matches.map((e) => ({ + profileId: e.profileId, + playerName: e.profileName, + })), + ); + }); + }); + }); + }, + addFriend: function e(t, a) { + return Wu(this, void 0, void 0, function* () { + return new Promise((i, n) => { + t.friend.addFriends([a], (s) => { + const o = Zu(s, jh); + if (o instanceof Error) n(o); + else if (200 !== o.status) { + if (eh(o)) + return lh(t) + .then(() => e(t, a)) + .then(i) + .catch(n); + n(Error("")); + } else i(); + }); + }); + }); + }, + removeFriend: function e(t, a) { + return Wu(this, void 0, void 0, function* () { + return new Promise((i, n) => { + t.friend.removeFriends([a], (s) => { + const o = Zu(s, Gh); + if (o instanceof Error) n(o); + else if (200 !== o.status) { + if (eh(o)) + return lh(t) + .then(() => e(t, a)) + .then(i) + .catch(n); + n(Error("")); + } else i(); + }); + }); + }); + }, + inviteToParty: function e(t, a, i, n) { + return Wu(this, void 0, void 0, function* () { + const s = { fromPlayerName: a.playerName, lobbyId: n.id }; + return new Promise((o, r) => { + t.event.sendEvent(i.profileId, Hh, s, (s) => { + const l = Zu(s, Vh); + if (l instanceof Error) r(l); + else if (200 !== l.status) { + if (eh(l)) + return lh(t) + .then(() => e(t, a, i, n)) + .then(o) + .catch(r); + r(Error("")); + } else o(); + }); + }); + }); + }, + sendFriendRequest: function e(t, a, i) { + return Wu(this, void 0, void 0, function* () { + const n = { fromPlayerName: a.playerName }; + return new Promise((s, o) => { + t.event.sendEvent(i, zh, n, (n) => { + const r = Zu(n, Vh); + if (r instanceof Error) o(r); + else if (200 !== r.status) { + if (eh(r)) + return lh(t) + .then(() => e(t, a, i)) + .then(s) + .catch(o); + o(Error("")); + } else s(); + }); + }); + }); + }, + acceptFriendRequest: function e(t, a, i) { + return Wu(this, void 0, void 0, function* () { + const n = { fromPlayerName: a.playerName }; + return new Promise((s, o) => { + t.event.sendEvent(i, qh, n, (n) => { + const r = Zu(n, Vh); + if (r instanceof Error) o(r); + else if (200 !== r.status) { + if (eh(r)) + return lh(t) + .then(() => e(t, a, i)) + .then(s) + .catch(o); + o(Error("")); + } else s(); + }); + }); + }); + }, + mockBackend: yp, + sendMockLobbyEvent: function (e) { + switch (e.type) { + case "royaleLobby": + Ep.sendLobbyCallback({ + service: "lobby", + operation: "MEMBER_JOIN", + data: { + lobbyId: e.lobby.id, + lobby: { + members: Array.from({ + length: e.lobby.totalMembers, + }).map((e, t) => ({ + profileId: `id-${t}`, + name: `Player${t}`, + cxId: `098213-${t}`, + extra: {}, + })), + owner: "id-0", + lobbyTypeDef: { + teams: { all: { maxUsers: e.lobby.maxMembers } }, + }, + }, + }, + }); + break; + case "friendsLobby": + Ep.sendLobbyCallback({ + service: "lobby", + operation: "MEMBER_JOIN", + data: { + lobbyId: e.lobby.id, + lobby: { + members: e.lobby.members.map((e) => ({ + profileId: e.profileId, + name: e.playerName, + cxId: "098213", + extra: { skin: e.skin.fileName, rank: e.rank }, + })), + owner: e.lobby.ownerId, + lobbyTypeDef: { + teams: { all: { maxUsers: e.lobby.maxMembers } }, + }, + }, + }, + }); + break; + case "server": + Ep.sendLobbyCallback({ + service: "lobby", + operation: "ROOM_ASSIGNED", + data: { + lobbyId: "", + connectData: { + address: e.server.address, + ports: { "9313/tcp": e.server.port }, + }, + passcode: e.server.passcode, + }, + }); + break; + case "startGame": + Ep.sendLobbyCallback({ + service: "lobby", + operation: "DISBANDED", + data: { + lobbyId: "", + reason: { code: 80101, desc: "Start game" }, + }, + }); + } + }, + sendMockGeneralEvent: function (e) { + switch (e.type) { + case "invite": + Ep.sendEventCallback({ + service: "event", + data: { + fromPlayerId: e.from.profileId, + eventType: Hh, + eventData: { + fromPlayerName: e.from.playerName, + lobbyId: e.lobbyId, + }, + }, + }); + break; + case "friendRequest": + Ep.sendEventCallback({ + service: "event", + data: { + fromPlayerId: e.from.profileId, + eventType: zh, + eventData: { fromPlayerName: e.from.playerName }, + }, + }); + break; + case "friendRequestAccept": + Ep.sendEventCallback({ + service: "event", + data: { + fromPlayerId: e.from.profileId, + eventType: qh, + eventData: { fromPlayerName: e.from.playerName }, + }, + }); + } + }, + ACCOUNT_ENTITY: fh, + LEVELS_ENTITY: yh, + UPDATE_LOGIN_ERROR: ah, + EXPIRED_LOGIN_ERROR: ih, + USER_NOT_FOUND: nh, + OFFLINE: th, + }, + Sp = kc({ + itemId: mc, + version: fc, + usesLeft: Bc([hc, fc]), + defId: mc, + }), + Ip = Ld({ + mappers: [ + () => ({ + booster: wu, + pass: [], + editor: [], + skin: [], + bonusLevel: [], + all: [], + spentItemDefIds: [], + }), + (e) => ({ + ownedItems: + 0 === e.all.length + ? [ + ...e.booster, + ...e.pass, + ...e.editor, + ...e.skin, + ...e.bonusLevel, + ] + : e.all, + spentItemDefIds: e.spentItemDefIds, + }), + (e) => + Object.assign(Object.assign({}, e), { playerSkin: "default" }), + ], + finalSchema: kc({ + ownedItems: Oc(Sp), + spentItemDefIds: Oc(mc), + playerSkin: mc, + }), + uncompress: (e) => ({ + ownedItems: e.ownedItems + .map((e) => { + var t; + return bp.getItemFromResponse( + e.itemId, + e.version, + e.defId, + 1, + null !== (t = e.usesLeft) && void 0 !== t ? t : void 0, + ); + }) + .filter(nt), + spentItemDefIds: e.spentItemDefIds, + playerSkin: Wt.getSkin(e.playerSkin), + }), + compress: (e) => ({ + ownedItems: e.ownedItems.map((e) => ({ + itemId: e.itemId, + version: e.itemVersion, + usesLeft: "boosterItem" === e.type ? e.usesLeft : null, + defId: e.defId, + })), + spentItemDefIds: e.spentItemDefIds, + playerSkin: e.playerSkin.fileName, + }), + }), + _p = { + getItem: (e) => ju.secureStorage.getItem(e), + setItem: (e, t) => ju.secureStorage.setItem(e, t), + clear: () => ju.clearSecureStorage(), + }; + function vp(e) { + return "editorItem" === e.type; + } + function Tp(e) { + return "themeItem" === e.type; + } + function Rp(e) { + return "boosterItem" === e.type; + } + function Op(e) { + if (!e) return []; + switch (e.name) { + case "cloud9": + return [hl.songs.cloud9]; + case "superLevelPack": + return [ + hl.songs.aura, + hl.songs.coolFriends, + hl.songs.forYou, + hl.songs.nacreousSnowmelt, + ]; + } + } + function Cp(e) { + if (!e) return []; + switch (e.name) { + case "cloud9": + return [ca.skater]; + case "superLevelPack": + return [ca.arrows, ca.speed, ca.dreamy, ca.fighter]; + } + } + function wp(e) { + if (!e) return []; + switch (e.name) { + case "cloud9": + return ["skateboard"]; + case "superLevelPack": + return [ + "switchBlockSpike", + "giantEnemy", + "punch", + "speedChange", + "arrows", + ]; + } + } + function Ap(e, t, a) { + const i = rt(t.layout.powerups.map((e) => e.item)); + if (i.includes("skateboard") && !e.includes("skateboard")) + return a + ? "Cloud 9 bonus level needs to be unlocked to use skateboard" + : "Skateboard not unlocked"; + const n = a ? "Super Level Pack required: " : ""; + return t.layout.collectibles.some((e) => "arrow" === e.form) && + !e.includes("arrows") + ? n + "Arrows not unlocked" + : i.includes("punch") && !e.includes("punch") + ? n + "Punch not unlocked" + : t.layout.enemies.some((e) => e.giant) && + !e.includes("giantEnemy") + ? n + "Giant enemies not unlocked" + : t.layout.speedChanges.length > 0 && !e.includes("speedChange") + ? n + "Speed changes not unlocked" + : t.layout.switchButtons.filter( + (e) => "blockSpike" === e.affects, + ).length > 0 && !e.includes("switchBlockSpike") + ? n + "Switch block / spike buttons not unlocked" + : null; + } + const kp = { + calculateNumberBoosters: function (e) { + let t = 0, + a = 0, + i = 0; + return ( + e.forEach((e) => { + "autopilot" === e.booster.type + ? (t += e.usesLeft) + : "missiles" === e.booster.type + ? (a += e.usesLeft) + : "slowmo" === e.booster.type && (i += e.usesLeft); + }), + { numAutopilots: t, numMissiles: a, numSlowMotions: i } + ); + }, + removeBoughtItems: function (e, t) { + const a = t + .filter((e) => "passItem" === e.type) + .map((e) => e.defId); + return e.filter((e) => !a.includes(e.defId)); + }, + getBoosterItems: function (e) { + return e.filter((e) => "boosterItem" === e.type); + }, + useUpOneBooster: function (e, t) { + const a = t.findIndex((t) => t.defId === e.defId); + if (-1 === a) return t; + const i = t[a]; + return Rp(i) + ? i.usesLeft > 1 + ? tt( + t, + Object.assign(Object.assign({}, i), { + usesLeft: i.usesLeft - 1, + itemVersion: e.itemVersion, + }), + a, + ) + : at(t, a) + : t; + }, + isEditorOrThemeItem: function (e) { + return vp(e) || Tp(e); + }, + isEditorItem: vp, + isThemeItem: Tp, + canPlayLevel: function (e, t) { + return null; + return zu.hasIAP() + ? e.song.isBonusSong && !t.flatMap(Op).includes(e.song) + ? `${e.song.name} is a bonus level song you haven't unlocked` + : e.layout.properties.theme.isBonusTheme && + !t + .flatMap(Cp) + .map((e) => e.id) + .includes(e.layout.properties.theme.id) + ? `${e.layout.properties.theme.name} is a bonus level theme you haven't unlocked` + : Ap(t.flatMap(wp), e, true) + : null; + }, + canEditLevel: function (e, t, a, i) { + return null; + if (!i.includes(e.song)) + return `${e.song.name} song not unlocked`; + if ( + ![ + ca.world1.id, + ...a.map((e) => e.theme.id), + ...Rr.map((e) => e.id), + ].includes(e.layout.properties.theme.id) + ) + return `${e.layout.properties.theme.name} theme not unlocked`; + const n = [...t.map((e) => e.feature), ...Tr], + s = rt(e.layout.powerups.map((e) => e.item)); + if (s.includes("doubleJump") && !n.includes("doubleJump")) + return "Double jump not unlocked"; + if (s.includes("gun") && !n.includes("gun")) + return "Gun not unlocked"; + if (s.includes("jetpack") && !n.includes("jetpack")) + return "Jetpack not unlocked"; + if (s.includes("playerStack") && !n.includes("playerStacks")) + return "Player stacks not unlocked"; + if (s.includes("punch") && !n.includes("punch")) + return "Punch not unlocked"; + const o = rt( + e.layout.enemies.filter((e) => !e.giant).map((e) => e.kind), + ); + return (!o.includes("walker") && !o.includes("walkerHelmet")) || + n.includes("walkingEnemy") + ? o.includes("shooter") && !n.includes("flyingEnemy") + ? "Flying enemy not unlocked" + : e.layout.saws.length > 0 && !n.includes("saws") + ? "Saws not unlocked" + : e.layout.switchButtons.filter( + (e) => "movement" === e.affects, + ).length > 0 && !n.includes("switchButton") + ? "Switch buttons not unlocked" + : e.layout.collectibles.some((e) => "coin" === e.form) && + !n.includes("collectible") + ? "Collectible Coins not unlocked" + : e.layout.springs.length > 0 && !n.includes("spring") + ? "Springs not unlocked" + : e.layout.portals.length > 0 && + !n.includes("portals") + ? "Portals not unlocked" + : e.layout.platforms.some( + (e) => "falling" === e.movement, + ) && !n.includes("fallingPlatform") + ? "Falling platforms not unlocked" + : (e.layout.platforms.some( + (e) => "jump" === e.movementTrigger, + ) || + e.layout.saws.some( + (e) => "jump" === e.movementTrigger, + ) || + e.layout.switchPlatforms.some( + (e) => "jump" === e.movementTrigger, + )) && + !n.includes("moveOnJump") + ? "Move on jump not unlocked" + : Ap(n, e, false) + : "Walking enemy not unlocked"; + }, + isPassItem: function (e) { + return "passItem" === e.type; + }, + isBoosterItem: Rp, + isSkinItem: function (e) { + return "skinItem" === e.type; + }, + isBonusLevelItem: function (e) { + return "bonusLevelItem" === e.type; + }, + }, + Np = function () { + return (window.Worker, null); + }, + xp = function (e, t) { + return new Promise((a) => { + if (!e) { + const e = JSON.parse(t), + i = Iu.jsonToData(e); + return void a(i); + } + const i = { type: "jsonToData", accountStorageString: t }; + (e.postMessage(i), + (e.onmessage = ({ data: e }) => { + a(e.accountStorage); + })); + }); + }, + Pp = function (e, t, a) { + return new Promise((i) => { + if (!e) { + const e = Iu.dataToJson(t, a), + n = JSON.stringify(e); + return void i(n); + } + const n = { + type: "dataToJson", + accountStorage: Iu.removeNonSerialBossData(t), + }; + (e.postMessage(n), + (e.onmessage = ({ data: e }) => { + i(e.accountStorageString); + })); + }); + }, + Mp = function (e) { + null == e || e.terminate(); + }; + var Lp = function (e, t, a, i) { + return new (a || (a = Promise))(function (n, s) { + function o(e) { + try { + l(i.next(e)); + } catch (e) { + s(e); + } + } + function r(e) { + try { + l(i.throw(e)); + } catch (e) { + s(e); + } + } + function l(e) { + var t; + e.done + ? n(e.value) + : ((t = e.value), + t instanceof a + ? t + : new a(function (e) { + e(t); + })).then(o, r); + } + l((i = i.apply(e, t || [])).next()); + }); + }; + const Dp = "savedLevels", + Bp = "savedLevelsSettings", + Fp = "savedAccount", + Yp = "savedLocal", + Up = "savedOfflineRequests", + jp = "savedOfflineCache"; + function Gp(e, t, a) { + return Lp(this, void 0, void 0, function* () { + let i = {}; + try { + const t = yield e.getItem(Bp); + if (null !== t) { + const e = Ru.jsonToData(JSON.parse(t)); + e instanceof Error || (i = e.data); + } + } catch (e) { } + try { + const n = yield e.getItem(Dp); + if (null === n) return { data: [], dateUpdated: 0 }; + const s = JSON.parse(n), + o = Yd.jsonToData(s); + if (o instanceof Error) + return ( + null == a || a.ok(`Error loading levels: ${o.message}`), + { data: [], dateUpdated: 0 } + ); + const r = o.data.map((e) => { + const t = i[e.id]; + return t + ? ul( + e, + "noShorten", + t.viewOffset, + t.runHistory, + Math.min(t.runHistoryIndex, t.runHistory.length - 1), + ) + : ul(e); + }); + return ( + o.didUpdate && (yield Vp(e, r, t)), + { data: r, dateUpdated: o.dateUpdated } + ); + } catch (e) { + const t = `Error loading levels: ${e.message}`; + return ( + Ql(t), + null == a || a.ok(t), + { data: [], dateUpdated: 0 } + ); + } + }); + } + function Vp(e, t, a) { + return Lp(this, void 0, void 0, function* () { + yield e.setItem( + Dp, + JSON.stringify( + Yd.dataToJson( + t.map(({ level: e }) => e), + a, + ), + ), + ); + const i = t.reduce( + (e, { level: t, settings: a }) => + Object.assign(Object.assign({}, e), { [t.id]: a }), + {}, + ); + yield e.setItem(Bp, JSON.stringify(Ru.dataToJson(i, a))); + }); + } + function Hp(e, t) { + return Lp(this, void 0, void 0, function* () { + const a = yield e.getItem(Yp); + if (null === a) + return { data: vu.getDefaultData(), firstTimePlaying: true }; + try { + const e = JSON.parse(a), + i = vu.jsonToData(e); + if (i instanceof Error) { + const e = `Error loading local saved data: ${i.message}`; + return ( + null == t || t.ok(e), + Ql(e), + { data: vu.getDefaultData(), firstTimePlaying: false } + ); + } + return { data: i.data, firstTimePlaying: false }; + } catch (e) { + const a = `Error loading local saved data: ${e.message}`; + return ( + null == t || t.ok(a), + Ql(a), + { data: vu.getDefaultData(), firstTimePlaying: false } + ); + } + }); + } + function Xp(e, t, a) { + return Lp(this, void 0, void 0, function* () { + const i = yield e.getItem(Fp); + if (null === i) + return { data: Iu.getDefaultData(), dateUpdated: 0 }; + try { + const e = yield xp(t, i); + if (e instanceof Error) { + const t = `Error loading saved data: ${e.message}`; + console.error(e); return ( null == a || a.ok(t), Ql(t), { data: Iu.getDefaultData(), dateUpdated: 0 } ); } + return { data: e.data, dateUpdated: e.dateUpdated }; + } catch (e) { + const t = `Error loading saved data: ${e.message}`; + console.error(e); + return ( + null == a || a.ok(t), + Ql(t), + { data: Iu.getDefaultData(), dateUpdated: 0 } + ); + } + }); + } + function zp(e, t, a, i, n, s) { + return Lp(this, void 0, void 0, function* () { + const o = s || (yield Xp(e, t)).data, + r = Object.assign(Object.assign({}, o), n); + try { + const a = yield Pp(t, r, i); + if (!a) throw Error("Failed to serialise"); + yield e.setItem(Fp, a); + } catch (e) { + const t = `Error saving data: ${e.message}`; + (a.ok(t), Ql(t)); + } + return r; + }); + } + function Wp(e) { + return Lp(this, void 0, void 0, function* () { + try { + const t = yield e.getItem(Up); + if (null === t) return []; + const a = JSON.parse(t), + i = Cu(a); + return i instanceof Error ? [] : i; + } catch (e) { + const t = `Error loading offline requests saved data: ${e.message}`; + return (Ql(t), console.error(t), []); + } + }); + } + function qp() { + return Lp(this, void 0, void 0, function* () { + const e = _p, + t = yield e.getItem(jp); + if (null === t) { + return Ip.getDefaultData(); + } + try { + const e = JSON.parse(t), + a = Ip.jsonToData(e); + if (a instanceof Error) throw a; + return a.data; + } catch (e) { + return ( + console.error(`Error loading offline cache: ${e.message}`), + Ip.getDefaultData() + ); + } + }); + } + function $p(e, t) { + return Lp(this, void 0, void 0, function* () { + const a = _p, + i = yield qp(), + n = Object.assign(Object.assign({}, i), t); + try { + yield a.setItem(jp, JSON.stringify(Ip.dataToJson(n, e))); + } catch (e) { + console.error(`Error saving offline cache: ${e.message}`); + } + return n; + }); + } + const Jp = { + getSavedLevels: Gp, + saveLevel: function (e, t, a, i, n, s, o, r) { + return Lp(this, void 0, void 0, function* () { + const { data: l } = yield Gp(e, t), + c = l.findIndex((e) => e.level.id === a.id); + try { + const i = ul(a, "every5", n, s, o, r), + d = -1 === c ? [...l, i] : tt(l, i, c); + return { data: (yield Vp(e, d, t), d), error: false }; + } catch (r) { + console.error( + "Probably not enough storage space, trying again with less history", + r, + ); + const d = ul(a, "last10", n, s, o), + u = -1 === c ? [...l, d] : tt(l, d, c); + try { + yield Vp(e, u, t); + } catch (e) { + const t = `Error saving level: ${e.message} Try deleting older levels, or use the "ERASE RUN HISTORY" button in "MORE"`; + console.error(e); + (Ql(t), i.ok(t)); + } + return { data: u, error: true }; + } }); - } - function zp(e, t, a, i, n, s) { + }, + deleteLevel: function (e, t, a, i) { return Lp(this, void 0, void 0, function* () { - const o = s || (yield Xp(e, t)).data, - r = Object.assign(Object.assign({}, o), n); + const { data: n } = yield Gp(e, i), + s = n.findIndex((e) => e.level.id === t.level.id); + if (-1 === s) return n; + const o = at(n, s); try { - const a = yield Pp(t, r, i); - if (!a) throw Error("Failed to serialise"); - yield e.setItem(Fp, a); + yield Vp(e, o, i); } catch (e) { - const t = `Error saving data: ${e.message}`; + const t = `Error deleting level: ${e.message}`; (a.ok(t), Ql(t)); } - return r; + return o; }); - } - function Wp(e) { + }, + saveAllLevels: function (e, t, a, i) { return Lp(this, void 0, void 0, function* () { try { - const t = yield e.getItem(Up); - if (null === t) return []; - const a = JSON.parse(t), - i = Cu(a); - return i instanceof Error ? [] : i; + yield Vp(e, t, i); } catch (e) { - const t = `Error loading offline requests saved data: ${e.message}`; - return (Ql(t), console.error(t), []); + const t = `Error saving levels: ${e.message}`; + (a.ok(t), Ql(t)); } }); - } - function qp() { + }, + saveLevelProgress: function ( + e, + t, + a, + i, + n, + s, + o, + r, + l, + c, + d, + u, + h, + p, + ) { + return Lp(this, void 0, void 0, function* () { + const { data: g } = yield Xp(t, e), + m = g.levelsProgress, + f = Xl(m, i, n, s, o, r, l, d, u, h, p); + return yield zp(t, e, c, a, { levelsProgress: f }, g); + }); + }, + getAccount: Xp, + saveAccount: zp, + addFriendRequests: function (e, t, a, i, n) { + return Lp(this, void 0, void 0, function* () { + const s = (yield Xp(e, null, t)).data, + o = s.friendRequests.map((e) => e.profileId), + r = n + ? i + : [ + ...s.friendRequests, + ...i.filter((e) => !o.includes(e.profileId)), + ]; + return (yield zp(e, null, t, a, { friendRequests: r }, s), r); + }); + }, + getLocal: Hp, + saveLocal: function (e, t, a, i, n) { return Lp(this, void 0, void 0, function* () { - const e = _p, - t = yield e.getItem(jp); - if (null === t) { - return Ip.getDefaultData(); + const s = n || (yield Hp(e)).data, + o = Object.assign(Object.assign({}, s), i); + try { + yield e.setItem(Yp, JSON.stringify(vu.dataToJson(o, a))); + } catch (e) { + const a = `Error saving local data: ${e.message}`; + (t.ok(a), Ql(a)); } + }); + }, + saveLocalOfflineCache: function (e, t, a) { + return Lp(this, void 0, void 0, function* () { + const i = (yield Hp(e)).data, + n = Object.assign(Object.assign({}, i), { + offlineCache: Object.assign( + Object.assign({}, i.offlineCache), + a, + ), + }); try { - const e = JSON.parse(t), - a = Ip.jsonToData(e); - if (a instanceof Error) throw a; - return a.data; + yield e.setItem(Yp, JSON.stringify(vu.dataToJson(n, t))); } catch (e) { - return ( - console.error(`Error loading offline cache: ${e.message}`), - Ip.getDefaultData() - ); + console.error("Error saving local offline cache", e); } }); - } - function $p(e, t) { + }, + getOfflineRequests: Wp, + addOfflineRequests: function (e, t) { return Lp(this, void 0, void 0, function* () { - const a = _p, - i = yield qp(), - n = Object.assign(Object.assign({}, i), t); try { - yield a.setItem(jp, JSON.stringify(Ip.dataToJson(n, e))); + const a = yield Wp(e); + yield e.setItem(Up, JSON.stringify([...a, ...t])); } catch (e) { - console.error(`Error saving offline cache: ${e.message}`); + const t = `Error saving offline requests data: ${e.message}`; + (Ql(t), console.error(t)); } - return n; }); - } - const Jp = { - getSavedLevels: Gp, - saveLevel: function (e, t, a, i, n, s, o, r) { - return Lp(this, void 0, void 0, function* () { - const { data: l } = yield Gp(e, t), - c = l.findIndex((e) => e.level.id === a.id); - try { - const i = ul(a, "every5", n, s, o, r), - d = -1 === c ? [...l, i] : tt(l, i, c); - return { data: (yield Vp(e, d, t), d), error: false }; - } catch (r) { - console.error( - "Probably not enough storage space, trying again with less history", - r, - ); - const d = ul(a, "last10", n, s, o), - u = -1 === c ? [...l, d] : tt(l, d, c); - try { - yield Vp(e, u, t); - } catch (e) { - const t = `Error saving level: ${e.message} Try deleting older levels, or use the "ERASE RUN HISTORY" button in "MORE"`; - console.error(e); - (Ql(t), i.ok(t)); - } - return { data: u, error: true }; - } - }); - }, - deleteLevel: function (e, t, a, i) { - return Lp(this, void 0, void 0, function* () { - const { data: n } = yield Gp(e, i), - s = n.findIndex((e) => e.level.id === t.level.id); - if (-1 === s) return n; - const o = at(n, s); - try { - yield Vp(e, o, i); - } catch (e) { - const t = `Error deleting level: ${e.message}`; - (a.ok(t), Ql(t)); - } - return o; - }); - }, - saveAllLevels: function (e, t, a, i) { - return Lp(this, void 0, void 0, function* () { - try { - yield Vp(e, t, i); - } catch (e) { - const t = `Error saving levels: ${e.message}`; - (a.ok(t), Ql(t)); - } - }); - }, - saveLevelProgress: function ( - e, - t, - a, - i, - n, - s, - o, - r, - l, - c, - d, - u, - h, - p, - ) { - return Lp(this, void 0, void 0, function* () { - const { data: g } = yield Xp(t, e), - m = g.levelsProgress, - f = Xl(m, i, n, s, o, r, l, d, u, h, p); - return yield zp(t, e, c, a, { levelsProgress: f }, g); - }); - }, - getAccount: Xp, - saveAccount: zp, - addFriendRequests: function (e, t, a, i, n) { - return Lp(this, void 0, void 0, function* () { - const s = (yield Xp(e, null, t)).data, - o = s.friendRequests.map((e) => e.profileId), - r = n - ? i - : [ - ...s.friendRequests, - ...i.filter((e) => !o.includes(e.profileId)), - ]; - return (yield zp(e, null, t, a, { friendRequests: r }, s), r); - }); - }, - getLocal: Hp, - saveLocal: function (e, t, a, i, n) { - return Lp(this, void 0, void 0, function* () { - const s = n || (yield Hp(e)).data, - o = Object.assign(Object.assign({}, s), i); - try { - yield e.setItem(Yp, JSON.stringify(vu.dataToJson(o, a))); - } catch (e) { - const a = `Error saving local data: ${e.message}`; - (t.ok(a), Ql(a)); - } - }); - }, - saveLocalOfflineCache: function (e, t, a) { - return Lp(this, void 0, void 0, function* () { - const i = (yield Hp(e)).data, - n = Object.assign(Object.assign({}, i), { - offlineCache: Object.assign( - Object.assign({}, i.offlineCache), - a, - ), - }); - try { - yield e.setItem(Yp, JSON.stringify(vu.dataToJson(n, t))); - } catch (e) { - console.error("Error saving local offline cache", e); - } - }); - }, - getOfflineRequests: Wp, - addOfflineRequests: function (e, t) { - return Lp(this, void 0, void 0, function* () { - try { - const a = yield Wp(e); - yield e.setItem(Up, JSON.stringify([...a, ...t])); - } catch (e) { - const t = `Error saving offline requests data: ${e.message}`; - (Ql(t), console.error(t)); - } - }); - }, - clearOfflineRequests: function (e) { - return Lp(this, void 0, void 0, function* () { - try { - yield e.setItem(Up, JSON.stringify([])); - } catch (e) { - const t = `Error saving offline requests data: ${e.message}`; - (Ql(t), console.error(t)); - } - }); - }, - getEncryptedStorage: qp, - saveEncryptedStorage: $p, - getUserItems: function (e) { - return Lp(this, void 0, void 0, function* () { - const t = (yield qp()).ownedItems; - switch (e) { - case "bonusLevel": - return t.filter(kp.isBonusLevelItem); - case "booster": - return t.filter(kp.isBoosterItem); - case "editor": - return t.filter(kp.isEditorOrThemeItem); - case "pass": - return t.filter(kp.isPassItem); - case "skin": - return t.filter(kp.isSkinItem); - default: - return t; - } - }); - }, - addPurchasedItems: function (e, t) { - return Lp(this, void 0, void 0, function* () { - const a = (yield qp()).ownedItems; - yield $p(t, { ownedItems: [...a, ...e] }); - }); - }, - useBooster: function (e, t, a) { - return Lp(this, void 0, void 0, function* () { - const i = _p, - n = yield qp(), - s = Object.assign(Object.assign({}, n), { - spentItemDefIds: a - ? [...n.spentItemDefIds, t.defId] - : n.spentItemDefIds, - ownedItems: kp.useUpOneBooster(t, n.ownedItems), - }); - try { - yield i.setItem(jp, JSON.stringify(Ip.dataToJson(s, e))); - } catch (e) { - console.error(`Error saving offline cache: ${e.message}`); - } + }, + clearOfflineRequests: function (e) { + return Lp(this, void 0, void 0, function* () { + try { + yield e.setItem(Up, JSON.stringify([])); + } catch (e) { + const t = `Error saving offline requests data: ${e.message}`; + (Ql(t), console.error(t)); + } + }); + }, + getEncryptedStorage: qp, + saveEncryptedStorage: $p, + getUserItems: function (e) { + return Lp(this, void 0, void 0, function* () { + const t = (yield qp()).ownedItems; + switch (e) { + case "bonusLevel": + return t.filter(kp.isBonusLevelItem); + case "booster": + return t.filter(kp.isBoosterItem); + case "editor": + return t.filter(kp.isEditorOrThemeItem); + case "pass": + return t.filter(kp.isPassItem); + case "skin": + return t.filter(kp.isSkinItem); + default: + return t; + } + }); + }, + addPurchasedItems: function (e, t) { + return Lp(this, void 0, void 0, function* () { + const a = (yield qp()).ownedItems; + yield $p(t, { ownedItems: [...a, ...e] }); + }); + }, + useBooster: function (e, t, a) { + return Lp(this, void 0, void 0, function* () { + const i = _p, + n = yield qp(), + s = Object.assign(Object.assign({}, n), { + spentItemDefIds: a + ? [...n.spentItemDefIds, t.defId] + : n.spentItemDefIds, + ownedItems: kp.useUpOneBooster(t, n.ownedItems), }); - }, - SAVED_LEVELS_KEY: Dp, - SAVED_ACCOUNT_KEY: Fp, - SAVED_OFFLINE_REQUESTS: Up, - SAVED_LOCAL_KEY: Yp, - }, - Kp = 120, - Qp = (e, t) => ({ - textState: - "init" === e - ? { type: "init", view: "tapToJump", timer: Kp } - : "skateboard" === e - ? { type: "skateboard", view: "crouch", timer: Kp } - : null, - boosterPrompt: t ? "waitingToShow" : null, - }), - Zp = (e, t) => { - if (null === e) return ""; - switch (e.type) { - case "init": - switch (e.view) { - case "tapToJump": - return (t ? "TAP" : "CLICK OR SPACE BAR") + " TO JUMP"; - case "holdDown": - return "HOLD DOWN TO KEEP JUMPING"; - case "goodLuck": - return "GOOD LUCK!"; - case "end": - return ""; - } - case "skateboard": - switch (e.view) { - case "crouch": - return t - ? "HOLD CLICK OR SPACE BAR TO CROUCH" - : "PRESS DOWN TO CROUCH"; - case "jump": - return "RELEASE TO JUMP"; - case "backflip": - return "PRESS DOWN IN AIR TO BACKFLIP"; - case "end": - return ""; - } + try { + yield i.setItem(jp, JSON.stringify(Ip.dataToJson(s, e))); + } catch (e) { + console.error(`Error saving offline cache: ${e.message}`); } - }, - eg = 12, - playerTrail = makeSprite({ - render: ({ props: e, getContext }) => { - if (!e.isFront) { - if (e.theme == "classic") { - return [ - onChange( - () => e.attempt, - () => [ - playerTrailSquares.Single( - { - playerX: e.playerX, - playerY: e.playerY, - playerRot: e.playerRot, - crashed: e.crashed, - paused: e.paused, - playerScale: e.playerScale - }, - (t) => { - ( - (t.playerX = e.playerX), - (t.playerY = e.playerY), - (t.playerRot = e.playerRot), - (t.crashed = e.crashed), - (t.paused = e.paused), - (t.playerScale = e.playerScale) - ) - } - ) - ]) - ]; - } + }); + }, + SAVED_LEVELS_KEY: Dp, + SAVED_ACCOUNT_KEY: Fp, + SAVED_OFFLINE_REQUESTS: Up, + SAVED_LOCAL_KEY: Yp, + }, + Kp = 120, + Qp = (e, t) => ({ + textState: + "init" === e + ? { type: "init", view: "tapToJump", timer: Kp } + : "skateboard" === e + ? { type: "skateboard", view: "crouch", timer: Kp } + : null, + boosterPrompt: t ? "waitingToShow" : null, + }), + Zp = (e, t) => { + if (null === e) return ""; + switch (e.type) { + case "init": + switch (e.view) { + case "tapToJump": + return (t ? "TAP" : "CLICK OR SPACE BAR") + " TO JUMP"; + case "holdDown": + return "HOLD DOWN TO KEEP JUMPING"; + case "goodLuck": + return "GOOD LUCK!"; + case "end": + return ""; + } + case "skateboard": + switch (e.view) { + case "crouch": + return t + ? "HOLD CLICK OR SPACE BAR TO CROUCH" + : "PRESS DOWN TO CROUCH"; + case "jump": + return "RELEASE TO JUMP"; + case "backflip": + return "PRESS DOWN IN AIR TO BACKFLIP"; + case "end": + return ""; + } + } + }, + eg = 12, + playerTrail = makeSprite({ + render: ({ props: e, getContext }) => { + if (!e.isFront) { + if (e.theme == "classic") { return [ - ifConditional( - () => e.theme === "infinite", + onChange( + () => e.attempt, () => [ - onChange( - () => e.attempt, - () => [ - onChange( - () => e.touchingPortals, - () => [ - universalFlyingTrail.Single( - { - playerX: e.playerX, - playerY: e.playerY, - radius: 4 * e.playerScale, - offset: 10.5 * e.playerScale, - playerDir: e.playerDir, - paused: e.paused, - crashed: e.crashed, - trail: e.skin.trail, - frame: e.frame || 0, - touchingPortals: e.touchingPortals, - }, - (t) => { - ((t.radius = 4 * e.playerScale), - (t.offset = 10.5 * e.playerScale), - (t.playerX = e.playerX), - (t.playerY = e.playerY), - (t.playerDir = e.playerDir), - (t.paused = e.paused), - (t.crashed = e.crashed), - (t.trail = e.skin.trail), - (t.frame = e.frame || 0), - (t.touchingPortals = e.touchingPortals)); - }, - ), - universalFlyingTrail.Single( - { - playerX: e.playerX, - playerY: e.playerY, - radius: 4 * e.playerScale, - offset: -10.5 * e.playerScale, - playerDir: e.playerDir, - paused: e.paused, - crashed: e.crashed, - trail: e.skin.trail, - frame: e.frame || 0, - touchingPortals: e.touchingPortals, - }, - (t) => { - ((t.radius = 4 * e.playerScale), - (t.offset = -10.5 * e.playerScale), - (t.playerX = e.playerX), - (t.playerY = e.playerY), - (t.playerDir = e.playerDir), - (t.paused = e.paused), - (t.crashed = e.crashed), - (t.trail = e.skin.trail), - (t.frame = e.frame || 0), - (t.touchingPortals = e.touchingPortals)); - }, - ), - ], - ), - ], - )]), - ]; + playerTrailSquares.Single( + { + playerX: e.playerX, + playerY: e.playerY, + playerRot: e.playerRot, + crashed: e.crashed, + paused: e.paused, + playerScale: e.playerScale + }, + (t) => { + ( + (t.playerX = e.playerX), + (t.playerY = e.playerY), + (t.playerRot = e.playerRot), + (t.crashed = e.crashed), + (t.paused = e.paused), + (t.playerScale = e.playerScale) + ) + } + ) + ]) + ]; } return [ - conditional( - () => e.theme == "classic" || e.theme == "infinite", - () => [], + ifConditional( + () => e.theme === "infinite", () => [ - playerTrailStrip.Single( - { - playerX: e.playerX, - playerY: e.playerY, - y: 90 / 8, - playerDir: e.playerDir, - crashed: e.crashed, - paused: e.paused, - skin: e.skin, - playerScaleOff: e.playerScale === 0.5, - }, - (t) => { - ((t.playerX = e.playerX), - (t.playerY = e.playerY), - (t.playerDir = e.playerDir), - (t.crashed = e.crashed), - (t.paused = e.paused), - (t.skin = e.skin)); - t.playerScaleOff = e.playerScale === 0.5; - t.playerSpeedMultiplier = e.playerSpeedMultiplier; - }, - ), - playerTrailStrip.Single( - { - playerX: e.playerX, - playerY: e.playerY, - y: 3.75, - playerDir: e.playerDir, - crashed: e.crashed, - paused: e.paused, - skin: e.skin, - }, - (t) => { - ((t.playerX = e.playerX), - (t.playerY = e.playerY), - (t.playerDir = e.playerDir), - (t.crashed = e.crashed), - (t.paused = e.paused), - (t.skin = e.skin)); - t.playerSpeedMultiplier = e.playerSpeedMultiplier; - }, - ), - playerTrailStrip.Single( - { - playerX: e.playerX, - playerY: e.playerY, - y: -3.75, - playerDir: e.playerDir, - crashed: e.crashed, - paused: e.paused, - skin: e.skin, - }, - (t) => { - ((t.playerX = e.playerX), - (t.playerY = e.playerY), - (t.playerDir = e.playerDir), - (t.crashed = e.crashed), - (t.paused = e.paused), - (t.skin = e.skin)); - t.playerSpeedMultiplier = e.playerSpeedMultiplier; - }, - ), - playerTrailStrip.Single( - { - playerX: e.playerX, - playerY: e.playerY, - y: -90 / 8, - playerDir: e.playerDir, - crashed: e.crashed, - paused: e.paused, - skin: e.skin, - playerScaleOff: e.playerScale === 0.5, - }, - (t) => { - ((t.playerX = e.playerX), - (t.playerY = e.playerY), - (t.playerDir = e.playerDir), - (t.crashed = e.crashed), - (t.paused = e.paused), - (t.skin = e.skin)); - t.playerScaleOff = e.playerScale === 0.5; - t.playerSpeedMultiplier = e.playerSpeedMultiplier; - }, - ), - ], - ), + onChange( + () => e.attempt, + () => [ + onChange( + () => e.touchingPortals, + () => [ + universalFlyingTrail.Single( + { + playerX: e.playerX, + playerY: e.playerY, + radius: 4 * e.playerScale, + offset: 10.5 * e.playerScale, + playerDir: e.playerDir, + paused: e.paused, + crashed: e.crashed, + trail: e.skin.trail, + frame: e.frame || 0, + touchingPortals: e.touchingPortals, + }, + (t) => { + ((t.radius = 4 * e.playerScale), + (t.offset = 10.5 * e.playerScale), + (t.playerX = e.playerX), + (t.playerY = e.playerY), + (t.playerDir = e.playerDir), + (t.paused = e.paused), + (t.crashed = e.crashed), + (t.trail = e.skin.trail), + (t.frame = e.frame || 0), + (t.touchingPortals = e.touchingPortals)); + }, + ), + universalFlyingTrail.Single( + { + playerX: e.playerX, + playerY: e.playerY, + radius: 4 * e.playerScale, + offset: -10.5 * e.playerScale, + playerDir: e.playerDir, + paused: e.paused, + crashed: e.crashed, + trail: e.skin.trail, + frame: e.frame || 0, + touchingPortals: e.touchingPortals, + }, + (t) => { + ((t.radius = 4 * e.playerScale), + (t.offset = -10.5 * e.playerScale), + (t.playerX = e.playerX), + (t.playerY = e.playerY), + (t.playerDir = e.playerDir), + (t.paused = e.paused), + (t.crashed = e.crashed), + (t.trail = e.skin.trail), + (t.frame = e.frame || 0), + (t.touchingPortals = e.touchingPortals)); + }, + ), + ], + ), + ], + )]), ]; - }, - }), - playerTrailSquares = makeSprite({ - init: ({props}) => ({ - path: Array.from( - { length: 6 }, - () => ({x: e.playerX, y: e.playerY, rot: e.playerRot, scale: e.playerScale, opacity: 1}) - ), - frame: 0 - }), - loop({state, props: e}) { - if (e.paused) { - return void 0; - } - state.path.forEach((e) => { - e.opacity -= 0.1; - e.justAdded = false; - }) - state.frame++; - if (state.frame % 5 > 0) { - return void 0; - } - state.path.shift(); - if (!e.crashed) { - state.path.push( - { - x: e.playerX, - y: e.playerY, - rot: e.playerRot, - scale: e.playerScale, - opacity: 1.1, - justAdded: true - } - ) - } - }, - render: ({state, props, getContext: a}) => [ - ifConditional( - () => !a(Se).settings.hidePlayerTrail, + } + return [ + conditional( + () => e.theme == "classic" || e.theme == "infinite", + () => [], () => [ - g({ - props: () => ({ - color: "black" - }), update: (t, a, i) => { - t.show = !a.justAdded; - t.opacity = a.opacity; - t.x = a.x; - t.y = a.y; - t.rotation = a.rot; - t.width = a.scale * 30; + playerTrailStrip.Single( + { + playerX: e.playerX, + playerY: e.playerY, + y: 90 / 8, + playerDir: e.playerDir, + crashed: e.crashed, + paused: e.paused, + skin: e.skin, + playerScaleOff: e.playerScale === 0.5, + }, + (t) => { + ((t.playerX = e.playerX), + (t.playerY = e.playerY), + (t.playerDir = e.playerDir), + (t.crashed = e.crashed), + (t.paused = e.paused), + (t.skin = e.skin)); + t.playerScaleOff = e.playerScale === 0.5; + t.playerSpeedMultiplier = e.playerSpeedMultiplier; + }, + ), + playerTrailStrip.Single( + { + playerX: e.playerX, + playerY: e.playerY, + y: 3.75, + playerDir: e.playerDir, + crashed: e.crashed, + paused: e.paused, + skin: e.skin, + }, + (t) => { + ((t.playerX = e.playerX), + (t.playerY = e.playerY), + (t.playerDir = e.playerDir), + (t.crashed = e.crashed), + (t.paused = e.paused), + (t.skin = e.skin)); + t.playerSpeedMultiplier = e.playerSpeedMultiplier; + }, + ), + playerTrailStrip.Single( + { + playerX: e.playerX, + playerY: e.playerY, + y: -3.75, + playerDir: e.playerDir, + crashed: e.crashed, + paused: e.paused, + skin: e.skin, + }, + (t) => { + ((t.playerX = e.playerX), + (t.playerY = e.playerY), + (t.playerDir = e.playerDir), + (t.crashed = e.crashed), + (t.paused = e.paused), + (t.skin = e.skin)); + t.playerSpeedMultiplier = e.playerSpeedMultiplier; + }, + ), + playerTrailStrip.Single( + { + playerX: e.playerX, + playerY: e.playerY, + y: -90 / 8, + playerDir: e.playerDir, + crashed: e.crashed, + paused: e.paused, + skin: e.skin, + playerScaleOff: e.playerScale === 0.5, + }, + (t) => { + ((t.playerX = e.playerX), + (t.playerY = e.playerY), + (t.playerDir = e.playerDir), + (t.crashed = e.crashed), + (t.paused = e.paused), + (t.skin = e.skin)); + t.playerScaleOff = e.playerScale === 0.5; + t.playerSpeedMultiplier = e.playerSpeedMultiplier; + }, + ), + ], + ), + ]; + }, + }), + playerTrailSquares = makeSprite({ + init: ({ props }) => ({ + path: Array.from( + { length: 6 }, + () => ({ x: e.playerX, y: e.playerY, rot: e.playerRot, scale: e.playerScale, opacity: 1 }) + ), + frame: 0 + }), + loop({ state, props: e }) { + if (e.paused) { + return void 0; + } + state.path.forEach((e) => { + e.opacity -= 0.1; + e.justAdded = false; + }) + state.frame++; + if (state.frame % 5 > 0) { + return void 0; + } + state.path.shift(); + if (!e.crashed) { + state.path.push( + { + x: e.playerX, + y: e.playerY, + rot: e.playerRot, + scale: e.playerScale, + opacity: 1.1, + justAdded: true + } + ) + } + }, + render: ({ state, props, getContext: a }) => [ + ifConditional( + () => !a(Se).settings.hidePlayerTrail, + () => [ + g({ + props: () => ({ + color: "black" + }), update: (t, a, i) => { + t.show = !a.justAdded; + t.opacity = a.opacity; + t.x = a.x; + t.y = a.y; + t.rotation = a.rot; + t.width = a.scale * 30; t.height = a.scale * 30; }, array: () => state.path }) ]) - ] + ] + }), + playerTrailStrip = makeSprite({ + init: ({ props: e, device: t }) => ({ + followY: e.playerY, + width: 1, + widthDir: -0.01 - 0.04 * t.random(), + offsetX: -30 * t.random(), + offsetXDir: -0.5 - 1.5 * t.random(), + offsetY: 3.75 * t.random() * 2 - 3.75, + offsetYDir: -0.005 - 0.005 * t.random(), + bottomPath: Array.from( + { length: e.playerScaleOff ? 0 : eg }, + () => [e.playerX, e.playerY], + ), + middlePath: Array.from( + { length: e.playerScaleOff ? 0 : 6 }, + () => [e.playerX, e.playerY], + ), + topPath: Array.from({ length: e.playerScaleOff ? 0 : 2 }, () => [ + e.playerX, + e.playerY, + ]), + bottomWidth: eg, }), - playerTrailStrip = makeSprite({ - init: ({ props: e, device: t }) => ({ - followY: e.playerY, - width: 1, - widthDir: -0.01 - 0.04 * t.random(), - offsetX: -30 * t.random(), - offsetXDir: -0.5 - 1.5 * t.random(), - offsetY: 3.75 * t.random() * 2 - 3.75, - offsetYDir: -0.005 - 0.005 * t.random(), - bottomPath: Array.from( - { length: e.playerScaleOff ? 0 : eg }, - () => [e.playerX, e.playerY], - ), - middlePath: Array.from( - { length: e.playerScaleOff ? 0 : 6 }, - () => [e.playerX, e.playerY], - ), - topPath: Array.from({ length: e.playerScaleOff ? 0 : 2 }, () => [ - e.playerX, - e.playerY, - ]), - bottomWidth: eg, - }), - loop({ state: e, props: t, device: a }) { - if (t.paused) return; - if (t.crashed || t.playerScaleOff) - return ( - e.bottomPath.shift(), - e.middlePath.shift(), - void e.topPath.shift() - ); - if (t.playerScaleOff) { - return ( - e.bottomPath.pop(), - e.middlePath.pop(), - void e.topPath.pop() - ); - } - ((e.followY = B.clamp2( - t.playerY - 15, - t.playerY + 15, - e.followY + (t.playerY - e.followY) / 4, - )), - (e.width += e.widthDir), - e.width < 0.9 - ? ((e.width = 0.9), (e.widthDir = 0.01 + 0.04 * a.random())) - : e.width > 1.5 && - ((e.width = 1.5), (e.widthDir = -0.01 - 0.04 * a.random())), - (e.offsetX += e.offsetXDir), - e.offsetX < -30 - ? ((e.offsetX = -30), (e.offsetXDir = 0.5 + 1.5 * a.random())) - : e.offsetX > 0 && - ((e.offsetX = 0), (e.offsetXDir = -0.5 - 1.5 * a.random())), - (e.offsetY += e.offsetYDir), - e.offsetY < -3.75 - ? ((e.offsetY = -3.75), - (e.offsetYDir = 0.005 + 0.005 * a.random())) - : e.offsetY > 3.75 && - ((e.offsetY = 3.75), - (e.offsetYDir = -0.005 - 0.005 * a.random()))); - const i = - t.playerX + - t.playerDir * (e.offsetX - 7.5 * globalPlayerScale), - n = e.followY, - s = Math.ceil(eg * e.width), - o = - e.bottomPath.length > 0 && - e.bottomPath[e.bottomPath.length - 1], - fullTopPath = - e.topPath.length > 0 && e.topPath[e.topPath.length - 1]; - if (s >= e.bottomWidth) { - const t = e.bottomPath.shift(); - t && - ((t[0] = i), + loop({ state: e, props: t, device: a }) { + if (t.paused) return; + if (t.crashed || t.playerScaleOff) + return ( + e.bottomPath.shift(), + e.middlePath.shift(), + void e.topPath.shift() + ); + if (t.playerScaleOff) { + return ( + e.bottomPath.pop(), + e.middlePath.pop(), + void e.topPath.pop() + ); + } + ((e.followY = B.clamp2( + t.playerY - 15, + t.playerY + 15, + e.followY + (t.playerY - e.followY) / 4, + )), + (e.width += e.widthDir), + e.width < 0.9 + ? ((e.width = 0.9), (e.widthDir = 0.01 + 0.04 * a.random())) + : e.width > 1.5 && + ((e.width = 1.5), (e.widthDir = -0.01 - 0.04 * a.random())), + (e.offsetX += e.offsetXDir), + e.offsetX < -30 + ? ((e.offsetX = -30), (e.offsetXDir = 0.5 + 1.5 * a.random())) + : e.offsetX > 0 && + ((e.offsetX = 0), (e.offsetXDir = -0.5 - 1.5 * a.random())), + (e.offsetY += e.offsetYDir), + e.offsetY < -3.75 + ? ((e.offsetY = -3.75), + (e.offsetYDir = 0.005 + 0.005 * a.random())) + : e.offsetY > 3.75 && + ((e.offsetY = 3.75), + (e.offsetYDir = -0.005 - 0.005 * a.random()))); + const i = + t.playerX + + t.playerDir * (e.offsetX - 7.5 * globalPlayerScale), + n = e.followY, + s = Math.ceil(eg * e.width), + o = + e.bottomPath.length > 0 && + e.bottomPath[e.bottomPath.length - 1], + fullTopPath = + e.topPath.length > 0 && e.topPath[e.topPath.length - 1]; + if (s >= e.bottomWidth) { + const t = e.bottomPath.shift(); + t && + ((t[0] = i), (t[1] = n), e.bottomPath.push(t), (e.bottomWidth = Math.min(eg, e.bottomWidth + 1))); - } else e.bottomWidth--; - const r = e.middlePath.shift(); - r && ((r[0] = i), (r[1] = n), e.middlePath.push(r)); - const l = e.topPath.shift(); - (l && ((l[0] = i), (l[1] = n), e.topPath.push(l)), - (!o || - !fullTopPath || - Math.abs(i - o[0]) > 60 * t.playerSpeedMultiplier || - Math.abs(n - o[1]) > 60) && - ((e.bottomPath = Array.from({ length: eg }, () => [ - t.playerX, - t.playerY, - ])), - (e.middlePath = Array.from({ length: 6 }, () => [ - t.playerX, - t.playerY, - ])), - (e.topPath = Array.from({ length: 2 }, () => [ - t.playerX, - t.playerY, - ])))); - }, - render: ({ state: e, props: t, getContext: a }) => [ - ifConditional( - () => !a(Se).settings.hidePlayerTrail, - () => [ - onChange( - () => t.skin.fileName, - () => [ - conditional( - () => "pixel" === t.skin.trail.form, - () => [ - g({ - props: () => ({ - color: t.skin.trail.bottomColour, - opacity: 0.7, - width: 6, - height: 6, - }), - update: (k, [a, i]) => { - ((k.x = a), (k.y = i + e.offsetY)); - k.color = t.skin.trail.bottomColour; - }, - array: () => e.bottomPath, + } else e.bottomWidth--; + const r = e.middlePath.shift(); + r && ((r[0] = i), (r[1] = n), e.middlePath.push(r)); + const l = e.topPath.shift(); + (l && ((l[0] = i), (l[1] = n), e.topPath.push(l)), + (!o || + !fullTopPath || + Math.abs(i - o[0]) > 60 * t.playerSpeedMultiplier || + Math.abs(n - o[1]) > 60) && + ((e.bottomPath = Array.from({ length: eg }, () => [ + t.playerX, + t.playerY, + ])), + (e.middlePath = Array.from({ length: 6 }, () => [ + t.playerX, + t.playerY, + ])), + (e.topPath = Array.from({ length: 2 }, () => [ + t.playerX, + t.playerY, + ])))); + }, + render: ({ state: e, props: t, getContext: a }) => [ + ifConditional( + () => !a(Se).settings.hidePlayerTrail, + () => [ + onChange( + () => t.skin.fileName, + () => [ + conditional( + () => "pixel" === t.skin.trail.form, + () => [ + g({ + props: () => ({ + color: t.skin.trail.bottomColour, + opacity: 0.7, + width: 6, + height: 6, }), - g({ - props: () => ({ - color: t.skin.trail.topColour, - opacity: 0.7, - width: 6, - height: 6, - }), - update: (k, [a, i]) => { - ((k.x = a), (k.y = i + e.offsetY)); - k.color = t.skin.trail.topColour; - }, - array: () => e.middlePath, + update: (k, [a, i]) => { + ((k.x = a), (k.y = i + e.offsetY)); + k.color = t.skin.trail.bottomColour; + }, + array: () => e.bottomPath, + }), + g({ + props: () => ({ + color: t.skin.trail.topColour, + opacity: 0.7, + width: 6, + height: 6, }), - g({ - props: () => ({ - color: t.skin.trail.topColour, - opacity: 0.9, - width: 6, - height: 6, - }), - update: (k, [a, i]) => { - ((k.x = a), (k.y = i + e.offsetY)); - k.color = t.skin.trail.topColour; - }, - array: () => e.topPath, + update: (k, [a, i]) => { + ((k.x = a), (k.y = i + e.offsetY)); + k.color = t.skin.trail.topColour; + }, + array: () => e.middlePath, + }), + g({ + props: () => ({ + color: t.skin.trail.topColour, + opacity: 0.9, + width: 6, + height: 6, }), - ], - () => [ - m( - { - color: t.skin.trail.bottomColour, - opacity: 0.7, - thickness: 6, - path: e.bottomPath, - lineCap: "round", - y: e.offsetY, - }, - (k) => { - ((k.path = e.bottomPath), (k.y = e.offsetY)); - k.color = t.skin.trail.bottomColour; - }, - ), - m( - { - color: t.skin.trail.topColour, - opacity: 0.7, - thickness: 6, - path: e.middlePath, - lineCap: "round", - y: e.offsetY, - }, - (k) => { - ((k.path = e.middlePath), (k.y = e.offsetY)); - k.color = t.skin.trail.topColour; - }, - ), - m( - { - color: t.skin.trail.topColour, - opacity: 0.9, - thickness: 6, - path: e.topPath, - lineCap: "round", - y: e.offsetY, - }, - (k) => { - ((k.path = e.topPath), (k.y = e.offsetY)); - k.color = t.skin.trail.topColour; - }, - ), - ], - ), - ], - ), - ], - ), - ], + update: (k, [a, i]) => { + ((k.x = a), (k.y = i + e.offsetY)); + k.color = t.skin.trail.topColour; + }, + array: () => e.topPath, + }), + ], + () => [ + m( + { + color: t.skin.trail.bottomColour, + opacity: 0.7, + thickness: 6, + path: e.bottomPath, + lineCap: "round", + y: e.offsetY, + }, + (k) => { + ((k.path = e.bottomPath), (k.y = e.offsetY)); + k.color = t.skin.trail.bottomColour; + }, + ), + m( + { + color: t.skin.trail.topColour, + opacity: 0.7, + thickness: 6, + path: e.middlePath, + lineCap: "round", + y: e.offsetY, + }, + (k) => { + ((k.path = e.middlePath), (k.y = e.offsetY)); + k.color = t.skin.trail.topColour; + }, + ), + m( + { + color: t.skin.trail.topColour, + opacity: 0.9, + thickness: 6, + path: e.topPath, + lineCap: "round", + y: e.offsetY, + }, + (k) => { + ((k.path = e.topPath), (k.y = e.offsetY)); + k.color = t.skin.trail.topColour; + }, + ), + ], + ), + ], + ), + ], + ), + ], + }), + flyingTrail = makeSprite({ + init: ({ props: e }) => ({ + path: Array.from({ length: eg }, () => ({ + x: 40, + topY: e.playerY + 8, + bottomY: e.playerY - 8, + })), + renderPath: Array.from({ length: 24 }, () => [0, 0]), }), - flyingTrail = makeSprite({ - init: ({ props: e }) => ({ - path: Array.from({ length: eg }, () => ({ - x: 40, - topY: e.playerY + 8, - bottomY: e.playerY - 8, - })), - renderPath: Array.from({ length: 24 }, () => [0, 0]), - }), - loop({ state: e, props: t }) { - if (!t.paused) { - e.path.shift(); - for (let i = 0; i < e.path.length; i++) - e.path[i].x -= 10 * t.playerDir * t.df; - (t.crashed || - e.path.push({ - x: 40 * t.playerDir, - topY: t.playerY + 8, - bottomY: t.playerY - 8, - }), - (function (renderPath, path) { - let topPart = path.map((point) => [point.x, point.topY]), + loop({ state: e, props: t }) { + if (!t.paused) { + e.path.shift(); + for (let i = 0; i < e.path.length; i++) + e.path[i].x -= 10 * t.playerDir * t.df; + (t.crashed || + e.path.push({ + x: 40 * t.playerDir, + topY: t.playerY + 8, + bottomY: t.playerY - 8, + }), + (function (renderPath, path) { + let topPart = path.map((point) => [point.x, point.topY]), bottomPart = path.map((point) => [point.x, point.bottomY]).reverse(); - e.renderPath = [...topPart, ...bottomPart]; - for (let a = 0; a < Math.ceil(path.length / 2); a++) { - e.renderPath.push(e.renderPath[0]); - e.renderPath.shift(); - } - return; - const pathLength = path.length, - halfPathLength = Math.ceil(pathLength / 2), - twicePathLength = 2 * pathLength, - anotherTwicePathLength = twicePathLength, - o = anotherTwicePathLength - renderPath.length; - if (o > 0) - for (let t = 0; t < o; t++) renderPath.push([0, 0]); - else o < 0 && (renderPath.length = anotherTwicePathLength); - for (let a = 0; a < path.length; a++) { - const { - x: pointX, - topY: topY, - bottomY: bottomY, - } = path[a]; - if (a < halfPathLength) { - const t = twicePathLength - halfPathLength + a; - ((renderPath[t][0] = pointX), - (renderPath[t][1] = topY)); - } else { - const t = a - halfPathLength; - ((renderPath[t][0] = pointX), - (renderPath[t][1] = topY)); - } - const l = twicePathLength - 1 - halfPathLength - a; - ((renderPath[l][0] = pointX), - (renderPath[l][1] = bottomY)); + e.renderPath = [...topPart, ...bottomPart]; + for (let a = 0; a < Math.ceil(path.length / 2); a++) { + e.renderPath.push(e.renderPath[0]); + e.renderPath.shift(); + } + return; + const pathLength = path.length, + halfPathLength = Math.ceil(pathLength / 2), + twicePathLength = 2 * pathLength, + anotherTwicePathLength = twicePathLength, + o = anotherTwicePathLength - renderPath.length; + if (o > 0) + for (let t = 0; t < o; t++) renderPath.push([0, 0]); + else o < 0 && (renderPath.length = anotherTwicePathLength); + for (let a = 0; a < path.length; a++) { + const { + x: pointX, + topY: topY, + bottomY: bottomY, + } = path[a]; + if (a < halfPathLength) { + const t = twicePathLength - halfPathLength + a; + ((renderPath[t][0] = pointX), + (renderPath[t][1] = topY)); + } else { + const t = a - halfPathLength; + ((renderPath[t][0] = pointX), + (renderPath[t][1] = topY)); } - })(e.renderPath, e.path)); - } - }, - render: ({ props: e, state: t, getContext: a }) => [ - ifConditional( - () => { - try { - return !a(Se).settings.hidePlayerTrail - } catch (e) { - return true + const l = twicePathLength - 1 - halfPathLength - a; + ((renderPath[l][0] = pointX), + (renderPath[l][1] = bottomY)); } - }, - () => [ - m( - { - fillGradient: { - type: "linearHoriz", - width: 80 * e.df, - colors: [e.colour, e.colour], - opacities: [ - e.playerDir > 0 ? 0 : 1, - e.playerDir > 0 ? 1 : 0, - ], - }, - y: -5, - }, - (a) => { - ((a.fillGradient.width = 80 * e.df), - (a.path = t.renderPath), - (a.x = e.playerX - 40 * e.playerDir), - (a.fillGradient.opacities = [ - e.playerDir > 0 ? 0 : 1, - e.playerDir > 0 ? 1 : 0, - ])); + })(e.renderPath, e.path)); + } + }, + render: ({ props: e, state: t, getContext: a }) => [ + ifConditional( + () => { + try { + return !a(Se).settings.hidePlayerTrail + } catch (e) { + return true + } + }, + () => [ + m( + { + fillGradient: { + type: "linearHoriz", + width: 80 * e.df, + colors: [e.colour, e.colour], + opacities: [ + e.playerDir > 0 ? 0 : 1, + e.playerDir > 0 ? 1 : 0, + ], }, - ), - ], - ), - ], + y: -5, + }, + (a) => { + ((a.fillGradient.width = 80 * e.df), + (a.path = t.renderPath), + (a.x = e.playerX - 40 * e.playerDir), + (a.fillGradient.opacities = [ + e.playerDir > 0 ? 0 : 1, + e.playerDir > 0 ? 1 : 0, + ])); + }, + ), + ], + ), + ], + }), + universalFlyingTrail = makeSprite({ + init: ({ props: e }) => ({ + path: Array.from({ length: eg + 6 + 2 }, () => ({ + x: e.playerX, // 40, + y: e.playerY + (e.offset || 0), + })), + renderPath: Array.from({ length: eg + 6 + 2 }, () => [0, 0]), + lastPlayerX: e.playerX, + width: 0, + // 20.454545454545453 is Sky Fracture's jump frames + // props.jumpFrames / 0.511363636 + space: 40, }), - universalFlyingTrail = makeSprite({ - init: ({ props: e }) => ({ - path: Array.from({ length: eg + 6 + 2 }, () => ({ - x: e.playerX, // 40, - y: e.playerY + (e.offset || 0), - })), - renderPath: Array.from({ length: eg + 6 + 2 }, () => [0, 0]), - lastPlayerX: e.playerX, - width: 0, - // 20.454545454545453 is Sky Fracture's jump frames - // props.jumpFrames / 0.511363636 - space: 40, - }), - loop({ state: e, props: props }) { - let calculatedX = e.path.map((part) => part.x), - width = - e.path.length === 0 - ? 0 - : Math.abs(0 - Math.min(...calculatedX)); - if ( - props.touchingPortals && - Math.abs(props.playerX - e.lastPlayerX) / 0.16125 > 5 - ) { - e.lastPlayerX = props.playerX; - } - - if (!props.paused) { - if (!props.crashed) { - e.space = - Math.abs(props.playerX - e.lastPlayerX) / 0.16125 || 0; - e.width = width; - } - e.path.shift(); + loop({ state: e, props: props }) { + let calculatedX = e.path.map((part) => part.x), + width = + e.path.length === 0 + ? 0 + : Math.abs(0 - Math.min(...calculatedX)); + if ( + props.touchingPortals && + Math.abs(props.playerX - e.lastPlayerX) / 0.16125 > 5 + ) { + e.lastPlayerX = props.playerX; + } - // for (let t = 0; t < e.path.length; t++) e.path[t].x -= Math.abs(props.playerX - e.lastPlayerX); + if (!props.paused) { + if (!props.crashed) { + e.space = + Math.abs(props.playerX - e.lastPlayerX) / 0.16125 || 0; + e.width = width; + } + e.path.shift(); - if (!props.crashed) { - e.path.push({ - x: props.playerX, //e.space, - y: props.playerY + (props.offset || 0), - radius: props.radius, - }); - } + // for (let t = 0; t < e.path.length; t++) e.path[t].x -= Math.abs(props.playerX - e.lastPlayerX); - e.lastPlayerX = props.playerX; + if (!props.crashed) { + e.path.push({ + x: props.playerX, //e.space, + y: props.playerY + (props.offset || 0), + radius: props.radius, + }); } - }, - render: ({ props: e, state: t, getContext: a }) => { - return [ - ifConditional( - () => - !a(Se).settings.hidePlayerTrail, - () => [ - f({ - props: () => ({ - thickness: e.radius * 2, - color: e.trail.topColour, - opacity: 1, - lineCap: "butt", - path: [ - [-15, -15], - [0, 15], - [15, -15], - ], - }), - update: (a, n, index) => { - ((a.thickness = n.radius * 2), - (a.x = 0), - (a.color = e.trail.topColour), - (a.path = t.path[index + 1] - ? [ - [n.x, n.y], - [t.path[index + 1].x, t.path[index + 1].y], - ] - : [ - [n.x, n.y], - [n.x, n.y], - ]), - (a.opacity = index / t.path.length)); - }, - array: () => t.path, + + e.lastPlayerX = props.playerX; + } + }, + render: ({ props: e, state: t, getContext: a }) => { + return [ + ifConditional( + () => + !a(Se).settings.hidePlayerTrail, + () => [ + f({ + props: () => ({ + thickness: e.radius * 2, + color: e.trail.topColour, + opacity: 1, + lineCap: "butt", + path: [ + [-15, -15], + [0, 15], + [15, -15], + ], }), - ], - ), - ]; - }, - }), - ng = makeSprite({ - render: ({ props: e, device: t }) => [ - imageArray({ - fileName: "images/online/name-arrow.png", - props: () => ({ width: 13, height: 8 }), - update: (a, i) => { - const n = et.initialPosition.x + i.x - e.playerX, - s = i.y - e.cameraY; - ((a.x = B.clamp2( - -t.size.fullWidth / 2 + 100, - t.size.fullWidth / 2 - 100, - n, + update: (a, n, index) => { + ((a.thickness = n.radius * 2), + (a.x = 0), + (a.color = e.trail.topColour), + (a.path = t.path[index + 1] + ? [ + [n.x, n.y], + [t.path[index + 1].x, t.path[index + 1].y], + ] + : [ + [n.x, n.y], + [n.x, n.y], + ]), + (a.opacity = index / t.path.length)); + }, + array: () => t.path, + }), + ], + ), + ]; + }, + }), + ng = makeSprite({ + render: ({ props: e, device: t }) => [ + imageArray({ + fileName: "images/online/name-arrow.png", + props: () => ({ width: 13, height: 8 }), + update: (a, i) => { + const n = et.initialPosition.x + i.x - e.playerX, + s = i.y - e.cameraY; + ((a.x = B.clamp2( + -t.size.fullWidth / 2 + 100, + t.size.fullWidth / 2 - 100, + n, + )), + (a.y = B.clamp2( + -t.size.fullHeight / 2 + 20, + t.size.fullHeight / 2 - 20, + s, )), - (a.y = B.clamp2( - -t.size.fullHeight / 2 + 20, - t.size.fullHeight / 2 - 20, - s, - )), - (a.rotation = - B.toDeg(Math.atan2(i.x - e.playerX, i.y - e.cameraY)) - - 180)); - }, - array: () => e.info.offCamera, - }), - d({ - props: () => ({ color: ve, font: { size: 15 } }), - update: (a, { x: i, y: n, username: s }) => { - const o = et.initialPosition.x + i - e.playerX, - r = n - e.cameraY + 10, - l = B.clamp2( - -t.size.fullWidth / 2 + 140, - t.size.fullWidth / 2 - 140, - o, - ), - c = B.clamp2( - -t.size.fullHeight / 2 + 30, - t.size.fullHeight / 2 - 10, - r, - ); - ((a.x = l), (a.y = c), (a.text = s)); - }, - array: () => e.info.offCamera, - }), - d({ - props: () => ({ color: ve, font: { size: 15 } }), - update: (a, { x: i, y: n }) => { - const s = Math.round( - Math.hypot(i - e.playerX, n - e.playerY) / 100, - ), - o = et.initialPosition.x + i - e.playerX, - r = n - e.cameraY - 10, - l = B.clamp2( - -t.size.fullWidth / 2 + 140, - t.size.fullWidth / 2 - 140, - o, - ), - c = B.clamp2( - -t.size.fullHeight / 2 + 10, - t.size.fullHeight / 2 - 30, - r, - ); - ((a.x = l), (a.y = c), (a.text = `${s}m`)); - }, - array: () => e.info.offCamera, - }), - ], - }), - sg = makeSprite({ - init: ({ props: e }) => ({ fade: 0, text: e.text }), - loop({ props: e, state: t }) { - if (e.text !== t.text) { - if (t.fade > 0) return void t.fade--; - ((t.fade = 0), (t.text = e.text)); - } else t.fade < 30 && t.fade++; - }, - render: ({ state: e }) => [ - c({ font: { size: 20 }, color: "white" }, (t) => { - ((t.text = e.text), (t.opacity = e.fade / 30)); - }), - ], - }), - og = makeCustomSprite({ - init: ({ props: e }) => ({ fade: 0, text: e.text, timer: 0 }), - loop: ({ state: e, props: t }) => - e.timer > t.showTime - ? e.fade > 0 - ? Object.assign(Object.assign({}, e), { fade: e.fade - 1 }) - : Object.assign(Object.assign({}, e), { fade: 0 }) - : e.fade < 30 && e.timer > t.delay - ? Object.assign(Object.assign({}, e), { fade: e.fade + 1 }) - : Object.assign(Object.assign({}, e), { timer: e.timer + 1 }), - render: ({ state: e }) => [ - n({ - font: { size: 20 }, - text: e.text, - color: "white", - opacity: e.fade / 30, - }), - ], - }), - rg = makeSprite({ - init({ - device: { random: e }, - props: { element: t, halfDeviceWidth: a, halfDeviceHeight: i }, - }) { - const n = 300 / i; - let s = ot(e); - const o = []; - let r = -a + (t.initXOffset || st(0, t.xRangeMin * n, e)); - for (; r < a + t.width; ) - (o.push({ x: r, y: lg(t, i, s, e) }), - (s *= -1), - (r += st(t.xRangeMin * n, t.xRangeMax * n, e))); - return { images: o, alternatingSign: s, spinDir: ot(e) }; - }, - loop({ state: e, props: t, device: a }) { - const i = t.halfDeviceWidth + (1.4 * t.element.width) / 2, - n = -i, - s = t.halfDeviceHeight + (1.4 * t.element.height) / 2, - o = -s; - for (const r of e.images) { - const l = r.x - t.moveX, - c = n - l; - if (c > 10) { - ((e.alternatingSign = -e.alternatingSign), - (r.x = i + t.moveX + 10 - c), - (r.y = lg( - t.element, - t.halfDeviceHeight, - e.alternatingSign, - a.random, - ))); + (a.rotation = + B.toDeg(Math.atan2(i.x - e.playerX, i.y - e.cameraY)) - + 180)); + }, + array: () => e.info.offCamera, + }), + d({ + props: () => ({ color: ve, font: { size: 15 } }), + update: (a, { x: i, y: n, username: s }) => { + const o = et.initialPosition.x + i - e.playerX, + r = n - e.cameraY + 10, + l = B.clamp2( + -t.size.fullWidth / 2 + 140, + t.size.fullWidth / 2 - 140, + o, + ), + c = B.clamp2( + -t.size.fullHeight / 2 + 30, + t.size.fullHeight / 2 - 10, + r, + ); + ((a.x = l), (a.y = c), (a.text = s)); + }, + array: () => e.info.offCamera, + }), + d({ + props: () => ({ color: ve, font: { size: 15 } }), + update: (a, { x: i, y: n }) => { + const s = Math.round( + Math.hypot(i - e.playerX, n - e.playerY) / 100, + ), + o = et.initialPosition.x + i - e.playerX, + r = n - e.cameraY - 10, + l = B.clamp2( + -t.size.fullWidth / 2 + 140, + t.size.fullWidth / 2 - 140, + o, + ), + c = B.clamp2( + -t.size.fullHeight / 2 + 10, + t.size.fullHeight / 2 - 30, + r, + ); + ((a.x = l), (a.y = c), (a.text = `${s}m`)); + }, + array: () => e.info.offCamera, + }), + ], + }), + sg = makeSprite({ + init: ({ props: e }) => ({ fade: 0, text: e.text }), + loop({ props: e, state: t }) { + if (e.text !== t.text) { + if (t.fade > 0) return void t.fade--; + ((t.fade = 0), (t.text = e.text)); + } else t.fade < 30 && t.fade++; + }, + render: ({ state: e }) => [ + c({ font: { size: 20 }, color: "white" }, (t) => { + ((t.text = e.text), (t.opacity = e.fade / 30)); + }), + ], + }), + og = makeCustomSprite({ + init: ({ props: e }) => ({ fade: 0, text: e.text, timer: 0 }), + loop: ({ state: e, props: t }) => + e.timer > t.showTime + ? e.fade > 0 + ? Object.assign(Object.assign({}, e), { fade: e.fade - 1 }) + : Object.assign(Object.assign({}, e), { fade: 0 }) + : e.fade < 30 && e.timer > t.delay + ? Object.assign(Object.assign({}, e), { fade: e.fade + 1 }) + : Object.assign(Object.assign({}, e), { timer: e.timer + 1 }), + render: ({ state: e }) => [ + n({ + font: { size: 20 }, + text: e.text, + color: "white", + opacity: e.fade / 30, + }), + ], + }), + rg = makeSprite({ + init({ + device: { random: e }, + props: { element: t, halfDeviceWidth: a, halfDeviceHeight: i }, + }) { + const n = 300 / i; + let s = ot(e); + const o = []; + let r = -a + (t.initXOffset || st(0, t.xRangeMin * n, e)); + for (; r < a + t.width;) + (o.push({ x: r, y: lg(t, i, s, e) }), + (s *= -1), + (r += st(t.xRangeMin * n, t.xRangeMax * n, e))); + return { images: o, alternatingSign: s, spinDir: ot(e) }; + }, + loop({ state: e, props: t, device: a }) { + const i = t.halfDeviceWidth + (1.4 * t.element.width) / 2, + n = -i, + s = t.halfDeviceHeight + (1.4 * t.element.height) / 2, + o = -s; + for (const r of e.images) { + const l = r.x - t.moveX, + c = n - l; + if (c > 10) { + ((e.alternatingSign = -e.alternatingSign), + (r.x = i + t.moveX + 10 - c), + (r.y = lg( + t.element, + t.halfDeviceHeight, + e.alternatingSign, + a.random, + ))); + continue; + } + const d = l - i; + if (d > 10) + ((e.alternatingSign = -e.alternatingSign), + (r.x = n + t.moveX - (10 - d)), + (r.y = lg( + t.element, + t.halfDeviceHeight, + e.alternatingSign, + a.random, + ))); + else if (!t.element.dontMoveY) { + const e = r.y - t.moveY, + a = o - e; + if (a > 10) { + r.y = s + t.moveY + 10 - a; continue; } - const d = l - i; - if (d > 10) - ((e.alternatingSign = -e.alternatingSign), - (r.x = n + t.moveX - (10 - d)), - (r.y = lg( - t.element, - t.halfDeviceHeight, - e.alternatingSign, - a.random, - ))); - else if (!t.element.dontMoveY) { - const e = r.y - t.moveY, - a = o - e; - if (a > 10) { - r.y = s + t.moveY + 10 - a; - continue; - } - const i = e - s; - if (i > 10) { - r.y = o + t.moveY - (10 - i); - continue; - } + const i = e - s; + if (i > 10) { + r.y = o + t.moveY - (10 - i); + continue; } } - }, - render: ({ props: e, state: t }) => [ - imageArray({ - fileName: e.element.fileName, - props: () => ({ - width: e.element.width, - height: e.element.height, - opacity: e.element.opacity, - }), - update: (a, i) => { - ((a.x = i.x - e.moveX), - (a.y = e.element.dontMoveY ? i.y : i.y - e.moveY), - e.element.spinning && - (a.rotation = t.spinDir * (e.moveX % 360))); - }, - array: () => t.images, - }), - ], - }), - lg = (e, t, a, i) => { - const { yMin: n = 0, yMax: s = t, alternateY: o = true } = e; - if (s === n) return n; - const r = st(n, s, i); - return o ? a * r : r; + } }, - cg = 950, - dg = makeSprite({ - init: ({ props: { playerX: e } }) => - e < 0 - ? { startX1: e, startX2: e + cg } - : { startX1: e - cg, startX2: e }, - loop({ state: e, props: { playerX: t } }) { - (e.startX1 - t < -950 - ? (e.startX1 += 1900) - : e.startX1 - t > cg && (e.startX1 -= 1900), - e.startX2 - t < -950 - ? (e.startX2 += 1900) - : e.startX2 - t > cg && (e.startX2 -= 1900)); - }, - render: ({ props: e, state: t }) => [ - y({ fileName: e.fileName, width: cg, height: e.height }, (a) => { - a.x = t.startX1 - e.playerX; + render: ({ props: e, state: t }) => [ + imageArray({ + fileName: e.element.fileName, + props: () => ({ + width: e.element.width, + height: e.element.height, + opacity: e.element.opacity, }), - y({ fileName: e.fileName, width: cg, height: e.height }, (a) => { - a.x = t.startX2 - e.playerX; - }), - ], - }), - ug = makeSprite({ - render({ props: e, getContext: t }) { - switch (e.bossState.type) { - case "robot": - const { animationRenderer: a } = e.spineContext || t(Ws); - return [ - Vs( - { - id: "RobotBoss", - runtime: e.bossState.runtime, - animationRenderer: a, - }, - (t) => { - t.runtime = e.bossState.runtime; - }, - ), - ifConditional( - () => e.bossState.debug.length > 0, - () => [ - m( - { path: e.bossState.debug, color: "#FF0000" }, - (t) => { - t.path = e.bossState.debug; - }, - ), - ], - ), - ]; - case "pixel": - const i = 338, - n = 285; - return [ - bossButtonSprite.Array({ - props: (e) => ({ button: e }), - update: (e, t) => { - ((e.button = t), - (e.x = t.x), - (e.y = t.y), - (e.df = t.df)); - }, - array: () => e.bossState.allButtons, - key: (e, t) => t, - }), - onChange( - () => e.bossState.view, - () => { - const t = e.bossState, - health = t.health; - switch (t.view) { - case "idle": - return [ - loopingSpriteSheet.Single( - { - fileName: `images/level/boss2/idle/health${Math.ceil(health / 2)}.png`, - columns: 6, - rows: 2, - maxIndex: 10, - frameRate: 6, - width: i, - height: n, - frame: e.frame, - }, - (t) => { - const a = e.bossState; - ((t.x = a.bossX), - (t.y = a.bossY), - (t.frame = e.frame)); - }, - ), - ]; - case "gunOut": - return [ - triggerableSpriteSheet.Single( - { - fileName: `images/level/boss2/gunout/health${Math.ceil(health / 2)}.png`, - columns: 3, - rows: 2, - frameRate: 6, - width: i, - height: n, - paused: e.paused, - df: e.df, - }, - (t) => { - const a = e.bossState; - ((t.x = a.bossX), - (t.y = a.bossY), - (t.paused = e.paused), - (t.df = e.df)); - }, - ), - ]; - case "gunIn": - return [ - triggerableSpriteSheet.Single( - { - fileName: `images/level/boss2/gunin/health${Math.ceil(health / 2)}.png`, - columns: 2, - rows: 2, - frameRate: 6, - width: i, - height: n, - paused: e.paused, - df: e.df, - }, - (t) => { - const a = e.bossState; - ((t.x = a.bossX), - (t.y = a.bossY), - (t.paused = e.paused), - (t.df = e.df)); - }, - ), - ]; - case "gun": - const s = 6 === health || 8 === health ? 3 : 2, - o = 4 === health || 8 === health ? 2 : 1, - r = 6 * s * o - 1; - return [ - loopingSpriteSheet.Single( - { - fileName: `images/level/boss2/gunshot/health${Math.ceil(health / 2)}.png`, - columns: s, - rows: o, - frameRate: 6, - width: i, - height: n, - frame: r - t.isShootingFrames, - }, - (t) => { - const a = e.bossState; - ((t.x = a.bossX), - (t.y = a.bossY), - (t.frame = r - a.isShootingFrames)); - }, - ), - ]; - case "chargeLaser": - return [ - gg.Single( - { - bossWidth: i, - bossHeight: n, - health: health, - paused: e.paused, - frame: e.frame, - df: e.df, - }, - (t) => { - const a = e.bossState; - ((t.x = a.bossX), - (t.y = a.bossY), - (t.paused = e.paused), - (t.frame = e.frame), - (t.df = e.df)); - }, - ), - Ro.Single( - { - fileName: "audio/levels/boss2/laser.wav", - loop: false, - paused: e.paused, - fromPosition: 0, - isGameSfx: true, - df: e.df, - }, - (t) => { - ((t.paused = e.paused), (t.df = e.df)); - }, - ), - ]; - case "chargeLaserDamage": - return [ - triggerableSpriteSheet.Single( - { - fileName: `images/level/boss2/laserdamage/health${Math.ceil(health / 2)}.png`, - columns: 2, - rows: 2, - frameRate: 6, - width: i, - height: n, - paused: e.paused, - df: e.df, - }, - (t) => { - const a = e.bossState; - ((t.x = a.bossX), - (t.y = a.bossY), - (t.paused = e.paused), - (t.df = e.df)); - }, - ), - Ro.Single( - { - fileName: "audio/levels/boss2/damage.wav", - loop: false, - paused: e.paused, - fromPosition: 0, - isGameSfx: true, - df: e.df, - }, - (t) => { - ((t.paused = e.paused), (t.df = e.df)); - }, - ), - ]; - case "death": - return [ - mg.Single( - { - bossWidth: i, - bossHeight: n, - paused: e.paused, - df: e.df, - }, - (t) => { - const a = e.bossState; - ((t.x = a.bossX), - (t.y = a.bossY), - (t.paused = e.paused), - (t.df = e.df)); - }, - ), - Ro.Single( - { - fileName: "audio/levels/boss2/death.wav", - loop: false, - paused: e.paused, - fromPosition: 0, - isGameSfx: true, - df: e.df, - }, - (t) => { - ((t.paused = e.paused), (t.df = e.df)); - }, - ), - ]; - } - }, - ), - no.Array({ - props: (e) => ({ bullet: e }), - update: (a, t) => { - ((a.bullet = t), - (a.x = t.x), - (a.y = t.y), - (a.paused = e.paused), - (a.df = e.df)); - }, - array: () => e.bossState.bullets, - key: (e, t) => t, - }), - ]; - case "flying": { - const t = e.bossState; - return [ - yg.Array({ - props: (t) => ({ asteroid: t, frame: e.frame }), - update: (t, a) => { - ((t.asteroid = a), (t.frame = e.frame), (t.paused = e.paused), (t.df = e.df)); - }, - array: () => e.bossState.asteroids, - key: (e) => e.index, - }), - Eg.Array({ - props: (e) => ({ tile: e }), - update: (e, t) => { - e.tile = t; - }, - array: () => e.bossState.insideAsteroid, - key: (e) => e.index, - }), - imageArray({ - fileName: "images/level/boss3/bullet.png", - props: () => ({}), - update: (e, t) => { - ((e.x = t.x), - (e.y = t.y), - (e.width = t.width), - (e.height = t.height), - (e.scaleX = -Math.sign(t.speed)) - ); - }, - array: () => e.bossState.bullets, - }), - flyingTrail.Single( - { - playerX: t.bossX, - playerY: t.bossY, - playerDir: 1, - crashed: t.destroyed, - paused: e.paused, - frame: e.frame, - colour: "#C50202", - df: e.df, - }, - (t) => { - const a = e.bossState; - ((t.playerX = a.bossX), - (t.playerY = a.bossY), - (t.crashed = a.destroyed), - (t.paused = e.paused), - (t.frame = e.frame), - (t.df = e.df)); - }, - ), - conditional( - () => e.bossState.destroyed, - () => [ - qa.Single( - { - trail: { - form: "default", - topColour: "#C50202", - bottomColour: "#C50202", - }, - paused: e.paused, - df: e.df, - justDestroyed: true, - playerRot: 0, - sfx: false, - playerScale: 1, - }, - (t) => { - const a = e.bossState; - ((t.x = a.bossX), - (t.y = a.bossY), - (t.paused = e.paused), - (t.df = e.df)); - }, - ), - ], - () => [ - fg.Single( - { - gunView: t.shootFrames > 0 ? "shoot" : t.gunView, - paused: e.paused, - df: e.df, - spineContext: e.spineContext, - scale: e.scale, - }, - (t) => { - const a = e.bossState; - ((t.x = a.bossX), - (t.y = a.bossY), - (t.gunView = - a.shootFrames > 0 ? "shoot" : a.gunView), - (t.paused = e.paused), - (t.df = e.df), (t.scale = e.scale) - ); - }, - ), - ], - ), - ]; - } - case "demon": { - const { animationRenderer: a, animationAssets: i } = e.spineContext || t(Ws); - return [ - bg.Array({ - props: (t, n) => ({ - animationRenderer: a, - animationAssets: i, - paused: e.paused, - df: e.df, - xVal: t.x, - yVal: t.y, - batchLength: e.bossState.minions.length, - batchIndex: n, - }), - update: (e, t, a) => { - ((e.xVal = t.x), (e.yVal = t.y), (e.batchIndex = a)); - }, - updateAll: (t) => { - ((t.paused = e.paused), - (t.df = e.df), - (t.batchLength = e.bossState.minions.length)); - }, - array: () => e.bossState.minions, - key: (e) => e.index, - }), - ifConditional( - () => e.bossState.minions.length > 0, - () => [ - Ro.Single( - { - fileName: "audio/levels/boss4/minion.mp3", - loop: true, - isGameSfx: true, - paused: e.paused, - df: e.df, - }, - (t) => { - ((t.paused = e.paused), (t.df = e.df)); - }, - ), - ], - ), - Sg.Array({ - props: (t, n) => ({ - animationRenderer: a, - animationAssets: i, - paused: e.paused, - df: e.df, - xVal: t.x, - yVal: t.y, - batchLength: e.bossState.fireballs.length, - batchIndex: n, - }), - update: (e, t, a) => { - ((e.xVal = t.x), (e.yVal = t.y), (e.batchIndex = a)); - }, - updateAll: (t) => { - ((t.paused = e.paused), - (t.df = e.df), - (t.batchLength = e.bossState.fireballs.length)); - }, - array: () => e.bossState.fireballs, - key: (e) => e.index, - }), - ifConditional( - () => e.bossState.fireballs.length > 0, - () => [ - Ro.Single( - { - fileName: "audio/levels/boss4/fireball.mp3", - loop: true, - isGameSfx: true, - paused: e.paused, - df: e.df, - }, - (t) => { - ((t.paused = e.paused), (t.df = e.df)); - }, - ), - ], - ), - ifConditional( - () => e.frame > Rl && e.frame < Ol && !e.playerCrashed, - () => { - const t = et.closestFlatAngle(e.playerRot) % 360; - return [ - Hs( - { - id: "PlayerHit", - animationAssets: i, - animationRenderer: a, - animationName: `short_${t}`, - fileNames: Qs.spineFiles.world4BossPlayerHit, - loop: false, - paused: e.paused, - df: e.df, - x: e.playerX + 52, - y: -259, - scale: { x: 1.1, y: 1.1 }, - height: 0, - }, - (t) => { - ((t.paused = e.paused), - (t.df = e.df), - (t.x = e.playerX + 52)); - }, - ), - ]; - }, - ), - ifConditional( - () => e.frame > Rl && !e.playerCrashed, - () => [ - Ro.Single( - { - fileName: "audio/levels/boss4/death.mp3", - paused: e.paused, - loop: false, - isGameSfx: true, - df: e.df, - }, - (t) => { - ((t.paused = e.paused), (t.df = e.df)); - }, - ), - ], - ), - ]; - } - } - }, - }), - hg = makeSprite({ - render({ props: e, getContext: t }) { - switch (e.bossState.type) { - case "flying": - return [ - y({ - fileName: "images/level/boss3/star-line.png", - width: 950, - height: 50, - y: et.initialPosition.y, - }), - y({ - fileName: "images/level/boss3/star-line.png", - width: 950, - height: 50, - y: et.initialPosition.y + 90, - }), - dg.Single( - { - fileName: "images/level/boss3/star-line-stars.png", - playerX: e.playerX, - playerY: 0, - height: 50, - y: et.initialPosition.y, - }, - (t) => { - t.playerX = e.playerX; - }, - ), - dg.Single( - { - fileName: "images/level/boss3/star-line-stars.png", - playerX: e.playerX, - playerY: 0, - height: 50, - y: et.initialPosition.y + 90, - }, - (t) => { - t.playerX = e.playerX; - }, - ), - ]; - case "demon": { - const { animationRenderer: a } = t(Ws); - return [ - Vs( - { - id: "DemonBoss", - runtime: e.bossState.runtime, - animationRenderer: a, - }, - (t) => { - t.runtime = e.bossState.runtime; - }, - ), - ]; - } - default: - return []; - } - }, - }), - pg = makeSprite({ - render: ({ props: e }) => - "pixel" === e.bossState.type - ? [ - ifConditional( - () => e.frame >= 430, - () => [ - onChange( - () => e.bossState.health, - () => { - const t = - 15 + - (Math.max(0, e.bossState.health / 2 - 0.8) / - 4.2) * - 298; - return [ - y({ - fileName: - "images/level/boss2/healthbar-frame.png", - width: 328, - height: 60, - }), - y({ - fileName: "images/level/boss2/healthbar.png", - width: 328, - height: 60, - mask: rectangleMask({ - width: t, - height: 60, - x: t / 2, - }), - anchorX: -164, - x: -164, - }), - ]; - }, - ), - ], - ), - ] - : [], - }), - gg = makeSprite({ - init: () => ({ isGunOut: false, gunFired: false }), - render: ({ props: e, state: t }) => [ - conditional( - () => t.gunFired, - () => [ - triggerableSpriteSheet.Single( + update: (a, i) => { + ((a.x = i.x - e.moveX), + (a.y = e.element.dontMoveY ? i.y : i.y - e.moveY), + e.element.spinning && + (a.rotation = t.spinDir * (e.moveX % 360))); + }, + array: () => t.images, + }), + ], + }), + lg = (e, t, a, i) => { + const { yMin: n = 0, yMax: s = t, alternateY: o = true } = e; + if (s === n) return n; + const r = st(n, s, i); + return o ? a * r : r; + }, + cg = 950, + dg = makeSprite({ + init: ({ props: { playerX: e } }) => + e < 0 + ? { startX1: e, startX2: e + cg } + : { startX1: e - cg, startX2: e }, + loop({ state: e, props: { playerX: t } }) { + (e.startX1 - t < -950 + ? (e.startX1 += 1900) + : e.startX1 - t > cg && (e.startX1 -= 1900), + e.startX2 - t < -950 + ? (e.startX2 += 1900) + : e.startX2 - t > cg && (e.startX2 -= 1900)); + }, + render: ({ props: e, state: t }) => [ + y({ fileName: e.fileName, width: cg, height: e.height }, (a) => { + a.x = t.startX1 - e.playerX; + }), + y({ fileName: e.fileName, width: cg, height: e.height }, (a) => { + a.x = t.startX2 - e.playerX; + }), + ], + }), + ug = makeSprite({ + render({ props: e, getContext: t }) { + switch (e.bossState.type) { + case "robot": + const { animationRenderer: a } = e.spineContext || t(Ws); + return [ + Vs( { - fileName: `images/level/boss2/lasercharge/shot/health${Math.ceil(e.health / 2)}.png`, - columns: 2, - rows: 1, - frameRate: 3, - width: e.bossWidth, - height: e.bossHeight, - df: e.df, - paused: e.paused, + id: "RobotBoss", + runtime: e.bossState.runtime, + animationRenderer: a, }, (t) => { - ((t.df = e.df), (t.paused = e.paused)); + t.runtime = e.bossState.runtime; }, ), - ], - () => [ - y({ - fileName: `images/level/boss2/lasercharge/base/health${Math.ceil(e.health / 2)}.png`, - width: e.bossWidth, - height: e.bossHeight, - }), - conditional( - () => t.isGunOut, + ifConditional( + () => e.bossState.debug.length > 0, () => [ - y({ - fileName: - "images/level/boss2/lasercharge/guncharging.png", - width: e.bossWidth, - height: e.bossHeight, - }), - triggerableSpriteSheet.Single( - { - fileName: - "images/level/boss2/lasercharge/laserbar.png", - columns: 1, - rows: 20, - frameRate: 6, - width: 98, - height: 13, - paused: e.paused, - df: e.df, - x: -68, - y: 4, - }, - (t) => { - ((t.paused = e.paused), (t.df = e.df)); - }, - ), - loopingSpriteSheet.Single( - { - fileName: - "images/level/boss2/lasercharge/laserorbs.png", - columns: 2, - rows: 2, - frameRate: 6, - width: 112, - height: 105, - frame: e.frame, - x: -120, - }, - (t) => { - t.frame = e.frame; - }, - ), - triggerableSpriteSheet.Single( - { - fileName: - "images/level/boss2/lasercharge/lasertip.png", - columns: 11, - rows: 2, - frameRate: 6, - width: 30, - height: 30, - x: -120, - y: 4, - paused: e.paused, - df: e.df, - onEnd: () => { - t.gunFired = true; - }, - }, + m( + { path: e.bossState.debug, color: "#FF0000" }, (t) => { - ((t.paused = e.paused), (t.df = e.df)); + t.path = e.bossState.debug; }, ), ], - () => [ - triggerableSpriteSheet.Single( - { - fileName: "images/level/boss2/lasercharge/gunout.png", - columns: 3, - rows: 1, - frameRate: 6, - width: e.bossWidth, - height: e.bossHeight, - paused: e.paused, - df: e.df, - onEnd: () => { - t.isGunOut = true; + ), + ]; + case "pixel": + const i = 338, + n = 285; + return [ + bossButtonSprite.Array({ + props: (e) => ({ button: e }), + update: (e, t) => { + ((e.button = t), + (e.x = t.x), + (e.y = t.y), + (e.df = t.df)); + }, + array: () => e.bossState.allButtons, + key: (e, t) => t, + }), + onChange( + () => e.bossState.view, + () => { + const t = e.bossState, + health = t.health; + switch (t.view) { + case "idle": + return [ + loopingSpriteSheet.Single( + { + fileName: `images/level/boss2/idle/health${Math.ceil(health / 2)}.png`, + columns: 6, + rows: 2, + maxIndex: 10, + frameRate: 6, + width: i, + height: n, + frame: e.frame, + }, + (t) => { + const a = e.bossState; + ((t.x = a.bossX), + (t.y = a.bossY), + (t.frame = e.frame)); + }, + ), + ]; + case "gunOut": + return [ + triggerableSpriteSheet.Single( + { + fileName: `images/level/boss2/gunout/health${Math.ceil(health / 2)}.png`, + columns: 3, + rows: 2, + frameRate: 6, + width: i, + height: n, + paused: e.paused, + df: e.df, + }, + (t) => { + const a = e.bossState; + ((t.x = a.bossX), + (t.y = a.bossY), + (t.paused = e.paused), + (t.df = e.df)); + }, + ), + ]; + case "gunIn": + return [ + triggerableSpriteSheet.Single( + { + fileName: `images/level/boss2/gunin/health${Math.ceil(health / 2)}.png`, + columns: 2, + rows: 2, + frameRate: 6, + width: i, + height: n, + paused: e.paused, + df: e.df, + }, + (t) => { + const a = e.bossState; + ((t.x = a.bossX), + (t.y = a.bossY), + (t.paused = e.paused), + (t.df = e.df)); + }, + ), + ]; + case "gun": + const s = 6 === health || 8 === health ? 3 : 2, + o = 4 === health || 8 === health ? 2 : 1, + r = 6 * s * o - 1; + return [ + loopingSpriteSheet.Single( + { + fileName: `images/level/boss2/gunshot/health${Math.ceil(health / 2)}.png`, + columns: s, + rows: o, + frameRate: 6, + width: i, + height: n, + frame: r - t.isShootingFrames, + }, + (t) => { + const a = e.bossState; + ((t.x = a.bossX), + (t.y = a.bossY), + (t.frame = r - a.isShootingFrames)); + }, + ), + ]; + case "chargeLaser": + return [ + gg.Single( + { + bossWidth: i, + bossHeight: n, + health: health, + paused: e.paused, + frame: e.frame, + df: e.df, + }, + (t) => { + const a = e.bossState; + ((t.x = a.bossX), + (t.y = a.bossY), + (t.paused = e.paused), + (t.frame = e.frame), + (t.df = e.df)); + }, + ), + Ro.Single( + { + fileName: "audio/levels/boss2/laser.wav", + loop: false, + paused: e.paused, + fromPosition: 0, + isGameSfx: true, + df: e.df, + }, + (t) => { + ((t.paused = e.paused), (t.df = e.df)); + }, + ), + ]; + case "chargeLaserDamage": + return [ + triggerableSpriteSheet.Single( + { + fileName: `images/level/boss2/laserdamage/health${Math.ceil(health / 2)}.png`, + columns: 2, + rows: 2, + frameRate: 6, + width: i, + height: n, + paused: e.paused, + df: e.df, + }, + (t) => { + const a = e.bossState; + ((t.x = a.bossX), + (t.y = a.bossY), + (t.paused = e.paused), + (t.df = e.df)); + }, + ), + Ro.Single( + { + fileName: "audio/levels/boss2/damage.wav", + loop: false, + paused: e.paused, + fromPosition: 0, + isGameSfx: true, + df: e.df, + }, + (t) => { + ((t.paused = e.paused), (t.df = e.df)); + }, + ), + ]; + case "death": + return [ + mg.Single( + { + bossWidth: i, + bossHeight: n, + paused: e.paused, + df: e.df, + }, + (t) => { + const a = e.bossState; + ((t.x = a.bossX), + (t.y = a.bossY), + (t.paused = e.paused), + (t.df = e.df)); + }, + ), + Ro.Single( + { + fileName: "audio/levels/boss2/death.wav", + loop: false, + paused: e.paused, + fromPosition: 0, + isGameSfx: true, + df: e.df, + }, + (t) => { + ((t.paused = e.paused), (t.df = e.df)); + }, + ), + ]; + } + }, + ), + no.Array({ + props: (e) => ({ bullet: e }), + update: (a, t) => { + ((a.bullet = t), + (a.x = t.x), + (a.y = t.y), + (a.paused = e.paused), + (a.df = e.df)); + }, + array: () => e.bossState.bullets, + key: (e, t) => t, + }), + ]; + case "flying": { + const t = e.bossState; + return [ + yg.Array({ + props: (t) => ({ asteroid: t, frame: e.frame }), + update: (t, a) => { + ((t.asteroid = a), (t.frame = e.frame), (t.paused = e.paused), (t.df = e.df)); + }, + array: () => e.bossState.asteroids, + key: (e) => e.index, + }), + Eg.Array({ + props: (e) => ({ tile: e }), + update: (e, t) => { + e.tile = t; + }, + array: () => e.bossState.insideAsteroid, + key: (e) => e.index, + }), + imageArray({ + fileName: "images/level/boss3/bullet.png", + props: () => ({}), + update: (e, t) => { + ((e.x = t.x), + (e.y = t.y), + (e.width = t.width), + (e.height = t.height), + (e.scaleX = -Math.sign(t.speed)) + ); + }, + array: () => e.bossState.bullets, + }), + flyingTrail.Single( + { + playerX: t.bossX, + playerY: t.bossY, + playerDir: 1, + crashed: t.destroyed, + paused: e.paused, + frame: e.frame, + colour: "#C50202", + df: e.df, + }, + (t) => { + const a = e.bossState; + ((t.playerX = a.bossX), + (t.playerY = a.bossY), + (t.crashed = a.destroyed), + (t.paused = e.paused), + (t.frame = e.frame), + (t.df = e.df)); + }, + ), + conditional( + () => e.bossState.destroyed, + () => [ + qa.Single( + { + trail: { + form: "default", + topColour: "#C50202", + bottomColour: "#C50202", }, + paused: e.paused, + df: e.df, + justDestroyed: true, + playerRot: 0, + sfx: false, + playerScale: 1, }, (t) => { - ((t.paused = e.paused), (t.df = e.df)); + const a = e.bossState; + ((t.x = a.bossX), + (t.y = a.bossY), + (t.paused = e.paused), + (t.df = e.df)); + }, + ), + ], + () => [ + fg.Single( + { + gunView: t.shootFrames > 0 ? "shoot" : t.gunView, + paused: e.paused, + df: e.df, + spineContext: e.spineContext, + scale: e.scale, + }, + (t) => { + const a = e.bossState; + ((t.x = a.bossX), + (t.y = a.bossY), + (t.gunView = + a.shootFrames > 0 ? "shoot" : a.gunView), + (t.paused = e.paused), + (t.df = e.df), (t.scale = e.scale) + ); }, ), ], ), - ], - ), - ], - }), - mg = makeSprite({ - init: () => ({ - step: 1, - explosions: [ - { x: 44, y: -60, start: 20 }, - { x: 98, y: 1, start: 69 }, - { x: 108, y: -18, start: 4 }, - { x: -86, y: -21, start: 66 }, - { x: 122, y: -4, start: 13 }, - { x: 96, y: -56, start: 52 }, - { x: 71, y: -110, start: 37 }, - { x: -59, y: -16, start: 47 }, - { x: 122, y: -11, start: 70 }, - { x: -11, y: 3, start: 22 }, - { x: 62, y: -103, start: 51 }, - { x: 108, y: 3, start: 45 }, - { x: -110, y: -6, start: 3 }, - { x: -74, y: -17, start: 35 }, - { x: -143, y: -73, start: 45 }, - { x: -109, y: -91, start: 12 }, - { x: -31, y: -17, start: 36 }, - { x: 5, y: -62, start: 21 }, - { x: 9, y: -3, start: 58 }, - ], - explosionTimer: 0, - }), - loop({ state: e, props: t }) { - if (!t.paused && 1 === e.step) { - if (e.explosionTimer >= 80) return void (e.step = 2); - e.explosionTimer += t.df; + ]; } - }, - render: ({ props: e, state: t }) => [ - onChange( - () => t.step, - () => { - switch (t.step) { - case 1: + case "demon": { + const { animationRenderer: a, animationAssets: i } = e.spineContext || t(Ws); + return [ + bg.Array({ + props: (t, n) => ({ + animationRenderer: a, + animationAssets: i, + paused: e.paused, + df: e.df, + xVal: t.x, + yVal: t.y, + batchLength: e.bossState.minions.length, + batchIndex: n, + }), + update: (e, t, a) => { + ((e.xVal = t.x), (e.yVal = t.y), (e.batchIndex = a)); + }, + updateAll: (t) => { + ((t.paused = e.paused), + (t.df = e.df), + (t.batchLength = e.bossState.minions.length)); + }, + array: () => e.bossState.minions, + key: (e) => e.index, + }), + ifConditional( + () => e.bossState.minions.length > 0, + () => [ + Ro.Single( + { + fileName: "audio/levels/boss4/minion.mp3", + loop: true, + isGameSfx: true, + paused: e.paused, + df: e.df, + }, + (t) => { + ((t.paused = e.paused), (t.df = e.df)); + }, + ), + ], + ), + Sg.Array({ + props: (t, n) => ({ + animationRenderer: a, + animationAssets: i, + paused: e.paused, + df: e.df, + xVal: t.x, + yVal: t.y, + batchLength: e.bossState.fireballs.length, + batchIndex: n, + }), + update: (e, t, a) => { + ((e.xVal = t.x), (e.yVal = t.y), (e.batchIndex = a)); + }, + updateAll: (t) => { + ((t.paused = e.paused), + (t.df = e.df), + (t.batchLength = e.bossState.fireballs.length)); + }, + array: () => e.bossState.fireballs, + key: (e) => e.index, + }), + ifConditional( + () => e.bossState.fireballs.length > 0, + () => [ + Ro.Single( + { + fileName: "audio/levels/boss4/fireball.mp3", + loop: true, + isGameSfx: true, + paused: e.paused, + df: e.df, + }, + (t) => { + ((t.paused = e.paused), (t.df = e.df)); + }, + ), + ], + ), + ifConditional( + () => e.frame > Rl && e.frame < Ol && !e.playerCrashed, + () => { + const t = et.closestFlatAngle(e.playerRot) % 360; return [ - triggerableSpriteSheet.Single( + Hs( { - fileName: "images/level/boss2/death/death1.png", - columns: 4, - rows: 2, - maxIndex: 3, - frameRate: 6, - width: e.bossWidth, - height: e.bossHeight, + id: "PlayerHit", + animationAssets: i, + animationRenderer: a, + animationName: `short_${t}`, + fileNames: Qs.spineFiles.world4BossPlayerHit, + loop: false, paused: e.paused, df: e.df, + x: e.playerX + 52, + y: -259, + scale: { x: 1.1, y: 1.1 }, + height: 0, }, (t) => { - ((t.paused = e.paused), (t.df = e.df)); - }, - ), - bo.Array({ - props: () => ({ - justDestroyed: true, - frameRate: 6, - mute: true, - paused: e.paused, - df: e.df, - giant: false, - }), - update: (t, a) => { ((t.paused = e.paused), (t.df = e.df), - (t.x = a.x), - (t.y = a.y)); - }, - array: () => t.explosions, - filter: (e) => e.start <= t.explosionTimer, - key: (e, t) => t, - }), - ]; - case 2: - return [ - triggerableSpriteSheet.Single( - { - fileName: "images/level/boss2/death/death1.png", - columns: 4, - rows: 2, - startFrame: 18, - maxIndex: 7, - frameRate: 6, - width: e.bossWidth, - height: e.bossHeight, - paused: e.paused, - df: e.df, - onEnd: () => { - t.step = 3; - }, - }, - (t) => { - ((t.paused = e.paused), (t.df = e.df)); + (t.x = e.playerX + 52)); }, ), ]; - case 3: - return [ - triggerableSpriteSheet.Single( - { - fileName: "images/level/boss2/death/death2.png", - columns: 3, - rows: 1, - frameRate: 6, - width: 3570 / 9, - height: 980 / 3, - x: 1, - y: -1, - paused: e.paused, - df: e.df, - onEnd: () => { - t.step = 4; - }, - }, - (t) => { - ((t.paused = e.paused), (t.df = e.df)); - }, - ), - ]; - case 4: - return [ - triggerableSpriteSheet.Single( - { - fileName: "images/level/boss2/death/explosion.png", - columns: 3, - rows: 3, - frameRate: 6, - width: 437, - height: 437, - x: -20, - y: -10, - paused: e.paused, - df: e.df, - hideOnEnd: true, - }, - (t) => { - ((t.paused = e.paused), (t.df = e.df)); - }, - ), - ]; - } - }, - ), - ], - }), - fg = makeSprite({ - render({ getContext: e, props: t }) { - const { animationAssets: a, animationRenderer: i } = t.spineContext || e(Ws); - return [ - onChange( - () => t.gunView, - () => { - switch (t.gunView) { - case "up": - case "toUp": - return [ - Hs( - { - id: "Up", - animationAssets: a, - animationRenderer: i, - animationName: "out", - fileNames: Qs.spineFiles.bossSpaceGun, - startFromFrame: "toUp" === t.gunView ? 0 : 9999, - loop: false, - paused: t.paused, - df: t.df, - x: 0, - y: 0, - height: 30, - }, - (e) => { - ((e.paused = t.paused), (e.df = t.df), (e.scale = { - x: t.scale || 1, - y: t.scale || 1 - })); - }, - ), - ]; - case "down": - case "toDown": - return [ - Hs( - { - id: "Down", - animationAssets: a, - animationRenderer: i, - animationName: "in", - fileNames: Qs.spineFiles.bossSpaceGun, - startFromFrame: "toDown" === t.gunView ? 0 : 9999, - loop: false, - paused: t.paused, - df: t.df, - x: 0, - y: 0, - height: 30, - }, - (e) => { - ((e.paused = t.paused), (e.df = t.df), (e.scale = { - x: t.scale || 1, - y: t.scale || 1 - })); - }, - ), - ]; - case "shoot": - return [ - Hs( - { - id: "Fire", - animationAssets: a, - animationRenderer: i, - animationName: "fire", - fileNames: Qs.spineFiles.bossSpaceGun, - loop: false, - paused: t.paused, - df: t.df, - x: 0, - y: 0, - height: 30, - }, - (e) => { - ((e.paused = t.paused), (e.df = t.df), (e.scale = { - x: t.scale || 1, - y: t.scale || 1 - })); - }, - ), - ]; - } - }, - ), - ]; - }, - }), - yg = makeSprite({ - render: ({ props: e }) => [ - conditional( - () => e.asteroid.destroyed, - () => [ - qa.Single( + }, + ), + ifConditional( + () => e.frame > Rl && !e.playerCrashed, + () => [ + Ro.Single( + { + fileName: "audio/levels/boss4/death.mp3", + paused: e.paused, + loop: false, + isGameSfx: true, + df: e.df, + }, + (t) => { + ((t.paused = e.paused), (t.df = e.df)); + }, + ), + ], + ), + ]; + } + } + }, + }), + hg = makeSprite({ + render({ props: e, getContext: t }) { + switch (e.bossState.type) { + case "flying": + return [ + y({ + fileName: "images/level/boss3/star-line.png", + width: 950, + height: 50, + y: et.initialPosition.y, + }), + y({ + fileName: "images/level/boss3/star-line.png", + width: 950, + height: 50, + y: et.initialPosition.y + 90, + }), + dg.Single( { - trail: { - form: "default", - topColour: "#868a99", - bottomColour: "#3a3a43", - }, - paused: e.paused, - df: e.df, - justDestroyed: true, - playerRot: 0, - sfx: false, - playerScale: 1, + fileName: "images/level/boss3/star-line-stars.png", + playerX: e.playerX, + playerY: 0, + height: 50, + y: et.initialPosition.y, }, (t) => { - const a = e.bossState; - ((t.x = e.asteroid.x), - (t.y = e.asteroid.y), - (t.paused = e.paused), - (t.df = e.df)); + t.playerX = e.playerX; }, ), - ], - () => [ y( + dg.Single( + { + fileName: "images/level/boss3/star-line-stars.png", + playerX: e.playerX, + playerY: 0, + height: 50, + y: et.initialPosition.y + 90, + }, + (t) => { + t.playerX = e.playerX; + }, + ), + ]; + case "demon": { + const { animationRenderer: a } = t(Ws); + return [ + Vs( + { + id: "DemonBoss", + runtime: e.bossState.runtime, + animationRenderer: a, + }, + (t) => { + t.runtime = e.bossState.runtime; + }, + ), + ]; + } + default: + return []; + } + }, + }), + pg = makeSprite({ + render: ({ props: e }) => + "pixel" === e.bossState.type + ? [ + ifConditional( + () => e.frame >= 430, + () => [ + onChange( + () => e.bossState.health, + () => { + const t = + 15 + + (Math.max(0, e.bossState.health / 2 - 0.8) / + 4.2) * + 298; + return [ + y({ + fileName: + "images/level/boss2/healthbar-frame.png", + width: 328, + height: 60, + }), + y({ + fileName: "images/level/boss2/healthbar.png", + width: 328, + height: 60, + mask: rectangleMask({ + width: t, + height: 60, + x: t / 2, + }), + anchorX: -164, + x: -164, + }), + ]; + }, + ), + ], + ), + ] + : [], + }), + gg = makeSprite({ + init: () => ({ isGunOut: false, gunFired: false }), + render: ({ props: e, state: t }) => [ + conditional( + () => t.gunFired, + () => [ + triggerableSpriteSheet.Single( { - fileName: `images/level/boss3/asteroid${ - e.asteroid.radius <= 15 - ? "60" - : e.asteroid.radius <= 25 - ? "120" - : "210" - }.png`, - width: 2.4 * e.asteroid.radius, - height: 2.4 * e.asteroid.radius, + fileName: `images/level/boss2/lasercharge/shot/health${Math.ceil(e.health / 2)}.png`, + columns: 2, + rows: 1, + frameRate: 3, + width: e.bossWidth, + height: e.bossHeight, + df: e.df, + paused: e.paused, }, (t) => { - ((t.x = e.asteroid.x), - (t.y = e.asteroid.y), - (t.rotation = e.asteroid.x + e.frame)); + ((t.df = e.df), (t.paused = e.paused)); }, - ) ] - ) - ], - }), - Eg = makeSprite({ - render({ props: e }) { - const t = - "topEntry" === e.tile.type - ? -1 - : "bottomExit" === e.tile.type - ? 1 - : 0; - return [ - t - ? y( + ), + ], + () => [ + y({ + fileName: `images/level/boss2/lasercharge/base/health${Math.ceil(e.health / 2)}.png`, + width: e.bossWidth, + height: e.bossHeight, + }), + conditional( + () => t.isGunOut, + () => [ + y({ + fileName: + "images/level/boss2/lasercharge/guncharging.png", + width: e.bossWidth, + height: e.bossHeight, + }), + triggerableSpriteSheet.Single( { - fileName: `images/level/boss3/tiles/${e.tile.type}Glow.png`, - width: 404, - height: 675, + fileName: + "images/level/boss2/lasercharge/laserbar.png", + columns: 1, + rows: 20, + frameRate: 6, + width: 98, + height: 13, + paused: e.paused, + df: e.df, + x: -68, + y: 4, }, - (a) => { - a.x = e.tile.x + (104 * t) / 2; + (t) => { + ((t.paused = e.paused), (t.df = e.df)); }, - ) - : null, - y( - { - fileName: `images/level/boss3/tiles/${e.tile.type}.png`, - width: vl, - height: 675, - }, - (t) => { - t.x = e.tile.x; - }, - ), - ]; - }, - }), - bg = makeSprite({ - render: ({ props: e }) => [ - Hs( - { - id: "Minion", - animationAssets: e.animationAssets, - animationRenderer: e.animationRenderer, - animationName: "animation", - fileNames: Qs.spineFiles.world4BossMinion, - loop: true, - paused: e.paused, - df: e.df, - x: e.xVal, - y: e.yVal - 5, - height: 10, - batchLength: e.batchLength, - batchIndex: e.batchIndex, - }, - (t) => { - ((t.paused = e.paused), - (t.df = e.df), - (t.x = e.xVal), - (t.y = e.yVal - 5), - (t.batchLength = e.batchLength), - (t.batchIndex = e.batchIndex)); - }, - ), - ], - }), - Sg = makeSprite({ - render: ({ props: e }) => [ - Hs( - { - id: "Fireball", - animationAssets: e.animationAssets, - animationRenderer: e.animationRenderer, - animationName: "animation", - fileNames: Qs.spineFiles.world4BossFireBall, - loop: true, - paused: e.paused, - df: e.df, - x: e.xVal, - y: e.yVal + 3, - height: 10, - batchLength: e.batchLength, - batchIndex: e.batchIndex, - }, - (t) => { - ((t.paused = e.paused), - (t.df = e.df), - (t.x = e.xVal), - (t.y = e.yVal + 3), - (t.batchLength = e.batchLength), - (t.batchIndex = e.batchIndex)); - }, - ), - ], - }), - Ig = makeSprite({ - render({ props: e, device: t }) { - const a = Array.from({ length: 25 }).map((e, t) => 38 * t); - return e.narrowLines - ? [ - f({ - props: () => ({ - fillColor: e.color, - path: [ - [0, 0], - [0, 0], - [0, 0], - ], - }), - update: (a, i) => { - const n = (i - e.playerX) % 950, - s = (n < 0 ? n + 950 : n) - 475, - o = s, - r = e.offsetY, - l = 4 * s, - c = -t.size.fullHeight / 2; - ((a.path[0][0] = o), - (a.path[0][1] = r), - (a.path[1][0] = l - e.thickness / 2), - (a.path[1][1] = c), - (a.path[2][0] = l + e.thickness / 2), - (a.path[2][1] = c), - (a.fillColor = e.color)); + ), + loopingSpriteSheet.Single( + { + fileName: + "images/level/boss2/lasercharge/laserorbs.png", + columns: 2, + rows: 2, + frameRate: 6, + width: 112, + height: 105, + frame: e.frame, + x: -120, }, - array: () => a, - }), - ] - : [ - f({ - props: () => ({ - color: e.color, - path: [ - [0, 0], - [0, 0], - ], - }), - update: (a, i) => { - const n = (i - e.playerX) % 950, - s = (n < 0 ? n + 950 : n) - 475, - o = s, - r = e.offsetY, - l = 4 * s, - c = -t.size.fullHeight / 2; - ((a.path[0][0] = o), - (a.path[0][1] = r), - (a.path[1][0] = l), - (a.path[1][1] = c), - (a.color = e.color)); + (t) => { + t.frame = e.frame; }, - array: () => a, - }), - ]; - }, - }), - _g = makeSprite({ - init: ({ device: e, props: t }) => ({ - ash: Array.from({ length: 20 }).map(() => ({ - x: - st(-e.size.fullWidth / 2, e.size.fullWidth / 2, e.random) + - t.moveX, - localX: 0, - y: st(-e.size.fullHeight / 2, e.size.fullHeight / 2, e.random), - speedX: 0, - speedY: e.random() + 1, - })), - }), - loop({ props: e, state: t, device: a }) { - if (e.paused) return; - const i = a.size.fullWidth / 2, - n = a.size.fullHeight / 2; - for (const s of t.ash) { - ((s.y -= s.speedY), - s.y < -n && - ((s.y += a.size.fullHeight + 10), - (s.speedX = 0), - (s.x = - st( - -a.size.fullWidth / 2, - a.size.fullWidth / 2, - a.random, - ) + e.moveX)), - (s.speedX += (a.random() - 0.5) / 4), - (s.x += s.speedX), - (s.localX = s.x - e.moveX)); - const t = -i - 30, - o = i + 30; - for (; s.localX < t; ) - ((s.x += a.size.fullWidth + 45), (s.localX = s.x - e.moveX)); - for (; s.localX > o; ) - ((s.x -= a.size.fullWidth + 45), (s.localX = s.x - e.moveX)); - } - }, - render: ({ state: e, device: t }) => [ - imageArray({ - fileName: "images/themes/speed/ash.png", - props: () => ({ - width: 6, - height: 3, - rotation: 360 * t.random(), - }), - update: (e, t) => { - ((e.x = t.localX), (e.y = t.y)); - }, - array: () => e.ash, - }), - ], - }), - arrowsBGTable = function () { - return { - "#FF0000": "#ff1212", - "#ffea00": "#ffeb12", - "#00FF00": "#12ff1a", - "#0000ff": "#12e3ff", - "#8000ff": "#b412ff", - "#ff00ff": "#fb12ff", - "#ffFFff": "#FFFFFF", - "#000000": "#000000", - }; - }, - //arrows - arrowTheme = makeSprite({ - init({ device: e }) { - const t = [], - a = be.rectTouchesRect({ - x: 0, - y: 0, - width: e.size.fullWidth, - height: e.size.fullHeight, - }); - return { - rects: Tg.flatMap((i, n) => - i - .map((i, s) => { - const o = 57 * s - 475, - r = 337.5 - 54 * n, - l = a({ x: o, y: r, width: 57, height: 54 }); - if (0 === i || !l) return null; - if ((n <= 4 || n >= 9) && s % 3 != 0) { - const a = e.random() < 0.5; - return ( - t.push({ - x: o, - y: r, - fade: a ? 0 : 1, - fadeIn: a, - timeout: Math.round(600 * e.random()), - colour: n > 6 ? Rg[12 - n] : Rg[n], - }), - null - ); - } - return { x: o, y: r, colour: n > 6 ? Rg[12 - n] : Rg[n] }; - }) - .filter(nt), - ), - fadeRects: t, - }; - }, - loop({ state: e, device: t, props: a }) { - a.paused || - e.fadeRects.forEach((e) => { - e.timeout > 0 - ? e.timeout-- - : e.fadeIn - ? e.fade < 1 - ? (e.fade += 0.01) - : ((e.fade = 1), - (e.fadeIn = !1), - (e.timeout = Math.round(600 * t.random()))) - : e.fade > 0 - ? (e.fade -= 0.01) - : ((e.fade = 0), - (e.fadeIn = !0), - (e.timeout = Math.round(600 * t.random()))); - }); - }, - render: ({ device: d, state: t, props: a }) => [ - Go.Single( - { - targetOpacity: 1, - targetColor: arrowsBGTable()[a.bgColor] || "#1254FF", - sprite: (s, k) => [ - p( + ), + triggerableSpriteSheet.Single( { - color: k.ref, - width: d.size.fullWidth, - height: d.size.fullHeight, - opacity: 1, + fileName: + "images/level/boss2/lasercharge/lasertip.png", + columns: 11, + rows: 2, + frameRate: 6, + width: 30, + height: 30, + x: -120, + y: 4, + paused: e.paused, + df: e.df, + onEnd: () => { + t.gunFired = true; + }, + }, + (t) => { + ((t.paused = e.paused), (t.df = e.df)); }, - (j) => ( - (j.width = d.size.fullWidth), - (j.height = d.size.fullHeight), - (j.color = k.ref), - (j.opacity = 1) - ), ), ], - }, - (t) => { - t.targetOpacity = 1; - t.targetColor = arrowsBGTable()[a.bgColor] || "#1254FF"; - }, - ), - g({ - props: (e) => ({ - color: e.colour, - width: 54, - height: 51, - x: e.x, - y: e.y, - }), - array: () => t.rects, - }), - g({ - props: (e) => ({ - color: e.colour, - width: 54, - height: 51, - x: e.x, - y: e.y, - }), - update: (e, t) => { - e.opacity = t.fade; - }, - array: () => t.fadeRects, - }), - ], - }), - tileSprite = makeSprite({ - init: ({ props: { playerX, playerY }, device: { random } }) => { - const a = random() < 0.5; - return { - x: playerX, - y: playerY, - max: 960, - fade: a ? 0 : 1, - fadeIn: a, - timeout: Math.round(100 * random()), - }; - }, - loop({ - state: e, - props: { playerX: t, playerY: a }, - device: { random }, - }) { - e.x = t; - e.y = a; - if (e.x < -e.max) { - while (e.x < -e.max) { - e.x += e.max * 2; - } - } else if (e.x > e.max) { - while (e.x > e.max) { - e.x -= e.max * 2; - } - } - if (e.y < -e.max) { - while (e.y < -e.max) { - e.y += e.max * 2; - } - } else if (e.y > e.max) { - while (e.y > e.max) { - e.y -= e.max * 2; - } - } - e.paused || e.timeout > 0 - ? e.timeout-- - : e.fadeIn - ? e.fade < 1 - ? (e.fade += 0.01) - : ((e.fade = 1), - (e.fadeIn = !1), - (e.timeout = Math.round(100 * random()))) - : e.fade > 0 - ? (e.fade -= 0.01) - : ((e.fade = 0), - (e.fadeIn = !0), - (e.timeout = Math.round(100 * random()))); - }, - render: ({ props: e, state: t }) => [ - p({ color: e.color, width: e.width, height: e.height }, (a) => { - a.color = e.color; - a.x = t.x; - a.y = t.y; - a.opacity = t.fade; - }), - ], - }), - Tg = [ - [0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1], - [0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0], - [0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1], - [1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1], - [0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0], - [1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1], - [0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1], - [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], - [1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1], - [1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1], - [1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1], - [1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1], - [0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1], - ], - Rg = [ - //hsla(223, 100%, 54%, 1.00) - "rgba(0, 0, 0, 0.45)", //"rgba(11, 45, 168, 1)", - "rgba(0, 0, 0, 0.38)", //"rgba(11, 45, 168, 1)" - "rgba(0, 0, 0, 0.36)", //"rgba(11, 47, 168, 1)" - "rgba(0, 0, 0, 0.34)", //"hsla(227, 87%, 36%, 1.00)", - "rgba(0, 0, 0, 0.35)", //"hsla(227, 86%, 39%, 1.00)" - "rgba(0, 0, 0, 0.31)", //"hsla(227, 85%, 42%, 1.00)" - "rgba(0, 0, 0, 0.29)", //"hsla(228, 84%, 44%, 1.00)", - ]; - function Og(e, t, a) { - const i = e.createShader(t); - if ( - (e.shaderSource(i, a), - e.compileShader(i), - e.getShaderParameter(i, e.COMPILE_STATUS)) - ) - return i; - throw Error(e.getShaderInfoLog(i) || ""); - } - const dreamySprite = makeNativeSprite("ShaderBg"), - createShaderBg = { - create: ({ props: props }) => { - const gl = document - .getElementById("replay-canvas") - .getContext("webgl"); - if (!gl) return null; - const a = gl.getExtension("OES_vertex_array_object"); - if (!a) return null; - const i = (function (e, t, a) { - const i = Og(e, e.VERTEX_SHADER, t), - n = Og(e, e.FRAGMENT_SHADER, a), - s = e.createProgram(); - if ( - (e.attachShader(s, i), - e.attachShader(s, n), - e.linkProgram(s), - e.getProgramParameter(s, e.LINK_STATUS)) - ) - return s; - throw Error(e.getProgramInfoLog(s) || ""); - })(gl, kg, Ng), - n = a.createVertexArrayOES(); - if (!n) return null; - a.bindVertexArrayOES(n); - const s = gl.getAttribLocation(i, "a_position"), - o = gl.createBuffer(); - (gl.bindBuffer(gl.ARRAY_BUFFER, o), - gl.enableVertexAttribArray(s), - gl.vertexAttribPointer(s, 2, gl.FLOAT, false, 0, 0), - gl.bufferData( - gl.ARRAY_BUFFER, - new Float32Array([-1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1]), - gl.STATIC_DRAW, - )); - const r = gl.getUniformLocation(i, "u_resolution"), - l = gl.getUniformLocation(i, "u_time"), - c = gl.getUniformLocation(i, "u_ct"), - d = gl.getUniformLocation(i, "u_xboost"), - u = gl.getUniformLocation(i, "u_yboost"), - h = gl.getUniformLocation(i, "u_col0"), - p = gl.getUniformLocation(i, "u_col1"), - g = gl.getUniformLocation(i, "u_col2"); - a.bindVertexArrayOES(null); - const m = [0.43, 0.04, 0.64], - f = [0.08, 0.02, 0.61], - y = [0.67, 0.03, 0.65], - E = [0.03, 0.11, 0.14], - b = [0.62, 0.17, 0.11], - S = [0.21, 0.05, 0.04], - finish1 = [0, 0, 0], - finish2 = [0, 0, 0], - finish3 = [0, 0, 0]; - function T(e, t, a) { - return 0.5 * (1 + Math.cos(0.017453292519943295 * e)) * t + a; - } - return { - render: (frame, bgSwitchTimer) => { - (gl.useProgram(i), - a.bindVertexArrayOES(n), - gl.uniform2f(r, gl.canvas.width, gl.canvas.height)); - const o = (frame / 20) * 1.25; - (gl.uniform1f(l, o), - gl.uniform1f(c, T(5 * o, 3, 1.1)), - gl.uniform1f(d, T(0.2 * o, 5, 5)), - gl.uniform1f(u, T(0.1 * o, 10, 5)), - Ag(f, E, bgSwitchTimer, finish1), - Ag(m, S, bgSwitchTimer, finish2), - Ag(y, b, bgSwitchTimer, finish3), - gl.uniform3f(h, ...finish1), - gl.uniform3f(p, ...finish2), - gl.uniform3f(g, ...finish3), - gl.drawArrays(gl.TRIANGLES, 0, 6)); - }, - bgSwitchTimer: props.lesserSwitch ? props.bgSwitch ? 0.7 : 0.2 : props.bgSwitch ? 1 : 0, - cleanup: () => { - (gl.deleteBuffer(o), - gl.deleteProgram(i), - a.deleteVertexArrayOES(n)); - }, - }; - }, - loop: ({ state: e, props: t }) => { - let min = t.lesserSwitch ? 0.2 : 0, - max = t.lesserSwitch ? 0.7 : 1; - e.bgSwitchTimer = Math.round(e.bgSwitchTimer * 10) / 10 - e && - (e.render(t.frame, e.bgSwitchTimer), - t.bgSwitch - ? e.bgSwitchTimer < max ? (e.bgSwitchTimer += 0.1) : (e.bgSwitchTimer > max && (e.bgSwitchTimer -= 0.1)) - : e.bgSwitchTimer > min ? (e.bgSwitchTimer -= 0.1) : (e.bgSwitchTimer < min && (e.bgSwitchTimer += 0.1)) - ); - }, - cleanup: ({ state: e }) => { - null == e || e.cleanup(); - }, - }; - function Ag(color, other, fraction, final) { - ((final[0] = color[0] * (1 - fraction) + other[0] * fraction), - (final[1] = color[1] * (1 - fraction) + other[1] * fraction), - (final[2] = color[2] * (1 - fraction) + other[2] * fraction)); - } - //var bgColor = "#69c5ff"; - const kg = - "\nprecision mediump float;\n\nattribute vec4 a_position;\n\nvoid main() {\n gl_Position = a_position;\n}\n", - Ng = - "\nprecision mediump float;\n\nuniform vec2 u_resolution;\nuniform float u_time;\nuniform float u_ct;\nuniform float u_xboost;\nuniform float u_yboost;\n\nuniform vec3 u_col0;\nuniform vec3 u_col1;\nuniform vec3 u_col2;\n\n#define RADIANS 0.017453292519943295\n\nconst int zoom = 3;\nconst float brightness = 0.975;\nfloat fScale = 1.25;\n\nfloat cosRange(float degrees, float range, float minimum) {\n return (((1.0 + cos(degrees * RADIANS)) * 0.5) * range) + minimum;\n}\n\nvoid main() {\n vec2 uv = fract(gl_FragCoord.xy / u_resolution);\n\n vec2 p = (2.0 * gl_FragCoord.xy - u_resolution.xy) / max(u_resolution.x, u_resolution.y);\n\n fScale = cosRange(u_time * 15.5, 1.25, 0.5);\n\n for(int i = 1; i < zoom; i++) {\n float _i = float(i);\n vec2 newp = p;\n newp.x += 0.25/ _i * sin(_i * p.y + u_time * cos(u_ct) * 0.5 / 20.0 + 0.005 * _i) * fScale + u_xboost;\n newp.y += 0.25/ _i * sin(_i * p.x + u_time * u_ct * 0.3 / 40.0 + 0.03 * float(i+15)) * fScale + u_yboost;\n p = newp;\n }\n\n vec3 col = vec3(0.5 * sin(3.0 * p.x) + 0.5, 0.5 * sin(3.0 * p.y) + 0.5, sin(p.x + p.y));\n col *= brightness;\n\n vec3 finalColor = (col.r + col.b) * u_col1 + col.g * u_col2;\n\n gl_FragColor = vec4(\n clamp(finalColor.r, u_col0.r, u_col2.r),\n clamp(finalColor.g, u_col0.g, u_col2.g),\n clamp(finalColor.b, u_col0.b, u_col2.b),\n 1.0);\n}\n", - basicBGcover = (e, t) => - Go.Single( - { - targetOpacity: (e.bgColor || "#00FFFF") == "#00FFFF" ? 0 : 0.5, - targetColor: e.bgColor || "#00FFFF", - sprite: (s, k) => [ - p( - { - color: k.ref, - width: t.size.fullWidth, - height: t.size.fullHeight, - opacity: s.ref, - }, - (j) => ( - (j.width = t.size.fullWidth), - (j.height = t.size.fullHeight), - (j.color = k.ref), - (j.opacity = s.ref) + () => [ + triggerableSpriteSheet.Single( + { + fileName: "images/level/boss2/lasercharge/gunout.png", + columns: 3, + rows: 1, + frameRate: 6, + width: e.bossWidth, + height: e.bossHeight, + paused: e.paused, + df: e.df, + onEnd: () => { + t.isGunOut = true; + }, + }, + (t) => { + ((t.paused = e.paused), (t.df = e.df)); + }, ), - ), - ], - }, - (t) => { - t.targetOpacity = - (e.bgColor || "#00FFFF") == "#00FFFF" ? 0 : 0.5; - t.targetColor = e.bgColor || "#00FFFF"; - }, + ], + ), + ], ), - rangeAsArray = (start, end) => - Array.from({ length: end - start + 1 }, (_, i) => start + i), - infiniteTiles = rangeAsArray(-16, 17).map((y) => - rangeAsArray(-16, 17).map((e) => [e * 60, y * 60]), - ), - - xg = makeSprite({ - render({ props: e, device: t }) { - const a = (() => { - switch (e.theme.background) { - case "world1": - case "world1Boss": - return Fg(t.size.fullHeight / 2, e.theme.id); - case "red": - return Ug; - case "world2": - case "world2Red": - case "world3Red": - case "world3": + ], + }), + mg = makeSprite({ + init: () => ({ + step: 1, + explosions: [ + { x: 44, y: -60, start: 20 }, + { x: 98, y: 1, start: 69 }, + { x: 108, y: -18, start: 4 }, + { x: -86, y: -21, start: 66 }, + { x: 122, y: -4, start: 13 }, + { x: 96, y: -56, start: 52 }, + { x: 71, y: -110, start: 37 }, + { x: -59, y: -16, start: 47 }, + { x: 122, y: -11, start: 70 }, + { x: -11, y: 3, start: 22 }, + { x: 62, y: -103, start: 51 }, + { x: 108, y: 3, start: 45 }, + { x: -110, y: -6, start: 3 }, + { x: -74, y: -17, start: 35 }, + { x: -143, y: -73, start: 45 }, + { x: -109, y: -91, start: 12 }, + { x: -31, y: -17, start: 36 }, + { x: 5, y: -62, start: 21 }, + { x: 9, y: -3, start: 58 }, + ], + explosionTimer: 0, + }), + loop({ state: e, props: t }) { + if (!t.paused && 1 === e.step) { + if (e.explosionTimer >= 80) return void (e.step = 2); + e.explosionTimer += t.df; + } + }, + render: ({ props: e, state: t }) => [ + onChange( + () => t.step, + () => { + switch (t.step) { + case 1: return [ - { - fileName: `images/themes/world3/background/${ - e.theme.id == "world3Red" ? "red" : "pink" - }-triangle.png`, - }, + triggerableSpriteSheet.Single( + { + fileName: "images/level/boss2/death/death1.png", + columns: 4, + rows: 2, + maxIndex: 3, + frameRate: 6, + width: e.bossWidth, + height: e.bossHeight, + paused: e.paused, + df: e.df, + }, + (t) => { + ((t.paused = e.paused), (t.df = e.df)); + }, + ), + bo.Array({ + props: () => ({ + justDestroyed: true, + frameRate: 6, + mute: true, + paused: e.paused, + df: e.df, + giant: false, + }), + update: (t, a) => { + ((t.paused = e.paused), + (t.df = e.df), + (t.x = a.x), + (t.y = a.y)); + }, + array: () => t.explosions, + filter: (e) => e.start <= t.explosionTimer, + key: (e, t) => t, + }), + ]; + case 2: + return [ + triggerableSpriteSheet.Single( + { + fileName: "images/level/boss2/death/death1.png", + columns: 4, + rows: 2, + startFrame: 18, + maxIndex: 7, + frameRate: 6, + width: e.bossWidth, + height: e.bossHeight, + paused: e.paused, + df: e.df, + onEnd: () => { + t.step = 3; + }, + }, + (t) => { + ((t.paused = e.paused), (t.df = e.df)); + }, + ), + ]; + case 3: + return [ + triggerableSpriteSheet.Single( + { + fileName: "images/level/boss2/death/death2.png", + columns: 3, + rows: 1, + frameRate: 6, + width: 3570 / 9, + height: 980 / 3, + x: 1, + y: -1, + paused: e.paused, + df: e.df, + onEnd: () => { + t.step = 4; + }, + }, + (t) => { + ((t.paused = e.paused), (t.df = e.df)); + }, + ), + ]; + case 4: + return [ + triggerableSpriteSheet.Single( + { + fileName: "images/level/boss2/death/explosion.png", + columns: 3, + rows: 3, + frameRate: 6, + width: 437, + height: 437, + x: -20, + y: -10, + paused: e.paused, + df: e.df, + hideOnEnd: true, + }, + (t) => { + ((t.paused = e.paused), (t.df = e.df)); + }, + ), ]; - case "virtual": - case "world3Red": - case "synthwave": - case "arrows": - case "dreamy": - case "speed": - return []; - case "world4": - case "world4Boss": - case "world4Red": - return Vg(t.size.fullHeight / 2, e.theme.id); - case "skater": - return jg; - case "fighter": - return Gg; } - })(); - var bg = [ - conditional( - () => e.plain, - () => [ - conditional( - () => e.theme.id === "speed", - () => [ - p( + }, + ), + ], + }), + fg = makeSprite({ + render({ getContext: e, props: t }) { + const { animationAssets: a, animationRenderer: i } = t.spineContext || e(Ws); + return [ + onChange( + () => t.gunView, + () => { + switch (t.gunView) { + case "up": + case "toUp": + return [ + Hs( { - color: e.theme.colour, - width: t.size.fullWidth, - height: t.size.fullHeight, + id: "Up", + animationAssets: a, + animationRenderer: i, + animationName: "out", + fileNames: Qs.spineFiles.bossSpaceGun, + startFromFrame: "toUp" === t.gunView ? 0 : 9999, + loop: false, + paused: t.paused, + df: t.df, + x: 0, + y: 0, + height: 30, }, - (k) => { - ((k.color = e.theme.colour), - (k.width = t.size.fullWidth), - (k.height = t.size.fullHeight)); + (e) => { + ((e.paused = t.paused), (e.df = t.df), (e.scale = { + x: t.scale || 1, + y: t.scale || 1 + })); }, ), - Go.Single( + ]; + case "down": + case "toDown": + return [ + Hs( { - targetOpacity: e.speedMultiplier / 10, - sprite: (e) => [ - p( - { - color: "#9D0808", - width: t.size.fullWidth, - height: t.size.fullHeight, - }, - (a) => { - ((a.opacity = e.ref), - (a.width = t.size.fullWidth), - (a.height = t.size.fullHeight)); - }, - ), - ], + id: "Down", + animationAssets: a, + animationRenderer: i, + animationName: "in", + fileNames: Qs.spineFiles.bossSpaceGun, + startFromFrame: "toDown" === t.gunView ? 0 : 9999, + loop: false, + paused: t.paused, + df: t.df, + x: 0, + y: 0, + height: 30, }, - (t) => { - t.targetOpacity = Math.min( - 0.5, - e.speedMultiplier / 10, - ); + (e) => { + ((e.paused = t.paused), (e.df = t.df), (e.scale = { + x: t.scale || 1, + y: t.scale || 1 + })); }, ), - ], - () => [ - conditional( - () => e.theme.id === "dreamy", - () => [ - p( - { - color: e.theme.colour, - width: t.size.fullWidth, - height: t.size.fullHeight, - }, - (k) => { - ((k.color = e.theme.colour), - (k.width = t.size.fullWidth), - (k.height = t.size.fullHeight)); - }, - ), - jo.Single( - { - shouldShow: - e.switchBlockSpikes == - (globalPlayerScale == 1), - initShow: - e.switchBlockSpikes == - (globalPlayerScale == 1), - fadeFrames: 15, - sprite: (a) => [ - p( - { - color: "#250B05", - width: t.size.fullWidth, - height: t.size.fullHeight, - }, - (k) => { - ((k.opacity = a.ref), - (k.width = t.size.fullWidth), - (k.height = t.size.fullHeight)); - }, - ), - ], - }, - (t) => { - t.shouldShow = - e.switchBlockSpikes == - (globalPlayerScale == 1); - }, - ), - ], - () => [ - p( - { - color: - e.theme.id == "classic" - ? e.bgColor || "#00FFFF" - : e.theme.colour, - width: t.size.fullWidth, - height: t.size.fullHeight, - }, - (k) => { - ((k.color = - e.theme.id == "classic" - ? e.bgColor || "#00FFFF" - : e.theme.colour), - (k.width = t.size.fullWidth), - (k.height = t.size.fullHeight)); - }, - ), + ]; + case "shoot": + return [ + Hs( + { + id: "Fire", + animationAssets: a, + animationRenderer: i, + animationName: "fire", + fileNames: Qs.spineFiles.bossSpaceGun, + loop: false, + paused: t.paused, + df: t.df, + x: 0, + y: 0, + height: 30, + }, + (e) => { + ((e.paused = t.paused), (e.df = t.df), (e.scale = { + x: t.scale || 1, + y: t.scale || 1 + })); + }, + ), + ]; + } + }, + ), + ]; + }, + }), + yg = makeSprite({ + render: ({ props: e }) => [ + conditional( + () => e.asteroid.destroyed, + () => [ + qa.Single( + { + trail: { + form: "default", + topColour: "#868a99", + bottomColour: "#3a3a43", + }, + paused: e.paused, + df: e.df, + justDestroyed: true, + playerRot: 0, + sfx: false, + playerScale: 1, + }, + (t) => { + const a = e.bossState; + ((t.x = e.asteroid.x), + (t.y = e.asteroid.y), + (t.paused = e.paused), + (t.df = e.df)); + }, + ), + ], + () => [y( + { + fileName: `images/level/boss3/asteroid${e.asteroid.radius <= 15 + ? "60" + : e.asteroid.radius <= 25 + ? "120" + : "210" + }.png`, + width: 2.4 * e.asteroid.radius, + height: 2.4 * e.asteroid.radius, + }, + (t) => { + ((t.x = e.asteroid.x), + (t.y = e.asteroid.y), + (t.rotation = e.asteroid.x + e.frame)); + }, + )] + ) + ], + }), + Eg = makeSprite({ + render({ props: e }) { + const t = + "topEntry" === e.tile.type + ? -1 + : "bottomExit" === e.tile.type + ? 1 + : 0; + return [ + t + ? y( + { + fileName: `images/level/boss3/tiles/${e.tile.type}Glow.png`, + width: 404, + height: 675, + }, + (a) => { + a.x = e.tile.x + (104 * t) / 2; + }, + ) + : null, + y( + { + fileName: `images/level/boss3/tiles/${e.tile.type}.png`, + width: vl, + height: 675, + }, + (t) => { + t.x = e.tile.x; + }, + ), + ]; + }, + }), + bg = makeSprite({ + render: ({ props: e }) => [ + Hs( + { + id: "Minion", + animationAssets: e.animationAssets, + animationRenderer: e.animationRenderer, + animationName: "animation", + fileNames: Qs.spineFiles.world4BossMinion, + loop: true, + paused: e.paused, + df: e.df, + x: e.xVal, + y: e.yVal - 5, + height: 10, + batchLength: e.batchLength, + batchIndex: e.batchIndex, + }, + (t) => { + ((t.paused = e.paused), + (t.df = e.df), + (t.x = e.xVal), + (t.y = e.yVal - 5), + (t.batchLength = e.batchLength), + (t.batchIndex = e.batchIndex)); + }, + ), + ], + }), + Sg = makeSprite({ + render: ({ props: e }) => [ + Hs( + { + id: "Fireball", + animationAssets: e.animationAssets, + animationRenderer: e.animationRenderer, + animationName: "animation", + fileNames: Qs.spineFiles.world4BossFireBall, + loop: true, + paused: e.paused, + df: e.df, + x: e.xVal, + y: e.yVal + 3, + height: 10, + batchLength: e.batchLength, + batchIndex: e.batchIndex, + }, + (t) => { + ((t.paused = e.paused), + (t.df = e.df), + (t.x = e.xVal), + (t.y = e.yVal + 3), + (t.batchLength = e.batchLength), + (t.batchIndex = e.batchIndex)); + }, + ), + ], + }), + Ig = makeSprite({ + render({ props: e, device: t }) { + const a = Array.from({ length: 25 }).map((e, t) => 38 * t); + return e.narrowLines + ? [ + f({ + props: () => ({ + fillColor: e.color, + path: [ + [0, 0], + [0, 0], + [0, 0], + ], + }), + update: (a, i) => { + const n = (i - e.playerX) % 950, + s = (n < 0 ? n + 950 : n) - 475, + o = s, + r = e.offsetY, + l = 4 * s, + c = -t.size.fullHeight / 2; + ((a.path[0][0] = o), + (a.path[0][1] = r), + (a.path[1][0] = l - e.thickness / 2), + (a.path[1][1] = c), + (a.path[2][0] = l + e.thickness / 2), + (a.path[2][1] = c), + (a.fillColor = e.color)); + }, + array: () => a, + }), + ] + : [ + f({ + props: () => ({ + color: e.color, + path: [ + [0, 0], + [0, 0], + ], + }), + update: (a, i) => { + const n = (i - e.playerX) % 950, + s = (n < 0 ? n + 950 : n) - 475, + o = s, + r = e.offsetY, + l = 4 * s, + c = -t.size.fullHeight / 2; + ((a.path[0][0] = o), + (a.path[0][1] = r), + (a.path[1][0] = l), + (a.path[1][1] = c), + (a.color = e.color)); + }, + array: () => a, + }), + ]; + }, + }), + _g = makeSprite({ + init: ({ device: e, props: t }) => ({ + ash: Array.from({ length: 20 }).map(() => ({ + x: + st(-e.size.fullWidth / 2, e.size.fullWidth / 2, e.random) + + t.moveX, + localX: 0, + y: st(-e.size.fullHeight / 2, e.size.fullHeight / 2, e.random), + speedX: 0, + speedY: e.random() + 1, + })), + }), + loop({ props: e, state: t, device: a }) { + if (e.paused) return; + const i = a.size.fullWidth / 2, + n = a.size.fullHeight / 2; + for (const s of t.ash) { + ((s.y -= s.speedY), + s.y < -n && + ((s.y += a.size.fullHeight + 10), + (s.speedX = 0), + (s.x = + st( + -a.size.fullWidth / 2, + a.size.fullWidth / 2, + a.random, + ) + e.moveX)), + (s.speedX += (a.random() - 0.5) / 4), + (s.x += s.speedX), + (s.localX = s.x - e.moveX)); + const t = -i - 30, + o = i + 30; + for (; s.localX < t;) + ((s.x += a.size.fullWidth + 45), (s.localX = s.x - e.moveX)); + for (; s.localX > o;) + ((s.x -= a.size.fullWidth + 45), (s.localX = s.x - e.moveX)); + } + }, + render: ({ state: e, device: t }) => [ + imageArray({ + fileName: "images/themes/speed/ash.png", + props: () => ({ + width: 6, + height: 3, + rotation: 360 * t.random(), + }), + update: (e, t) => { + ((e.x = t.localX), (e.y = t.y)); + }, + array: () => e.ash, + }), + ], + }), + arrowsBGTable = function () { + return { + "#FF0000": "#ff1212", + "#ffea00": "#ffeb12", + "#00FF00": "#12ff1a", + "#0000ff": "#12e3ff", + "#8000ff": "#b412ff", + "#ff00ff": "#fb12ff", + "#ffFFff": "#FFFFFF", + "#000000": "#000000", + }; + }, + //arrows + arrowTheme = makeSprite({ + init({ device: e }) { + const t = [], + a = be.rectTouchesRect({ + x: 0, + y: 0, + width: e.size.fullWidth, + height: e.size.fullHeight, + }); + return { + rects: Tg.flatMap((i, n) => + i + .map((i, s) => { + const o = 57 * s - 475, + r = 337.5 - 54 * n, + l = a({ x: o, y: r, width: 57, height: 54 }); + if (0 === i || !l) return null; + if ((n <= 4 || n >= 9) && s % 3 != 0) { + const a = e.random() < 0.5; + return ( + t.push({ + x: o, + y: r, + fade: a ? 0 : 1, + fadeIn: a, + timeout: Math.round(600 * e.random()), + colour: n > 6 ? Rg[12 - n] : Rg[n], + }), + null + ); + } + return { x: o, y: r, colour: n > 6 ? Rg[12 - n] : Rg[n] }; + }) + .filter(nt), + ), + fadeRects: t, + }; + }, + loop({ state: e, device: t, props: a }) { + a.paused || + e.fadeRects.forEach((e) => { + e.timeout > 0 + ? e.timeout-- + : e.fadeIn + ? e.fade < 1 + ? (e.fade += 0.01) + : ((e.fade = 1), + (e.fadeIn = !1), + (e.timeout = Math.round(600 * t.random()))) + : e.fade > 0 + ? (e.fade -= 0.01) + : ((e.fade = 0), + (e.fadeIn = !0), + (e.timeout = Math.round(600 * t.random()))); + }); + }, + render: ({ device: d, state: t, props: a }) => [ + Go.Single( + { + targetOpacity: 1, + targetColor: arrowsBGTable()[a.bgColor] || "#1254FF", + sprite: (s, k) => [ + p( + { + color: k.ref, + width: d.size.fullWidth, + height: d.size.fullHeight, + opacity: 1, + }, + (j) => ( + (j.width = d.size.fullWidth), + (j.height = d.size.fullHeight), + (j.color = k.ref), + (j.opacity = 1) + ), + ), + ], + }, + (t) => { + t.targetOpacity = 1; + t.targetColor = arrowsBGTable()[a.bgColor] || "#1254FF"; + }, + ), + g({ + props: (e) => ({ + color: e.colour, + width: 54, + height: 51, + x: e.x, + y: e.y, + }), + array: () => t.rects, + }), + g({ + props: (e) => ({ + color: e.colour, + width: 54, + height: 51, + x: e.x, + y: e.y, + }), + update: (e, t) => { + e.opacity = t.fade; + }, + array: () => t.fadeRects, + }), + ], + }), + tileSprite = makeSprite({ + init: ({ props: { playerX, playerY }, device: { random } }) => { + const a = random() < 0.5; + return { + x: playerX, + y: playerY, + max: 960, + fade: a ? 0 : 1, + fadeIn: a, + timeout: Math.round(100 * random()), + }; + }, + loop({ + state: e, + props: { playerX: t, playerY: a }, + device: { random }, + }) { + e.x = t; + e.y = a; + if (e.x < -e.max) { + while (e.x < -e.max) { + e.x += e.max * 2; + } + } else if (e.x > e.max) { + while (e.x > e.max) { + e.x -= e.max * 2; + } + } + if (e.y < -e.max) { + while (e.y < -e.max) { + e.y += e.max * 2; + } + } else if (e.y > e.max) { + while (e.y > e.max) { + e.y -= e.max * 2; + } + } + e.paused || e.timeout > 0 + ? e.timeout-- + : e.fadeIn + ? e.fade < 1 + ? (e.fade += 0.01) + : ((e.fade = 1), + (e.fadeIn = !1), + (e.timeout = Math.round(100 * random()))) + : e.fade > 0 + ? (e.fade -= 0.01) + : ((e.fade = 0), + (e.fadeIn = !0), + (e.timeout = Math.round(100 * random()))); + }, + render: ({ props: e, state: t }) => [ + p({ color: e.color, width: e.width, height: e.height }, (a) => { + a.color = e.color; + a.x = t.x; + a.y = t.y; + a.opacity = t.fade; + }), + ], + }), + Tg = [ + [0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1], + [0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0], + [0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1], + [1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1], + [0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0], + [1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1], + [0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], + [1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1], + [1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1], + [1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1], + [1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1], + [0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1], + ], + Rg = [ + //hsla(223, 100%, 54%, 1.00) + "rgba(0, 0, 0, 0.45)", //"rgba(11, 45, 168, 1)", + "rgba(0, 0, 0, 0.38)", //"rgba(11, 45, 168, 1)" + "rgba(0, 0, 0, 0.36)", //"rgba(11, 47, 168, 1)" + "rgba(0, 0, 0, 0.34)", //"hsla(227, 87%, 36%, 1.00)", + "rgba(0, 0, 0, 0.35)", //"hsla(227, 86%, 39%, 1.00)" + "rgba(0, 0, 0, 0.31)", //"hsla(227, 85%, 42%, 1.00)" + "rgba(0, 0, 0, 0.29)", //"hsla(228, 84%, 44%, 1.00)", + ]; + function Og(e, t, a) { + const i = e.createShader(t); + if ( + (e.shaderSource(i, a), + e.compileShader(i), + e.getShaderParameter(i, e.COMPILE_STATUS)) + ) + return i; + throw Error(e.getShaderInfoLog(i) || ""); + } + const dreamySprite = makeNativeSprite("ShaderBg"), + createShaderBg = { + create: ({ props: props }) => { + const gl = document + .getElementById("replay-canvas") + .getContext("webgl"); + if (!gl) return null; + const a = gl.getExtension("OES_vertex_array_object"); + if (!a) return null; + const i = (function (e, t, a) { + const i = Og(e, e.VERTEX_SHADER, t), + n = Og(e, e.FRAGMENT_SHADER, a), + s = e.createProgram(); + if ( + (e.attachShader(s, i), + e.attachShader(s, n), + e.linkProgram(s), + e.getProgramParameter(s, e.LINK_STATUS)) + ) + return s; + throw Error(e.getProgramInfoLog(s) || ""); + })(gl, kg, Ng), + n = a.createVertexArrayOES(); + if (!n) return null; + a.bindVertexArrayOES(n); + const s = gl.getAttribLocation(i, "a_position"), + o = gl.createBuffer(); + (gl.bindBuffer(gl.ARRAY_BUFFER, o), + gl.enableVertexAttribArray(s), + gl.vertexAttribPointer(s, 2, gl.FLOAT, false, 0, 0), + gl.bufferData( + gl.ARRAY_BUFFER, + new Float32Array([-1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1]), + gl.STATIC_DRAW, + )); + const r = gl.getUniformLocation(i, "u_resolution"), + l = gl.getUniformLocation(i, "u_time"), + c = gl.getUniformLocation(i, "u_ct"), + d = gl.getUniformLocation(i, "u_xboost"), + u = gl.getUniformLocation(i, "u_yboost"), + h = gl.getUniformLocation(i, "u_col0"), + p = gl.getUniformLocation(i, "u_col1"), + g = gl.getUniformLocation(i, "u_col2"); + a.bindVertexArrayOES(null); + const m = [0.43, 0.04, 0.64], + f = [0.08, 0.02, 0.61], + y = [0.67, 0.03, 0.65], + E = [0.03, 0.11, 0.14], + b = [0.62, 0.17, 0.11], + S = [0.21, 0.05, 0.04], + finish1 = [0, 0, 0], + finish2 = [0, 0, 0], + finish3 = [0, 0, 0]; + function T(e, t, a) { + return 0.5 * (1 + Math.cos(0.017453292519943295 * e)) * t + a; + } + return { + render: (frame, bgSwitchTimer) => { + (gl.useProgram(i), + a.bindVertexArrayOES(n), + gl.uniform2f(r, gl.canvas.width, gl.canvas.height)); + const o = (frame / 20) * 1.25; + (gl.uniform1f(l, o), + gl.uniform1f(c, T(5 * o, 3, 1.1)), + gl.uniform1f(d, T(0.2 * o, 5, 5)), + gl.uniform1f(u, T(0.1 * o, 10, 5)), + Ag(f, E, bgSwitchTimer, finish1), + Ag(m, S, bgSwitchTimer, finish2), + Ag(y, b, bgSwitchTimer, finish3), + gl.uniform3f(h, ...finish1), + gl.uniform3f(p, ...finish2), + gl.uniform3f(g, ...finish3), + gl.drawArrays(gl.TRIANGLES, 0, 6)); + }, + bgSwitchTimer: props.lesserSwitch ? props.bgSwitch ? 0.7 : 0.2 : props.bgSwitch ? 1 : 0, + cleanup: () => { + (gl.deleteBuffer(o), + gl.deleteProgram(i), + a.deleteVertexArrayOES(n)); + }, + }; + }, + loop: ({ state: e, props: t }) => { + let min = t.lesserSwitch ? 0.2 : 0, + max = t.lesserSwitch ? 0.7 : 1; + e.bgSwitchTimer = Math.round(e.bgSwitchTimer * 10) / 10 + e && + (e.render(t.frame, e.bgSwitchTimer), + t.bgSwitch + ? e.bgSwitchTimer < max ? (e.bgSwitchTimer += 0.1) : (e.bgSwitchTimer > max && (e.bgSwitchTimer -= 0.1)) + : e.bgSwitchTimer > min ? (e.bgSwitchTimer -= 0.1) : (e.bgSwitchTimer < min && (e.bgSwitchTimer += 0.1)) + ); + }, + cleanup: ({ state: e }) => { + null == e || e.cleanup(); + }, + }; + function Ag(color, other, fraction, final) { + ((final[0] = color[0] * (1 - fraction) + other[0] * fraction), + (final[1] = color[1] * (1 - fraction) + other[1] * fraction), + (final[2] = color[2] * (1 - fraction) + other[2] * fraction)); + } + //var bgColor = "#69c5ff"; + const kg = + "\nprecision mediump float;\n\nattribute vec4 a_position;\n\nvoid main() {\n gl_Position = a_position;\n}\n", + Ng = + "\nprecision mediump float;\n\nuniform vec2 u_resolution;\nuniform float u_time;\nuniform float u_ct;\nuniform float u_xboost;\nuniform float u_yboost;\n\nuniform vec3 u_col0;\nuniform vec3 u_col1;\nuniform vec3 u_col2;\n\n#define RADIANS 0.017453292519943295\n\nconst int zoom = 3;\nconst float brightness = 0.975;\nfloat fScale = 1.25;\n\nfloat cosRange(float degrees, float range, float minimum) {\n return (((1.0 + cos(degrees * RADIANS)) * 0.5) * range) + minimum;\n}\n\nvoid main() {\n vec2 uv = fract(gl_FragCoord.xy / u_resolution);\n\n vec2 p = (2.0 * gl_FragCoord.xy - u_resolution.xy) / max(u_resolution.x, u_resolution.y);\n\n fScale = cosRange(u_time * 15.5, 1.25, 0.5);\n\n for(int i = 1; i < zoom; i++) {\n float _i = float(i);\n vec2 newp = p;\n newp.x += 0.25/ _i * sin(_i * p.y + u_time * cos(u_ct) * 0.5 / 20.0 + 0.005 * _i) * fScale + u_xboost;\n newp.y += 0.25/ _i * sin(_i * p.x + u_time * u_ct * 0.3 / 40.0 + 0.03 * float(i+15)) * fScale + u_yboost;\n p = newp;\n }\n\n vec3 col = vec3(0.5 * sin(3.0 * p.x) + 0.5, 0.5 * sin(3.0 * p.y) + 0.5, sin(p.x + p.y));\n col *= brightness;\n\n vec3 finalColor = (col.r + col.b) * u_col1 + col.g * u_col2;\n\n gl_FragColor = vec4(\n clamp(finalColor.r, u_col0.r, u_col2.r),\n clamp(finalColor.g, u_col0.g, u_col2.g),\n clamp(finalColor.b, u_col0.b, u_col2.b),\n 1.0);\n}\n", + basicBGcover = (e, t) => + Go.Single( + { + targetOpacity: (e.bgColor || "#00FFFF") == "#00FFFF" ? 0 : 0.5, + targetColor: e.bgColor || "#00FFFF", + sprite: (s, k) => [ + p( + { + color: k.ref, + width: t.size.fullWidth, + height: t.size.fullHeight, + opacity: s.ref, + }, + (j) => ( + (j.width = t.size.fullWidth), + (j.height = t.size.fullHeight), + (j.color = k.ref), + (j.opacity = s.ref) + ), + ), + ], + }, + (t) => { + t.targetOpacity = + (e.bgColor || "#00FFFF") == "#00FFFF" ? 0 : 0.5; + t.targetColor = e.bgColor || "#00FFFF"; + }, + ), + rangeAsArray = (start, end) => + Array.from({ length: end - start + 1 }, (_, i) => start + i), + infiniteTiles = rangeAsArray(-16, 17).map((y) => + rangeAsArray(-16, 17).map((e) => [e * 60, y * 60]), + ), + + xg = makeSprite({ + render({ props: e, device: t }) { + const a = (() => { + switch (e.theme.background) { + case "world1": + case "world1Boss": + return Fg(t.size.fullHeight / 2, e.theme.id); + case "red": + return Ug; + case "world2": + case "world2Red": + case "world3Red": + case "world3": + return [ + { + fileName: `images/themes/world3/background/${e.theme.id == "world3Red" ? "red" : "pink" + }-triangle.png`, + }, + ]; + case "virtual": + case "world3Red": + case "synthwave": + case "arrows": + case "dreamy": + case "speed": + return []; + case "world4": + case "world4Boss": + case "world4Red": + return Vg(t.size.fullHeight / 2, e.theme.id); + case "skater": + return jg; + case "fighter": + return Gg; + } + })(); + var bg = [ + conditional( + () => e.plain, + () => [ + conditional( + () => e.theme.id === "speed", + () => [ + p( + { + color: e.theme.colour, + width: t.size.fullWidth, + height: t.size.fullHeight, + }, + (k) => { + ((k.color = e.theme.colour), + (k.width = t.size.fullWidth), + (k.height = t.size.fullHeight)); + }, + ), + Go.Single( + { + targetOpacity: e.speedMultiplier / 10, + sprite: (e) => [ p( { - color: "black", + color: "#9D0808", width: t.size.fullWidth, height: t.size.fullHeight, - opacity: e.theme.id == "classic" ? 0.2 : 0, }, - (k) => { - ((k.width = t.size.fullWidth), - (k.height = t.size.fullHeight), - (k.opacity = - e.theme.id == "classic" ? 0.2 : 0)); + (a) => { + ((a.opacity = e.ref), + (a.width = t.size.fullWidth), + (a.height = t.size.fullHeight)); }, ), ], - ), - ], - ), - ], - () => { - //*() - var b = (() => { - switch (e.theme.background) { - case "world1": - case "world1Boss": - var bgTable = { - "#FF0000": "#290202", - "#ffea00": "#292802", - "#00FF00": "#01170B", - "#00FFFF": "#050229", - "#0000ff": "#022829", - "#8000ff": "#190229", - "#ff00ff": "#290224", - "#ffFFff": "#FFFFFF", - "#000000": "#000000", - }; - return [ - Go.Single( - { - targetOpacity: 1, - targetColor: bgTable[e.bgColor] || "#050229", - sprite: (s, k) => [ - p( - { - color: k.ref, - width: t.size.fullWidth, - height: t.size.fullHeight, - opacity: s.ref, - }, - (j) => ( - (j.width = t.size.fullWidth), - (j.height = t.size.fullHeight), - (j.color = k.ref), - (j.opacity = s.ref) - ), - ), - ], - }, - (t) => { - t.targetOpacity = 1; - t.targetColor = - bgTable[e.bgColor] || - t.targetColor || - "#050229"; - }, - ), - rg.Array({ - props: (e) => ({ - moveX: 0, - moveY: 0, - element: e, - halfDeviceHeight: t.size.fullHeight / 2, - halfDeviceWidth: t.size.fullWidth / 2, - }), - update: (a, i) => { - ((a.moveX = e.cameraX * i.speed), - (a.moveY = e.cameraY * i.speed), - (a.halfDeviceHeight = t.size.fullHeight / 2), - (a.halfDeviceWidth = t.size.fullWidth / 2)); - }, - array: () => a, - key: (e, t) => t, - }), - "world1Boss" === e.theme.id - ? p( + }, + (t) => { + t.targetOpacity = Math.min( + 0.5, + e.speedMultiplier / 10, + ); + }, + ), + ], + () => [ + conditional( + () => e.theme.id === "dreamy", + () => [ + p( + { + color: e.theme.colour, + width: t.size.fullWidth, + height: t.size.fullHeight, + }, + (k) => { + ((k.color = e.theme.colour), + (k.width = t.size.fullWidth), + (k.height = t.size.fullHeight)); + }, + ), + jo.Single( + { + shouldShow: + e.switchBlockSpikes == + (globalPlayerScale == 1), + initShow: + e.switchBlockSpikes == + (globalPlayerScale == 1), + fadeFrames: 15, + sprite: (a) => [ + p( { - color: "", - gradient: { - type: "linearVert", - colors: ["#810202", "#01170B"], - height: t.size.fullHeight, - }, + color: "#250B05", width: t.size.fullWidth, height: t.size.fullHeight, - opacity: 0.6, }, - (e) => { - ((e.width = t.size.fullWidth), - (e.height = t.size.fullHeight), - (e.gradient.height = t.size.fullHeight)); + (k) => { + ((k.opacity = a.ref), + (k.width = t.size.fullWidth), + (k.height = t.size.fullHeight)); }, - ) - : Go.Single( + ), + ], + }, + (t) => { + t.shouldShow = + e.switchBlockSpikes == + (globalPlayerScale == 1); + }, + ), + ], + () => [ + p( + { + color: + e.theme.id == "classic" + ? e.bgColor || "#00FFFF" + : e.theme.colour, + width: t.size.fullWidth, + height: t.size.fullHeight, + }, + (k) => { + ((k.color = + e.theme.id == "classic" + ? e.bgColor || "#00FFFF" + : e.theme.colour), + (k.width = t.size.fullWidth), + (k.height = t.size.fullHeight)); + }, + ), + p( + { + color: "black", + width: t.size.fullWidth, + height: t.size.fullHeight, + opacity: e.theme.id == "classic" ? 0.2 : 0, + }, + (k) => { + ((k.width = t.size.fullWidth), + (k.height = t.size.fullHeight), + (k.opacity = + e.theme.id == "classic" ? 0.2 : 0)); + }, + ), + ], + ), + ], + ), + ], + () => { + //*() + var b = (() => { + switch (e.theme.background) { + case "world1": + case "world1Boss": + var bgTable = { + "#FF0000": "#290202", + "#ffea00": "#292802", + "#00FF00": "#01170B", + "#00FFFF": "#050229", + "#0000ff": "#022829", + "#8000ff": "#190229", + "#ff00ff": "#290224", + "#ffFFff": "#FFFFFF", + "#000000": "#000000", + }; + return [ + Go.Single( + { + targetOpacity: 1, + targetColor: bgTable[e.bgColor] || "#050229", + sprite: (s, k) => [ + p( { - targetOpacity: - bgTable[e.bgColor] == undefined ? 0 : 0.6, - targetColor: - bgTable[e.bgColor] || "#050229", - sprite: (s, k) => [ - p( - { - color: k.ref, - width: t.size.fullWidth, - height: t.size.fullHeight, - opacity: s.ref, - }, - (j) => ( - (j.width = t.size.fullWidth), - (j.height = t.size.fullHeight), - (j.color = k.ref), - (j.opacity = s.ref) - ), - ), - ], - }, - (t) => { - t.targetOpacity = - (bgTable[e?.bgColor] || "#050229") == - "#050229" - ? 0 - : 0.6; - t.targetColor = - bgTable[e?.bgColor] || - t.targetColor || - "#050229"; + color: k.ref, + width: t.size.fullWidth, + height: t.size.fullHeight, + opacity: s.ref, }, + (j) => ( + (j.width = t.size.fullWidth), + (j.height = t.size.fullHeight), + (j.color = k.ref), + (j.opacity = s.ref) + ), ), - ]; - case "red": { - const i = 1920 / 1080, - { bgWidth: n, bgHeight: s } = Mg( - i, - t.size.fullWidth, - t.size.fullHeight, - ); - return [ - y( - { - fileName: - "images/themes/red/background/background.png", - width: n, - height: s, - }, - (e) => { - const { bgWidth: a, bgHeight: n } = Mg( - i, - t.size.fullWidth, - t.size.fullHeight, - ); - ((e.width = a), (e.height = n)); - }, - ), - rg.Array({ - props: (e) => ({ - moveX: 0, - moveY: 0, - element: e, - halfDeviceHeight: t.size.fullHeight / 2, - halfDeviceWidth: t.size.fullWidth / 2, - }), - update: (a, i) => { - ((a.moveX = e.cameraX * i.speed), - (a.moveY = e.cameraY * i.speed), - (a.halfDeviceHeight = t.size.fullHeight / 2), - (a.halfDeviceWidth = t.size.fullWidth / 2)); - }, - array: () => a, - key: (e, t) => t, + ], + }, + (t) => { + t.targetOpacity = 1; + t.targetColor = + bgTable[e.bgColor] || + t.targetColor || + "#050229"; + }, + ), + rg.Array({ + props: (e) => ({ + moveX: 0, + moveY: 0, + element: e, + halfDeviceHeight: t.size.fullHeight / 2, + halfDeviceWidth: t.size.fullWidth / 2, }), - ]; - } - case "world2": - return [ - p( - { - color: "#5A20BE", - width: t.size.fullWidth, - height: t.size.fullHeight, - }, - (e) => { - ((e.width = t.size.fullWidth), - (e.height = t.size.fullHeight)); - }, - ), - p( - { - color: "#7E38B5", - width: t.size.fullWidth, - height: 402, - anchorY: -201, - y: -337.5, - }, - (e) => { - e.width = t.size.fullWidth; - }, - ), - dg.Single( - { - fileName: - "images/themes/world2/background/BG_01.png", - playerX: 0.15 * e.cameraX, - playerY: 0.15 * e.cameraY, - height: 140, - y: 132.5, - }, - (t) => { - ((t.playerX = 0.15 * e.cameraX), - (t.playerY = 0.15 * e.cameraY)); - }, - ), - p( - { - color: "#C05082", - width: t.size.fullWidth, - height: 324, - anchorY: -162, - y: -337.5, - }, - (e) => { - e.width = t.size.fullWidth; - }, - ), - dg.Single( - { - fileName: - "images/themes/world2/background/BG_02.png", - playerX: 0.2 * e.cameraX, - playerY: 0.2 * e.cameraY, - height: 153, - y: 60, - }, - (t) => { - ((t.playerX = 0.2 * e.cameraX), - (t.playerY = 0.2 * e.cameraY)); - }, - ), - p( - { - color: "#7E38B5", - width: t.size.fullWidth, - height: 298, - anchorY: -149, - y: -337.5, - }, - (e) => { - e.width = t.size.fullWidth; - }, - ), - dg.Single( - { - fileName: - "images/themes/world2/background/BG_03.png", - playerX: 0.25 * e.cameraX, - playerY: 0.25 * e.cameraY, - height: 159, - y: 36, - }, - (t) => { - ((t.playerX = 0.25 * e.cameraX), - (t.playerY = 0.25 * e.cameraY)); - }, - ), - p( - { - color: "#5A20BE", - width: t.size.fullWidth, - height: 238, - anchorY: -119, - y: -337.5, - }, - (e) => { - e.width = t.size.fullWidth; - }, - ), - dg.Single( - { - fileName: - "images/themes/world2/background/BG_04.png", - playerX: 0.3 * e.cameraX, - playerY: 0.3 * e.cameraY, - height: 168, - y: -19, - }, - (t) => { - ((t.playerX = 0.3 * e.cameraX), - (t.playerY = 0.3 * e.cameraY)); - }, - ), - p( - { - color: "#3B178A", - width: t.size.fullWidth, - height: 126, - anchorY: -63, - y: -337.5, - }, - (e) => { - e.width = t.size.fullWidth; - }, - ), - dg.Single( - { - fileName: - "images/themes/world2/background/BG_05.png", - playerX: 0.35 * e.cameraX, - playerY: 0.35 * e.cameraY, - height: 253, - y: -88, - }, - (t) => { - ((t.playerX = 0.35 * e.cameraX), - (t.playerY = 0.35 * e.cameraY)); - }, - ), - basicBGcover(e, t), - ]; - case "world2Red": - return [ - p( + update: (a, i) => { + ((a.moveX = e.cameraX * i.speed), + (a.moveY = e.cameraY * i.speed), + (a.halfDeviceHeight = t.size.fullHeight / 2), + (a.halfDeviceWidth = t.size.fullWidth / 2)); + }, + array: () => a, + key: (e, t) => t, + }), + "world1Boss" === e.theme.id + ? p( { - color: "#722431", + color: "", + gradient: { + type: "linearVert", + colors: ["#810202", "#01170B"], + height: t.size.fullHeight, + }, width: t.size.fullWidth, height: t.size.fullHeight, + opacity: 0.6, }, (e) => { ((e.width = t.size.fullWidth), - (e.height = t.size.fullHeight)); - }, - ), - p( - { - color: "#C42B33", - width: t.size.fullWidth, - height: 402, - anchorY: -201, - y: -337.5, - }, - (e) => { - e.width = t.size.fullWidth; - }, - ), - dg.Single( - { - fileName: "images/themes/world2Red/BG_01.png", - playerX: 0.15 * e.cameraX, - playerY: 0.15 * e.cameraY, - height: 140, - y: 132.5, - }, - (t) => { - ((t.playerX = 0.15 * e.cameraX), - (t.playerY = 0.15 * e.cameraY)); - }, - ), - p( - { - color: "#F45921", - width: t.size.fullWidth, - height: 324, - anchorY: -162, - y: -337.5, - }, - (e) => { - e.width = t.size.fullWidth; - }, - ), - dg.Single( - { - fileName: "images/themes/world2Red/BG_02.png", - playerX: 0.2 * e.cameraX, - playerY: 0.2 * e.cameraY, - height: 153, - y: 60, - }, - (t) => { - ((t.playerX = 0.2 * e.cameraX), - (t.playerY = 0.2 * e.cameraY)); - }, - ), - p( - { - color: "#C42B33", - width: t.size.fullWidth, - height: 298, - anchorY: -149, - y: -337.5, - }, - (e) => { - e.width = t.size.fullWidth; + (e.height = t.size.fullHeight), + (e.gradient.height = t.size.fullHeight)); }, - ), - dg.Single( + ) + : Go.Single( { - fileName: "images/themes/world2Red/BG_03.png", - playerX: 0.25 * e.cameraX, - playerY: 0.25 * e.cameraY, - height: 159, - y: 36, + targetOpacity: + bgTable[e.bgColor] == undefined ? 0 : 0.6, + targetColor: + bgTable[e.bgColor] || "#050229", + sprite: (s, k) => [ + p( + { + color: k.ref, + width: t.size.fullWidth, + height: t.size.fullHeight, + opacity: s.ref, + }, + (j) => ( + (j.width = t.size.fullWidth), + (j.height = t.size.fullHeight), + (j.color = k.ref), + (j.opacity = s.ref) + ), + ), + ], }, (t) => { - ((t.playerX = 0.25 * e.cameraX), - (t.playerY = 0.25 * e.cameraY)); + t.targetOpacity = + (bgTable[e?.bgColor] || "#050229") == + "#050229" + ? 0 + : 0.6; + t.targetColor = + bgTable[e?.bgColor] || + t.targetColor || + "#050229"; }, ), - p( - { - color: "#722431", - width: t.size.fullWidth, - height: 238, - anchorY: -119, - y: -337.5, - }, - (e) => { - e.width = t.size.fullWidth; - }, - ), - dg.Single( - { - fileName: "images/themes/world2Red/BG_04.png", - playerX: 0.3 * e.cameraX, - playerY: 0.3 * e.cameraY, - height: 168, - y: -19, - }, - (t) => { - ((t.playerX = 0.3 * e.cameraX), - (t.playerY = 0.3 * e.cameraY)); - }, - ), - p( - { - color: "#3D1D2E", - width: t.size.fullWidth, - height: 126, - anchorY: -63, - y: -337.5, - }, - (e) => { - e.width = t.size.fullWidth; - }, - ), - dg.Single( - { - fileName: "images/themes/world2Red/BG_05.png", - playerX: 0.35 * e.cameraX, - playerY: 0.35 * e.cameraY, - height: 253, - y: -88, - }, - (t) => { - ((t.playerX = 0.35 * e.cameraX), - (t.playerY = 0.35 * e.cameraY)); - }, - ), - basicBGcover(e, t), - ]; - case "world3": - case "virtual": - case "world3Red": - var bgTable = world3BgTable(); - const i = "world3Red" === e.theme.id, - v = false; //"virtual" === e.theme.id, - var n = - bgTable[e.bgColor] || (i ? "#a20e05" : "#40a5de"); - return [ - Go.Single( - { - targetOpacity: 1, - targetColor: - bgTable[e.bgColor] || - (i ? "#a20e05" : "#40a5de"), - sprite: (s, k) => [ - Hg.Single( - { isRed: i, isVirtual: v, bgColor: k.ref }, - (x) => { - x.bgColor = k.ref; - }, - ), - dg.Single( - { - fileName: - "images/themes/world3/background/cloud.png", - playerX: 0.01 * e.cameraX, - playerY: 0.01 * e.cameraY, - height: 356, - }, - (t) => { - ((t.playerX = 0.01 * e.cameraX), - (t.playerY = 0.01 * e.cameraY)); - }, - ), - dg.Single( - { - fileName: - "images/themes/world3/background/stars-moving.png", - playerX: 0.02 * e.cameraX, - playerY: 0.02 * e.cameraY, - height: 240, - }, - (t) => { - ((t.playerX = 0.02 * e.cameraX), - (t.playerY = 0.02 * e.cameraY)); - }, - ), - qg.Single({ paused: e.paused }, (x) => { - x.paused = e.paused; - }), - Xg.Single( - { isRed: i, isVirtual: v, bgColor: k.ref }, - (x) => { - x.bgColor = k.ref; - }, - ), - Ig.Single( - { - color: k.ref, - narrowLines: true, - opacity: 0.5, - thickness: 4, - playerX: 0.04 * e.cameraX, - offsetY: -100, - }, - (t) => { - t.playerX = 0.04 * e.cameraX; - t.color = k.ref; - }, - ), - Ig.Single( - { - color: k.ref, - narrowLines: true, - opacity: 0.5, - thickness: 4, - playerX: 0.04 * e.cameraX, - offsetY: -100, - scaleY: -1, - }, - (t) => { - t.playerX = 0.04 * e.cameraX; - t.color = k.ref; - }, - ), - ], - }, - (t) => { - t.targetOpacity = 1; - t.targetColor = - bgTable[e.bgColor] || - (i ? "#a20e05" : "#40a5de"); - }, - ), - - rg.Array({ - props: (j) => ({ - moveX: e.cameraX * Dg, - moveY: e.cameraY * Dg, - element: { - fileName: `images/themes/world3/background/${ - i ? "red" : "pink" - }-triangle.png`, - speed: Dg, - width: 252, - height: 279, - xRangeMin: 300, - xRangeMax: 600, - yMin: t.size.fullHeight / 4 + 170, - yMax: t.size.fullHeight / 2 + 80, - dontMoveY: true, - spinning: true, - }, - halfDeviceHeight: t.size.fullHeight / 2, - halfDeviceWidth: t.size.fullWidth / 2, - }), - update: (a) => { - ((a.moveX = e.cameraX * Dg), - (a.moveY = e.cameraY * Dg), - (a.halfDeviceHeight = t.size.fullHeight / 2), - (a.halfDeviceWidth = t.size.fullWidth / 2), - (a.element.yMin = - t.size.fullHeight / 4 + 170), - (a.element.yMax = - t.size.fullHeight / 2 + 80)); - }, - array: () => a, - key: (e, t) => t, - }), - Go.Single( - { - targetOpacity: (e.speedMultiplier - 1) / 10, - sprite: (e) => [ - p( - { - color: "#9D0808", - width: t.size.fullWidth, - height: t.size.fullHeight, - }, - (a) => { - ((a.opacity = e.ref), - (a.width = t.size.fullWidth), - (a.height = t.size.fullHeight)); - }, - ), - ], - }, - (t) => { - t.targetOpacity = Math.min( - 0.5, - (e.speedMultiplier - 1) / 10, - ); - }, - ), - Go.Single( - { - targetOpacity: (1 - e.speedMultiplier) / 10, - sprite: (e) => [ - p( - { - color: "#40a5de", - width: t.size.fullWidth, - height: t.size.fullHeight, - }, - (a) => { - ((a.opacity = e.ref), - (a.width = t.size.fullWidth), - (a.height = t.size.fullHeight)); - }, - ), - ], - }, - (t) => { - t.targetOpacity = Math.min( - 0.5, - (1 - e.speedMultiplier) / 10, - ); - }, - ), - ]; - case "synthwave": - return [ - y({ + ]; + case "red": { + const i = 1920 / 1080, + { bgWidth: n, bgHeight: s } = Mg( + i, + t.size.fullWidth, + t.size.fullHeight, + ); + return [ + y( + { fileName: - "images/themes/synthwave/background.png", - width: 950, - height: 383, - anchorY: 191, - y: 337, + "images/themes/red/background/background.png", + width: n, + height: s, + }, + (e) => { + const { bgWidth: a, bgHeight: n } = Mg( + i, + t.size.fullWidth, + t.size.fullHeight, + ); + ((e.width = a), (e.height = n)); + }, + ), + rg.Array({ + props: (e) => ({ + moveX: 0, + moveY: 0, + element: e, + halfDeviceHeight: t.size.fullHeight / 2, + halfDeviceWidth: t.size.fullWidth / 2, }), - basicBGcover(e, t), - dg.Single( - { - fileName: - "images/themes/synthwave/mountains.png", - playerX: 0.04 * e.cameraX, - playerY: 0.04 * e.cameraY, - height: 259, - y: 56, - }, - (t) => { - ((t.playerX = 0.04 * e.cameraX), - (t.playerY = 0.04 * e.cameraY)); - }, - ), - zg.Single({}), - Ig.Single( - { - color: "#181d4c", - narrowLines: false, - playerX: 0.04 * e.cameraX, - thickness: 2, - offsetY: -65, - }, - (t) => { - t.playerX = 0.04 * e.cameraX; - t.color = "#181d4c"; - }, - ), - ]; - case "world4": - return [ - y({ + update: (a, i) => { + ((a.moveX = e.cameraX * i.speed), + (a.moveY = e.cameraY * i.speed), + (a.halfDeviceHeight = t.size.fullHeight / 2), + (a.halfDeviceWidth = t.size.fullWidth / 2)); + }, + array: () => a, + key: (e, t) => t, + }), + ]; + } + case "world2": + return [ + p( + { + color: "#5A20BE", + width: t.size.fullWidth, + height: t.size.fullHeight, + }, + (e) => { + ((e.width = t.size.fullWidth), + (e.height = t.size.fullHeight)); + }, + ), + p( + { + color: "#7E38B5", + width: t.size.fullWidth, + height: 402, + anchorY: -201, + y: -337.5, + }, + (e) => { + e.width = t.size.fullWidth; + }, + ), + dg.Single( + { fileName: - "images/themes/world4/background/background.png", - width: 950, - height: 514, - y: 81, - }), - rg.Array({ - props: (e) => ({ - moveX: 0, - moveY: 0, - element: e, - halfDeviceHeight: t.size.fullHeight / 2, - halfDeviceWidth: t.size.fullWidth / 2, - }), - update: (a, i) => { - ((a.moveX = e.cameraX * i.speed), - (a.moveY = e.cameraY * i.speed), - (a.halfDeviceHeight = t.size.fullHeight / 2), - (a.halfDeviceWidth = t.size.fullWidth / 2)); - }, - array: () => a, - key: (e, t) => t, - }), - y({ + "images/themes/world2/background/BG_01.png", + playerX: 0.15 * e.cameraX, + playerY: 0.15 * e.cameraY, + height: 140, + y: 132.5, + }, + (t) => { + ((t.playerX = 0.15 * e.cameraX), + (t.playerY = 0.15 * e.cameraY)); + }, + ), + p( + { + color: "#C05082", + width: t.size.fullWidth, + height: 324, + anchorY: -162, + y: -337.5, + }, + (e) => { + e.width = t.size.fullWidth; + }, + ), + dg.Single( + { fileName: - "images/themes/world4/background/castle.png", - width: 950, - height: 274, - y: -40, - }), - dg.Single( - { - fileName: - "images/themes/world4/background/front-mountain2.png", - playerX: 0.04 * e.cameraX, - playerY: 0.04 * e.cameraY, - height: 233, - y: -180, - }, - (t) => { - ((t.playerX = 0.04 * e.cameraX), - (t.playerY = 0.04 * e.cameraY)); - }, - ), - dg.Single( - { - fileName: - "images/themes/world4/background/front-mountain1.png", - playerX: 0.1 * e.cameraX, - playerY: 0.1 * e.cameraY, - height: 602, - y: -36, - }, - (t) => { - ((t.playerX = 0.1 * e.cameraX), - (t.playerY = 0.1 * e.cameraY)); - }, - ), - basicBGcover(e, t), - ]; - case "world4Boss": - case "world4Red": { - const i = - "world4Boss" === e.theme.id ? "boss" : "red"; - return [ - y({ - fileName: `images/themes/world4/${i}/background.png`, - width: 950, - height: 541, - y: 67, - }), - rg.Array({ - props: (e) => ({ - moveX: 0, - moveY: 0, - element: e, - halfDeviceHeight: t.size.fullHeight / 2, - halfDeviceWidth: t.size.fullWidth / 2, - }), - update: (a, i) => { - ((a.moveX = e.cameraX * i.speed), - (a.moveY = e.cameraY * i.speed), - (a.halfDeviceHeight = t.size.fullHeight / 2), - (a.halfDeviceWidth = t.size.fullWidth / 2)); - }, - array: () => a, - key: (e, t) => t, - }), - y({ - fileName: `images/themes/world4/${i}/castle.png`, - width: 855, - height: 345, - y: -50, - }), - dg.Single( - { - fileName: `images/themes/world4/${i}/front-mountain2.png`, - playerX: 0.04 * e.cameraX, - playerY: 0.04 * e.cameraY, - height: 206, - y: -190, - }, - (t) => { - ((t.playerX = 0.04 * e.cameraX), - (t.playerY = 0.04 * e.cameraY)); - }, - ), - dg.Single( - { - fileName: `images/themes/world4/${i}/front-mountain1.png`, - playerX: 0.1 * e.cameraX, - playerY: 0.1 * e.cameraY, - height: 565, - y: -55, - }, - (t) => { - ((t.playerX = 0.1 * e.cameraX), - (t.playerY = 0.1 * e.cameraY)); - }, - ), - basicBGcover(e, t), - ]; - } - case "skater": - return [ - y({ + "images/themes/world2/background/BG_02.png", + playerX: 0.2 * e.cameraX, + playerY: 0.2 * e.cameraY, + height: 153, + y: 60, + }, + (t) => { + ((t.playerX = 0.2 * e.cameraX), + (t.playerY = 0.2 * e.cameraY)); + }, + ), + p( + { + color: "#7E38B5", + width: t.size.fullWidth, + height: 298, + anchorY: -149, + y: -337.5, + }, + (e) => { + e.width = t.size.fullWidth; + }, + ), + dg.Single( + { fileName: - "images/themes/skater/background/sky.png", - width: 950, - height: 205, - y: 235, - }), - dg.Single( - { - fileName: - "images/themes/skater/background/distant-buildings2.png", - playerX: 0.005 * e.cameraX, - playerY: 0.005 * e.cameraY, - height: 111, - y: 169, - }, - (t) => { - ((t.playerX = 0.005 * e.cameraX), - (t.playerY = 0.005 * e.cameraY)); - }, - ), - dg.Single( - { - fileName: - "images/themes/skater/background/distant-buildings.png", - playerX: 0.01 * e.cameraX, - playerY: 0.01 * e.cameraY, - height: 138, - y: 144, - }, - (t) => { - ((t.playerX = 0.01 * e.cameraX), - (t.playerY = 0.01 * e.cameraY)); - }, - ), - rg.Array({ - props: (e) => ({ - moveX: 0, - moveY: 0, - element: e, - halfDeviceHeight: t.size.fullHeight / 2, - halfDeviceWidth: t.size.fullWidth / 2, - }), - update: (a, i) => { - ((a.moveX = e.cameraX * i.speed), - (a.moveY = e.cameraY * i.speed), - (a.halfDeviceHeight = t.size.fullHeight / 2), - (a.halfDeviceWidth = t.size.fullWidth / 2)); - }, - array: () => a, - key: (e, t) => t, - }), - dg.Single( - { - fileName: - "images/themes/skater/background/hedges.png", - playerX: 0.02 * e.cameraX, - playerY: 0.02 * e.cameraY, - height: 74, - y: 100, - }, - (t) => { - ((t.playerX = 0.02 * e.cameraX), - (t.playerY = 0.02 * e.cameraY)); - }, - ), - dg.Single( - { - fileName: - "images/themes/skater/background/sky-buildings.png", - playerX: 0.05 * e.cameraX, - playerY: 0.05 * e.cameraY, - height: 300, - y: 183, - }, - (t) => { - ((t.playerX = 0.05 * e.cameraX), - (t.playerY = 0.05 * e.cameraY)); - }, - ), - dg.Single( - { - fileName: - "images/themes/skater/background/ground-buildings.png", - playerX: 0.1 * e.cameraX, - playerY: 0.1 * e.cameraY, - height: 515, - y: -80, - }, - (t) => { - ((t.playerX = 0.1 * e.cameraX), - (t.playerY = 0.1 * e.cameraY)); - }, - ), - basicBGcover(e, t), - ]; - case "arrows": - return [ - arrowTheme.Single( - { paused: false, bgColor: e.bgColor }, - (t) => { - t.paused = e.paused; - t.bgColor = e.bgColor; - }, - ), - ]; - case "dreamy": - return [ - p( - { - color: e.theme.colour, - width: t.size.fullWidth, - height: t.size.fullHeight, - }, - (j) => ( - (j.width = t.size.fullWidth), - (j.height = t.size.fullHeight) - ), - ), - dreamySprite( - { - id: "ShaderBg", - frame: e.frame, - bgSwitch: - e.switchBlockSpikes, - lesserSwitch: e.playerScale < 1 - }, - (t) => { - ((t.frame = e.frame), - (t.bgSwitch = - e.switchBlockSpikes), - (t.lesserSwitch = e.playerScale < 1)); - }, - ), - ]; - case "classic": - return [ - Go.Single( - { - targetOpacity: 1, - targetColor: e.bgColor || "#00FFFF", - sprite: (s, k) => [ - p( - { - color: k.ref, - width: t.size.fullWidth, - height: t.size.fullHeight, - opacity: 1, - }, - (j) => ( - (j.width = t.size.fullWidth), - (j.height = t.size.fullHeight), - (j.color = k.ref), - (j.opacity = 1) - ), - ), - ], - }, - (t) => { - t.targetOpacity = 1; - t.targetColor = e.bgColor || "#00FFFF"; - }, - ), - dg.Single( - { - fileName: - "images/themes/classic/background/fade.png", - playerX: 0, - playerY: 0, - height: t.size.fullHeight, - y: 50, - }, - (t) => { - ((t.playerX = 0), (t.playerY = 0)); - }, - ), - ]; - case "infinite": - let infiniteTileSprites = []; - return [ - Go.Single( - { - targetOpacity: 1, - targetColor: infiniteBgTable(0, e.bgColor), - sprite: (s, l) => [ - Go.Single( - { - targetOpacity: 1, - targetColor: infiniteBgTable( - 1, - e.bgColor, - ), - sprite: (s, d) => { - infiniteTileSprites = []; - infiniteTiles.map((tiles) => - tiles.map((tile) => - infiniteTileSprites.push( - tileSprite.Single( - { - color: d.ref, - width: 60, - height: 60, - playerX: - -0.05 * e.cameraX + tile[0], - playerY: - -0.05 * e.cameraY + tile[1], - }, - (t) => { - ((t.color = d.ref), - (t.playerX = - -0.05 * e.cameraX + - tile[0]), - (t.playerY = - -0.05 * e.cameraY + - tile[1])); - }, - ), - ), - ), - ); - return [ - p( - { - color: l.ref, - width: t.size.fullWidth, - height: t.size.fullHeight, - }, - (e) => { - ((e.width = t.size.fullWidth), - (e.height = t.size.fullHeight), - (e.color = l.ref)); - }, - ), - ...infiniteTileSprites, - ]; - }, - }, - (t) => { - t.targetOpacity = 1; - t.targetColor = - infiniteBgTable(1, e.bgColor) || - "#76d7d6"; - }, - ), - ], - }, - (t) => { - t.targetOpacity = 1; - t.targetColor = - infiniteBgTable(0, e.bgColor) || "#89dde1"; - }, - ), - ]; - case "fighter": - return [ - p( - { - color: "#0a0353", - width: t.size.fullWidth, - height: t.size.fullHeight, - }, - (e) => { - ((e.width = t.size.fullWidth), - (e.height = t.size.fullHeight)); - }, - ), - dg.Single( - { - fileName: - "images/themes/punch/background/BG_05.png", - playerX: 0.03 * e.cameraX, - playerY: 0.03 * e.cameraY, - height: 140, - y: 158, - }, - (t) => { - ((t.playerX = 0.03 * e.cameraX), - (t.playerY = 0.03 * e.cameraY)); - }, - ), - dg.Single( - { - fileName: - "images/themes/punch/background/BG_04.png", - playerX: 0.05 * e.cameraX, - playerY: 0.05 * e.cameraY, - height: 132, - y: 85, - }, - (t) => { - ((t.playerX = 0.05 * e.cameraX), - (t.playerY = 0.05 * e.cameraY)); - }, - ), - dg.Single( - { - fileName: - "images/themes/punch/background/BG_03.png", - playerX: 0.06 * e.cameraX, - playerY: 0.06 * e.cameraY, - height: 212, - y: 71, - }, - (t) => { - ((t.playerX = 0.06 * e.cameraX), - (t.playerY = 0.06 * e.cameraY)); - }, - ), - dg.Single( - { - fileName: - "images/themes/punch/background/BG_02.png", - playerX: 0.07 * e.cameraX, - playerY: 0.07 * e.cameraY, - height: 167, - y: 26, - }, - (t) => { - ((t.playerX = 0.07 * e.cameraX), - (t.playerY = 0.07 * e.cameraY)); - }, - ), - dg.Single( - { - fileName: - "images/themes/punch/background/BG_01.png", - playerX: 0.08 * e.cameraX, - playerY: 0.08 * e.cameraY, - height: 138, - y: -23, - }, - (t) => { - ((t.playerX = 0.08 * e.cameraX), - (t.playerY = 0.08 * e.cameraY)); - }, - ), - y({ + "images/themes/world2/background/BG_03.png", + playerX: 0.25 * e.cameraX, + playerY: 0.25 * e.cameraY, + height: 159, + y: 36, + }, + (t) => { + ((t.playerX = 0.25 * e.cameraX), + (t.playerY = 0.25 * e.cameraY)); + }, + ), + p( + { + color: "#5A20BE", + width: t.size.fullWidth, + height: 238, + anchorY: -119, + y: -337.5, + }, + (e) => { + e.width = t.size.fullWidth; + }, + ), + dg.Single( + { fileName: - "images/themes/punch/background/moon.png", - width: 77, - height: 77, - x: 200, - y: 120, - }), - rg.Array({ - props: (e) => ({ - moveX: 0, - moveY: 0, - element: e, - halfDeviceHeight: t.size.fullHeight / 2, - halfDeviceWidth: t.size.fullWidth / 2, - }), - update: (a, i) => { - ((a.moveX = e.cameraX * i.speed), - (a.moveY = e.cameraY * i.speed), - (a.halfDeviceHeight = t.size.fullHeight / 2), - (a.halfDeviceWidth = t.size.fullWidth / 2)); - }, - array: () => a, - key: (e, t) => t, - }), - dg.Single( - { - fileName: - "images/themes/punch/background/water.png", - playerX: 0 * e.cameraX, - playerY: 0 * e.cameraY, - height: 177, - y: -100, - }, - (t) => { - ((t.playerX = 0 * e.cameraX), - (t.playerY = 0 * e.cameraY)); - }, - ), - y({ + "images/themes/world2/background/BG_04.png", + playerX: 0.3 * e.cameraX, + playerY: 0.3 * e.cameraY, + height: 168, + y: -19, + }, + (t) => { + ((t.playerX = 0.3 * e.cameraX), + (t.playerY = 0.3 * e.cameraY)); + }, + ), + p( + { + color: "#3B178A", + width: t.size.fullWidth, + height: 126, + anchorY: -63, + y: -337.5, + }, + (e) => { + e.width = t.size.fullWidth; + }, + ), + dg.Single( + { fileName: - "images/themes/punch/background/Building_01.png", - width: 213, - height: 178, - x: -200, - y: 20, - }), - dg.Single( - { - fileName: - "images/themes/punch/background/ground.png", - playerX: 0.03 * e.cameraX, - playerY: 0.03 * e.cameraY, - height: 370, - y: -165, - }, - (t) => { - ((t.playerX = 0.03 * e.cameraX), - (t.playerY = 0.03 * e.cameraY)); - }, - ), - ]; - case "speed": - return [ - p( - { - color: "#1B222D", - width: t.size.fullWidth, - height: t.size.fullHeight / 2, - y: t.size.fullHeight / 4, - }, - (e) => { - ((e.width = t.size.fullWidth), - (e.height = t.size.fullHeight / 2), - (e.y = t.size.fullHeight / 4)); - }, - ), - y({ - fileName: "images/themes/speed/moon.png", - width: 217, - height: 162, - y: 100, - }), - Go.Single( - { - targetOpacity: e.speedMultiplier / 5, - sprite: (e) => [ - y( - { - fileName: - "images/themes/speed/red_moon.png", - width: 217, - height: 162, - y: 100, - }, - (t) => { - t.opacity = e.ref; - }, - ), - ], - }, - (t) => { - t.targetOpacity = e.speedMultiplier / 5; - }, - ), - dg.Single( - { - fileName: "images/themes/speed/plan1.png", - playerX: 0.04 * e.cameraX, - playerY: 0.04 * e.cameraY, - height: 380, - y: -147.5, - }, - (t) => { - ((t.playerX = 0.04 * e.cameraX), - (t.playerY = 0.04 * e.cameraY)); - }, - ), - Go.Single( - { - targetOpacity: e.speedMultiplier / 10, - sprite: (e) => [ - p( - { - color: "#9D0808", - width: t.size.fullWidth, - height: t.size.fullHeight, - }, - (a) => { - ((a.opacity = e.ref), - (a.width = t.size.fullWidth), - (a.height = t.size.fullHeight)); - }, - ), - ], - }, - (t) => { - t.targetOpacity = Math.min( - 0.5, - e.speedMultiplier / 10, - ); - }, - ), - ]; - } - })(); - //*() - b.push( - Go.Single( - { - targetOpacity: e.flash, - sprite: (s) => [ - p( - { - color: "#FFFFFF", - width: t.size.fullWidth, - height: t.size.fullHeight, - }, - (a) => { - ((a.opacity = e.flash), - (a.width = t.size.fullWidth), - (a.height = t.size.fullHeight)); - }, - ), - ], - }, - (t) => { - t.targetOpacity = e.flash; - }, - ), - ); - return b; - }, - ), - ]; - return bg; - }, - }), - Pg = makeSprite({ - render({ props: e, device: t }) { - const a = (() => { - switch (e.theme.id) { - case "world1": - case "world1Boss": - return Yg(e.theme.id, e.cameraX); - default: - return []; - } - })(); - return [ - "arrows" === e.theme.id - ? Ho.Single( - { - x: e.playerX - e.cameraX, - y: et.initialPosition.y - e.cameraY, - playerYRelative: e.playerY - et.initialPosition.y, - isBlank: e.theme.objects.block == "blank", - }, - (t) => { - ((t.x = e.playerX - e.cameraX), - (t.y = et.initialPosition.y - e.cameraY), - (t.playerYRelative = - e.playerY - et.initialPosition.y)); - }, - ) - : null, - ifConditional( - () => !e.plain, - () => { - switch (e.theme.id) { - case "world1": - case "world1Boss": - return [ - rg.Array({ - props: (e) => ({ - moveX: 0, - moveY: 0, - element: e, - halfDeviceHeight: t.size.fullHeight / 2, - halfDeviceWidth: t.size.fullWidth / 2, - }), - update: (a, i) => { - ((i.xRangeMax = - 1700 + e.cameraX / 1700 / i.speed), - (a.moveX = e.cameraX * i.speed), - (a.moveY = e.cameraY * i.speed), - (a.halfDeviceHeight = t.size.fullHeight / 2), - (a.halfDeviceWidth = t.size.fullWidth / 2)); + "images/themes/world2/background/BG_05.png", + playerX: 0.35 * e.cameraX, + playerY: 0.35 * e.cameraY, + height: 253, + y: -88, }, - array: () => a, - key: (e, t) => t, - }), - ]; - case "speed": - return [ - _g.Single( - { moveX: e.cameraX, paused: e.paused }, (t) => { - ((t.moveX = e.cameraX), (t.paused = e.paused)); + ((t.playerX = 0.35 * e.cameraX), + (t.playerY = 0.35 * e.cameraY)); }, ), + basicBGcover(e, t), ]; - default: - return []; - } - }, - ), - ]; - }, - }); - function Mg(e, t, a) { - const i = t / a > e; - return { bgWidth: i ? t : a * e, bgHeight: i ? t / e : a }; - } - const Lg = 0.2, - Dg = 0.05, - Bg = 0.01, - Fg = (e, t) => [ - { - fileName: `images/themes/${t}/background/Blur02.png`, - speed: Bg, - width: 24, - height: 675, - xRangeMin: 1000, - xRangeMax: 1200, - yMin: 0, - yMax: 0, - dontMoveY: true, - opacity: 0.7, - }, - { - fileName: `images/themes/${t}/background/Dust.png`, - speed: Bg, - width: 500 / 3, - height: 883 / 3, - xRangeMin: 100, - xRangeMax: 200, - }, - { - fileName: `images/themes/${t}/background/Star01.png`, - speed: Bg, - width: 15, - height: 15, - xRangeMin: 100, - xRangeMax: 200, - }, - { - fileName: `images/themes/${t}/background/Star02.png`, - speed: Bg, - width: 76 / 3, - height: 64 / 3, - xRangeMin: 300, - xRangeMax: 400, - }, - { - fileName: `images/themes/${t}/background/Star03.png`, - speed: Bg, - width: 35 / 3, - height: 34 / 3, - xRangeMin: 500, - xRangeMax: 600, - }, - { - fileName: `images/themes/${t}/background/Flara01.png`, - speed: Bg, - width: 1453 / 3, - height: 1453 / 3, - xRangeMin: 1000, - xRangeMax: 1200, - }, - { - fileName: `images/themes/${t}/background/RectangleBG01.png`, - speed: Bg, - width: 635, - height: 71 / 3, - xRangeMin: 600, - xRangeMax: 800, - }, - { - fileName: `images/themes/${t}/background/RectangleBG04.png`, - speed: Bg, - width: 35, - height: 119, - xRangeMin: 400, - xRangeMax: 500, - }, - { - fileName: `images/themes/${t}/background/RectangleBG02.png`, - speed: Bg, - width: 1043 / 3, - height: 62 / 3, - xRangeMin: 600, - xRangeMax: 800, - opacity: 0.5, - }, - { - fileName: `images/themes/${t}/background/RectangleBG03.png`, - speed: Bg, - width: 194, - height: 17, - xRangeMin: 0, - xRangeMax: 100, - opacity: 0.7, - }, - { - fileName: `images/themes/${t}/background/Shape01.png`, - speed: Bg, - width: 58, - height: 576, - xRangeMin: 200, - xRangeMax: 300, - opacity: 0.7, - }, - { - fileName: `images/themes/${t}/background/Shape02.png`, - speed: Bg, - width: 87, - height: 489, - xRangeMin: 500, - xRangeMax: 700, - opacity: 0.5, - }, - { - fileName: `images/themes/${t}/background/Shape03.png`, - speed: Bg, - width: 71, - height: 212, - xRangeMin: 200, - xRangeMax: 300, - opacity: 0.5, - }, - { - fileName: `images/themes/${t}/background/Rectangle06.png`, - speed: Bg, - width: 132, - height: 1256 / 3, - xRangeMin: 800, - xRangeMax: 1000, - opacity: 0.5, - }, - { - fileName: `images/themes/${t}/background/RectangleLong.png`, - speed: Dg, - width: 658, - height: 352 / 3, - xRangeMin: 400, - xRangeMax: 500, - opacity: 0.7, - }, - { - fileName: `images/themes/${t}/background/Triangle01.png`, - speed: Dg, - width: 353 / 3, - height: 176 / 3, - xRangeMax: 1000, - xRangeMin: 800, - opacity: 0.7, - }, - { - fileName: `images/themes/${t}/background/Triangle02.png`, - speed: Dg, - yMin: 0.5 * e, - yMax: 0.9 * e, - width: 502 / 3, - height: 251 / 3, - xRangeMax: 1000, - xRangeMin: 800, - opacity: 0.7, - }, - { - fileName: `images/themes/${t}/background/Triangle03.png`, - speed: Dg, - width: 353 / 3, - height: 176 / 3, - xRangeMax: 1000, - xRangeMin: 800, - opacity: 0.7, - }, - { - fileName: `images/themes/${t}/background/Triangle04.png`, - speed: Dg, - width: 353 / 3, - height: 176 / 3, - xRangeMax: 600, - xRangeMin: 800, - opacity: 0.7, - }, - { - fileName: `images/themes/${t}/background/Triangle05.png`, - speed: Dg, - yMin: 0.5 * e, - yMax: 0.9 * e, - width: 502 / 3, - height: 251 / 3, - xRangeMax: 600, - xRangeMin: 800, - opacity: 0.7, - }, - { - fileName: `images/themes/${t}/background/Triangle06.png`, - speed: Dg, - width: 149 / 3, - height: 74 / 3, - xRangeMax: 1000, - xRangeMin: 800, - opacity: 0.7, - }, - { - fileName: `images/themes/${t}/background/Triangle07.png`, - speed: Dg, - width: 221 / 3, - height: 37, - xRangeMax: 1000, - xRangeMin: 800, - opacity: 0.7, - }, - { - fileName: `images/themes/${t}/background/Fence01.png`, - speed: Lg, - width: 1291 / 3, - height: 88 / 3, - xRangeMin: 700, - xRangeMax: 800, - }, - { - fileName: `images/themes/${t}/background/Fence02.png`, - speed: Lg, - width: 655 / 3, - height: 88 / 3, - xRangeMin: 700, - xRangeMax: 800, - }, - { - fileName: `images/themes/${t}/background/Fence03.png`, - speed: Lg, - width: 212, - height: 46 / 3, - xRangeMin: 700, - xRangeMax: 800, - }, - { - fileName: `images/themes/${t}/background/Fence04.png`, - speed: Lg, - width: 47, - height: 43 / 3, - xRangeMin: 700, - xRangeMax: 800, - }, - { - fileName: `images/themes/${t}/background/Blur01.png`, - speed: Bg, - width: 321, - height: 526, - xRangeMin: 400, - xRangeMax: 800, - yMin: 0.5 * e, - yMax: 0.9 * e, - }, - ], - Yg = (e, t) => [ - { - fileName: `images/themes/${e}/background/Triangle06.png`, - speed: 2, - width: 149 / 3, - height: 74 / 3, - xRangeMin: 1000, - xRangeMax: 1700 * t, - opacity: "world1Boss" === e ? 0.4 : 0.7, - }, - { - fileName: `images/themes/${e}/background/Triangle07.png`, - speed: 2, - width: 221 / 3, - height: 37, - xRangeMin: 1000, - xRangeMax: 1700 * t, - opacity: "world1Boss" === e ? 0.4 : 0.7, - }, - ], - Ug = [ - { - speed: 0.1, - fileName: "images/themes/red/background/background-red-dots.png", - width: 839.5, - height: 469.5, - xRangeMin: 500, - xRangeMax: 600, - }, - { - speed: 0.15, - fileName: - "images/themes/red/background/background-red-flame1.png", - width: 732, - height: 904, - xRangeMin: 500, - xRangeMax: 600, - }, - { - speed: 0.2, - fileName: - "images/themes/red/background/background-red-flame2.png", - width: 808, - height: 1080, - xRangeMin: 500, - xRangeMax: 600, - }, - ], - jg = [ - { - fileName: "images/themes/skater/background/cloud1.png", - speed: 0.03, - width: 220, - height: 42, - xRangeMin: 1000, - xRangeMax: 1000, - initXOffset: 1, - yMin: 240, - yMax: 300, - alternateY: false, - dontMoveY: true, - }, - { - fileName: "images/themes/skater/background/cloud2.png", - speed: 0.03, - width: 242, - height: 47, - xRangeMin: 1000, - xRangeMax: 1000, - initXOffset: 500, - yMin: 240, - yMax: 300, - alternateY: false, - dontMoveY: true, - }, - ], - Gg = [ - { - fileName: "images/themes/punch/background/cloud_01.png", - speed: 0.1, - width: 65, - height: 23, - xRangeMin: 100, - xRangeMax: 500, - initXOffset: 1, - yMin: 50, - yMax: 200, - alternateY: false, - dontMoveY: true, - }, - { - fileName: "images/themes/punch/background/cloud_02.png", - speed: 0.1, - width: 115, - height: 27, - xRangeMin: 100, - xRangeMax: 500, - initXOffset: 500, - yMin: 50, - yMax: 200, - alternateY: false, - dontMoveY: true, - }, - { - fileName: "images/themes/punch/background/cloud_03.png", - speed: 0.1, - width: 122, - height: 38, - xRangeMin: 100, - xRangeMax: 500, - initXOffset: 250, - yMin: 50, - yMax: 200, - alternateY: false, - dontMoveY: true, - }, - { - fileName: "images/themes/punch/background/cloud_04.png", - speed: 0.1, - width: 260, - height: 48, - xRangeMin: 100, - xRangeMax: 500, - initXOffset: 800, - yMin: 50, - yMax: 200, - alternateY: false, - dontMoveY: true, - }, - ], - Vg = (e, t) => { - const a = - "world4" === t - ? "background" - : "world4Red" === t - ? "red" - : "boss"; - return [ - { - fileName: `images/themes/world4/${a}/cloud1.png`, - speed: Bg, - width: 209, - height: 64, - xRangeMin: 600, - xRangeMax: 600, - initXOffset: 1, - yMin: 150, - yMax: 0.5 * e - 30, - alternateY: false, - dontMoveY: true, - }, - { - fileName: `images/themes/world4/${a}/cloud2.png`, - speed: Bg, - width: 193, - height: 67, - xRangeMin: 600, - xRangeMax: 600, - initXOffset: 300, - yMin: 0.5 * e + 30, - yMax: e - 60, - alternateY: false, - dontMoveY: true, - }, - ]; - }, - world3BgTable = function () { - return { - "#FF0000": "#a20e06", - "#ffea00": "#ebdc0c", - "#00FF00": "#65de40", - "#0000ff": "#2538e0", - "#8000ff": "#9f40de", - "#ff00ff": "#de40d1", - "#ffFFff": "#FFFFFF", - "#000000": "#000000", - }; - }, - Hg = makeSprite({ - render({ props: e, device: t }) { - const darker = (col, amt) => { - var num = parseInt(col.substring(1), 16); - var r = (num >> 16) / amt; - var b = ((num >> 8) & 0x00ff) / amt; - var g = (num & 0x0000ff) / amt; - var newColor = g | (b << 8) | (r << 16); - return "#" + newColor.toString(16); - }; - let bgColor = - e.bgColor == "#40a5de" || e.bgColor == "#a20e05" - ? undefined - : e.bgColor; - function calcColors(clr) { - return clr - ? [ - clr, - darker(clr, 4), - darker(clr, 6), - darker(clr, 6), - darker(clr, 4), - clr, - ] - : e.isRed - ? [ - "#840901", - "#260402", - "#170302", - "#170302", - "#260402", - "#840901", - ] - : [ - "#7D00EB", - "#210089", - "#050522", - "#050522", - "#050522", - "#050522", - "#210089", - "#7D00EB", - ]; - } - const a = { - type: "linearVert", - height: t.size.fullHeight, - colors: calcColors(bgColor), - }; - return [ - p( - { - color: { - type: "linearVert", - height: t.size.fullHeight, - colors: calcColors(bgColor), - }, - gradient: a, - width: t.size.fullWidth, - height: t.size.fullHeight, - }, - (a) => { - ((a.width = t.size.fullWidth), - (a.height = t.size.fullHeight), - (a.gradient = { - type: "linearVert", - height: t.size.fullHeight, - colors: calcColors( - e.bgColor == "#40a5de" || e.bgColor == "#a20e05" - ? undefined - : e.bgColor, - ), - })); // this might be a bad idea... - }, - ), - y({ - fileName: "images/themes/world3/background/stars-static.png", - width: 950, - height: 512, - }), - ]; - }, - }), - Xg = makeSprite({ - render({ props: props, device: t }) { - var a = props.isRed ? "#a20e05" : "#40a5de", - i = props.isRed ? 0.7 : 0.5; - return [ - ...Array.from({ length: 15 }).flatMap((e, n) => { - const s = 2 * Math.pow(n, 1.8); - return [ - m( - { - color: props.bgColor || a, - opacity: i, - path: [ - [-t.size.fullWidth / 2, 0], - [t.size.fullWidth / 2, 0], - ], - y: -s - 100, - thickness: 0.1 + s / 40, - }, - (t) => { - t.color = props.bgColor || a; - }, - ), - m( - { - color: props.bgColor || a, - opacity: i, - path: [ - [-t.size.fullWidth / 2, 0], - [t.size.fullWidth / 2, 0], - ], - y: s + 100, - thickness: 0.1 + s / 40, - }, - (t) => { - t.color = props.bgColor || a; - }, - ), - ]; - }), - ]; - }, - }), - zg = makeSprite({ - render: ({ device: e }) => [ - p( - { - color: "#000002", - width: e.size.fullWidth, - height: e.size.fullHeight / 2, - anchorY: e.size.fullHeight / 4, - y: -65, - }, - (t) => { - ((t.width = e.size.fullWidth), - (t.height = e.size.fullHeight / 2), - (t.anchorY = e.size.fullHeight / 4)); - }, - ), - onChange( - () => e.size.fullWidth, - () => [ - ...Array.from({ length: 10 }).flatMap((t, a) => { - const i = 0 === a ? 0 : 3 * Math.pow(a, 2) + 3; - return [ - m({ - color: "#181d4c", - path: [ - [-e.size.fullWidth / 2, 0], - [e.size.fullWidth / 2, 0], - ], - y: -i - 65, - thickness: 1 + i / 60, - }), - ]; - }), - ], - ), - ], - }), - Wg = (e) => { - const t = Math.round(700 * e() - 350), - a = Math.round(300 * e() - 150); - return { - startX: t, - startY: a, - x: t, - y: a, - speed: 2 + 2 * e(), - life: 30 + 30 * e(), - thickness: 1 + 2 * e(), - }; - }, - qg = makeSprite({ - init: ({ device: e }) => ({ - stars: [Wg(e.random)], - newStarTimer: 60, - }), - loop({ state: e, device: t, props: a }) { - if (!a.paused) { - (e.newStarTimer--, - e.newStarTimer <= 0 && - ((e.newStarTimer += 60 * t.random()), - e.stars.push(Wg(t.random)))); - for (const t of e.stars) - ((t.x -= 0.65 * t.speed), - (t.y -= 0.75 * t.speed), - t.life--, - (t.thickness *= 0.99)); - lt(e.stars, (e) => e.life > 0); - } - }, - render: ({ state: e }) => [ - $g.Array({ - props: (e) => { - const t = e.startX - e.x; - return { - width: t, - anchorXVal: t / 2, - xVal: e.startX, - height: e.thickness, - rotation: -40, - opacity: e.life / 120, - color: "", - gradient: { - type: "linearHoriz", - width: t, - colors: ["#838493", "#838493"], - opacities: [1, 0], - }, - }; - }, - update: (e, t) => { - ((e.width = t.startX - t.x), - (e.anchorXVal = e.width / 2), - (e.gradient.width = e.width), - (e.xVal = t.startX), - (e.height = t.thickness), - (e.opacity = t.life / 120)); - }, - array: () => e.stars, - key: (e, t) => t, - }), - ], - }), - $g = makeSprite({ - render: ({ props: e }) => [ - p({ height: e.height }, (t) => { - ((t.width = e.width), - (t.gradient = e.gradient), - (t.anchorX = e.anchorXVal), - (t.x = e.xVal)); - }), - ], - }), - Jg = { left: 0, up: 90, right: 180, down: 270 }, - Kg = makeSprite({ - init: () => ({ player2X: 0, player2Y: 0 }), - loop({ - props: { playerX: e, playerY: t, touchingPortals: a }, - state: i, - }) { - const [n, s] = a; - ((i.player2X = s.x - n.x), (i.player2Y = s.y - n.y)); - const o = "left" === n.direction || "right" === n.direction, - r = "left" === s.direction || "right" === s.direction; - if (n.direction === s.direction) - if (o) { - const t = s.x - (e + i.player2X); - i.player2X += 2 * t; - } else { - const e = s.y - (t + i.player2Y); - i.player2Y += 2 * e; - } - if (o !== r) { - const a = Jg[n.direction], - o = Jg[s.direction], - l = em(o - a), - c = e + i.player2X - s.x, - d = -(t + i.player2Y - s.y) * l, - u = c * l; - ((i.player2X = s.x - e + d), - (i.player2Y = s.y - t + u), - r || (i.player2X = s.x - e)); - } - }, - render: ({ props: e, state: t }) => [ - Qg.Single( - { - playerRot: e.playerRot, - playerScaleX: e.playerScaleX, - playerScaleY: e.playerScaleY, - playerDir: e.playerDir, - skin: e.skin, - landTimer: e.landTimer, - onSkateboard: e.onSkateboard, - playerScale: e.isCompatible ? 1 : e.playerScale, - isFlying: e.isFlying, - }, - (t) => { - ((t.playerRot = e.playerRot), - (t.playerScaleX = e.playerScaleX), - (t.playerScaleY = e.playerScaleY), - (t.playerScale = e.isCompatible ? 1 : e.playerScale), - (t.playerDir = e.playerDir), - (t.skin = e.skin), - (t.landTimer = e.landTimer), - (t.isInfinite = e.isInfinite), - (t.bgColor = e.bgColor), - (t.onSkateboard = e.onSkateboard), - (t.mask = circleMask( - Zg(e.touchingPortals[0], e.playerX, e.playerY), - ))); - }, - ), - Qg.Single( - { - playerRot: e.playerRot, - playerScaleX: e.playerScaleX, - playerScaleY: e.playerScaleY, - playerDir: e.playerDir, - skin: e.skin, - landTimer: e.landTimer, - onSkateboard: e.onSkateboard, - playerScale: e.isCompatible ? 1 : e.playerScale, - isFlying: e.isFlying, - }, - (a) => { - ((a.x = t.player2X), - (a.y = t.player2Y), - (a.playerRot = e.playerRot), - (a.playerScaleX = e.playerScaleX), - (a.playerScaleY = e.playerScaleY), - (a.playerScale = e.isCompatible ? 1 : e.playerScale), - (a.playerDir = e.playerDir), - (a.skin = e.skin), - (a.landTimer = e.landTimer), - (a.onSkateboard = e.onSkateboard), - (t.isInfinite = e.isInfinite), - (t.bgColor = e.bgColor), - (a.mask = circleMask( - Zg( - e.touchingPortals[1], - e.playerX + t.player2X, - e.playerY + t.player2Y, - ), - ))); - }, - ), - ], - }), - Qg = makeSprite({ - render: ({ props: e }) => [ - e.isFlying - ? y( - { - fileName: "images/level/boss3/player-ship.png", - width: 40, - height: 30, - }, - (t) => { - ((t.rotation = e.playerRot), - (t.scaleX = e.playerScaleX * e.playerDir), - (t.scaleY = e.playerScaleY)); - }, - ) - : To.Single( - { - skin: e.skin, - landTimer: e.landTimer, - onSkateboard: e.onSkateboard, - }, - (t) => { - ((t.rotation = e.playerRot), - (t.scaleX = e.playerScaleX * e.playerDir), - (t.scaleY = e.playerScaleY), - (t.skin = e.skin), - (t.landTimer = e.landTimer), - (t.isInfinite = e.isInfinite), - (t.bgColor = e.bgColor), - (t.onSkateboard = e.onSkateboard)); - }, - ), - ], - }), - Zg = (e, t, a) => { - const i = 150 - e.width / 2; - switch (e.direction) { - case "left": - case "right": - return { - x: ("left" === e.direction ? -1 : 1) * i + e.x - t, - y: e.y - a, - radius: 150, - }; - case "up": - case "down": - const n = ("down" === e.direction ? -1 : 1) * i; - return { x: e.x - t, y: n + e.y - a, radius: 150 }; - } - }, - em = (e) => (B.isEven((e + 90) / 180) ? -1 : 1), - tm = makeSprite({ - render: ({ props: e }) => [ - y( - { - fileName: `images/themes/${e.theme}/bottom/${e.object.type}.png`, - width: e.object.width, - height: e.object.height, - }, - (t) => { - ((t.x = e.object.x), (t.y = e.object.y)); - }, - ), - ], - }), - am = makeSprite({ - init: ({ props: e }) => ({ - fade: 0, - jumpOut: 0, - prevLocalScore: e.localScore, - prevMultiplier: e.multiplier, - }), - loop({ state: e, props: t }) { - t.localScore > 0 && !t.crashed - ? ((e.prevLocalScore = t.localScore), - (e.prevMultiplier = t.multiplier), - (e.fade = 10), - (e.jumpOut = 30)) - : e.jumpOut > 0 && !t.crashed - ? e.jumpOut-- - : e.fade > 0 && e.fade--; - }, - render: ({ state: e, props: t, device: a }) => [ - ifConditional( - () => t.highScore > 0, - () => [ - c( - { - text: `${localize("HIGH SCORE")}: ${t.highScore.toLocaleString()}`, - color: Te, - strokeColor: He, - strokeThickness: 4, - font: { size: 15, align: "left" }, - x: -a.size.fullWidth / 2 + 100, - y: a.size.fullHeight / 2 - 40, - }, - (e) => { - ((e.x = -a.size.fullWidth / 2 + 100), - (e.y = a.size.fullHeight / 2 - 40)); - }, - ), - ], - ), - c( - { - text: `${localize("SCORE")}: ${t.totalScore.toLocaleString()}`, - color: Te, - strokeColor: He, - strokeThickness: 4, - font: { size: 20, align: "left" }, - x: -a.size.fullWidth / 2 + 100, - y: a.size.fullHeight / 2 - (t.highScore > 0 ? 65 : 50), - }, - (e) => { - ((e.text = `${localize("SCORE")}: ${t.totalScore.toLocaleString()}`), - (e.x = -a.size.fullWidth / 2 + 100), - (e.y = - a.size.fullHeight / 2 - (t.highScore > 0 ? 65 : 50))); - }, - ), - ifConditional( - () => 0 !== e.fade, - () => [ - Lo.Single( - { - sprites: [ - c( - { - text: e.prevLocalScore.toLocaleString(), - color: Te, - strokeColor: He, - strokeThickness: 4, - font: { size: 25 }, - y: -135, - }, - (a) => { - a.text = e.prevLocalScore.toLocaleString(); - const i = t.localScore > 0 ? 1 : 1 + e.jumpOut / 60; - ((a.scaleX = i), (a.scaleY = i)); - }, - ), - ifConditional( - () => e.prevMultiplier > 1, - () => [ - c( - { - text: `x${e.prevMultiplier}`, - color: Te, - strokeColor: He, - strokeThickness: 4, - font: { size: 40 }, - y: -165, - }, - (t) => { - t.text = `x${e.prevMultiplier}`; - }, - ), - ], - ), - ], - }, - (t) => { - t.opacity = e.fade <= 10 ? e.fade / 10 : 1; - }, - ), - ], - ), - ], - }), - im = makeSprite({ - render: ({ props: e, device: t }) => [ - ifConditional( - () => e.highScore > 0, - () => [ - c( - { - text: `${localize("HIGH SCORE")}: ${e.highScore.toLocaleString()}`, - color: Te, - strokeColor: He, - strokeThickness: 4, - font: { size: 15, align: "left" }, - x: -t.size.fullWidth / 2 + 100, - y: t.size.fullHeight / 2 - 40, - }, - (e) => { - ((e.x = -t.size.fullWidth / 2 + 100), - (e.y = t.size.fullHeight / 2 - 40)); - }, - ), - ], - ), - c( - { - text: `${localize("SCORE")}: ${e.totalScore.toLocaleString()}`, - color: Te, - strokeColor: He, - strokeThickness: 4, - font: { size: 20, align: "left" }, - x: -t.size.fullWidth / 2 + 100, - y: t.size.fullHeight / 2 - (e.highScore > 0 ? 65 : 50), - }, - (a) => { - ((a.text = `${localize("SCORE")}: ${e.totalScore.toLocaleString()}`), - (a.x = -t.size.fullWidth / 2 + 100), - (a.y = - t.size.fullHeight / 2 - (e.highScore > 0 ? 65 : 50))); - }, - ), - ifConditional( - () => e.combo > 0, - () => [ - c( - { - color: Te, - strokeColor: He, - strokeThickness: 4, - font: { size: 24 }, - y: -165, - }, - (t) => { - t.text = `${e.combo} combo`; - }, - ), - ifConditional( - () => e.fullCombo, - () => [ - c( - { - color: Te, - strokeColor: He, - strokeThickness: 4, - font: { size: 24 }, - y: -130, - }, - (t) => { - t.text = localize(e.perfectCombo ? "PERFECT FC" : "FULL COMBO"); - }, - ), - ], - ), - ], - ), - ], - }), - nm = makeSprite({ - render: ({ props: e }) => [ - onChange( - () => e.hasStarted, - () => [ - sm.Array({ - props: (e) => e, - array: () => e.info.playerPropsBySkinFileName, - update: (e, { fileName: t, positionInfo: a }) => { - ((e.fileName = t), (e.positionInfo = a)); - }, - key: ({ fileName: e }) => e, - }), - ], - ), - ], - }), - sm = makeSprite({ - render: ({ props: e }) => [ - imageArray({ - fileName: `images/player/skins/dark/${e.fileName}.png`, - props: () => ({}), - update: (e, t) => { - ((e.x = t.x), - (e.y = t.y), - (e.width = t.width), - (e.height = t.height), - (e.rotation = t.rotation), - (e.scaleX = t.scaleX), - (e.scaleY = t.scaleY), - (e.opacity = t.opacity)); - }, - array: () => e.positionInfo, - testId: (e) => `OtherPlayer-${e.playerIndex}`, - }), - ], - }); - function om(e, t, a, i, n, s, o, r, l, c) { - const d = {}, - u = [], - h = [], - p = []; - let g = 10, - m = 0, - f = ""; - for (let y = 0; y < e.length; y++) { - const E = e[y]; - if (null === E || y === l) continue; - if ( - (d[E.skin.fileName] || (d[E.skin.fileName] = []), - E.x > n + o || E.x < n - o || E.y > s + r || E.y < s - r) - ) { - c && - (g--, - g > 0 && p.push({ x: E.x, y: E.y, username: E.username })); - continue; - } - let { x: b, y: S, rotation: I } = E; - (0 === E.deathTimer && - ((S = t[y]), a && ((b += E.speed * i), (I += E.rotSpeed * i))), - d[E.skin.fileName].push({ - x: b, - y: S, - width: E.skin.size, - height: E.skin.size, - rotation: I, - scaleX: E.scaleX, - scaleY: E.scaleY, - opacity: - E.deathTimer > 0 ? Math.max(0, 6 - E.deathTimer) / 6 : 1, - playerIndex: E.playerIndex, - })); - for (const e of E.playerStack) - d[E.skin.fileName].push({ - x: b, - y: e, - width: E.skin.size, - height: E.skin.size, - rotation: I, - scaleX: E.scaleX, - scaleY: E.scaleY, - opacity: 1, - playerIndex: E.playerIndex, - }); - b > n - 5 && b < n + 5 - ? E.deathTimer || (m++, (f = E.username)) - : (u.push({ color: ve, x: b, y: S + M + 8, text: E.username }), - h.push({ x: b, y: S + M - 2 })); - } - return { - playerPropsBySkinFileName: Object.entries(d).map(([e, t]) => ({ - fileName: e, - positionInfo: t, - })), - nameProps: u, - arrowProps: h, - otherPlayersWithSameX: m, - otherPlayerWithSameXName: f, - offCamera: p, - }; - } - const rm = makeSprite({ - render: ({ props: e }) => [ - imageArray({ - fileName: "images/online/name-arrow.png", - props: () => ({ width: 13, height: 8 }), - update: (e, t) => { - ((e.x = t.x), (e.y = t.y)); - }, - array: () => e.info.arrowProps, - }), - d({ - props: () => ({ color: ve }), - update: (e, t) => { - ((e.text = t.text), (e.x = t.x), (e.y = t.y)); - }, - array: () => e.info.nameProps, - }), - c({ color: ve, strokeColor: Ye, strokeThickness: 3 }, (t) => { - ((t.x = e.playerX), - (t.y = e.playerY + M + 8), - (t.text = - 0 === e.info.otherPlayersWithSameX || e.crashed - ? e.playerName - : 1 === e.info.otherPlayersWithSameX - ? `${e.playerName} & ${e.info.otherPlayerWithSameXName}` - : `${e.playerName} & ${e.info.otherPlayersWithSameX} OPPONENTS`)); - }), - ifConditional( - () => - (e.info.otherPlayersWithSameX > 0 || - e.info.nameProps.length > 5) && - !e.crashed, - () => [ - y( - { - fileName: "images/online/highlight-player.png", - width: 60, - height: 60, - }, - (t) => { - ((t.x = e.playerX), (t.y = e.playerY)); - }, - ), - ], - ), - y( - { - fileName: "images/level/arrow-down-stroke.png", - width: 15, - height: 10, - }, - (t) => { - ((t.x = e.playerX), (t.y = e.playerY + M - 2)); - }, - ), - ], - }), - lm = makeSprite({ - init: () => ({ - fade: 0, - text: "", - bestFrame: 0, - show: false, - didCrash: false, - }), - loop({ props: e, state: t }) { - // console.warn(e.frame); - if (!e.crashed) - return 0 !== t.fade - ? ((t.fade = 0), (t.show = false), void (t.didCrash = false)) - : t.show || t.didCrash - ? ((t.show = false), void (t.didCrash = false)) - : void 0; - if (!t.didCrash && (e.frame > t.bestFrame || !e.hasCheckpoints)) { - const a = Math.floor((e.frame / e.maxFrame) * 100); - if (a >= 10) - return ( - (t.fade = 0), - (t.text = `${a}%`), - (t.bestFrame = e.frame), - (t.show = true), - void (t.didCrash = true) - ); - } - if (t.fade < 10) - return ( - (t.fade = t.fade + 1), - (t.text = t.text), - (t.bestFrame = t.bestFrame), - (t.show = t.show), - void (t.didCrash = true) - ); - t.didCrash || (t.didCrash = true); - }, - render: ({ state: e }) => [ - ifConditional( - () => e.show, - () => [ - y( - { - fileName: "images/level/arrow-down-stroke.png", - width: 15, - height: 10, - y: -32, - rotation: 180, - }, - (t) => { - t.opacity = e.fade / 10; - }, - ), - c( - { - font: { size: 20 }, - strokeColor: Ye, - strokeThickness: 3, - color: "white", - y: -50, - }, - (t) => { - ((t.text = e.text), (t.opacity = e.fade / 10)); - }, - ), - ], - ), - ], - }), - renderGround = makeSprite({ - render({ props: e }) { - return [ - e.theme == "classic" - ? y( - { - fileName: "images/themes/classic/ground.png", - width: 500, - height: 2, - }, - (a) => { - a.y = et.initialPosition.y - M / 2 - e.cameraY - 1; - }, - ) - : e.theme == "infinite" - ? p( - { - width: 660 * 2, - height: 10, - x: 0, - color: getInfiniteThemeColors(e.bgColor) - }, - (a) => { - a.y = - et.initialPosition.y - M / 2 - e.cameraY - 5; - a.color = getInfiniteThemeColors(e.bgColor); - }, - ) - : y( - { - fileName: `images/themes/${e.theme}/${e.theme === "world1Boss" ? "block" : "boss"}.png`, - width: 660 * 2, - height: 30, - }, - (a) => { - a.y = et.initialPosition.y - M / 2 - e.cameraY - 15; - }, - )]; - }, - }), - cm = makeSprite({ - render: ({ device: e, props: t, getContext: a }) => { - let lastFrame = t.frame; - return [ - xg.Single( - { - theme: t.layout.properties.theme, - cameraX: t.cameraX, - cameraY: t.cameraY, - paused: t.paused, - switchBlockSpikes: t.switchBlockSpikes, - bgColor: t.bgColor, - flash: t.flash || 0, - speedMultiplier: t.playerSpeedMultiplier, - plain: a(Se).settings.plainBackground, - frame: t.frame, - jumpFrames: t.jumpFrames, - playerDir: t.playerDir, - crashed: t.crashed, - gravity: t.gravity, - dashing: t.dashing, - isGravity: t.isGravity, - }, - (e) => { - ((e.playerScale = t.playerScale), - (e.isGravity = t.isGravity), - (e.dashing = t.dashing), - (e.cameraX = t.cameraX), - (e.cameraY = t.cameraY), - (e.paused = t.paused), - (e.speedMultiplier = t.playerSpeedMultiplier), - (e.bgColor = t.bgColor), - (e.flash = t.flash || 0), - (e.gravity = t.gravity || 1), - (e.switchBlockSpikes = t.switchBlockSpikes), - (e.plain = a(Se).settings.plainBackground), - (e.frame = t.frame), - (e.jumpFrames = t.jumpFrames), - (e.playerDir = t.playerDir), - (e.crashed = t.crashed)); - }, - ), - ifConditional( - () => t.playerPowerups.some((e) => e.item === "spaceship"), - () => [ - y( - { - fileName: "images/level/boss3/star-line.png", - width: 950, - height: 50, - y: t.flyingAnchor - 45 - t.cameraY, - }, - (e) => { - e.y = t.flyingAnchor - 45 - t.cameraY; - }, - ), - y( - { - fileName: "images/level/boss3/star-line.png", - width: 950, - height: 50, - y: t.flyingAnchor + 45 - t.cameraY, - }, - (e) => { - e.y = t.flyingAnchor + 45 - t.cameraY; - }, - ), - dg.Single( - { - fileName: "images/level/boss3/star-line-stars.png", - playerX: t.cameraX, - playerY: 0, - height: 50, - y: t.flyingAnchor - 45 - t.cameraY, - }, - (e) => { - e.playerX = t.cameraX; - e.y = t.flyingAnchor - 45 - t.cameraY; - }, - ), - dg.Single( - { - fileName: "images/level/boss3/star-line-stars.png", - playerX: e.cameraX, - playerY: 0, - height: 50, - y: t.flyingAnchor + 45 - t.cameraY, - }, - (e) => { - e.playerX = t.cameraX; - e.y = t.flyingAnchor + 45 - t.cameraY; - }, - ), - ], - ), - t.bossState - ? hg.Single( - { bossState: t.bossState, playerX: t.playerX }, - (e) => { - ((e.bossState = t.bossState), (e.playerX = t.playerX)); - }, - ) - : null, - t.layout.properties.useGround && - isSpecialTheme(t.layout.properties.theme.id) - ? renderGround.Single( - { - cameraY: t.cameraY, - theme: t.layout.properties.theme.id, - }, - (a) => { - a.cameraY = t.cameraY; - a.theme = t.layout.properties.theme.id; - a.bgColor = t.bgColor; - }, - ) - : null, - - dm.Single( - { - frame: t.frame, - df: t.df, - attempt: t.attempt, - playerX: t.playerX, - playerY: t.playerY, - playerGradY: t.playerGradY, - playerRot: t.playerRot, - playerDir: t.playerDir, - playerScaleX: t.playerScaleX, - playerScaleY: t.playerScaleY, - checkpoints: t.checkpoints, - playerPowerups: t.playerPowerups, - isCompatible: t.isCompatible, - playerPowerupOut: t.playerPowerupOut, - playerBullets: t.playerBullets, - playerJetpackFuel: t.playerJetpackFuel, - playerUsingPowerup: t.playerUsingPowerup, - playerStacks: t.playerStacks, - playerStackIndex: t.playerStackIndex, - playerSkin: t.playerSkin, - playerJumping: t.playerJumping, - touchingPortals: t.touchingPortals, - justHitObject: t.justHitObject, - explosions: t.explosions, - bossState: t.bossState, - layout: t.layout, - layoutState: t.layoutState, - layoutStateIndex: t.layoutStateIndex, - jumpFrames: t.jumpFrames, - switchRotation: t.switchRotation, - switchBlockSpikes: t.switchBlockSpikes, - crashed: t.crashed, - paused: t.paused || !t.started, - finishedLevel: t.finishedLevel, - isFlyingLevel: t.isFlyingLevel, - bottomLineObjects: t.bottomLineObjects, - landTimer: t.landTimer, - hasCheckpoints: t.hasCheckpoints, - maxFrame: t.maxFrame, - playerName: t.playerName, - otherPlayersInfo: t.otherPlayersInfo, - x: -t.cameraX, - y: -t.cameraY, - hidePlayer: t.hidePlayer, - started: t.started, - playerScale: t.playerScale, - bgColor: t.bgColor, - flash: t.flash, - gravity: t.gravity, - dashing: t.dashing, - isGravity: t.isGravity, - cameraX: t.cameraX, - cameraY: t.cameraY, - cameraXOffset: t.cameraXOffset, - fallTypes: t.fallTypes, - flyingAnchor: t.flyingAnchor, - playerSpeedMultiplier: t.playerSpeedMultiplier, - boosterDebug: t.boosterDebug, - }, - (e) => { - ( - (e.boosterDebug = t.boosterDebug), - (e.playerSpeedMultiplier = t.playerSpeedMultiplier), - (e.cameraX = t.cameraX), - (e.cameraXOffset = t.cameraXOffset), - (e.cameraY = t.cameraY), - (e.isGravity = t.isGravity), - (e.flyingAnchor = t.flyingAnchor), - (e.dashing = t.dashing), - (e.frame = t.frame), - (e.df = t.df), - (e.attempt = t.attempt), - (e.playerX = t.playerX), - (e.playerY = t.playerY), - (e.playerGradY = t.playerGradY), - (e.playerRot = t.playerRot), - (e.playerDir = t.playerDir), - (e.playerScaleX = t.playerScaleX), - (e.playerScaleY = t.playerScaleY), - (e.playerScale = t.playerScale), - (e.playerPowerups = t.playerPowerups), - (e.isCompatible = t.isCompatible), - (e.playerPowerupOut = t.playerPowerupOut), - (e.playerBullets = t.playerBullets), - (e.playerJetpackFuel = t.playerJetpackFuel), - (e.playerUsingPowerup = t.playerUsingPowerup), - (e.playerStacks = t.playerStacks), - (e.playerStackIndex = t.playerStackIndex), - (e.playerSkin = t.playerSkin), - (e.playerJumping = t.playerJumping), - (e.touchingPortals = t.touchingPortals), - (e.justHitObject = t.justHitObject), - (e.explosions = t.explosions), - (e.bossState = t.bossState), - (e.layout = t.layout), - (e.layoutState = t.layoutState), - (e.layoutStateIndex = t.layoutStateIndex), - (e.jumpFrames = t.jumpFrames), - (e.switchRotation = t.switchRotation), - (e.switchBlockSpikes = t.switchBlockSpikes), - (e.crashed = t.crashed), - (e.paused = t.paused || !t.started), - (e.finishedLevel = t.finishedLevel), - (e.bottomLineObjects = t.bottomLineObjects), - (e.landTimer = t.landTimer), - (e.hasCheckpoints = t.hasCheckpoints), - (e.maxFrame = t.maxFrame), - (e.playerName = t.playerName), - (e.otherPlayersInfo = t.otherPlayersInfo), - (e.x = -t.cameraX), - (e.y = -t.cameraY), - (e.hidePlayer = t.hidePlayer), - (e.started = t.started)); - ((e.flash = t.flash), - (e.bgColor = t.bgColor), - (e.gravity = t.gravity), - (e.fallTypes = t.fallTypes)); - }, - ), - Pg.Single( - { - theme: t.layout.properties.theme, - cameraX: t.cameraX, - cameraY: t.cameraY, - playerY: t.playerY, - playerX: t.playerX, - cameraXOffset: t.cameraXOffset, - playerDir: t.playerDir, - paused: t.paused, - plain: a(Se).settings.plainBackground, - }, - (e) => { - ((e.cameraX = t.cameraX), - (e.cameraY = t.cameraY), - (e.playerX = t.playerX), - (e.playerY = t.playerY), - (e.playerDir = t.playerDir), - (e.cameraXOffset = t.cameraXOffset), - (e.paused = t.paused), - (e.plain = a(Se).settings.plainBackground)); - }, - ), - t.showAttempts - ? conditional( - () => t.fadeOutAttempts || a(Se).settings.fadeOutAttempts, - () => [ - onChange( - () => t.attempt, - () => [ - jo.Single({ - initShow: true, - shouldShow: false, - fadeFrames: 120, - sprite: (e) => [ - attemptCounter.Single( - { - attempt: t.attempt, - theme: t.layout.properties.theme.id, - }, - (a) => { - ((a.attempt = t.attempt), - (a.theme = t.layout.properties.theme.id), - (a.background = t.bgColor), - (a.opacity = e.ref)); - }, - ), - ], - }), - ], - ), - ], - () => [ - attemptCounter.Single( - { - attempt: t.attempt, - theme: t.layout.properties.theme.id, - }, - (e) => { - e.attempt = t.attempt; - e.theme = t.layout.properties.theme.id; - e.background = t.bgColor; - }, - ), - ], - ) - : null, - ifConditional( - () => t.collectibles > 0, - () => [ - c( - { - color: "#4BE5F5", - strokeColor: "#6B00BE", - strokeThickness: 4, - font: { size: 20 }, - y: e.size.fullHeight / 2 - 120, - }, - (a) => { - ((a.text = `${t.collectibles} / ${t.collectiblesTotal}`), - (a.y = e.size.fullHeight / 2 - 120)); - }, - ), - ], - ), - conditional( - () => { - var e; - return t.playerPowerups.some( - (e) => e.item === "skateboard", - ); - }, - () => [ - am.Single( - { - localScore: t.score.local, - totalScore: t.score.total, - multiplier: t.score.multiplier, - highScore: t.highScore, - crashed: t.crashed, - }, - (e) => { - ((e.localScore = t.score.local), - (e.totalScore = t.score.total), - (e.multiplier = t.score.multiplier), - (e.highScore = t.highScore), - (e.crashed = t.crashed)); - }, - ), - ], - () => [ - ifConditional( - () => t.score.total > 0, - () => [ - im.Single( - { - totalScore: t.score.total, - combo: t.score.multiplier, - fullCombo: t.score.fullCombo, - perfectCombo: t.score.perfectCombo, - highScore: t.highScore, - fullCombo: t.score.fullCombo, - perfectCombo: t.score.perfectCombo - }, - (e) => { - ((e.totalScore = t.score.total), - (e.combo = t.crashed ? 0 : t.score.multiplier), - (e.highScore = t.highScore), - (e.fullCombo = t.score.fullCombo), - (e.perfectCombo = t.score.perfectCombo) - ); - }, - ), - ], - ), - ], - ), - ifConditional( - () => { - var e; - return ( - null !== - ((null === (e = t.tutorial) || void 0 === e - ? void 0 - : e.textState) || null) - ); - }, - () => [ - sg.Single( - { - text: Zp(t.tutorial.textState, e.isTouchScreen), - y: 50, - }, - (a) => { - a.text = Zp(t.tutorial.textState, e.isTouchScreen); - }, - ), - ], - ), - ifConditional( - () => void 0 !== t.otherPlayersInfo, - () => [ - ng.Single( - { - playerX: t.playerX, - playerY: t.playerY, - cameraY: t.cameraY, - info: t.otherPlayersInfo, - gravity: t.gravity, - }, - (e) => { - ((e.playerX = t.playerX), - (e.playerY = t.playerY), - (e.cameraY = t.cameraY), - (e.info = t.otherPlayersInfo), - (e.gravity = t.gravity)); - }, - ), - ], - ), - t.bossState - ? pg.Single( - { - bossState: t.bossState, - frame: t.frame, - y: e.size.fullHeight / 2 - 100, - }, - (a) => { - ((a.bossState = t.bossState), - (a.frame = t.frame), - (a.y = e.size.fullHeight / 2 - 100)); - }, - ) - : null, - ifConditional( - () => a(Se).settings.showDebug, - () => [ - onChange( - () => t.frame, - () => [ - ((lastFrame = - t.crashed || t.finishedLevel ? lastFrame : t.frame), - null), - c( - { - color: "white", - font: { weight: 500, align: "left" }, - opacity: 0.5, - text: `${lastFrame}`, - }, - (i) => { - ((t.text = `${lastFrame}`), - (i.x = e.size.fullWidth / -2 + 14), - (i.y = e.size.fullHeight / 2 - 100)); - }, - ), - c( - { - color: "white", - font: { weight: 500, align: "left" }, - opacity: 0.5, - text: `${t.justDownInputTimer}`, - }, - (i) => { - ((t.text = `${t.justDownInputTimer}`), - (i.x = e.size.fullWidth / -2 + 14), - (i.y = e.size.fullHeight / 2 - 120)); - }, - ), - c( - { - color: "white", - font: { weight: 500, align: "left" }, - opacity: 0.5, - text: `${t.jumping}`, - }, - (i) => { - ((t.text = `${t.jumping}`), - (i.x = e.size.fullWidth / -2 + 14), - (i.y = e.size.fullHeight / 2 - 140)); - }, - ), - c( - { - color: "white", - font: { weight: 500, align: "left" }, - opacity: 0.5, - text: `${t.playerSpeedMultiplier}`, - }, - (i) => { - ((t.text = `${t.playerSpeedMultiplier}`), - (i.x = e.size.fullWidth / -2 + 14), - (i.y = e.size.fullHeight / 2 - 160)); - }, - ), - c( - { - color: "white", - font: { weight: 500, align: "left" }, - opacity: 0.5, - text: `jumpFrames: ${t.levelSpeeds.jumpFrames}, speed: ${t.levelSpeeds.speed}`, - }, - (i) => { - ((t.text = `jumpFrames: ${t.levelSpeeds.jumpFrames}, speed: ${t.levelSpeeds.speed}`), - (i.x = e.size.fullWidth / -2 + 14), - (i.y = e.size.fullHeight / 2 - 180)); - }, - ), - ], - ), - ], - ), - ]; - }, - }), - dm = makeSprite({ - render({ props: e, device }) { - const t = []; - - return [ - ifConditional( - () => void 0 !== e.otherPlayersInfo, - () => [ - nm.Single( - { info: e.otherPlayersInfo, hasStarted: e.started }, - (t) => { - ((t.info = e.otherPlayersInfo), - (t.hasStarted = e.started)); - }, - ), - ], - ), - tm.Array({ - props: (t) => ({ - object: t, - theme: e.layout.properties.theme.objects.bottom, - }), - update: (e, t) => { - e.object = t; - }, - array: () => e.bottomLineObjects || t, - key: (e, t) => t, - }), - Ja.Single( - { - blocks: e.layout.blocks, - theme: e.layout.properties.theme.objects.block, - inGame: { - blockStates: e.layoutState.blocks, - indexes: e.layoutStateIndex.blocks, - frame: e.frame, - paused: e.paused, - df: e.df, - playerX: e.playerX, - gravity: e.gravity, - fallTypes: e.fallTypes, - }, - indexes: e.layoutStateIndex.blocks, - }, - (t) => { - ((t.blocks = e.layout.blocks), - (t.theme = e.layout.properties.theme.objects.block), - t.theme === "infinite" && (t.theme = getInfiniteThemePath(e.bgColor)), - (t.inGame.blockStates = e.layoutState.blocks), - (t.inGame.indexes = e.layoutStateIndex.blocks), - (t.inGame.frame = e.frame), - (t.inGame.paused = e.paused), - (t.inGame.df = e.df), - (t.inGame.crashed = e.crashed), - (t.inGame.playerX = e.playerX), - (t.inGame.fallTypes = e.fallTypes), - (t.inGame.playerDir = e.playerDir), - (t.inGame.crashed = e.crashed), - (t.inGame.gravity = e.gravity)); - t.indexes = e.layoutStateIndex.blocks; - }, - ), - Za.Single( - { - spikes: e.layout.spikes, - theme: e.layout.properties.theme.objects.spike, - inGame: { - spikeStates: e.layoutState.spikes, - indexes: e.layoutStateIndex.spikes, - frame: e.frame, - paused: e.paused, - df: e.df, - playerX: e.playerX, - fallTypes: e.fallTypes, - gravity: e.gravity, - }, - }, - (t) => { - ((t.spikes = e.layout.spikes), - (t.theme = e.layout.properties.theme.objects.spike), - t.theme === "infinite" && (t.theme = getInfiniteThemePath(e.bgColor)), - (t.inGame.spikeStates = e.layoutState.spikes), - (t.inGame.indexes = e.layoutStateIndex.spikes), - (t.inGame.frame = e.frame), - (t.inGame.paused = e.paused), - (t.inGame.df = e.df), - (t.inGame.crashed = e.crashed), - (t.inGame.playerX = e.playerX), - (t.inGame.playerY = e.playerY), - (t.inGame.crashed = e.crashed), - (t.inGame.fallTypes = e.fallTypes), - (t.inGame.playerDir = e.playerDir), - (t.inGame.gravity = e.gravity)); - }, - ), - Qa.Single( - { - platforms: e.layout.platforms, - theme: e.layout.properties.theme.objects.platform, - indexes: e.layoutStateIndex.platforms, - inGame: { - playerX: e.playerX, - fallTypes: e.fallTypes, - }, - }, - (t) => { - ((t.platforms = e.layout.platforms), - (t.theme = e.layout.properties.theme.objects.platform), - (t.indexes = e.layoutStateIndex.platforms), - (t.inGame.playerX = e.playerX), - (t.inGame.fallTypes = e.fallTypes), - (t.inGame.playerDir = e.playerDir)); - }, - ), - xo.Array({ - props: (t) => ({ - switchButton: t, - switchRotation: e.switchRotation, - switchBlockSpikes: e.switchBlockSpikes, - paused: e.paused, - df: e.df, - justHit: false, - theme: e.layout.properties.theme.objects.switch, - playerScale: e.playerScale, - inGame: { - playerX: e.playerX, - fallTypes: e.fallTypes, - playerDir: e.playerDir, - }, - }), - update: (t, a, i) => { - ((t.playerScale = e.playerScale), - (t.playerDir = e.playerDir), - (t.switchButton = a), - (t.switchRotation = e.switchRotation), - (t.switchBlockSpikes = e.switchBlockSpikes), - (t.paused = e.paused), - (t.df = e.df), - (t.theme = e.layout.properties.theme.objects.switch), - (t.orbTheme = e.layout.properties.theme.id === "classic" ? "classic" : e.layout.properties.theme.objects.switch), - t.theme === "infinite" && (t.theme = getInfiniteThemePath(e.bgColor)), - (t.justHit = - null !== e.justHitObject && - "switchButtons" === e.justHitObject.array && - (a.affects === "gravity" - ? e.justHitObject.index === i - : true))); - ((t.inGame.playerDir = e.playerDir), - (t.inGame.playerX = e.playerX), - (t.inGame.fallTypes = e.fallTypes)); - }, - array: () => e.layout.switchButtons, - key: (t, a) => e.layoutStateIndex.switchButtons[a], - }), - Po.Single( - { - switchPlatforms: e.layout.switchPlatforms, - indexes: e.layoutStateIndex.switchPlatforms, - theme: e.layout.properties.theme.objects.switch, - inGame: { - playerX: e.playerX, - fallTypes: e.fallTypes, - }, - }, - (t) => { - ((t.switchPlatforms = e.layout.switchPlatforms), - (t.indexes = e.layoutStateIndex.switchPlatforms)); - ((t.theme = e.layout.properties.theme.objects.switch), - (t.inGame.playerX = e.playerX), - (t.inGame.fallTypes = e.fallTypes), - (t.inGame.playerDir = e.playerDir)); - }, - ), - $o.Array({ - props: (t) => ({ - spring: t, - justHit: false, - df: e.df, - paused: e.paused, - inGame: { - playerX: e.playerX, - fallTypes: e.fallTypes, - }, - }), - update: (t, a, i) => { - ((t.spring = a), - (t.justHit = - null !== e.justHitObject && - "springs" === e.justHitObject.array && - e.justHitObject.index === i), - (t.df = e.df), - (t.paused = e.paused), - (t.inGame.playerX = e.playerX), - (t.inGame.fallTypes = e.fallTypes), - (t.inGame.playerDir = e.playerDir)); - }, - array: () => e.layout.springs, - key: (t, a) => e.layoutStateIndex.springs[a], - }), - Jo.Array({ - props: (t) => ({ - portal: t, - paused: e.paused, - df: e.df, - theme: e.layout.properties.theme.objects.switch, - inGame: { - playerX: e.playerX, - fallTypes: e.fallTypes, - playerDir: e.playerDir, - }, - }), - update: (t, a) => { - ((t.portal = a), - (t.df = e.df), - (t.paused = e.paused), - (t.theme = e.layout.properties.theme.objects.switch), - (t.inGame.playerX = e.playerX), - (t.inGame.fallTypes = e.fallTypes), - (t.inGame.playerDir = e.playerDir)); - }, - key: (t, a) => e.layoutStateIndex.portals[a], - array: () => e.layout.portals, - }), - Zs.Array({ - props: (t, a) => ({ - directionChange: t, - theme: e.layout.properties.theme.objects.dirChange, - wasHit: e.layoutState.directionChanges[a].wasHit, - paused: e.paused, - df: e.df, - inGame: { - playerX: e.playerX, - fallTypes: e.fallTypes, - }, - }), - update: (t, a, i) => { - ((t.directionChange = a), - (t.df = e.df), - (t.paused = e.paused), - (t.theme = e.layout.properties.theme.objects.dirChange), - (t.wasHit = e.layoutState.directionChanges[i].wasHit), - (t.inGame.playerX = e.playerX), - (t.inGame.fallTypes = e.fallTypes), - (t.inGame.playerDir = e.playerDir)); - }, - key: (t, a) => e.layoutStateIndex.directionChanges[a], - array: () => e.layout.directionChanges, - }), - er.Array({ - props: (t) => ({ - speedChange: t, - justHit: false, - previousJustHit: false, - df: e.df, - paused: e.paused, - theme: e.layout.properties.theme.objects.speedChange, - inGame: { - playerX: e.playerX, - fallTypes: e.fallTypes, - }, - }), - update: (t, a, i) => { - t.speedChange = a; - t.previousJustHit = - null == e.justHitObject - ? false - : t.previousJustHit || t.justHit; - t.justHit = - null !== e.justHitObject && - "speedChanges" === e.justHitObject.array && - e.justHitObject.index === i; - if (t.previousJustHit == true) { - t.justHit = false; - } - t.df = e.df; - t.paused = e.paused; - ((t.inGame.playerX = e.playerX), - (t.inGame.fallTypes = e.fallTypes), - (t.inGame.playerDir = e.playerDir)); - }, - array: () => e.layout.speedChanges, - key: (t, a) => e.layoutStateIndex.speedChanges[a], - }), - eo.Single( - { - saws: e.layout.saws, - theme: e.layout.properties.theme.objects.saw, - bigTheme: e.layout.properties.theme.objects.spike, - inGame: { - sawStates: e.layoutState.saws, - indexes: e.layoutStateIndex.saws, - frame: e.frame, - paused: e.paused, - df: e.df, - playerX: e.playerX, - fallTypes: e.fallTypes, - }, - bgColor: e.bgColor, - }, - (t) => { - ((t.saws = e.layout.saws), - (t.bigTheme = e.layout.properties.theme.objects.spike), - (t.theme = e.layout.properties.theme.objects.saw), - t.theme === "infinite" && (t.theme = getInfiniteThemePath(e.bgColor)), - t.bigTheme === "infinite" && (t.bigTheme = getInfiniteThemePath(e.bgColor)), - (t.bgColor = getInfiniteThemeColors(e.bgColor)), - (t.inGame.sawStates = e.layoutState.saws), - (t.inGame.indexes = e.layoutStateIndex.saws), - (t.inGame.frame = e.frame), - (t.inGame.paused = e.paused), - (t.inGame.df = e.df), - (t.inGame.playerX = e.playerX), - (t.inGame.fallTypes = e.fallTypes), - (t.inGame.playerDir = e.playerDir)); - }, - ), - ao.Array({ - array: () => e.layout.flags, - props: (t, a) => ({ - flag: t, - theme: e.layout.properties.theme.objects.flag, - inGame: { - wasHit: e.layoutState.flags[a].wasHit, - frame: e.frame, - paused: e.paused, - df: e.df, - isFlying: e.isFlyingLevel, - index: a, - playerX: e.playerX, - fallTypes: e.fallTypes, - }, - }), - update: (t, a, i) => { - ((t.flag = a), - (t.theme = e.layout.properties.theme.objects.flag), - (t.inGame.wasHit = e.layoutState.flags[i].wasHit), - (t.inGame.frame = e.frame), - (t.inGame.paused = e.paused && !e.finishedLevel), - (t.inGame.df = e.df), - (t.inGame.playerX = e.playerX), - (t.inGame.fallTypes = e.fallTypes), - (t.inGame.playerDir = e.playerDir)); - }, - key: (t, a) => e.layoutStateIndex.flags[a], - }), - Co.Array({ - array: () => e.layout.powerups, - props: (t) => ({ - powerup: t, - skin: e.playerSkin, - frame: e.frame, - paused: e.paused, - df: e.df, - theme: e.layout.properties.theme.objects.speedChange, - inGame: { - playerX: e.playerX, - fallTypes: e.fallTypes, - }, - }), - filter: (t, a) => !e.layoutState.powerups[a]?.wasPickedUp, - update: (t, a) => { - ((t.powerup = a), - (t.frame = e.frame), - (t.paused = e.paused && !e.finishedLevel), - (t.df = e.df), - (t.theme = e.layout.properties.theme.objects.speedChange), - (t.skin = e.playerSkin), - (t.inGame.playerX = e.playerX), - (t.inGame.fallTypes = e.fallTypes), - (t.inGame.playerDir = e.playerDir)); - }, - key: (t, a) => e.layoutStateIndex.powerups[a], - }), - e.bossState - ? ug.Single( - { - bossState: e.bossState, - frame: e.frame, - paused: e.paused, - playerX: e.playerX, - playerRot: e.playerRot, - playerCrashed: e.crashed, - df: e.df, - }, - (t) => { - ((t.bossState = e.bossState), - (t.frame = e.frame), - (t.paused = e.paused), - (t.playerX = e.playerX), - (t.playerRot = e.playerRot), - (t.playerCrashed = e.crashed), - (t.df = e.df)); - }, - ) - : null, - fo.Array({ - props: (t, a) => ({ - enemy: t, - enemyState: e.layoutState.enemies[a], - isBoss: null !== e.bossState, - jumpFrames: e.jumpFrames, - df: e.df, - frame: e.frame, - playerCrashed: e.crashed, - paused: e.paused, - playerX: e.playerX, - playerY: e.playerY, - playerDir: e.playerDir, - fallTypes: e.fallTypes, - }), - update: (t, a, i) => { - ((t.enemy = a), - (t.enemyState = e.layoutState.enemies[i]), - (t.df = e.df), - (t.frame = e.frame), - (t.playerCrashed = e.crashed), - (t.paused = e.paused), - (t.playerX = e.playerX), - (t.playerY = e.playerY), - (t.playerDir = e.playerDir), - (t.fallTypes = e.fallTypes)); - }, - array: () => e.layout.enemies, - key: (t, a) => e.layoutStateIndex.enemies[a], - }), - ifConditional( - () => void 0 !== e.otherPlayersInfo, - () => [ - rm.Single( - { - info: e.otherPlayersInfo, - playerX: e.playerX, - playerY: e.playerY, - playerName: e.playerName, - crashed: e.crashed, - hasStarted: e.started, - }, - (t) => { - ((t.info = e.otherPlayersInfo), - (t.playerX = e.playerX), - (t.playerY = e.playerY), - (t.playerName = e.playerName), - (t.crashed = e.crashed)); - }, - ), - ], - ), - conditional( - () => e.playerPowerups.length > 0, - () => [ - Ao.Single( - { - x: e.playerX, - y: e.playerY, - scaleX: e.playerDir * e.playerScale, - scaleY: e.playerScale, - powerup: e.playerPowerups[0] || null, - isJetpack: e.playerPowerups.some( - (e) => e.item === "jetpack", - ), - isSkating: e.playerPowerups.some( - (e) => e.item === "skateboard", - ), - isUsing: e.playerUsingPowerup, - playerRot: e.playerRot * e.playerDir, - playerDir: e.playerDir, - playerScaleY: e.playerScaleY, - playerIsOnGround: 0 === e.playerGradY, - jumping: e.playerJumping, - jetpackFuel: e.playerJetpackFuel, - frame: e.frame, - paused: e.paused, - df: e.df, - crashed: e.crashed, - }, - (t) => { - ((t.x = e.playerX), - (t.y = e.playerY), - (t.scaleX = e.playerDir * e.playerScale), - (t.scaleY = e.playerScale), - (t.powerup = e.playerPowerups[0] || null), - (t.isJetpack = e.playerPowerups.some( - (e) => e.item === "jetpack", - )), - (t.isSkating = e.playerPowerups.some( - (e) => e.item === "skateboard", - )), - (t.isUsing = e.playerUsingPowerup), - (t.playerRot = e.playerRot * e.playerDir), - (t.playerDir = e.playerDir), - (t.playerScaleY = e.playerScaleY), - (t.playerIsOnGround = 0 === e.playerGradY), - (t.jumping = e.playerJumping), - (t.jetpackFuel = e.playerJetpackFuel), - (t.frame = e.frame), - (t.paused = e.paused), - (t.df = e.df), - (t.crashed = e.crashed)); - }, - ), - ], - () => [ - ifConditional( - () => null !== e.playerPowerupOut, - () => [ - No.Single( - { - x: e.playerX, - y: e.playerY, - scaleX: e.playerDir * e.playerScale, - scaleY: e.playerScale, - powerup: e.playerPowerupOut, - playerRot: e.playerRot, - playerDir: e.playerDir, - df: e.df, - }, - (t) => { - ((t.x = e.playerX), - (t.y = e.playerY), - (t.scaleX = e.playerDir * e.playerScale), - (t.scaleY = e.playerScale), - (t.powerup = e.playerPowerupOut), - (t.playerRot = e.playerRot), - (t.playerDir = e.playerDir), - (t.df = e.df)); - }, - ), - ], - ), - ], - ), - bulletSprite.Array({ - props: (t) => ({ - x: t.x, - y: t.y, - bullet: t, - isEnemy: false, - removeBullet: () => - e.playerBullets && - e.playerBullets.splice(e.playerBullets.indexOf(t), 1), - }), - update: (a, t) => { - ((a.x = t.x), - (a.y = getBlockFallY( - t.x, - t.y, - e.playerX, - e.fallTypes, - e.playerDir, - )), - (a.bullet = t)); - }, - array: () => e.playerBullets, - key: (e, t) => t, - }), - conditional( - () => - e.isFlyingLevel || - e.playerPowerups.some((e) => e.item === "spaceship"), - () => [ - onChange( - () => e.attempt, - () => [ - flyingTrail.Single( - { - playerX: e.playerX, - playerY: e.playerY, - playerDir: e.playerDir, - crashed: e.crashed, - paused: e.paused, - colour: "#FCDA45", - frame: e.frame, - df: e.df, - }, - (t) => { - ((t.playerX = e.playerX), - (t.playerY = e.playerY), - (t.playerDir = e.playerDir), - (t.crashed = e.crashed || e.bossState?.playerDestroyed), - (t.paused = e.paused), - (t.frame = e.frame), - (t.df = e.df)); - }, - ), - ], - ), - ], - () => [ - playerTrail.Single( - { - playerX: e.playerX, - playerY: e.playerY, - playerDir: e.playerDir, - crashed: e.crashed, - paused: e.paused, - skin: e.playerSkin, - isFront: false, - attempt: e.attempt, - touchingPortals: null !== e.touchingPortals, - playerScale: e.playerScale, - }, - (t) => { - ((t.playerSpeedMultiplier = e.playerSpeedMultiplier), - (t.playerScale = e.playerScale), - (t.playerX = e.playerX), - (t.playerY = e.playerY), - (t.playerDir = e.playerDir), - (t.crashed = e.crashed || e.hidePlayer), - (t.paused = e.paused), - (t.attempt = e.attempt), - (t.touchingPortals = null !== e.touchingPortals), - (t.skin = Object.assign({}, e.playerSkin)), - (t.skin.trail = Object.assign({}, e.playerSkin.trail)), - (e.layout.properties.theme.id === "infinite") && ["world1", "default", "headphone"].includes(t.skin.fileName) && (t.skin.trail = { - form: "default", - topColour: getInfinitePlayerColors(e.bgColor), - bottomColour: getInfinitePlayerColors(e.bgColor), - }), - (t.theme = e.layout.properties.theme.id), - (t.playerRot = e.playerRot) - ); - }, - ), - ], - ), - g({ - props: (t) => ({ - color: e.playerSkin.trail.topColour, - width: 30, - height: 30, - x: t.x, - y: t.y, - opacity: 0.4 - }), - update: (a, t) => { - a.x = t.x; - a.y = t.y; - a.rotation = e.frame; - }, - array: () => e.boosterDebug ? e.boosterDebug.jumpIndicators : [], - }), - imageArray({ - fileName: "images/level/flag.png", - props: (t) => ({ - width: 30, - height: 60, - x: t.x, - y: t.y + 15, - }), - update: (a, t) => { - a.x = t.state.playerX; - a.y = t.state.playerY + 15 + (-15 * t.state.playerScale) + 15; - }, - array: () => e.checkpoints, - }), - ifConditional( - () => !e.hidePlayer, - () => [ - conditional( - () => e.crashed || e.bossState?.playerDestroyed, - () => [ - qa.Single( - { - x: e.playerX, - y: e.playerY, - justDestroyed: true, - paused: e.paused, - trail: - e.flyingAnchor === null && !e.isFlyingLevel - ? e.playerSkin.trail - : { - form: "default", - topColour: "#FCDA45", - bottomColour: "#FCDA45", - }, // for now, hehehe... - playerRot: e.playerRot, - playerScale: e.playerScale, - df: e.df, - }, - (t) => { - ( - (t.paused = e.paused), - (t.df = e.df), - (t.trail = ["world1", "default", "headphone"].includes(e.playerSkin.fileName) && e.layout.properties.theme.id === "infinite" ? - { - form: "default", - topColour: getInfinitePlayerColors(e.bgColor), - bottomColour: getInfinitePlayerColors(e.bgColor), - } - : e.flyingAnchor === null && !e.isFlyingLevel - ? e.playerSkin.trail - : { - form: "default", - topColour: "#FCDA45", - bottomColour: "#FCDA45", - }) - ); - }, - ), - ], - () => [ - conditional( - () => null !== e.touchingPortals, - () => [ - Kg.Single( - { - x: e.playerX, - y: e.playerY, - playerX: e.playerX, - playerY: e.playerY, - landTimer: e.landTimer, - skin: e.playerSkin, - playerDir: e.playerDir, - playerRot: e.playerRot, - playerScaleX: e.playerScaleX, - playerScaleY: e.playerScaleY, - playerScale: e.playerScale, - onSkateboard: false, - touchingPortals: e.touchingPortals, - isFlying: e.playerPowerups.some( - (e) => e.item === "spaceship", - ), - }, - (t) => { - var a; - const i = e.playerPowerups.some( - (e) => e.item === "skateboard", - ); - ((t.x = e.playerX), - (t.y = e.playerY), - (t.playerX = e.playerX), - (t.playerY = e.playerY), - (t.landTimer = e.landTimer), - (t.playerDir = e.playerDir), - (t.playerRot = e.playerRot), - (t.playerScaleX = e.playerScaleX), - (t.playerScale = e.playerScale), - (t.playerScaleY = e.playerScaleY), - (t.onSkateboard = i), - (t.isInfinite = e.layout.properties.theme.id === "infinite"), - (t.bgColor = e.bgColor), - (t.touchingPortals = e.touchingPortals)); - }, - ), - ], - () => [ - conditional( - () => - e.isFlyingLevel || - e.playerPowerups.some( - (e) => e.item === "spaceship", - ), - () => [ - y( - { - fileName: - "images/level/boss3/player-ship.png", - width: 40, - height: 30, - }, - (t) => { - ((t.x = e.playerX), - (t.y = e.playerY), - (t.rotation = e.playerRot), - (t.scaleX = e.playerScaleX * e.playerDir), - (t.scaleY = e.playerScaleY)); - }, - ), - ], - () => [ - To.Single({ skin: e.playerSkin }, (t) => { - var a; - ((t.x = e.playerX), - (t.y = e.playerY), - (t.rotation = e.playerRot), - (t.scaleX = e.playerScaleX * e.playerDir), - (t.scaleY = e.playerScaleY), - (t.skin = e.playerSkin), - (t.isInfinite = e.layout.properties.theme.id === "infinite"), - (t.bgColor = e.bgColor), - (t.opacity = e.playerPowerups.some( - (e) => e.item == "ghost", - ) - ? 0.5 - : 1), - (t.landTimer = e.landTimer)); - t.onSkateboard = e.playerPowerups.some( - (e) => e.item === "skateboard", - ); - }), - ], - ), - ], - ), - conditional( - () => e.playerPowerups.length > 0, - () => [ - conditional( - () => - e.playerPowerups.some( - (e) => e.item === "playerStack", - ), - () => [ - playerTrail.Array({ - props: ({ y: t }) => ({ - skin: e.playerSkin, - playerX: e.playerX, - playerY: t, - playerDir: e.playerDir, - crashed: false, - paused: e.paused, - isFront: false, - attempt: e.attempt, - touchingPortals: null !== e.touchingPortals, - playerScale: e.playerScale, - }), - update: (t, { y: a }) => { - ((t.playerSpeedMultiplier = - e.playerSpeedMultiplier), - (t.playerScale = e.playerScale), - (t.playerX = e.playerX), - (t.playerY = a), - (t.playerDir = e.playerDir), - (t.paused = e.paused), - (t.attempt = e.attempt), - (t.touchingPortals = - null !== e.touchingPortals), - (t.skin = Object.assign({}, e.playerSkin)), - (t.skin.trail = Object.assign({}, e.playerSkin.trail)), - (e.layout.properties.theme.id === "infinite") && ["world1", "default", "headphone"].includes(t.skin.fileName) && (t.skin.trail = { - form: "default", - topColour: getInfinitePlayerColors(e.bgColor), - bottomColour: getInfinitePlayerColors(e.bgColor), - }), - (t.theme = e.layout.properties.theme.id), - (t.playerRot = e.playerRot) - ); - }, - array: () => e.playerStacks, - key: (e, t) => t, - }), - To.Array({ - props: () => ({ skin: e.playerSkin }), - update: (t, { y: a }) => { - ((t.x = e.playerX), - (t.y = a), - (t.scaleX = - e.playerDir * - (e.isCompatible ? 1 : e.playerScale)), - (t.scaleY = e.isCompatible - ? 1 - : e.playerScale), - (t.isInfinite = e.layout.properties.theme.id === "infinite"), - (t.bgColor = e.bgColor)); - }, - array: () => e.playerStacks, - key: (e, t) => t, - }), - playerTrail.Array({ - props: ({ y: t }) => ({ - skin: e.playerSkin, - playerX: e.playerX, - playerY: t, - playerDir: e.playerDir, - crashed: false, - paused: e.paused, - isFront: true, - playerScale: e.playerScale, - }), - update: (t, { y: a }) => { - ((t.playerSpeedMultiplier = - e.playerSpeedMultiplier), - (t.playerScale = e.playerScale), - (t.playerX = e.playerX), - (t.playerY = a), - (t.playerDir = e.playerDir), - (t.paused = e.paused), - (t.attempt = e.attempt), - (t.skin = Object.assign({}, e.playerSkin)), - (t.skin.trail = Object.assign({}, e.playerSkin.trail)), - (e.layout.properties.theme.id === "infinite") && ["world1", "default", "headphone"].includes(t.skin.fileName) && (t.skin.trail = { - form: "default", - topColour: getInfinitePlayerColors(e.bgColor), - bottomColour: getInfinitePlayerColors(e.bgColor), - }), - (t.theme = e.layout.properties.theme.id), - (t.playerRot = e.playerRot) - ); - }, - array: () => e.playerStacks, - key: (e, t) => t, - }), - (t.scaleX = e.playerDir * e.playerScale), - (t.scaleY = e.playerScale), - (t.isUsing = e.playerUsingPowerup), - (t.playerRot = e.playerRot * e.playerDir), - wo.Array({ - props: ({ y }) => ({ - powerup: e.playerPowerups[0], - x: e.playerX, - y: y, - scaleX: e.playerDir * e.playerScale, - scaleY: e.playerScale, - isUsing: e.playerUsingPowerup, - playerRot: e.playerRot * e.playerDir, - paused: e.paused, - df: e.df, - }), - update: (t, a) => { - ((t.powerup = e.playerPowerups[0]), - (t.x = e.playerX), - (t.y = a.y), - (t.paused = e.paused), - (t.df = e.df)); - }, - array: () => e.playerStacks, - key: (e, t) => t, - }), - ], - () => [], - ), - wo.Single( - { - powerup: e.playerPowerups.filter( - (e) => e.item != "playerStack", - )[0], - x: e.playerX, - y: e.playerY, - scaleX: e.playerDir * e.playerScale, - scaleY: e.playerScale, - isUsing: e.playerUsingPowerup, - playerRot: e.playerRot * e.playerDir, - paused: e.paused, - df: e.df, - }, - (t) => { - ((t.powerup = e.playerPowerups.filter( - (e) => e.item != "playerStack", - )[0]), - (t.x = e.playerX), - (t.y = e.playerY), - (t.scaleX = e.playerDir * e.playerScale), - (t.scaleY = e.playerScale), - (t.isUsing = e.playerUsingPowerup), - (t.playerRot = e.playerRot * e.playerDir), - (t.paused = e.paused), - (t.df = e.df)); - }, - ), - ], - () => [], - ), - ], - ), - ], - ), - ifConditional( - () => null !== e.playerPowerupOut, - () => [ - onChange( - () => e.playerPowerupOut, - () => [ - ko.Single( - { - x: e.playerX, - y: e.playerY, - scaleX: e.playerDir * e.playerScale, - scaleY: e.playerScale, - powerup: e.playerPowerupOut, - playerRot: e.playerRot, - playerDir: e.playerDir, - playerScale: e.playerScale, - paused: e.paused, - df: e.df, - }, - (t) => { - ((t.x = e.playerX), - (t.y = e.playerY), - (t.scaleX = e.playerDir * e.playerScale), - (t.scaleY = e.playerScale), - (t.powerup = e.playerPowerupOut), - (t.playerRot = e.playerRot), - (t.playerDir = e.playerDir), - (t.playerScale = e.playerScale), - (t.paused = e.paused), - (t.df = e.df)); - }, - ), - ko.Array({ - props: ({ y }) => ({ - x: e.playerX, - y: y, - scaleX: e.playerDir * e.playerScale, - scaleY: e.playerScale, - powerup: e.playerPowerupOut, - playerRot: e.playerRot, - playerDir: e.playerDir, - playerScale: e.playerScale, - paused: e.paused, - df: e.df, - }), - update: (t, a) => { - ((t.x = e.playerX), - (t.y = a.y), - (t.scaleX = e.playerDir * e.playerScale), - (t.scaleY = e.playerScale), - (t.powerup = e.playerPowerupOut), - (t.playerRot = e.playerRot), - (t.playerDir = e.playerDir), - (t.playerScale = e.playerScale), - (t.paused = e.paused), - (t.df = e.df)); - }, - array: () => e.playerStacks, - key: (e, t) => t, - }), - ], - ), - ], - ), - ifConditional( - () => e.playerPowerups.length > 1, - () => [ - c( - { - text: `x${e.playerPowerups.length}`, - color: Te, - strokeColor: He, - strokeThickness: 4, - font: { size: 20 }, - x: e.playerX, - y: e.playerY + 40, - }, - (t) => { - t.x = e.playerX; - t.y = e.playerY + 40; - t.text = `x${e.playerPowerups.length}`; - }, - ), - ], - ), - ifConditional( - () => - !( - e.isFlyingLevel || - e.playerPowerups.some((e) => e.item === "spaceship") - ), - () => [ - playerTrail.Single( - { - playerX: e.playerX, - playerY: e.playerY, - playerDir: e.playerDir, - crashed: e.crashed, - paused: e.paused, - skin: e.playerSkin, - isFront: true, - touchingPortals: null !== e.touchingPortals, - playerScale: e.playerScale, - }, - (t) => { - ((t.playerSpeedMultiplier = e.playerSpeedMultiplier), - (t.playerScale = e.playerScale), - (t.playerX = e.playerX), - (t.playerY = e.playerY), - (t.playerDir = e.playerDir), - (t.crashed = e.crashed || e.hidePlayer), - (t.paused = e.paused), - (t.touchingPortals = null !== e.touchingPortals), - (t.skin = Object.assign({}, e.playerSkin)), - (t.skin.trail = Object.assign({}, e.playerSkin.trail)), - (e.layout.properties.theme.id === "infinite") && ["world1", "default", "headphone"].includes(t.skin.fileName) && (t.skin.trail = { - form: "default", - topColour: getInfinitePlayerColors(e.bgColor), - bottomColour: getInfinitePlayerColors(e.bgColor), - }), - (t.theme = e.layout.properties.theme.id), - (t.playerRot = e.playerRot) - ); - }, - ), - ], - ), - Wo.Single( - { - collectibles: e.layout.collectibles, - collectibleStates: e.layoutState.collectibles, - collectibleIndexes: e.layoutStateIndex.collectibles, - frame: e.frame, - playerX: e.playerX, - fallTypes: e.fallTypes, - playerDir: e.playerDir, - paused: e.paused, - df: e.df, - theme: e.layout.properties.theme.objects.switch, - }, - (t) => { - ((t.collectibles = e.layout.collectibles), - (t.collectibleStates = e.layoutState.collectibles), - (t.collectibleIndexes = e.layoutStateIndex.collectibles), - (t.frame = e.frame), - (t.playerX = e.playerX), - (t.fallTypes = e.fallTypes), - (t.playerDir = e.playerDir), - (t.paused = e.paused), - (t.df = e.df), - (t.theme = e.layout.properties.theme === "infinite" ? "infinite" : e.layout.properties.theme.objects.switch)); - }, - ), - qa.Array({ - props: (t) => ({ - x: t.x, - y: t.y, - justDestroyed: t.framesLeft === $.explosionTime - 1, - paused: e.paused, - trail: e.playerSkin.trail, - playerRot: e.playerRot, - df: e.df, - playerScale: e.playerScale, - }), - update: (t) => { - ((t.paused = e.paused), (t.df = e.df)); - }, - array: () => e.explosions, - key: (e, t) => t, - }), - ifConditional( - () => void 0 !== e.maxFrame && void 0 !== e.hasCheckpoints, - () => [ - lm.Single( - { - crashed: e.crashed, - hasCheckpoints: e.hasCheckpoints, - frame: e.frame, - maxFrame: e.maxFrame, - }, - (t) => { - ((t.crashed = e.crashed), - (t.hasCheckpoints = e.hasCheckpoints), - (t.frame = e.frame), - (t.maxFrame = e.maxFrame), - (t.x = e.playerX), - (t.y = e.playerY - 50)); - }, - ), - ], - ), - ]; - }, - }), - attemptCounter = makeSprite({ - render: ({ device: e, props: t }) => - bgOnly || showcaseOnly - ? [] - : t.theme == "classic" - ? [ - c( - { - color: "white", - font: { family: "Akashi", size: 24, weight: 500 }, - y: e.size.fullHeight / 2 - 70, - }, - (a) => { - ((a.text = `${localize("Attempt")} ${t.attempt}`), - (a.y = e.size.fullHeight / 2 - 70)); - }, - ), - ] - : t.theme == "infinite" - ? [ - u( - { - y: e.size.fullHeight / 2 - 55, - color: getInfiniteThemeColors(t.background), - radius: 57, - opacity: 0.5 - }, - (a) => { - a.y = e.size.fullHeight / 2 - 55; - a.color = getInfiniteThemeColors(t.background); - }, - ), - u( - { - y: e.size.fullHeight / 2 - 55, - color: getInfiniteThemeColors(t.background), - radius: 50, - }, - (a) => { - a.y = e.size.fullHeight / 2 - 55; - a.color = getInfiniteThemeColors(t.background); - }, - ), - u( - { - y: e.size.fullHeight / 2 - 55, - color: infiniteBgTable(0, t.background), - radius: 40, - }, - (a) => { - a.y = e.size.fullHeight / 2 - 55; - a.color = infiniteBgTable(0, t.background); - }, - ), - c( - { - text: localize("Attempt"), - color: getInfiniteThemeColors(t.background), - font: { family: "Poppins", size: 16 }, - y: e.size.fullHeight / 2 - 47, - }, - (a) => { - a.y = e.size.fullHeight / 2 - 47; - a.color = getInfiniteThemeColors(t.background); - }, - ), - c( - { - color: getInfiniteThemeColors(t.background), - font: { family: "Poppins", size: 16 }, - y: e.size.fullHeight / 2 - 71, - }, - (a) => { - ((a.text = String(t.attempt)), - (a.y = e.size.fullHeight / 2 - 71)); - }, - ), - ] - : [ - y( - { - fileName: "images/level/attempt.png", - width: 75, - height: 79, - y: e.size.fullHeight / 2 - 55, - }, - (t) => { - t.y = e.size.fullHeight / 2 - 55; - }, - ), - c( - { - text: localize("ATTEMPT"), - color: "white", - font: { family: "Montserrat", size: 15 }, - y: e.size.fullHeight / 2 - 50, - strokeColor: He, - strokeThickness: 4, - }, - (t) => { - t.y = e.size.fullHeight / 2 - 50; - }, - ), - c( - { - color: "white", - font: { family: "Montserrat", size: 20 }, - y: e.size.fullHeight / 2 - 70, - strokeColor: He, - strokeThickness: 4, - }, - (a) => { - ((a.text = String(t.attempt)), - (a.y = e.size.fullHeight / 2 - 70)); - }, - ), - ], - }), - hm = (y, cameraY, finished, anchor, useGround) => { - if (anchor) { - return cameraY + (anchor - cameraY) / 5; - } - if (finished) return cameraY + (y - cameraY) / 10; - const i = et.initialPosition.y + 105, - n = et.initialPosition.y; - let isGrounded = false; - if (y <= 30 && !(y - cameraY > i) && useGround) { - cameraY = cameraY + (30 - cameraY) / 4; - isGrounded = true; - } - cameraY = - y - cameraY > i && !isGrounded - ? cameraY + (5 + y - cameraY - i) / 4 - : y - cameraY < n && !isGrounded - ? cameraY + (-5 + y - cameraY - n) / 4 - : cameraY; - return cameraY; - }, - pm = (e, t, a) => { - const i = a - ? et.initialPosition.x - : 1 === t - ? 0 - : 2 * et.initialPosition.x, - n = e - i; - return 0 === n || Math.abs(n) < 1 ? i : e - n / 4; - }, - gm = (e, t) => e - et.initialPosition.x + t; - var mm = function (e, t, a, i) { - return new (a || (a = Promise))(function (n, s) { - function o(e) { - try { - l(i.next(e)); - } catch (e) { - s(e); - } - } - function r(e) { - try { - l(i.throw(e)); - } catch (e) { - s(e); - } - } - function l(e) { - var t; - e.done - ? n(e.value) - : ((t = e.value), - t instanceof a - ? t - : new a(function (e) { - e(t); - })).then(o, r); - } - l((i = i.apply(e, t || [])).next()); - }); - }; - function fm(e, t) { - return mm(this, void 0, void 0, function* () { - const a = yield bp.verifyPurchase(e, t, "googlePlay"); - return (yield ju.playStoreAcknowledge(t.productId), a); - }); - } - const ym = { - checkForPreviousPurchases: function (e) { - return mm(this, void 0, void 0, function* () { - const t = yield ju.checkPreviousPurchases(); - return t ? yield fm(e, t) : null; - }); - }, - getPurchases: function (e) { - return mm(this, void 0, void 0, function* () { - let t; - return ( - (t = yield bp.getPurchases(e, "googlePlay")), - (t = yield ju.playStoreProductInfo(t)), - t.sort((e, t) => (e.price < t.price ? -1 : 1)) - ); - }); - }, - makePurchase: function (e, t) { - return mm(this, void 0, void 0, function* () { - { - const a = yield ju.playStoreBuy(t); - return null === a ? null : yield fm(e, a); - } - }); - }, - }; - var Em = function (e, t, a, i) { - return new (a || (a = Promise))(function (n, s) { - function o(e) { - try { - l(i.next(e)); - } catch (e) { - s(e); - } - } - function r(e) { - try { - l(i.throw(e)); - } catch (e) { - s(e); - } - } - function l(e) { - var t; - e.done - ? n(e.value) - : ((t = e.value), - t instanceof a - ? t - : new a(function (e) { - e(t); - })).then(o, r); - } - l((i = i.apply(e, t || [])).next()); - }); - }; - const bm = makeCustomSprite({ - init({ - props: { onModalClose: e, onPurchaseComplete: t }, - updateState: a, - device: i, - getContext: n, - }) { - const { online: s } = n(Se); - if (s) { - const n = s.backend; - function o() { - return Em(this, void 0, void 0, function* () { - const e = yield ym.checkForPreviousPurchases(n); - if (null !== e) - return ( - t(e), - void i.alert.ok("Finished processing pending purchase") - ); - const s = yield ym.getPurchases(n); - a((e) => - Object.assign(Object.assign({}, e), { purchases: s }), - ); - }); - } - o().catch((t) => { - i.alert.ok(`Failed to retrieve store items: ${t.message}`, e); - }); - } - return { purchases: "loading", isPurchasing: false }; - }, - render({ - state: e, - props: t, - updateState: a, - device: i, - getContext: s, - }) { - const { onModalClose: o, onPurchaseComplete: r } = t; - return [ - Clickable({ - id: "ClickOutside", - onPressOutside: o, - width: 400, - height: 300, - sprites: () => [], - onPress: () => null, - }), - We({ - width: 400, - height: 300, - color: ve, - strokeColor: Ye, - strokeThickness: 8, - }), - Fo({ - id: "CloseButton", - text: "X", - x: 200, - y: 150, - width: 40, - height: 40, - onPress: o, - strokeColor: Ye, - }), - ...("loading" === e.purchases - ? [ - n({ - text: `${localize("LOADING")}...`, - color: ve, - strokeColor: Ye, - strokeThickness: 3, - }), - ] - : e.isPurchasing - ? [ - n({ - text: `${localize("PROCESSING")}...`, - color: ve, - strokeColor: Ye, - strokeThickness: 3, - }), - ] - : e.purchases.flatMap((e, t) => [ - n({ - text: e.title, - font: { size: 20 }, - x: -80, - color: Te, - strokeColor: Ye, - strokeThickness: 4, - y: 70 - 60 * t, - }), - Fo({ - id: `BlockButton-${e.productId}`, - width: 120, - height: 50, - text: e.price, - strokeColor: Ye, - textColor: ve, - textStroke: Ye, - textStrokeThickness: 4, - onPress: () => { - const { online: t } = s(Se); - t && - (a((e) => - Object.assign(Object.assign({}, e), { - isPurchasing: true, - }), - ), - ym - .makePurchase(t.backend, e) - .then((e) => { - null !== e && - (i - .audio("audio/global/purchase-blocks.wav") - .play(), - r(e)); - }) - .catch((e) => { - "pending" === e.message - ? i.alert.ok( - "Waiting for pending payment, please check back later", - ) - : (console.error(e.message), - i.alert.ok("Couldn't complete purchase")); - }) - .finally(() => { - a((e) => - Object.assign(Object.assign({}, e), { - isPurchasing: false, - }), - ); - })); - }, - x: 80, - y: 70 - 60 * t, - }), - ])), - ]; - }, - }), - Sm = makeSprite({ - init({ - props: { onModalClose: e, onPurchaseComplete: t }, - device: a, - getContext: i, - getState: n, - }) { - const { online: s } = i(Se); - if (s) { - const i = s.backend; - function o() { - return Em(this, void 0, void 0, function* () { - const e = yield ym.checkForPreviousPurchases(i); - if (null !== e) - return ( - t(e), - void a.alert.ok("Finished processing pending purchase") - ); - const s = yield ym.getPurchases(i); - n().purchases = s; - }); - } - o().catch((t) => { - a.alert.ok(`Failed to retrieve store items: ${t.message}`, e); - }); - } - return { purchases: "loading", isPurchasing: false }; - }, - render: ({ state: e, props: t, device: a, getContext: i }) => [ - _e.Single({ - onPressOutside: t.onModalClose, - width: 400, - height: 300, - sprites: () => [], - onPress: () => null, - }), - qe({ - width: 400, - height: 300, - fillColor: ve, - color: Ye, - thickness: 8, - }), - Yo.Single({ - text: "X", - x: 200, - y: 150, - width: 40, - height: 40, - onPress: t.onModalClose, - strokeColor: Ye, - }), - conditional( - () => "loading" === e.purchases, - () => [ - c({ - text: `${localize("LOADING")}...`, - color: ve, - strokeColor: Ye, - strokeThickness: 3, - }), - ], - () => [ - conditional( - () => e.isPurchasing, - () => [ - c({ - text: `${localize("PROCESSING")}...`, - color: ve, - strokeColor: Ye, - strokeThickness: 3, - }), - ], - () => [ - d({ - props: (e, t) => ({ - font: { size: 20 }, - x: -80, - color: Te, - strokeColor: Ye, - strokeThickness: 4, - text: e.title, - y: 70 - 60 * t, - }), - array: () => e.purchases, - }), - Yo.Array({ - props: (n, s) => ({ - width: 120, - height: 50, - text: n.price, - strokeColor: Ye, - textColor: ve, - textStroke: Ye, - textStrokeThickness: 4, - onPress: () => { - const { online: s } = i(Se); - s && - ((e.isPurchasing = true), - ym - .makePurchase(s.backend, n) - .then((e) => { - null !== e && - (a - .audio("audio/global/purchase-blocks.wav") - .play(), - t.onPurchaseComplete(e)); - }) - .catch((e) => { - "pending" === e.message - ? a.alert.ok( - "Waiting for pending payment, please check back later", - ) - : (console.error(e.message), - a.alert.ok("Couldn't complete purchase")); - }) - .finally(() => { - e.isPurchasing = false; - })); - }, - x: 80, - y: 70 - 60 * s, - }), - key: (e) => e.productId, - array: () => e.purchases, - }), - ], - ), - ], - ), - ], - }); - var Im = function (e, t, a, i) { - return new (a || (a = Promise))(function (n, s) { - function o(e) { - try { - l(i.next(e)); - } catch (e) { - s(e); - } - } - function r(e) { - try { - l(i.throw(e)); - } catch (e) { - s(e); - } - } - function l(e) { - var t; - e.done - ? n(e.value) - : ((t = e.value), - t instanceof a - ? t - : new a(function (e) { - e(t); - })).then(o, r); - } - l((i = i.apply(e, t || [])).next()); - }); - }; - const _m = makeCustomSprite({ - init: () => ({ didRequest: false }), - loop({ state: e, props: t, getContext: a }) { - var i; - if (e.didRequest) { - const { online: e } = a(Se); - if (e) - return ( - null === (i = t.onConnect) || void 0 === i || i.call(t), - { didRequest: false } - ); - } - return e; - }, - render({ device: e, getContext: t, updateState: a, state: i }) { - return [ - Fo({ - id: "GoOnline", - text: i.didRequest ? "LOADING" : "GO ONLINE", - width: 120, - height: 40, - onPress: () => - Im(this, void 0, void 0, function* () { - a(() => ({ didRequest: true })); - const { data: i } = yield Jp.getLocal(e.storage, e.alert), - { sendAccountAction: n } = t(Se); - n({ type: "goOnline", auth: i.auth }); - }), - }), - ]; - }, - }), - vm = makeSprite({ - init: () => ({ didRequest: false }), - loop({ state: e, props: t, getContext: a }) { - var i; - if (e.didRequest) { - const { online: n } = a(Se); - n && - (null === (i = t.onConnect) || void 0 === i || i.call(t), - (e.didRequest = false)); - } - }, - render({ device: e, getContext: t, state: a }) { - return [ - Yo.Single( - { - text: a.didRequest ? "LOADING" : "GO ONLINE", - width: 120, - height: 40, - onPress: () => - Im(this, void 0, void 0, function* () { - a.didRequest = true; - const { data: i } = yield Jp.getLocal( - e.storage, - e.alert, - ), - { sendAccountAction: n } = t(Se); - n({ type: "goOnline", auth: i.auth }); - }), - }, - (e) => { - e.text = a.didRequest ? "LOADING" : "GO ONLINE"; - }, - ), - ]; - }, - }), - Tm = makeCustomSprite({ - render: ({ - props: { - text: e, - selected: t, - width: a, - height: i, - disabled: s = false, - darkText: l = false, - darkBg: c = false, - fontSize: d = 15, - onPress: u, - noPress: h, - strokeColor: strokeColor = Me, - }, - device: p, - }) => [ - Clickable({ - id: "Clickable", - width: a, - height: i, - onPress: () => { - (p.audio("audio/global/button.wav").play(0), u()); - }, - disabled: s || h, - sprites: (u) => { - const h = u ? Ae : l ? Ue : Be; - return [ - // 5e01ff - So({ - id: "RaisedRects", - width: a, - height: i, - raiseHeight: 5, - rad: 5, - bottomColour: c ? Be : ve, - topColour: s ? Xe : u ? ke : Re, - isPressed: u, - stroke: { - colour: s ? ze : c ? Ye : strokeColor, - thickness: 2, - }, - sprites: (i) => [ - o({ - color: ve, - width: 15, - height: 15, - x: -a / 2 + 20, - y: i, - }), - t - ? r({ - color: h, - path: [ - [-8, 2], - [0, -6], - [12, 7], - ], - thickness: 5, - x: -a / 2 + 20, - y: i, - }) - : null, - n({ - font: { size: d }, - text: e, - color: h, - x: 10, - y: i, - }), - ], - }), - ]; - }, - }), - ], - }), - Rm = makeSprite({ - render: ({ props: e, device: t }) => [ - _e.Single( - { - width: e.width, - height: e.height, - onPress: () => { - (t.audio("audio/global/button.wav").play(0), e.onPress()); - }, - disabled: e.disabled || e.noPress, - sprites: (t) => { - const a = t ? Ae : e.darkText ? Ue : Be; - return [ - Io.Single( - { - width: e.width, - height: e.height, - raiseHeight: 5, - rad: 5, - bottomColour: e.darkBg ? Be : ve, - topColour: e.disabled ? Xe : t ? ke : Re, - isPressed: t, - stroke: { - colour: e.disabled ? ze : e.darkBg ? Ye : Me, - thickness: 2, - }, - sprites: (t) => [ - p({ - color: ve, - width: 15, - height: 15, - x: -e.width / 2 + 20, - y: t, - }), - ifConditional( - () => e.selected, - () => [ - m({ - color: a, - path: [ - [-8, 2], - [0, -6], - [12, 7], - ], - thickness: 5, - x: -e.width / 2 + 20, - y: t, - }), - ], - ), - c({ - font: { - size: - e.fontSize || (e.text.length > 18 ? 13 : 15), - }, - text: localize(e.text), - color: a, - x: 10, - y: t, - }), - ], - }, - (a) => { - ((a.bottomColour = e.darkBg ? Be : ve), - (a.topColour = e.disabled ? Xe : t ? ke : Re), - (a.stroke.colour = e.disabled - ? ze - : e.darkBg - ? Ye - : Me)); - }, - ), - ]; - }, - }, - (t) => { - t.disabled = e.disabled || e.noPress; - }, - ), - ], - }); - const Om = makeSprite({ - init({ getContext: e }) { - const { settings: t } = e(Se); - return { - initSettings: t, - headphonesSync: null, - didChangeHeadphoneSync: false, - }; - }, - loop({ state: e }) { - null !== e.headphonesSync && - (e.headphonesSync++, - e.headphonesSync > 60 && (e.headphonesSync = null)); - }, - render({ props: e, getContext: t, device: a, state: i }) { - const n = { ref: "MAX" }, - s = (e) => { - n.ref = - e >= 1 - ? "MAX" - : e >= 0.7 - ? "HIGH" - : e >= 0.4 - ? "MED" - : "LOW"; - }; - return ( - s(a.resolution.get()), - [ - Bo.Single( - { - containerHeight: a.size.fullHeight - 70 + 50, - containerWidth: a.size.fullWidth, - contentHeight: 850, - y: (a.size.fullHeight - 70) / 2 + 35, - sprites: (o) => [ - c({ - text: `${localize("RESOLUTION")}:`, - font: { size: 15 }, - color: ve, - x: -130, - y: -50, - }), - Yo.Single( - { - text: localize("LOW"), - onPress: () => { - (a.resolution.set(0.25), s(0.25)); - }, - width: 50, - height: 40, - x: -40, - y: -50, - }, - (e) => { - ((e.disabled = "LOW" === n.ref), - (e.noPress = o.ref)); - }, - ), - Yo.Single( - { - text: localize("MED"), - onPress: () => { - (a.resolution.set(0.5), s(0.5)); - }, - width: 50, - height: 40, - x: 20, - y: -50, - }, - (e) => { - ((e.disabled = "MED" === n.ref), - (e.noPress = o.ref)); - }, - ), - Yo.Single( - { - text: localize("HIGH"), - onPress: () => { - (a.resolution.set(0.75), s(0.75)); - }, - width: 50, - height: 40, - x: 80, - y: -50, - }, - (e) => { - ((e.disabled = "HIGH" === n.ref), - (e.noPress = o.ref)); - }, - ), - Yo.Single( - { - text: localize("MAX"), - onPress: () => { - (a.resolution.set(1), s(1)); - }, - width: 50, - height: 40, - x: 140, - y: -50, - }, - (e) => { - ((e.disabled = "MAX" === n.ref), - (e.noPress = o.ref)); - }, - ), - c({ - text: `${localize("MUSIC")}:`, - font: { size: 15 }, - color: ve, - x: -130, - y: -100, - }), - sliderSprite.Single( - { - x: 50, - y: -100, - value: a.globalAudio.volume, - setValue: (e) => { - a.globalAudio.setVolume(e); - }, - }, - (e) => { - e.value = a.globalAudio.volume; - }, - ), - /*c({ - text: "SFX:", - font: { size: 15 }, - color: ve, - x: -130, - y: -120, - }), - wm.Single( - { - x: 50, - y: -120, - value: a.globalAudio.volume, - setValue: (e) => { - a.globalAudio.setVolume(e); - }, - }, - (e) => { - e.value = a.globalAudio.volume; - } - ),*/ - c({ - text: localize("HEADPHONE"), - font: { size: 15 }, - color: ve, - x: -140, - y: -140, - }), - c( - { font: { size: 15 }, color: ve, x: -140, y: -160 }, - (e) => { - const { settings: a } = t(Se); - e.text = `${localize("DELAY")}: ${1000 * a.headphonesDelay}ms`; - }, - ), - sliderSprite.Single( - { - x: 50, - y: -150, - value: 0, - setValue: (e) => { - const { updateSettings: a } = t(Se); - ((i.didChangeHeadphoneSync = true), - a({ - headphonesDelay: Math.round(1000 * e) / 1000, - })); - }, - }, - (e) => { - const { settings: a } = t(Se); - ((e.value = a.headphonesDelay), - (e.shouldFlash = - null !== i.headphonesSync && - i.headphonesSync === - Math.round(60 * a.headphonesDelay) + 1)); - }, - ), - Yo.Single( - { - text: localize("PLAY SOUND"), - noSfx: true, - onPress: () => { - ((i.didChangeHeadphoneSync = true), - (i.headphonesSync = 0), - a - .audio("audio/global/sync.wav") - .play({ overwrite: true, fromPosition: 0 })); - }, - width: 120, - height: 40, - x: 235, - y: -150, - }, - (e) => { - e.noPress = o.ref; - }, - ), - ifConditional( - () => i.didChangeHeadphoneSync, - () => [ - c({ - text: localize("TIP: MOVE KNOB SO IT FLASHES"), - color: ve, - x: 235, - y: -180, - }), - c({ - text: localize("WHEN YOU HEAR SOUND PLAYED"), - color: ve, - x: 235, - y: -193, - }), - ], - ), - Rm.Single( - { - text: "PLAIN BACKGROUND", - selected: false, - onPress: () => { - const { settings: e, updateSettings: a } = t(Se); - a({ plainBackground: !e.plainBackground }); - }, - width: 250, - height: 40, - y: -200, - }, - (e) => { - const { settings: a } = t(Se); - ((e.selected = a.plainBackground), - (e.noPress = o.ref)); - }, - ), - Rm.Single( - { - text: "HIDE PLAYER TRAIL", - selected: false, - onPress: () => { - const { settings: e, updateSettings: a } = t(Se); - a({ hidePlayerTrail: !e.hidePlayerTrail }); - }, - width: 250, - height: 40, - y: -250, - }, - (e) => { - const { settings: a } = t(Se); - ((e.selected = a.hidePlayerTrail), - (e.noPress = o.ref)); - }, - ), - Rm.Single( - { - text: "HIDE BUTTONS", - selected: false, - onPress: () => { - const { settings: e, updateSettings: a } = t(Se); - a({ hideUi: !e.hideUi }); - }, - width: 250, - height: 40, - y: -300, - }, - (e) => { - const { settings: a } = t(Se); - ((e.selected = a.hideUi), (e.noPress = o.ref)); - }, - ), - Rm.Single( - { - text: "MUTE GAME SFX", - selected: false, - onPress: () => { - const { settings: e, updateSettings: a } = t(Se); - a({ muteSfx: !e.muteSfx }); - }, - width: 250, - height: 40, - y: -350, - }, - (e) => { - const { settings: a } = t(Se); - ((e.selected = a.muteSfx), (e.noPress = o.ref)); - }, - ), - Rm.Single( - { - text: "MUTE JUMP SFX", - selected: false, - disabled: false, - onPress: () => { - const { settings: e, updateSettings: a } = t(Se); - a({ muteJump: !e.muteJump }); - }, - width: 250, - height: 40, - y: -400, - }, - (e) => { - const { settings: a } = t(Se); - ((e.selected = a.muteSfx || a.muteJump), - (e.disabled = a.muteSfx), - (e.noPress = o.ref)); - }, - ), - Rm.Single( - { - text: "MUTE MENU MUSIC", - selected: false, - onPress: () => { - var a; - const { settings: i, updateSettings: n } = t(Se); - (null === (a = e.onMenuMusicMute) || - void 0 === a || - a.call(e, !i.muteMenuMusic), - n({ muteMenuMusic: !i.muteMenuMusic })); - }, - width: 250, - height: 40, - y: -450, - }, - (e) => { - const { settings: a } = t(Se); - ((e.selected = a.muteMenuMusic), - (e.noPress = o.ref)); - }, - ), - Rm.Single( - { - text: "OVERLAP IN EDITOR", - selected: false, - onPress: () => { - var a; - const { settings: i, updateSettings: n } = t(Se); - n({ overlapObjects: !i.overlapObjects }); - overlapObjects = i.overlapObjects; - }, - width: 250, - height: 40, - y: -500, - }, - (e) => { - const { settings: a } = t(Se); - overlapObjects = a.overlapObjects; - ((e.selected = a.overlapObjects), - (e.noPress = o.ref)); - }, - ), - Rm.Single( - { - text: "SHOW EDITOR ANIMATIONS", - selected: false, - onPress: () => { - var a; - const { settings: i, updateSettings: n } = t(Se); - n({ animateEditor: !i.animateEditor }); - }, - width: 250, - height: 40, - y: -550, - }, - (e) => { - const { settings: a } = t(Se); - ((e.selected = a.animateEditor), - (e.noPress = o.ref)); - }, - ), - Rm.Single( - { - text: "MIRROR MENU BUTTON", - selected: false, - onPress: () => { - var a; - const { settings: i, updateSettings: n } = t(Se); - n({ mirrorMenuButton: !i.mirrorMenuButton }); - mirrorMenuButton = i.mirrorMenuButton; - }, - width: 250, - height: 40, - y: -600, - }, - (e) => { - const { settings: a } = t(Se); - mirrorMenuButton = a.mirrorMenuButton; - ((e.selected = a.mirrorMenuButton), - (e.noPress = o.ref)); - }, - ), - Rm.Single( - { - text: "DISABLE PLAYER GLOW", - selected: false, - onPress: () => { - var a; - const { settings: i, updateSettings: n } = t(Se); - n({ hidePlayerGlow: !i.hidePlayerGlow }); - }, - width: 250, - height: 40, - y: -650, - }, - (e) => { - const { settings: a } = t(Se); - ((e.selected = a.hidePlayerGlow), - (e.noPress = o.ref)); - }, - ), - Rm.Single( - { - text: "FADE OUT ATTEMPTS", - selected: false, - onPress: () => { - var a; - const { settings: i, updateSettings: n } = t(Se); - n({ fadeOutAttempts: !i.fadeOutAttempts }); - }, - width: 250, - height: 40, - y: -700, - }, - (e) => { - const { settings: a } = t(Se); - ((e.selected = a.fadeOutAttempts), - (e.noPress = o.ref)); - }, - ), - /*Rm.Single( - { - text: '"INFINITE" TRAIL', - selected: false, - onPress: () => { - var a; - const { settings: i, updateSettings: n } = t(Se); - n({ flyingTrail: !i.flyingTrail }); - }, - width: 250, - height: 40, - y: -750, - }, - (e) => { - const { settings: a } = t(Se); - ((e.selected = a.flyingTrail), (e.noPress = o.ref)); - }, - ),*/ - Rm.Single( - { - text: "SHOW DEBUG INFO", - selected: false, - onPress: () => { - var a; - const { settings: i, updateSettings: n } = t(Se); - n({ showDebug: !i.showDebug }); - }, - width: 250, - height: 40, - y: -750, - }, - (e) => { - const { settings: a } = t(Se); - ((e.selected = a.showDebug), (e.noPress = o.ref)); - }, - ), - Rm.Single( - { - text: "DISABLE RELEASE BUFFER", - selected: false, - onPress: () => { - var a; - const { settings: i, updateSettings: n } = t(Se); - n({ - disableReleaseBuffer: !i.disableReleaseBuffer, - }); - }, - width: 250, - height: 40, - y: -800, - }, - (e) => { - const { settings: a } = t(Se); - ((e.selected = a.disableReleaseBuffer), - (e.noPress = o.ref)); - }, - ), - ], - }, - (e) => { - ((e.containerHeight = a.size.fullHeight - 70), - (e.containerWidth = a.size.fullWidth), - (e.y = (a.size.fullHeight - 70) / 2 + 35)); - }, - ), - Yo.Single( - { - text: localize("BACK"), - width: 80, - height: 40, - onPress: () => { - return ( - (n = this), - (s = void 0), - (r = function* () { - const { settings: n, online: s } = t(Se); - if ( - (e.goBack(), - (function (e, t) { - let a = true; - return ( - Object.entries(e).forEach(([e, i]) => { - i !== t[e] && (a = false); - }), - a - ); - })(i.initSettings, n)) - ) - return; - const o = yield Jp.saveAccount( - a.storage, - null, - a.alert, - a.now, - { settings: n }, - ); - s && - (yield bp.updateAccountStorage( - s.backend, - o, - a.now, - )); - }), - new ((o = void 0) || (o = Promise))(function (e, t) { - function a(e) { - try { - l(r.next(e)); - } catch (e) { - t(e); - } - } - function i(e) { - try { - l(r.throw(e)); - } catch (e) { - t(e); - } - } - function l(t) { - var n; - t.done - ? e(t.value) - : ((n = t.value), - n instanceof o - ? n - : new o(function (e) { - e(n); - })).then(a, i); - } - l((r = r.apply(n, s || [])).next()); - }) - ); - var n, s, o, r; - }, - y: -a.size.fullHeight / 2 + 40, - }, - (e) => { - e.y = -a.size.fullHeight / 2 + 40; - }, - ), - ] - ); - }, - }), - Cm = makeSprite({ - render: ({ props: e }) => [ - Se.Single({ - context: () => e.globalContextVal, - sprites: [ - Om.Single( - { goBack: e.goBack, onMenuMusicMute: e.onMenuMusicMute }, - (t) => { - ((t.goBack = e.goBack), - (t.onMenuMusicMute = e.onMenuMusicMute)); - }, - ), - ], - }), - ], - }), - sliderSprite = makeSprite({ - loop({ props: e, getInputs: t, getContext: a }) { - const { pointer: i } = t(); - if (i.pressed && i.y > -15 && i.y < 15) { - const { addToOnPressQueue: t } = a(Se); - t(() => { - e.setValue(B.clamp2(0, 1, (i.x + 110) / 220)); - }); - } - }, - render: ({ props: e }) => [ - qe({ width: 220, height: 10, fillColor: Xe, rad: 2 }), - u({ radius: 15, color: Me, x: 220 * e.value - 110 }, (t) => { - t.x = 220 * e.value - 110; - }), - u({ radius: 12, color: Re, x: 220 * e.value - 110 }, (t) => { - ((t.x = 220 * e.value - 110), - (t.color = e.shouldFlash ? ve : Re)); - }), - ], - }); - var Am = function (e, t, a, i) { - return new (a || (a = Promise))(function (n, s) { - function o(e) { - try { - l(i.next(e)); - } catch (e) { - s(e); - } - } - function r(e) { - try { - l(i.throw(e)); - } catch (e) { - s(e); - } - } - function l(e) { - var t; - e.done - ? n(e.value) - : ((t = e.value), - t instanceof a - ? t - : new a(function (e) { - e(t); - })).then(o, r); - } - l((i = i.apply(e, t || [])).next()); - }); - }; - const gameplayOverlay = makeSprite({ - init: () => ({ boostersMenuOpen: false }), - loop({ props: e, getInputs: t, device: a }) { - let keysPressed = t().keysJustPressed - keysPressed.Escape && (e.paused ? e.onResume() : e.onPause()); - keysPressed.z && (e.addCheckpoint()); - keysPressed.x && (e.removeCheckpoint()); - keysPressed.r && e.onReset && ((e.paused || e.onPause()), true) && a.alert.okCancel( - localize( - "Are you sure you want to return to the beginning?", - ), - (t) => - Am(this, void 0, void 0, function* () { - t && e.onReset(); - }), - ); - }, - render({ props: e, state: t, device: a, getContext: i }) { - const { settings: n } = i(Se); - return [ - menuButtonSprite.Single( - { - hidden: n.hideUi, - onPress: e.onPause, - x: - (-a.size.fullWidth / 2 + - (isSpecialTheme(e.theme) ? 35 : 50)) * - (n.mirrorMenuButton ? -1 : 1), - y: - a.size.fullHeight / 2 - - (isSpecialTheme(e.theme) ? 25 : 50), - theme: e.theme, - background: e.background, - }, - (t) => { - ((t.background = e.background), - (t.hidden = i(Se).settings.hideUi), - (t.x = - (-a.size.fullWidth / 2 + - (isSpecialTheme(t.theme) ? 35 : 50)) * - (i(Se).settings.mirrorMenuButton ? -1 : 1)), - (t.y = - a.size.fullHeight / 2 - - (isSpecialTheme(t.theme) ? 25 : 50))); - }, - ), - ifConditional( - () => !i(Se).settings.hideUi, - () => [ - Yo.Single( - { - text: localize("FLAG"), - onPress: () => { - (e.addCheckpoint()); - }, - width: Pm, - height: Mm, - x: - Mm / -2, - y: a.size.fullHeight / -2 + 40, - }, - (e) => { - ((e.x = Mm / -2), - (e.y = a.size.fullHeight / -2 + 40)); - }, - ), - Yo.Single( - { - text: "<", - onPress: () => { - (e.removeCheckpoint()); - }, - width: Mm, - height: Mm, - x: - Pm / 2, - y: a.size.fullHeight / -2 + 40, - }, - (e) => { - ((e.x = Pm / 2), - (e.y = a.size.fullHeight / -2 + 40)); - }, - ), - ] - ), - c({ - text: localize(`PRACTICE MODE`), - font: { size: 15 }, - color: Ve, - x: 0, - y: a.size.fullHeight / -2 + 10, - hidden: true - }, (t) => { - t.opacity = +e.isPractice - }), - ifConditional( - () => void 0 !== e.boosters, - () => [ - Yo.Single( - { - text: localize("BOOSTERS"), - onPress: () => { - (e.boosters.onOpen(), - e.onPause(), - (t.boostersMenuOpen = true)); - }, - width: Pm, - height: Mm, - x: - (a.size.fullWidth / 2 - 80) * - (n.mirrorMenuButton ? -1 : 1), - y: a.size.fullHeight / 2 - 50, - }, - (e) => { - ((e.x = - (a.size.fullWidth / 2 - 80) * - (i(Se).settings.mirrorMenuButton ? -1 : 1)), - (e.y = a.size.fullHeight / 2 - 50)); - }, - ), - ifConditional( - () => e.boosters.showPrompt, - () => [ - Fm.Single( - { - x: a.size.fullWidth / 2 - 40, - y: a.size.fullHeight / 2 - 85, - }, - (e) => { - ((e.x = a.size.fullWidth / 2 - 40), - (e.y = a.size.fullHeight / 2 - 85)); - }, - ), - ], - ), - ], - ), - ifConditional( - () => e.paused, - () => [ - conditional( - () => t.boostersMenuOpen && void 0 !== e.boosters, - () => [ - Lm.Single( - { - booster: e.boosters.booster, - pressedBooster: (a) => { - (e.boosters.pressedBooster(a), - (t.boostersMenuOpen = false)); - }, - closeMenu: () => { - ((t.boostersMenuOpen = false), e.onResume()); - }, - disableMissiles: e.boosters.disableMissiles, - }, - (t) => { - t.booster = e.boosters.booster; - }, - ), - ], - () => [ - pauseMenu.Single( - { - backToMenu: e.backToMenu, - onResume: e.onResume, - onReset: e.onReset, - onEndGame: e.onEndGame, - attempt: e.attempt, - frame: e.frame, - maxFrame: e.maxFrame, - fadeOutAttempts: e.fadeOutAttempts, - }, - (t) => { - t.fadeOutAttempts = e.fadeOutAttempts; - }, - ), - ], - ), - ], - ), - ]; - }, - }), - pauseMenu = makeSprite({ - init: ({ props: { onReset: e, onEndGame: t } }) => ({ - xPositions: - e || t - ? Array.from({ length: 4 }).map((e, t) => 170 * (t - 1.5)) - : Array.from({ length: 3 }).map((e, t) => 170 * (t - 1)), - showSettings: false, - }), - render({ props: e, state: t, device: a }) { - return [ - _e.Single( - { - width: a.size.fullWidth, - height: a.size.fullHeight, - sprites: () => [], - onPress: () => null, - }, - (e) => { - ((e.width = a.size.fullWidth), - (e.height = a.size.fullHeight)); - }, - ), - p( - { - color: "#34065a", - opacity: 0.74, - width: a.size.fullWidth, - height: a.size.fullHeight, - }, - (e) => { - ((e.width = a.size.fullWidth), - (e.height = a.size.fullHeight)); - }, - ), - conditional( - () => t.showSettings, - () => [ - Om.Single({ - goBack: () => { - t.showSettings = false; - }, - }), - ], - () => [ - ifConditional( - () => e.fadeOutAttempts, - () => [ - c({ - text: `${localize("ATTEMPT")} ${e.attempt}`, - font: { size: 15 }, - color: ve, - x: 0, - y: -a.size.fullHeight * 0.45, - }), - ], - ), - ifConditional( - () => e.maxFrame > 0, - () => [ - c({ - text: `${(e.frame / e.maxFrame) * 100}%`, - font: { size: 15 }, - color: ve, - x: 0, - y: -a.size.fullHeight * 0.45 + 15, - }), - ], - ), - Je.Single({ - text: localize("RESUME"), - width: 100, - height: 100, - onPress: e.onResume, - x: t.xPositions[0], - }), - Je.Single({ - text: localize("SETTINGS"), - width: 100, - height: 100, - onPress: () => { - t.showSettings = true; - }, - x: t.xPositions[1], - }), - conditional( - () => void 0 !== e.onReset, - () => [ - Je.Single({ - text: localize("RESET"), - width: 100, - height: 100, - onPress: () => { - a.alert.okCancel( - localize( - "Are you sure you want to return to the beginning?", - ), - (t) => - Am(this, void 0, void 0, function* () { - t && e.onReset(); - }), - ); - }, - x: t.xPositions[2], - }), - ], - () => [ - ifConditional( - () => void 0 !== e.onEndGame, - () => [ - Je.Single({ - text: "END GAME", - colour: xe, - width: 100, - height: 100, - onPress: () => { - a.alert.okCancel( - localize( - "Are you sure you want to end the game for all players?", - ), - (t) => - Am(this, void 0, void 0, function* () { - t && (e.onResume(), e.onEndGame()); - }), - ); - }, - x: t.xPositions[2], - }), - ], - ), - ], - ), - Je.Single({ - text: localize("MENU"), - width: 100, - height: 100, - onPress: e.backToMenu, - x: t.xPositions[t.xPositions.length - 1], - }), - ], - ), - ]; - }, - }); - function xm(e, t, a) { - return !( - !a || - !a.withCheckpoints || - t || - (a.showBoostersPrompt && "waitingToShow" === e) - ); - } - const Pm = 110, - Mm = 40, - Lm = makeSprite({ - init: ({ props: e, getState: t }) => - e.booster - ? { - view: { - type: "boosters", - boosters: { - items: [], - numAutopilots: 0, - numMissiles: 0, - numSlowMotions: 0, - }, - buying: null, - }, - } - : (Jp.getUserItems("booster").then((e) => { - t().view = { - type: "boosters", - boosters: Object.assign( - { items: e }, - kp.calculateNumberBoosters(e), - ), - buying: null, - }; - }), - { view: { type: "loading" } }), - render: ({ props: e, state: t, device: a, getContext: i }) => [ - p({ width: 600, height: 320, color: ve }), - _e.Single({ - onPressOutside: e.closeMenu, - width: 600, - height: 320, - sprites: () => [], - onPress: () => null, - }), - Yo.Single({ - text: "X", - x: 300, - y: 160, - width: 40, - height: 40, - onPress: e.closeMenu, - strokeColor: Ye, - }), - c({ - font: { size: 38 }, - text: localize("BOOSTERS"), - strokeColor: Ye, - color: ve, - strokeThickness: 12, - y: 160, - }), - conditional( - () => "loading" === t.view.type, - () => [ - c({ - text: `${localize("LOADING")}...`, - color: ve, - strokeColor: Ye, - strokeThickness: 3, - }), - ], - () => { - var n, s, o; - const r = () => { - e.booster && e.pressedBooster(e.booster); - }, - l = (e) => { - t.view.buying = e; - }, - d = (n) => { - const s = t.view.boosters.items.find( - (e) => e.booster.type === n.type, - ); - if (!s) return; - t.view = { type: "loading" }; - const { online: o } = i(Se); - o - ? bp - .useItem(o.backend, s) - .then((e) => Jp.useBooster(a.now, e || s, false)) - .then(() => { - e.pressedBooster(s.booster); - }) - .catch((t) => { - a.alert.ok( - `Failed to use item: ${t.message}`, - e.closeMenu, - ); - }) - : Jp.useBooster(a.now, s, true).then(() => { - e.pressedBooster(s.booster); - }); - }; - return [ - c({ - text: localize("BOOSTERS LAST UNTIL THE NEXT CHECKPOINT"), - font: { size: 15 }, - color: Ye, - y: -120, - }), - Dm.Single( - { - name: "AUTOPILOT", - isBeingUsed: - "autopilot" === - (null === (n = e.booster) || void 0 === n - ? void 0 - : n.type), - disable: null !== e.booster && "autopilot" !== e.booster.type, - numBooster: t.view.boosters.numAutopilots, - onUseBooster: () => { - d(Pu()); - }, - onAddBooster: () => { - l(Pu()); - }, - onCancelBooster: r, - x: -190, - y: 20, - }, - (a) => { - var i; - ((a.isBeingUsed = - "autopilot" === - (null === (i = e.booster) || void 0 === i - ? void 0 - : i.type)), - (a.disable = null !== e.booster && - "autopilot" !== e.booster.type), - "boosters" === t.view.type && - (a.numBooster = t.view.boosters.numAutopilots)); - }, - ), - Dm.Single( - { - name: "MISSILES", - isBeingUsed: - "missiles" === - (null === (s = e.booster) || void 0 === s - ? void 0 - : s.type), - disable: - (null !== e.booster && - "missiles" !== e.booster.type) || - e.disableMissiles, - numBooster: t.view.boosters.numMissiles, - onUseBooster: () => { - d(Mu()); - }, - onAddBooster: () => { - l(Mu()); - }, - onCancelBooster: r, - y: 20, - }, - (a) => { - var i; - ((a.isBeingUsed = - "missiles" === - (null === (i = e.booster) || void 0 === i - ? void 0 - : i.type)), - (a.disable = - (null !== e.booster && - "missiles" !== e.booster.type) || - e.disableMissiles), - "boosters" === t.view.type && - (a.numBooster = t.view.boosters.numMissiles)); - }, - ), - Dm.Single( - { - name: "SLOW MOTION", - isBeingUsed: - "slowmo" === - (null === (o = e.booster) || void 0 === o - ? void 0 - : o.type), - disable: - null !== e.booster && "slowmo" !== e.booster.type, - numBooster: t.view.boosters.numSlowMotions, - onUseBooster: () => { - d(Lu()); - }, - onAddBooster: () => { - l(Lu()); - }, - onCancelBooster: r, - x: 190, - y: 20, - }, - (a) => { - var i; - ((a.isBeingUsed = - "slowmo" === - (null === (i = e.booster) || void 0 === i - ? void 0 - : i.type)), - (a.disable = - null !== e.booster && "slowmo" !== e.booster.type), - "boosters" === t.view.type && - (a.numBooster = t.view.boosters.numSlowMotions)); - }, - ), - ifConditional( - () => - "boosters" === t.view.type && null !== t.view.buying, - () => [ - Bm.Single({ - booster: t.view.buying, - addItem: (e) => { - const a = t.view, - i = [...a.boosters.items, e]; - a.boosters = Object.assign( - { items: i }, - kp.calculateNumberBoosters(i), - ); - }, - closeMenu: () => { - t.view.buying = null; - }, - }), - ], - ), - ]; - }, - ), - ], - }), - Dm = makeSprite({ - render: ({ props: e }) => [ - m( - { - thickness: 4, - color: Ye, - lineCap: "round", - path: [ - [-80, 50], - [-50, 80], - [80, 80], - [80, -50], - [50, -80], - [-80, -80], - [-80, 50], - ], - }, - (t) => { - t.fillColor = e.isBeingUsed ? Ye : void 0; - }, - ), - Yo.Single( - { - text: localize(e.name), - disabled: e.disable || e.isBeingUsed || 0 === e.numBooster, - width: 140, - height: 60, - onPress: () => { - e.onUseBooster(); - }, - y: 20, - }, - (t) => { - t.disabled = e.disable || e.isBeingUsed || 0 === e.numBooster; - }, - ), - conditional( - () => e.isBeingUsed, - () => [ - Yo.Single({ - text: "CANCEL", - width: 100, - height: 40, - onPress: () => { - e.onCancelBooster(); - }, - y: -40, - }), - ], - () => [ - ifConditional( - () => !e.disable, - () => [ - conditional( - () => 0 === e.numBooster, - () => [ - Yo.Single({ - text: "+", - fontSize: 30, - width: 40, - height: 40, - onPress: () => { - e.onAddBooster(); - }, - y: -40, - }), - ], - () => [ - c( - { - text: `x${e.numBooster}`, - font: { size: 20 }, - color: Re, - strokeColor: Ye, - strokeThickness: 4, - y: -40, - }, - (t) => { - t.text = `x${e.numBooster}`; - }, - ), - ], - ), - ], - ), - ], - ), - ], - }), - Bm = makeSprite({ - init({ props: e, device: t, getState: a, getContext: i }) { - const { online: n } = i(Se); - return ( - n && - bp - .getBuyableItems(n.backend, e.booster.type) - .then((e) => { - a().items = e; - }) - .catch((a) => { - t.alert.ok( - `Couldn't retrieve items from store: ${a.message}`, - () => { - e.closeMenu(); - }, - ); - }), - { - items: "loading", - showBuyBlocksModal: null, - isPurchasing: false, - } - ); - }, - render: ({ props: e, state: t, device: a, getContext: i }) => [ - _e.Single({ - onPressOutside: e.closeMenu, - width: 600, - height: 320, - sprites: () => [], - onPress: () => null, - }), - qe({ - width: 600, - height: 320, - fillColor: ve, - color: Ye, - thickness: 8, - }), - Yo.Single({ - text: "X", - x: 300, - y: 160, - width: 40, - height: 40, - onPress: e.closeMenu, - strokeColor: Ye, - }), - conditional( - () => null === i(Se).online, - () => [ - c({ - text: localize("CONNECT ONLINE TO BUY BOOSTERS"), - color: Ye, - }), - vm.Single({ y: -50 }), - ], - () => { - const n = (i, n) => { - bp.buyItem(n.backend, i) - .then(({ balance: t, item: i }) => { - if ( - (n.updateBlocksBalance(t), "boosterItem" === i.type) - ) - return ( - e.addItem(i), - a.audio("audio/global/purchase-item.wav").play(), - Jp.addPurchasedItems([i], a.now) - ); - }) - .then(() => { - e.closeMenu(); - }) - .catch((e) => { - a.alert.ok(`Error buying item: ${e.message}`); - }) - .finally(() => { - t.isPurchasing = false; - }); - }; - return [ - c( - { - color: ve, - strokeColor: Ye, - font: { size: 15 }, - strokeThickness: 6, - x: 200, - y: 50, - }, - (e) => { - const { blocksBalance: t } = i(Se).online; - e.text = `BLOCKS: ${t}`; - }, - ), - ...(zu.hasIAP() - ? [ - Yo.Single({ - text: "+", - fontSize: 30, - width: 60, - height: 60, - onPress: () => { - t.showBuyBlocksModal = {}; - }, - x: 210, - strokeColor: Ye, - textColor: ve, - textStroke: Ye, - textStrokeThickness: 6, - }), - ] - : [ - c({ - font: { size: 14 }, - text: "GET ACHIEVEMENTS", - color: Me, - x: 210, - y: 0, - }), - c({ - font: { size: 14 }, - text: "TO EARN", - color: Me, - x: 210, - y: -20, - }), - c({ - font: { size: 14 }, - text: "MORE BLOCKS", - color: Me, - x: 210, - y: -40, - }), - ]), - conditional( - () => "loading" === t.items, - () => [ - c({ - text: `${localize("LOADING")}...`, - font: { size: 20 }, - color: Ye, - }), - ], - () => [ - conditional( - () => t.isPurchasing, - () => [ - c({ - text: `${localize("PURCHASING")}...`, - font: { size: 20 }, - color: Ye, - }), - ], - () => [ - d({ - props: (e, t) => ({ - font: { size: 18 }, - x: -150, - color: ve, - strokeColor: Ye, - strokeThickness: 4, - text: e.name, - y: 80 - 80 * t, - }), - array: () => t.items, - }), - Yo.Array({ - props: (e, a) => ({ - text: `${e.blocksPrice} BLOCKS`, - strokeColor: Ye, - textColor: ve, - textStroke: Ye, - textStrokeThickness: 5, - width: 130, - height: 50, - onPress: () => { - const a = i(Se).online; - ((t.isPurchasing = true), - e.blocksPrice > a.blocksBalance - ? (t.showBuyBlocksModal = { - buyItemOnComplete: e, - }) - : n(e, a)); - }, - x: 50, - y: 80 - 80 * a, - }), - key: (e, t) => t, - array: () => t.items, - }), - ], - ), - ], - ), - ifConditional( - () => null !== t.showBuyBlocksModal, - () => [ - Sm.Single({ - onModalClose: () => { - ((t.showBuyBlocksModal = null), - (t.isPurchasing = false)); - }, - onPurchaseComplete: (e) => { - const a = i(Se).online, - { buyItemOnComplete: s } = t.showBuyBlocksModal; - (s && e >= s.blocksPrice && n(s, a), - a.updateBlocksBalance(e), - (t.showBuyBlocksModal = null)); - }, - }), - ], - ), - ]; - }, - ), - ], - }), - Fm = makeSprite({ - init: () => ({ arrowY: 0 }), - loop({ state: e }) { - ((e.arrowY += 0.3), e.arrowY > 10 && (e.arrowY = -10)); - }, - render: ({ state: e }) => [ - c({ - text: localize("STUCK? TRY A BOOSTER"), - color: "white", - font: { align: "right", size: 14 }, - x: -15, - }), - y( - { fileName: "images/level/arrow-up.png", width: 14, height: 8 }, - (t) => { - t.y = -5 + Math.abs(e.arrowY); - }, - ), - ], - }), - Ym = JSON.parse( - '{"75":1,"81":0,"186":1,"193":0,"303":1,"313":0,"332":1,"339":0,"440":1,"449":0,"548":1,"559":0,"612":1,"676":0,"717":1,"727":0,"775":1,"784":0,"881":1,"968":0,"1051":1,"1061":0,"1133":1,"1142":0,"1187":1,"1195":0,"1215":1,"1280":0,"1327":1,"1337":0,"1370":1,"1378":0,"1443":1,"1452":0,"1497":1,"1504":0,"1553":1,"1621":0,"1660":1,"1671":0,"1773":1,"1859":0,"2042":1,"2051":0,"2125":1,"2133":0,"2180":1,"2187":0,"2238":1,"2247":0,"2276":1,"2284":0,"2337":1,"2344":0,"2389":1,"2396":0,"2422":1,"2429":0,"2472":1,"2480":0,"2527":1,"2535":0,"2725":1,"2837":0,"2897":1,"2904":0,"2939":1,"2948":0,"3005":1,"3013":0,"3060":1,"3068":0,"3089":1,"3296":0,"3338":1,"3346":0,"3409":1,"3416":0,"3510":1,"3518":0,"3685":1,"3692":0,"3802":1,"3810":0,"3833":1,"3843":0,"3863":1,"3873":0,"3913":1,"3921":0,"4010":1,"4017":0,"4093":1,"4101":0,"4136":1,"4143":0,"4166":1,"4177":0,"4240":1,"4247":0,"4308":1,"4314":0,"4348":1,"4356":0,"4373":1,"4380":0,"4501":1,"4512":0,"4608":1,"4615":0,"4699":1,"4737":0,"4833":1,"4842":0,"4944":1,"4952":0,"5043":1,"5048":0,"5129":1,"5138":0,"5165":1,"5173":0,"5252":1,"5260":0,"5284":1,"5291":0,"5387":1,"5397":0,"5489":1,"5496":0,"5539":1,"5577":0,"5606":1,"5615":0,"5711":1,"5719":0,"5753":1,"5817":0,"5838":1,"5848":0,"5929":1,"5963":0,"6043":1,"6054":0,"6128":1,"6137":0,"6203":1,"6594":0,"6840":1,"6849":0,"6869":1,"6957":0,"7054":1,"7064":0,"7184":1,"7192":0,"7233":1,"7242":0,"7287":1,"7295":0,"7348":1,"7356":0,"7438":1,"7443":0,"7496":1,"7504":0,"7528":1,"7536":0,"7623":1,"7659":0,"7686":1,"7748":0,"7799":1,"7809":0,"7864":1,"7928":0,"8006":1,"8093":0,"8126":1,"8136":0,"8257":1,"8266":0,"8290":1,"8299":0,"8348":1,"8359":0,"8460":1,"8519":0,"8558":1,"8567":0,"8604":1,"8616":0,"8664":1,"8672":0}', - ), - Um = JSON.parse( - '{"113":1,"120":0,"196":1,"204":0,"227":1,"236":0,"354":1,"363":0,"456":1,"466":0,"476":1,"486":0,"728":1,"736":0,"859":1,"865":0,"953":1,"961":0,"976":1,"986":0,"1112":1,"1120":0,"1211":1,"1219":0,"1267":1,"1277":0,"1308":1,"1317":0,"1347":1,"1357":0,"1601":1,"1609":0,"1659":1,"1668":0,"1720":1,"1730":0,"1814":1,"1851":0,"1904":1,"1913":0,"1981":1,"1989":0,"2027":1,"2035":0,"2157":1,"2164":0,"2172":1,"2181":0,"2221":1,"2229":0,"2268":1,"2278":0,"2298":1,"2309":0,"2361":1,"2370":0,"2443":1,"2450":0,"2472":1,"2481":0,"2502":1,"2511":0,"2541":1,"2549":0,"2572":1,"2582":0,"2602":1,"2613":0,"2661":1,"2669":0,"2694":1,"2706":0,"2735":1,"2797":0,"2819":1,"2831":0,"2846":1,"2858":0,"2875":1,"2885":0,"2937":1,"2947":0,"2993":1,"3001":0,"3020":1,"3029":0,"3093":1,"3102":0,"3129":1,"3229":0,"3286":1,"3295":0,"3316":1,"3325":0,"3357":1,"3366":0,"3389":1,"3400":0,"3444":1,"3454":0,"3475":1,"3483":0,"3503":1,"3516":0,"3539":1,"3550":0,"3605":1,"3614":0,"3694":1,"3705":0,"3760":1,"3768":0,"3856":1,"3988":0,"4127":1,"4135":0,"4158":1,"4170":0,"4192":1,"4201":0,"4225":1,"4236":0,"4286":1,"4295":0,"4341":1,"4353":0,"4372":1,"4382":0,"4431":1,"4440":0,"4494":1,"4504":0,"4520":1,"4532":0,"4560":1,"4571":0,"4611":1,"4621":0,"4728":1,"4737":0,"4755":1,"4765":0,"4844":1,"4853":0,"4887":1,"4896":0,"4947":1,"4956":0,"4969":1,"4980":0,"5017":1,"5025":0,"5062":1,"5073":0,"5097":1,"5109":0,"5159":1,"5174":0,"5198":1,"5207":0,"5232":1,"5241":0,"5261":1,"5269":0,"5294":1,"5303":0,"5325":1,"5334":0,"5356":1,"5366":0,"5386":1,"5396":0,"5418":1,"5429":0,"5447":1,"5518":0,"5544":1,"5555":0,"5638":1,"5646":0,"5670":1,"5680":0,"5700":1,"5711":0,"5755":1,"5766":0,"5788":1,"5800":0,"5823":1,"5838":0,"5853":1,"5868":0,"5880":1,"5895":0,"5912":1,"5925":0,"5973":1,"5982":0,"5994":1,"6004":0,"6067":1,"6076":0,"6083":1,"6094":0,"6170":1,"6185":0,"6203":1,"6214":0,"6258":1,"6267":0,"6328":1,"6338":0,"6380":1,"6389":0,"6449":1,"6457":0,"6499":1,"6508":0,"6544":1,"6551":0,"6558":1,"6567":0,"6578":1,"6589":0,"6669":1,"6677":0,"6710":1,"6718":0,"6823":1,"6833":0,"6858":1,"6869":0,"7012":1,"7021":0,"7070":1,"7079":0,"7089":1,"7100":0,"7139":1,"7207":0,"7234":1,"7245":0,"7262":1,"7274":0,"7297":1,"7308":0,"7328":1,"7347":0,"7363":1,"7375":0,"7396":1,"7406":0,"7437":1,"7447":0,"7471":1,"7480":0,"7529":1,"7537":0,"7638":1,"7649":0,"7674":1,"7684":0,"7707":1,"7717":0,"7738":1,"7748":0,"7766":1,"7776":0,"7799":1,"7810":0,"7829":1,"7841":0,"7876":1,"7885":0,"8012":1,"8022":0,"8044":1,"8053":0,"8076":1,"8086":0,"8128":1,"8139":0,"8170":1,"8182":0,"8203":1,"8214":0,"8236":1,"8248":0,"8270":1,"8280":0,"8301":1,"8311":0,"8331":1,"8341":0,"8360":1,"8371":0,"8394":1,"8402":0,"8423":1,"8433":0,"8452":1,"8464":0,"8486":1,"8497":0,"8533":1,"8543":0,"8573":1,"8582":0}', - ), - jm = JSON.parse( - '{"61":1,"70":0,"112":1,"121":0,"168":1,"175":0,"221":1,"229":0,"282":1,"290":0,"325":1,"333":0,"390":1,"399":0,"473":1,"481":0,"523":1,"529":0,"580":1,"588":0,"628":1,"636":0,"930":1,"940":0,"973":1,"982":0,"1100":1,"1109":0,"1240":1,"1250":0,"1328":1,"1340":0,"1409":1,"1416":1,"1422":0,"1424":0,"1463":1,"1473":0,"1518":1,"1529":0,"1789":1,"1801":0,"1950":1,"1957":0,"1987":1,"1995":0,"2031":1,"2038":0,"2099":1,"2109":0,"2147":1,"2156":0,"2214":1,"2225":0,"2266":1,"2277":0,"2332":1,"2340":1,"2342":0,"2347":0,"2381":1,"2393":0,"2436":1,"2444":0,"2596":1,"2611":0,"2642":1,"2652":0,"2678":1,"2687":0,"2731":1,"2739":0,"2810":1,"2820":0,"3050":1,"3064":0,"3083":1,"3125":0,"3395":1,"3407":0,"3426":1,"3438":0,"3465":1,"3475":0,"3513":1,"3522":0,"3660":1,"3672":0,"3695":1,"3707":0,"3739":1,"3749":0,"3995":1,"4005":0,"4079":1,"4088":0,"4259":1,"4268":0,"4322":1,"4333":0,"4415":1,"4423":0,"4474":1,"4480":0,"4500":1,"4513":0,"4756":1,"4766":0,"4804":1,"4815":0,"4850":1,"4859":0,"4921":1,"4950":0,"4977":1,"4997":0,"5150":1,"5160":0}', - ), - Gm = JSON.parse( - '{"71":1,"77":0,"167":1,"174":0,"277":1,"285":0,"356":1,"365":0,"396":1,"409":0,"460":1,"469":0,"543":1,"551":0,"591":1,"599":0,"633":1,"640":0,"698":1,"705":0,"727":1,"734":0,"779":1,"788":0,"828":1,"835":0,"859":1,"867":0,"896":1,"904":0,"990":1,"997":0,"1041":1,"1104":0,"1138":1,"1149":0,"1203":1,"1212":0,"1229":1,"1238":0,"1260":1,"1267":0,"1292":1,"1332":0,"1376":1,"1387":0,"1406":1,"1414":0,"1426":1,"1438":0,"1461":1,"1469":0,"1514":1,"1524":0,"1543":1,"1550":0,"1568":1,"1578":0,"1633":1,"1641":0,"1728":1,"1735":0,"1759":1,"1765":0,"1785":1,"1792":0,"1858":1,"1866":0,"1925":1,"1932":0,"1961":1,"1972":0,"2019":1,"2027":0,"2087":1,"2096":0,"2126":1,"2133":0,"2153":1,"2164":0,"2243":1,"2251":0,"2369":1,"2374":0,"2445":1,"2456":0,"2500":1,"2507":0,"2512":1,"2518":0,"2554":1,"2561":0,"2611":1,"2620":0,"2662":1,"2674":0,"2741":1,"2750":0,"2828":1,"2838":0,"2880":1,"2890":0,"2929":1,"2937":0,"2963":1,"2971":0,"3021":1,"3031":0,"3048":1,"3056":0,"3080":1,"3090":0,"3148":1,"3156":0,"3198":1,"3206":0,"3277":1,"3285":0,"3337":1,"3346":0,"3386":1,"3396":0,"3425":1,"3435":0,"3460":1,"3468":0,"3502":1,"3511":0,"3535":1,"3543":0,"3674":1,"3681":0,"3699":1,"3707":0,"3721":1,"3729":0,"3757":1,"3766":0,"3884":1,"3889":0,"3894":0,"3917":1,"3925":0,"3941":1,"3949":0,"3973":1,"3979":0,"4003":1,"4013":0,"4020":1,"4029":0,"4111":1,"4118":0,"4146":1,"4157":0,"4253":1,"4260":0,"4302":1,"4309":0,"4332":1,"4343":0,"4371":1,"4380":0,"4405":1,"4413":0,"4455":1,"4468":0,"4523":1,"4530":0,"4692":1,"4700":0,"4727":1,"4735":0,"4768":1,"4775":0,"4793":1,"4801":0,"4833":1,"4839":0,"4895":1,"4902":0,"5078":1,"5084":0,"5160":1,"5189":0,"5243":1,"5250":0,"5302":1,"5309":0,"5355":1,"5364":0,"5417":1,"5424":0,"5464":1,"5472":0,"5529":1,"5539":0,"5669":1,"5676":0,"5709":0,"5787":1,"5795":0,"5878":1,"5886":0,"5991":1,"5998":0,"6040":1,"6048":0,"6107":1,"6115":0,"6221":1,"6232":0,"6280":1,"6288":0,"6337":1,"6344":0,"6433":1,"6442":0,"6494":1,"6529":0,"6612":1,"6621":0,"6643":1,"6652":0,"6685":1,"6694":0,"6715":1,"6723":0,"6757":1,"6771":0,"6819":1,"6827":0,"6851":1,"6859":0,"6878":1,"6886":0,"6911":1,"6923":0,"6947":1,"6956":0,"6991":1,"6999":0,"7017":1,"7025":0,"7078":1,"7086":0,"7142":1,"7148":0,"7159":1,"7171":0,"7219":1,"7230":0,"7247":1,"7309":0,"7373":1,"7382":0,"7439":1,"7447":0,"7484":1,"7492":0,"7511":1,"7519":0,"7588":1,"7595":0,"7640":1,"7648":0,"7676":1,"7685":0,"7703":1,"7713":0,"7736":1,"7741":0,"7747":1,"7753":0,"7759":1,"7772":0,"7875":1,"7881":0,"7972":1,"7979":0,"7988":1,"7995":0,"8134":1,"8143":0,"8156":1,"8166":0}', - ), - Vm = JSON.parse( - '{"85":1,"91":0,"172":1,"182":0,"230":1,"238":0,"284":1,"292":0,"361":1,"369":0,"414":1,"423":0,"445":1,"455":0,"519":1,"527":0,"600":1,"607":0,"664":1,"673":0,"721":1,"731":0,"755":1,"765":0,"858":1,"868":0,"1006":1,"1037":0,"1129":1,"1138":0,"1227":1,"1235":0,"1371":1,"1420":0,"1450":1,"1459":0,"1494":1,"1502":0,"1628":1,"1636":0,"1682":1,"1690":0,"1758":1,"1767":0,"1828":1,"1837":0,"1860":1,"1870":0,"1892":1,"1924":0,"1980":1,"1988":0,"2008":1,"2017":0,"2067":1,"2076":0,"2102":1,"2109":0,"2153":1,"2163":0,"2185":1,"2194":0,"2219":1,"2230":0,"2250":1,"2283":0,"2349":1,"2399":0,"2448":1,"2473":0,"2540":1,"2550":0,"2578":1,"2588":0,"2617":1,"2628":0,"2703":1,"2712":0,"2783":1,"2792":0,"2837":1,"2846":0,"2918":1,"2928":0,"2993":1,"3003":0,"3033":1,"3043":0,"3171":1,"3344":0,"3376":1,"3384":0,"3413":1,"3421":0,"3450":1,"3473":0,"3488":1,"3495":0,"3550":1,"3559":0,"3610":1,"3619":0,"3691":1,"3700":0,"3725":1,"3735":0,"3759":1,"3767":0,"3869":1,"3924":0,"3998":1,"4008":0,"4074":1,"4083":0,"4139":1,"4148":0,"4198":1,"4208":0,"4281":1,"4330":0,"4372":1,"4381":0,"4459":1,"4467":0,"4703":1,"4712":0,"4740":1,"4750":0,"4774":1,"4783":0,"4842":1,"4851":0,"4890":1,"4899":0,"4923":1,"4931":0,"4955":1,"4964":0,"5003":1,"5013":0,"5079":1,"5088":0,"5111":1,"5120":0,"5143":1,"5152":0,"5226":1,"5235":0,"5278":1,"5350":0,"5403":1,"5458":0,"5476":1,"5506":0,"5536":1,"5546":0,"5611":1,"5640":0,"5676":1,"5685":0,"5725":1,"5734":0,"5775":1,"5787":0,"5838":1,"5850":0,"5918":1,"5928":0,"6001":1,"6011":0,"6037":1,"6047":0,"6083":1,"6092":0,"6136":1,"6145":0,"6177":1,"6186":0,"6281":1,"6291":0,"6316":1,"6323":0,"6349":1,"6359":0,"6403":1,"6582":0,"6727":1,"6943":0,"7032":1,"7041":0,"7154":1,"7184":0,"7293":1,"7302":0,"7447":1,"7453":0,"7489":1,"7497":0,"7535":1,"7543":0,"7563":1,"7570":0,"7586":1,"7596":0,"7635":1,"7644":0,"7656":1,"7666":0,"7760":1,"7769":0,"7801":1,"7811":0,"7857":1,"7866":0,"7909":1,"7918":0,"7963":1,"7972":0,"8015":1,"8024":0,"8062":1,"8071":0,"8093":1,"8102":0,"8149":1,"8157":0,"8174":1,"8301":0,"8344":1,"8352":0,"8543":1,"8891":0,"8927":1,"8941":0,"8947":1,"9195":0,"9235":1,"9244":0,"9292":1,"9301":0,"9329":1,"9337":0,"9378":1,"9387":0,"9412":1,"9420":0,"9463":1,"9473":0,"9491":1,"9500":0,"9550":1,"9777":0,"9818":1,"9879":0}', - ), - Hm = JSON.parse( - '{"75":1,"83":0,"99":1,"106":0,"140":1,"147":0,"173":1,"180":0,"198":1,"205":0,"270":1,"276":0,"292":1,"298":0,"360":1,"369":0,"405":1,"411":0,"437":1,"446":0,"458":1,"466":0,"484":1,"493":0,"530":1,"537":0,"554":1,"561":0,"582":1,"589":0,"611":1,"617":0,"652":1,"686":0,"722":1,"728":0,"747":1,"753":0,"793":1,"801":0,"817":1,"825":0,"863":1,"869":0,"914":1,"921":0,"981":1,"987":0,"1004":1,"1013":0,"1037":1,"1044":0,"1069":1,"1076":0,"1087":1,"1095":0,"1106":1,"1115":0,"1131":1,"1139":0,"1165":1,"1173":0,"1207":1,"1214":0,"1253":1,"1262":0,"1281":1,"1289":0,"1318":1,"1327":0,"1372":1,"1405":0,"1425":1,"1433":0,"1449":1,"1457":0,"1492":1,"1499":0,"1511":1,"1518":0,"1563":1,"1595":0,"1632":1,"1656":0,"1679":1,"1688":0,"1704":1,"1712":0,"1737":1,"1792":0,"1805":1,"1815":0,"1861":1,"1907":0,"1948":1,"1957":0,"1971":1,"1979":0,"2020":1,"2029":0,"2045":1,"2052":0,"2067":1,"2077":0,"2092":1,"2101":0,"2119":1,"2127":0,"2154":1,"2162":0,"2191":1,"2200":0,"2212":1,"2219":0,"2225":1,"2244":0,"2260":1,"2267":0,"2278":1,"2286":0,"2339":1,"2346":0,"2374":1,"2383":0,"2409":1,"2419":0,"2446":1,"2454":0,"2476":1,"2484":0,"2507":1,"2516":0,"2526":1,"2534":0,"2552":1,"2561":0,"2574":1,"2582":0,"2609":1,"2620":0,"2641":1,"2649":0,"2665":1,"2672":0,"2691":1,"2698":0,"2724":1,"2731":0,"2741":1,"2748":0,"2787":1,"2794":0,"2811":1,"2818":0,"2828":1,"2837":0,"2854":1,"2863":0,"2908":1,"2918":0,"2932":1,"2940":0,"2956":1,"2966":0,"2974":1,"2983":0,"3018":1,"3025":0,"3033":1,"3040":0,"3053":1,"3060":0,"3105":1,"3115":0,"3131":1,"3140":0,"3154":1,"3162":0,"3167":1,"3175":0,"3198":1,"3205":0,"3222":1,"3230":0,"3245":1,"3253":0,"3291":1,"3300":0,"3316":1,"3324":0,"3347":1,"3356":0,"3365":1,"3372":0,"3395":1,"3404":0,"3414":1,"3422":0,"3446":1,"3452":0,"3458":1,"3464":0,"3485":1,"3491":0,"3507":1,"3516":0,"3533":1,"3540":0,"3555":1,"3563":0,"3580":1,"3589":0,"3607":1,"3614":0,"3628":1,"3637":0,"3647":1,"3656":0,"3659":1,"3665":0,"3669":1,"3675":0,"3678":1,"3684":0,"3686":1,"3693":0,"3695":1,"3701":0,"3704":1,"3710":0,"3712":1,"3718":0,"3721":1,"3727":0,"3730":1,"3736":0,"3740":1,"3746":0,"3806":1,"3812":0,"3845":1,"3878":0,"3893":1,"3900":0,"3947":1,"3955":0,"3960":1,"3967":0,"3983":1,"3991":0,"4032":1,"4038":0,"4054":1,"4062":0,"4072":1,"4079":0,"4085":1,"4142":0,"4155":1,"4163":0,"4173":1,"4184":0,"4200":1,"4207":0,"4227":1,"4234":0,"4255":1,"4262":0,"4273":1,"4282":0,"4294":1,"4301":0,"4321":1,"4331":0,"4343":1,"4353":0,"4363":1,"4410":0,"4418":1,"4426":0,"4445":1,"4453":0,"4457":1,"4467":0,"4483":1,"4491":0,"4494":1,"4503":0,"4511":1,"4531":0,"4538":1,"4548":0,"4560":1,"4570":0,"4585":1,"4592":0,"4632":1,"4639":0,"4653":1,"4660":0,"4679":1,"4685":0,"4707":1,"4713":0,"4722":1,"4728":0,"4746":1,"4760":0,"4770":1,"4778":0,"4788":1,"4795":0,"4825":1,"4832":0,"4854":1,"4861":0,"4873":1,"4880":0,"4896":1,"4903":0,"4926":1,"4934":0,"4970":1,"4977":0,"4990":1,"4998":0,"5017":1,"5023":0,"5039":1,"5047":0,"5064":1,"5072":0,"5091":1,"5097":0,"5122":1,"5131":0,"5150":1,"5157":0,"5185":1,"5190":0,"5222":1,"5230":0,"5251":1,"5273":0,"5305":1,"5312":0,"5333":1,"5343":0,"5352":1,"5360":0,"5398":1,"5405":0,"5431":1,"5437":0,"5466":1,"5472":0,"5480":1,"5487":0,"5504":1,"5513":0,"5521":1,"5527":0,"5548":1,"5556":0,"5572":1,"5579":0,"5595":1,"5632":0,"5666":1,"5673":0,"5687":1,"5694":0,"5709":1,"5718":0,"5749":1,"5756":0,"5790":1,"5797":0,"5821":1,"5827":0,"5838":1,"5848":0,"5860":1,"5870":0,"5890":1,"5919":0,"5933":1,"5940":0,"5962":1,"6075":0,"6097":1,"6104":0,"6163":1,"6170":0,"6182":1,"6189":0,"6213":1,"6220":0,"6228":1,"6236":0,"6264":1,"6271":0,"6285":1,"6293":0,"6299":1,"6441":0,"6479":1,"6511":0,"6525":1,"6533":0,"6577":1,"6613":0,"6628":1,"6637":0,"6649":1,"6658":0,"6672":1,"6681":0,"6699":1,"6706":0,"6746":1,"6753":0,"6770":1,"6778":0,"6822":1,"6828":0,"6832":1,"6841":0,"6853":1,"6880":0,"6890":1,"6899":0,"6907":1,"6917":0,"6957":1,"6965":0,"6983":1,"6991":0,"7004":1,"7012":0,"7031":1,"7040":0,"7077":1,"7085":0,"7094":1,"7102":0,"7109":1,"7117":0,"7152":1,"7160":0,"7179":1,"7238":0,"7274":1,"7281":0,"7306":1,"7354":0,"7374":1,"7618":0,"7623":1,"7665":0,"7727":1,"7735":0,"7771":1,"7781":0,"7802":1,"7809":0,"7828":1,"7836":0,"7864":1,"7872":0,"7899":1,"7906":0,"7925":1,"7932":0,"7950":1,"7957":0,"7990":1,"7997":0,"8016":1,"8024":0,"8032":1,"8061":0,"8089":1,"8096":0,"8114":1,"8121":0,"8150":1,"8156":0,"8208":1,"8215":0,"8227":1,"8235":0,"8254":1,"8260":0,"8310":1,"8344":0,"8379":1,"8389":0,"8400":1,"8406":0,"8415":1,"8422":0,"8429":1,"8435":0,"8475":1,"8510":0,"8528":1,"8534":0,"8554":1,"8559":0,"8596":1,"8602":0,"8642":1,"8650":0,"8669":1,"8676":0,"8714":1,"8747":0,"8764":1,"8793":0,"8829":1,"8836":0,"8845":1,"8852":0,"8876":1,"8883":0,"8906":1,"8912":0,"8938":1,"8944":1,"8968":0,"8980":1,"9010":0,"9021":1,"9029":0,"9035":1,"9042":0,"9046":1,"9053":0,"9057":1,"9063":0,"9067":1,"9074":0,"9078":1,"9088":0,"9091":1,"9098":0,"9101":1,"9108":0,"9111":1,"9117":0,"9120":1,"9127":0,"9130":1,"9136":0}' - ), - Xm = JSON.parse( - '{"80":1,"85":0,"165":1,"191":0,"285":1,"291":0,"365":1,"421":0,"476":1,"511":0,"570":1,"598":0,"647":1,"681":0,"721":1,"736":0,"748":1,"770":0,"777":1,"788":0,"883":1,"891":0,"932":1,"939":0,"980":1,"992":0,"1021":1,"1078":0,"1107":1,"1115":0,"1147":1,"1156":0,"1358":1,"1368":0,"1413":1,"1419":0,"1451":1,"1464":0,"1646":1,"1656":0,"1730":1,"1740":0,"1774":1,"1781":0,"1811":1,"1819":0,"1880":1,"1889":0,"1952":1,"1961":0,"2007":1,"2016":0,"2162":1,"2170":0,"2220":1,"2229":0,"2265":1,"2271":0,"2293":1,"2300":0,"2343":1,"2373":0,"2394":1,"2401":0,"2452":1,"2459":0,"2478":1,"2484":0,"2503":1,"2510":0,"2549":1,"2556":0,"2597":1,"2603":0,"2663":1,"2672":0,"2702":1,"2711":0,"2796":1,"2804":0,"2884":1,"2889":0,"3113":1,"3119":0,"3165":1,"3171":0,"3268":1,"3273":0,"3303":1,"3309":0,"3341":1,"3345":0,"3372":1,"3377":0,"3424":1,"3427":0,"3588":1,"3595":0,"3688":1,"3696":0,"4000":1,"4007":0,"4035":1,"4039":0,"4065":1,"4070":0,"4092":1,"4097":0,"4117":1,"4123":0,"4143":1,"4147":0,"4194":1,"4199":0,"4218":1,"4224":0,"4247":1,"4255":0,"4338":1,"4342":0,"4528":1,"4534":0,"4574":1,"4583":0,"4604":1,"4610":0,"4648":1,"4658":0,"4712":1,"4718":0,"4736":1,"4742":0,"4766":1,"4773":0,"4838":1,"4844":0,"4863":1,"4923":0,"4990":1,"4997":0,"5099":1,"5108":0,"5137":1,"5145":0,"5167":1,"5199":0,"5224":1,"5277":0,"5324":1,"5329":0,"5346":1,"5352":0,"5412":1,"5420":0,"5452":1,"5457":0,"5478":1,"5483":0,"5507":1,"5514":0,"5559":1,"5564":0,"5583":1,"5588":0,"5635":1,"5641":0,"5712":1,"5716":0,"5760":1,"5768":0,"5808":1,"5814":0,"5836":1,"5841":0,"5891":1,"5896":0,"5921":1,"5925":0,"5945":1,"5952":0,"5971":1,"5979":0,"6020":1,"6026":0,"6049":1,"6058":0,"6078":1,"6086":0,"6123":1,"6138":0,"6356":1,"6364":0,"6455":1,"6462":0,"6558":1,"6565":0,"6777":1,"6785":0,"6879":1,"6887":0,"6982":1,"6991":0,"7185":1,"7218":0,"7417":1,"7423":0,"7517":1,"7523":0,"7557":1,"7563":0,"7610":1,"7620":0,"7698":1,"7779":0,"7798":1,"7807":0,"7852":1,"7861":0,"7879":1,"7887":0,"7899":1,"7907":0,"7965":1,"7976":0,"8025":1,"8037":0,"8076":1,"8093":0,"8265":1,"8270":0,"8318":1,"8322":0,"8369":1,"8374":0,"8423":1,"8429":0,"8470":1,"8477":0,"8537":1,"8542":0,"8673":1,"8681":0,"8699":1,"8705":0,"8724":1,"8730":0,"8787":1,"8792":0,"8822":1,"8826":0,"8846":1,"8851":0,"8868":1,"8873":0,"8913":1,"8920":0,"8964":1,"8969":0,"8999":1,"9028":0,"9057":1,"9068":0,"9127":1,"9136":0,"9151":1,"9160":0,"9206":1,"9214":0,"9267":1,"9275":0,"9331":1,"9366":0,"9465":1,"9472":0,"9543":1,"9548":0,"9648":1,"9656":0,"9709":1,"9719":0,"9748":1,"9757":0,"9774":1,"9784":0,"9804":1,"9813":0,"9848":1,"9856":0,"9934":1,"9944":0,"9960":1,"9968":0,"9981":1,"9992":0,"10021":1,"10031":0,"10060":1,"10068":0,"10087":1,"10097":0,"10173":1,"10187":0,"10233":1,"10238":0,"10518":1,"10556":0}' - ), - zm = JSON.parse( - '{"48":1,"52":0,"74":1,"78":0,"114":1,"120":0,"143":1,"147":0,"194":1,"219":0,"245":1,"251":0,"267":1,"270":0,"275":1,"281":0,"324":1,"328":0,"341":1,"346":0,"369":1,"376":0,"388":1,"394":0,"419":1,"424":0,"443":1,"448":0,"469":1,"474":0,"495":1,"499":0,"515":1,"520":0,"533":1,"537":0,"553":1,"558":0,"569":1,"575":0,"599":1,"604":0,"660":1,"668":0,"698":1,"704":0,"745":1,"751":0,"762":1,"767":0,"819":1,"824":0,"854":1,"859":0,"886":1,"891":0,"933":1,"939":0,"971":1,"975":0,"981":1,"986":0,"996":1,"1001":0,"1012":1,"1017":0,"1022":1,"1027":0,"1040":1,"1045":0,"1054":1,"1060":0,"1075":1,"1080":0,"1095":1,"1100":0,"1112":1,"1117":0,"1142":1,"1149":0,"1170":1,"1175":0,"1203":1,"1208":0,"1233":1,"1240":0,"1311":1,"1316":0,"1331":1,"1336":0,"1347":1,"1352":0,"1368":1,"1372":0,"1384":1,"1389":0,"1406":1,"1410":0,"1423":1,"1427":0,"1443":1,"1448":0,"1458":1,"1463":0,"1473":1,"1478":0,"1495":1,"1500":0,"1515":1,"1520":0,"1537":1,"1543":0,"1557":1,"1565":0,"1583":1,"1591":0,"1609":1,"1614":0,"1648":1,"1672":0,"1688":1,"1694":0,"1711":1,"1716":0,"1735":1,"1740":0,"1780":1,"1783":0,"1822":1,"1825":0,"1926":1,"1932":0,"1940":1,"1945":0,"1967":1,"1971":0,"1978":1,"1984":0,"1998":1,"2003":0,"2023":1,"2029":0,"2043":1,"2050":0,"2062":1,"2068":0,"2105":1,"2110":0,"2144":1,"2150":0,"2201":1,"2207":0,"2214":1,"2219":0,"2241":1,"2246":0,"2268":1,"2275":0,"2296":1,"2320":0,"2339":1,"2381":0,"2404":1,"2410":0,"2430":1,"2439":0,"2455":1,"2460":0,"2468":1,"2474":0,"2539":1,"2544":0,"2573":1,"2578":0,"2600":1,"2665":0,"2734":1,"2740":0,"2754":1,"2759":0,"2771":1,"2778":0,"2804":1,"2812":0,"2864":1,"2870":0,"2891":1,"2897":0,"2944":1,"2950":0,"2992":1,"2996":0,"3005":1,"3011":0,"3030":1,"3035":0,"3045":1,"3051":0,"3068":1,"3073":0,"3083":1,"3090":0,"3110":1,"3115":0,"3122":1,"3127":0,"3148":1,"3153":0,"3163":1,"3169":0,"3264":1,"3270":0,"3304":1,"3310":0,"3342":1,"3349":0,"3387":1,"3394":0,"3428":1,"3434":0,"3443":1,"3447":0,"3465":1,"3470":0,"3497":1,"3503":0,"3540":1,"3545":0,"3568":1,"3572":0,"3585":1,"3591":0,"3603":1,"3609":0,"3637":1,"3643":0,"3702":1,"3707":0,"3711":1,"3717":0,"3815":1,"3821":0,"3878":1,"3883":0,"3905":1,"3910":0,"3917":1,"3922":0,"3931":1,"3937":0,"3972":1,"3979":0,"4019":1,"4027":0,"4040":1,"4048":0,"4059":1,"4067":0,"4085":1,"4091":0,"4103":1,"4111":0,"4120":1,"4128":0,"4152":1,"4158":0,"4178":1,"4183":0,"4191":1,"4200":0,"4212":1,"4219":0,"4223":1,"4235":0,"4244":1,"4254":0,"4261":1,"4270":0,"4292":1,"4300":0,"4344":1,"4352":0,"4376":1,"4383":0,"4398":1,"4404":0,"4415":1,"4422":0,"4432":1,"4440":0,"4526":1,"4532":0,"4537":1,"4543":0,"4563":1,"4568":0,"4574":1,"4581":0,"4612":1,"4617":0,"4629":1,"4636":0,"4673":1,"4678":0,"4686":1,"4691":0,"4708":1,"4714":0,"4729":1,"4735":0,"4753":1,"4757":0,"4766":1,"4823":0,"4849":1,"4856":0,"4878":1,"4903":0,"4917":1,"4922":0,"4929":1,"4936":0,"4957":1,"4964":0,"4978":1,"4986":0,"4996":1,"5005":0,"5044":1,"5052":0,"5074":1,"5079":0,"5174":1,"5180":0,"5222":1,"5230":0,"5305":1,"5313":0,"5384":1,"5391":0,"5460":1,"5467":0,"5482":1,"5489":0,"5506":1,"5513":0,"5530":1,"5538":0,"5583":1,"5590":0,"5627":1,"5635":0,"5653":1,"5694":0,"5781":1,"5786":0,"5795":1,"5801":0,"5828":1,"5834":0,"5867":1,"5869":0,"5872":1,"5875":0,"5904":1,"5908":0,"5941":1,"5949":0,"6019":1,"6025":0,"6099":1,"6105":0,"6178":1,"6184":0,"6209":1,"6215":0,"6283":1,"6288":0,"6395":1,"6399":0,"6416":1,"6420":0,"6443":1,"6447":0,"6470":1,"6475":0,"6491":1,"6495":0,"6510":1,"6514":0,"6542":1,"6547":0,"6551":1,"6558":0,"6588":1,"6592":0,"6608":1,"6613":0,"6631":1,"6635":0,"6667":1,"6673":0,"6689":1,"6694":0,"6706":1,"6713":0,"6727":1,"6732":0,"6752":1,"6759":0,"6773":1,"6778":0,"6787":1,"6794":0,"6808":1,"6814":0,"6826":1,"6832":0,"6847":1,"6853":0,"6884":1,"6889":0,"6905":1,"6910":0,"6916":1,"6922":0,"6929":1,"6936":0,"6946":1,"6954":0,"6966":1,"6972":0,"6984":1,"6990":0,"7024":1,"7027":0,"7041":1,"7046":0,"7060":1,"7066":0,"7090":1,"7098":0,"7110":1,"7118":0,"7128":1,"7136":0,"7159":1,"7164":0,"7198":1,"7202":0,"7219":1,"7224":0,"7239":1,"7243":0,"7259":1,"7264":0,"7276":1,"7282":0,"7309":1,"7319":0,"7338":1,"7342":0,"7360":1,"7366":0,"7380":1,"7385":0,"7401":1,"7406":0,"7417":1,"7423":0,"7439":1,"7444":0,"7456":1,"7462":0,"7526":1,"7532":0,"7546":1,"7552":0,"7606":1,"7612":0,"7641":1,"7646":0,"7710":1,"7714":0,"7729":1,"7734":0,"7763":1,"7769":0,"7805":1,"7853":0,"7905":1,"7911":0,"7925":1,"7930":0,"7943":1,"7949":0,"7969":1,"7973":0,"7988":1,"7993":0,"8017":1,"8023":0,"8057":1,"8064":0,"8096":1,"8104":0,"8126":1,"8130":0,"8219":1,"8226":0,"8299":1,"8304":0,"8333":1,"8339":0,"8361":1,"8366":0,"8379":1,"8384":0,"8417":1,"8422":0,"8456":1,"8461":0,"8477":1,"8482":0,"8503":1,"8512":0,"8524":1,"8531":0,"8546":1,"8550":0,"8558":1,"8564":0,"8574":1,"8578":0,"8586":1,"8592":0,"8650":1,"8657":0,"8669":1,"8677":0,"8692":1,"8697":0,"8732":1,"8737":0,"8746":1,"8751":0,"8774":1,"8778":0,"8822":1,"8829":0,"8916":1,"8921":0,"8972":1,"8978":0,"8983":1,"9003":0,"9031":1,"9038":0,"9070":1,"9074":0,"9146":1,"9151":0,"9188":1,"9195":0,"9220":1,"9226":0,"9237":1,"9243":0,"9260":1,"9266":0,"9284":1,"9289":0,"9308":1,"9315":0,"9336":1,"9343":0,"9382":1,"9389":0,"9411":1,"9419":0,"9444":1,"9452":0,"9482":1,"9489":0,"9524":1,"9531":0}' - ), - Wm = JSON.parse( - '{"130":1,"138":0,"243":1,"250":0,"358":1,"365":0,"594":1,"602":0,"709":1,"715":0,"797":1,"803":0,"821":1,"832":0,"903":1,"911":0,"1005":1,"1012":0,"1205":1,"1211":0,"1436":1,"1445":0,"1536":1,"1543":0,"1630":1,"1641":0,"1732":1,"1739":0,"1762":1,"1771":0,"1830":1,"1839":0,"1860":1,"1869":0,"1928":1,"1938":0,"1958":1,"1967":0,"2103":1,"2110":0,"2330":1,"2418":0,"2454":1,"2476":0,"2485":1,"2524":0,"2566":1,"2683":0,"2719":1,"2780":0,"2807":1,"2867":0,"2911":1,"2920":0,"2956":1,"2992":0,"3158":1,"3166":0,"3268":1,"3278":0,"3381":1,"3390":0,"3445":1,"3454":0,"3651":1,"3657":0,"3731":1,"3738":0,"3817":1,"3827":0,"3845":1,"3853":0,"3927":1,"3935":0,"3955":1,"3963":0,"4034":1,"4043":0,"4121":1,"4129":0,"4148":1,"4156":0,"4232":1,"4242":0,"4312":1,"4321":0,"4572":1,"4579":0,"4674":1,"4695":0,"4767":1,"4804":0,"4873":1,"4913":0,"4963":1,"5026":0,"5142":1,"5151":0}', - ), - qm = JSON.parse( - '{"81":1,"87":0,"159":1,"163":0,"205":1,"210":0,"234":1,"240":0,"290":1,"296":0,"330":1,"336":0,"352":1,"357":0,"438":1,"443":0,"465":1,"470":0,"495":1,"500":0,"539":1,"545":0,"559":1,"566":0,"594":1,"602":0,"621":1,"625":0,"661":1,"665":0,"739":1,"745":0,"786":1,"793":0,"821":1,"826":0,"874":1,"880":0,"903":1,"908":0,"929":1,"934":0,"954":1,"959":0,"980":1,"984":0,"1026":1,"1031":0,"1113":1,"1119":0,"1136":1,"1141":0,"1185":1,"1190":0,"1284":1,"1290":0,"1344":1,"1351":0,"1374":1,"1381":0,"1409":1,"1420":0,"1466":1,"1472":0,"1492":1,"1499":0,"1511":1,"1517":0,"1568":1,"1574":0,"1653":1,"1660":0,"1700":1,"1706":0,"1721":1,"1728":0,"1747":1,"1754":0,"1777":1,"1784":0,"1799":1,"1805":0,"1829":1,"1838":0,"1855":1,"1889":0,"1904":1,"1915":0,"1957":1,"2008":0,"2084":1,"2091":0,"2109":1,"2117":0,"2183":1,"2219":0,"2243":1,"2291":0,"2316":1,"2373":0,"2394":1,"2454":0,"2472":1,"2480":0,"2504":1,"2515":0,"2545":1,"2579":0,"2600":1,"2630":0,"2679":1,"2684":0,"2704":1,"2710":0,"2728":1,"2738":0,"2752":1,"2761":0,"2804":1,"2811":0,"2827":1,"2836":0,"2982":1,"2987":0,"3021":1,"3027":0,"3085":1,"3092":0,"3112":1,"3119":0,"3162":1,"3195":0,"3213":1,"3221":0,"3238":1,"3246":0,"3347":1,"3355":0,"3420":1,"3426":0,"3446":1,"3453":0,"3475":1,"3481":0,"3521":1,"3526":0,"3546":1,"3552":0,"3571":1,"3576":0,"3627":1,"3680":0,"3756":1,"3763":0,"3783":1,"3790":0,"3834":1,"3841":0,"3862":1,"3867":0,"3886":1,"3919":0,"4047":1,"4055":0,"4087":1,"4093":0,"4117":1,"4122":0,"4193":1,"4220":0,"4244":1,"4250":0,"4295":1,"4298":0,"4333":1,"4341":0,"4359":1,"4366":0,"4388":1,"4394":0,"4422":1,"4427":0,"4447":1,"4451":0,"4484":1,"4488":0,"4555":1,"4560":0,"4602":1,"4636":0,"4684":1,"4719":0,"4758":1,"4767":0,"4811":1,"4881":0,"4918":1,"4930":0,"4963":1,"4970":0,"5007":1,"5080":0,"5122":1,"5130":0,"5170":1,"5174":0,"5194":1,"5202":0,"5217":1,"5223":0,"5252":1,"5305":0,"5373":1,"5380":0,"5429":1,"5435":0,"5453":1,"5460":0,"5480":1,"5488":0,"5580":1,"5585":0,"5631":1,"5638":0,"5659":1,"5666":0,"5678":1,"5687":0,"5707":1,"5714":0,"5736":1,"5742":0,"5815":1,"5822":0,"5841":1,"5849":0,"5888":1,"5894":0,"5915":1,"5920":0,"5942":1,"5947":0,"5995":1,"6000":0,"6017":1,"6024":0,"6068":1,"6075":0,"6096":1,"6103":0,"6119":1,"6125":0,"6138":1,"6145":0,"6226":1,"6234":0,"6252":1,"6263":0,"6275":1,"6285":0,"6304":1,"6315":0,"6330":1,"6341":0,"6356":1,"6368":0,"6396":1,"6406":0,"6432":1,"6446":0,"6458":1,"6470":0,"6484":1,"6497":0,"6507":1,"6518":0,"6569":1,"6577":0,"6605":1,"6612":0,"6633":1,"6641":0,"6661":1,"6669":0,"6712":1,"6721":0,"6732":1,"6742":0,"6765":1,"6776":0,"6844":1,"6851":0,"6871":1,"6879":0,"6898":1,"6905":0,"6925":1,"6932":0,"6950":1,"6955":0,"6976":1,"6985":0}', - ), - $m = JSON.parse( - '{"329":1,"336":0,"457":1,"464":0,"490":1,"496":0,"524":1,"531":0,"682":1,"689":0,"764":1,"770":0,"801":1,"807":0,"830":1,"836":0,"1004":1,"1020":0,"1033":1,"1040":0,"1062":1,"1070":0,"1094":1,"1099":0,"1122":1,"1129":0,"1172":1,"1179":0,"1206":1,"1213":0,"1271":1,"1278":0,"1379":1,"1387":0,"1410":1,"1417":0,"1453":1,"1458":0,"1526":1,"1532":0,"1549":1,"1554":0,"1618":1,"1688":0,"1734":1,"1743":0,"1762":1,"1770":0,"1800":1,"1805":0,"1887":1,"1894":0,"1918":1,"1924":0,"1958":1,"1964":0,"2002":1,"2009":0,"2073":1,"2081":0,"2196":1,"2207":0,"2288":1,"2295":0,"2420":1,"2428":0,"2582":1,"2590":0,"2645":1,"2652":0,"2674":1,"2679":0,"2706":1,"2711":0,"2728":1,"2733":0,"2812":1,"2820":0,"2841":1,"2848":0,"2904":1,"2911":0,"3019":1,"3094":0,"3121":1,"3128":0,"3183":1,"3184":0,"3224":1,"3230":0,"3306":1,"3349":0,"3398":1,"3404":0,"3464":1,"3558":0,"3699":1,"3705":0,"3826":1,"3832":0,"3871":1,"3875":0,"3904":1,"3909":0,"3934":1,"3939":0,"4000":1,"4006":0,"4042":1,"4048":0,"4073":1,"4078":0,"4164":1,"4171":0,"4216":1,"4221":0,"4264":1,"4270":0,"4347":1,"4353":0,"4369":1,"4376":0,"4394":1,"4401":0,"4430":1,"4436":0,"4717":1,"4723":0,"4867":1,"4873":0,"4966":1,"4970":0,"5006":1,"5014":0,"5044":1,"5049":0,"5104":1,"5113":0,"5125":1,"5130":0,"5184":1,"5189":0,"5235":1,"5241":0,"5264":1,"5270":0,"5292":1,"5293":0,"5328":1,"5333":0,"5378":1,"5384":0,"5415":1,"5425":0,"5455":1,"5461":0,"5605":1,"5614":0,"5645":1,"5663":0,"5672":1,"5682":0,"5688":1,"5698":0,"5735":1,"5742":0,"5822":1,"5850":0,"5875":1,"5885":0,"5971":1,"5975":0,"5998":1,"6006":0,"6030":1,"6041":0,"6051":1,"6059":0,"6070":1,"6079":0,"6091":1,"6099":0,"6143":1,"6150":0,"6211":1,"6219":0,"6238":1,"6245":0,"6298":1,"6305":0,"6328":1,"6334":0,"6365":1,"6371":0,"6396":1,"6401":0,"6424":1,"6428":0,"6577":1,"6583":0,"6636":1,"6644":0,"6684":1,"6691":0,"6746":1,"6752":0,"6825":1,"6831":0,"6885":1,"6890":0,"6911":1,"6918":0,"6955":1,"6961":0,"7000":1,"7007":0,"7120":1,"7125":0,"7148":1,"7154":0,"7178":1,"7184":0,"7202":1,"7209":0,"7226":1,"7236":0,"7255":1,"7261":0,"7332":1,"7337":0,"7456":1,"7460":0,"7483":1,"7488":0,"7543":1,"7551":0,"7577":1,"7583":0,"7637":1,"7643":0,"7680":1,"7687":0,"7713":1,"7845":0,"7904":1,"8011":0,"8031":1,"8038":0,"8080":1,"8089":0,"8120":1,"8125":0,"8150":1,"8156":0,"8211":1,"8218":0,"8249":1,"8254":0,"8325":1,"8329":0,"8382":1,"8389":0,"8416":1,"8424":0,"8448":1,"8457":0,"8484":1,"8545":0,"8580":1,"8620":0,"8664":1,"8789":0,"8812":1,"8820":0,"8846":1,"8890":0,"8918":1,"8929":0,"8956":1,"8964":0,"9010":1,"9017":0,"9047":1,"9053":0,"9094":1,"9099":0,"9135":1,"9140":0,"9178":1,"9184":0,"9203":1,"9211":0}' - ), - Jm = JSON.parse( - '{"70":1,"77":0,"90":1,"99":0,"130":1,"149":0,"151":1,"166":0,"176":1,"188":0,"206":1,"215":0,"231":1,"238":0,"259":1,"267":0,"309":1,"316":0,"352":1,"379":0,"401":1,"411":0,"440":1,"446":0,"484":1,"491":0,"517":1,"522":0,"563":1,"587":0,"607":1,"638":0,"664":1,"669":0,"708":1,"717":0,"736":1,"743":0,"761":1,"767":0,"788":1,"794":0,"814":1,"820":0,"839":1,"846":0,"934":1,"987":0,"1031":1,"1084":0,"1094":1,"1100":0,"1125":1,"1187":0,"1238":1,"1291":0,"1354":1,"1382":0,"1403":1,"1423":0,"1457":1,"1466":0,"1507":1,"1543":0,"1563":1,"1569":0,"1618":1,"1632":0,"1649":1,"1657":0,"1676":1,"1682":0,"1694":1,"1702":0,"1713":1,"1724":0,"1753":1,"1758":0,"1803":1,"1810":0,"1837":1,"1858":0,"1887":1,"1899":0,"1913":1,"1922":0,"1945":1,"1952":0,"1983":1,"1988":0,"2004":1,"2011":0,"2058":1,"2065":0,"2082":1,"2090":0,"2112":1,"2118":0,"2166":1,"2172":0,"2244":1,"2252":0,"2271":1,"2279":0,"2303":1,"2309":0,"2330":1,"2336":0,"2360":1,"2366":0,"2407":1,"2413":0,"2438":1,"2445":0,"2461":1,"2469":0,"2492":1,"2498":0,"2521":1,"2527":0,"2547":1,"2553":0,"2574":1,"2581":0,"2603":1,"2609":0,"2627":1,"2634":0,"2656":1,"2663":0,"2705":1,"2712":0,"2742":1,"2748":0,"2761":1,"2769":0,"2794":1,"2801":0,"2845":1,"2851":0,"2868":1,"2907":0,"2939":1,"2946":0,"2955":1,"2962":0,"2989":1,"2996":0,"3052":1,"3061":0,"3139":1,"3145":0,"3188":1,"3194":0,"3224":1,"3227":0,"3244":1,"3250":0,"3283":1,"3293":0,"3314":1,"3321":0,"3354":1,"3361":0,"3393":1,"3399":0,"3460":1,"3466":0,"3480":1,"3486":0,"3514":1,"3521":0,"3572":1,"3580":0,"3638":1,"3646":0,"3679":1,"3687":0,"3702":1,"3712":0,"3750":1,"3759":0,"3786":1,"3795":0,"3855":1,"3861":0,"3882":1,"3887":0,"3907":1,"3913":0,"3929":1,"3936":0,"3949":1,"3955":0,"4071":1,"4075":0,"4095":1,"4099":0,"4153":1,"4160":0,"4171":1,"4178":0,"4209":1,"4217":0,"4234":1,"4243":0,"4263":1,"4271":0,"4320":1,"4326":0,"4346":1,"4353":0,"4373":1,"4379":0,"4410":1,"4416":0,"4448":1,"4456":0,"4493":1,"4500":0,"4530":1,"4535":0,"4557":1,"4563":0,"4599":1,"4608":0,"4635":1,"4641":0,"4659":1,"4666":0,"4685":1,"4694":0,"4724":1,"4733":0,"4748":1,"4755":0,"4772":1,"4781":0,"4819":1,"4830":0,"4853":1,"4862":0,"4880":1,"4888":0,"4946":1,"4955":0,"4968":1,"4979":0,"4998":1,"5009":0,"5042":1,"5050":0,"5079":1,"5112":0,"5159":1,"5165":0,"5187":1,"5246":0,"5270":1,"5331":0,"5361":1,"5370":0,"5402":1,"5412":0,"5442":1,"5452":0,"5481":1,"5490":0,"5503":1,"5511":0,"5534":1,"5543":0,"5598":1,"5602":0,"5623":1,"5627":0,"5659":1,"5670":0,"5713":1,"5721":0,"5787":1,"5795":0,"5808":1,"5820":0,"5858":1,"5867":0,"5878":1,"5886":0,"5897":1,"5912":0,"5921":1,"5935":0,"6016":1,"6024":0,"6044":1,"6051":0,"6062":1,"6069":0,"6121":1,"6128":0,"6144":1,"6154":0,"6186":1,"6194":0,"6252":1,"6257":0,"6282":1,"6288":0,"6311":1,"6316":0,"6338":1,"6347":0,"6363":1,"6373":0,"6389":1,"6398":0,"6443":1,"6451":0,"6474":1,"6482":0,"6500":1,"6506":0,"6525":1,"6532":0,"6552":1,"6560":0,"6575":1,"6586":0,"6599":1,"6609":0,"6619":1,"6629":0,"6690":1,"6700":0,"6710":1,"6717":0,"6742":1,"6752":0,"6757":1,"6774":0,"6797":1,"6804":0,"6825":1,"6832":0,"6851":1,"6858":0,"6878":1,"6887":0,"6930":1,"6935":0,"6961":1,"6969":0,"6990":1,"6997":0,"7016":1,"7022":0,"7043":1,"7051":0,"7068":1,"7075":0,"7126":1,"7131":0,"7161":1,"7167":0,"7187":1,"7193":0,"7213":1,"7220":0,"7235":1,"7241":0,"7272":1,"7280":0,"7316":1,"7325":0,"7341":1,"7348":0,"7369":1,"7376":0,"7405":1,"7413":0,"7561":1,"7569":0,"7587":1,"7591":0,"7638":1,"7643":0,"7669":1,"7674":0,"7703":1,"7710":0,"7736":1,"7742":0,"7776":1,"7783":0,"7811":1,"7819":0,"7888":1,"7894":0,"7923":1,"7931":0,"7997":1,"8003":0,"8029":1,"8035":0,"8057":1,"8062":0,"8084":1,"8092":0,"8127":1,"8133":0,"8151":1,"8159":0,"8169":1,"8177":0,"8205":1,"8227":0,"8268":1,"8275":0,"8313":1,"8320":0,"8351":1,"8377":0,"8434":1,"8463":0,"8490":1,"8502":0,"8518":1,"8526":0,"8546":1,"8582":0,"8601":1,"8660":0,"8692":1,"8722":0,"8817":1,"8826":0}' - ), - Km = JSON.parse( - '{"107":1,"114":0,"179":1,"187":0,"260":1,"267":0,"347":1,"354":0,"405":1,"412":0,"471":1,"671":0,"750":1,"757":0,"779":1,"787":0,"804":1,"813":0,"874":1,"882":0,"929":1,"936":0,"984":1,"990":0,"1040":1,"1047":0,"1206":1,"1213":0,"1259":1,"1267":0,"1316":1,"1323":0,"1356":1,"1696":0,"1716":1,"1726":0,"1763":1,"1771":0,"1833":1,"1841":0,"1887":1,"1898":0,"1970":1,"2074":0,"2148":1,"2155":0,"2206":1,"2214":0,"2290":1,"2298":0,"2344":1,"2352":0,"2501":1,"2507":0,"2621":1,"2629":0,"2727":1,"2736":0,"2789":1,"2797":0,"2863":1,"2871":0,"2919":1,"2943":0,"3071":1,"3079":0,"3161":1,"3168":0,"3250":1,"3332":0,"3389":1,"3398":0,"3426":1,"3436":0,"3455":1,"3463":0,"3522":1,"3528":0,"3616":1,"3623":0,"3741":1,"3748":0,"3840":1,"3848":0,"3890":1,"3899":0,"3983":1,"4040":0,"4116":1,"4124":0,"4174":1,"4181":0,"4211":1,"4292":0,"4332":1,"4341":0,"4373":1,"4381":0,"4421":1,"4480":0,"4526":1,"4533":0,"4580":1,"4588":0,"4600":1,"4616":0,"4649":1,"4684":0,"4718":1,"4728":0,"4750":1,"4758":0,"4788":1,"4839":0,"4935":1,"4944":0,"4984":1,"4993":0,"5021":1,"5032":0,"5068":1,"5076":0,"5101":1,"5110":0,"5144":1,"5153":0,"5200":1,"5209":0,"5258":1,"5295":0,"5324":1,"5332":0,"5355":1,"5363":0,"5421":1,"5430":0,"5521":1,"5528":0,"5557":1,"5643":0,"5683":1,"5715":0,"5829":1,"5837":0,"5887":1,"5894":0,"5933":1,"5941":0,"6014":1,"6022":0,"6183":1,"6192":0,"6278":1,"6285":0,"6331":1,"6340":0,"6374":1,"6381":0,"6437":1,"6444":0,"6488":1,"6496":0,"6542":1,"6548":0,"6589":1,"6599":0,"6639":1,"6648":0,"6704":1,"6714":0,"6767":1,"6774":0,"6803":1,"6811":0,"6865":1,"6875":0,"6938":1,"6944":0,"7016":1,"7024":0,"7046":1,"7055":0,"7085":1,"7092":0,"7149":1,"7158":0,"7206":1,"7214":0,"7334":1,"7341":0,"7464":1,"7471":0}', - ), - Qm = JSON.parse( - '{"177":1,"182":0,"239":1,"246":0,"313":1,"319":0,"405":1,"411":0,"453":1,"461":0,"484":1,"491":0,"525":1,"533":0,"628":1,"636":0,"647":1,"654":0,"667":1,"674":0,"701":1,"708":0,"730":1,"738":0,"759":1,"767":0,"792":1,"799":0,"851":1,"861":0,"889":1,"898":0,"922":1,"929":0,"946":1,"954":0,"993":1,"1001":0,"1098":1,"1104":0,"1161":1,"1168":0,"1201":1,"1208":0,"1221":1,"1229":0,"1397":1,"1403":0,"1468":1,"1477":0,"1551":1,"1559":0,"1603":1,"1611":0,"1641":1,"1650":0,"1697":1,"1704":0,"1735":1,"1742":0,"1803":1,"1811":0,"1882":1,"1890":0,"2027":1,"2035":0,"2066":1,"2074":0,"2123":1,"2130":0,"2186":1,"2193":0,"2230":1,"2238":0,"2252":1,"2260":0,"2309":1,"2317":0,"2348":1,"2356":0,"2413":1,"2419":0,"2435":1,"2443":0,"2475":1,"2483":0,"2492":1,"2499":0,"2679":1,"2687":0,"2725":1,"2734":0,"2766":1,"2774":0,"2800":1,"2808":0,"2828":1,"2836":0,"2888":1,"2896":0,"2921":1,"2929":0,"2951":1,"2959":0,"3023":1,"3031":0,"3072":1,"3080":0,"3178":1,"3187":0,"3278":1,"3286":0,"3328":1,"3335":0,"3364":1,"3372":0,"3448":1,"3455":0,"3502":1,"3510":0,"3526":1,"3534":0,"3551":1,"3558":0,"3581":1,"3588":0,"3610":1,"3618":0,"3695":1,"3703":0,"3773":1,"3782":0,"3809":1,"3816":0,"3831":1,"3839":0,"3849":1,"3857":0,"4085":1,"4094":0,"4180":1,"4188":0,"4247":1,"4254":0,"4339":1,"4348":0,"4408":1,"4416":0,"4498":1,"4508":0,"4589":1,"4598":0,"4633":1,"4641":0,"4671":1,"4679":0,"4719":1,"4728":0,"4759":1,"4768":0,"4807":1,"4815":0,"4827":1,"4835":0,"4851":1,"4858":0,"4872":1,"4880":0,"4899":1,"4906":0,"4926":1,"4933":0,"4982":1,"4990":0,"5027":1,"5035":0,"5058":1,"5067":0,"5106":1,"5114":0,"5155":1,"5163":0,"5199":1,"5208":0}', - ), - Zm = JSON.parse( - '{"58":1,"64":0,"165":1,"173":0,"193":1,"204":0,"219":1,"237":0,"273":1,"284":0,"304":1,"334":0,"460":1,"483":0,"564":1,"579":0,"595":1,"612":0,"628":1,"640":0,"699":1,"714":0,"862":1,"868":0,"875":1,"899":0,"924":1,"933":0,"953":1,"961":0,"1026":1,"1073":0,"1119":1,"1165":0,"1275":1,"1286":0,"1304":1,"1319":0,"1329":1,"1341":0,"1380":1,"1389":0,"1411":1,"1419":0,"1514":1,"1529":0,"1542":1,"1552":0,"1567":1,"1576":0,"1591":1,"1602":0,"1663":1,"1676":0,"1698":1,"1712":0,"1729":1,"1742":0,"1756":1,"1764":0,"1805":1,"1813":0,"1860":1,"1883":0,"1903":1,"1914":0,"1928":1,"1942":0,"1956":1,"1963":0,"1989":1,"1998":0,"2049":1,"2098":0,"2142":1,"2155":0,"2225":1,"2237":0,"2250":1,"2258":0,"2271":1,"2279":0,"2294":1,"2306":0,"2322":1,"2329":0,"2361":1,"2368":0,"2410":1,"2448":0,"2479":1,"2505":0,"2589":1,"2596":0,"2618":1,"2632":0,"2646":1,"2653":0,"2670":1,"2686":0,"2719":1,"2726":0,"2770":1,"2782":0,"2802":1,"2817":0,"2834":1,"2848":0,"2862":1,"2876":0,"2973":1,"2980":0,"3002":1,"3031":0,"3114":1,"3125":0,"3144":1,"3156":0,"3169":1,"3183":0,"3228":1,"3265":0,"3299":1,"3309":0,"3349":1,"3392":0,"3427":1,"3458":0,"3484":1,"3512":0,"3527":1,"3538":0,"3568":1,"3578":0,"3597":1,"3638":0,"3733":1,"3742":0,"3763":1,"3784":0,"3810":1,"3830":0,"3854":1,"3880":0,"3903":1,"3922":0,"3946":1,"3973":0,"3997":1,"4015":0,"4039":1,"4052":0,"4093":1,"4113":0,"4137":1,"4147":0,"4164":1,"4203":0,"4228":1,"4237":0,"4272":1,"4379":0,"4386":1,"4399":0,"4468":1,"4475":0,"4496":1,"4513":0,"4530":1,"4546":0,"4570":1,"4595":0,"4616":1,"4630":0,"4638":1,"4643":0,"4660":1,"4672":0,"4688":1,"4706":0,"4729":1,"4754":0,"4770":1,"4782":0,"4799":1,"4828":0,"4847":1,"4863":0,"4872":1,"4877":0,"4906":1,"4923":0,"4947":1,"4978":0,"4992":1,"5010":0,"5036":1,"5069":0,"5082":1,"5100":0,"5118":1,"5129":0,"5146":1,"5160":0,"5211":1,"5221":0,"5232":1,"5246":0,"5260":1,"5271":0,"5287":1,"5300":0,"5309":1,"5318":0,"5375":1,"5410":0,"5447":1,"5459":0,"5473":1,"5482":0,"5493":1,"5503":0,"5522":1,"5533":0,"5542":1,"5547":0,"5587":1,"5601":0,"5609":1,"5626":0,"5652":1,"5664":0,"5676":1,"5687":0,"5700":1,"5714":0,"5728":1,"5739":0,"5793":1,"5805":0,"5840":1,"5849":0,"5953":1,"5977":0,"5989":1,"5998":0,"6046":1,"6073":0,"6088":1,"6098":0,"6126":1,"6155":0,"6233":1,"6240":0,"6267":1,"6309":0,"6376":1,"6382":0,"6412":1,"6456":0,"6538":1,"6553":0,"6562":1,"6572":0,"6585":1,"6590":0,"6616":1,"6636":0,"6727":1,"6749":0,"6809":1,"6833":0,"6887":1,"6893":0,"6910":1,"6921":0,"6949":1,"6998":0,"7089":1,"7101":0,"7119":1,"7139":0,"7179":1,"7199":0,"7257":1,"7276":0,"7291":1,"7310":0,"7352":1,"7368":0,"7383":1,"7415":0}', - ), - ef = JSON.parse( - '{"56":1,"60":0,"142":1,"156":0,"159":1,"180":0,"199":1,"207":0,"272":1,"279":0,"310":1,"316":0,"373":1,"383":0,"386":1,"409":0,"437":1,"473":0,"535":1,"540":0,"619":1,"658":0,"731":1,"765":0,"787":1,"849":0,"874":1,"912":0,"1071":1,"1107":0,"1200":1,"1228":0,"1328":1,"1349":0,"1382":1,"1399":0,"1426":1,"1439":0,"1493":1,"1528":0,"1561":1,"1571":0,"1629":1,"1643":0,"1688":1,"1694":0,"1715":1,"1722":0,"1807":1,"1816":0,"1862":1,"1875":0,"1915":1,"1957":0,"1994":1,"2001":0,"2024":1,"2032":0,"2055":1,"2060":0,"2072":1,"2084":0,"2141":1,"2153":0,"2189":1,"2249":0,"2392":1,"2459":0,"2506":1,"2550":0,"2558":1,"2567":0,"2573":1,"2589":0,"2611":1,"2616":0,"2675":1,"2697":0,"2706":1,"2717":0,"2743":1,"2752":0,"2761":1,"2769":0,"2779":1,"2800":0,"2820":1,"2836":0,"2841":1,"2871":0,"2882":1,"2892":0,"2927":1,"3073":0,"3095":1,"3135":0,"3147":1,"3191":0,"3266":1,"3333":0,"3361":1,"3428":0,"3449":1,"3457":0,"3485":1,"3490":0,"3544":1,"3579":0,"3601":1,"3608":0,"3634":1,"3641":0,"3659":1,"3668":0,"3685":1,"3695":0,"3715":1,"3719":0,"3795":1,"3799":0,"3819":1,"3825":0,"3850":1,"3857":0,"3881":1,"3885":0,"3909":1,"3914":0,"3945":1,"3953":0,"3977":1,"3985":0,"4011":1,"4022":0,"4055":1,"4064":0,"4067":1,"4090":0,"4116":1,"4157":0,"4190":1,"4200":0,"4248":1,"4279":0,"4306":1,"4314":0,"4331":1,"4337":0,"4392":1,"4400":0,"4472":1,"4482":0,"4524":1,"4538":0,"4582":1,"4596":0,"4617":1,"4659":0,"4724":1,"4748":0,"4834":1,"4894":0,"4922":1,"4927":0,"5037":1,"5043":0,"5089":1,"5097":0,"5124":1,"5129":0,"5204":1,"5209":0,"5229":1,"5237":0,"5273":1,"5282":0,"5346":1,"5361":0,"5541":1,"5548":0,"5622":1,"5642":0,"5685":1,"5690":0,"5761":1,"5770":0,"5783":1,"5791":0,"5866":1,"5874":0,"5906":1,"5940":0,"5991":1,"6028":0,"6049":1,"6057":0,"6081":1,"6130":0,"6225":1,"6272":0,"6322":1,"6350":0,"6352":1,"6381":0,"6429":1,"6438":0,"6439":1,"6464":0,"6486":1,"6494":0,"6529":1,"6536":0,"6580":1,"6644":0,"6662":1,"6685":0,"6712":1,"6724":0,"6748":1,"6757":0,"6792":1,"6832":0,"6841":1,"6854":0,"7000":1,"7012":0,"7066":1,"7080":0,"7139":1,"7151":0,"7208":1,"7358":0,"7417":1,"7435":0,"7480":1,"7491":0,"7601":1,"7608":0,"7626":1,"7632":0,"7669":1,"7675":0,"7763":1,"7770":0,"7790":1,"7832":0,"7846":1,"7854":0,"7904":1,"7916":0,"7928":1,"7935":0,"7950":1,"7958":0,"8044":1,"8051":0,"8073":1,"8077":0,"8160":1,"8170":0,"8192":1,"8200":0,"8218":1,"8223":0,"8239":1,"8247":0,"8269":1,"8274":0,"8292":1,"8301":0,"8405":1,"8411":0,"8437":1,"8442":0,"8495":1,"8504":0,"8555":1,"8561":0,"8657":1,"8725":0,"8747":1,"8765":0,"8829":1,"8837":0,"8859":1,"8865":0,"8885":1,"8893":0,"9082":1,"9089":0,"9255":1,"9287":0,"9356":1,"9363":0,"9499":1,"9507":0,"9520":1,"9536":0,"9619":1,"9658":0}' - ), - tf = JSON.parse( - '{"46":1,"49":0,"83":1,"88":0,"113":1,"116":0,"138":1,"143":0,"211":1,"217":0,"272":1,"279":0,"309":1,"366":0,"427":1,"433":0,"465":1,"472":0,"505":1,"512":0,"579":1,"586":0,"654":1,"660":0,"691":1,"695":0,"720":1,"725":0,"765":1,"773":0,"789":1,"795":0,"928":1,"933":0,"973":1,"978":0,"1002":1,"1008":0,"1030":1,"1036":0,"1097":1,"1104":0,"1147":1,"1156":0,"1205":1,"1213":0,"1258":1,"1264":0,"1347":1,"1354":0,"1375":1,"1382":0,"1414":1,"1474":0,"1565":1,"1572":0,"1635":1,"1640":0,"1664":1,"1668":0,"1691":1,"1696":0,"1812":1,"1821":0,"1872":1,"1883":0,"1918":1,"1930":0,"1985":1,"1995":0,"2076":1,"2081":0,"2136":1,"2170":0,"2225":1,"2235":0,"2265":1,"2275":0,"2301":1,"2311":0,"2390":1,"2396":0,"2421":1,"2427":0,"2454":1,"2461":0,"2693":1,"2702":0,"2742":1,"2749":0,"2880":1,"2885":0,"2913":1,"2917":0,"2960":1,"2964":0,"3006":1,"3012":0,"3097":1,"3103":0,"3132":1,"3138":0,"3198":1,"3204":0,"3230":1,"3240":0,"3296":1,"3302":0,"3351":1,"3356":0,"3421":1,"3430":0,"3470":1,"3481":0,"3566":1,"3574":0,"3652":1,"3659":0,"3713":1,"3718":0,"3791":1,"3797":0,"3833":1,"3841":0,"3987":1,"3993":0,"4015":1,"4021":0,"4046":1,"4053":0,"4071":1,"4081":0,"4115":1,"4122":0,"4142":1,"4148":0,"4222":1,"4230":0,"4253":1,"4262":0,"4290":1,"4295":0,"4367":1,"4372":0,"4548":1,"4555":0,"4741":1,"4750":0,"4766":1,"4778":0,"4853":1,"4861":0,"5044":1,"5051":0,"5095":1,"5102":0,"5194":1,"5203":0,"5229":1,"5238":0,"5271":1,"5280":0,"5412":1,"5416":0,"5476":1,"5483":0,"5572":1,"5579":0,"5630":1,"5637":0,"5670":1,"5678":0,"5759":1,"5767":0,"5791":1,"5800":0,"5883":1,"5890":0,"5988":1,"5997":0,"6030":1,"6039":0,"6104":1,"6112":0,"6126":1,"6132":0,"6249":1,"6256":0,"6294":1,"6301":0,"6322":1,"6328":0,"6345":1,"6353":0,"6370":1,"6383":0,"6484":1,"6493":0,"6516":1,"6524":0,"6539":1,"6549":0,"6568":1,"6606":0,"6702":1,"6743":0,"6771":1,"6779":0,"6799":1,"6805":0,"6823":1,"6832":0,"6936":1,"7008":0,"7031":1,"7039":0,"7139":1,"7154":0,"7156":1,"7160":0,"7206":1,"7277":0,"7358":1,"7367":0,"7386":1,"7396":0,"7547":1,"7560":0,"7753":1,"7763":0,"7780":1,"7788":0,"7803":1,"7813":0,"7868":1,"7875":0,"7915":1,"7923":0,"8047":1,"8056":0,"8089":1,"8096":0,"8135":1,"8142":0,"8220":1,"8226":0,"8267":1,"8273":0,"8303":1,"8308":0,"8415":1,"8420":0,"8514":1,"8519":0,"8549":1,"8554":0,"8640":1,"8646":0,"8715":1,"8720":0,"8800":1,"8807":0,"8905":1,"8911":0,"8943":1,"8950":0,"9053":1,"9059":0,"9120":1,"9128":0,"9348":1,"9354":0,"9374":1,"9384":0,"9450":1,"9459":0,"9506":1,"9515":0,"9596":1,"9608":0,"9617":1,"9630":0,"9647":1,"9657":0,"9671":1,"9681":0,"9695":1,"9709":0,"9721":1,"9730":0,"9807":1,"9814":0,"9862":1,"9868":0,"9919":1,"9927":0,"9973":1,"9983":0,"10032":1,"10039":0}' - ), - af = JSON.parse( - '{"33":1,"40":0,"61":1,"69":0,"150":1,"156":0,"182":1,"190":0,"207":1,"216":0,"225":1,"254":0,"266":1,"275":0,"300":1,"389":0,"417":1,"425":0,"441":1,"511":0,"535":1,"625":0,"650":1,"662":0,"674":1,"741":0,"768":1,"857":0,"878":1,"887":0,"1213":1,"1221":0,"1250":1,"1258":0,"1310":1,"1317":0,"1367":1,"1376":0,"1488":1,"1504":0,"1542":1,"1549":0,"1595":1,"1602":0,"1681":1,"1688":0,"1767":1,"1775":0,"1919":1,"1929":0,"1941":1,"1951":0,"2016":1,"2026":0,"2105":1,"2114":0,"2131":1,"2141":0,"2160":1,"2169":0,"2188":1,"2197":0,"2217":1,"2226":0,"2248":1,"2257":0,"2312":1,"2319":0,"2328":1,"2338":0,"2349":1,"2358":0,"2376":1,"2384":0,"2422":1,"2429":0,"2445":1,"2452":0,"2492":1,"2501":0,"2518":1,"2526":0,"2608":1,"2616":0,"2622":1,"2630":0,"2634":1,"2641":0,"2800":1,"2808":0,"2840":1,"2848":0,"2874":1,"2883":0,"2938":1,"2946":0,"2979":1,"2988":0,"3029":1,"3038":0,"3072":1,"3081":0,"3096":1,"3109":0,"3215":1,"3223":0,"3276":1,"3342":0,"3379":1,"3390":0,"3441":1,"3451":0,"3483":1,"3491":0,"3557":1,"3568":0,"3713":1,"3721":0,"3746":1,"3755":0,"3788":1,"3796":0,"3807":1,"3817":0,"3833":1,"3871":0,"3918":1,"3927":0,"3937":1,"3948":0,"3973":1,"3984":0,"3995":1,"4005":0,"4033":1,"4044":0,"4088":1,"4097":0,"4118":1,"4127":0,"4143":1,"4154":0,"4172":1,"4185":0,"4235":1,"4245":0,"4276":1,"4285":0,"4304":1,"4314":0,"4400":1,"4411":0,"4439":1,"4448":0,"4480":1,"4493":0,"4504":1,"4515":0,"4536":1,"4546":0,"4605":1,"4610":0,"4630":1,"4687":0,"4826":1,"4836":0,"4931":1,"4939":0,"5164":1,"5172":0,"5203":1,"5211":0,"5260":1,"5266":0,"5314":1,"5325":0,"5398":1,"5406":0,"5426":1,"5441":0,"5482":1,"5494":0,"5544":1,"5553":0,"5830":1,"5897":0,"6032":1,"6093":0,"6207":1,"6217":0,"6262":1,"6269":0,"6314":1,"6321":0,"6367":1,"6375":0,"6421":1,"6431":0,"6498":1,"6508":0,"6672":1,"6679":0,"6787":1,"6795":0,"6881":1,"6916":0,"6993":1,"7002":0,"7011":1,"7023":0,"7091":1,"7099":0,"7136":1,"7146":0,"7157":1,"7167":0,"7224":1,"7235":0,"7254":1,"7263":0,"7283":1,"7292":0,"7358":1,"7364":0,"7423":1,"7432":0,"7452":1,"7461":0,"7481":1,"7491":0,"7519":1,"7527":0,"7547":1,"7556":0,"7587":1,"7595":0,"7716":1,"7724":0,"7768":1,"7775":0,"7791":1,"7800":0,"7817":1,"7827":0,"7843":1,"7851":0,"7891":1,"7899":0,"7928":1,"7935":0,"7955":1,"7965":0,"8018":1,"8026":0,"8036":1,"8044":0,"8063":1,"8071":0,"8102":1,"8111":0,"8142":1,"8148":0,"8253":1,"8260":0,"8286":1,"8293":0,"8359":1,"8365":0,"8374":1,"8404":0,"8449":1,"8455":0,"8523":1,"8532":0,"8563":1,"8572":0}', - ), - nf = JSON.parse( - '{"83":1,"92":0,"136":1,"143":0,"182":1,"191":0,"229":1,"265":0,"310":1,"319":0,"334":1,"343":0,"356":1,"368":0,"389":1,"400":0,"431":1,"457":0,"475":1,"483":0,"491":1,"500":0,"527":1,"535":0,"557":1,"567":0,"599":1,"609":0,"654":1,"663":0,"698":1,"708":0,"770":1,"779":0,"787":1,"796":0,"816":1,"825":0,"837":1,"846":0,"860":1,"870":0,"885":1,"893":0,"927":1,"935":0,"950":1,"960":0,"979":1,"1033":0,"1052":1,"1057":1,"1061":0,"1066":0,"1078":1,"1137":0,"1173":1,"1183":0,"1195":1,"1204":0,"1217":1,"1227":0,"1242":1,"1252":0,"1265":1,"1274":0,"1302":1,"1328":0,"1344":1,"1352":0,"1377":1,"1388":0,"1409":1,"1418":0,"1440":1,"1448":0,"1472":1,"1483":0,"1505":1,"1514":0,"1558":1,"1569":0,"1591":1,"1601":0,"1627":1,"1636":0,"1650":1,"1660":0,"1685":1,"1695":0,"1723":1,"1732":0,"1756":1,"1765":0,"1777":1,"1787":0,"1798":1,"1808":0,"1824":1,"1834":0,"1846":1,"1856":0,"1869":1,"1878":0,"1891":1,"1901":0,"1945":1,"1955":0,"1994":1,"2004":0,"2021":1,"2030":0,"2046":1,"2055":0,"2075":1,"2085":0,"2092":1,"2102":0,"2135":1,"2144":0,"2156":1,"2158":1,"2165":0,"2169":0,"2180":1,"2188":0,"2204":1,"2212":0,"2227":1,"2235":0,"2252":1,"2260":0,"2275":1,"2283":0,"2449":1,"2457":0,"2500":1,"2508":0,"2537":1,"2545":0,"2599":1,"2606":0,"2631":1,"2639":0,"2667":1,"2674":0,"2724":1,"2777":0,"2845":1,"2853":0,"2878":1,"2887":0,"2922":1,"2932":0,"2956":1,"2963":0,"2989":1,"2999":0,"3012":1,"3020":0,"3032":1,"3040":0,"3047":1,"3057":0,"3098":1,"3145":1,"3178":0,"3216":1,"3248":0,"3267":1,"3302":0,"3361":1,"3392":0,"3443":1,"3524":0,"3554":1,"3582":0,"3620":1,"3631":0,"3648":1,"3653":0,"3658":1,"3662":0,"3667":1,"3671":0,"3675":1,"3680":0,"3685":1,"3689":0,"3695":1,"3699":0,"3705":1,"3708":0,"3714":1,"3719":0,"3724":1,"3729":0,"3732":1,"3738":0,"3869":1,"3875":0,"3909":1,"3916":0,"3931":1,"3939":0,"3969":1,"3977":0,"3990":1,"3999":0,"4043":1,"4049":0,"4080":1,"4088":0,"4118":1,"4128":0,"4164":1,"4173":0,"4204":1,"4212":0,"4267":1,"4274":0,"4292":1,"4300":0,"4316":1,"4324":0,"4340":1,"4348":0,"4360":1,"4375":0,"4388":1,"4456":0,"4480":1,"4503":0,"4537":1,"4544":0,"4576":1,"4584":0,"4657":1,"4663":0,"4685":1,"4689":1,"4693":0,"4712":1,"4720":0,"4741":1,"4748":0,"4776":1,"4785":0,"4844":1,"4853":0,"4881":1,"4889":0,"4908":1,"4916":0,"4940":1,"4948":0,"4991":1,"4998":0,"5035":1,"5042":0,"5075":1,"5084":0,"5106":1,"5115":0,"5127":1,"5173":0,"5217":1,"5221":0,"5272":1,"5280":0,"5332":1,"5340":0,"5395":1,"5422":0,"5452":1,"5464":0,"5483":1,"5509":0,"5540":1,"5552":0,"5575":1,"5586":0,"5597":1,"5629":0,"5649":1,"5657":0,"5672":1,"5684":0,"5714":1,"5721":0,"5733":1,"5742":0,"5771":1,"5780":0,"5804":1,"5810":0,"5814":1,"5840":0,"5857":1,"5870":0,"5894":1,"5906":0,"5921":1,"6002":0,"6012":1,"6017":0,"6021":1,"6027":0,"6068":1,"6073":0,"6079":1,"6083":0,"6087":1,"6092":0,"6185":1,"6197":0,"6220":1,"6254":0,"6280":1,"6295":0,"6326":1,"6334":0,"6377":1,"6386":0,"6422":1,"6431":0,"6474":1,"6482":0,"6531":1,"6540":0,"6598":1,"6616":0,"6643":1,"6652":0,"6696":1,"6708":0,"6722":1,"6732":0,"6760":1,"6843":0,"6863":1,"6871":0,"6993":1,"7000":0,"7023":1,"7030":0,"7083":1,"7091":0,"7124":1,"7132":0,"7155":1,"7164":0,"7196":1,"7203":0,"7239":1,"7284":0,"7302":1,"7337":0,"7388":1,"7395":0,"7414":1,"7422":0,"7457":1,"7465":0,"7494":1,"7502":0,"7512":1,"7525":0,"7968":1,"8004":0,"8054":1,"8062":0,"8087":1,"8094":0,"8144":1,"8151":0,"8174":1,"8182":0,"8192":1,"8254":0,"8260":1,"8334":0,"8401":1,"8407":0,"8428":1,"8437":0,"8465":1,"8472":0,"8502":1,"8508":0,"8573":1,"8583":0,"8603":1,"8609":0,"8683":1,"8690":0,"8709":1,"8710":1,"8720":0,"8722":0,"8767":1,"8777":0,"8804":1,"8815":0,"8856":1,"8869":0,"8907":1,"8918":0,"8995":1,"9002":0,"9025":1,"9032":0,"9060":1,"9070":0,"9136":1,"9143":0,"9185":1,"9192":0,"9252":1,"9263":0,"9305":1,"9313":0,"9378":1,"9386":0,"9406":1,"9414":0,"9479":1,"9490":0,"9505":1,"9514":0,"9595":1,"9604":0,"9622":1,"9629":0,"9649":1,"9659":0,"9681":1,"9693":0,"9718":1,"9727":0,"9744":1,"9752":0,"9772":1,"9780":0,"9804":1,"9815":0,"10051":1,"10064":0,"10075":1,"10078":1,"10087":0,"10088":0,"10107":1,"10122":0,"10151":1,"10161":0,"10181":1,"10193":0,"10216":1,"10226":0,"10237":1,"10245":0,"10261":1,"10270":0,"10287":1,"10296":0,"10314":1,"10324":0,"10340":1,"10355":0,"10369":1,"10427":0,"10438":1,"10454":0,"10468":1,"10478":0,"10491":1,"10502":0,"10518":1,"10537":0,"10558":1,"10564":0,"10574":1,"10585":0,"10604":1,"10619":0,"10627":1,"10635":0,"10668":1,"10678":0,"10690":1,"10700":0,"10770":1,"10780":0,"10795":1,"10848":1,"10855":0,"10856":0,"10882":1,"10892":0,"10909":1,"10919":0,"10948":1,"10957":0,"10973":1,"10982":0,"11030":1,"11049":0,"11085":1,"11103":0,"11139":1,"11155":0,"11201":1,"11208":0,"11243":1,"11255":0,"11294":1,"11311":0,"11350":1,"11360":0,"11390":1,"11397":0,"11415":1,"11425":0,"11488":1,"11500":0}', - ), - sf = JSON.parse( - '{"122":1,"133":0,"168":1,"179":0,"218":1,"227":0,"263":1,"273":0,"293":1,"303":0,"331":1,"341":0,"371":1,"381":0,"428":1,"438":0,"464":1,"493":0,"513":1,"522":0,"543":1,"552":0,"571":1,"581":0,"702":1,"713":0,"848":1,"856":0,"876":1,"885":0,"905":1,"914":0,"943":1,"952":0,"982":1,"1008":0,"1059":1,"1068":0,"1108":1,"1117":0,"1135":1,"1145":0,"1176":1,"1187":0,"1220":1,"1229":0,"1344":1,"1352":0,"1430":1,"1438":0,"1513":1,"1521":0,"1603":1,"1610":0,"1693":1,"1703":0,"1774":1,"1786":0,"1866":1,"1876":0,"1949":1,"1960":0,"2041":1,"2051":0,"2122":1,"2132":0,"2213":1,"2224":0,"2297":1,"2306":0,"2388":1,"2396":0,"2471":1,"2478":0,"2560":1,"2569":0,"2689":1,"2696":0,"2881":1,"2891":0,"2929":1,"2938":0,"3029":1,"3035":0,"3067":1,"3073":0,"3104":1,"3111":0,"3190":1,"3199":0,"3277":1,"3284":0,"3392":1,"3400":0,"3480":1,"3490":0,"3536":1,"3542":0,"3570":1,"3573":1,"3580":0,"3631":1,"3639":0,"3658":1,"3665":0,"3700":1,"3709":0,"3756":1,"3765":0,"3879":1,"3886":0,"3903":1,"3911":0,"4079":1,"4088":0,"4165":1,"4174":0,"4192":1,"4201":0,"4277":1,"4285":0,"4322":1,"4330":0,"4376":1,"4386":0,"4424":1,"4432":0,"4451":1,"4460":0,"4487":1,"4497":0,"4532":1,"4541":0,"4558":1,"4568":0,"4611":1,"4621":0,"4654":1,"4662":0,"4733":1,"4742":0,"4770":1,"4780":0,"4816":1,"4825":0,"4869":1,"4878":0,"4892":1,"4901":0,"4935":1,"4945":0,"4975":1,"4986":0,"5009":1,"5016":0,"5063":1,"5071":0,"5096":1,"5104":0,"5134":1,"5142":0,"5164":1,"5171":0,"5207":1,"5216":0}', - ), - of = JSON.parse( - '{"70":1,"187":0,"293":1,"317":0,"322":1,"352":0,"455":1,"476":0,"567":1,"611":0,"699":1,"730":0,"734":1,"765":0,"804":1,"835":0,"906":1,"926":0,"976":1,"986":0,"1051":1,"1076":0,"1169":1,"1187":0,"1225":1,"1338":0,"1343":1,"1369":0,"1473":1,"1495":0,"1499":1,"1530":0,"1575":1,"1595":0,"1643":1,"1671":0,"1677":1,"1709":0,"1731":1,"1748":0,"1754":1,"1785":0,"1824":1,"1847":0,"1912":1,"1926":0,"1959":1,"1967":0,"1998":1,"2004":0,"2036":1,"2053":0,"2094":1,"2108":0,"2128":1,"2141":0,"2144":1,"2173":0,"2187":1,"2203":0,"2252":1,"2258":0,"2330":1,"2359":0,"2362":1,"2390":0,"2435":1,"2459":0,"2493":1,"2513":0,"2518":1,"2545":0,"2555":1,"2562":0,"2592":1,"2617":0,"2666":1,"2723":0,"2785":1,"2804":0,"2849":1,"2880":0,"2932":1,"2939":0,"2963":1,"2971":0,"2999":1,"3007":0,"3136":1,"3148":0,"3244":1,"3260":0,"3338":1,"3346":0,"3404":1,"3427":0,"3529":1,"3552":0,"3657":1,"3669":0,"3673":1,"3701":0,"3769":1,"3777":0,"3811":1,"3821":0,"3858":1,"3866":0,"3975":1,"3990":0,"4025":1,"4050":0,"4095":1,"4134":0,"4182":1,"4215":0,"4262":1,"4305":0,"4348":1,"4371":0,"4411":1,"4423":0,"4458":1,"4469":0,"4499":1,"4505":0,"4538":1,"4545":0,"4578":1,"4589":0,"4623":1,"4628":0,"4734":1,"4762":0,"4773":1,"4794":0,"4923":1,"4985":0,"5023":1,"5033":0,"5073":1,"5078":0,"5145":1,"5171":0,"5198":1,"5203":0,"5263":1,"5278":0,"5362":1,"5367":0,"5396":1,"5402":0,"5446":1,"5453":0,"5497":1,"5503":0,"5559":1,"5587":0,"5630":1,"5637":0,"5661":1,"5670":0,"5717":1,"5730":0,"5758":1,"5791":0,"5805":1,"5823":0,"5846":1,"5868":0,"5932":1,"5950":0,"5975":1,"5998":0,"6023":1,"6036":0,"6166":1,"6178":0,"6192":1,"6351":0,"6365":1,"6383":0,"6447":1,"6465":0,"6475":1,"6503":0,"6583":1,"6588":0,"6618":1,"6625":0,"6655":1,"6672":0,"6687":1,"6811":0,"6853":1,"6876":0,"6912":1,"6925":0,"6995":1,"7022":0,"7134":1,"7162":0,"7234":1,"7248":0,"7317":1,"7328":0,"7423":1,"7436":0,"7471":1,"7535":0,"7564":1,"7603":0,"7631":1,"7654":0,"7659":1,"7692":0,"7710":1,"7735":0,"7767":1,"7809":0,"7844":1,"7855":0,"7859":1,"7889":0,"7897":1,"7917":0,"7924":1,"7953":0,"7995":1,"8023":0,"8068":1,"8086":0,"8117":1,"8130":0,"8135":1,"8161":0,"8271":1,"8286":0,"8324":1,"8341":0,"8347":1,"8375":0,"8394":1,"8412":0,"8505":1,"8512":0,"8640":1,"8668":0,"8675":1,"8681":0,"8712":1,"8724":0,"8776":1,"8791":0,"8812":1,"8867":0,"8871":1,"8902":0,"8960":1,"8966":0,"9002":1,"9010":0,"9014":1,"9041":0}', - ), - rf = JSON.parse( - '{"87":1,"94":0,"134":1,"141":0,"227":1,"234":0,"410":1,"417":0,"531":1,"541":0,"564":1,"635":0,"704":1,"714":0,"781":1,"789":0,"841":1,"852":0,"904":1,"914":0,"999":1,"1008":0,"1022":1,"1032":0,"1076":1,"1086":0,"1156":1,"1165":0,"1187":1,"1197":0,"1271":1,"1281":0,"1326":1,"1336":0,"1360":1,"1420":0,"1527":1,"1536":0,"1588":1,"1598":0,"1652":1,"1660":0,"1700":1,"1709":0,"1789":1,"1797":0,"1809":1,"1820":0,"1850":1,"1859":0,"1880":1,"1888":0,"1907":1,"1915":0,"1930":1,"1941":0,"2034":1,"2043":0,"2068":1,"2078":0,"2101":1,"2109":0,"2123":1,"2133":0,"2157":1,"2163":0,"2228":1,"2237":0,"2250":1,"2262":0,"2300":1,"2311":0,"2333":1,"2339":0,"2348":1,"2360":0,"2403":1,"2411":0,"2440":1,"2446":0,"2470":1,"2478":0,"2738":1,"2747":0,"2789":1,"2866":0,"2922":1,"2935":0,"3022":1,"3031":0,"3065":1,"3127":0,"3162":1,"3172":0,"3360":1,"3526":0,"3559":1,"3570":0,"3669":1,"3677":0,"3780":1,"3789":0,"3815":1,"3824":0,"3885":1,"3893":0,"3949":1,"3997":0,"4059":1,"4069":0,"4116":1,"4128":0,"4156":1,"4165":0,"4195":1,"4209":0,"4227":1,"4240":0,"4277":1,"4286":0,"4316":1,"4323":0,"4406":1,"4413":0,"4421":1,"4431":0,"4474":1,"4483":0,"4504":1,"4512":0,"4543":1,"4617":0,"4650":1,"4661":0,"4718":1,"4725":0,"4823":1,"4832":0,"4865":1,"4886":0,"4966":1,"4972":0,"5028":1,"5035":0,"5108":1,"5116":0,"5190":1,"5198":0,"5225":1,"5234":0,"5260":1,"5269":0,"5340":1,"5347":0,"5356":1,"5365":0,"5438":1,"5446":0,"5519":1,"5527":0,"5562":1,"5569":0,"5662":1,"5670":0,"6062":1,"6071":0,"6175":1,"6181":0,"6264":1,"6326":0,"6364":1,"6373":0,"6415":1,"6517":0,"6556":1,"6604":0,"6634":1,"6694":0,"6735":1,"6744":0,"6875":1,"6883":0,"7017":1,"7024":0,"7059":1,"7067":0,"7116":1,"7123":0,"7160":1,"7167":0,"7194":1,"7201":0,"7212":1,"7223":0,"7251":1,"7258":0,"7265":1,"7272":0,"7348":1,"7356":0,"7511":1,"7518":0,"7557":1,"7563":0,"7616":1,"7623":0,"7728":1,"7735":0,"7792":1,"7800":0,"7861":1,"7869":0,"7919":1,"7927":0,"8011":1,"8019":0,"8068":1,"8186":0,"8235":1,"8244":0,"8600":1,"8609":0,"8728":1,"8738":0,"8914":1,"8921":0,"8945":1,"8956":0,"8998":1,"9006":0,"9187":1,"9195":0,"9325":1,"9332":0,"9386":1,"9394":0,"9450":1,"9456":0,"9590":1,"9597":0,"9644":1,"9652":0,"9701":1,"9708":0,"9758":1,"9764":0,"9849":1,"9856":0,"9916":1,"9925":0,"9953":1,"9961":0,"9985":1,"9991":0,"10141":1,"10151":0,"10213":1,"10220":0,"10263":1,"10273":0,"10331":1,"10341":0,"10480":1,"10487":0}', - ), - lf = JSON.parse( - '{"101":1,"109":0,"336":1,"344":0,"539":1,"549":0,"709":1,"717":0,"801":1,"810":0,"900":1,"910":0,"913":1,"932":0,"969":1,"1001":0,"1038":1,"1099":0,"1222":1,"1232":0,"1264":1,"1301":0,"1363":1,"1374":0,"1414":1,"1423":0,"1451":1,"1459":0,"1483":1,"1518":0,"1613":1,"1622":0,"1680":1,"1688":0,"1826":1,"1836":0,"1895":1,"1906":0,"1970":1,"1980":0,"2004":1,"2013":0,"2116":1,"2126":0,"2169":1,"2225":0,"2335":1,"2345":0,"2392":1,"2402":0,"2435":1,"2446":0,"2470":1,"2480":0,"2557":1,"2565":0,"2617":1,"2627":0,"2800":1,"2809":0,"2840":1,"2852":0,"2910":1,"2921":0,"2956":1,"2965":0,"2991":1,"3018":0,"3104":1,"3113":0,"3117":1,"3138":0,"3192":1,"3203":0,"3228":1,"3240":0,"3293":1,"3304":0,"3319":1,"3329":0,"3341":1,"3353":0,"3467":1,"3478":0,"3513":1,"3527":0,"3542":1,"3552":0,"3650":1,"3658":0,"3707":1,"3715":0,"3763":1,"3771":0,"3817":1,"3827":0,"3876":1,"3885":0,"3930":1,"3940":0,"4103":1,"4113":0,"4180":1,"4191":0,"4224":1,"4234":0,"4270":1,"4279":0,"4328":1,"4339":0,"4402":1,"4412":0,"4535":1,"4543":0,"4576":1,"4584":0,"4620":1,"4629":0,"4648":1,"4694":0,"4785":1,"4793":0,"4890":1,"4901":0,"5106":1,"5116":0,"5169":1,"5178":0,"5238":1,"5246":0,"5316":1,"5325":0,"5395":1,"5406":0,"5452":1,"5464":0,"5621":1,"5635":0,"5677":1,"5687":0,"5772":1,"5780":0,"5919":1,"5930":0,"5991":1,"6001":0,"6026":1,"6035":0,"6148":1,"6159":0,"6202":1,"6216":0,"6257":1,"6268":0,"6302":1,"6393":0,"6432":1,"6443":0,"6469":1,"6479":0,"6497":1,"6507":0,"6619":1,"6633":0,"6761":1,"6827":0,"6881":1,"6891":0,"6912":1,"6923":0,"6962":1,"6971":0,"7044":1,"7054":0,"7088":1,"7097":0,"7220":1,"7228":0,"7240":1,"7251":0,"7296":1,"7305":0,"7324":1,"7336":0,"7346":1,"7355":0,"7460":1,"7468":0,"7498":1,"7507":0,"7672":1,"7681":0,"7720":1,"7729":0,"7748":1,"7759":0,"7797":1,"7808":0,"7821":1,"7837":0,"7874":1,"7885":0,"7979":1,"7992":0,"8030":1,"8040":0,"8069":1,"8077":0,"8114":1,"8125":0,"8174":1,"8183":0,"8246":1,"8259":0,"8332":1,"8342":0,"8382":1,"8389":0,"8424":1,"8432":0,"8454":1,"8462":0,"8568":1,"8577":0,"8605":1,"8614":0,"8639":1,"8649":0,"8671":1,"8682":0,"8709":1,"8719":0,"8747":1,"8759":0,"8808":1,"8817":0,"8858":1,"8867":0,"8902":1,"8911":0,"8932":1,"8964":0,"9055":1,"9064":0,"9108":1,"9120":0,"9159":1,"9169":0,"9188":1,"9200":0,"9264":1,"9274":0,"9296":1,"9304":0,"9331":1,"9397":0,"9672":1,"9681":0}', - ), - cf = JSON.parse( - '{"148":1,"184":0,"371":1,"408":0,"586":1,"594":0,"618":1,"625":0,"708":1,"715":0,"818":1,"838":0,"849":1,"856":0,"1016":1,"1057":0,"1083":1,"1090":0,"1115":1,"1121":0,"1146":1,"1151":0,"1239":1,"1293":0,"1324":1,"1333":0,"1446":1,"1452":0,"1465":1,"1472":0,"1533":1,"1569":0,"1606":1,"1615":0,"1680":1,"1685":0,"1732":1,"1796":0,"1947":1,"1952":0,"1999":1,"2007":0,"2035":1,"2041":0,"2128":1,"2135":0,"2174":1,"2181":0,"2230":1,"2295":0,"2397":1,"2401":0,"2486":1,"2494":0,"2514":1,"2520":0,"2594":1,"2600":0,"2624":1,"2630":0,"2816":1,"2832":0,"2845":1,"2851":0,"2904":1,"2911":0,"2963":1,"2969":0,"3016":1,"3022":0,"3044":1,"3051":0,"3099":1,"3106":0,"3135":1,"3143":0,"3210":1,"3217":0,"3331":1,"3337":0,"3362":1,"3370":0,"3426":1,"3432":0,"3465":1,"3473":0,"3773":1,"3779":0,"3807":1,"3813":0,"3835":1,"3841":0,"3921":1,"3929":0,"3975":1,"3984":0,"4032":1,"4039":0,"4057":1,"4066":0,"4145":1,"4153":0,"4196":1,"4231":0,"4247":1,"4256":0,"4393":1,"4431":0,"4449":1,"4458":0,"4480":1,"4488":0,"4595":1,"4603":0,"4635":1,"4643":0,"4662":1,"4669":0,"4811":1,"4873":0,"4904":1,"4915":0,"4968":1,"4977":0,"4992":1,"5002":0,"5079":1,"5086":0,"5134":1,"5142":0,"5239":1,"5248":0,"5273":1,"5281":0,"5292":1,"5300":0,"5321":1,"5330":0,"5373":1,"5378":0,"5483":1,"5490":0,"5514":1,"5522":0,"5577":1,"5583":0,"5622":1,"5628":0,"5652":1,"5659":0,"5710":1,"5716":0,"5740":1,"5747":0,"5838":1,"5847":0,"5937":1,"5974":0,"5996":1,"6004":0,"6053":1,"6059":0,"6079":1,"6087":0,"6109":1,"6116":0,"6142":1,"6150":0,"6193":1,"6201":0,"6391":1,"6396":0,"6411":1,"6428":0,"6482":1,"6488":0,"6514":1,"6520":0,"6584":1,"6600":0,"6617":1,"6623":0,"6646":1,"6651":0,"6662":1,"6668":0,"6728":1,"6734":0,"6792":1,"6803":0,"6838":1,"6846":0,"6866":1,"6875":0,"6926":1,"6934":0,"6955":1,"6962":0,"6987":1,"6993":0,"7016":1,"7022":0,"7059":1,"7065":0,"7075":1,"7082":0,"7128":1,"7138":0,"7342":1,"7348":0,"7372":1,"7378":0,"7404":1,"7411":0,"7444":1,"7453":0,"7469":1,"7479":0,"7514":1,"7518":0,"7527":1,"7533":0,"7567":1,"7577":0,"7601":1,"7639":0,"7684":1,"7694":0,"7717":1,"7724":0,"7743":1,"7751":0,"7778":1,"7797":0,"7848":1,"7857":0,"7946":1,"7953":0,"7971":1,"7980":0,"8005":1,"8012":0,"8024":1,"8030":0,"8138":1,"8145":0,"8192":1,"8197":0,"8227":1,"8233":0,"8252":1,"8260":0,"8303":1,"8310":0,"8329":1,"8336":0,"8360":1,"8365":0,"8404":1,"8410":0,"8441":1,"8448":0,"8472":1,"8477":0,"8693":1,"8712":0,"8748":1,"8754":0,"8777":1,"8785":0,"8807":1,"8815":0,"8842":1,"8851":0,"8882":1,"8891":0,"8916":1,"8956":0,"8963":1,"8971":0,"9335":1,"9347":0,"9428":1,"9439":0,"9456":1,"9463":0}' - ), - df = JSON.parse( - '{"131":1,"137":0,"152":1,"158":0,"205":1,"212":0,"283":1,"289":0,"320":1,"327":0,"348":1,"355":0,"387":1,"393":0,"427":1,"434":0,"460":1,"468":0,"493":1,"501":0,"513":1,"520":0,"571":1,"577":0,"593":1,"600":0,"618":1,"625":0,"634":1,"641":0,"665":1,"673":0,"698":1,"705":0,"761":1,"767":0,"778":1,"786":0,"859":1,"867":0,"883":1,"890":0,"904":1,"911":0,"922":1,"929":0,"945":1,"954":0,"964":1,"972":0,"991":1,"999":0,"1049":1,"1056":0,"1066":1,"1073":0,"1093":1,"1101":0,"1145":1,"1153":0,"1168":1,"1175":0,"1192":1,"1199":0,"1210":1,"1217":0,"1228":1,"1254":0,"1278":1,"1285":0,"1331":1,"1339":0,"1353":1,"1360":0,"1376":1,"1383":0,"1431":1,"1439":0,"1477":1,"1484":0,"1495":1,"1502":0,"1511":1,"1518":0,"1530":1,"1538":0,"1564":1,"1570":0,"1644":1,"1651":0,"1665":1,"1672":0,"1683":1,"1690":0,"1703":1,"1710":0,"1744":1,"1752":0,"1780":1,"1785":0,"1789":1,"1797":0,"1814":1,"1819":0,"1823":1,"1829":0,"1846":1,"1851":0,"1857":1,"1862":0,"1874":1,"1881":0,"1895":1,"1904":0,"1914":1,"1924":0,"2008":1,"2015":0,"2021":1,"2029":0,"2045":1,"2052":0,"2062":1,"2068":0,"2085":1,"2091":0,"2097":1,"2103":0,"2125":1,"2132":0,"2151":1,"2157":0,"2166":1,"2172":0,"2189":1,"2196":0,"2202":1,"2209":0,"2226":1,"2232":0,"2238":1,"2244":0,"2260":1,"2267":0,"2291":1,"2299":0,"2310":1,"2317":0,"2327":1,"2334":0,"2362":1,"2369":0,"2375":1,"2384":0,"2404":1,"2410":0,"2418":1,"2425":0,"2444":1,"2451":0,"2477":1,"2484":0,"2508":1,"2516":0,"2530":1,"2538":0,"2579":1,"2587":0,"2595":1,"2638":0,"2670":1,"2677":0,"2688":1,"2697":0,"2728":1,"2735":0,"2740":1,"2747":0,"2761":1,"2769":0,"2783":1,"2791":0,"2804":1,"2811":0,"2819":1,"2827":0,"2834":1,"2841":0,"2848":1,"2855":0,"2870":1,"2878":0,"2891":1,"2899":0,"2905":1,"2914":0,"2936":1,"2943":0,"2973":1,"2980":0,"2993":1,"3000":0,"3009":1,"3017":0,"3047":1,"3056":0,"3081":1,"3091":0,"3117":1,"3124":0,"3210":1,"3215":0,"3219":1,"3226":0,"3250":1,"3255":0,"3259":1,"3266":0,"3303":1,"3311":0,"3348":1,"3354":0,"3362":1,"3369":0,"3398":1,"3404":0,"3412":1,"3419":0,"3428":1,"3437":0,"3448":1,"3455":0,"3500":1,"3505":0,"3510":1,"3518":0,"3529":1,"3536":0,"3539":1,"3546":0,"3592":1,"3599":0,"3620":1,"3627":0,"3640":1,"3646":0,"3651":1,"3659":0,"3674":1,"3682":0,"3734":1,"3739":0,"3745":1,"3752":0,"3766":1,"3774":0,"3782":1,"3790":0,"3800":1,"3808":0,"3821":1,"3845":0,"3867":1,"3874":0,"3899":1,"3907":0,"3920":1,"3928":0,"3938":1,"3946":0,"3960":1,"3968":0,"4020":1,"4028":0,"4063":1,"4070":0,"4081":1,"4089":0,"4098":1,"4106":0,"4110":1,"4114":1,"4124":0,"4151":1,"4159":0,"4209":1,"4217":0,"4228":1,"4237":0,"4244":1,"4250":0,"4255":1,"4263":0,"4306":1,"4313":0,"4326":1,"4333":0,"4353":1,"4359":0,"4370":1,"4377":0,"4385":1,"4393":0,"4408":1,"4421":0,"4440":1,"4448":0,"4463":1,"4471":0,"4495":1,"4502":0,"4513":1,"4521":0,"4542":1,"4550":0,"4583":1,"4589":0,"4592":1,"4601":0,"4638":1,"4646":0,"4655":1,"4662":0,"4669":1,"4677":0,"4691":1,"4701":0,"4722":1,"4730":0,"4742":1,"4751":0,"4764":1,"4808":0,"4825":1,"4832":0,"4836":1,"4844":0,"4849":1,"4898":0,"4925":1,"4931":0,"4937":1,"4945":0,"4970":1,"4976":0,"4982":1,"4990":0,"5013":1,"5020":0,"5033":1,"5041":0,"5056":1,"5065":0,"5079":1,"5087":0,"5104":1,"5112":0,"5126":1,"5135":0,"5152":1,"5159":0,"5162":1,"5170":0,"5184":1,"5190":0,"5194":1,"5200":0,"5239":1,"5248":0,"5310":1,"5317":0,"5327":1,"5333":0,"5337":1,"5342":0,"5347":1,"5354":0,"5364":1,"5372":0,"5382":1,"5391":0,"5400":1,"5409":0,"5417":1,"5426":0,"5437":1,"5444":0,"5449":1,"5457":0,"5471":1,"5479":0,"5492":1,"5500":0,"5507":1,"5515":0,"5538":1,"5544":0,"5548":1,"5557":0,"5564":1,"5572":0,"5581":1,"5587":0,"5593":1,"5600":0,"5616":1,"5623":0,"5633":1,"5642":0,"5652":1,"5660":0,"5670":1,"5676":0,"5680":1,"5688":0,"5702":1,"5711":0,"5722":1,"5730":0,"5735":1,"5743":0,"5757":1,"5765":0,"5778":1,"5785":0,"5792":1,"5798":0,"5812":1,"5820":0,"5829":1,"5836":0,"5846":1,"5854":0,"5863":1,"5869":0,"5882":1,"5891":0,"5919":1,"5927":0,"5932":1,"5939":0,"5944":1,"5952":0,"5970":1,"5983":0,"5989":1,"6011":0,"6022":1,"6030":0,"6062":1,"6069":0,"6074":1,"6080":0,"6085":1,"6093":0,"6106":1,"6111":0,"6116":1,"6122":0,"6142":1,"6147":0,"6152":1,"6158":0,"6169":1,"6175":0,"6182":1,"6190":0,"6205":1,"6212":0,"6218":1,"6227":0,"6241":1,"6246":0,"6254":1,"6261":0,"6276":1,"6284":0,"6312":1,"6322":0,"6370":1,"6376":0,"6465":1,"6471":0,"6477":1,"6486":0,"6502":1,"6507":0,"6513":1,"6520":0,"6536":1,"6541":0,"6547":1,"6555":0,"6572":1,"6577":0,"6582":1,"6589":0,"6610":1,"6617":0,"6644":1,"6650":0,"6655":1,"6662":0,"6680":1,"6686":0,"6690":1,"6697":0,"6717":1,"6725":0,"6751":1,"6757":0,"6762":1,"6770":0,"6788":1,"6794":0,"6798":1,"6806":0,"6822":1,"6830":0,"6853":1,"6862":0,"6874":1,"6882":0,"6894":1,"6902":0,"6917":1,"6928":0,"6936":1,"6944":0,"6951":1,"6959":0,"6965":1,"6972":0,"6980":1,"6986":0,"6990":1,"6996":0,"7037":1,"7043":0,"7048":1,"7055":0,"7073":1,"7079":0,"7083":1,"7091":0,"7110":1,"7116":0,"7120":1,"7129":0,"7145":1,"7153":0,"7171":1,"7178":0,"7181":1,"7190":0,"7208":1,"7214":0,"7219":1,"7227":0,"7239":1,"7245":0,"7260":1,"7267":0,"7273":1,"7280":0,"7285":1,"7292":0,"7307":1,"7314":0,"7323":1,"7329":0,"7345":1,"7352":0,"7358":1,"7365":0,"7381":1,"7387":0,"7404":1,"7412":0,"7416":1,"7423":0,"7440":1,"7448":0,"7484":1,"7492":0,"7515":1,"7523":0,"7546":1,"7552":0,"7558":1,"7567":0,"7603":1,"7610":0,"7620":1,"7627":0,"7638":1,"7645":0,"7657":1,"7665":0,"7677":1,"7683":0,"7695":1,"7702":0,"7712":1,"7720":0,"7731":1,"7738":0,"7749":1,"7756":0,"7767":1,"7774":0,"7783":1,"7792":0,"7800":1,"7808":0,"7818":1,"7826":0,"7837":1,"7844":0,"7855":1,"7862":0,"7868":1,"7874":0,"7879":1,"7884":0,"7922":1,"7931":0,"7941":1,"7945":1,"7950":0,"7951":0,"7968":1,"7975":0,"7993":1,"8020":0,"8033":1,"8043":0,"8058":1,"8068":0,"8090":1,"8098":0,"8104":1,"8116":0,"8136":1,"8144":0,"8210":1,"8218":0,"8228":1,"8237":0,"8247":1,"8255":0,"8265":1,"8272":0,"8282":1,"8290":0,"8302":1,"8309":0,"8336":1,"8344":0,"8353":1,"8362":0,"8373":1,"8381":0,"8390":1,"8399":0,"8410":1,"8416":0,"8422":1,"8427":0,"8434":1,"8440":0,"8446":1,"8451":0,"8454":1,"8460":0,"8499":1,"8507":0,"8535":1,"8542":0,"8595":1,"8604":0,"8633":1,"8641":0,"8697":1,"8703":0,"8723":1,"8728":0,"8733":1,"8739":0,"8767":1,"8774":0,"8794":1,"8799":0,"8803":1,"8809":0,"8839":1,"8846":0,"8864":1,"8870":0,"8875":1,"8880":0,"8909":1,"8915":0,"8927":1,"8932":0,"8937":1,"8941":0,"8945":1,"8950":0,"8975":1,"8981":0,"8985":1,"8992":0,"9008":1,"9014":0,"9019":1,"9025":0,"9046":1,"9052":0,"9055":1,"9062":0,"9079":1,"9086":0,"9091":1,"9097":0,"9119":1,"9159":0,"9178":1,"9222":0,"9245":1,"9303":0,"9326":1,"9334":0,"9394":1,"9398":0,"9411":1,"9418":0,"9427":1,"9435":0,"9445":1,"9453":0,"9463":1,"9472":0,"9482":1,"9490":0,"9502":1,"9510":0,"9520":1,"9528":0,"9538":1,"9545":0,"9556":1,"9563":0,"9573":1,"9582":0,"9592":1,"9599":0,"9609":1,"9617":0,"9629":1,"9637":0,"9646":1,"9654":0,"9670":1,"9678":0,"9683":1,"9691":0,"9699":1,"9707":0,"9718":1,"9726":0,"9735":1,"9743":0,"9753":1,"9761":0,"9770":1,"9778":0,"9787":1,"9795":0,"9804":1,"9812":0,"9834":1,"9836":1,"9841":0,"9869":1,"9876":0,"9901":1,"9908":0,"9932":1,"9938":0,"9985":1,"9991":0,"9998":1,"10005":0,"10023":1,"10028":0,"10032":1,"10039":0,"10056":1,"10062":0,"10067":1,"10074":0,"10093":1,"10100":0,"10110":1,"10116":0,"10121":1,"10129":0,"10147":1,"10154":0,"10160":1,"10167":0,"10181":1,"10188":0,"10195":1,"10201":0,"10206":1,"10212":0,"10217":1,"10223":0,"10259":1,"10265":0,"10278":1,"10285":0,"10299":1,"10307":0,"10312":1,"10318":0,"10334":1,"10340":0,"10345":1,"10350":1,"10352":0,"10353":0,"10368":1,"10408":0,"10418":1,"10427":0,"10443":1,"10452":0,"10469":1,"10477":0,"10498":1,"10505":0,"10539":1,"10545":0}', - ), - uf = JSON.parse( - '{"111":1,"116":0,"219":1,"225":0,"240":1,"245":0,"272":1,"280":0,"301":1,"306":0,"330":1,"335":0,"353":1,"359":0,"381":1,"387":0,"399":1,"407":0,"419":1,"430":0,"480":1,"541":0,"709":1,"718":0,"765":1,"770":0,"806":1,"810":0,"822":1,"827":0,"841":1,"846":0,"862":1,"868":0,"900":1,"910":0,"927":1,"934":0,"957":1,"963":0,"978":1,"983":0,"1009":1,"1016":0,"1030":1,"1037":0,"1045":1,"1053":0,"1062":1,"1069":0,"1077":1,"1085":0,"1118":1,"1124":0,"1146":1,"1153":0,"1205":1,"1211":0,"1228":1,"1233":0,"1366":1,"1371":0,"1403":1,"1408":0,"1434":1,"1443":0,"1453":1,"1459":0,"1475":1,"1485":0,"1502":1,"1509":0,"1558":1,"1564":0,"1584":1,"1590":0,"1612":1,"1619":0,"1637":1,"1643":0,"1657":1,"1662":0,"1721":1,"1727":0,"1754":1,"1758":0,"1819":1,"1825":0,"1840":1,"1847":0,"1881":1,"1890":0,"1915":1,"1922":0,"1941":1,"1948":0,"2013":1,"2022":0,"2083":1,"2090":0,"2108":1,"2114":0,"2125":1,"2131":0,"2160":1,"2166":0,"2238":1,"2245":0,"2293":1,"2299":0,"2314":1,"2320":0,"2371":1,"2377":0,"2428":1,"2432":0,"2485":1,"2492":0,"2525":1,"2531":0,"2543":1,"2549":0,"2561":1,"2567":0,"2580":1,"2585":0,"2613":1,"2619":0,"2648":1,"2654":0,"2687":1,"2724":0,"2732":1,"2739":0,"2754":1,"2759":0,"2778":1,"2782":0,"2810":1,"2816":0,"2841":1,"2847":0,"2878":1,"2888":0,"2907":1,"2915":0,"2935":1,"2940":0,"2982":1,"2989":0,"3010":1,"3018":0,"3061":1,"3068":0,"3302":1,"3313":0,"3353":1,"3412":0,"3433":1,"3440":0,"3459":1,"3463":0,"3492":1,"3558":0,"3579":1,"3612":0,"3628":1,"3634":0,"3658":1,"3684":0,"3695":1,"3701":0,"3735":1,"3769":0,"3776":1,"3783":0,"3801":1,"3810":0,"3834":1,"3879":0,"3901":1,"3909":0,"3935":1,"3940":0,"3961":1,"3973":0,"3985":1,"3992":0,"4032":1,"4063":0,"4120":1,"4128":0,"4170":1,"4179":0,"4206":1,"4213":0,"4236":1,"4244":0,"4272":1,"4278":0,"4285":1,"4292":0,"4317":1,"4326":0,"4341":1,"4349":0,"4358":1,"4362":0,"4395":1,"4400":0,"4417":1,"4421":0,"4445":1,"4450":0,"4476":1,"4480":0,"4491":1,"4496":0,"4509":1,"4515":0,"4554":1,"4582":0,"4613":1,"4620":0,"4652":1,"4661":0,"4676":1,"4684":0,"4690":1,"4699":0,"4735":1,"4747":0,"4761":1,"4768":0,"4787":1,"4794":0,"4821":1,"4828":0,"4911":1,"4955":0,"5390":1,"5431":0,"5482":1,"5502":0,"5533":1,"5547":0,"5560":1,"5572":0,"5598":1,"5609":0,"5626":1,"5635":0,"5648":1,"5659":0,"5679":1,"5687":0,"5711":1,"5720":0,"5754":1,"5766":0,"5780":1,"5791":0,"5832":1,"5845":0,"5928":1,"5940":0,"5957":1,"5966":0,"5987":1,"6002":0,"6062":1,"6075":0,"6112":1,"6121":0,"6134":1,"6146":0,"6167":1,"6175":0,"6194":1,"6203":0,"6236":1,"6264":0,"6485":1,"6493":0,"6509":1,"6516":0,"6585":1,"6592":0,"6627":1,"6652":0,"6696":1,"6704":0,"6724":1,"6731":0,"6819":1,"6829":0,"6850":1,"6874":0,"6887":1,"6893":0,"6928":1,"6934":0,"6965":1,"6969":0,"6999":1,"7006":0,"7069":1,"7074":0,"7121":1,"7146":0,"7172":1,"7178":0,"7198":1,"7201":0,"7225":1,"7230":0,"7253":1,"7259":0,"7285":1,"7290":0,"7302":1,"7308":0,"7322":1,"7327":0,"7356":1,"7360":0,"7369":1,"7376":0,"7385":1,"7390":0,"7405":1,"7409":0,"7435":1,"7441":0,"7495":1,"7500":0,"7520":1,"7523":0,"7549":1,"7554":0,"7573":1,"7577":0,"7599":1,"7603":0,"7661":1,"7668":0,"7695":1,"7701":0,"7729":1,"7734":0,"7917":1,"7926":0,"7952":1,"7960":0,"7986":1,"7995":0,"8009":1,"8017":0,"8023":1,"8033":0,"8041":1,"8052":0,"8105":1,"8116":0,"8128":1,"8134":0,"8152":1,"8159":0,"8170":1,"8176":0,"8201":1,"8208":0,"8229":1,"8238":0,"8298":1,"8306":0,"8529":1,"8538":0,"8566":1,"8574":0,"8593":1,"8599":0,"8627":1,"8633":0,"8646":1,"8650":0,"8677":1,"8682":0,"8703":1,"8705":0,"8755":1,"8761":0,"8785":1,"8790":0,"8862":1,"8869":0,"8890":1,"8895":0,"8914":1,"8921":0,"8982":1,"8988":0,"9003":1,"9008":0,"9062":1,"9066":0,"9087":1,"9093":0,"9165":1,"9174":0,"9212":1,"9218":0,"9241":1,"9250":0,"9391":1,"9399":0,"9418":1,"9424":0,"9442":1,"9451":0,"9470":1,"9475":0,"9496":1,"9503":0,"9523":1,"9529":0,"9552":1,"9561":0,"9604":1,"9617":0,"9628":1,"9637":0,"9654":1,"9662":0,"9692":1,"9698":0,"9713":1,"9718":0,"9743":1,"9751":0,"9770":1,"9774":0,"9793":1,"9797":0,"9848":1,"9855":0,"9957":1,"9963":0,"9985":1,"9991":0,"10012":1,"10018":0,"10037":1,"10042":0,"10067":1,"10072":0,"10096":1,"10101":0,"10122":1,"10128":0,"10173":1,"10181":0,"10249":1,"10300":0,"10418":1,"10428":0,"10438":1,"10448":0,"10471":1,"10482":0,"10529":1,"10535":0,"10549":1,"10557":0,"10571":1,"10578":0,"10592":1,"10598":0,"10613":1,"10620":0,"10640":1,"10646":0,"10668":1,"10673":0,"10681":1,"10687":0,"10719":1,"10724":0,"10739":1,"10745":0,"10770":1,"10775":0,"10829":1,"10836":0,"10861":1,"10869":0,"10902":1,"10907":0,"10923":1,"10928":0,"10940":1,"10945":0,"10959":1,"10964":0,"10995":1,"11003":0,"11042":1,"11050":0,"11120":1,"11183":0,"11211":1,"11219":0,"11235":1,"11242":0,"11365":1,"11383":0,"11416":1,"11426":0,"11470":1}' - ), - faAuto = JSON.parse( - '{"110":1,"128":0,"140":1,"148":0,"184":1,"189":0,"195":1,"199":0,"214":1,"218":0,"232":1,"237":0,"264":1,"268":0,"281":1,"286":0,"312":1,"317":0,"335":1,"341":0,"368":1,"372":0,"380":1,"384":0,"397":1,"403":0,"425":1,"430":0,"435":1,"441":0,"492":1,"500":0,"517":1,"522":0,"541":1,"545":0,"562":1,"568":0,"592":1,"597":0,"631":1,"637":0,"686":1,"692":0,"700":1,"704":0,"726":1,"730":0,"738":1,"742":0,"794":1,"801":0,"833":1,"839":0,"940":1,"947":0,"964":1,"972":0,"1003":1,"1015":0,"1020":1,"1025":0,"1037":1,"1042":0,"1050":1,"1055":0,"1071":1,"1077":0,"1095":1,"1101":0,"1109":1,"1113":0,"1126":1,"1132":0,"1157":1,"1163":0,"1180":1,"1185":0,"1197":1,"1202":0,"1223":1,"1229":0,"1246":1,"1252":0,"1280":1,"1285":0,"1304":1,"1307":0,"1312":1,"1313":0,"1323":1,"1327":0,"1339":1,"1343":0,"1360":1,"1365":0,"1374":1,"1377":0,"1415":1,"1419":0,"1430":1,"1435":0,"1453":1,"1458":0,"1492":1,"1496":0,"1498":1,"1525":0,"1551":1,"1557":0,"1563":1,"1572":0,"1592":1,"1596":0,"1598":1,"1602":0,"1623":1,"1630":0,"1639":1,"1646":0,"1679":1,"1712":0,"1717":1,"1722":0,"1730":1,"1736":0,"1816":1,"1822":0,"1854":1,"1885":0,"1918":1,"1929":0,"1964":1,"1971":0,"1989":1,"1994":0,"2066":1,"2072":0,"2096":1,"2102":0,"2156":1,"2160":0,"2164":1,"2168":0,"2196":1,"2197":0,"2208":1,"2213":0,"2261":1,"2270":0,"2284":1,"2292":0,"2316":1,"2326":0,"2350":1,"2362":0,"2377":1,"2414":0,"2455":1,"2497":0,"2562":1,"2569":0,"2577":1,"2582":0,"2603":1,"2608":0,"2638":1,"2644":0,"2689":1,"2696":0,"2728":1,"2737":0,"2769":1,"2773":0,"2800":1,"2808":0,"2832":1,"2837":0,"2846":1,"2851":0,"2858":1,"2862":0,"2868":1,"2872":0,"2889":1,"2895":0,"2905":1,"2916":0,"2936":1,"2941":0,"2962":1,"2966":0,"3009":1,"3014":0,"3051":1,"3056":0,"3063":1,"3068":0,"3075":1,"3081":0,"3158":1,"3162":0,"3165":1,"3171":0,"3191":1,"3195":0,"3197":1,"3203":0,"3223":1,"3229":0,"3241":1,"3248":0,"3291":1,"3297":0,"3332":1,"3338":0,"3377":1,"3384":0,"3402":1,"3410":0,"3438":1,"3444":0,"3494":1,"3501":0,"3512":1,"3518":0,"3587":1,"3592":0,"3605":1,"3611":0,"3633":1,"3639":0,"3692":1,"3699":0,"3717":1,"3724":0,"3731":1,"3736":0,"3742":1,"3747":0,"3785":1,"3791":0,"3811":1,"3816":0,"3830":1,"3834":0,"3836":1,"3840":0,"3845":1,"3862":0,"3899":1,"3902":0,"3905":1,"3907":0,"3914":1,"3918":0,"3951":1,"3957":0,"3965":1,"3971":0,"4009":1,"4017":0,"4049":1,"4057":0,"4089":1,"4096":0,"4126":1,"4136":0,"4167":1,"4170":0,"4200":1,"4211":0,"4245":1,"4251":0,"4269":1,"4277":0,"4304":1,"4309":0,"4350":1,"4354":0,"4369":1,"4370":0,"4383":1,"4388":0,"4414":1,"4419":0,"4426":1,"4432":0,"4502":1,"4507":0,"4530":1,"4536":0,"4553":1,"4560":0,"4591":1,"4600":0,"4621":1,"4627":0,"4656":1,"4663":0,"4688":1,"4698":0,"4711":1,"4720":0,"4732":1,"4741":0,"4783":1,"4792":0,"4844":1,"4848":0,"4851":1,"4856":0,"4937":1,"4942":0,"4964":1,"4970":0,"5000":1,"5007":0,"5038":1,"5045":0,"5077":1,"5084":0,"5103":1,"5111":0,"5150":1,"5157":0,"5212":1,"5225":0,"5264":1,"5273":0}' - ), - getAutopilotInputs = function (e, t, a = 1) { - const i = (function (e, t) { - switch (e) { - case "Dragonfly": - return Ym; - case "Solar Wind": - return Um; - case "Indestructable": - return jm; - case "8 Bit Shuffle": - return Gm; - case "Think Different": - return Vm; - case "Solar Abyss": - return Hm; - case "Glitched Out": - return Xm; - case "Milky Ways": - return zm; - case "Critical Hit (Extended)": - return Wm; - case "Silverdust": - return qm; - case "Frontier": - return $m; - case "Theory Of Everything 3": - return Jm; - case "Accelerated": - return Km; - case "Sky Fracture": - return Qm; - case "Daydreamer": - return Zm; - case "True Colors": - return ef; - case "Color": - return tf; - case "Coincidence": - return af; - case "Mutant": - return nf; - case "Overdrive": - return sf; - case "Cloud 9": - return of; - case "Last Tile": - return rf; - case "Virtual": - return cf; - case "Nacreous Snowmelt": - return df; - case "Rum n' Bass": - return uf; - case "Funky Adventures": - return faAuto; - default: - return {}; - } - })(t, a), - n = (function (e) { - const t = Math.round(e), - a = e - t; - return Math.abs(a) < 0.1 ? t : null; - })(e); - if (null === n) return null; - const s = i[String(n)]; - return void 0 !== s ? Boolean(s) : null; - }, - pf = function (e, t) {}, - gf = function () {}, - mf = function (e) {}; - const ff = makeSprite({ - init({ getContext: e, device: t, props: a }) { - if ((t.audio("audio/levels/level-complete.wav").play(0), a.world && a.checkpoints.length == 0)) { - const { online: i, achievementUnlocked: n } = e(Se), - { world: s, collectibles: o, score: r } = a; - i - ? (function (e, t, a, i, n, s) { - return ( - (o = this), - (r = void 0), - (c = function* () { - const { levelFileName: o, isCheckpoints: r } = yf( - t, - i, - n, - ); - yield bp - .completedLevel(e, o, r, i, n) - .then(({ hasPass: e, achievements: t }) => { - t.forEach(({ justUnlocked: t, achievement: i }) => { - t && - s(() => { - a(i, e); - }, 2e3); - }); - }); - }), - new ((l = void 0) || (l = Promise))(function (e, t) { - function a(e) { - try { - n(c.next(e)); - } catch (e) { - t(e); - } - } - function i(e) { - try { - n(c.throw(e)); - } catch (e) { - t(e); - } - } - function n(t) { - var n; - t.done - ? e(t.value) - : ((n = t.value), - n instanceof l - ? n - : new l(function (e) { - e(n); - })).then(a, i); - } - n((c = c.apply(o, r || [])).next()); - }) - ); - var o, r, l, c; - })(i.backend, s, n, o, r, t.timer.start).catch(() => { - (t.alert.ok( - "Failed to save achievement online, will try again later", - ), - Jp.addOfflineRequests(t.storage, [yf(s, o, r)])); - }) - : Jp.addOfflineRequests(t.storage, [yf(s, o, r)]); - } - return { frame: 0, opacity: 0 }; - }, - loop({ state: e }) { - e.opacity >= 1 || (e.frame++, e.frame > 100 && (e.opacity += 0.1)); - }, - render({ props: e, getContext: t, state: a, device: i }) { - const { animationAssets: n, animationRenderer: s } = t(Ws); - return [ - _e.Single( - { - width: i.size.fullWidth, - height: i.size.fullHeight, - sprites: () => [], - onPress: () => null, - }, - (e) => { - ((e.width = i.size.fullWidth), - (e.height = i.size.fullHeight)); - }, - ), - Hs({ - id: "Spine", - animationAssets: n, - animationRenderer: s, - fileNames: Qs.spineFiles.levelComplete, - loop: false, - animationName: "animation", - paused: false, - x: 0, - y: 0, - height: 0, - df: 1, - }), - ifConditional( - () => 0 !== a.opacity, - () => [ - Lo.Single( - { - opacity: a.opacity, - sprites: [ - c({ - testId: "FinishLevel", - font: { size: 50 }, - text: localize(e.checkpoints.length > 0 ? "PRACTICE COMPLETE!" : "LEVEL COMPLETE!"), - strokeColor: e.checkpoints.length > 0 ? Ve : Ye, - color: ve, - strokeThickness: 16, - y: 120, - }), - e.score && e.prevHighScore - ? e.score > e.prevHighScore - ? Sf.Single({ - attempts: e.attempts, - score: e.score, - isHighScore: true, - }) - : If.Single({ - attempts: e.attempts, - score: e.score, - highScore: e.prevHighScore, - }) - : e.score - ? Sf.Single({ - attempts: e.attempts, - score: e.score, - isHighScore: false, - }) - : void 0 !== e.prevBestAttempts - ? bf.Single({ - attempts: e.attempts, - prevBestAttempts: e.prevBestAttempts, - }) - : Ef.Single({ attempts: e.attempts }), - Yo.Single({ - text: localize("CONTINUE"), - width: 120, - height: 60, - x: 190, - y: -120, - strokeColor: Ye, - onPress: e.onContinue, - }), - ], - }, - (e) => { - e.opacity = a.opacity; - }, - ), - ], - ), - ]; - }, - }); - function yf(e, t, a) { - return { - type: "completedLevel", - levelFileName: Hl.getWorld(e.number)[ - e.levelIndex - ].levelFileName.replace(/-/g, "_"), - isCheckpoints: e.withCheckpoints, - collectibles: t, - highScore: a, - }; - } - const Ef = makeSprite({ - render: ({ props: { attempts: e } }) => [ - qe({ width: 500, height: 100, fillColor: Ce }), - qe({ width: 480, height: 80, fillColor: ve }), - c({ - font: { size: 20 }, - text: localize("TOTAL ATTEMPTS") + ":", - color: Ye, - x: -90, - }), - c({ - font: { size: 40 }, - text: e.toLocaleString(), - strokeColor: Ye, - color: ve, - strokeThickness: 7, - x: 130, - }), - ], - }), - bf = makeSprite({ - render: ({ props: { attempts: e, prevBestAttempts: t } }) => [ - qe({ width: 500, height: 140, fillColor: Ce }), - qe({ width: 480, height: 120, fillColor: ve }), - c({ - font: { size: 20 }, - text: localize("TOTAL ATTEMPTS") + ":", - color: Ye, - x: -90, - y: 25, - }), - c({ - font: { size: 40 }, - text: e.toLocaleString(), - strokeColor: Ye, - color: ve, - strokeThickness: 7, - x: 130, - y: 25, - }), - ifConditional( - () => e < t, - () => [ - c({ - font: { size: 15 }, - text: localize("NEW RECORD!"), - color: Te, - strokeColor: Ye, - strokeThickness: 4, - y: -5, - }), - ], - ), - c({ - font: { size: 15 }, - text: `${localize( - "PREVIOUS BEST", - )}: ${t.toLocaleString()} ${localize("ATTEMPT")}${ - 1 === t ? "" : "S" - }`, - color: ve, - strokeColor: Ye, - strokeThickness: 4, - y: -25, - }), - ], - }), - Sf = makeSprite({ - render: ({ props: { attempts: e, score: t, isHighScore: a } }) => [ - qe({ width: 500, height: 140, fillColor: Ce }), - qe({ width: 480, height: 120, fillColor: ve }), - c({ - font: { size: 20 }, - text: localize("TOTAL ATTEMPTS") + ":", - color: Ye, - x: -90, - y: 25, - }), - c({ - font: { size: 40 }, - text: e.toLocaleString(), - strokeColor: Ye, - color: ve, - strokeThickness: 7, - x: 130, - y: 25, - }), - c({ - font: { size: 24 }, - text: `${localize(a ? "NEW HIGH SCORE" : "SCORE")}: ${t.toLocaleString()}`, - color: Te, - strokeColor: Ve, - strokeThickness: 4, - y: -20, - }), - ], - }), - If = makeSprite({ - render: ({ props: { attempts: e, score: t, highScore: a } }) => [ - qe({ width: 500, height: 160, fillColor: Ce }), - qe({ width: 480, height: 140, fillColor: ve }), - c({ - font: { size: 20 }, - text: localize("TOTAL ATTEMPTS") + ":", - color: Ye, - x: -90, - y: 30, - }), - c({ - font: { size: 40 }, - text: e.toLocaleString(), - strokeColor: Ye, - color: ve, - strokeThickness: 7, - x: 130, - y: 30, - }), - c({ - font: { size: 20 }, - text: `${localize("SCORE")}: ${t.toLocaleString()}`, - color: Te, - strokeColor: Ve, - strokeThickness: 4, - y: -10, - }), - c({ - font: { size: 18 }, - text: `${localize("HIGH SCORE")}: ${a.toLocaleString()}`, - color: Te, - strokeColor: Ve, - strokeThickness: 4, - y: -40, - }), - ], - }), - _f = (e) => { - if ("blocks" === e) - return { - fileName: "images/achievement/rewards/blocks.png", - width: 72, - height: 49, - }; - if (e.startsWith("missiles")) - return { - fileName: "images/achievement/rewards/missiles.png", - width: 72, - height: 49, - }; - if (e.startsWith("autopilot")) - return { - fileName: "images/achievement/rewards/autopilot.png", - width: 72, - height: 49, - }; - if (e.startsWith("slowmo")) - return { - fileName: "images/achievement/rewards/slowmo.png", - width: 72, - height: 49, - }; - if (e.startsWith("skin_")) { - const t = e.slice(5), - a = Wt.getSkin(t); - return { - fileName: `images/player/skins/${a.fileName}.png`, - width: a.size, - height: a.size, - }; - } - return e.startsWith("theme_") - ? { - fileName: "images/achievement/rewards/theme.png", - width: 72, - height: 49, - } - : e.startsWith("editor_") - ? { - fileName: "images/achievement/rewards/editor.png", - width: 72, - height: 49, - } - : { - fileName: "images/achievement/rewards/bonus.png", - width: 72, - height: 49, - }; - }; - const vf = makeSprite({ - init({ device: e, props: t, getState: a, getContext: i }) { - var n, s, o, r, l, c; - let d; - const { animationAssets: u } = i(Ws), - { settings: h } = i(Se), - p = Rf(e, h, t.level, a); - ((d = - t.startState && - xa.layoutConsistentWithState( - t.startState.layoutState, - t.level.layout, - ) - ? Object.assign( - Object.assign({}, tl(t.startState, t.level.boss)), + case "world2Red": + return [ + p( + { + color: "#722431", + width: t.size.fullWidth, + height: t.size.fullHeight, + }, + (e) => { + ((e.width = t.size.fullWidth), + (e.height = t.size.fullHeight)); + }, + ), + p( + { + color: "#C42B33", + width: t.size.fullWidth, + height: 402, + anchorY: -201, + y: -337.5, + }, + (e) => { + e.width = t.size.fullWidth; + }, + ), + dg.Single( + { + fileName: "images/themes/world2Red/BG_01.png", + playerX: 0.15 * e.cameraX, + playerY: 0.15 * e.cameraY, + height: 140, + y: 132.5, + }, + (t) => { + ((t.playerX = 0.15 * e.cameraX), + (t.playerY = 0.15 * e.cameraY)); + }, + ), + p( + { + color: "#F45921", + width: t.size.fullWidth, + height: 324, + anchorY: -162, + y: -337.5, + }, + (e) => { + e.width = t.size.fullWidth; + }, + ), + dg.Single( + { + fileName: "images/themes/world2Red/BG_02.png", + playerX: 0.2 * e.cameraX, + playerY: 0.2 * e.cameraY, + height: 153, + y: 60, + }, + (t) => { + ((t.playerX = 0.2 * e.cameraX), + (t.playerY = 0.2 * e.cameraY)); + }, + ), + p( + { + color: "#C42B33", + width: t.size.fullWidth, + height: 298, + anchorY: -149, + y: -337.5, + }, + (e) => { + e.width = t.size.fullWidth; + }, + ), + dg.Single( + { + fileName: "images/themes/world2Red/BG_03.png", + playerX: 0.25 * e.cameraX, + playerY: 0.25 * e.cameraY, + height: 159, + y: 36, + }, + (t) => { + ((t.playerX = 0.25 * e.cameraX), + (t.playerY = 0.25 * e.cameraY)); + }, + ), + p( + { + color: "#722431", + width: t.size.fullWidth, + height: 238, + anchorY: -119, + y: -337.5, + }, + (e) => { + e.width = t.size.fullWidth; + }, + ), + dg.Single( + { + fileName: "images/themes/world2Red/BG_04.png", + playerX: 0.3 * e.cameraX, + playerY: 0.3 * e.cameraY, + height: 168, + y: -19, + }, + (t) => { + ((t.playerX = 0.3 * e.cameraX), + (t.playerY = 0.3 * e.cameraY)); + }, + ), + p( + { + color: "#3D1D2E", + width: t.size.fullWidth, + height: 126, + anchorY: -63, + y: -337.5, + }, + (e) => { + e.width = t.size.fullWidth; + }, + ), + dg.Single( + { + fileName: "images/themes/world2Red/BG_05.png", + playerX: 0.35 * e.cameraX, + playerY: 0.35 * e.cameraY, + height: 253, + y: -88, + }, + (t) => { + ((t.playerX = 0.35 * e.cameraX), + (t.playerY = 0.35 * e.cameraY)); + }, + ), + basicBGcover(e, t), + ]; + case "world3": + case "virtual": + case "world3Red": + var bgTable = world3BgTable(); + const i = "world3Red" === e.theme.id, + v = false; //"virtual" === e.theme.id, + var n = + bgTable[e.bgColor] || (i ? "#a20e05" : "#40a5de"); + return [ + Go.Single( + { + targetOpacity: 1, + targetColor: + bgTable[e.bgColor] || + (i ? "#a20e05" : "#40a5de"), + sprite: (s, k) => [ + Hg.Single( + { isRed: i, isVirtual: v, bgColor: k.ref }, + (x) => { + x.bgColor = k.ref; + }, + ), + dg.Single( + { + fileName: + "images/themes/world3/background/cloud.png", + playerX: 0.01 * e.cameraX, + playerY: 0.01 * e.cameraY, + height: 356, + }, + (t) => { + ((t.playerX = 0.01 * e.cameraX), + (t.playerY = 0.01 * e.cameraY)); + }, + ), + dg.Single( + { + fileName: + "images/themes/world3/background/stars-moving.png", + playerX: 0.02 * e.cameraX, + playerY: 0.02 * e.cameraY, + height: 240, + }, + (t) => { + ((t.playerX = 0.02 * e.cameraX), + (t.playerY = 0.02 * e.cameraY)); + }, + ), + qg.Single({ paused: e.paused }, (x) => { + x.paused = e.paused; + }), + Xg.Single( + { isRed: i, isVirtual: v, bgColor: k.ref }, + (x) => { + x.bgColor = k.ref; + }, + ), + Ig.Single( + { + color: k.ref, + narrowLines: true, + opacity: 0.5, + thickness: 4, + playerX: 0.04 * e.cameraX, + offsetY: -100, + }, + (t) => { + t.playerX = 0.04 * e.cameraX; + t.color = k.ref; + }, + ), + Ig.Single( + { + color: k.ref, + narrowLines: true, + opacity: 0.5, + thickness: 4, + playerX: 0.04 * e.cameraX, + offsetY: -100, + scaleY: -1, + }, + (t) => { + t.playerX = 0.04 * e.cameraX; + t.color = k.ref; + }, + ), + ], + }, + (t) => { + t.targetOpacity = 1; + t.targetColor = + bgTable[e.bgColor] || + (i ? "#a20e05" : "#40a5de"); + }, + ), + + rg.Array({ + props: (j) => ({ + moveX: e.cameraX * Dg, + moveY: e.cameraY * Dg, + element: { + fileName: `images/themes/world3/background/${i ? "red" : "pink" + }-triangle.png`, + speed: Dg, + width: 252, + height: 279, + xRangeMin: 300, + xRangeMax: 600, + yMin: t.size.fullHeight / 4 + 170, + yMax: t.size.fullHeight / 2 + 80, + dontMoveY: true, + spinning: true, + }, + halfDeviceHeight: t.size.fullHeight / 2, + halfDeviceWidth: t.size.fullWidth / 2, + }), + update: (a) => { + ((a.moveX = e.cameraX * Dg), + (a.moveY = e.cameraY * Dg), + (a.halfDeviceHeight = t.size.fullHeight / 2), + (a.halfDeviceWidth = t.size.fullWidth / 2), + (a.element.yMin = + t.size.fullHeight / 4 + 170), + (a.element.yMax = + t.size.fullHeight / 2 + 80)); + }, + array: () => a, + key: (e, t) => t, + }), + Go.Single( + { + targetOpacity: (e.speedMultiplier - 1) / 10, + sprite: (e) => [ + p( + { + color: "#9D0808", + width: t.size.fullWidth, + height: t.size.fullHeight, + }, + (a) => { + ((a.opacity = e.ref), + (a.width = t.size.fullWidth), + (a.height = t.size.fullHeight)); + }, + ), + ], + }, + (t) => { + t.targetOpacity = Math.min( + 0.5, + (e.speedMultiplier - 1) / 10, + ); + }, + ), + Go.Single( + { + targetOpacity: (1 - e.speedMultiplier) / 10, + sprite: (e) => [ + p( + { + color: "#40a5de", + width: t.size.fullWidth, + height: t.size.fullHeight, + }, + (a) => { + ((a.opacity = e.ref), + (a.width = t.size.fullWidth), + (a.height = t.size.fullHeight)); + }, + ), + ], + }, + (t) => { + t.targetOpacity = Math.min( + 0.5, + (1 - e.speedMultiplier) / 10, + ); + }, + ), + ]; + case "synthwave": + return [ + y({ + fileName: + "images/themes/synthwave/background.png", + width: 950, + height: 383, + anchorY: 191, + y: 337, + }), + basicBGcover(e, t), + dg.Single( + { + fileName: + "images/themes/synthwave/mountains.png", + playerX: 0.04 * e.cameraX, + playerY: 0.04 * e.cameraY, + height: 259, + y: 56, + }, + (t) => { + ((t.playerX = 0.04 * e.cameraX), + (t.playerY = 0.04 * e.cameraY)); + }, + ), + zg.Single({}), + Ig.Single( + { + color: "#181d4c", + narrowLines: false, + playerX: 0.04 * e.cameraX, + thickness: 2, + offsetY: -65, + }, + (t) => { + t.playerX = 0.04 * e.cameraX; + t.color = "#181d4c"; + }, + ), + ]; + case "world4": + return [ + y({ + fileName: + "images/themes/world4/background/background.png", + width: 950, + height: 514, + y: 81, + }), + rg.Array({ + props: (e) => ({ + moveX: 0, + moveY: 0, + element: e, + halfDeviceHeight: t.size.fullHeight / 2, + halfDeviceWidth: t.size.fullWidth / 2, + }), + update: (a, i) => { + ((a.moveX = e.cameraX * i.speed), + (a.moveY = e.cameraY * i.speed), + (a.halfDeviceHeight = t.size.fullHeight / 2), + (a.halfDeviceWidth = t.size.fullWidth / 2)); + }, + array: () => a, + key: (e, t) => t, + }), + y({ + fileName: + "images/themes/world4/background/castle.png", + width: 950, + height: 274, + y: -40, + }), + dg.Single( + { + fileName: + "images/themes/world4/background/front-mountain2.png", + playerX: 0.04 * e.cameraX, + playerY: 0.04 * e.cameraY, + height: 233, + y: -180, + }, + (t) => { + ((t.playerX = 0.04 * e.cameraX), + (t.playerY = 0.04 * e.cameraY)); + }, + ), + dg.Single( + { + fileName: + "images/themes/world4/background/front-mountain1.png", + playerX: 0.1 * e.cameraX, + playerY: 0.1 * e.cameraY, + height: 602, + y: -36, + }, + (t) => { + ((t.playerX = 0.1 * e.cameraX), + (t.playerY = 0.1 * e.cameraY)); + }, + ), + basicBGcover(e, t), + ]; + case "world4Boss": + case "world4Red": { + const i = + "world4Boss" === e.theme.id ? "boss" : "red"; + return [ + y({ + fileName: `images/themes/world4/${i}/background.png`, + width: 950, + height: 541, + y: 67, + }), + rg.Array({ + props: (e) => ({ + moveX: 0, + moveY: 0, + element: e, + halfDeviceHeight: t.size.fullHeight / 2, + halfDeviceWidth: t.size.fullWidth / 2, + }), + update: (a, i) => { + ((a.moveX = e.cameraX * i.speed), + (a.moveY = e.cameraY * i.speed), + (a.halfDeviceHeight = t.size.fullHeight / 2), + (a.halfDeviceWidth = t.size.fullWidth / 2)); + }, + array: () => a, + key: (e, t) => t, + }), + y({ + fileName: `images/themes/world4/${i}/castle.png`, + width: 855, + height: 345, + y: -50, + }), + dg.Single( + { + fileName: `images/themes/world4/${i}/front-mountain2.png`, + playerX: 0.04 * e.cameraX, + playerY: 0.04 * e.cameraY, + height: 206, + y: -190, + }, + (t) => { + ((t.playerX = 0.04 * e.cameraX), + (t.playerY = 0.04 * e.cameraY)); + }, + ), + dg.Single( + { + fileName: `images/themes/world4/${i}/front-mountain1.png`, + playerX: 0.1 * e.cameraX, + playerY: 0.1 * e.cameraY, + height: 565, + y: -55, + }, + (t) => { + ((t.playerX = 0.1 * e.cameraX), + (t.playerY = 0.1 * e.cameraY)); + }, + ), + basicBGcover(e, t), + ]; + } + case "skater": + return [ + y({ + fileName: + "images/themes/skater/background/sky.png", + width: 950, + height: 205, + y: 235, + }), + dg.Single( + { + fileName: + "images/themes/skater/background/distant-buildings2.png", + playerX: 0.005 * e.cameraX, + playerY: 0.005 * e.cameraY, + height: 111, + y: 169, + }, + (t) => { + ((t.playerX = 0.005 * e.cameraX), + (t.playerY = 0.005 * e.cameraY)); + }, + ), + dg.Single( + { + fileName: + "images/themes/skater/background/distant-buildings.png", + playerX: 0.01 * e.cameraX, + playerY: 0.01 * e.cameraY, + height: 138, + y: 144, + }, + (t) => { + ((t.playerX = 0.01 * e.cameraX), + (t.playerY = 0.01 * e.cameraY)); + }, + ), + rg.Array({ + props: (e) => ({ + moveX: 0, + moveY: 0, + element: e, + halfDeviceHeight: t.size.fullHeight / 2, + halfDeviceWidth: t.size.fullWidth / 2, + }), + update: (a, i) => { + ((a.moveX = e.cameraX * i.speed), + (a.moveY = e.cameraY * i.speed), + (a.halfDeviceHeight = t.size.fullHeight / 2), + (a.halfDeviceWidth = t.size.fullWidth / 2)); + }, + array: () => a, + key: (e, t) => t, + }), + dg.Single( + { + fileName: + "images/themes/skater/background/hedges.png", + playerX: 0.02 * e.cameraX, + playerY: 0.02 * e.cameraY, + height: 74, + y: 100, + }, + (t) => { + ((t.playerX = 0.02 * e.cameraX), + (t.playerY = 0.02 * e.cameraY)); + }, + ), + dg.Single( + { + fileName: + "images/themes/skater/background/sky-buildings.png", + playerX: 0.05 * e.cameraX, + playerY: 0.05 * e.cameraY, + height: 300, + y: 183, + }, + (t) => { + ((t.playerX = 0.05 * e.cameraX), + (t.playerY = 0.05 * e.cameraY)); + }, + ), + dg.Single( + { + fileName: + "images/themes/skater/background/ground-buildings.png", + playerX: 0.1 * e.cameraX, + playerY: 0.1 * e.cameraY, + height: 515, + y: -80, + }, + (t) => { + ((t.playerX = 0.1 * e.cameraX), + (t.playerY = 0.1 * e.cameraY)); + }, + ), + basicBGcover(e, t), + ]; + case "arrows": + return [ + arrowTheme.Single( + { paused: false, bgColor: e.bgColor }, + (t) => { + t.paused = e.paused; + t.bgColor = e.bgColor; + }, + ), + ]; + case "dreamy": + return [ + p( + { + color: e.theme.colour, + width: t.size.fullWidth, + height: t.size.fullHeight, + }, + (j) => ( + (j.width = t.size.fullWidth), + (j.height = t.size.fullHeight) + ), + ), + dreamySprite( + { + id: "ShaderBg", + frame: e.frame, + bgSwitch: + e.switchBlockSpikes, + lesserSwitch: e.playerScale < 1 + }, + (t) => { + ((t.frame = e.frame), + (t.bgSwitch = + e.switchBlockSpikes), + (t.lesserSwitch = e.playerScale < 1)); + }, + ), + ]; + case "classic": + return [ + Go.Single( + { + targetOpacity: 1, + targetColor: e.bgColor || "#00FFFF", + sprite: (s, k) => [ + p( + { + color: k.ref, + width: t.size.fullWidth, + height: t.size.fullHeight, + opacity: 1, + }, + (j) => ( + (j.width = t.size.fullWidth), + (j.height = t.size.fullHeight), + (j.color = k.ref), + (j.opacity = 1) + ), + ), + ], + }, + (t) => { + t.targetOpacity = 1; + t.targetColor = e.bgColor || "#00FFFF"; + }, + ), + dg.Single( + { + fileName: + "images/themes/classic/background/fade.png", + playerX: 0, + playerY: 0, + height: t.size.fullHeight, + y: 50, + }, + (t) => { + ((t.playerX = 0), (t.playerY = 0)); + }, + ), + ]; + case "infinite": + let infiniteTileSprites = []; + return [ + Go.Single( + { + targetOpacity: 1, + targetColor: infiniteBgTable(0, e.bgColor), + sprite: (s, l) => [ + Go.Single( + { + targetOpacity: 1, + targetColor: infiniteBgTable( + 1, + e.bgColor, + ), + sprite: (s, d) => { + infiniteTileSprites = []; + infiniteTiles.map((tiles) => + tiles.map((tile) => + infiniteTileSprites.push( + tileSprite.Single( + { + color: d.ref, + width: 60, + height: 60, + playerX: + -0.05 * e.cameraX + tile[0], + playerY: + -0.05 * e.cameraY + tile[1], + }, + (t) => { + ((t.color = d.ref), + (t.playerX = + -0.05 * e.cameraX + + tile[0]), + (t.playerY = + -0.05 * e.cameraY + + tile[1])); + }, + ), + ), + ), + ); + return [ + p( + { + color: l.ref, + width: t.size.fullWidth, + height: t.size.fullHeight, + }, + (e) => { + ((e.width = t.size.fullWidth), + (e.height = t.size.fullHeight), + (e.color = l.ref)); + }, + ), + ...infiniteTileSprites, + ]; + }, + }, + (t) => { + t.targetOpacity = 1; + t.targetColor = + infiniteBgTable(1, e.bgColor) || + "#76d7d6"; + }, + ), + ], + }, + (t) => { + t.targetOpacity = 1; + t.targetColor = + infiniteBgTable(0, e.bgColor) || "#89dde1"; + }, + ), + ]; + case "fighter": + return [ + p( + { + color: "#0a0353", + width: t.size.fullWidth, + height: t.size.fullHeight, + }, + (e) => { + ((e.width = t.size.fullWidth), + (e.height = t.size.fullHeight)); + }, + ), + dg.Single( + { + fileName: + "images/themes/punch/background/BG_05.png", + playerX: 0.03 * e.cameraX, + playerY: 0.03 * e.cameraY, + height: 140, + y: 158, + }, + (t) => { + ((t.playerX = 0.03 * e.cameraX), + (t.playerY = 0.03 * e.cameraY)); + }, + ), + dg.Single( + { + fileName: + "images/themes/punch/background/BG_04.png", + playerX: 0.05 * e.cameraX, + playerY: 0.05 * e.cameraY, + height: 132, + y: 85, + }, + (t) => { + ((t.playerX = 0.05 * e.cameraX), + (t.playerY = 0.05 * e.cameraY)); + }, + ), + dg.Single( + { + fileName: + "images/themes/punch/background/BG_03.png", + playerX: 0.06 * e.cameraX, + playerY: 0.06 * e.cameraY, + height: 212, + y: 71, + }, + (t) => { + ((t.playerX = 0.06 * e.cameraX), + (t.playerY = 0.06 * e.cameraY)); + }, + ), + dg.Single( + { + fileName: + "images/themes/punch/background/BG_02.png", + playerX: 0.07 * e.cameraX, + playerY: 0.07 * e.cameraY, + height: 167, + y: 26, + }, + (t) => { + ((t.playerX = 0.07 * e.cameraX), + (t.playerY = 0.07 * e.cameraY)); + }, + ), + dg.Single( + { + fileName: + "images/themes/punch/background/BG_01.png", + playerX: 0.08 * e.cameraX, + playerY: 0.08 * e.cameraY, + height: 138, + y: -23, + }, + (t) => { + ((t.playerX = 0.08 * e.cameraX), + (t.playerY = 0.08 * e.cameraY)); + }, + ), + y({ + fileName: + "images/themes/punch/background/moon.png", + width: 77, + height: 77, + x: 200, + y: 120, + }), + rg.Array({ + props: (e) => ({ + moveX: 0, + moveY: 0, + element: e, + halfDeviceHeight: t.size.fullHeight / 2, + halfDeviceWidth: t.size.fullWidth / 2, + }), + update: (a, i) => { + ((a.moveX = e.cameraX * i.speed), + (a.moveY = e.cameraY * i.speed), + (a.halfDeviceHeight = t.size.fullHeight / 2), + (a.halfDeviceWidth = t.size.fullWidth / 2)); + }, + array: () => a, + key: (e, t) => t, + }), + dg.Single( + { + fileName: + "images/themes/punch/background/water.png", + playerX: 0 * e.cameraX, + playerY: 0 * e.cameraY, + height: 177, + y: -100, + }, + (t) => { + ((t.playerX = 0 * e.cameraX), + (t.playerY = 0 * e.cameraY)); + }, + ), + y({ + fileName: + "images/themes/punch/background/Building_01.png", + width: 213, + height: 178, + x: -200, + y: 20, + }), + dg.Single( + { + fileName: + "images/themes/punch/background/ground.png", + playerX: 0.03 * e.cameraX, + playerY: 0.03 * e.cameraY, + height: 370, + y: -165, + }, + (t) => { + ((t.playerX = 0.03 * e.cameraX), + (t.playerY = 0.03 * e.cameraY)); + }, + ), + ]; + case "speed": + return [ + p( + { + color: "#1B222D", + width: t.size.fullWidth, + height: t.size.fullHeight / 2, + y: t.size.fullHeight / 4, + }, + (e) => { + ((e.width = t.size.fullWidth), + (e.height = t.size.fullHeight / 2), + (e.y = t.size.fullHeight / 4)); + }, + ), + y({ + fileName: "images/themes/speed/moon.png", + width: 217, + height: 162, + y: 100, + }), + Go.Single( + { + targetOpacity: e.speedMultiplier / 5, + sprite: (e) => [ + y( + { + fileName: + "images/themes/speed/red_moon.png", + width: 217, + height: 162, + y: 100, + }, + (t) => { + t.opacity = e.ref; + }, + ), + ], + }, + (t) => { + t.targetOpacity = e.speedMultiplier / 5; + }, + ), + dg.Single( + { + fileName: "images/themes/speed/plan1.png", + playerX: 0.04 * e.cameraX, + playerY: 0.04 * e.cameraY, + height: 380, + y: -147.5, + }, + (t) => { + ((t.playerX = 0.04 * e.cameraX), + (t.playerY = 0.04 * e.cameraY)); + }, + ), + Go.Single( + { + targetOpacity: e.speedMultiplier / 10, + sprite: (e) => [ + p( + { + color: "#9D0808", + width: t.size.fullWidth, + height: t.size.fullHeight, + }, + (a) => { + ((a.opacity = e.ref), + (a.width = t.size.fullWidth), + (a.height = t.size.fullHeight)); + }, + ), + ], + }, + (t) => { + t.targetOpacity = Math.min( + 0.5, + e.speedMultiplier / 10, + ); + }, + ), + ]; + } + })(); + //*() + b.push( + Go.Single( { - checkpoint: Object.assign( - Object.assign({}, t.startState.checkpoint), - { state: tl(t.startState, t.level.boss) }, - ), - bossState: - (!(null === (n = t.level.boss) || void 0 === n - ? void 0 - : n.mutatesState) && - t.startState.bossState) || - (null === (s = t.level.boss) || void 0 === s - ? void 0 - : s.initState({ - assets: u, - checkpointState: t.startState, - playSound: p.playSound, - pauseSound: p.pauseSound, - })) || - null, + targetOpacity: e.flash, + sprite: (s) => [ + p( + { + color: "#FFFFFF", + width: t.size.fullWidth, + height: t.size.fullHeight, + }, + (a) => { + ((a.opacity = e.flash), + (a.width = t.size.fullWidth), + (a.height = t.size.fullHeight)); + }, + ), + ], }, - ) - : Zr( - t.level.layout, - t.level.boss, - u, - null, - p.playSound, - p.pauseSound, - )), - t.online || - e.audio(t.level.song.fileName).play({ - fromPosition: - (1 / 60) * d.frame + - t.level.songStartSecs + - h.headphonesDelay, - overwrite: true, - })); - const g = _r(t.level), - m = Ca.getInitFirstIndexes(), - f = Ca.getEmptyLayout(t.level.layout.properties), - y = xa.getInitState(f), - E = xa.getEmptyStateIndexes(); - return ( - Ca.setInViewLayoutAndState( - t.level.layout, - d.frame, - g.jumpFrames, - d.playerX, - d.playerY, - d.layoutState, - d.switchButtons.rot, - d.jumpSwitch.ratio, - d.switchBlockSpikes, - m, - f, - y, - E, - d.fallTypes, - ), - null === (o = t.didStart) || - void 0 === o || - o.call(t, d.checkpoint.index, false), - { - worker: Np(), - mutValues: { - levelState: d, - blockJumpUntilReleased: false, - landTimer: 0, - layoutFirstIndexes: m, - resetTimer: null, - checkpoints: [] - }, - bigMutValues: { - inViewLayout: f, - inViewLayoutState: y, - fullLayoutStateIndexes: E, - }, - paused: false, - pausedMusicDelay: 0, - playerInputIsDown: false, - hasStarted: !t.online, - tutorial: Qp( - (null === (r = t.world) || void 0 === r - ? void 0 - : r.tutorialType) || null, - (null === (l = t.world) || void 0 === l - ? void 0 - : l.showBoostersPrompt) || false, - ), - isAfkTimer: 600, - booster: null, - levelSpeeds: g, - df: 1, - powerupOut: null, - didAlertStorageError: false, - isFlyingLevel: - "flying" === - (null === (c = d.bossState) || void 0 === c - ? void 0 - : c.type), - sfx: p, - onReachedCheckpoint: (n, s, o) => { - var r; - const l = a(); - (null !== l.booster && - l.booster.frameStarted < - l.mutValues.levelState.frame - 180 && - !n && - (e - .audio(t.level.song.fileName) - .play({ overwrite: true, playbackRate: 1 }), - (l.booster = null), - (l.df = 1), - (l.mutValues.levelState.frame = Math.round( - l.mutValues.levelState.frame, - ))), - e.timer.start(() => { - Tf(t, l, e, i(Se).online, false, n, o); - }, 500), - mf(n), - null === (r = t.onReachedCheckpoint) || - void 0 === r || - r.call(t, n, l.mutValues.levelState.attempt, s)); - }, - onCrash: (n) => { - var s; - t.editor || e.audio(t.level.song.fileName).pause(); - const o = a(); - (e.timer.start(() => { - Tf(t, o, e, i(Se).online, true, false); - }, 500), - null === (s = t.didCrash) || - void 0 === s || - s.call( - t, - o.mutValues.levelState.frame, - n, - o.isAfkTimer <= 0, - ), - gf(), - null !== o.tutorial.boosterPrompt && - (o.tutorial.boosterPrompt = ((e, t, a) => - "waitingToShow" !== e - ? e - : t > 2e3 && a > 10 - ? "show" - : e)( - o.tutorial.boosterPrompt, - o.mutValues.levelState.frame, - o.mutValues.levelState.attempt, - ))); - }, - onReset: (n) => { - var s; - const o = a(); - (e.audio(t.level.song.fileName).play({ - fromPosition: - (1 / 60) * n + - t.level.songStartSecs + - i(Se).settings.headphonesDelay, - overwrite: true, - playbackRate: o.df, - }), - "autopilot" === - (null === (s = o.booster) || void 0 === s - ? void 0 - : s.booster.type) && - (o.booster.booster.playerInput = "up")); - }, - onOpenBooster: () => { - const e = a(); - null !== e.tutorial.boosterPrompt && - (e.tutorial.boosterPrompt = null); + (t) => { + t.targetOpacity = e.flash; + }, + ), + ); + return b; + }, + ), + ]; + return bg; + }, + }), + Pg = makeSprite({ + render({ props: e, device: t }) { + const a = (() => { + switch (e.theme.id) { + case "world1": + case "world1Boss": + return Yg(e.theme.id, e.cameraX); + default: + return []; + } + })(); + return [ + "arrows" === e.theme.id + ? Ho.Single( + { + x: e.playerX - e.cameraX, + y: et.initialPosition.y - e.cameraY, + playerYRelative: e.playerY - et.initialPosition.y, + isBlank: e.theme.objects.block == "blank", }, - pressedBooster: (i) => { - const n = a(); - ((n.df = - "slowmo" === i.type && null === n.booster ? 0.5 : 1), - n.mutValues.levelState.crashed || - e - .audio(t.level.song.fileName) - .play({ overwrite: true, playbackRate: n.df }), - null === n.booster - ? (n.booster = { - booster: i, - frameStarted: n.mutValues.levelState.frame, - }) - : (n.booster = null), - (n.mutValues.levelState.frame = Math.round( - n.mutValues.levelState.frame, - )), - (n.paused = false)); + (t) => { + ((t.x = e.playerX - e.cameraX), + (t.y = et.initialPosition.y - e.cameraY), + (t.playerYRelative = + e.playerY - et.initialPosition.y)); }, - } - ); - }, - loop({ - props: props, - state: t, - device: a, - getInputs: i, - getContext: n, - }) { - var s, o, r, l, c, d, u, h, p, g, m; - const f = i(), - { settings: y } = n(Se); - if ( - (null === - (o = - null === (s = props.online) || void 0 === s - ? void 0 - : s.loop) || - void 0 === o || - o.call(s, t.mutValues.levelState), - !t.hasStarted) - ) { - if ( - !(null === (r = props.online) || void 0 === r - ? void 0 - : r.start) ) - return; - ((t.hasStarted = true), - a.audio(props.level.song.fileName).play({ - fromPosition: props.level.songStartSecs + y.headphonesDelay, - overwrite: true, - })); - } - if (props.paused) - return void a.audio(props.level.song.fileName).pause(); - if (t.paused && !props.online) return; - const { level: E, editor: b, mockPlayerInput: S } = props, - { levelSpeeds: I, df: _ } = t, - { speed: v } = I; - (null !== t.tutorial.textState && - (t.tutorial.textState = ((e, t, a) => { - if (null === e || a) return e; - const i = Math.max(e.timer - 1, 0); - if ("init" === e.type) { - if ("tapToJump" === e.view && t > 200) - return Object.assign(Object.assign({}, e), { - view: "holdDown", - }); - if ("holdDown" === e.view && t > 370) - return Object.assign(Object.assign({}, e), { - view: "goodLuck", - timer: Kp, - }); - if ("goodLuck" === e.view && 0 === i) - return Object.assign(Object.assign({}, e), { - view: "end", - timer: Kp, - }); - } - if ("skateboard" === e.type) { - if ("crouch" === e.view && t > 80) - return Object.assign(Object.assign({}, e), { - view: "jump", - }); - if ("jump" === e.view && t > 180) - return Object.assign(Object.assign({}, e), { - view: "backflip", - timer: Kp, - }); - if ("backflip" === e.view && 0 === i) - return Object.assign(Object.assign({}, e), { - view: "end", - timer: Kp, - }); + : null, + ifConditional( + () => !e.plain, + () => { + switch (e.theme.id) { + case "world1": + case "world1Boss": + return [ + rg.Array({ + props: (e) => ({ + moveX: 0, + moveY: 0, + element: e, + halfDeviceHeight: t.size.fullHeight / 2, + halfDeviceWidth: t.size.fullWidth / 2, + }), + update: (a, i) => { + ((i.xRangeMax = + 1700 + e.cameraX / 1700 / i.speed), + (a.moveX = e.cameraX * i.speed), + (a.moveY = e.cameraY * i.speed), + (a.halfDeviceHeight = t.size.fullHeight / 2), + (a.halfDeviceWidth = t.size.fullWidth / 2)); + }, + array: () => a, + key: (e, t) => t, + }), + ]; + case "speed": + return [ + _g.Single( + { moveX: e.cameraX, paused: e.paused }, + (t) => { + ((t.moveX = e.cameraX), (t.paused = e.paused)); + }, + ), + ]; + default: + return []; } - return "end" === e.view && 0 === i - ? null - : Object.assign(Object.assign({}, e), { timer: i }); - })( - t.tutorial.textState, - t.mutValues.levelState.frame, - t.mutValues.levelState.crashed, - )), - t.isAfkTimer--); - const { - playerY: playerY, - playerGradY: R, - playerDir: O, - finishedLevel: finishedLevel, - bossState: w, - frame: A, - flyingAnchor, - } = t.mutValues.levelState; - if ( - b && - !t.mutValues.levelState.crashed && - !t.mutValues.levelState.finishedLevel - ) { - t.mutValues.levelState.frameCountSinceHistoryPush++; - const newFrameCountSinceHistoryPush = - 37.5 / Math.max(v, Math.abs(R)); - if ( - t.mutValues.levelState.frameCountSinceHistoryPush >= - newFrameCountSinceHistoryPush - ) { - t.mutValues.levelState.frameCountSinceHistoryPush = 0; - const e = tl( - t.mutValues.levelState, - props.level.boss || null, - ); - b.pushRunHistory(e); - } - } - (t.isFlyingLevel || - (t.mutValues.levelState.cameraY = hm( - playerY, - t.mutValues.levelState.cameraY, - finishedLevel, - flyingAnchor, - t.bigMutValues.inViewLayout.properties.useGround, - )), - (t.mutValues.levelState.cameraXOffset = pm( - t.mutValues.levelState.cameraXOffset, - O, - finishedLevel, - ))); - const isClassic = isSpecialTheme( - t.bigMutValues.inViewLayout.properties.theme.id, - ), - k = - be.pointInBox2( - (-a.size.fullWidth / 2 + (isClassic ? 35 : 50)) * - (n(Se).settings.mirrorMenuButton || - void 0 === props.backToMenu - ? -1 - : 1), - a.size.fullHeight / 2 - (isClassic ? 25 : 50), - 50, - isClassic ? 28 : 50, - f.pointer.x, - f.pointer.y, - ) || - (xm(t.tutorial.boosterPrompt, y.hideUi, props.world) && - be.pointInBox2( - (a.size.fullWidth / 2 - 80) * - (n(Se).settings.mirrorMenuButton ? -1 : 1), - a.size.fullHeight / 2 - 50, - Pm, - Mm, - f.pointer.x, - f.pointer.y, - )) || - (be.pointInBox2( - Mm / -2, - a.size.fullHeight / -2 + 40, - Pm, - Mm, - f.pointer.x, - f.pointer.y, - )) || (be.pointInBox2( - Pm / 2, - a.size.fullHeight / -2 + 40, - Mm, - Mm, - f.pointer.x, - f.pointer.y, - )), - N = Pl(w, A), - x = - ((f.pointer.pressed && !k) || - f.keysDown[" "] || - f.keysDown["w"] || - f.keysDown.ArrowUp || - "down" === S || - "justDown" === S) && - !finishedLevel && - !N, - P = x - ? f.pointer.justPressed || - f.keysJustPressed[" "] || - f.keysJustPressed["w"] || - f.keysJustPressed.ArrowUp || - "justDown" === S - ? "justDown" - : "down" - : "up"; - (x !== t.playerInputIsDown && - (null === (l = props.online) || - void 0 === l || - l.onInputChange(x), - (t.playerInputIsDown = x), - (t.isAfkTimer = 600)), - pf( - t.mutValues.levelState.frame, - "down" === P || "justDown" === P, - )); - let M = null; - if ( - "autopilot" === - (null === (c = t.booster) || void 0 === c - ? void 0 - : c.booster.type) - ) { - M = t.booster.booster.playerInput; - const e = getAutopilotInputs( - t.mutValues.levelState.frame, - E.name, - _, - ); - (null !== e - ? (M = e ? "justDown" : "up") - : "justDown" === M && (M = "down"), - (t.booster.booster.playerInput = M)); - } - let oldPowerupsLength = - t.mutValues.levelState.playerPowerups.filter( - (e) => e.item !== "playerStack", - ).length, - firstPowerup = t.mutValues.levelState.playerPowerups.filter( - (e) => e.item !== "playerStack", - )[0]; - if ( - ((null === (d = props.online) || void 0 === d - ? void 0 - : d.eliminated) && - !t.mutValues.levelState.crashed && - (t.mutValues.levelState.crashed = true), - dl({ - useBoosterDebug: y.showDebug, - mutValues: t.mutValues, - bigMutValues: t.bigMutValues, - booster: t.booster && t.booster.booster, - playerInput: M || P, - level: E, - levelSpeeds: I, - df: _, - animationAssets: n(Ws).animationAssets, - waitAtCheckpoint: - "royaleCheckpointKnockout" === - (null === - (h = - null === (u = props.online) || void 0 === u - ? void 0 - : u.mode) || void 0 === h - ? void 0 - : h.type) && - true === props.online.checkpointPlayerReached, - bottomLineTheme: E.layout.properties.theme.objects.bottom, - shouldResetOnCrash: - !b && - void 0 === S && - !(null === (p = props.online) || void 0 === p - ? void 0 - : p.eliminated), - sfx: t.sfx, - onReachedCheckpoint: t.onReachedCheckpoint, - onCrash: t.onCrash, - onReset: t.onReset, - disableReleaseBuffer: y.disableReleaseBuffer, - }), - oldPowerupsLength - - t.mutValues.levelState.playerPowerups.filter( - (e) => e.item !== "playerStack", - ).length > - 0 - ? t.powerupOut - ? ((t.powerupOut.powerup = firstPowerup), - (t.powerupOut.timer = 60)) - : (t.powerupOut = { - powerup: firstPowerup, - timer: 60, - }) - : t.powerupOut && - (t.powerupOut.timer > 0 - ? t.powerupOut.timer-- - : (t.powerupOut = null)), - null === (g = props.online) || - void 0 === g || - g.onPlayerMove( - t.mutValues.levelState.playerX, - t.mutValues.levelState.playerY, + }, + ), + ]; + }, + }); + function Mg(e, t, a) { + const i = t / a > e; + return { bgWidth: i ? t : a * e, bgHeight: i ? t / e : a }; + } + const Lg = 0.2, + Dg = 0.05, + Bg = 0.01, + Fg = (e, t) => [ + { + fileName: `images/themes/${t}/background/Blur02.png`, + speed: Bg, + width: 24, + height: 675, + xRangeMin: 1000, + xRangeMax: 1200, + yMin: 0, + yMax: 0, + dontMoveY: true, + opacity: 0.7, + }, + { + fileName: `images/themes/${t}/background/Dust.png`, + speed: Bg, + width: 500 / 3, + height: 883 / 3, + xRangeMin: 100, + xRangeMax: 200, + }, + { + fileName: `images/themes/${t}/background/Star01.png`, + speed: Bg, + width: 15, + height: 15, + xRangeMin: 100, + xRangeMax: 200, + }, + { + fileName: `images/themes/${t}/background/Star02.png`, + speed: Bg, + width: 76 / 3, + height: 64 / 3, + xRangeMin: 300, + xRangeMax: 400, + }, + { + fileName: `images/themes/${t}/background/Star03.png`, + speed: Bg, + width: 35 / 3, + height: 34 / 3, + xRangeMin: 500, + xRangeMax: 600, + }, + { + fileName: `images/themes/${t}/background/Flara01.png`, + speed: Bg, + width: 1453 / 3, + height: 1453 / 3, + xRangeMin: 1000, + xRangeMax: 1200, + }, + { + fileName: `images/themes/${t}/background/RectangleBG01.png`, + speed: Bg, + width: 635, + height: 71 / 3, + xRangeMin: 600, + xRangeMax: 800, + }, + { + fileName: `images/themes/${t}/background/RectangleBG04.png`, + speed: Bg, + width: 35, + height: 119, + xRangeMin: 400, + xRangeMax: 500, + }, + { + fileName: `images/themes/${t}/background/RectangleBG02.png`, + speed: Bg, + width: 1043 / 3, + height: 62 / 3, + xRangeMin: 600, + xRangeMax: 800, + opacity: 0.5, + }, + { + fileName: `images/themes/${t}/background/RectangleBG03.png`, + speed: Bg, + width: 194, + height: 17, + xRangeMin: 0, + xRangeMax: 100, + opacity: 0.7, + }, + { + fileName: `images/themes/${t}/background/Shape01.png`, + speed: Bg, + width: 58, + height: 576, + xRangeMin: 200, + xRangeMax: 300, + opacity: 0.7, + }, + { + fileName: `images/themes/${t}/background/Shape02.png`, + speed: Bg, + width: 87, + height: 489, + xRangeMin: 500, + xRangeMax: 700, + opacity: 0.5, + }, + { + fileName: `images/themes/${t}/background/Shape03.png`, + speed: Bg, + width: 71, + height: 212, + xRangeMin: 200, + xRangeMax: 300, + opacity: 0.5, + }, + { + fileName: `images/themes/${t}/background/Rectangle06.png`, + speed: Bg, + width: 132, + height: 1256 / 3, + xRangeMin: 800, + xRangeMax: 1000, + opacity: 0.5, + }, + { + fileName: `images/themes/${t}/background/RectangleLong.png`, + speed: Dg, + width: 658, + height: 352 / 3, + xRangeMin: 400, + xRangeMax: 500, + opacity: 0.7, + }, + { + fileName: `images/themes/${t}/background/Triangle01.png`, + speed: Dg, + width: 353 / 3, + height: 176 / 3, + xRangeMax: 1000, + xRangeMin: 800, + opacity: 0.7, + }, + { + fileName: `images/themes/${t}/background/Triangle02.png`, + speed: Dg, + yMin: 0.5 * e, + yMax: 0.9 * e, + width: 502 / 3, + height: 251 / 3, + xRangeMax: 1000, + xRangeMin: 800, + opacity: 0.7, + }, + { + fileName: `images/themes/${t}/background/Triangle03.png`, + speed: Dg, + width: 353 / 3, + height: 176 / 3, + xRangeMax: 1000, + xRangeMin: 800, + opacity: 0.7, + }, + { + fileName: `images/themes/${t}/background/Triangle04.png`, + speed: Dg, + width: 353 / 3, + height: 176 / 3, + xRangeMax: 600, + xRangeMin: 800, + opacity: 0.7, + }, + { + fileName: `images/themes/${t}/background/Triangle05.png`, + speed: Dg, + yMin: 0.5 * e, + yMax: 0.9 * e, + width: 502 / 3, + height: 251 / 3, + xRangeMax: 600, + xRangeMin: 800, + opacity: 0.7, + }, + { + fileName: `images/themes/${t}/background/Triangle06.png`, + speed: Dg, + width: 149 / 3, + height: 74 / 3, + xRangeMax: 1000, + xRangeMin: 800, + opacity: 0.7, + }, + { + fileName: `images/themes/${t}/background/Triangle07.png`, + speed: Dg, + width: 221 / 3, + height: 37, + xRangeMax: 1000, + xRangeMin: 800, + opacity: 0.7, + }, + { + fileName: `images/themes/${t}/background/Fence01.png`, + speed: Lg, + width: 1291 / 3, + height: 88 / 3, + xRangeMin: 700, + xRangeMax: 800, + }, + { + fileName: `images/themes/${t}/background/Fence02.png`, + speed: Lg, + width: 655 / 3, + height: 88 / 3, + xRangeMin: 700, + xRangeMax: 800, + }, + { + fileName: `images/themes/${t}/background/Fence03.png`, + speed: Lg, + width: 212, + height: 46 / 3, + xRangeMin: 700, + xRangeMax: 800, + }, + { + fileName: `images/themes/${t}/background/Fence04.png`, + speed: Lg, + width: 47, + height: 43 / 3, + xRangeMin: 700, + xRangeMax: 800, + }, + { + fileName: `images/themes/${t}/background/Blur01.png`, + speed: Bg, + width: 321, + height: 526, + xRangeMin: 400, + xRangeMax: 800, + yMin: 0.5 * e, + yMax: 0.9 * e, + }, + ], + Yg = (e, t) => [ + { + fileName: `images/themes/${e}/background/Triangle06.png`, + speed: 2, + width: 149 / 3, + height: 74 / 3, + xRangeMin: 1000, + xRangeMax: 1700 * t, + opacity: "world1Boss" === e ? 0.4 : 0.7, + }, + { + fileName: `images/themes/${e}/background/Triangle07.png`, + speed: 2, + width: 221 / 3, + height: 37, + xRangeMin: 1000, + xRangeMax: 1700 * t, + opacity: "world1Boss" === e ? 0.4 : 0.7, + }, + ], + Ug = [ + { + speed: 0.1, + fileName: "images/themes/red/background/background-red-dots.png", + width: 839.5, + height: 469.5, + xRangeMin: 500, + xRangeMax: 600, + }, + { + speed: 0.15, + fileName: + "images/themes/red/background/background-red-flame1.png", + width: 732, + height: 904, + xRangeMin: 500, + xRangeMax: 600, + }, + { + speed: 0.2, + fileName: + "images/themes/red/background/background-red-flame2.png", + width: 808, + height: 1080, + xRangeMin: 500, + xRangeMax: 600, + }, + ], + jg = [ + { + fileName: "images/themes/skater/background/cloud1.png", + speed: 0.03, + width: 220, + height: 42, + xRangeMin: 1000, + xRangeMax: 1000, + initXOffset: 1, + yMin: 240, + yMax: 300, + alternateY: false, + dontMoveY: true, + }, + { + fileName: "images/themes/skater/background/cloud2.png", + speed: 0.03, + width: 242, + height: 47, + xRangeMin: 1000, + xRangeMax: 1000, + initXOffset: 500, + yMin: 240, + yMax: 300, + alternateY: false, + dontMoveY: true, + }, + ], + Gg = [ + { + fileName: "images/themes/punch/background/cloud_01.png", + speed: 0.1, + width: 65, + height: 23, + xRangeMin: 100, + xRangeMax: 500, + initXOffset: 1, + yMin: 50, + yMax: 200, + alternateY: false, + dontMoveY: true, + }, + { + fileName: "images/themes/punch/background/cloud_02.png", + speed: 0.1, + width: 115, + height: 27, + xRangeMin: 100, + xRangeMax: 500, + initXOffset: 500, + yMin: 50, + yMax: 200, + alternateY: false, + dontMoveY: true, + }, + { + fileName: "images/themes/punch/background/cloud_03.png", + speed: 0.1, + width: 122, + height: 38, + xRangeMin: 100, + xRangeMax: 500, + initXOffset: 250, + yMin: 50, + yMax: 200, + alternateY: false, + dontMoveY: true, + }, + { + fileName: "images/themes/punch/background/cloud_04.png", + speed: 0.1, + width: 260, + height: 48, + xRangeMin: 100, + xRangeMax: 500, + initXOffset: 800, + yMin: 50, + yMax: 200, + alternateY: false, + dontMoveY: true, + }, + ], + Vg = (e, t) => { + const a = + "world4" === t + ? "background" + : "world4Red" === t + ? "red" + : "boss"; + return [ + { + fileName: `images/themes/world4/${a}/cloud1.png`, + speed: Bg, + width: 209, + height: 64, + xRangeMin: 600, + xRangeMax: 600, + initXOffset: 1, + yMin: 150, + yMax: 0.5 * e - 30, + alternateY: false, + dontMoveY: true, + }, + { + fileName: `images/themes/world4/${a}/cloud2.png`, + speed: Bg, + width: 193, + height: 67, + xRangeMin: 600, + xRangeMax: 600, + initXOffset: 300, + yMin: 0.5 * e + 30, + yMax: e - 60, + alternateY: false, + dontMoveY: true, + }, + ]; + }, + world3BgTable = function () { + return { + "#FF0000": "#a20e06", + "#ffea00": "#ebdc0c", + "#00FF00": "#65de40", + "#0000ff": "#2538e0", + "#8000ff": "#9f40de", + "#ff00ff": "#de40d1", + "#ffFFff": "#FFFFFF", + "#000000": "#000000", + }; + }, + Hg = makeSprite({ + render({ props: e, device: t }) { + const darker = (col, amt) => { + var num = parseInt(col.substring(1), 16); + var r = (num >> 16) / amt; + var b = ((num >> 8) & 0x00ff) / amt; + var g = (num & 0x0000ff) / amt; + var newColor = g | (b << 8) | (r << 16); + return "#" + newColor.toString(16); + }; + let bgColor = + e.bgColor == "#40a5de" || e.bgColor == "#a20e05" + ? undefined + : e.bgColor; + function calcColors(clr) { + return clr + ? [ + clr, + darker(clr, 4), + darker(clr, 6), + darker(clr, 6), + darker(clr, 4), + clr, + ] + : e.isRed + ? [ + "#840901", + "#260402", + "#170302", + "#170302", + "#260402", + "#840901", + ] + : [ + "#7D00EB", + "#210089", + "#050522", + "#050522", + "#050522", + "#050522", + "#210089", + "#7D00EB", + ]; + } + const a = { + type: "linearVert", + height: t.size.fullHeight, + colors: calcColors(bgColor), + }; + return [ + p( + { + color: { + type: "linearVert", + height: t.size.fullHeight, + colors: calcColors(bgColor), + }, + gradient: a, + width: t.size.fullWidth, + height: t.size.fullHeight, + }, + (a) => { + ((a.width = t.size.fullWidth), + (a.height = t.size.fullHeight), + (a.gradient = { + type: "linearVert", + height: t.size.fullHeight, + colors: calcColors( + e.bgColor == "#40a5de" || e.bgColor == "#a20e05" + ? undefined + : e.bgColor, + ), + })); // this might be a bad idea... + }, + ), + y({ + fileName: "images/themes/world3/background/stars-static.png", + width: 950, + height: 512, + }), + ]; + }, + }), + Xg = makeSprite({ + render({ props: props, device: t }) { + var a = props.isRed ? "#a20e05" : "#40a5de", + i = props.isRed ? 0.7 : 0.5; + return [ + ...Array.from({ length: 15 }).flatMap((e, n) => { + const s = 2 * Math.pow(n, 1.8); + return [ + m( + { + color: props.bgColor || a, + opacity: i, + path: [ + [-t.size.fullWidth / 2, 0], + [t.size.fullWidth / 2, 0], + ], + y: -s - 100, + thickness: 0.1 + s / 40, + }, + (t) => { + t.color = props.bgColor || a; + }, ), - null === (m = props.online) || void 0 === m - ? void 0 - : m.serverPlayerPos) - ) { - const a = props.online.serverPlayerPos; - (props.online.didResync(), - Ca.setInViewLayoutAndState( - E.layout, - a.mutValues.levelState.frame, - I.jumpFrames, - a.mutValues.levelState.playerX, - a.mutValues.levelState.playerY, - a.mutValues.levelState.layoutState, - a.mutValues.levelState.switchButtons.rot, - a.mutValues.levelState.jumpSwitch.ratio, - a.mutValues.levelState.switchBlockSpikes, - a.mutValues.layoutFirstIndexes, - t.bigMutValues.inViewLayout, - t.bigMutValues.inViewLayoutState, - t.bigMutValues.fullLayoutStateIndexes, - a.mutValues.levelState.fallTypes, + m( + { + color: props.bgColor || a, + opacity: i, + path: [ + [-t.size.fullWidth / 2, 0], + [t.size.fullWidth / 2, 0], + ], + y: s + 100, + thickness: 0.1 + s / 40, + }, + (t) => { + t.color = props.bgColor || a; + }, ), - (t.mutValues = a.mutValues), - (t.playerInputIsDown = - "down" === a.playerInput || "justDown" === a.playerInput)); + ]; + }), + ]; + }, + }), + zg = makeSprite({ + render: ({ device: e }) => [ + p( + { + color: "#000002", + width: e.size.fullWidth, + height: e.size.fullHeight / 2, + anchorY: e.size.fullHeight / 4, + y: -65, + }, + (t) => { + ((t.width = e.size.fullWidth), + (t.height = e.size.fullHeight / 2), + (t.anchorY = e.size.fullHeight / 4)); + }, + ), + onChange( + () => e.size.fullWidth, + () => [ + ...Array.from({ length: 10 }).flatMap((t, a) => { + const i = 0 === a ? 0 : 3 * Math.pow(a, 2) + 3; + return [ + m({ + color: "#181d4c", + path: [ + [-e.size.fullWidth / 2, 0], + [e.size.fullWidth / 2, 0], + ], + y: -i - 65, + thickness: 1 + i / 60, + }), + ]; + }), + ], + ), + ], + }), + Wg = (e) => { + const t = Math.round(700 * e() - 350), + a = Math.round(300 * e() - 150); + return { + startX: t, + startY: a, + x: t, + y: a, + speed: 2 + 2 * e(), + life: 30 + 30 * e(), + thickness: 1 + 2 * e(), + }; + }, + qg = makeSprite({ + init: ({ device: e }) => ({ + stars: [Wg(e.random)], + newStarTimer: 60, + }), + loop({ state: e, device: t, props: a }) { + if (!a.paused) { + (e.newStarTimer--, + e.newStarTimer <= 0 && + ((e.newStarTimer += 60 * t.random()), + e.stars.push(Wg(t.random)))); + for (const t of e.stars) + ((t.x -= 0.65 * t.speed), + (t.y -= 0.75 * t.speed), + t.life--, + (t.thickness *= 0.99)); + lt(e.stars, (e) => e.life > 0); + } + }, + render: ({ state: e }) => [ + $g.Array({ + props: (e) => { + const t = e.startX - e.x; + return { + width: t, + anchorXVal: t / 2, + xVal: e.startX, + height: e.thickness, + rotation: -40, + opacity: e.life / 120, + color: "", + gradient: { + type: "linearHoriz", + width: t, + colors: ["#838493", "#838493"], + opacities: [1, 0], + }, + }; + }, + update: (e, t) => { + ((e.width = t.startX - t.x), + (e.anchorXVal = e.width / 2), + (e.gradient.width = e.width), + (e.xVal = t.startX), + (e.height = t.thickness), + (e.opacity = t.life / 120)); + }, + array: () => e.stars, + key: (e, t) => t, + }), + ], + }), + $g = makeSprite({ + render: ({ props: e }) => [ + p({ height: e.height }, (t) => { + ((t.width = e.width), + (t.gradient = e.gradient), + (t.anchorX = e.anchorXVal), + (t.x = e.xVal)); + }), + ], + }), + Jg = { left: 0, up: 90, right: 180, down: 270 }, + Kg = makeSprite({ + init: () => ({ player2X: 0, player2Y: 0 }), + loop({ + props: { playerX: e, playerY: t, touchingPortals: a }, + state: i, + }) { + const [n, s] = a; + ((i.player2X = s.x - n.x), (i.player2Y = s.y - n.y)); + const o = "left" === n.direction || "right" === n.direction, + r = "left" === s.direction || "right" === s.direction; + if (n.direction === s.direction) + if (o) { + const t = s.x - (e + i.player2X); + i.player2X += 2 * t; + } else { + const e = s.y - (t + i.player2Y); + i.player2Y += 2 * e; } - }, - render({ props: e, state: t, device: a, getContext: i }) { - var n, s, o, r; - return [ - cm.Single( - { - frame: t.mutValues.levelState.frame, - df: t.df, - attempt: t.mutValues.levelState.attempt, - playerX: t.mutValues.levelState.playerX, - playerY: t.mutValues.levelState.playerY, - playerGradY: t.mutValues.levelState.playerGradY, - playerRot: t.mutValues.levelState.playerRot, - playerDir: t.mutValues.levelState.playerDir, - playerScaleX: t.mutValues.levelState.playerScaleX, - playerScaleY: t.mutValues.levelState.playerScaleY, - playerScale: t.mutValues.levelState.playerScale, - playerPowerups: t.mutValues.levelState.playerPowerups, - isCompatible: t.mutValues.levelState.isCompatible, - playerPowerupOut: - (null === (n = t.powerupOut) || void 0 === n - ? void 0 - : n.powerup) || null, - playerJetpackFuel: t.mutValues.levelState.playerJetpackFuel, - playerUsingPowerup: - t.mutValues.levelState.playerUsingPowerup, - playerStacks: t.mutValues.levelState.playerStacks, - playerStackIndex: t.mutValues.levelState.playerStackIndex, - playerBullets: t.mutValues.levelState.playerBullets, - playerSkin: e.playerSkin, - playerJumping: t.mutValues.levelState.jumping, - playerSpeedMultiplier: - t.mutValues.levelState.playerSpeedMultiplier, - explosions: t.mutValues.levelState.explosions, - collectibles: t.mutValues.levelState.collectibles, - score: t.mutValues.levelState.score, - highScore: - (null === (s = e.world) || void 0 === s - ? void 0 - : s.highScore) || 0, - collectiblesTotal: e.level.layout.collectibles.filter( - (x) => x.form == "coin", - ).length, - touchingPortals: t.mutValues.levelState.touchingPortals, - justHitObject: t.mutValues.levelState.justHitObject, - bossState: t.mutValues.levelState.bossState, - switchRotation: t.mutValues.levelState.switchButtons.rot, - switchBlockSpikes: t.mutValues.levelState.switchBlockSpikes, - layout: t.bigMutValues.inViewLayout, - crashed: t.mutValues.levelState.crashed, - paused: t.paused || t.mutValues.levelState.finishedLevel, - finishedLevel: t.mutValues.levelState.finishedLevel, - isFlyingLevel: t.isFlyingLevel, - started: - false !== - (null === (o = e.online) || void 0 === o - ? void 0 - : o.start), - bottomLineObjects: - (null === (r = t.mutValues.levelState.bottomLine) || - void 0 === r - ? void 0 - : r.objects) || null, - layoutState: t.bigMutValues.inViewLayoutState, - layoutStateIndex: t.bigMutValues.fullLayoutStateIndexes, - landTimer: t.mutValues.landTimer, - jumpFrames: t.levelSpeeds.jumpFrames, - hasCheckpoints: e.hasCheckpoints, - maxFrame: e.maxFrame, - cameraX: 0, - cameraY: 0, - showAttempts: void 0 === e.editor, - playerName: "YOU", - tutorial: t.tutorial, - hidePlayer: Ll( - t.mutValues.levelState.bossState, - t.mutValues.levelState.frame, - t.mutValues.levelState.crashed, + if (o !== r) { + const a = Jg[n.direction], + o = Jg[s.direction], + l = em(o - a), + c = e + i.player2X - s.x, + d = -(t + i.player2Y - s.y) * l, + u = c * l; + ((i.player2X = s.x - e + d), + (i.player2Y = s.y - t + u), + r || (i.player2X = s.x - e)); + } + }, + render: ({ props: e, state: t }) => [ + Qg.Single( + { + playerRot: e.playerRot, + playerScaleX: e.playerScaleX, + playerScaleY: e.playerScaleY, + playerDir: e.playerDir, + skin: e.skin, + landTimer: e.landTimer, + onSkateboard: e.onSkateboard, + playerScale: e.isCompatible ? 1 : e.playerScale, + isFlying: e.isFlying, + }, + (t) => { + ((t.playerRot = e.playerRot), + (t.playerScaleX = e.playerScaleX), + (t.playerScaleY = e.playerScaleY), + (t.playerScale = e.isCompatible ? 1 : e.playerScale), + (t.playerDir = e.playerDir), + (t.skin = e.skin), + (t.landTimer = e.landTimer), + (t.isInfinite = e.isInfinite), + (t.bgColor = e.bgColor), + (t.onSkateboard = e.onSkateboard), + (t.mask = circleMask( + Zg(e.touchingPortals[0], e.playerX, e.playerY), + ))); + }, + ), + Qg.Single( + { + playerRot: e.playerRot, + playerScaleX: e.playerScaleX, + playerScaleY: e.playerScaleY, + playerDir: e.playerDir, + skin: e.skin, + landTimer: e.landTimer, + onSkateboard: e.onSkateboard, + playerScale: e.isCompatible ? 1 : e.playerScale, + isFlying: e.isFlying, + }, + (a) => { + ((a.x = t.player2X), + (a.y = t.player2Y), + (a.playerRot = e.playerRot), + (a.playerScaleX = e.playerScaleX), + (a.playerScaleY = e.playerScaleY), + (a.playerScale = e.isCompatible ? 1 : e.playerScale), + (a.playerDir = e.playerDir), + (a.skin = e.skin), + (a.landTimer = e.landTimer), + (a.onSkateboard = e.onSkateboard), + (t.isInfinite = e.isInfinite), + (t.bgColor = e.bgColor), + (a.mask = circleMask( + Zg( + e.touchingPortals[1], + e.playerX + t.player2X, + e.playerY + t.player2Y, ), - fadeOutAttempts: Ml(t.mutValues.levelState.bossState), - bgColor: t.mutValues.levelState.bgColor, - flash: t.flash, - gravity: t.gravity, - dashing: t.dashing, - isGravity: t.isGravity, - fallTypes: t.mutValues.levelState.fallTypes, - flyingAnchor: t.mutValues.levelState.flyingAnchor, - justDownInputTimer: - t.mutValues.levelState.justDownInputTimer, - jumping: t.mutValues.levelState.jumping, - levelSpeeds: t.levelSpeeds, - checkpoints: t.mutValues.checkpoints + ))); + }, + ), + ], + }), + Qg = makeSprite({ + render: ({ props: e }) => [ + e.isFlying + ? y( + { + fileName: "images/level/boss3/player-ship.png", + width: 40, + height: 30, + }, + (t) => { + ((t.rotation = e.playerRot), + (t.scaleX = e.playerScaleX * e.playerDir), + (t.scaleY = e.playerScaleY)); + }, + ) + : To.Single( + { + skin: e.skin, + landTimer: e.landTimer, + onSkateboard: e.onSkateboard, + }, + (t) => { + ((t.rotation = e.playerRot), + (t.scaleX = e.playerScaleX * e.playerDir), + (t.scaleY = e.playerScaleY), + (t.skin = e.skin), + (t.landTimer = e.landTimer), + (t.isInfinite = e.isInfinite), + (t.bgColor = e.bgColor), + (t.onSkateboard = e.onSkateboard)); + }, + ), + ], + }), + Zg = (e, t, a) => { + const i = 150 - e.width / 2; + switch (e.direction) { + case "left": + case "right": + return { + x: ("left" === e.direction ? -1 : 1) * i + e.x - t, + y: e.y - a, + radius: 150, + }; + case "up": + case "down": + const n = ("down" === e.direction ? -1 : 1) * i; + return { x: e.x - t, y: n + e.y - a, radius: 150 }; + } + }, + em = (e) => (B.isEven((e + 90) / 180) ? -1 : 1), + tm = makeSprite({ + render: ({ props: e }) => [ + y( + { + fileName: `images/themes/${e.theme}/bottom/${e.object.type}.png`, + width: e.object.width, + height: e.object.height, + }, + (t) => { + ((t.x = e.object.x), (t.y = e.object.y)); + }, + ), + ], + }), + am = makeSprite({ + init: ({ props: e }) => ({ + fade: 0, + jumpOut: 0, + prevLocalScore: e.localScore, + prevMultiplier: e.multiplier, + }), + loop({ state: e, props: t }) { + t.localScore > 0 && !t.crashed + ? ((e.prevLocalScore = t.localScore), + (e.prevMultiplier = t.multiplier), + (e.fade = 10), + (e.jumpOut = 30)) + : e.jumpOut > 0 && !t.crashed + ? e.jumpOut-- + : e.fade > 0 && e.fade--; + }, + render: ({ state: e, props: t, device: a }) => [ + ifConditional( + () => t.highScore > 0, + () => [ + c( + { + text: `${localize("HIGH SCORE")}: ${t.highScore.toLocaleString()}`, + color: Te, + strokeColor: He, + strokeThickness: 4, + font: { size: 15, align: "left" }, + x: -a.size.fullWidth / 2 + 100, + y: a.size.fullHeight / 2 - 40, }, - - (a) => { - var i, n, s, o, r; - ( - (a.checkpoints = t.mutValues.checkpoints), - (a.justDownInputTimer = - t.mutValues.levelState.justDownInputTimer), - (a.levelSpeeds = t.levelSpeeds), - (a.boosterDebug = t.mutValues.levelState.boosterDebug), - (a.jumping = t.mutValues.levelState.jumping), - (a.isGravity = t.mutValues.levelState.isGravity), - (a.flyingAnchor = t.mutValues.levelState.flyingAnchor), - (a.dashing = t.mutValues.levelState.dashing), - (a.frame = t.mutValues.levelState.frame), - (a.fallTypes = t.mutValues.levelState.fallTypes), - (a.df = t.df), - (a.attempt = t.mutValues.levelState.attempt), - (a.playerX = t.mutValues.levelState.playerX), - (a.playerY = t.mutValues.levelState.playerY), - (a.playerGradY = t.mutValues.levelState.playerGradY), - (a.playerRot = t.mutValues.levelState.playerRot), - (a.playerDir = t.mutValues.levelState.playerDir), - (a.playerScaleX = t.mutValues.levelState.playerScaleX), - (a.playerScaleY = t.mutValues.levelState.playerScaleY), - (a.playerScale = t.mutValues.levelState.playerScale), - (a.playerPowerups = - t.mutValues.levelState.playerPowerups), - (a.isCompatible = t.mutValues.levelState.isCompatible), - (a.playerPowerupOut = - (null === (i = t.powerupOut) || void 0 === i - ? void 0 - : i.powerup) || null), - (a.playerJetpackFuel = - t.mutValues.levelState.playerJetpackFuel), - (a.playerUsingPowerup = - t.mutValues.levelState.playerUsingPowerup), - (a.playerStacks = t.mutValues.levelState.playerStacks), - (a.playerStackIndex = - t.mutValues.levelState.playerStackIndex), - (a.playerBullets = t.mutValues.levelState.playerBullets), - (a.playerSkin = e.playerSkin), - (a.playerJumping = t.mutValues.levelState.jumping), - (a.playerSpeedMultiplier = - t.mutValues.levelState.playerSpeedMultiplier), - (a.explosions = t.mutValues.levelState.explosions), - (a.collectibles = t.mutValues.levelState.collectibles), - (a.score = t.mutValues.levelState.score), - (a.highScore = - (null === (n = e.world) || void 0 === n - ? void 0 - : n.highScore) || 0), - (a.collectiblesTotal = e.level.layout.collectibles.filter( - (x) => x.form == "coin", - ).length), - (a.touchingPortals = - t.mutValues.levelState.touchingPortals), - (a.justHitObject = t.mutValues.levelState.justHitObject), - (a.bossState = t.mutValues.levelState.bossState), - (a.switchRotation = - t.mutValues.levelState.switchButtons.rot), - (a.switchBlockSpikes = - t.mutValues.levelState.switchBlockSpikes), - (a.layout = t.bigMutValues.inViewLayout), - (a.crashed = t.mutValues.levelState.crashed), - (a.paused = - t.paused || t.mutValues.levelState.finishedLevel), - (a.finishedLevel = t.mutValues.levelState.finishedLevel), - (a.isFlyingLevel = t.isFlyingLevel), - (a.started = - false !== - (null === (s = e.online) || void 0 === s - ? void 0 - : s.start)), - (a.bottomLineObjects = - (null === (o = t.mutValues.levelState.bottomLine) || - void 0 === o - ? void 0 - : o.objects) || null), - (a.layoutState = t.bigMutValues.inViewLayoutState), - (a.layoutStateIndex = - t.bigMutValues.fullLayoutStateIndexes), - (a.landTimer = t.mutValues.landTimer), - (a.jumpFrames = t.levelSpeeds.jumpFrames), - (a.otherPlayersInfo = - null === (r = e.online) || void 0 === r - ? void 0 - : r.getOtherPlayersInfo( - t.mutValues.levelState.playerX, - t.mutValues.levelState.playerY, - )), - (a.hasCheckpoints = e.hasCheckpoints), - (a.maxFrame = e.maxFrame)); - const l = gm( - t.mutValues.levelState.playerX, - t.mutValues.levelState.cameraXOffset, - ); - ((a.cameraX = l), - (a.cameraY = t.mutValues.levelState.cameraY), - (a.bgColor = t.mutValues.levelState.bgColor || "#00FFFF"), - (a.flash = t.mutValues.levelState.flash || 0), - (a.gravity = t.mutValues.levelState.gravity || 0), - (a.showAttempts = void 0 === e.editor), - (a.tutorial = t.tutorial), - (a.hidePlayer = Ll( - t.mutValues.levelState.bossState, - t.mutValues.levelState.frame, - t.mutValues.levelState.crashed, - )), - (a.fadeOutAttempts = Ml( - t.mutValues.levelState.bossState, - ))); + (e) => { + ((e.x = -a.size.fullWidth / 2 + 100), + (e.y = a.size.fullHeight / 2 - 40)); }, ), - onChange( - () => { - var e; - return null === (e = t.booster) || void 0 === e - ? void 0 - : e.booster.type; - }, - () => { - if (!t.booster) return []; - const e = { - fileName: `images/achievement/rewards/${t.booster.booster.type}.png`, - width: 72, - height: 49, - }; - return [ - y( + ], + ), + c( + { + text: `${localize("SCORE")}: ${t.totalScore.toLocaleString()}`, + color: Te, + strokeColor: He, + strokeThickness: 4, + font: { size: 20, align: "left" }, + x: -a.size.fullWidth / 2 + 100, + y: a.size.fullHeight / 2 - (t.highScore > 0 ? 65 : 50), + }, + (e) => { + ((e.text = `${localize("SCORE")}: ${t.totalScore.toLocaleString()}`), + (e.x = -a.size.fullWidth / 2 + 100), + (e.y = + a.size.fullHeight / 2 - (t.highScore > 0 ? 65 : 50))); + }, + ), + ifConditional( + () => 0 !== e.fade, + () => [ + Lo.Single( + { + sprites: [ + c( { - fileName: e.fileName, - width: e.width, - height: e.height, - x: a.size.fullWidth / 2 - 130 - Pm / 2, - y: a.size.fullHeight / 2 - 50, + text: e.prevLocalScore.toLocaleString(), + color: Te, + strokeColor: He, + strokeThickness: 4, + font: { size: 25 }, + y: -135, }, - (e) => { - ((e.x = a.size.fullWidth / 2 - 130 - Pm / 2), - (e.y = a.size.fullHeight / 2 - 50)); + (a) => { + a.text = e.prevLocalScore.toLocaleString(); + const i = t.localScore > 0 ? 1 : 1 + e.jumpOut / 60; + ((a.scaleX = i), (a.scaleY = i)); }, ), - ]; + ifConditional( + () => e.prevMultiplier > 1, + () => [ + c( + { + text: `x${e.prevMultiplier}`, + color: Te, + strokeColor: He, + strokeThickness: 4, + font: { size: 40 }, + y: -165, + }, + (t) => { + t.text = `x${e.prevMultiplier}`; + }, + ), + ], + ), + ], + }, + (t) => { + t.opacity = e.fade <= 10 ? e.fade / 10 : 1; }, ), - ifConditional( - () => void 0 !== e.backToMenu && !e.online, - () => [ - gameplayOverlay.Single( - { - backToMenu: () => e.backToMenu(false), - paused: t.paused, - attempt: t.mutValues.levelState.attempt, - frame: t.mutValues.levelState.frame, - maxFrame: e.maxFrame, - theme: t.bigMutValues.inViewLayout.properties.theme.id, - fadeOutAttempts: - Ml(t.mutValues.levelState.bossState) || - i(Se).settings.fadeOutAttempts, - addCheckpoint: () => { - if (!t.mutValues.levelState.crashed) { - t.mutValues.checkpoints.push({ - state: tl(t.mutValues.levelState, e.level.boss) - }) - } - }, - removeCheckpoint: () => { - if (t.mutValues.checkpoints.length > 1) { - t.mutValues.checkpoints.pop() - } - }, - onResume: () => { - if ( - ((t.paused = false), - (t.sfx = Rf(a, i(Se).settings, e.level, () => t)), - !e.online && !t.mutValues.levelState.crashed) - ) { - const n = - i(Se).settings.headphonesDelay - - t.pausedMusicDelay; - 0 !== n - ? a.audio(e.level.song.fileName).play({ - overwrite: true, - playbackRate: t.df, - fromPosition: - a - .audio(e.level.song.fileName) - .getPosition() + n, - }) - : a.audio(e.level.song.fileName).play({ - overwrite: true, - playbackRate: t.df, - fromPosition: - (1 / 60) * t.mutValues.levelState.frame + - e.level.songStartSecs + - i(Se).settings.headphonesDelay, - }); - } - }, - onPause: () => { - (e.online || - ((t.pausedMusicDelay = - i(Se).settings.headphonesDelay), - a.audio(e.level.song.fileName).pause()), - (t.paused = true)); - }, - onReset: () => { - var n, s; - const { animationAssets: o } = i(Ws), - r = Zr( - e.level.layout, - e.level.boss, - o || null, - null, - t.sfx.playSound, - t.sfx.pauseSound, - ); - a.audio(e.level.song.fileName).play({ - fromPosition: - e.level.songStartSecs + - i(Se).settings.headphonesDelay, - overwrite: true, - }); - const l = _r(e.level); - (Ca.setInViewLayoutAndState( - e.level.layout, - r.frame, - l.jumpFrames, - r.playerX, - r.playerY, - r.layoutState, - r.switchButtons.rot, - r.jumpSwitch.ratio, - r.switchBlockSpikes, - t.mutValues.layoutFirstIndexes, - t.bigMutValues.inViewLayout, - t.bigMutValues.inViewLayoutState, - t.bigMutValues.fullLayoutStateIndexes, - r.fallTypes, - ), - null === (n = e.didStart) || - void 0 === n || - n.call(e, 0, false), - (t.mutValues.levelState = r), - (t.mutValues.blockJumpUntilReleased = false), - (t.paused = false), - (t.mutValues.landTimer = 0), - (t.mutValues.checkpoints.length = 0), - (t.playerInputIsDown = false), - (t.hasStarted = true), - (t.mutValues.resetTimer = null), - (t.tutorial = Qp( - null, - (null === (s = e.world) || void 0 === s - ? void 0 - : s.showBoostersPrompt) || false, - )), - (t.isAfkTimer = 600), - (t.booster = null), - (t.levelSpeeds = l), - (t.df = 1), - (t.powerupOut = null), - e.world && - Jp.saveLevelProgress( - t.worker, - a.storage, - a.now, - e.level.name, - e.world.levelIndex, - e.world.number, - e.world.withCheckpoints, - false, - 1, - a.alert, - r.attempt, - null, - )); - }, - }, - (a) => { - const { settings: n } = i(Se); - (xm(t.tutorial.boosterPrompt, n.hideUi, e.world) - ? a.boosters - ? ((a.boosters.booster = - t.booster && t.booster.booster), - (a.boosters.showPrompt = - "show" === t.tutorial.boosterPrompt), - (a.boosters.onOpen = t.onOpenBooster), - (a.boosters.pressedBooster = t.pressedBooster)) - : (a.boosters = { - booster: t.booster && t.booster.booster, - showPrompt: "show" === t.tutorial.boosterPrompt, - onOpen: t.onOpenBooster, - pressedBooster: t.pressedBooster, - disableMissiles: canUseMissiles(e.level), - }) - : (a.boosters = void 0), - (a.paused = t.paused), - (a.hideUi = n.hideUi), - (a.isPractice = t.mutValues.checkpoints.length > 0), - (console.log(t.mutValues.checkpoints.length)), - (a.attempt = t.mutValues.levelState.attempt), - a.crashed || (a.frame = t.mutValues.levelState.frame), - (a.theme = - t.bigMutValues.inViewLayout.properties.theme.id), - (a.background = t.mutValues.levelState.bgColor), - (a.fadeOutAttempts = - Ml(t.mutValues.levelState.bossState) || - i(Se).settings.fadeOutAttempts)); - }, - ), - ], + ], + ), + ], + }), + im = makeSprite({ + render: ({ props: e, device: t }) => [ + ifConditional( + () => e.highScore > 0, + () => [ + c( + { + text: `${localize("HIGH SCORE")}: ${e.highScore.toLocaleString()}`, + color: Te, + strokeColor: He, + strokeThickness: 4, + font: { size: 15, align: "left" }, + x: -t.size.fullWidth / 2 + 100, + y: t.size.fullHeight / 2 - 40, + }, + (e) => { + ((e.x = -t.size.fullWidth / 2 + 100), + (e.y = t.size.fullHeight / 2 - 40)); + }, ), - ifConditional( - () => t.mutValues.levelState.finishedLevel && !e.online, - () => { - var a, i; - return [ - ff.Single({ - attempts: t.mutValues.levelState.attempt, - score: t.mutValues.levelState.score.total, - collectibles: t.mutValues.levelState.collectibles, - prevHighScore: - (null === (a = e.world) || void 0 === a - ? void 0 - : a.highScore) || 0, - prevBestAttempts: ( - null === (i = e.world) || void 0 === i - ? void 0 - : i.withCheckpoints - ) - ? e.world.prevBestAttempts - : void 0, - onContinue: () => { - var t; - e.editor - ? e.editor.backToEditor() - : null === (t = e.backToMenu) || - void 0 === t || - t.call(e, true); - }, - world: e.world, - checkpoints: t.mutValues.checkpoints - }), - ]; + ], + ), + c( + { + text: `${localize("SCORE")}: ${e.totalScore.toLocaleString()}`, + color: Te, + strokeColor: He, + strokeThickness: 4, + font: { size: 20, align: "left" }, + x: -t.size.fullWidth / 2 + 100, + y: t.size.fullHeight / 2 - (e.highScore > 0 ? 65 : 50), + }, + (a) => { + ((a.text = `${localize("SCORE")}: ${e.totalScore.toLocaleString()}`), + (a.x = -t.size.fullWidth / 2 + 100), + (a.y = + t.size.fullHeight / 2 - (e.highScore > 0 ? 65 : 50))); + }, + ), + ifConditional( + () => e.combo > 0, + () => [ + c( + { + color: Te, + strokeColor: He, + strokeThickness: 4, + font: { size: 24 }, + y: -165, + }, + (t) => { + t.text = `${e.combo} combo`; }, ), - ]; - }, - cleanup({ state: e }) { - Mp(e.worker); - }, - }), - Tf = (e, t, a, i, n, s, o) => { - return ( - (r = void 0), - (l = void 0), - (d = function* () { - if (e.world && t.mutValues.checkpoints.length === 0) { - const r = n ? 1 : 0, - l = yield Jp.saveLevelProgress( - t.worker, - a.storage, - a.now, - e.level.name, - e.world.levelIndex, - e.world.number, - e.world.withCheckpoints, - s, - Math.floor(t.mutValues.levelState.frame), + ifConditional( + () => e.fullCombo, + () => [ + c( { - ok: () => { - t.didAlertStorageError || - ((t.didAlertStorageError = true), - a.alert.ok( - "Progress isn't being saved! Ensure you have enough storage space.", - )); - }, - okCancel: a.alert.okCancel, + color: Te, + strokeColor: He, + strokeThickness: 4, + font: { size: 24 }, + y: -130, }, - t.mutValues.levelState.attempt + r, - o, - t.mutValues.levelState.score.total, - r, - ); - s && - i && - i.signedInAccount && - (yield bp.updateAccountStorage(i.backend, l, a.now)); - } - }), - new ((c = void 0) || (c = Promise))(function (e, t) { - function a(e) { - try { - n(d.next(e)); - } catch (e) { - t(e); - } - } - function i(e) { - try { - n(d.throw(e)); - } catch (e) { - t(e); - } - } - function n(t) { - var n; - t.done - ? e(t.value) - : ((n = t.value), - n instanceof c - ? n - : new c(function (e) { - e(n); - })).then(a, i); - } - n((d = d.apply(r, l || [])).next()); - }) - ); - var r, l, c, d; - }, - Rf = (e, t, a, i) => ({ - playSound: (a) => { - Ga(a, e, t, { fromPosition: 0, playbackRate: i().df }); - }, - pauseSound: (t) => { - e.audio(t).pause(); - }, - enemyShoot: () => { - Ga("audio/levels/enemy/shoot.wav", e, t, { overwrite: true }); - }, - jump: (a) => { - (!a && t.muteJump) || - Ga( - `audio/levels/${a ? "skateboard/ollie" : "jump"}.wav`, - e, - t, - 0, - ); - }, - pauseSong: () => { - e.audio(a.song.fileName).pause(); - }, - fadeSong: () => { - e.audio(a.song.fileName).setVolume({ - type: "linear", - fadeTime: 2, - fadeTo: 0, - }); - }, - hitFlag: () => { - Ga("audio/levels/flag.wav", e, t, 0); - }, - hitSpring: () => { - Ga("audio/levels/spring.wav", e, t, 0); - }, - hitCollectible: () => { - Ga("audio/levels/coin-collect.wav", e, t, 0); - }, - hitSwitch: () => { - Ga("audio/levels/switch-button.mp3", e, t, 0); - }, - hitDirectionChange: () => { - Ga("audio/levels/direction-change.wav", e, t, 0); - }, - hitSpeedChange: (a, i) => { - let n; - ((n = i - ? "up" + (a < 1 ? 1 : a < 1.5 ? 2 : a < 2 ? 3 : a < 3 ? 4 : 5) - : "down" + - (a < 0.5 ? 5 : a < 1 ? 4 : a < 1.5 ? 3 : a < 2 ? 2 : 1)), - Ga(`audio/levels/speedChange/${n}.wav`, e, t, 0)); - }, - hitPortal: () => { - const a = e.random() < 0.5 ? 1 : 2; - Ga(`audio/levels/portal${a}.wav`, e, t, 0); - }, - pickupPowerup: (a) => { - switch (a) { - case "jetpack": - Ga("audio/levels/jetpack/pickup.wav", e, t, 0); - break; - case "gun": - Ga("audio/levels/gun/pickup.wav", e, t, 0); - break; - case "punch": - Ga("audio/levels/punch/pickup.wav", e, t, 0); - break; - case "playerStack": - Ga( - `audio/levels/stack/${B.clamp([1, 7])( - i().mutValues.levelState.playerStacks.length + 1, - )}.wav`, - e, - t, - 0, - ); - break; - case "doubleJump": - Ga("audio/levels/doubleJump/pickup.wav", e, t, 0); - } - }, - useUpPowerup: (a) => { - switch (a) { - case "jetpack": - Ga("audio/levels/jetpack/finish.wav", e, t, 0); - break; - case "gun": - Ga("audio/levels/gun/shoot.wav", e, t, 0); - break; - case "punch": - Ga("audio/levels/punch/use.wav", e, t, 0); - break; - case "doubleJump": - Ga("audio/levels/doubleJump/jump.wav", e, t, 0); - } + (t) => { + t.text = localize(e.perfectCombo ? "PERFECT FC" : "FULL COMBO"); + }, + ), + ], + ), + ], + ), + ], + }), + nm = makeSprite({ + render: ({ props: e }) => [ + onChange( + () => e.hasStarted, + () => [ + sm.Array({ + props: (e) => e, + array: () => e.info.playerPropsBySkinFileName, + update: (e, { fileName: t, positionInfo: a }) => { + ((e.fileName = t), (e.positionInfo = a)); + }, + key: ({ fileName: e }) => e, + }), + ], + ), + ], + }), + sm = makeSprite({ + render: ({ props: e }) => [ + imageArray({ + fileName: `images/player/skins/dark/${e.fileName}.png`, + props: () => ({}), + update: (e, t) => { + ((e.x = t.x), + (e.y = t.y), + (e.width = t.width), + (e.height = t.height), + (e.rotation = t.rotation), + (e.scaleX = t.scaleX), + (e.scaleY = t.scaleY), + (e.opacity = t.opacity)); + }, + array: () => e.positionInfo, + testId: (e) => `OtherPlayer-${e.playerIndex}`, + }), + ], + }); + function om(e, t, a, i, n, s, o, r, l, c) { + const d = {}, + u = [], + h = [], + p = []; + let g = 10, + m = 0, + f = ""; + for (let y = 0; y < e.length; y++) { + const E = e[y]; + if (null === E || y === l) continue; + if ( + (d[E.skin.fileName] || (d[E.skin.fileName] = []), + E.x > n + o || E.x < n - o || E.y > s + r || E.y < s - r) + ) { + c && + (g--, + g > 0 && p.push({ x: E.x, y: E.y, username: E.username })); + continue; + } + let { x: b, y: S, rotation: I } = E; + (0 === E.deathTimer && + ((S = t[y]), a && ((b += E.speed * i), (I += E.rotSpeed * i))), + d[E.skin.fileName].push({ + x: b, + y: S, + width: E.skin.size, + height: E.skin.size, + rotation: I, + scaleX: E.scaleX, + scaleY: E.scaleY, + opacity: + E.deathTimer > 0 ? Math.max(0, 6 - E.deathTimer) / 6 : 1, + playerIndex: E.playerIndex, + })); + for (const e of E.playerStack) + d[E.skin.fileName].push({ + x: b, + y: e, + width: E.skin.size, + height: E.skin.size, + rotation: I, + scaleX: E.scaleX, + scaleY: E.scaleY, + opacity: 1, + playerIndex: E.playerIndex, + }); + b > n - 5 && b < n + 5 + ? E.deathTimer || (m++, (f = E.username)) + : (u.push({ color: ve, x: b, y: S + M + 8, text: E.username }), + h.push({ x: b, y: S + M - 2 })); + } + return { + playerPropsBySkinFileName: Object.entries(d).map(([e, t]) => ({ + fileName: e, + positionInfo: t, + })), + nameProps: u, + arrowProps: h, + otherPlayersWithSameX: m, + otherPlayerWithSameXName: f, + offCamera: p, + }; + } + const rm = makeSprite({ + render: ({ props: e }) => [ + imageArray({ + fileName: "images/online/name-arrow.png", + props: () => ({ width: 13, height: 8 }), + update: (e, t) => { + ((e.x = t.x), (e.y = t.y)); + }, + array: () => e.info.arrowProps, + }), + d({ + props: () => ({ color: ve }), + update: (e, t) => { + ((e.text = t.text), (e.x = t.x), (e.y = t.y)); }, - addScore: () => { - Ga("audio/levels/skateboard/score/add.wav", e, t, 0); + array: () => e.info.nameProps, + }), + c({ color: ve, strokeColor: Ye, strokeThickness: 3 }, (t) => { + ((t.x = e.playerX), + (t.y = e.playerY + M + 8), + (t.text = + 0 === e.info.otherPlayersWithSameX || e.crashed + ? e.playerName + : 1 === e.info.otherPlayersWithSameX + ? `${e.playerName} & ${e.info.otherPlayerWithSameXName}` + : `${e.playerName} & ${e.info.otherPlayersWithSameX} OPPONENTS`)); + }), + ifConditional( + () => + (e.info.otherPlayersWithSameX > 0 || + e.info.nameProps.length > 5) && + !e.crashed, + () => [ + y( + { + fileName: "images/online/highlight-player.png", + width: 60, + height: 60, + }, + (t) => { + ((t.x = e.playerX), (t.y = e.playerY)); + }, + ), + ], + ), + y( + { + fileName: "images/level/arrow-down-stroke.png", + width: 15, + height: 10, }, - scoreMultiplier: (a) => { - Ga( - `audio/levels/skateboard/score/${Math.min(a, 10)}.wav`, - e, - t, - 0, - ); + (t) => { + ((t.x = e.playerX), (t.y = e.playerY + M - 2)); }, + ), + ], + }), + lm = makeSprite({ + init: () => ({ + fade: 0, + text: "", + bestFrame: 0, + show: false, + didCrash: false, }), - ScreenBounds = makePureSprite({ - shouldRerender: () => false, - render: ({ - size: { width: e, height: t, widthMargin: a, heightMargin: i }, - }) => - a > 0 - ? [ - o({ - width: a, - height: t, - color: "black", - opacity: 0.8, - x: -e / 2 - a / 2, - }), - o({ - width: a, - height: t, - color: "black", - opacity: 0.8, - x: e / 2 + a / 2, - }), - ] - : i > 0 - ? [ - o({ - width: e, - height: i, - color: "black", - opacity: 0.8, - y: -t / 2 - i / 2, - }), - o({ - width: e, - height: i, - color: "black", - opacity: 0.8, - y: t / 2 + i / 2, - }), - ] - : [], - }), - Cf = function (e) { - try { - const t = "string" == typeof e ? JSON.parse(e) : e, - a = Yd.jsonToData(t); - if (a instanceof Error) return a; - const i = a.data[0]; - return ((i.name = i.name.replace(/\n/g, "")), i); - } catch (e) { - return e; + loop({ props: e, state: t }) { + // console.warn(e.frame); + if (!e.crashed) + return 0 !== t.fade + ? ((t.fade = 0), (t.show = false), void (t.didCrash = false)) + : t.show || t.didCrash + ? ((t.show = false), void (t.didCrash = false)) + : void 0; + if (!t.didCrash && (e.frame > t.bestFrame || !e.hasCheckpoints)) { + const a = Math.floor((e.frame / e.maxFrame) * 100); + if (a >= 10) + return ( + (t.fade = 0), + (t.text = `${a}%`), + (t.bestFrame = e.frame), + (t.show = true), + void (t.didCrash = true) + ); } + if (t.fade < 10) + return ( + (t.fade = t.fade + 1), + (t.text = t.text), + (t.bestFrame = t.bestFrame), + (t.show = t.show), + void (t.didCrash = true) + ); + t.didCrash || (t.didCrash = true); }, - wf = function (e, t) { - const a = Yd.dataToJson([e], t); - return JSON.stringify(a); - }; - function Af(e) { - return new Promise(function (t, a) { - const i = new XMLHttpRequest(); - ((i.onload = function () { - t(new Response(i.response, { status: i.status || 200 })); - }), - (i.onerror = function () { - a(new TypeError(`Failed to load file: ${e.toString()}`)); - }), - i.open("GET", e), - (i.responseType = "arraybuffer"), - i.send(null)); - }); - } - function kf(e) { - return ( - (t = this), - (a = void 0), - (n = function* () { - try { - const t = e.split(".")[0].split("audio/tracks/")[1]; - return (yield Af(`waveforms/${t}-waveform.json`)).json(); - } catch (e) { - return null; - } - }), - new ((i = void 0) || (i = Promise))(function (e, s) { - function o(e) { - try { - l(n.next(e)); - } catch (e) { - s(e); - } - } - function r(e) { - try { - l(n.throw(e)); - } catch (e) { - s(e); - } - } - function l(t) { - var a; - t.done - ? e(t.value) - : ((a = t.value), - a instanceof i - ? a - : new i(function (e) { - e(a); - })).then(o, r); - } - l((n = n.apply(t, a || [])).next()); - }) - ); - var t, a, i, n; - } - const Nf = makeCustomSprite({ - init: () => ({ - showSettings: false, - saved: false, - downloaded: false, - }), - render({ - device: e, - props: { - viewOffset: t, - onPressEdit: a, - onPressExport: i, - onPressMenu: s, - onSave: r, - levelName: l, - onChangeText: c, - }, - state: d, - updateState: u, - getContext: h, - }) { - const p = e.size.width + 2 * e.size.widthMargin, - g = e.size.height + 2 * e.size.heightMargin, - m = [ - o({ width: p, height: g, color: "#091045" }), - GridLines.Single({ - id: "GridLines", - parentOffset: t, - x: t.x, - y: t.y, - scaleX: t.scale, - scaleY: t.scale, - }), - ]; - return d.showSettings - ? [ - ...m, - Cm.Single({ - id: "SettingsMenu", - globalContextVal: h(Se), - goBack: () => { - u((e) => - Object.assign(Object.assign({}, e), { - showSettings: false, - }), - ); - }, - }), - ] - : [ - ...m, - xf({ - id: "LevelName", - levelName: l, - onChangeText: (e) => { - (u((e) => - Object.assign(Object.assign({}, e), { - saved: false, - downloaded: false, - }), - ), - c(e)); - }, - y: 90, - }), - Fo({ - id: "EditButton", - text: localize("EDIT"), - width: 110, - height: 50, - strokeColor: Ye, - onPress: a, - x: -280, - }), - Fo({ - id: "SaveButton", - text: - "loading" === d.saved - ? "SAVING" - : d.saved - ? "SAVED" - : localize("SAVE"), - width: 110, - height: 50, - strokeColor: Ye, - disabled: false !== d.saved, - onPress: () => { - (r().then(() => { - u((e) => - Object.assign(Object.assign({}, e), { - saved: true, - }), - ); - }), - u((e) => - Object.assign(Object.assign({}, e), { - saved: "loading", - downloaded: false, - }), - )); - }, - x: -140, - }), - DropdownButton({ - id: "ExportButton", - options: ["CLIPBOARD", "FILE"], - choice: 0, - text: "EXPORT", - width: 110, + render: ({ state: e }) => [ + ifConditional( + () => e.show, + () => [ + y( + { + fileName: "images/level/arrow-down-stroke.png", + width: 15, + height: 10, + y: -32, + rotation: 180, + }, + (t) => { + t.opacity = e.fade / 10; + }, + ), + c( + { + font: { size: 20 }, + strokeColor: Ye, + strokeThickness: 3, + color: "white", + y: -50, + }, + (t) => { + ((t.text = e.text), (t.opacity = e.fade / 10)); + }, + ), + ], + ), + ], + }), + renderGround = makeSprite({ + render({ props: e }) { + return [ + e.theme == "classic" + ? y( + { + fileName: "images/themes/classic/ground.png", + width: 500, + height: 2, + }, + (a) => { + a.y = et.initialPosition.y - M / 2 - e.cameraY - 1; + }, + ) + : e.theme == "infinite" + ? p( + { + width: 660 * 2, + height: 10, + x: 0, + color: getInfiniteThemeColors(e.bgColor) + }, + (a) => { + a.y = + et.initialPosition.y - M / 2 - e.cameraY - 5; + a.color = getInfiniteThemeColors(e.bgColor); + }, + ) + : y( + { + fileName: `images/themes/${e.theme}/${e.theme === "world1Boss" ? "block" : "boss"}.png`, + width: 660 * 2, + height: 30, + }, + (a) => { + a.y = et.initialPosition.y - M / 2 - e.cameraY - 15; + }, + )]; + }, + }), + cm = makeSprite({ + render: ({ device: e, props: t, getContext: a }) => { + let lastFrame = t.frame; + return [ + xg.Single( + { + theme: t.layout.properties.theme, + cameraX: t.cameraX, + cameraY: t.cameraY, + paused: t.paused, + switchBlockSpikes: t.switchBlockSpikes, + bgColor: t.bgColor, + flash: t.flash || 0, + speedMultiplier: t.playerSpeedMultiplier, + plain: a(Se).settings.plainBackground, + frame: t.frame, + jumpFrames: t.jumpFrames, + playerDir: t.playerDir, + crashed: t.crashed, + gravity: t.gravity, + dashing: t.dashing, + isGravity: t.isGravity, + }, + (e) => { + ((e.playerScale = t.playerScale), + (e.isGravity = t.isGravity), + (e.dashing = t.dashing), + (e.cameraX = t.cameraX), + (e.cameraY = t.cameraY), + (e.paused = t.paused), + (e.speedMultiplier = t.playerSpeedMultiplier), + (e.bgColor = t.bgColor), + (e.flash = t.flash || 0), + (e.gravity = t.gravity || 1), + (e.switchBlockSpikes = t.switchBlockSpikes), + (e.plain = a(Se).settings.plainBackground), + (e.frame = t.frame), + (e.jumpFrames = t.jumpFrames), + (e.playerDir = t.playerDir), + (e.crashed = t.crashed)); + }, + ), + ifConditional( + () => t.playerPowerups.some((e) => e.item === "spaceship"), + () => [ + y( + { + fileName: "images/level/boss3/star-line.png", + width: 950, height: 50, - strokeColor: Ye, - onPress: (choice) => { - (u((e) => - Object.assign(Object.assign({}, e), { - downloaded: false, - }), - ), - i(choice).then((e) => { - e && - choice === 1 && - u((e) => - Object.assign(Object.assign({}, e), { - downloaded: true, - }), - ); - })); - }, - x: 0, - }), - d.downloaded - ? n({ - text: localize("DOWNLOADED!"), - color: ve, - font: { size: 15 }, - y: -150, - }) - : null, - Fo({ - id: "SettingsButton", - text: localize("SETTINGS"), - width: 110, + y: t.flyingAnchor - 45 - t.cameraY, + }, + (e) => { + e.y = t.flyingAnchor - 45 - t.cameraY; + }, + ), + y( + { + fileName: "images/level/boss3/star-line.png", + width: 950, height: 50, - strokeColor: Ye, - onPress: () => { - u((e) => - Object.assign(Object.assign({}, e), { - showSettings: true, - downloaded: false, - }), - ); - }, - x: 140, - }), - ((window.onbeforeunload = d.saved - ? undefined - : () => - "You have unsaved changes. Are you sure you want to return to the main menu?"), - void 0), - Fo({ - id: "ExitButton", - text: localize("MENU"), - width: 110, + y: t.flyingAnchor + 45 - t.cameraY, + }, + (e) => { + e.y = t.flyingAnchor + 45 - t.cameraY; + }, + ), + dg.Single( + { + fileName: "images/level/boss3/star-line-stars.png", + playerX: t.cameraX, + playerY: 0, height: 50, - onPress: () => { - d.saved - ? s() - : e.alert.okCancel( - localize( - "You have unsaved changes. Are you sure you want to return to the main menu?", - ), - (e) => { - e && s(); + y: t.flyingAnchor - 45 - t.cameraY, + }, + (e) => { + e.playerX = t.cameraX; + e.y = t.flyingAnchor - 45 - t.cameraY; + }, + ), + dg.Single( + { + fileName: "images/level/boss3/star-line-stars.png", + playerX: e.cameraX, + playerY: 0, + height: 50, + y: t.flyingAnchor + 45 - t.cameraY, + }, + (e) => { + e.playerX = t.cameraX; + e.y = t.flyingAnchor + 45 - t.cameraY; + }, + ), + ], + ), + t.bossState + ? hg.Single( + { bossState: t.bossState, playerX: t.playerX }, + (e) => { + ((e.bossState = t.bossState), (e.playerX = t.playerX)); + }, + ) + : null, + t.layout.properties.useGround && + isSpecialTheme(t.layout.properties.theme.id) + ? renderGround.Single( + { + cameraY: t.cameraY, + theme: t.layout.properties.theme.id, + }, + (a) => { + a.cameraY = t.cameraY; + a.theme = t.layout.properties.theme.id; + a.bgColor = t.bgColor; + }, + ) + : null, + + dm.Single( + { + frame: t.frame, + df: t.df, + attempt: t.attempt, + playerX: t.playerX, + playerY: t.playerY, + playerGradY: t.playerGradY, + playerRot: t.playerRot, + playerDir: t.playerDir, + playerScaleX: t.playerScaleX, + playerScaleY: t.playerScaleY, + checkpoints: t.checkpoints, + playerPowerups: t.playerPowerups, + isCompatible: t.isCompatible, + playerPowerupOut: t.playerPowerupOut, + playerBullets: t.playerBullets, + playerJetpackFuel: t.playerJetpackFuel, + playerUsingPowerup: t.playerUsingPowerup, + playerStacks: t.playerStacks, + playerStackIndex: t.playerStackIndex, + playerSkin: t.playerSkin, + playerJumping: t.playerJumping, + touchingPortals: t.touchingPortals, + justHitObject: t.justHitObject, + explosions: t.explosions, + bossState: t.bossState, + layout: t.layout, + layoutState: t.layoutState, + layoutStateIndex: t.layoutStateIndex, + jumpFrames: t.jumpFrames, + switchRotation: t.switchRotation, + switchBlockSpikes: t.switchBlockSpikes, + crashed: t.crashed, + paused: t.paused || !t.started, + finishedLevel: t.finishedLevel, + isFlyingLevel: t.isFlyingLevel, + bottomLineObjects: t.bottomLineObjects, + landTimer: t.landTimer, + hasCheckpoints: t.hasCheckpoints, + maxFrame: t.maxFrame, + playerName: t.playerName, + otherPlayersInfo: t.otherPlayersInfo, + x: -t.cameraX, + y: -t.cameraY, + hidePlayer: t.hidePlayer, + started: t.started, + playerScale: t.playerScale, + bgColor: t.bgColor, + flash: t.flash, + gravity: t.gravity, + dashing: t.dashing, + isGravity: t.isGravity, + cameraX: t.cameraX, + cameraY: t.cameraY, + cameraXOffset: t.cameraXOffset, + fallTypes: t.fallTypes, + flyingAnchor: t.flyingAnchor, + playerSpeedMultiplier: t.playerSpeedMultiplier, + boosterDebug: t.boosterDebug, + }, + (e) => { + ( + (e.boosterDebug = t.boosterDebug), + (e.playerSpeedMultiplier = t.playerSpeedMultiplier), + (e.cameraX = t.cameraX), + (e.cameraXOffset = t.cameraXOffset), + (e.cameraY = t.cameraY), + (e.isGravity = t.isGravity), + (e.flyingAnchor = t.flyingAnchor), + (e.dashing = t.dashing), + (e.frame = t.frame), + (e.df = t.df), + (e.attempt = t.attempt), + (e.playerX = t.playerX), + (e.playerY = t.playerY), + (e.playerGradY = t.playerGradY), + (e.playerRot = t.playerRot), + (e.playerDir = t.playerDir), + (e.playerScaleX = t.playerScaleX), + (e.playerScaleY = t.playerScaleY), + (e.playerScale = t.playerScale), + (e.playerPowerups = t.playerPowerups), + (e.isCompatible = t.isCompatible), + (e.playerPowerupOut = t.playerPowerupOut), + (e.playerBullets = t.playerBullets), + (e.playerJetpackFuel = t.playerJetpackFuel), + (e.playerUsingPowerup = t.playerUsingPowerup), + (e.playerStacks = t.playerStacks), + (e.playerStackIndex = t.playerStackIndex), + (e.playerSkin = t.playerSkin), + (e.playerJumping = t.playerJumping), + (e.touchingPortals = t.touchingPortals), + (e.justHitObject = t.justHitObject), + (e.explosions = t.explosions), + (e.bossState = t.bossState), + (e.layout = t.layout), + (e.layoutState = t.layoutState), + (e.layoutStateIndex = t.layoutStateIndex), + (e.jumpFrames = t.jumpFrames), + (e.switchRotation = t.switchRotation), + (e.switchBlockSpikes = t.switchBlockSpikes), + (e.crashed = t.crashed), + (e.paused = t.paused || !t.started), + (e.finishedLevel = t.finishedLevel), + (e.bottomLineObjects = t.bottomLineObjects), + (e.landTimer = t.landTimer), + (e.hasCheckpoints = t.hasCheckpoints), + (e.maxFrame = t.maxFrame), + (e.playerName = t.playerName), + (e.otherPlayersInfo = t.otherPlayersInfo), + (e.x = -t.cameraX), + (e.y = -t.cameraY), + (e.hidePlayer = t.hidePlayer), + (e.started = t.started)); + ((e.flash = t.flash), + (e.bgColor = t.bgColor), + (e.gravity = t.gravity), + (e.fallTypes = t.fallTypes)); + }, + ), + Pg.Single( + { + theme: t.layout.properties.theme, + cameraX: t.cameraX, + cameraY: t.cameraY, + playerY: t.playerY, + playerX: t.playerX, + cameraXOffset: t.cameraXOffset, + playerDir: t.playerDir, + paused: t.paused, + plain: a(Se).settings.plainBackground, + }, + (e) => { + ((e.cameraX = t.cameraX), + (e.cameraY = t.cameraY), + (e.playerX = t.playerX), + (e.playerY = t.playerY), + (e.playerDir = t.playerDir), + (e.cameraXOffset = t.cameraXOffset), + (e.paused = t.paused), + (e.plain = a(Se).settings.plainBackground)); + }, + ), + t.showAttempts + ? conditional( + () => t.fadeOutAttempts || a(Se).settings.fadeOutAttempts, + () => [ + onChange( + () => t.attempt, + () => [ + jo.Single({ + initShow: true, + shouldShow: false, + fadeFrames: 120, + sprite: (e) => [ + attemptCounter.Single( + { + attempt: t.attempt, + theme: t.layout.properties.theme.id, }, - ); + (a) => { + ((a.attempt = t.attempt), + (a.theme = t.layout.properties.theme.id), + (a.background = t.bgColor), + (a.opacity = e.ref)); + }, + ), + ], + }), + ], + ), + ], + () => [ + attemptCounter.Single( + { + attempt: t.attempt, + theme: t.layout.properties.theme.id, }, - strokeColor: Ye, - x: 280, - }), - document.fullscreenEnabled - ? vo({ - id: "FullScreen", - fullScreen: true, - onPress: () => { - if (document.fullscreenElement) { - document.exitFullscreen(); - } else { - document.documentElement - .requestFullscreen() - .catch((e) => { - throw e; - }); - } - }, - x: e.size.fullWidth / 2 - 40, - y: e.size.fullHeight / 2 - 40, - }) - : null - ]; - }, - }), - xf = makeCustomSprite({ - render({ props: { levelName: e, onChangeText: t } }) { - const a = 25; - return [ - r({ - fillColor: ve, - path: [ - [-200, -25], - [185, -25], - [210, 0], - [210, a], - [-175, a], - [-200, 0], - [-200, -25], + (e) => { + e.attempt = t.attempt; + e.theme = t.layout.properties.theme.id; + e.background = t.bgColor; + }, + ), ], - y: -10, + ) + : null, + ifConditional( + () => t.collectibles > 0, + () => [ + c( + { + color: "#4BE5F5", + strokeColor: "#6B00BE", + strokeThickness: 4, + font: { size: 20 }, + y: e.size.fullHeight / 2 - 120, + }, + (a) => { + ((a.text = `${t.collectibles} / ${t.collectiblesTotal}`), + (a.y = e.size.fullHeight / 2 - 120)); + }, + ), + ], + ), + conditional( + () => { + var e; + return t.playerPowerups.some( + (e) => e.item === "skateboard", + ); + }, + () => [ + am.Single( + { + localScore: t.score.local, + totalScore: t.score.total, + multiplier: t.score.multiplier, + highScore: t.highScore, + crashed: t.crashed, + }, + (e) => { + ((e.localScore = t.score.local), + (e.totalScore = t.score.total), + (e.multiplier = t.score.multiplier), + (e.highScore = t.highScore), + (e.crashed = t.crashed)); + }, + ), + ], + () => [ + ifConditional( + () => t.score.total > 0, + () => [ + im.Single( + { + totalScore: t.score.total, + combo: t.score.multiplier, + fullCombo: t.score.fullCombo, + perfectCombo: t.score.perfectCombo, + highScore: t.highScore, + fullCombo: t.score.fullCombo, + perfectCombo: t.score.perfectCombo + }, + (e) => { + ((e.totalScore = t.score.total), + (e.combo = t.crashed ? 0 : t.score.multiplier), + (e.highScore = t.highScore), + (e.fullCombo = t.score.fullCombo), + (e.perfectCombo = t.score.perfectCombo) + ); + }, + ), + ], + ), + ], + ), + ifConditional( + () => { + var e; + return ( + null !== + ((null === (e = t.tutorial) || void 0 === e + ? void 0 + : e.textState) || null) + ); + }, + () => [ + sg.Single( + { + text: Zp(t.tutorial.textState, e.isTouchScreen), + y: 50, + }, + (a) => { + a.text = Zp(t.tutorial.textState, e.isTouchScreen); + }, + ), + ], + ), + ifConditional( + () => void 0 !== t.otherPlayersInfo, + () => [ + ng.Single( + { + playerX: t.playerX, + playerY: t.playerY, + cameraY: t.cameraY, + info: t.otherPlayersInfo, + gravity: t.gravity, + }, + (e) => { + ((e.playerX = t.playerX), + (e.playerY = t.playerY), + (e.cameraY = t.cameraY), + (e.info = t.otherPlayersInfo), + (e.gravity = t.gravity)); + }, + ), + ], + ), + t.bossState + ? pg.Single( + { + bossState: t.bossState, + frame: t.frame, + y: e.size.fullHeight / 2 - 100, + }, + (a) => { + ((a.bossState = t.bossState), + (a.frame = t.frame), + (a.y = e.size.fullHeight / 2 - 100)); + }, + ) + : null, + ifConditional( + () => a(Se).settings.showDebug, + () => [ + onChange( + () => t.frame, + () => [ + ((lastFrame = + t.crashed || t.finishedLevel ? lastFrame : t.frame), + null), + c( + { + color: "white", + font: { weight: 500, align: "left" }, + opacity: 0.5, + text: `${lastFrame}`, + }, + (i) => { + ((t.text = `${lastFrame}`), + (i.x = e.size.fullWidth / -2 + 14), + (i.y = e.size.fullHeight / 2 - 100)); + }, + ), + c( + { + color: "white", + font: { weight: 500, align: "left" }, + opacity: 0.5, + text: `${t.justDownInputTimer}`, + }, + (i) => { + ((t.text = `${t.justDownInputTimer}`), + (i.x = e.size.fullWidth / -2 + 14), + (i.y = e.size.fullHeight / 2 - 120)); + }, + ), + c( + { + color: "white", + font: { weight: 500, align: "left" }, + opacity: 0.5, + text: `${t.jumping}`, + }, + (i) => { + ((t.text = `${t.jumping}`), + (i.x = e.size.fullWidth / -2 + 14), + (i.y = e.size.fullHeight / 2 - 140)); + }, + ), + c( + { + color: "white", + font: { weight: 500, align: "left" }, + opacity: 0.5, + text: `${t.playerSpeedMultiplier}`, + }, + (i) => { + ((t.text = `${t.playerSpeedMultiplier}`), + (i.x = e.size.fullWidth / -2 + 14), + (i.y = e.size.fullHeight / 2 - 160)); + }, + ), + c( + { + color: "white", + font: { weight: 500, align: "left" }, + opacity: 0.5, + text: `jumpFrames: ${t.levelSpeeds.jumpFrames}, speed: ${t.levelSpeeds.speed}`, + }, + (i) => { + ((t.text = `jumpFrames: ${t.levelSpeeds.jumpFrames}, speed: ${t.levelSpeeds.speed}`), + (i.x = e.size.fullWidth / -2 + 14), + (i.y = e.size.fullHeight / 2 - 180)); + }, + ), + ], + ), + ], + ), + ]; + }, + }), + dm = makeSprite({ + render({ props: e, device }) { + const t = []; + + return [ + ifConditional( + () => void 0 !== e.otherPlayersInfo, + () => [ + nm.Single( + { info: e.otherPlayersInfo, hasStarted: e.started }, + (t) => { + ((t.info = e.otherPlayersInfo), + (t.hasStarted = e.started)); + }, + ), + ], + ), + tm.Array({ + props: (t) => ({ + object: t, + theme: e.layout.properties.theme.objects.bottom, + }), + update: (e, t) => { + e.object = t; + }, + array: () => e.bottomLineObjects || t, + key: (e, t) => t, + }), + Ja.Single( + { + blocks: e.layout.blocks, + theme: e.layout.properties.theme.objects.block, + inGame: { + blockStates: e.layoutState.blocks, + indexes: e.layoutStateIndex.blocks, + frame: e.frame, + paused: e.paused, + df: e.df, + playerX: e.playerX, + gravity: e.gravity, + fallTypes: e.fallTypes, + }, + indexes: e.layoutStateIndex.blocks, + }, + (t) => { + ((t.blocks = e.layout.blocks), + (t.theme = e.layout.properties.theme.objects.block), + t.theme === "infinite" && (t.theme = getInfiniteThemePath(e.bgColor)), + (t.inGame.blockStates = e.layoutState.blocks), + (t.inGame.indexes = e.layoutStateIndex.blocks), + (t.inGame.frame = e.frame), + (t.inGame.paused = e.paused), + (t.inGame.df = e.df), + (t.inGame.crashed = e.crashed), + (t.inGame.playerX = e.playerX), + (t.inGame.fallTypes = e.fallTypes), + (t.inGame.playerDir = e.playerDir), + (t.inGame.crashed = e.crashed), + (t.inGame.gravity = e.gravity)); + t.indexes = e.layoutStateIndex.blocks; + }, + ), + Za.Single( + { + spikes: e.layout.spikes, + theme: e.layout.properties.theme.objects.spike, + inGame: { + spikeStates: e.layoutState.spikes, + indexes: e.layoutStateIndex.spikes, + frame: e.frame, + paused: e.paused, + df: e.df, + playerX: e.playerX, + fallTypes: e.fallTypes, + gravity: e.gravity, + }, + }, + (t) => { + ((t.spikes = e.layout.spikes), + (t.theme = e.layout.properties.theme.objects.spike), + t.theme === "infinite" && (t.theme = getInfiniteThemePath(e.bgColor)), + (t.inGame.spikeStates = e.layoutState.spikes), + (t.inGame.indexes = e.layoutStateIndex.spikes), + (t.inGame.frame = e.frame), + (t.inGame.paused = e.paused), + (t.inGame.df = e.df), + (t.inGame.crashed = e.crashed), + (t.inGame.playerX = e.playerX), + (t.inGame.playerY = e.playerY), + (t.inGame.crashed = e.crashed), + (t.inGame.fallTypes = e.fallTypes), + (t.inGame.playerDir = e.playerDir), + (t.inGame.gravity = e.gravity)); + }, + ), + Qa.Single( + { + platforms: e.layout.platforms, + theme: e.layout.properties.theme.objects.platform, + indexes: e.layoutStateIndex.platforms, + inGame: { + playerX: e.playerX, + fallTypes: e.fallTypes, + }, + }, + (t) => { + ((t.platforms = e.layout.platforms), + (t.theme = e.layout.properties.theme.objects.platform), + (t.indexes = e.layoutStateIndex.platforms), + (t.inGame.playerX = e.playerX), + (t.inGame.fallTypes = e.fallTypes), + (t.inGame.playerDir = e.playerDir)); + }, + ), + xo.Array({ + props: (t) => ({ + switchButton: t, + switchRotation: e.switchRotation, + switchBlockSpikes: e.switchBlockSpikes, + paused: e.paused, + df: e.df, + justHit: false, + theme: e.layout.properties.theme.objects.switch, + playerScale: e.playerScale, + inGame: { + playerX: e.playerX, + fallTypes: e.fallTypes, + playerDir: e.playerDir, + }, }), - r({ - fillColor: we, - path: [ - [-200, -25], - [175, -25], - [200, 0], - [200, a], - [-175, a], - [-200, 0], - [-200, -25], - ], + update: (t, a, i) => { + ((t.playerScale = e.playerScale), + (t.playerDir = e.playerDir), + (t.switchButton = a), + (t.switchRotation = e.switchRotation), + (t.switchBlockSpikes = e.switchBlockSpikes), + (t.paused = e.paused), + (t.df = e.df), + (t.theme = e.layout.properties.theme.objects.switch), + (t.orbTheme = e.layout.properties.theme.id === "classic" ? "classic" : e.layout.properties.theme.objects.switch), + t.theme === "infinite" && (t.theme = getInfiniteThemePath(e.bgColor)), + (t.justHit = + null !== e.justHitObject && + "switchButtons" === e.justHitObject.array && + (a.affects === "gravity" + ? e.justHitObject.index === i + : true))); + ((t.inGame.playerDir = e.playerDir), + (t.inGame.playerX = e.playerX), + (t.inGame.fallTypes = e.fallTypes)); + }, + array: () => e.layout.switchButtons, + key: (t, a) => e.layoutStateIndex.switchButtons[a], + }), + Po.Single( + { + switchPlatforms: e.layout.switchPlatforms, + indexes: e.layoutStateIndex.switchPlatforms, + theme: e.layout.properties.theme.objects.switch, + inGame: { + playerX: e.playerX, + fallTypes: e.fallTypes, + }, + }, + (t) => { + ((t.switchPlatforms = e.layout.switchPlatforms), + (t.indexes = e.layoutStateIndex.switchPlatforms)); + ((t.theme = e.layout.properties.theme.objects.switch), + (t.inGame.playerX = e.playerX), + (t.inGame.fallTypes = e.fallTypes), + (t.inGame.playerDir = e.playerDir)); + }, + ), + $o.Array({ + props: (t) => ({ + spring: t, + justHit: false, + df: e.df, + paused: e.paused, + inGame: { + playerX: e.playerX, + fallTypes: e.fallTypes, + }, }), - r({ - fillColor: ve, - path: [ - [-200, 0], - [-175, a], - [-70, a], - [-70, -10], - [-200, -10], - [-200, 0], - ], + update: (t, a, i) => { + ((t.spring = a), + (t.justHit = + null !== e.justHitObject && + "springs" === e.justHitObject.array && + e.justHitObject.index === i), + (t.df = e.df), + (t.paused = e.paused), + (t.inGame.playerX = e.playerX), + (t.inGame.fallTypes = e.fallTypes), + (t.inGame.playerDir = e.playerDir)); + }, + array: () => e.layout.springs, + key: (t, a) => e.layoutStateIndex.springs[a], + }), + Jo.Array({ + props: (t) => ({ + portal: t, + paused: e.paused, + df: e.df, + theme: e.layout.properties.theme.objects.switch, + inGame: { + playerX: e.playerX, + fallTypes: e.fallTypes, + playerDir: e.playerDir, + }, }), - n({ - text: "LEVEL NAME", - color: Be, - font: { align: "left", size: 13 }, - x: -175, - y: 5, + update: (t, a) => { + ((t.portal = a), + (t.df = e.df), + (t.paused = e.paused), + (t.theme = e.layout.properties.theme.objects.switch), + (t.inGame.playerX = e.playerX), + (t.inGame.fallTypes = e.fallTypes), + (t.inGame.playerDir = e.playerDir)); + }, + key: (t, a) => e.layoutStateIndex.portals[a], + array: () => e.layout.portals, + }), + Zs.Array({ + props: (t, a) => ({ + directionChange: t, + theme: e.layout.properties.theme.objects.dirChange, + wasHit: e.layoutState.directionChanges[a].wasHit, + paused: e.paused, + df: e.df, + inGame: { + playerX: e.playerX, + fallTypes: e.fallTypes, + }, }), - P({ - id: "NameInput", - fontName: "Montserrat", - fontSize: 15, - text: e, - onChangeText: t, - color: Be, - align: "left", - width: 200, - x: 50, - y: 90, + update: (t, a, i) => { + ((t.directionChange = a), + (t.df = e.df), + (t.paused = e.paused), + (t.theme = e.layout.properties.theme.objects.dirChange), + (t.wasHit = e.layoutState.directionChanges[i].wasHit), + (t.inGame.playerX = e.playerX), + (t.inGame.fallTypes = e.fallTypes), + (t.inGame.playerDir = e.playerDir)); + }, + key: (t, a) => e.layoutStateIndex.directionChanges[a], + array: () => e.layout.directionChanges, + }), + er.Array({ + props: (t) => ({ + speedChange: t, + justHit: false, + previousJustHit: false, + df: e.df, + paused: e.paused, + theme: e.layout.properties.theme.objects.speedChange, + inGame: { + playerX: e.playerX, + fallTypes: e.fallTypes, + }, }), - ]; - }, - }), - Pf = function (e, t) { - const a = (660 - t.x) / t.scale, - i = (-t.x - 660) / t.scale, - n = (450 - t.y) / t.scale, - s = (-t.y - 450) / t.scale, - o = (e) => - (function (e, t, a, i, n, s) { - return e < a && e > i && t < n && t > s; - })(e.x, e.y, a, i, n, s); - return { - properties: e.properties, - blocks: e.blocks.filter(o), - spikes: e.spikes.filter(o), - platforms: e.platforms.filter(o), - directionChanges: e.directionChanges.filter(o), - speedChanges: e.speedChanges.filter(o), - saws: e.saws.filter(o), - flags: e.flags.filter(o), - powerups: e.powerups.filter(o), - enemies: [...e.enemies], - switchButtons: e.switchButtons.filter(o), - switchPlatforms: e.switchPlatforms.filter(o), - springs: e.springs.filter(o), - portals: e.portals.filter(o), - collectibles: e.collectibles.filter(o), - }; - }, - Mf = function (e, t, a, i) { - const { - frame: n, - layoutState: s, - switchButtons: o, - jumpSwitch: r, - playerX: l, - fallTypes, - } = t[a], - { jumpFrames: c } = _r(e), - d = Ca.clone(i); - return ( - Ca.setLayoutAtTime( - d, - s.enemies, - l, - n, - c, - o.rot, - r.ratio, - fallTypes, + update: (t, a, i) => { + t.speedChange = a; + t.previousJustHit = + null == e.justHitObject + ? false + : t.previousJustHit || t.justHit; + t.justHit = + null !== e.justHitObject && + "speedChanges" === e.justHitObject.array && + e.justHitObject.index === i; + if (t.previousJustHit == true) { + t.justHit = false; + } + t.df = e.df; + t.paused = e.paused; + ((t.inGame.playerX = e.playerX), + (t.inGame.fallTypes = e.fallTypes), + (t.inGame.playerDir = e.playerDir)); + }, + array: () => e.layout.speedChanges, + key: (t, a) => e.layoutStateIndex.speedChanges[a], + }), + eo.Single( + { + saws: e.layout.saws, + theme: e.layout.properties.theme.objects.saw, + bigTheme: e.layout.properties.theme.objects.spike, + inGame: { + sawStates: e.layoutState.saws, + indexes: e.layoutStateIndex.saws, + frame: e.frame, + paused: e.paused, + df: e.df, + playerX: e.playerX, + fallTypes: e.fallTypes, + }, + bgColor: e.bgColor, + }, + (t) => { + ((t.saws = e.layout.saws), + (t.bigTheme = e.layout.properties.theme.objects.spike), + (t.theme = e.layout.properties.theme.objects.saw), + t.theme === "infinite" && (t.theme = getInfiniteThemePath(e.bgColor)), + t.bigTheme === "infinite" && (t.bigTheme = getInfiniteThemePath(e.bgColor)), + (t.bgColor = getInfiniteThemeColors(e.bgColor)), + (t.inGame.sawStates = e.layoutState.saws), + (t.inGame.indexes = e.layoutStateIndex.saws), + (t.inGame.frame = e.frame), + (t.inGame.paused = e.paused), + (t.inGame.df = e.df), + (t.inGame.playerX = e.playerX), + (t.inGame.fallTypes = e.fallTypes), + (t.inGame.playerDir = e.playerDir)); + }, ), - d - ); - }; - var Lf = function (e, t, a, i) { - return new (a || (a = Promise))(function (n, s) { - function o(e) { - try { - l(i.next(e)); - } catch (e) { - s(e); - } - } - function r(e) { - try { - l(i.throw(e)); - } catch (e) { - s(e); - } - } - function l(e) { - var t; - e.done - ? n(e.value) - : ((t = e.value), - t instanceof a - ? t - : new a(function (e) { - e(t); - })).then(o, r); - } - l((i = i.apply(e, t || [])).next()); - }); - }; - const allFeatures = [ - "doubleJump", - "flyingEnemy", - "gun", - "jetpack", - "moveOnJump", - "saws", - "walkingEnemy", - "switchButton", - "playerStacks", - "collectible", - "spring", - "fallingPlatform", - "portals", - "skateboard", - "switchBlockSpike", - "punch", - "giantEnemy", - "speedChange", - "arrows", - ], - Df = makeCustomSprite({ - init({ props: e, updateState: t }) { - (!(function (e) { - Jp.getUserItems("editor") - .then((t) => { - const a = t.filter(kp.isEditorItem).map((e) => e.feature), - i = [ - ca.world1, - ...rt(t.filter(kp.isThemeItem).map((e) => e.theme)), - ].sort((e, t) => e.name.localeCompare(t.name)); - e((e) => - Object.assign(Object.assign({}, e), { - unlockedFeatures: { - type: "loaded", - editor: [...a, ...Tr], - themes: [...i, ...Rr], + ao.Array({ + array: () => e.layout.flags, + props: (t, a) => ({ + flag: t, + theme: e.layout.properties.theme.objects.flag, + inGame: { + wasHit: e.layoutState.flags[a].wasHit, + frame: e.frame, + paused: e.paused, + df: e.df, + isFlying: e.isFlyingLevel, + index: a, + playerX: e.playerX, + fallTypes: e.fallTypes, + }, + }), + update: (t, a, i) => { + ((t.flag = a), + (t.theme = e.layout.properties.theme.objects.flag), + (t.inGame.wasHit = e.layoutState.flags[i].wasHit), + (t.inGame.frame = e.frame), + (t.inGame.paused = e.paused && !e.finishedLevel), + (t.inGame.df = e.df), + (t.inGame.playerX = e.playerX), + (t.inGame.fallTypes = e.fallTypes), + (t.inGame.playerDir = e.playerDir)); + }, + key: (t, a) => e.layoutStateIndex.flags[a], + }), + Co.Array({ + array: () => e.layout.powerups, + props: (t) => ({ + powerup: t, + skin: e.playerSkin, + frame: e.frame, + paused: e.paused, + df: e.df, + theme: e.layout.properties.theme.objects.speedChange, + inGame: { + playerX: e.playerX, + fallTypes: e.fallTypes, + }, + }), + filter: (t, a) => !e.layoutState.powerups[a]?.wasPickedUp, + update: (t, a) => { + ((t.powerup = a), + (t.frame = e.frame), + (t.paused = e.paused && !e.finishedLevel), + (t.df = e.df), + (t.theme = e.layout.properties.theme.objects.speedChange), + (t.skin = e.playerSkin), + (t.inGame.playerX = e.playerX), + (t.inGame.fallTypes = e.fallTypes), + (t.inGame.playerDir = e.playerDir)); + }, + key: (t, a) => e.layoutStateIndex.powerups[a], + }), + e.bossState + ? ug.Single( + { + bossState: e.bossState, + frame: e.frame, + paused: e.paused, + playerX: e.playerX, + playerRot: e.playerRot, + playerCrashed: e.crashed, + df: e.df, + }, + (t) => { + ((t.bossState = e.bossState), + (t.frame = e.frame), + (t.paused = e.paused), + (t.playerX = e.playerX), + (t.playerRot = e.playerRot), + (t.playerCrashed = e.crashed), + (t.df = e.df)); + }, + ) + : null, + fo.Array({ + props: (t, a) => ({ + enemy: t, + enemyState: e.layoutState.enemies[a], + isBoss: null !== e.bossState, + jumpFrames: e.jumpFrames, + df: e.df, + frame: e.frame, + playerCrashed: e.crashed, + paused: e.paused, + playerX: e.playerX, + playerY: e.playerY, + playerDir: e.playerDir, + fallTypes: e.fallTypes, + }), + update: (t, a, i) => { + ((t.enemy = a), + (t.enemyState = e.layoutState.enemies[i]), + (t.df = e.df), + (t.frame = e.frame), + (t.playerCrashed = e.crashed), + (t.paused = e.paused), + (t.playerX = e.playerX), + (t.playerY = e.playerY), + (t.playerDir = e.playerDir), + (t.fallTypes = e.fallTypes)); + }, + array: () => e.layout.enemies, + key: (t, a) => e.layoutStateIndex.enemies[a], + }), + ifConditional( + () => void 0 !== e.otherPlayersInfo, + () => [ + rm.Single( + { + info: e.otherPlayersInfo, + playerX: e.playerX, + playerY: e.playerY, + playerName: e.playerName, + crashed: e.crashed, + hasStarted: e.started, + }, + (t) => { + ((t.info = e.otherPlayersInfo), + (t.playerX = e.playerX), + (t.playerY = e.playerY), + (t.playerName = e.playerName), + (t.crashed = e.crashed)); + }, + ), + ], + ), + conditional( + () => e.playerPowerups.length > 0, + () => [ + Ao.Single( + { + x: e.playerX, + y: e.playerY, + scaleX: e.playerDir * e.playerScale, + scaleY: e.playerScale, + powerup: e.playerPowerups[0] || null, + isJetpack: e.playerPowerups.some( + (e) => e.item === "jetpack", + ), + isSkating: e.playerPowerups.some( + (e) => e.item === "skateboard", + ), + isUsing: e.playerUsingPowerup, + playerRot: e.playerRot * e.playerDir, + playerDir: e.playerDir, + playerScaleY: e.playerScaleY, + playerIsOnGround: 0 === e.playerGradY, + jumping: e.playerJumping, + jetpackFuel: e.playerJetpackFuel, + frame: e.frame, + paused: e.paused, + df: e.df, + crashed: e.crashed, + }, + (t) => { + ((t.x = e.playerX), + (t.y = e.playerY), + (t.scaleX = e.playerDir * e.playerScale), + (t.scaleY = e.playerScale), + (t.powerup = e.playerPowerups[0] || null), + (t.isJetpack = e.playerPowerups.some( + (e) => e.item === "jetpack", + )), + (t.isSkating = e.playerPowerups.some( + (e) => e.item === "skateboard", + )), + (t.isUsing = e.playerUsingPowerup), + (t.playerRot = e.playerRot * e.playerDir), + (t.playerDir = e.playerDir), + (t.playerScaleY = e.playerScaleY), + (t.playerIsOnGround = 0 === e.playerGradY), + (t.jumping = e.playerJumping), + (t.jetpackFuel = e.playerJetpackFuel), + (t.frame = e.frame), + (t.paused = e.paused), + (t.df = e.df), + (t.crashed = e.crashed)); + }, + ), + ], + () => [ + ifConditional( + () => null !== e.playerPowerupOut, + () => [ + No.Single( + { + x: e.playerX, + y: e.playerY, + scaleX: e.playerDir * e.playerScale, + scaleY: e.playerScale, + powerup: e.playerPowerupOut, + playerRot: e.playerRot, + playerDir: e.playerDir, + df: e.df, + }, + (t) => { + ((t.x = e.playerX), + (t.y = e.playerY), + (t.scaleX = e.playerDir * e.playerScale), + (t.scaleY = e.playerScale), + (t.powerup = e.playerPowerupOut), + (t.playerRot = e.playerRot), + (t.playerDir = e.playerDir), + (t.df = e.df)); + }, + ), + ], + ), + ], + ), + bulletSprite.Array({ + props: (t) => ({ + x: t.x, + y: t.y, + bullet: t, + isEnemy: false, + removeBullet: () => + e.playerBullets && + e.playerBullets.splice(e.playerBullets.indexOf(t), 1), + }), + update: (a, t) => { + ((a.x = t.x), + (a.y = getBlockFallY( + t.x, + t.y, + e.playerX, + e.fallTypes, + e.playerDir, + )), + (a.bullet = t)); + }, + array: () => e.playerBullets, + key: (e, t) => t, + }), + conditional( + () => + e.isFlyingLevel || + e.playerPowerups.some((e) => e.item === "spaceship"), + () => [ + onChange( + () => e.attempt, + () => [ + flyingTrail.Single( + { + playerX: e.playerX, + playerY: e.playerY, + playerDir: e.playerDir, + crashed: e.crashed, + paused: e.paused, + colour: "#FCDA45", + frame: e.frame, + df: e.df, + }, + (t) => { + ((t.playerX = e.playerX), + (t.playerY = e.playerY), + (t.playerDir = e.playerDir), + (t.crashed = e.crashed || e.bossState?.playerDestroyed), + (t.paused = e.paused), + (t.frame = e.frame), + (t.df = e.df)); }, - }), - ); - }) - .catch((t) => { - (console.error(t), - e((e) => - Object.assign(Object.assign({}, e), { - unlockedFeatures: { - type: "error", - message: t instanceof Error ? t.message : String(t), - }, - }), - )); - }); - })(t), - kf(e.savedLevel.level.song.fileName).then((e) => { - t((t) => - Object.assign(Object.assign({}, t), { waveformData: e }), - ); - })); - const a = e.savedLevel.level.layout, - i = - e.savedLevel.settings.runHistory[ - e.savedLevel.settings.runHistoryIndex - ], - n = xa.sortLayoutState(i.layoutState, a), - { - viewOffset: s, - runHistory: o, - runHistoryIndex: r, - } = e.savedLevel.settings, - l = Pf(a, s), - c = Mf(e.savedLevel.level, o, r, l); - return { - view: "editing", - unlockedFeatures: { type: "loading" }, - levelEditorSettings: { viewOffset: s, actionHistory: [] }, - levelName: e.savedLevel.level.name, - layout: a, - sortedLayout: Ca.sortLayout(a), - sortedLevelState: el(i, n.sortedState), - sortedLayoutStateOriginalIndexes: n.originalIndexes, - runHistory: o, - runHistoryIndex: r, - themeLoaded: false, - initRunHistoryIndex: e.savedLevel.settings.runHistoryIndex, - waveformData: null, - inViewLayout: l, - inViewLayoutAtTime: c, - }; - }, - render({ - props: e, - state: t, - updateState: a, - device: i, - getContext: s, - }) { - const r = i.size.width + 2 * i.size.widthMargin, - l = i.size.height + 2 * i.size.heightMargin, - c = t.layout.properties.theme, - d = Yf({ - id: `ThemeLoader-${c.id}`, - theme: c, - onLoad: () => { - a((e) => - Object.assign(Object.assign({}, e), { - themeLoaded: true, - }), - ); - }, - }); - if ("loaded" !== t.unlockedFeatures.type) - return [ - d, - o({ width: r, height: l, color: "#091045" }), - Fo({ - id: "BackButton", - text: localize("BACK"), - width: 80, - height: 40, - onPress: e.backToMenu, - y: -50, - }), - ...("loading" === t.unlockedFeatures.type - ? [ - n({ - text: `${localize("LOADING")}...`, - color: ve, - font: { size: 15 }, - }), - ] - : [ - n({ - text: `ERROR LOADING EDITOR: ${t.unlockedFeatures.message}`, - color: Ve, - font: { size: 15 }, - }), - ]), - ]; - if ("menu" === t.view) - return [ - d, - Nf({ - id: "LevelEditorMenu", - viewOffset: t.levelEditorSettings.viewOffset, - levelName: t.levelName, - onChangeText: (e) => { - a((t) => - Object.assign(Object.assign({}, t), { levelName: e }), - ); + ), + ], + ), + ], + () => [ + playerTrail.Single( + { + playerX: e.playerX, + playerY: e.playerY, + playerDir: e.playerDir, + crashed: e.crashed, + paused: e.paused, + skin: e.playerSkin, + isFront: false, + attempt: e.attempt, + touchingPortals: null !== e.touchingPortals, + playerScale: e.playerScale, }, - onPressEdit: () => { - a((e) => - Object.assign(Object.assign({}, e), { - view: "editing", + (t) => { + ((t.playerSpeedMultiplier = e.playerSpeedMultiplier), + (t.playerScale = e.playerScale), + (t.playerX = e.playerX), + (t.playerY = e.playerY), + (t.playerDir = e.playerDir), + (t.crashed = e.crashed || e.hidePlayer), + (t.paused = e.paused), + (t.attempt = e.attempt), + (t.touchingPortals = null !== e.touchingPortals), + (t.skin = Object.assign({}, e.playerSkin)), + (t.skin.trail = Object.assign({}, e.playerSkin.trail)), + (e.layout.properties.theme.id === "infinite") && ["world1", "default", "headphone"].includes(t.skin.fileName) && (t.skin.trail = { + form: "default", + topColour: getInfinitePlayerColors(e.bgColor), + bottomColour: getInfinitePlayerColors(e.bgColor), }), + (t.theme = e.layout.properties.theme.id), + (t.playerRot = e.playerRot) ); }, - onSave: () => - Lf(this, void 0, void 0, function* () { - const a = Object.assign( - Object.assign({}, e.savedLevel.level), - { name: t.levelName, layout: t.layout }, - ), - n = yield Jp.saveLevel( - i.storage, - i.now, - a, - i.alert, - t.levelEditorSettings.viewOffset, - t.runHistory, - t.runHistoryIndex, - t.initRunHistoryIndex, - ), - { online: o } = s(Se); - o && - o.signedInAccount && - (yield bp.updateLevelsStorage( - o.backend, - n.data.map(({ level: e }) => e), - i.now, - )); - }), - onPressExport: (choice) => - Lf(this, void 0, void 0, function* () { - const a = Object.assign( - Object.assign({}, e.savedLevel.level), + ), + ], + ), + g({ + props: (t) => ({ + color: e.playerSkin.trail.topColour, + width: 30, + height: 30, + x: t.x, + y: t.y, + opacity: 0.4 + }), + update: (a, t) => { + a.x = t.x; + a.y = t.y; + a.rotation = e.frame; + }, + array: () => e.boosterDebug ? e.boosterDebug.jumpIndicators : [], + }), + imageArray({ + fileName: "images/level/flag.png", + props: (t) => ({ + width: 30, + height: 60, + x: t.x, + y: t.y + 15, + }), + update: (a, t) => { + a.x = t.state.playerX; + a.y = t.state.playerY + 15 + (-15 * t.state.playerScale) + 15; + }, + array: () => e.checkpoints, + }), + ifConditional( + () => !e.hidePlayer, + () => [ + conditional( + () => e.crashed || e.bossState?.playerDestroyed, + () => [ + qa.Single( + { + x: e.playerX, + y: e.playerY, + justDestroyed: true, + paused: e.paused, + trail: + e.flyingAnchor === null && !e.isFlyingLevel + ? e.playerSkin.trail + : { + form: "default", + topColour: "#FCDA45", + bottomColour: "#FCDA45", + }, // for now, hehehe... + playerRot: e.playerRot, + playerScale: e.playerScale, + df: e.df, + }, + (t) => { + ( + (t.paused = e.paused), + (t.df = e.df), + (t.trail = ["world1", "default", "headphone"].includes(e.playerSkin.fileName) && e.layout.properties.theme.id === "infinite" ? + { + form: "default", + topColour: getInfinitePlayerColors(e.bgColor), + bottomColour: getInfinitePlayerColors(e.bgColor), + } + : e.flyingAnchor === null && !e.isFlyingLevel + ? e.playerSkin.trail + : { + form: "default", + topColour: "#FCDA45", + bottomColour: "#FCDA45", + }) + ); + }, + ), + ], + () => [ + conditional( + () => null !== e.touchingPortals, + () => [ + Kg.Single( { - name: t.levelName, - layout: Ca.sortLayout(t.layout), + x: e.playerX, + y: e.playerY, + playerX: e.playerX, + playerY: e.playerY, + landTimer: e.landTimer, + skin: e.playerSkin, + playerDir: e.playerDir, + playerRot: e.playerRot, + playerScaleX: e.playerScaleX, + playerScaleY: e.playerScaleY, + playerScale: e.playerScale, + onSkateboard: false, + touchingPortals: e.touchingPortals, + isFlying: e.playerPowerups.some( + (e) => e.item === "spaceship", + ), }, - ), - n = wf(a, i.now); - if (choice !== 1) - return ( - i.clipboard.copy(n, (e) => { - if (e) - return ( - i.alert.ok( - `${localize("Error copying level JSON to clipboard:")} ${e.message}`, - ), - void i.log(n) - ); - i.alert.ok( - localize("Level JSON copied to clipboard. (Upload your levels to userlevels.com)"), + (t) => { + var a; + const i = e.playerPowerups.some( + (e) => e.item === "skateboard", ); - }), - true - ); - try { - return yield zu.saveFile(`${a.name}.json`, n, "application/json"); - } catch (e) { - return ( - i.alert.ok(`Error saving file: ${e.message}`), - i.log(n), - false - ); - } - }), - onPressMenu: e.backToMenu, - }), - ]; - if ("editing" === t.view) { - const i = (i) => { - if ("undo" !== i.type) - a((t) => { - const a = Ba(i, t.layout, t.runHistory), - n = Pf(a.layout, t.levelEditorSettings.viewOffset), - s = Mf( - e.savedLevel.level, - a.runHistory, - t.runHistoryIndex, - n, - ); - return Object.assign(Object.assign({}, t), { - layout: a.layout, - runHistory: a.runHistory, - levelEditorSettings: Object.assign( - Object.assign({}, t.levelEditorSettings), - { - actionHistory: [ - Fa(i, t.layout), - ...t.levelEditorSettings.actionHistory.slice( - 0, - 100, + ((t.x = e.playerX), + (t.y = e.playerY), + (t.playerX = e.playerX), + (t.playerY = e.playerY), + (t.landTimer = e.landTimer), + (t.playerDir = e.playerDir), + (t.playerRot = e.playerRot), + (t.playerScaleX = e.playerScaleX), + (t.playerScale = e.playerScale), + (t.playerScaleY = e.playerScaleY), + (t.onSkateboard = i), + (t.isInfinite = e.layout.properties.theme.id === "infinite"), + (t.bgColor = e.bgColor), + (t.touchingPortals = e.touchingPortals)); + }, + ), + ], + () => [ + conditional( + () => + e.isFlyingLevel || + e.playerPowerups.some( + (e) => e.item === "spaceship", + ), + () => [ + y( + { + fileName: + "images/level/boss3/player-ship.png", + width: 40, + height: 30, + }, + (t) => { + ((t.x = e.playerX), + (t.y = e.playerY), + (t.rotation = e.playerRot), + (t.scaleX = e.playerScaleX * e.playerDir), + (t.scaleY = e.playerScaleY)); + }, ), ], - }, - ), - inViewLayout: n, - inViewLayoutAtTime: s, - themeLoaded: !a.newAssets, - }); - }); - else { - if (0 === t.levelEditorSettings.actionHistory.length) - return; - const [i, ...n] = t.levelEditorSettings.actionHistory; - a((t) => { - const a = (function (e, t, a) { - switch (e.type) { - case "undoPlaceObjects": - return Ba( - Object.assign(Object.assign({}, e), { - type: "eraseObjects", - }), - t, - a, - ); - case "undoMoveObjects": - return Ba( - Object.assign(Object.assign({}, e), { - type: "moveObjects", + () => [ + To.Single({ skin: e.playerSkin }, (t) => { + var a; + ((t.x = e.playerX), + (t.y = e.playerY), + (t.rotation = e.playerRot), + (t.scaleX = e.playerScaleX * e.playerDir), + (t.scaleY = e.playerScaleY), + (t.skin = e.playerSkin), + (t.isInfinite = e.layout.properties.theme.id === "infinite"), + (t.bgColor = e.bgColor), + (t.opacity = e.playerPowerups.some( + (e) => e.item == "ghost", + ) + ? 0.5 + : 1), + (t.landTimer = e.landTimer)); + t.onSkateboard = e.playerPowerups.some( + (e) => e.item === "skateboard", + ); + }), + ], + ), + ], + ), + conditional( + () => e.playerPowerups.length > 0, + () => [ + conditional( + () => + e.playerPowerups.some( + (e) => e.item === "playerStack", + ), + () => [ + playerTrail.Array({ + props: ({ y: t }) => ({ + skin: e.playerSkin, + playerX: e.playerX, + playerY: t, + playerDir: e.playerDir, + crashed: false, + paused: e.paused, + isFront: false, + attempt: e.attempt, + touchingPortals: null !== e.touchingPortals, + playerScale: e.playerScale, }), - t, - a, - ); - case "undoSetProperty": - return Ba( - { - type: "setProperty", - array: e.array, - index: e.index, - set: () => e.object, + update: (t, { y: a }) => { + ((t.playerSpeedMultiplier = + e.playerSpeedMultiplier), + (t.playerScale = e.playerScale), + (t.playerX = e.playerX), + (t.playerY = a), + (t.playerDir = e.playerDir), + (t.paused = e.paused), + (t.attempt = e.attempt), + (t.touchingPortals = + null !== e.touchingPortals), + (t.skin = Object.assign({}, e.playerSkin)), + (t.skin.trail = Object.assign({}, e.playerSkin.trail)), + (e.layout.properties.theme.id === "infinite") && ["world1", "default", "headphone"].includes(t.skin.fileName) && (t.skin.trail = { + form: "default", + topColour: getInfinitePlayerColors(e.bgColor), + bottomColour: getInfinitePlayerColors(e.bgColor), + }), + (t.theme = e.layout.properties.theme.id), + (t.playerRot = e.playerRot) + ); }, - t, - a, - ); - case "undoEraseObjects": - return Ba( - Object.assign(Object.assign({}, e), { - type: "placeObjects", + array: () => e.playerStacks, + key: (e, t) => t, + }), + To.Array({ + props: () => ({ skin: e.playerSkin }), + update: (t, { y: a }) => { + ((t.x = e.playerX), + (t.y = a), + (t.scaleX = + e.playerDir * + (e.isCompatible ? 1 : e.playerScale)), + (t.scaleY = e.isCompatible + ? 1 + : e.playerScale), + (t.isInfinite = e.layout.properties.theme.id === "infinite"), + (t.bgColor = e.bgColor)); + }, + array: () => e.playerStacks, + key: (e, t) => t, + }), + playerTrail.Array({ + props: ({ y: t }) => ({ + skin: e.playerSkin, + playerX: e.playerX, + playerY: t, + playerDir: e.playerDir, + crashed: false, + paused: e.paused, + isFront: true, + playerScale: e.playerScale, }), - t, - a, - ); - case "undoChangeTheme": - return Ba( - Object.assign(Object.assign({}, e), { - type: "changeTheme", + update: (t, { y: a }) => { + ((t.playerSpeedMultiplier = + e.playerSpeedMultiplier), + (t.playerScale = e.playerScale), + (t.playerX = e.playerX), + (t.playerY = a), + (t.playerDir = e.playerDir), + (t.paused = e.paused), + (t.attempt = e.attempt), + (t.skin = Object.assign({}, e.playerSkin)), + (t.skin.trail = Object.assign({}, e.playerSkin.trail)), + (e.layout.properties.theme.id === "infinite") && ["world1", "default", "headphone"].includes(t.skin.fileName) && (t.skin.trail = { + form: "default", + topColour: getInfinitePlayerColors(e.bgColor), + bottomColour: getInfinitePlayerColors(e.bgColor), + }), + (t.theme = e.layout.properties.theme.id), + (t.playerRot = e.playerRot) + ); + }, + array: () => e.playerStacks, + key: (e, t) => t, + }), + (t.scaleX = e.playerDir * e.playerScale), + (t.scaleY = e.playerScale), + (t.isUsing = e.playerUsingPowerup), + (t.playerRot = e.playerRot * e.playerDir), + wo.Array({ + props: ({ y }) => ({ + powerup: e.playerPowerups[0], + x: e.playerX, + y: y, + scaleX: e.playerDir * e.playerScale, + scaleY: e.playerScale, + isUsing: e.playerUsingPowerup, + playerRot: e.playerRot * e.playerDir, + paused: e.paused, + df: e.df, }), - t, - a, - ); - } - })(i, t.layout, t.runHistory), - s = Pf(a.layout, t.levelEditorSettings.viewOffset), - o = Mf( - e.savedLevel.level, - a.runHistory, - t.runHistoryIndex, - s, - ); - return Object.assign(Object.assign({}, t), { - layout: a.layout, - runHistory: a.runHistory, - levelEditorSettings: Object.assign( - Object.assign({}, t.levelEditorSettings), - { actionHistory: n }, - ), - inViewLayout: s, - inViewLayoutAtTime: o, - themeLoaded: !a.newAssets, - }); - }); - } - }; - return [ - d, - o({ - width: r, - height: l, - color: t.layout.properties.theme.colour, - }), - ...(s(Se).settings.animateEditor && t.themeLoaded - ? [ - xg.Single( - { - id: "Background", - theme: t.layout.properties.theme, - cameraX: - -t.levelEditorSettings.viewOffset.x / - t.levelEditorSettings.viewOffset.scale, - cameraY: - -t.levelEditorSettings.viewOffset.y / - t.levelEditorSettings.viewOffset.scale, - paused: false, - switchBlockSpikes: - t.runHistory[t.runHistoryIndex].switchBlockSpikes, - playerScale: - t.runHistory[t.runHistoryIndex].playerScale, - bgColor: t.runHistory[t.runHistoryIndex].bgColor, - flash: 0, - speedMultiplier: - t.runHistory[t.runHistoryIndex] - .playerSpeedMultiplier, - plain: s(Se).settings.plainBackground, - frame: - t.levelEditorSettings.viewOffset.x + - t.levelEditorSettings.viewOffset.y, - jumpFrames: t.jumpFrames, - playerDir: 1, - crashed: false, - gravity: 1, - dashing: false, - isGravity: false, - scaleX: Math.max( - 1, - t.levelEditorSettings.viewOffset.scale, - ), - scaleY: Math.max( - 1, - t.levelEditorSettings.viewOffset.scale, - ), - }, - (e) => { - ((e.theme = t.layout.properties.theme), - (e.cameraX = - -t.levelEditorSettings.viewOffset.x / - t.levelEditorSettings.viewOffset.scale), - (e.cameraY = - -t.levelEditorSettings.viewOffset.y / - t.levelEditorSettings.viewOffset.scale), - (e.paused = t.paused), - (e.speedMultiplier = - t.runHistory[ - t.runHistoryIndex - ].playerSpeedMultiplier), - (e.bgColor = - t.runHistory[t.runHistoryIndex].bgColor), - (e.switchBlockSpikes = - t.runHistory[ - t.runHistoryIndex - ].switchBlockSpikes), - (e.playerScale = - t.runHistory[t.runHistoryIndex].playerScale), - (e.frame = 0), - (e.jumpFrames = t.jumpFrames), - (e.scaleX = Math.max( - 1, - t.levelEditorSettings.viewOffset.scale, - )), - (e.scaleY = Math.max( - 1, - t.levelEditorSettings.viewOffset.scale, - ))); - }, - ), - ] - : [ - o({ - color: infiniteBgTable( - 0, - t.runHistory[t.runHistoryIndex].bgColor || - "#00FFFF", + update: (t, a) => { + ((t.powerup = e.playerPowerups[0]), + (t.x = e.playerX), + (t.y = a.y), + (t.paused = e.paused), + (t.df = e.df)); + }, + array: () => e.playerStacks, + key: (e, t) => t, + }), + ], + () => [], ), - width: r, - height: l, - show: t.layout.properties.theme.id === "infinite", - }), - o({ - color: "#250b05", - width: r, - height: l, - show: - t.layout.properties.theme.id === "dreamy" && - t.runHistory[t.runHistoryIndex] - .switchBlockSpikes === - (t.runHistory[t.runHistoryIndex].playerScale === - 1), - }), - o({ - color: "#9D0808", - width: r, - height: l, - opacity: Math.min( - 0.5, - t.runHistory[t.runHistoryIndex] - .playerSpeedMultiplier / 10, + wo.Single( + { + powerup: e.playerPowerups.filter( + (e) => e.item != "playerStack", + )[0], + x: e.playerX, + y: e.playerY, + scaleX: e.playerDir * e.playerScale, + scaleY: e.playerScale, + isUsing: e.playerUsingPowerup, + playerRot: e.playerRot * e.playerDir, + paused: e.paused, + df: e.df, + }, + (t) => { + ((t.powerup = e.playerPowerups.filter( + (e) => e.item != "playerStack", + )[0]), + (t.x = e.playerX), + (t.y = e.playerY), + (t.scaleX = e.playerDir * e.playerScale), + (t.scaleY = e.playerScale), + (t.isUsing = e.playerUsingPowerup), + (t.playerRot = e.playerRot * e.playerDir), + (t.paused = e.paused), + (t.df = e.df)); + }, ), - show: t.layout.properties.theme.id === "speed", - }), - o({ - color: - t.runHistory[t.runHistoryIndex].bgColor || - "#00FFFF", - width: r, - height: l, - show: t.layout.properties.theme.id === "classic", + ], + () => [], + ), + ], + ), + ], + ), + ifConditional( + () => null !== e.playerPowerupOut, + () => [ + onChange( + () => e.playerPowerupOut, + () => [ + ko.Single( + { + x: e.playerX, + y: e.playerY, + scaleX: e.playerDir * e.playerScale, + scaleY: e.playerScale, + powerup: e.playerPowerupOut, + playerRot: e.playerRot, + playerDir: e.playerDir, + playerScale: e.playerScale, + paused: e.paused, + df: e.df, + }, + (t) => { + ((t.x = e.playerX), + (t.y = e.playerY), + (t.scaleX = e.playerDir * e.playerScale), + (t.scaleY = e.playerScale), + (t.powerup = e.playerPowerupOut), + (t.playerRot = e.playerRot), + (t.playerDir = e.playerDir), + (t.playerScale = e.playerScale), + (t.paused = e.paused), + (t.df = e.df)); + }, + ), + ko.Array({ + props: ({ y }) => ({ + x: e.playerX, + y: y, + scaleX: e.playerDir * e.playerScale, + scaleY: e.playerScale, + powerup: e.playerPowerupOut, + playerRot: e.playerRot, + playerDir: e.playerDir, + playerScale: e.playerScale, + paused: e.paused, + df: e.df, }), - o({ - color: "black", - width: r, - height: l, - opacity: 0.3, - show: t.layout.properties.theme.id === "classic", + update: (t, a) => { + ((t.x = e.playerX), + (t.y = a.y), + (t.scaleX = e.playerDir * e.playerScale), + (t.scaleY = e.playerScale), + (t.powerup = e.playerPowerupOut), + (t.playerRot = e.playerRot), + (t.playerDir = e.playerDir), + (t.playerScale = e.playerScale), + (t.paused = e.paused), + (t.df = e.df)); + }, + array: () => e.playerStacks, + key: (e, t) => t, + }), + ], + ), + ], + ), + ifConditional( + () => e.playerPowerups.length > 1, + () => [ + c( + { + text: `x${e.playerPowerups.length}`, + color: Te, + strokeColor: He, + strokeThickness: 4, + font: { size: 20 }, + x: e.playerX, + y: e.playerY + 40, + }, + (t) => { + t.x = e.playerX; + t.y = e.playerY + 40; + t.text = `x${e.playerPowerups.length}`; + }, + ), + ], + ), + ifConditional( + () => + !( + e.isFlyingLevel || + e.playerPowerups.some((e) => e.item === "spaceship") + ), + () => [ + playerTrail.Single( + { + playerX: e.playerX, + playerY: e.playerY, + playerDir: e.playerDir, + crashed: e.crashed, + paused: e.paused, + skin: e.playerSkin, + isFront: true, + touchingPortals: null !== e.touchingPortals, + playerScale: e.playerScale, + }, + (t) => { + ((t.playerSpeedMultiplier = e.playerSpeedMultiplier), + (t.playerScale = e.playerScale), + (t.playerX = e.playerX), + (t.playerY = e.playerY), + (t.playerDir = e.playerDir), + (t.crashed = e.crashed || e.hidePlayer), + (t.paused = e.paused), + (t.touchingPortals = null !== e.touchingPortals), + (t.skin = Object.assign({}, e.playerSkin)), + (t.skin.trail = Object.assign({}, e.playerSkin.trail)), + (e.layout.properties.theme.id === "infinite") && ["world1", "default", "headphone"].includes(t.skin.fileName) && (t.skin.trail = { + form: "default", + topColour: getInfinitePlayerColors(e.bgColor), + bottomColour: getInfinitePlayerColors(e.bgColor), }), - ]), - - zr({ - id: "LevelEditor", - settings: t.levelEditorSettings, - setSettings: (t) => { - a((a) => { - let { inViewLayout: i, inViewLayoutAtTime: n } = a; - return ( - t.viewOffset && - ((i = Pf(a.layout, t.viewOffset)), - (n = Mf( - e.savedLevel.level, - a.runHistory, - a.runHistoryIndex, - i, - ))), - Object.assign(Object.assign({}, a), { - levelEditorSettings: Object.assign( - Object.assign({}, a.levelEditorSettings), - t, - ), - inViewLayout: i, - inViewLayoutAtTime: n, - }) - ); - }); + (t.theme = e.layout.properties.theme.id), + (t.playerRot = e.playerRot) + ); }, - runHistory: t.runHistory, - runHistoryIndex: t.runHistoryIndex, - setHistoryIndex: (t) => { - a((a) => { - const i = Mf( - e.savedLevel.level, - a.runHistory, - t, - a.inViewLayout, - ); - return Object.assign(Object.assign({}, a), { - runHistoryIndex: t, - initRunHistoryIndex: Math.min( - t, - a.initRunHistoryIndex, - ), - inViewLayoutAtTime: i, - }); - }); + ), + ], + ), + Wo.Single( + { + collectibles: e.layout.collectibles, + collectibleStates: e.layoutState.collectibles, + collectibleIndexes: e.layoutStateIndex.collectibles, + frame: e.frame, + playerX: e.playerX, + fallTypes: e.fallTypes, + playerDir: e.playerDir, + paused: e.paused, + df: e.df, + theme: e.layout.properties.theme.objects.switch, + }, + (t) => { + ((t.collectibles = e.layout.collectibles), + (t.collectibleStates = e.layoutState.collectibles), + (t.collectibleIndexes = e.layoutStateIndex.collectibles), + (t.frame = e.frame), + (t.playerX = e.playerX), + (t.fallTypes = e.fallTypes), + (t.playerDir = e.playerDir), + (t.paused = e.paused), + (t.df = e.df), + (t.theme = e.layout.properties.theme === "infinite" ? "infinite" : e.layout.properties.theme.objects.switch)); + }, + ), + qa.Array({ + props: (t) => ({ + x: t.x, + y: t.y, + justDestroyed: t.framesLeft === $.explosionTime - 1, + paused: e.paused, + trail: e.playerSkin.trail, + playerRot: e.playerRot, + df: e.df, + playerScale: e.playerScale, + }), + update: (t) => { + ((t.paused = e.paused), (t.df = e.df)); + }, + array: () => e.explosions, + key: (e, t) => t, + }), + ifConditional( + () => void 0 !== e.maxFrame && void 0 !== e.hasCheckpoints, + () => [ + lm.Single( + { + crashed: e.crashed, + hasCheckpoints: e.hasCheckpoints, + frame: e.frame, + maxFrame: e.maxFrame, }, - features: allFeatures, - themes: t.unlockedFeatures.themes, - send: i, - level: Object.assign( - Object.assign({}, e.savedLevel.level), - { layout: t.layout }, - ), - waveformData: t.waveformData, - inViewLayout: t.inViewLayout, - inViewLayoutAtTime: t.inViewLayoutAtTime, - isLoading: !t.themeLoaded, - playerSkin: e.playerSkin, - }), - Ke({ - id: "PlayButton", - type: "play", - x: r / 2 - 50, - y: l / 2 - 50, - disabled: !t.themeLoaded, - onPress: () => { - a((e) => { - const t = Object.assign( - Object.assign({}, e.runHistory[e.runHistoryIndex]), - { - bossState: e.runHistory[e.runHistoryIndex] - .bossState - ? JSON.parse( - JSON.stringify( - e.runHistory[e.runHistoryIndex].bossState, - ), - ) - : null, - }, - ), - { sortedState: a, originalIndexes: i } = - xa.sortLayoutState(t.layoutState, e.layout); - return Object.assign(Object.assign({}, e), { - view: "playing", - sortedLayout: Ca.sortLayout(e.layout), - sortedLevelState: el(t, a), - sortedLayoutStateOriginalIndexes: i, - runHistory: e.runHistory.slice( - 0, - e.runHistoryIndex + 1, - ), - }); - }); + (t) => { + ((t.crashed = e.crashed), + (t.hasCheckpoints = e.hasCheckpoints), + (t.frame = e.frame), + (t.maxFrame = e.maxFrame), + (t.x = e.playerX), + (t.y = e.playerY - 50)); + }, + ), + ], + ), + ]; + }, + }), + attemptCounter = makeSprite({ + render: ({ device: e, props: t }) => + bgOnly || showcaseOnly + ? [] + : t.theme == "classic" + ? [ + c( + { + color: "white", + font: { family: "Akashi", size: 24, weight: 500 }, + y: e.size.fullHeight / 2 - 70, + }, + (a) => { + ((a.text = `${localize("Attempt")} ${t.attempt}`), + (a.y = e.size.fullHeight / 2 - 70)); }, + ), + ] + : t.theme == "infinite" + ? [ + u( + { + y: e.size.fullHeight / 2 - 55, + color: getInfiniteThemeColors(t.background), + radius: 57, + opacity: 0.5 + }, + (a) => { + a.y = e.size.fullHeight / 2 - 55; + a.color = getInfiniteThemeColors(t.background); + }, + ), + u( + { + y: e.size.fullHeight / 2 - 55, + color: getInfiniteThemeColors(t.background), + radius: 50, + }, + (a) => { + a.y = e.size.fullHeight / 2 - 55; + a.color = getInfiniteThemeColors(t.background); + }, + ), + u( + { + y: e.size.fullHeight / 2 - 55, + color: infiniteBgTable(0, t.background), + radius: 40, + }, + (a) => { + a.y = e.size.fullHeight / 2 - 55; + a.color = infiniteBgTable(0, t.background); + }, + ), + c( + { + text: localize("Attempt"), + color: getInfiniteThemeColors(t.background), + font: { family: "Poppins", size: 16 }, + y: e.size.fullHeight / 2 - 47, + }, + (a) => { + a.y = e.size.fullHeight / 2 - 47; + a.color = getInfiniteThemeColors(t.background); + }, + ), + c( + { + color: getInfiniteThemeColors(t.background), + font: { family: "Poppins", size: 16 }, + y: e.size.fullHeight / 2 - 71, + }, + (a) => { + ((a.text = String(t.attempt)), + (a.y = e.size.fullHeight / 2 - 71)); + }, + ), + ] + : [ + y( + { + fileName: "images/level/attempt.png", + width: 75, + height: 79, + y: e.size.fullHeight / 2 - 55, + }, + (t) => { + t.y = e.size.fullHeight / 2 - 55; + }, + ), + c( + { + text: localize("ATTEMPT"), + color: "white", + font: { family: "Montserrat", size: 15 }, + y: e.size.fullHeight / 2 - 50, + strokeColor: He, + strokeThickness: 4, + }, + (t) => { + t.y = e.size.fullHeight / 2 - 50; + }, + ), + c( + { + color: "white", + font: { family: "Montserrat", size: 20 }, + y: e.size.fullHeight / 2 - 70, + strokeColor: He, + strokeThickness: 4, + }, + (a) => { + ((a.text = String(t.attempt)), + (a.y = e.size.fullHeight / 2 - 70)); + }, + ), + ], + }), + hm = (y, cameraY, finished, anchor, useGround) => { + if (anchor) { + return cameraY + (anchor - cameraY) / 5; + } + if (finished) return cameraY + (y - cameraY) / 10; + const i = et.initialPosition.y + 105, + n = et.initialPosition.y; + let isGrounded = false; + if (y <= 30 && !(y - cameraY > i) && useGround) { + cameraY = cameraY + (30 - cameraY) / 4; + isGrounded = true; + } + cameraY = + y - cameraY > i && !isGrounded + ? cameraY + (5 + y - cameraY - i) / 4 + : y - cameraY < n && !isGrounded + ? cameraY + (-5 + y - cameraY - n) / 4 + : cameraY; + return cameraY; + }, + pm = (e, t, a) => { + const i = a + ? et.initialPosition.x + : 1 === t + ? 0 + : 2 * et.initialPosition.x, + n = e - i; + return 0 === n || Math.abs(n) < 1 ? i : e - n / 4; + }, + gm = (e, t) => e - et.initialPosition.x + t; + var mm = function (e, t, a, i) { + return new (a || (a = Promise))(function (n, s) { + function o(e) { + try { + l(i.next(e)); + } catch (e) { + s(e); + } + } + function r(e) { + try { + l(i.throw(e)); + } catch (e) { + s(e); + } + } + function l(e) { + var t; + e.done + ? n(e.value) + : ((t = e.value), + t instanceof a + ? t + : new a(function (e) { + e(t); + })).then(o, r); + } + l((i = i.apply(e, t || [])).next()); + }); + }; + function fm(e, t) { + return mm(this, void 0, void 0, function* () { + const a = yield bp.verifyPurchase(e, t, "googlePlay"); + return (yield ju.playStoreAcknowledge(t.productId), a); + }); + } + const ym = { + checkForPreviousPurchases: function (e) { + return mm(this, void 0, void 0, function* () { + const t = yield ju.checkPreviousPurchases(); + return t ? yield fm(e, t) : null; + }); + }, + getPurchases: function (e) { + return mm(this, void 0, void 0, function* () { + let t; + return ( + (t = yield bp.getPurchases(e, "googlePlay")), + (t = yield ju.playStoreProductInfo(t)), + t.sort((e, t) => (e.price < t.price ? -1 : 1)) + ); + }); + }, + makePurchase: function (e, t) { + return mm(this, void 0, void 0, function* () { + { + const a = yield ju.playStoreBuy(t); + return null === a ? null : yield fm(e, a); + } + }); + }, + }; + var Em = function (e, t, a, i) { + return new (a || (a = Promise))(function (n, s) { + function o(e) { + try { + l(i.next(e)); + } catch (e) { + s(e); + } + } + function r(e) { + try { + l(i.throw(e)); + } catch (e) { + s(e); + } + } + function l(e) { + var t; + e.done + ? n(e.value) + : ((t = e.value), + t instanceof a + ? t + : new a(function (e) { + e(t); + })).then(o, r); + } + l((i = i.apply(e, t || [])).next()); + }); + }; + const bm = makeCustomSprite({ + init({ + props: { onModalClose: e, onPurchaseComplete: t }, + updateState: a, + device: i, + getContext: n, + }) { + const { online: s } = n(Se); + if (s) { + const n = s.backend; + function o() { + return Em(this, void 0, void 0, function* () { + const e = yield ym.checkForPreviousPurchases(n); + if (null !== e) + return ( + t(e), + void i.alert.ok("Finished processing pending purchase") + ); + const s = yield ym.getPurchases(n); + a((e) => + Object.assign(Object.assign({}, e), { purchases: s }), + ); + }); + } + o().catch((t) => { + i.alert.ok(`Failed to retrieve store items: ${t.message}`, e); + }); + } + return { purchases: "loading", isPurchasing: false }; + }, + render({ + state: e, + props: t, + updateState: a, + device: i, + getContext: s, + }) { + const { onModalClose: o, onPurchaseComplete: r } = t; + return [ + Clickable({ + id: "ClickOutside", + onPressOutside: o, + width: 400, + height: 300, + sprites: () => [], + onPress: () => null, + }), + We({ + width: 400, + height: 300, + color: ve, + strokeColor: Ye, + strokeThickness: 8, + }), + Fo({ + id: "CloseButton", + text: "X", + x: 200, + y: 150, + width: 40, + height: 40, + onPress: o, + strokeColor: Ye, + }), + ...("loading" === e.purchases + ? [ + n({ + text: `${localize("LOADING")}...`, + color: ve, + strokeColor: Ye, + strokeThickness: 3, + }), + ] + : e.isPurchasing + ? [ + n({ + text: `${localize("PROCESSING")}...`, + color: ve, + strokeColor: Ye, + strokeThickness: 3, + }), + ] + : e.purchases.flatMap((e, t) => [ + n({ + text: e.title, + font: { size: 20 }, + x: -80, + color: Te, + strokeColor: Ye, + strokeThickness: 4, + y: 70 - 60 * t, }), - Bf.Single({ - id: "MenuButton", - globalContextVal: s(Se), + Fo({ + id: `BlockButton-${e.productId}`, + width: 120, + height: 50, + text: e.price, + strokeColor: Ye, + textColor: ve, + textStroke: Ye, + textStrokeThickness: 4, onPress: () => { - a((e) => - Object.assign(Object.assign({}, e), { view: "menu" }), - ); + const { online: t } = s(Se); + t && + (a((e) => + Object.assign(Object.assign({}, e), { + isPurchasing: true, + }), + ), + ym + .makePurchase(t.backend, e) + .then((e) => { + null !== e && + (i + .audio("audio/global/purchase-blocks.wav") + .play(), + r(e)); + }) + .catch((e) => { + "pending" === e.message + ? i.alert.ok( + "Waiting for pending payment, please check back later", + ) + : (console.error(e.message), + i.alert.ok("Couldn't complete purchase")); + }) + .finally(() => { + a((e) => + Object.assign(Object.assign({}, e), { + isPurchasing: false, + }), + ); + })); }, + x: 80, + y: 70 - 60 * t, }), - ]; - } - return [ - d, - Ff.Single({ - id: "Level", - globalContextVal: s(Se), - spineContextVal: s(Ws), - level: Object.assign(Object.assign({}, e.savedLevel.level), { - layout: t.sortedLayout, - }), - playerSkin: e.playerSkin, - startState: t.sortedLevelState, - pushRunHistory: (e) => { - a((t) => - Object.assign(Object.assign({}, t), { - runHistory: [ - ...t.runHistory, - el( - e, - xa.unsortLayoutState( - e.layoutState, - t.sortedLayoutStateOriginalIndexes, - ), - ), - ], - }), - ); - }, - backToEditor: () => { - a((e) => - Object.assign(Object.assign({}, e), { view: "editing" }), + ])), + ]; + }, + }), + Sm = makeSprite({ + init({ + props: { onModalClose: e, onPurchaseComplete: t }, + device: a, + getContext: i, + getState: n, + }) { + const { online: s } = i(Se); + if (s) { + const i = s.backend; + function o() { + return Em(this, void 0, void 0, function* () { + const e = yield ym.checkForPreviousPurchases(i); + if (null !== e) + return ( + t(e), + void a.alert.ok("Finished processing pending purchase") ); - }, - }), - ScreenBounds({ id: "ScreenBounds" }), - Ke({ - id: "PlayButton", - type: "edit", - x: r / 2 - 50, - y: l / 2 - 50, - disabled: false, - onPress: () => { - (i.audio(e.savedLevel.level.song.fileName).pause(), - a((e) => - Object.assign(Object.assign({}, e), { - view: "editing", - }), - )); - }, + const s = yield ym.getPurchases(i); + n().purchases = s; + }); + } + o().catch((t) => { + a.alert.ok(`Failed to retrieve store items: ${t.message}`, e); + }); + } + return { purchases: "loading", isPurchasing: false }; + }, + render: ({ state: e, props: t, device: a, getContext: i }) => [ + _e.Single({ + onPressOutside: t.onModalClose, + width: 400, + height: 300, + sprites: () => [], + onPress: () => null, + }), + qe({ + width: 400, + height: 300, + fillColor: ve, + color: Ye, + thickness: 8, + }), + Yo.Single({ + text: "X", + x: 200, + y: 150, + width: 40, + height: 40, + onPress: t.onModalClose, + strokeColor: Ye, + }), + conditional( + () => "loading" === e.purchases, + () => [ + c({ + text: `${localize("LOADING")}...`, + color: ve, + strokeColor: Ye, + strokeThickness: 3, }), - ]; - }, - }), - Bf = makeSprite({ - render: ({ props: e, device: t }) => [ - Se.Single({ - context: () => e.globalContextVal, - sprites: [ - menuButtonSprite.Single( - { - hidden: false, - onPress: e.onPress, - x: -t.size.fullWidth / 2 + 50, - y: t.size.fullHeight / 2 - 50, - }, - (e) => { - ((e.x = -t.size.fullWidth / 2 + 50), - (e.y = t.size.fullHeight / 2 - 50)); - }, - ), - ], - }), - ], - }), - Ff = makeSprite({ - render: ({ props: e }) => [ - Se.Single({ - context: () => e.globalContextVal, - sprites: [ - Ws.Single({ - context: () => e.spineContextVal, - sprites: [ - vf.Single( - { - level: e.level, - startState: e.startState, - editor: { - pushRunHistory: e.pushRunHistory, - backToEditor: e.backToEditor, - }, - playerSkin: - "default" === e.playerSkin.fileName - ? e.level.layout.properties.theme.player - : e.playerSkin, - }, - (t) => { - ((t.level = e.level), - (t.startState = e.startState), - (t.editor.pushRunHistory = e.pushRunHistory), - (t.editor.backToEditor = e.backToEditor)); + ], + () => [ + conditional( + () => e.isPurchasing, + () => [ + c({ + text: `${localize("PROCESSING")}...`, + color: ve, + strokeColor: Ye, + strokeThickness: 3, + }), + ], + () => [ + d({ + props: (e, t) => ({ + font: { size: 20 }, + x: -80, + color: Te, + strokeColor: Ye, + strokeThickness: 4, + text: e.title, + y: 70 - 60 * t, + }), + array: () => e.purchases, + }), + Yo.Array({ + props: (n, s) => ({ + width: 120, + height: 50, + text: n.price, + strokeColor: Ye, + textColor: ve, + textStroke: Ye, + textStrokeThickness: 4, + onPress: () => { + const { online: s } = i(Se); + s && + ((e.isPurchasing = true), + ym + .makePurchase(s.backend, n) + .then((e) => { + null !== e && + (a + .audio("audio/global/purchase-blocks.wav") + .play(), + t.onPurchaseComplete(e)); + }) + .catch((e) => { + "pending" === e.message + ? a.alert.ok( + "Waiting for pending payment, please check back later", + ) + : (console.error(e.message), + a.alert.ok("Couldn't complete purchase")); + }) + .finally(() => { + e.isPurchasing = false; + })); }, - ), - ], - }), - ], - }), - ], - }), - Yf = makeCustomSprite({ - init({ preloadFiles: e, props: t }) { - e({ - imageFileNames: [ - ...Qs.getThemeImages(t.theme), - ...qs(t.theme.background), - ], - imageFileNamesScaleNearestPixel: Qs.getThemeImagesPixel( - t.theme, + x: 80, + y: 70 - 60 * s, + }), + key: (e) => e.productId, + array: () => e.purchases, + }), + ], ), - }).then(() => { - t.onLoad(); - }); - }, - render: () => [], - }), - Uf = makePureSprite({ - shouldRerender: (e, t) => e.text !== t.text, - render: ({ props: { text: e, width: t, height: a } }) => [ - We({ width: t, height: a, y: -5, color: Re }), - We({ width: t, height: a, color: ve }), - n({ font: { size: 20 }, text: e, color: Be }), - ], - }), - jf = makeCustomSprite({ - render: ({ props: { closeModal: e, width: t, height: a } }) => [ + ], + ), + ], + }); + var Im = function (e, t, a, i) { + return new (a || (a = Promise))(function (n, s) { + function o(e) { + try { + l(i.next(e)); + } catch (e) { + s(e); + } + } + function r(e) { + try { + l(i.throw(e)); + } catch (e) { + s(e); + } + } + function l(e) { + var t; + e.done + ? n(e.value) + : ((t = e.value), + t instanceof a + ? t + : new a(function (e) { + e(t); + })).then(o, r); + } + l((i = i.apply(e, t || [])).next()); + }); + }; + const _m = makeCustomSprite({ + init: () => ({ didRequest: false }), + loop({ state: e, props: t, getContext: a }) { + var i; + if (e.didRequest) { + const { online: e } = a(Se); + if (e) + return ( + null === (i = t.onConnect) || void 0 === i || i.call(t), + { didRequest: false } + ); + } + return e; + }, + render({ device: e, getContext: t, updateState: a, state: i }) { + return [ + Fo({ + id: "GoOnline", + text: i.didRequest ? "LOADING" : "GO ONLINE", + width: 120, + height: 40, + onPress: () => + Im(this, void 0, void 0, function* () { + a(() => ({ didRequest: true })); + const { data: i } = yield Jp.getLocal(e.storage, e.alert), + { sendAccountAction: n } = t(Se); + n({ type: "goOnline", auth: i.auth }); + }), + }), + ]; + }, + }), + vm = makeSprite({ + init: () => ({ didRequest: false }), + loop({ state: e, props: t, getContext: a }) { + var i; + if (e.didRequest) { + const { online: n } = a(Se); + n && + (null === (i = t.onConnect) || void 0 === i || i.call(t), + (e.didRequest = false)); + } + }, + render({ device: e, getContext: t, state: a }) { + return [ + Yo.Single( + { + text: a.didRequest ? "LOADING" : "GO ONLINE", + width: 120, + height: 40, + onPress: () => + Im(this, void 0, void 0, function* () { + a.didRequest = true; + const { data: i } = yield Jp.getLocal( + e.storage, + e.alert, + ), + { sendAccountAction: n } = t(Se); + n({ type: "goOnline", auth: i.auth }); + }), + }, + (e) => { + e.text = a.didRequest ? "LOADING" : "GO ONLINE"; + }, + ), + ]; + }, + }), + Tm = makeCustomSprite({ + render: ({ + props: { + text: e, + selected: t, + width: a, + height: i, + disabled: s = false, + darkText: l = false, + darkBg: c = false, + fontSize: d = 15, + onPress: u, + noPress: h, + strokeColor: strokeColor = Me, + }, + device: p, + }) => [ Clickable({ - id: "ClickOutside", - onPressOutside: e, - width: t, - height: a, - sprites: () => [], - onPress: () => null, + id: "Clickable", + width: a, + height: i, + onPress: () => { + (p.audio("audio/global/button.wav").play(0), u()); + }, + disabled: s || h, + sprites: (u) => { + const h = u ? Ae : l ? Ue : Be; + return [ + // 5e01ff + So({ + id: "RaisedRects", + width: a, + height: i, + raiseHeight: 5, + rad: 5, + bottomColour: c ? Be : ve, + topColour: s ? Xe : u ? ke : Re, + isPressed: u, + stroke: { + colour: s ? ze : c ? Ye : strokeColor, + thickness: 2, + }, + sprites: (i) => [ + o({ + color: ve, + width: 15, + height: 15, + x: -a / 2 + 20, + y: i, + }), + t + ? r({ + color: h, + path: [ + [-8, 2], + [0, -6], + [12, 7], + ], + thickness: 5, + x: -a / 2 + 20, + y: i, + }) + : null, + n({ + font: { size: d }, + text: e, + color: h, + x: 10, + y: i, + }), + ], + }), + ]; + }, }), ], - }), - Gf = makeCustomSprite({ - init({ props: e, updateState: t, preloadFiles: a, device: i }) { - let n = null; - return ( - e.withContext - ? ((n = Fs( - e.withContext.animationContext, - e.withContext.spineFiles, - i.timer.start, - )), - Promise.all([n, a(e.assets)]).then(([a]) => { - var i; - (null === (i = e.onLoad) || void 0 === i || i.call(e), - t((e) => - Object.assign(Object.assign({}, e), { - animationAssets: a, - loaded: true, + }), + Rm = makeSprite({ + render: ({ props: e, device: t }) => [ + _e.Single( + { + width: e.width, + height: e.height, + onPress: () => { + (t.audio("audio/global/button.wav").play(0), e.onPress()); + }, + disabled: e.disabled || e.noPress, + sprites: (t) => { + const a = t ? Ae : e.darkText ? Ue : Be; + return [ + Io.Single( + { + width: e.width, + height: e.height, + raiseHeight: 5, + rad: 5, + bottomColour: e.darkBg ? Be : ve, + topColour: e.disabled ? Xe : t ? ke : Re, + isPressed: t, + stroke: { + colour: e.disabled ? ze : e.darkBg ? Ye : Me, + thickness: 2, + }, + sprites: (t) => [ + p({ + color: ve, + width: 15, + height: 15, + x: -e.width / 2 + 20, + y: t, }), - )); - })) - : a(e.assets).then(() => { - var a; - (null === (a = e.onLoad) || void 0 === a || a.call(e), - t((e) => - Object.assign(Object.assign({}, e), { loaded: true }), - )); - }), - { loaded: false, animationAssets: n } - ); - }, - render: ({ props: e, state: t }) => - !t.loaded || (t.animationAssets && "then" in t.animationAssets) - ? e.loadingSprites || [] - : e.withContext && t.animationAssets - ? [ - Se.Sprite({ - context: e.withContext.globalContext, - sprites: [ - Ws.Sprite({ - context: { - animationAssets: t.animationAssets, - animationRenderer: - e.withContext.animationRenderer, + ifConditional( + () => e.selected, + () => [ + m({ + color: a, + path: [ + [-8, 2], + [0, -6], + [12, 7], + ], + thickness: 5, + x: -e.width / 2 + 20, + y: t, + }), + ], + ), + c({ + font: { + size: + e.fontSize || (e.text.length > 18 ? 13 : 15), }, - sprites: e.sprites, + text: localize(e.text), + color: a, + x: 10, + y: t, }), ], - }), - ] - : e.sprites, - cleanup({ state: e }) { - e.animationAssets && - ("then" in e.animationAssets - ? e.animationAssets.then(Gs) - : Gs(e.animationAssets)); - }, - }), - Vf = makeCustomSprite({ - init: ({ - updateState: e, - preloadFiles: t, - props: a, - device: i, - }) => ({ - animationAssets: ("string" == typeof a.level - ? Hf(a.level) - : Promise.resolve(a.level) - ) - .then((e) => { - var n; - return Xf( - e, - a.playerSkin, - a.removeCheckpoints, - t, - i.timer.start, - a.animationContext, - null === (n = a.boss) || void 0 === n - ? void 0 - : n.fileNames, - ); - }) - .then(([t, i]) => { - const n = a.boss; - return ( - e(() => ({ - level: n - ? Object.assign(Object.assign({}, t), { - boss: n, - layout: n.overrideMovement - ? t.layout - : Ca.addBlocksFlat(t.layout), - }) - : t, - animationAssets: i, - })), - i - ); - }), - level: null, - }), - render: ({ props: e, state: t }) => - !t.level || "then" in t.animationAssets - ? [ - n({ - text: `${localize("LOADING")}...`, + }, + (a) => { + ((a.bottomColour = e.darkBg ? Be : ve), + (a.topColour = e.disabled ? Xe : t ? ke : Re), + (a.stroke.colour = e.disabled + ? ze + : e.darkBg + ? Ye + : Me)); + }, + ), + ]; + }, + }, + (t) => { + t.disabled = e.disabled || e.noPress; + }, + ), + ], + }); + const Om = makeSprite({ + init({ getContext: e }) { + const { settings: t } = e(Se); + return { + initSettings: t, + headphonesSync: null, + didChangeHeadphoneSync: false, + }; + }, + loop({ state: e }) { + null !== e.headphonesSync && + (e.headphonesSync++, + e.headphonesSync > 60 && (e.headphonesSync = null)); + }, + render({ props: e, getContext: t, device: a, state: i }) { + const n = { ref: "MAX" }, + s = (e) => { + n.ref = + e >= 1 + ? "MAX" + : e >= 0.7 + ? "HIGH" + : e >= 0.4 + ? "MED" + : "LOW"; + }; + const hasCursor = !a.isTouchScreen; + const mouseSettingOffset = hasCursor ? 50 : 0; + return ( + s(a.resolution.get()), + [ + Bo.Single( + { + containerHeight: a.size.fullHeight - 70 + 50, + containerWidth: a.size.fullWidth, + contentHeight: 850 + mouseSettingOffset, + y: (a.size.fullHeight - 70) / 2 + 35, + sprites: (o) => [ + c({ + text: `${localize("RESOLUTION")}:`, font: { size: 15 }, color: ve, + x: -130, + y: -50, }), - ] - : [ - Se.Sprite({ - context: e.globalContext, - sprites: [ - Ws.Sprite({ - context: { - animationAssets: t.animationAssets, - animationRenderer: e.animationRenderer, - }, - sprites: e.sprites(t.level), - }), - ], - }), - ], - cleanup({ state: e }) { - "then" in e.animationAssets - ? e.animationAssets.then(Gs) - : Gs(e.animationAssets); - }, - }); - function Hf(e) { - return Af(`levels/${e}.json`) - .then((e) => e.json()) - .then((e) => Cf(e)); - } - function Xf(e, t, a, i, n, s, o) { - return Promise.all([ - i({ - imageFileNames: [ - ...Qs.getThemeImages(e.layout.properties.theme), - ...Qs.getPlayerImages([t], []), - ...Qs.levelImages, - ...((null == o ? void 0 : o.images) || []), - ], - audioFileNames: [ - e.song.fileName, - ...Qs.levelSfx, - ...((null == o ? void 0 : o.audio) || []), - ], - imageFileNamesScaleNearestPixel: [ - ...Qs.getThemeImagesPixel(e.layout.properties.theme), - ...((null == o ? void 0 : o.pixelArtImages) || []), - ], - }).then(() => (a ? Ir(e) : e)), - Fs( - s, - [ - ...Qs.getThemeSpine(e.layout.properties.theme), - ...((null == o ? void 0 : o.spine) || []), - ], - n, - ), - ]); - } - const zf = makeCustomSprite({ - init: () => ({ arrowY: 0 }), - loop: ({ state: e }) => - e.arrowY > 10 ? { arrowY: -10 } : { arrowY: e.arrowY + 0.3 }, - render: ({ state: e }) => [ - r({ - path: [ - [-16, 0], - [-16, 20], - [16, 20], - [16, 0], - [40, 0], - [0, -32], - [-40, 0], - [-16, 0], - [-16, 20], - ], - color: Ye, - thickness: 3, - fillColor: ve, - y: -5 + Math.abs(e.arrowY), - }), - ], - }), - Wf = 350, - qf = 280, - //*level previewer - $f = makeCustomSprite({ - init: () => ({ checkpointsOn: true }), - render({ - props: { - worldLevel: { - song: e, - levelName: name, - difficulty: t, - maxFrames: a, - comingSoon: i, - author: author, - }, - levelProgress: s, - playLevel: o, - arrow: c, - showHighScore: d, - showStartArrows: u, - }, - state: { checkpointsOn: h }, - updateState: p, - }) { - const g = s.checkpoints.didFinish - ? "100%" - : `${Math.floor((s.checkpoints.furthestFrame / a) * 100)}%`, - offset = 0, - m = s.noCheckpoints.didFinish - ? "100%" - : `${Math.floor((s.noCheckpoints.furthestFrame / a) * 100)}%`, - f = c.facingLeft ? 1 : -1, - y = e.bpm < 120 ? 1 : e.bpm < 140 ? 2 : e.bpm < 170 ? 3 : 4, - E = hl.getSnippetName(e.fileName); - return [ - Clickable({ - id: "ClickInside", - width: Wf, - height: qf, - sprites: () => [], - onPress: () => null, - }), - We({ color: Re, width: 360, height: 290, y: -5, x: 5 * f }), - We({ color: ve, width: Wf, height: qf }), - r({ - fillColor: Re, - path: [ - [0, c.y], - [10 * -f, c.y + 10], - [10 * -f, c.y - 10], - ], - anchorX: 14 * -f, - x: (360 * f) / 2, - }), - n({ - font: { - size: 20, - align: "left", - baseline: "bottom", - weight: 800, - }, - text: (name).toUpperCase(), - color: Be, - x: -155, - y: 100, - }), - n({ - font: { - align: "left", - weight: 500, - baseline: "bottom", - style: "italic", - }, - text: author ? localize("level by") : localize("artist"), - color: Be, - x: -155, - y: 80, - }), - n({ - font: { - size: e.author.length > 20 ? 12 : 15, - align: "left", - weight: 600, - baseline: "bottom", - }, - text: author ? author : e.author, - color: Be, - x: -120 + (author ? 5 : 0), - y: 80, - }), - e.label - ? n({ - font: { - align: "right", - weight: 500, - baseline: "bottom", - style: "italic", + Yo.Single( + { + text: localize("LOW"), + onPress: () => { + (a.resolution.set(0.25), s(0.25)); + }, + width: 50, + height: 40, + x: -40, + y: -50, }, - text: e.label, - color: Be, - x: 155, - y: 80, - }) - : null, - r({ - thickness: 3, - color: Re, - path: [ - [-160, offset], - [95, offset], - ], - y: 70, - }), - l({ - fileName: `images/mainMenu/levelSelect/bpm/${y}.png`, - width: 64, - height: 36, - x: -110, - y: -5 + offset, - }), - n({ - font: { size: 15 }, - text: String(e.bpm), - color: Be, - x: -110, - y: 30 + offset, - strokeColor: Ce, - strokeThickness: 3, - }), - n({ - font: { weight: 500 }, - text: "BPM", - color: Be, - x: -110, - y: -40 + offset, - }), - l({ - fileName: `images/mainMenu/levelSelect/difficultyIconsModal/${Math.round( - Math.min(t, 10) - )}.png`, - width: 40, - height: 87, - anchorY: -40, - y: -30 + offset, - }), - n({ - font: { size: 15 }, - text: `${t}/10`, - color: Be, - y: 30 + offset, - strokeColor: Ce, - strokeThickness: 3, - }), - n({ - font: { weight: 500 }, - text: localize("DIFFICULTY"), - color: Be, - y: -40 + offset, - }), - l({ - fileName: `images/mainMenu/levelSelect/checkpointsIcon${ - s.checkpoints.didFinish ? "Complete" : "" - }.png`, - width: 48, - height: 45, - x: 85, - y: -5 + offset, - scaleX: h ? 1 : 0.7, - scaleY: h ? 1 : 0.7, - }), - l({ - fileName: `images/mainMenu/levelSelect/noCheckpointsIcon${ - s.noCheckpoints.didFinish ? "Complete" : "" - }.png`, - width: 62, - height: 46, - x: 135, - y: -5 + offset, - scaleX: h ? 0.7 : 1, - scaleY: h ? 0.7 : 1, - }), - n({ - font: { size: h ? 15 : 12 }, - text: g, - color: Be, - x: 85, - y: 30 + offset, - strokeColor: Ce, - strokeThickness: 3, - }), - n({ - font: { size: h ? 12 : 15 }, - text: m, - color: Be, - x: 135, - y: 30 + offset, - strokeColor: Ce, - strokeThickness: 3, - }), - n({ - font: { weight: 500 }, - text: localize("PROGRESS"), - color: Be, - x: 110, - y: -40 + offset, - }), - Tm({ - id: "CheckpointsButton", - text: localize("CHECKPOINTS"), - selected: h, - width: 170, - height: 40, - x: -60, - y: -90 + offset, - darkBg: true, - onPress: () => { - p((e) => - Object.assign(Object.assign({}, e), { - checkpointsOn: !e.checkpointsOn, - }), - ); - }, - }), - Fo({ - id: "PlayButton", - text: localize("PLAY"), - disabled: (!h && !s.checkpoints.didFinish) || i, - width: 70, - height: 40, - x: 100, - y: -90 + offset, - darkBg: true, - onPress: () => { - o(h); - }, - }), - u ? zf({ id: "LevelsHelp", x: 100, y: -30 }) : null, - i - ? n({ - text: localize("COMING SOON!"), + (e) => { + ((e.disabled = "LOW" === n.ref), + (e.noPress = o.ref)); + }, + ), + Yo.Single( + { + text: localize("MED"), + onPress: () => { + (a.resolution.set(0.5), s(0.5)); + }, + width: 50, + height: 40, + x: 20, + y: -50, + }, + (e) => { + ((e.disabled = "MED" === n.ref), + (e.noPress = o.ref)); + }, + ), + Yo.Single( + { + text: localize("HIGH"), + onPress: () => { + (a.resolution.set(0.75), s(0.75)); + }, + width: 50, + height: 40, + x: 80, + y: -50, + }, + (e) => { + ((e.disabled = "HIGH" === n.ref), + (e.noPress = o.ref)); + }, + ), + Yo.Single( + { + text: localize("MAX"), + onPress: () => { + (a.resolution.set(1), s(1)); + }, + width: 50, + height: 40, + x: 140, + y: -50, + }, + (e) => { + ((e.disabled = "MAX" === n.ref), + (e.noPress = o.ref)); + }, + ), + c({ + text: `${localize("MUSIC")}:`, + font: { size: 15 }, color: ve, - strokeColor: Ye, - strokeThickness: 3, - x: 100, - y: -120 + offset, - }) - : null, - d - ? n({ - text: `${localize("HIGH SCORE")}: ${s.highScore.toLocaleString()}`, + x: -130, + y: -100, + }), + sliderSprite.Single( + { + x: 50, + y: -100, + value: a.globalAudio.volume, + setValue: (e) => { + a.globalAudio.setVolume(e); + }, + }, + (e) => { + e.value = a.globalAudio.volume; + }, + ), + /*c({ + text: "SFX:", font: { size: 15 }, - color: Te, - strokeColor: Ye, - strokeThickness: 3, - y: 55 + offset, - }) - : null, - h && s.bestAttempts - ? n({ - text: `${localize("PREVIOUS BEST")}: ${s.bestAttempts.toLocaleString()} ${localize("ATTEMPT")}${ - 1 === s.bestAttempts ? "" : "S" - }`, - font: { size: 10, weight: 500, style: "italic" }, - color: Ye, - x: -60, - y: -120 + offset, - }) - : null, - Gf({ - id: `LoadSong-${E}`, - assets: { audioFileNames: [E] }, - sprites: [ - Ro.Single({ - id: `PreviewSong-${E}`, - fileName: E, - loop: false, - paused: false, - fromPosition: 0, - overwrite: true, - isGameSfx: false, + color: ve, + x: -130, + y: -120, }), - ], - }), - ]; - }, - }), - Jf = makeCustomSprite({ - init: () => ({ selectedLevelIndex: null }), - render({ - props: e, - updateState: t, - device: a, - state: { selectedLevelIndex: i }, - }) { - const n = Hl.getWorld(e.world), - s = a.size.width + 2 * a.size.widthMargin, - o = a.size.height + 2 * a.size.heightMargin, - r = null === i ? null : n[i]; - return [ - Uf({ - id: "Title", - text: `${localize("WORLD")} ${e.world}`, - width: 200, - height: 35, - x: -s / 2 + 120, - y: o / 2 - 40, - }), - r && null !== i - ? jf({ - id: "InvisibleModal", - closeModal: () => { - (e.fadeInMusic(), - t((e) => - Object.assign(Object.assign({}, e), { - selectedLevelIndex: null, - }), - )); + wm.Single( + { + x: 50, + y: -120, + value: a.globalAudio.volume, + setValue: (e) => { + a.globalAudio.setVolume(e); + }, }, - x: r.x - 225 * Math.sign(r.x - 1), - y: -20, - width: Wf, - height: qf, - }) - : null, - Kf({ - id: "MapView", - world: n, - worldProgress: e.worldProgress, - selectedWorldLevel: r, - onSelectLevel: (a) => { - (e.fadeOutMusic(), - t((e) => - Object.assign(Object.assign({}, e), { - selectedLevelIndex: a, + (e) => { + e.value = a.globalAudio.volume; + } + ),*/ + c({ + text: localize("HEADPHONE"), + font: { size: 15 }, + color: ve, + x: -140, + y: -140, + }), + c( + { font: { size: 15 }, color: ve, x: -140, y: -160 }, + (e) => { + const { settings: a } = t(Se); + e.text = `${localize("DELAY")}: ${1000 * a.headphonesDelay}ms`; + }, + ), + sliderSprite.Single( + { + x: 50, + y: -150, + value: 0, + setValue: (e) => { + const { updateSettings: a } = t(Se); + ((i.didChangeHeadphoneSync = true), + a({ + headphonesDelay: Math.round(1000 * e) / 1000, + })); + }, + }, + (e) => { + const { settings: a } = t(Se); + ((e.value = a.headphonesDelay), + (e.shouldFlash = + null !== i.headphonesSync && + i.headphonesSync === + Math.round(60 * a.headphonesDelay) + 1)); + }, + ), + Yo.Single( + { + text: localize("PLAY SOUND"), + noSfx: true, + onPress: () => { + ((i.didChangeHeadphoneSync = true), + (i.headphonesSync = 0), + a + .audio("audio/global/sync.wav") + .play({ overwrite: true, fromPosition: 0 })); + }, + width: 120, + height: 40, + x: 235, + y: -150, + }, + (e) => { + e.noPress = o.ref; + }, + ), + ifConditional( + () => i.didChangeHeadphoneSync, + () => [ + c({ + text: localize("TIP: MOVE KNOB SO IT FLASHES"), + color: ve, + x: 235, + y: -180, }), - )); - }, - showStartArrows: e.showStartArrows && null === r, - }), - r && null !== i - ? $f({ - id: `LevelView-${r.levelFileName}`, - worldLevel: r, - levelProgress: - e.worldProgress.find( - (e) => e.levelName === r.levelName, - ) || zl(e.world, i, r.levelName), - x: r.x - 225 * Math.sign(r.x - 1), - y: -20, - playLevel: (t) => { - e.playLevel(r, { - number: e.world, - levelIndex: i, - withCheckpoints: t, - }); + c({ + text: localize("WHEN YOU HEAR SOUND PLAYED"), + color: ve, + x: 235, + y: -193, + }), + ], + ), + Rm.Single( + { + text: "PLAIN BACKGROUND", + selected: false, + onPress: () => { + const { settings: e, updateSettings: a } = t(Se); + a({ plainBackground: !e.plainBackground }); + }, + width: 250, + height: 40, + y: -200, }, - arrow: { y: r.y, facingLeft: r.x >= 0 }, - showStartArrows: e.showStartArrows, - }) - : null, - Fo({ - id: "BackButton", + (e) => { + const { settings: a } = t(Se); + ((e.selected = a.plainBackground), + (e.noPress = o.ref)); + }, + ), + Rm.Single( + { + text: "HIDE PLAYER TRAIL", + selected: false, + onPress: () => { + const { settings: e, updateSettings: a } = t(Se); + a({ hidePlayerTrail: !e.hidePlayerTrail }); + }, + width: 250, + height: 40, + y: -250, + }, + (e) => { + const { settings: a } = t(Se); + ((e.selected = a.hidePlayerTrail), + (e.noPress = o.ref)); + }, + ), + Rm.Single( + { + text: "HIDE BUTTONS", + selected: false, + onPress: () => { + const { settings: e, updateSettings: a } = t(Se); + a({ hideUi: !e.hideUi }); + }, + width: 250, + height: 40, + y: -300, + }, + (e) => { + const { settings: a } = t(Se); + ((e.selected = a.hideUi), (e.noPress = o.ref)); + }, + ), + Rm.Single( + { + text: "MUTE GAME SFX", + selected: false, + onPress: () => { + const { settings: e, updateSettings: a } = t(Se); + a({ muteSfx: !e.muteSfx }); + }, + width: 250, + height: 40, + y: -350, + }, + (e) => { + const { settings: a } = t(Se); + ((e.selected = a.muteSfx), (e.noPress = o.ref)); + }, + ), + Rm.Single( + { + text: "MUTE JUMP SFX", + selected: false, + disabled: false, + onPress: () => { + const { settings: e, updateSettings: a } = t(Se); + a({ muteJump: !e.muteJump }); + }, + width: 250, + height: 40, + y: -400, + }, + (e) => { + const { settings: a } = t(Se); + ((e.selected = a.muteSfx || a.muteJump), + (e.disabled = a.muteSfx), + (e.noPress = o.ref)); + }, + ), + Rm.Single( + { + text: "MUTE MENU MUSIC", + selected: false, + onPress: () => { + var a; + const { settings: i, updateSettings: n } = t(Se); + (null === (a = e.onMenuMusicMute) || + void 0 === a || + a.call(e, !i.muteMenuMusic), + n({ muteMenuMusic: !i.muteMenuMusic })); + }, + width: 250, + height: 40, + y: -450, + }, + (e) => { + const { settings: a } = t(Se); + ((e.selected = a.muteMenuMusic), + (e.noPress = o.ref)); + }, + ), + Rm.Single( + { + text: "OVERLAP IN EDITOR", + selected: false, + onPress: () => { + var a; + const { settings: i, updateSettings: n } = t(Se); + n({ overlapObjects: !i.overlapObjects }); + overlapObjects = i.overlapObjects; + }, + width: 250, + height: 40, + y: -500, + }, + (e) => { + const { settings: a } = t(Se); + overlapObjects = a.overlapObjects; + ((e.selected = a.overlapObjects), + (e.noPress = o.ref)); + }, + ), + Rm.Single( + { + text: "SHOW EDITOR ANIMATIONS", + selected: false, + onPress: () => { + var a; + const { settings: i, updateSettings: n } = t(Se); + n({ animateEditor: !i.animateEditor }); + }, + width: 250, + height: 40, + y: -550, + }, + (e) => { + const { settings: a } = t(Se); + ((e.selected = a.animateEditor), + (e.noPress = o.ref)); + }, + ), + Rm.Single( + { + text: "MIRROR MENU BUTTON", + selected: false, + onPress: () => { + var a; + const { settings: i, updateSettings: n } = t(Se); + n({ mirrorMenuButton: !i.mirrorMenuButton }); + mirrorMenuButton = i.mirrorMenuButton; + }, + width: 250, + height: 40, + y: -600, + }, + (e) => { + const { settings: a } = t(Se); + mirrorMenuButton = a.mirrorMenuButton; + ((e.selected = a.mirrorMenuButton), + (e.noPress = o.ref)); + }, + ), + Rm.Single( + { + text: "DISABLE PLAYER GLOW", + selected: false, + onPress: () => { + var a; + const { settings: i, updateSettings: n } = t(Se); + n({ hidePlayerGlow: !i.hidePlayerGlow }); + }, + width: 250, + height: 40, + y: -650, + }, + (e) => { + const { settings: a } = t(Se); + ((e.selected = a.hidePlayerGlow), + (e.noPress = o.ref)); + }, + ), + Rm.Single( + { + text: "FADE OUT ATTEMPTS", + selected: false, + onPress: () => { + var a; + const { settings: i, updateSettings: n } = t(Se); + n({ fadeOutAttempts: !i.fadeOutAttempts }); + }, + width: 250, + height: 40, + y: -700, + }, + (e) => { + const { settings: a } = t(Se); + ((e.selected = a.fadeOutAttempts), + (e.noPress = o.ref)); + }, + ), + /*Rm.Single( + { + text: '"INFINITE" TRAIL', + selected: false, + onPress: () => { + var a; + const { settings: i, updateSettings: n } = t(Se); + n({ flyingTrail: !i.flyingTrail }); + }, + width: 250, + height: 40, + y: -750, + }, + (e) => { + const { settings: a } = t(Se); + ((e.selected = a.flyingTrail), (e.noPress = o.ref)); + }, + ),*/ + Rm.Single( + { + text: "SHOW DEBUG INFO", + selected: false, + onPress: () => { + var a; + const { settings: i, updateSettings: n } = t(Se); + n({ showDebug: !i.showDebug }); + }, + width: 250, + height: 40, + y: -750, + }, + (e) => { + const { settings: a } = t(Se); + ((e.selected = a.showDebug), (e.noPress = o.ref)); + }, + ), + Rm.Single( + { + text: "DISABLE RELEASE BUFFER", + selected: false, + onPress: () => { + var a; + const { settings: i, updateSettings: n } = t(Se); + n({ + disableReleaseBuffer: !i.disableReleaseBuffer, + }); + }, + width: 250, + height: 40, + y: -800, + }, + (e) => { + const { settings: a } = t(Se); + ((e.selected = a.disableReleaseBuffer), + (e.noPress = o.ref)); + }, + ), + ifConditional( + () => hasCursor, + () => [ + Rm.Single( + { + text: "HIDE MOUSE WHEN PLAYING", + selected: false, + onPress: () => { + var a; + const { settings: i, updateSettings: n } = t(Se); + n({ + hideMouseWhenPlaying: !i.hideMouseWhenPlaying, + }); + }, + width: 250, + height: 40, + y: -850, + }, + (e) => { + const { settings: a } = t(Se); + ((e.selected = a.hideMouseWhenPlaying), + (e.noPress = o.ref)); + }, + ), + ], + ), + ], + }, + (e) => { + ((e.containerHeight = a.size.fullHeight - 70), + (e.containerWidth = a.size.fullWidth), + (e.y = (a.size.fullHeight - 70) / 2 + 35)); + }, + ), + Yo.Single( + { text: localize("BACK"), width: 80, height: 40, onPress: () => { - (e.fadeInMusic(), e.onBack()); + return ( + (n = this), + (s = void 0), + (r = function* () { + const { settings: n, online: s } = t(Se); + if ( + (e.goBack(), + (function (e, t) { + let a = true; + return ( + Object.entries(e).forEach(([e, i]) => { + i !== t[e] && (a = false); + }), + a + ); + })(i.initSettings, n)) + ) + return; + const o = yield Jp.saveAccount( + a.storage, + null, + a.alert, + a.now, + { settings: n }, + ); + s && + (yield bp.updateAccountStorage( + s.backend, + o, + a.now, + )); + }), + new ((o = void 0) || (o = Promise))(function (e, t) { + function a(e) { + try { + l(r.next(e)); + } catch (e) { + t(e); + } + } + function i(e) { + try { + l(r.throw(e)); + } catch (e) { + t(e); + } + } + function l(t) { + var n; + t.done + ? e(t.value) + : ((n = t.value), + n instanceof o + ? n + : new o(function (e) { + e(n); + })).then(a, i); + } + l((r = r.apply(n, s || [])).next()); + }) + ); + var n, s, o, r; }, - x: -s / 2 + 60, - y: -o / 2 + 40, - }), - ]; - }, - }), - Kf = makeCustomSprite({ - render({ - props: { - world: e, - worldProgress: t, - onSelectLevel: a, - selectedWorldLevel: i, - showStartArrows: n, - }, - }) { - const s = e.map((a, i) => { - const n = e[i], - s = t.find((e) => e.levelName === n.levelName); - return { - checkpointsComplete: - (null == s ? void 0 : s.checkpoints.didFinish) || false, - noCheckpointsComplete: - (null == s ? void 0 : s.noCheckpoints.didFinish) || false, - }; + y: -a.size.fullHeight / 2 + 40, + }, + (e) => { + e.y = -a.size.fullHeight / 2 + 40; + }, + ), + ] + ); + }, + }), + Cm = makeSprite({ + render: ({ props: e }) => [ + Se.Single({ + context: () => e.globalContextVal, + sprites: [ + Om.Single( + { goBack: e.goBack, onMenuMusicMute: e.onMenuMusicMute }, + (t) => { + ((t.goBack = e.goBack), + (t.onMenuMusicMute = e.onMenuMusicMute)); + }, + ), + ], + }), + ], + }), + sliderSprite = makeSprite({ + loop({ props: e, getInputs: t, getContext: a }) { + const { pointer: i } = t(); + if (i.pressed && i.y > -15 && i.y < 15) { + const { addToOnPressQueue: t } = a(Se); + t(() => { + e.setValue(B.clamp2(0, 1, (i.x + 110) / 220)); }); - return [ - ...e.map(({ pathToLevel: e }) => - r({ color: ve, path: e, thickness: 3, lineCap: "round" }), + } + }, + render: ({ props: e }) => [ + qe({ width: 220, height: 10, fillColor: Xe, rad: 2 }), + u({ radius: 15, color: Me, x: 220 * e.value - 110 }, (t) => { + t.x = 220 * e.value - 110; + }), + u({ radius: 12, color: Re, x: 220 * e.value - 110 }, (t) => { + ((t.x = 220 * e.value - 110), + (t.color = e.shouldFlash ? ve : Re)); + }), + ], + }); + var Am = function (e, t, a, i) { + return new (a || (a = Promise))(function (n, s) { + function o(e) { + try { + l(i.next(e)); + } catch (e) { + s(e); + } + } + function r(e) { + try { + l(i.throw(e)); + } catch (e) { + s(e); + } + } + function l(e) { + var t; + e.done + ? n(e.value) + : ((t = e.value), + t instanceof a + ? t + : new a(function (e) { + e(t); + })).then(o, r); + } + l((i = i.apply(e, t || [])).next()); + }); + }; + const gameplayOverlay = makeSprite({ + init: () => ({ boostersMenuOpen: false }), + loop({ props: e, getInputs: t, device: a, getContext: i }) { + const { settings: cursorSettings } = i(Se); + const desiredCursor = + cursorSettings.hideMouseWhenPlaying && !e.paused + ? "none" + : "default"; + if (document.body.style.cursor !== desiredCursor) { + document.body.style.cursor = desiredCursor; + } + let keysPressed = t().keysJustPressed + keysPressed.Escape && (e.paused ? e.onResume() : e.onPause()); + keysPressed.z && (e.addCheckpoint()); + keysPressed.x && (e.removeCheckpoint()); + keysPressed.r && e.onReset && ((e.paused || e.onPause()), true) && a.alert.okCancel( + localize( + "Are you sure you want to return to the beginning?", + ), + (t) => + Am(this, void 0, void 0, function* () { + t && e.onReset(); + }), + ); + }, + cleanup() { + document.body.style.cursor = "default"; + }, + render({ props: e, state: t, device: a, getContext: i }) { + const { settings: n } = i(Se); + return [ + ifConditional( + () => !i(Se).settings.hideMouseWhenPlaying, + () => [ + menuButtonSprite.Single( + { + hidden: n.hideUi, + onPress: e.onPause, + x: + (-a.size.fullWidth / 2 + + (isSpecialTheme(e.theme) ? 35 : 50)) * + (n.mirrorMenuButton ? -1 : 1), + y: + a.size.fullHeight / 2 - + (isSpecialTheme(e.theme) ? 25 : 50), + theme: e.theme, + background: e.background, + }, + (t) => { + ((t.background = e.background), + (t.hidden = i(Se).settings.hideUi), + (t.x = + (-a.size.fullWidth / 2 + + (isSpecialTheme(t.theme) ? 35 : 50)) * + (i(Se).settings.mirrorMenuButton ? -1 : 1)), + (t.y = + a.size.fullHeight / 2 - + (isSpecialTheme(t.theme) ? 25 : 50))); + }, ), - ...e.map( - ( - { - levelFileName: e, - levelName: t, - unlockedByIndex: n, - x: o, - y: r, - difficulty: l, - boss: c, + ], + ), + ifConditional( + () => !i(Se).settings.hideUi && !i(Se).settings.hideMouseWhenPlaying, + () => [ + Yo.Single( + { + text: localize("FLAG"), + onPress: () => { + (e.addCheckpoint()); }, - d, - ) => { - const { checkpointsComplete: u, noCheckpointsComplete: h } = - s[d], - p = - null !== n && - !s[n].checkpointsComplete && - !s[n].noCheckpointsComplete && - true; - return Qf({ - id: `LevelButton-${e}`, - levelName: t, - checkpointsComplete: u, - noCheckpointsComplete: h, - difficulty: l, - isBoss: Boolean(c), - selected: (null == i ? void 0 : i.levelName) === t, - x: o, - y: r, - locked: false, //p, - onPress: () => a(d), - }); + width: Pm, + height: Mm, + x: + Mm / -2, + y: a.size.fullHeight / -2 + 40, + }, + (e) => { + ((e.x = Mm / -2), + (e.y = a.size.fullHeight / -2 + 40)); }, ), - n ? zf({ id: "LevelsHelp", x: e[0].x, y: e[0].y + 70 }) : null, - ]; - }, - }), - Qf = makeCustomSprite({ - render({ props: e }) { - let t = "", - a = 0, - i = 0; - return ( - e.locked - ? ((t = "Level_Locked.png"), (a = 45), (i = 73.5)) - : ((t = `difficultyIcons/${e.difficulty}.png`), - (a = 48), - (i = 121.5)), - [ - Clickable({ - id: "Clickable", - width: 60, - height: 160, - onPress: e.onPress, - disabled: e.locked, - sprites: () => [ - Uo({ - id: "SelectedLevelFade", - shouldShow: e.selected, - sprite: (e) => [ - l({ - fileName: - "images/mainMenu/levelSelect/difficultyIcons/background.png", - width: 73.5, - height: 136.5, - y: 25, - opacity: e, - }), - ], - }), - l({ - fileName: `images/mainMenu/levelSelect/${t}`, - width: a, - height: i, - anchorY: -i / 2, - y: -30, - }), - e.locked - ? null - : n({ - text: e.levelName.toUpperCase(), - color: Oe, - font: { weight: 500 }, - y: -45, - }), - e.isBoss && !e.locked - ? n({ - text: "BOSS", - color: Oe, - font: { weight: 800 }, - y: -58, - }) - : null, - ], - }), - e.checkpointsComplete - ? l({ - fileName: "images/mainMenu/levelSelect/Star01.png", - width: 20, - height: 20, - x: -20, - y: 15 + 5 * e.difficulty * 1.5, - }) - : null, - e.noCheckpointsComplete - ? l({ - fileName: "images/mainMenu/levelSelect/Star02.png", - width: 20, - height: 20, - x: 20, - y: 15 + 5 * e.difficulty * 1.5, - }) - : null, - ] - ); - }, + Yo.Single( + { + text: "<", + onPress: () => { + (e.removeCheckpoint()); + }, + width: Mm, + height: Mm, + x: + Pm / 2, + y: a.size.fullHeight / -2 + 40, + }, + (e) => { + ((e.x = Pm / 2), + (e.y = a.size.fullHeight / -2 + 40)); + }, + ), + ] + ), + c({ + text: localize(`PRACTICE MODE`), + font: { size: 15 }, + color: Ve, + x: 0, + y: a.size.fullHeight / -2 + 10, + hidden: true + }, (t) => { + t.opacity = +e.isPractice + }), + ifConditional( + () => void 0 !== e.boosters, + () => [ + ifConditional( + () => !i(Se).settings.hideMouseWhenPlaying, + () => [ + Yo.Single( + { + text: localize("BOOSTERS"), + onPress: () => { + (e.boosters.onOpen(), + e.onPause(), + (t.boostersMenuOpen = true)); + }, + width: Pm, + height: Mm, + x: + (a.size.fullWidth / 2 - 80) * + (n.mirrorMenuButton ? -1 : 1), + y: a.size.fullHeight / 2 - 50, + }, + (e) => { + ((e.x = + (a.size.fullWidth / 2 - 80) * + (i(Se).settings.mirrorMenuButton ? -1 : 1)), + (e.y = a.size.fullHeight / 2 - 50)); + }, + ), + ifConditional( + () => e.boosters.showPrompt, + () => [ + Fm.Single( + { + x: a.size.fullWidth / 2 - 40, + y: a.size.fullHeight / 2 - 85, + }, + (e) => { + ((e.x = a.size.fullWidth / 2 - 40), + (e.y = a.size.fullHeight / 2 - 85)); + }, + ), + ], + ), + ], + ), + ], + ), + ifConditional( + () => e.paused, + () => [ + conditional( + () => t.boostersMenuOpen && void 0 !== e.boosters, + () => [ + Lm.Single( + { + booster: e.boosters.booster, + pressedBooster: (a) => { + (e.boosters.pressedBooster(a), + (t.boostersMenuOpen = false)); + }, + closeMenu: () => { + ((t.boostersMenuOpen = false), e.onResume()); + }, + disableMissiles: e.boosters.disableMissiles, + }, + (t) => { + t.booster = e.boosters.booster; + }, + ), + ], + () => [ + pauseMenu.Single( + { + backToMenu: e.backToMenu, + onResume: e.onResume, + onReset: e.onReset, + onEndGame: e.onEndGame, + attempt: e.attempt, + frame: e.frame, + maxFrame: e.maxFrame, + fadeOutAttempts: e.fadeOutAttempts, + }, + (t) => { + t.fadeOutAttempts = e.fadeOutAttempts; + }, + ), + ], + ), + ], + ), + ]; + }, + }), + pauseMenu = makeSprite({ + init: ({ props: { onReset: e, onEndGame: t } }) => ({ + xPositions: + e || t + ? Array.from({ length: 4 }).map((e, t) => 170 * (t - 1.5)) + : Array.from({ length: 3 }).map((e, t) => 170 * (t - 1)), + showSettings: false, }), - Zf = makeCustomSprite({ - init({ updateState: e, device: t, getContext: a }) { - const { online: i } = a(Se); - return ( - i && - bp - .getBuyableItems(i.backend) - .then((t) => { - e((e) => - Object.assign(Object.assign({}, e), { - passItem: - t.find( - (e) => "bonus_level_super_level_pack" === e.defId, - ) || "loading", - }), - ); - }) - .catch((e) => { - t.alert.ok( - `Couldn't retrieve items from store: ${e.message}`, - ); - }), - { - passItem: "loading", - showBuyBlocksModal: null, - isPurchasing: false, - } - ); - }, - render({ - props: { didBuy: e, song: t }, - state: { showBuyBlocksModal: a, isPurchasing: i, passItem: s }, - device: o, - updateState: c, - getContext: d, - }) { - const u = null !== t, - h = t ? hl.getSnippetName(t.fileName) : null, - p = [ - We({ color: Re, width: 360, height: 290, y: -5, x: -5 }), - We({ color: ve, width: Wf, height: qf }), - u - ? r({ - fillColor: Re, - path: [ - [0, 0], - [10, 10], - [10, -10], - ], - anchorX: 14, - x: -180, - }) - : null, - l({ - fileName: `images/superLevelPack/${ - (null == t ? void 0 : t.name) || "Default" - }.png`, - x: -75, - y: 10, - width: 180, - height: 113, + render({ props: e, state: t, device: a }) { + return [ + _e.Single( + { + width: a.size.fullWidth, + height: a.size.fullHeight, + sprites: () => [], + onPress: () => null, + }, + (e) => { + ((e.width = a.size.fullWidth), + (e.height = a.size.fullHeight)); + }, + ), + p( + { + color: "#34065a", + opacity: 0.74, + width: a.size.fullWidth, + height: a.size.fullHeight, + }, + (e) => { + ((e.width = a.size.fullWidth), + (e.height = a.size.fullHeight)); + }, + ), + conditional( + () => t.showSettings, + () => [ + Om.Single({ + goBack: () => { + t.showSettings = false; + }, }), - r({ - fillColor: ve, - path: [ - [-165, 66.5], - [-145, 66.5], - [-165, 46.5], + ], + () => [ + ifConditional( + () => e.fadeOutAttempts, + () => [ + c({ + text: `${localize("ATTEMPT")} ${e.attempt}`, + font: { size: 15 }, + color: ve, + x: 0, + y: -a.size.fullHeight * 0.45, + }), ], - }), - r({ - fillColor: ve, - path: [ - [15, -46.5], - [15, -26.5], - [-5, -46.5], + ), + ifConditional( + () => e.maxFrame > 0, + () => [ + c({ + text: `${(e.frame / e.maxFrame) * 100}%`, + font: { size: 15 }, + color: ve, + x: 0, + y: -a.size.fullHeight * 0.45 + 15, + }), ], + ), + Je.Single({ + text: localize("RESUME"), + width: 100, + height: 100, + onPress: e.onResume, + x: t.xPositions[0], }), - n({ - font: { size: 20 }, - text: u ? "UNLOCKED WITH THE" : "GET THE", - color: Be, - y: 115, - }), - n({ - font: { size: 20 }, - text: "SUPER LEVEL PACK", - color: Be, - y: 90, - }), - n({ - font: { size: 12 }, - text: "INCLUDES LEVELS", - color: Be, - x: 95, - y: 55, - }), - n({ - font: { size: 12 }, - text: "FOR YOU", - color: t === hl.songs.forYou ? He : Me, - x: 95, - y: 35, - }), - n({ - font: { size: 12 }, - text: "COOL FRIENDS", - color: t === hl.songs.coolFriends ? He : Me, - x: 95, - y: 15, - }), - n({ - font: { size: 12 }, - text: "NACREOUS SNOWMELT", - x: 95, - color: t === hl.songs.nacreousSnowmelt ? He : Me, - y: -5, - }), - n({ - font: { size: 12 }, - text: "AURA", - color: t === hl.songs.aura ? He : Me, - x: 95, - y: -25, + Je.Single({ + text: localize("SETTINGS"), + width: 100, + height: 100, + onPress: () => { + t.showSettings = true; + }, + x: t.xPositions[1], }), - h - ? Gf({ - id: `LoadSong-${h}`, - assets: { audioFileNames: [h] }, - sprites: [ - Ro.Single({ - id: `PreviewSong-${h}`, - fileName: h, - loop: false, - paused: false, - fromPosition: 0, - overwrite: true, - isGameSfx: false, + conditional( + () => void 0 !== e.onReset, + () => [ + Je.Single({ + text: localize("RESET"), + width: 100, + height: 100, + onPress: () => { + a.alert.okCancel( + localize( + "Are you sure you want to return to the beginning?", + ), + (t) => + Am(this, void 0, void 0, function* () { + t && e.onReset(); + }), + ); + }, + x: t.xPositions[2], + }), + ], + () => [ + ifConditional( + () => void 0 !== e.onEndGame, + () => [ + Je.Single({ + text: "END GAME", + colour: xe, + width: 100, + height: 100, + onPress: () => { + a.alert.okCancel( + localize( + "Are you sure you want to end the game for all players?", + ), + (t) => + Am(this, void 0, void 0, function* () { + t && (e.onResume(), e.onEndGame()); + }), + ); + }, + x: t.xPositions[2], }), ], - }) - : null, - ], - { online: g } = d(Se); - if (!g) return [...p, _m({ id: "GoOnline", y: -90 })]; - const { - blocksBalance: m, - backend: f, - updateBlocksBalance: y, - } = g, - E = (t) => { - bp.buyItem(f, t) - .then( - ({ balance: t, item: a }) => ( - y(t), - "bonusLevelItem" === a.type && e(a), - o.audio("audio/global/purchase-item.wav").play(), - Jp.addPurchasedItems([a], o.now) ), - ) - .catch((e) => { - o.alert.ok(`Error buying item: ${e.message}`); - }) - .finally(() => { - c((e) => - Object.assign(Object.assign({}, e), { - isPurchasing: false, - }), - ); - }); + ], + ), + Je.Single({ + text: localize("MENU"), + width: 100, + height: 100, + onPress: e.backToMenu, + x: t.xPositions[t.xPositions.length - 1], + }), + ], + ), + ]; + }, + }); + function xm(e, t, a) { + return !( + !a || + !a.withCheckpoints || + t || + (a.showBoostersPrompt && "waitingToShow" === e) + ); + } + const Pm = 110, + Mm = 40, + Lm = makeSprite({ + init: ({ props: e, getState: t }) => + e.booster + ? { + view: { + type: "boosters", + boosters: { + items: [], + numAutopilots: 0, + numMissiles: 0, + numSlowMotions: 0, + }, + buying: null, + }, + } + : (Jp.getUserItems("booster").then((e) => { + t().view = { + type: "boosters", + boosters: Object.assign( + { items: e }, + kp.calculateNumberBoosters(e), + ), + buying: null, }; - return [ - ...p, - n({ - text: `BLOCKS: ${m}`, + }), + { view: { type: "loading" } }), + render: ({ props: e, state: t, device: a, getContext: i }) => [ + p({ width: 600, height: 320, color: ve }), + _e.Single({ + onPressOutside: e.closeMenu, + width: 600, + height: 320, + sprites: () => [], + onPress: () => null, + }), + Yo.Single({ + text: "X", + x: 300, + y: 160, + width: 40, + height: 40, + onPress: e.closeMenu, + strokeColor: Ye, + }), + c({ + font: { size: 38 }, + text: localize("BOOSTERS"), + strokeColor: Ye, + color: ve, + strokeThickness: 12, + y: 160, + }), + conditional( + () => "loading" === t.view.type, + () => [ + c({ + text: `${localize("LOADING")}...`, color: ve, strokeColor: Ye, - font: { size: 12 }, - strokeThickness: 4, - x: 120, - y: -55, + strokeThickness: 3, }), - Fo({ - id: "Add Blocks", - text: "+", - fontSize: 24, - width: 50, - height: 50, - onPress: () => { - c((e) => - Object.assign(Object.assign({}, e), { - showBuyBlocksModal: {}, - }), - ); + ], + () => { + var n, s, o; + const r = () => { + e.booster && e.pressedBooster(e.booster); + }, + l = (e) => { + t.view.buying = e; }, - x: 120, - y: -95, - strokeColor: Ye, - textColor: ve, - textStroke: Ye, - textStrokeThickness: 6, - }), - ...("loading" === s - ? [ - n({ - text: `${localize("LOADING")}...`, - font: { size: 20 }, - color: Ye, - x: -50, - y: -90, - }), - ] - : i - ? [ - n({ - text: `${localize("PURCHASING")}...`, - font: { size: 20 }, - color: Ye, - x: -50, - y: -90, - }), - ] - : [ - Fo({ - id: "BuyPack", - text: `BUY - ${s.blocksPrice} BLOCKS`, - width: 200, - height: 60, - onPress: () => { - (c((e) => - Object.assign(Object.assign({}, e), { - isPurchasing: true, - }), - ), - s.blocksPrice > m - ? c((e) => - Object.assign(Object.assign({}, e), { - showBuyBlocksModal: { - buyItemOnComplete: s, - }, - }), - ) - : E(s)); - }, - x: -50, - y: -90, - strokeColor: Ye, - textColor: ve, - textStroke: Ye, - textStrokeThickness: 4, - }), - ]), - a && - bm({ - id: "BuyBlocksModal", - x: -155, - onModalClose: () => { - c((e) => - Object.assign(Object.assign({}, e), { - showBuyBlocksModal: null, - isPurchasing: false, - }), - ); + d = (n) => { + const s = t.view.boosters.items.find( + (e) => e.booster.type === n.type, + ); + if (!s) return; + t.view = { type: "loading" }; + const { online: o } = i(Se); + o + ? bp + .useItem(o.backend, s) + .then((e) => Jp.useBooster(a.now, e || s, false)) + .then(() => { + e.pressedBooster(s.booster); + }) + .catch((t) => { + a.alert.ok( + `Failed to use item: ${t.message}`, + e.closeMenu, + ); + }) + : Jp.useBooster(a.now, s, true).then(() => { + e.pressedBooster(s.booster); + }); + }; + return [ + c({ + text: localize("BOOSTERS LAST UNTIL THE NEXT CHECKPOINT"), + font: { size: 15 }, + color: Ye, + y: -120, + }), + Dm.Single( + { + name: "AUTOPILOT", + isBeingUsed: + "autopilot" === + (null === (n = e.booster) || void 0 === n + ? void 0 + : n.type), + disable: null !== e.booster && "autopilot" !== e.booster.type, + numBooster: t.view.boosters.numAutopilots, + onUseBooster: () => { + d(Pu()); + }, + onAddBooster: () => { + l(Pu()); + }, + onCancelBooster: r, + x: -190, + y: 20, }, - onPurchaseComplete: (e) => { - (a.buyItemOnComplete && - e >= a.buyItemOnComplete.blocksPrice && - E(a.buyItemOnComplete), - y(e), - c((e) => - Object.assign(Object.assign({}, e), { - showBuyBlocksModal: null, - }), - )); + (a) => { + var i; + ((a.isBeingUsed = + "autopilot" === + (null === (i = e.booster) || void 0 === i + ? void 0 + : i.type)), + (a.disable = null !== e.booster && + "autopilot" !== e.booster.type), + "boosters" === t.view.type && + (a.numBooster = t.view.boosters.numAutopilots)); }, - }), - ]; - }, - }), - ey = makeCustomSprite({ - init: ({ updateState: e, preloadFiles: t, device: a }) => ( - Promise.all([ - Jp.getUserItems("bonusLevel"), - Jp.getLocal(a.storage), - t({ imageFileNames: Qs.superLevelPackImages }), - ]).then(([t, i]) => { - (i.data.hasVisitedSuperLevelPack || - Jp.saveLocal(a.storage, a.alert, a.now, { - hasVisitedSuperLevelPack: true, - }), - e((e) => - Object.assign(Object.assign({}, e), { levelItems: t }), - )); - }), - { selectedLevelIndex: null, levelItems: "loading" } + ), + Dm.Single( + { + name: "MISSILES", + isBeingUsed: + "missiles" === + (null === (s = e.booster) || void 0 === s + ? void 0 + : s.type), + disable: + (null !== e.booster && + "missiles" !== e.booster.type) || + e.disableMissiles, + numBooster: t.view.boosters.numMissiles, + onUseBooster: () => { + d(Mu()); + }, + onAddBooster: () => { + l(Mu()); + }, + onCancelBooster: r, + y: 20, + }, + (a) => { + var i; + ((a.isBeingUsed = + "missiles" === + (null === (i = e.booster) || void 0 === i + ? void 0 + : i.type)), + (a.disable = + (null !== e.booster && + "missiles" !== e.booster.type) || + e.disableMissiles), + "boosters" === t.view.type && + (a.numBooster = t.view.boosters.numMissiles)); + }, + ), + Dm.Single( + { + name: "SLOW MOTION", + isBeingUsed: + "slowmo" === + (null === (o = e.booster) || void 0 === o + ? void 0 + : o.type), + disable: + null !== e.booster && "slowmo" !== e.booster.type, + numBooster: t.view.boosters.numSlowMotions, + onUseBooster: () => { + d(Lu()); + }, + onAddBooster: () => { + l(Lu()); + }, + onCancelBooster: r, + x: 190, + y: 20, + }, + (a) => { + var i; + ((a.isBeingUsed = + "slowmo" === + (null === (i = e.booster) || void 0 === i + ? void 0 + : i.type)), + (a.disable = + null !== e.booster && "slowmo" !== e.booster.type), + "boosters" === t.view.type && + (a.numBooster = t.view.boosters.numSlowMotions)); + }, + ), + ifConditional( + () => + "boosters" === t.view.type && null !== t.view.buying, + () => [ + Bm.Single({ + booster: t.view.buying, + addItem: (e) => { + const a = t.view, + i = [...a.boosters.items, e]; + a.boosters = Object.assign( + { items: i }, + kp.calculateNumberBoosters(i), + ); + }, + closeMenu: () => { + t.view.buying = null; + }, + }), + ], + ), + ]; + }, + ), + ], + }), + Dm = makeSprite({ + render: ({ props: e }) => [ + m( + { + thickness: 4, + color: Ye, + lineCap: "round", + path: [ + [-80, 50], + [-50, 80], + [80, 80], + [80, -50], + [50, -80], + [-80, -80], + [-80, 50], + ], + }, + (t) => { + t.fillColor = e.isBeingUsed ? Ye : void 0; + }, ), - render({ - props: e, - device: { - size: { fullHeight: t, fullWidth: a }, + Yo.Single( + { + text: localize(e.name), + disabled: e.disable || e.isBeingUsed || 0 === e.numBooster, + width: 140, + height: 60, + onPress: () => { + e.onUseBooster(); + }, + y: 20, }, - state: { selectedLevelIndex: i, levelItems: s }, - updateState: o, - }) { - const r = [ - Uf({ - id: "Title", - text: localize("BONUS LEVELS"), - width: 200, - height: 35, - x: -a / 2 + 120, - y: t / 2 - 40, - }), - Fo({ - id: "BackButton", - text: localize("BACK"), - width: 80, + (t) => { + t.disabled = e.disable || e.isBeingUsed || 0 === e.numBooster; + }, + ), + conditional( + () => e.isBeingUsed, + () => [ + Yo.Single({ + text: "CANCEL", + width: 100, height: 40, onPress: () => { - (e.fadeInMusic(), e.onBack()); + e.onCancelBooster(); }, - x: -a / 2 + 60, - y: -t / 2 + 40, + y: -40, }), - ]; - if ("loading" === s) - return [ - ...r, - n({ - text: `${localize("LOADING")}...`, - color: ve, - font: { size: 15 }, - }), - ]; - const l = null === i ? null : Hl.bonusLevels[i], - c = null !== l && ty(l, s), - d = !zu.hasIAP() || s.some((e) => "superLevelPack" === e.name), - u = t - 156, - h = (e) => { - o((t) => - "loading" === t.levelItems - ? t - : Object.assign(Object.assign({}, t), { - levelItems: [...t.levelItems, e], - selectedLevelIndex: - null === t.selectedLevelIndex - ? 1 - : t.selectedLevelIndex, + ], + () => [ + ifConditional( + () => !e.disable, + () => [ + conditional( + () => 0 === e.numBooster, + () => [ + Yo.Single({ + text: "+", + fontSize: 30, + width: 40, + height: 40, + onPress: () => { + e.onAddBooster(); + }, + y: -40, }), + ], + () => [ + c( + { + text: `x${e.numBooster}`, + font: { size: 20 }, + color: Re, + strokeColor: Ye, + strokeThickness: 4, + y: -40, + }, + (t) => { + t.text = `x${e.numBooster}`; + }, + ), + ], + ), + ], + ), + ], + ), + ], + }), + Bm = makeSprite({ + init({ props: e, device: t, getState: a, getContext: i }) { + const { online: n } = i(Se); + return ( + n && + bp + .getBuyableItems(n.backend, e.booster.type) + .then((e) => { + a().items = e; + }) + .catch((a) => { + t.alert.ok( + `Couldn't retrieve items from store: ${a.message}`, + () => { + e.closeMenu(); + }, ); - }; - return [ - We({ - color: ve, - width: 280, - height: u + 6, - x: -190, - strokeColor: Ye, - strokeThickness: 6, }), - null !== i - ? jf({ - id: "InvisibleModal", - closeModal: () => { - (e.fadeInMusic(), - o((e) => - Object.assign(Object.assign({}, e), { - selectedLevelIndex: null, - }), - )); - }, - x: 155, - width: Wf, - height: qf, + { + items: "loading", + showBuyBlocksModal: null, + isPurchasing: false, + } + ); + }, + render: ({ props: e, state: t, device: a, getContext: i }) => [ + _e.Single({ + onPressOutside: e.closeMenu, + width: 600, + height: 320, + sprites: () => [], + onPress: () => null, + }), + qe({ + width: 600, + height: 320, + fillColor: ve, + color: Ye, + thickness: 8, + }), + Yo.Single({ + text: "X", + x: 300, + y: 160, + width: 40, + height: 40, + onPress: e.closeMenu, + strokeColor: Ye, + }), + conditional( + () => null === i(Se).online, + () => [ + c({ + text: localize("CONNECT ONLINE TO BUY BOOSTERS"), + color: Ye, + }), + vm.Single({ y: -50 }), + ], + () => { + const n = (i, n) => { + bp.buyItem(n.backend, i) + .then(({ balance: t, item: i }) => { + if ( + (n.updateBlocksBalance(t), "boosterItem" === i.type) + ) + return ( + e.addItem(i), + a.audio("audio/global/purchase-item.wav").play(), + Jp.addPurchasedItems([i], a.now) + ); }) - : null, - ScrollContainer({ - id: "ScrollContainer", - containerHeight: u, - containerWidth: 250, - contentHeight: 80 * Math.ceil(Hl.bonusLevels.length) + 30, - y: u / 2, - x: -190, - sprites: (t) => [ - ...Hl.bonusLevels.map((a, n) => { - const r = !ty(a, s); - return ay({ - id: `Lvl-${n}`, - song: a.song, - - name: a.levelName, - author: a.author, - locked: r, - selected: i === n, + .then(() => { + e.closeMenu(); + }) + .catch((e) => { + a.alert.ok(`Error buying item: ${e.message}`); + }) + .finally(() => { + t.isPurchasing = false; + }); + }; + return [ + c( + { + color: ve, + strokeColor: Ye, + font: { size: 15 }, + strokeThickness: 6, + x: 200, + y: 50, + }, + (e) => { + const { blocksBalance: t } = i(Se).online; + e.text = `BLOCKS: ${t}`; + }, + ), + ...(zu.hasIAP() + ? [ + Yo.Single({ + text: "+", + fontSize: 30, + width: 60, + height: 60, onPress: () => { - (e.fadeOutMusic(), - o((e) => - Object.assign(Object.assign({}, e), { - selectedLevelIndex: n, - }), - )); - }, - y: -50 - 80 * n, - noPress: t, - }); - }), - ], - }), - ...r, - l && null !== i - ? true // c - ? $f({ - id: `LevelView-${l.levelFileName}`, - worldLevel: l, - levelProgress: - e.worldProgress.find( - (e) => e.levelName === l.levelName, - ) || zl(0, i, l.levelName), - x: 155, - playLevel: (t) => { - e.playLevel(l, { - number: 0, - levelIndex: i, - withCheckpoints: t, - }); + t.showBuyBlocksModal = {}; }, - arrow: { y: 0, facingLeft: false }, - showHighScore: - "carnival" === l.levelFileName || - "funky-adventures" === l.levelFileName, - showStartArrows: false, - }) - : "cloud-9" === l.levelFileName - ? iy({ id: "LockedModal", x: 155, song: l.song }) - : Zf({ - id: "BuySuperLevelPackModal", - x: 155, - song: l.song, - didBuy: h, - }) - : d - ? null - : Zf({ - id: "BuySuperLevelPackModal", - x: 155, - song: null, - didBuy: h, + x: 210, + strokeColor: Ye, + textColor: ve, + textStroke: Ye, + textStrokeThickness: 6, }), - ]; - }, - }); - function ty(e, t) { - return "cloud-9" === e.levelFileName - ? t.some((e) => "cloud9" === e.name) - : !zu.hasIAP() || t.some((e) => "superLevelPack" === e.name); - } - const ay = makeCustomSprite({ - render({ - props: { - song: e, - name: name, - author: author, - selected: t, - locked: a, - onPress: i, - noPress: s, - }, - device: o, - }) { - let r = e.author.toLocaleUpperCase(); - return ( - r.length > 15 && (r = `${r.slice(0, 15)}...`), - [ - Clickable({ - id: "Clickable", - width: 240, - height: 65, - onPress: () => { - (o.audio("audio/global/button.wav").play(0), i()); - }, - disabled: s, - sprites: (i) => [ - So({ - id: "RaiseRects", - width: 240, - height: 65, - raiseHeight: 5, - rad: 5, - isPressed: i, - topColour: i ? ke : t ? Re : Le, - bottomColour: Ue, - stroke: { thickness: 2, colour: Ye }, - shadowDir: "down", - sprites: (t) => [ - n({ - font: { size: 15 }, - text: name.toLocaleUpperCase(), - color: Ue, - y: t + 8, + ] + : [ + c({ + font: { size: 14 }, + text: "GET ACHIEVEMENTS", + color: Me, + x: 210, + y: 0, + }), + c({ + font: { size: 14 }, + text: "TO EARN", + color: Me, + x: 210, + y: -20, + }), + c({ + font: { size: 14 }, + text: "MORE BLOCKS", + color: Me, + x: 210, + y: -40, + }), + ]), + conditional( + () => "loading" === t.items, + () => [ + c({ + text: `${localize("LOADING")}...`, + font: { size: 20 }, + color: Ye, + }), + ], + () => [ + conditional( + () => t.isPurchasing, + () => [ + c({ + text: `${localize("PURCHASING")}...`, + font: { size: 20 }, + color: Ye, }), - n({ - font: { size: 15, weight: 500, style: "italic" }, - text: `${localize('by')} ${author ? author : r}`, - color: Ue, - y: t - 10, + ], + () => [ + d({ + props: (e, t) => ({ + font: { size: 18 }, + x: -150, + color: ve, + strokeColor: Ye, + strokeThickness: 4, + text: e.name, + y: 80 - 80 * t, + }), + array: () => t.items, + }), + Yo.Array({ + props: (e, a) => ({ + text: `${e.blocksPrice} BLOCKS`, + strokeColor: Ye, + textColor: ve, + textStroke: Ye, + textStrokeThickness: 5, + width: 130, + height: 50, + onPress: () => { + const a = i(Se).online; + ((t.isPurchasing = true), + e.blocksPrice > a.blocksBalance + ? (t.showBuyBlocksModal = { + buyItemOnComplete: e, + }) + : n(e, a)); + }, + x: 50, + y: 80 - 80 * a, + }), + key: (e, t) => t, + array: () => t.items, }), - false //a - ? l({ - fileName: "images/mainMenu/lockIcon.png", - width: 40, - height: 40, - x: 90, - y: t, - }) - : null, ], + ), + ], + ), + ifConditional( + () => null !== t.showBuyBlocksModal, + () => [ + Sm.Single({ + onModalClose: () => { + ((t.showBuyBlocksModal = null), + (t.isPurchasing = false)); + }, + onPurchaseComplete: (e) => { + const a = i(Se).online, + { buyItemOnComplete: s } = t.showBuyBlocksModal; + (s && e >= s.blocksPrice && n(s, a), + a.updateBlocksBalance(e), + (t.showBuyBlocksModal = null)); + }, + }), + ], + ), + ]; + }, + ), + ], + }), + Fm = makeSprite({ + init: () => ({ arrowY: 0 }), + loop({ state: e }) { + ((e.arrowY += 0.3), e.arrowY > 10 && (e.arrowY = -10)); + }, + render: ({ state: e }) => [ + c({ + text: localize("STUCK? TRY A BOOSTER"), + color: "white", + font: { align: "right", size: 14 }, + x: -15, + }), + y( + { fileName: "images/level/arrow-up.png", width: 14, height: 8 }, + (t) => { + t.y = -5 + Math.abs(e.arrowY); + }, + ), + ], + }), + Ym = JSON.parse( + '{"75":1,"81":0,"186":1,"193":0,"303":1,"313":0,"332":1,"339":0,"440":1,"449":0,"548":1,"559":0,"612":1,"676":0,"717":1,"727":0,"775":1,"784":0,"881":1,"968":0,"1051":1,"1061":0,"1133":1,"1142":0,"1187":1,"1195":0,"1215":1,"1280":0,"1327":1,"1337":0,"1370":1,"1378":0,"1443":1,"1452":0,"1497":1,"1504":0,"1553":1,"1621":0,"1660":1,"1671":0,"1773":1,"1859":0,"2042":1,"2051":0,"2125":1,"2133":0,"2180":1,"2187":0,"2238":1,"2247":0,"2276":1,"2284":0,"2337":1,"2344":0,"2389":1,"2396":0,"2422":1,"2429":0,"2472":1,"2480":0,"2527":1,"2535":0,"2725":1,"2837":0,"2897":1,"2904":0,"2939":1,"2948":0,"3005":1,"3013":0,"3060":1,"3068":0,"3089":1,"3296":0,"3338":1,"3346":0,"3409":1,"3416":0,"3510":1,"3518":0,"3685":1,"3692":0,"3802":1,"3810":0,"3833":1,"3843":0,"3863":1,"3873":0,"3913":1,"3921":0,"4010":1,"4017":0,"4093":1,"4101":0,"4136":1,"4143":0,"4166":1,"4177":0,"4240":1,"4247":0,"4308":1,"4314":0,"4348":1,"4356":0,"4373":1,"4380":0,"4501":1,"4512":0,"4608":1,"4615":0,"4699":1,"4737":0,"4833":1,"4842":0,"4944":1,"4952":0,"5043":1,"5048":0,"5129":1,"5138":0,"5165":1,"5173":0,"5252":1,"5260":0,"5284":1,"5291":0,"5387":1,"5397":0,"5489":1,"5496":0,"5539":1,"5577":0,"5606":1,"5615":0,"5711":1,"5719":0,"5753":1,"5817":0,"5838":1,"5848":0,"5929":1,"5963":0,"6043":1,"6054":0,"6128":1,"6137":0,"6203":1,"6594":0,"6840":1,"6849":0,"6869":1,"6957":0,"7054":1,"7064":0,"7184":1,"7192":0,"7233":1,"7242":0,"7287":1,"7295":0,"7348":1,"7356":0,"7438":1,"7443":0,"7496":1,"7504":0,"7528":1,"7536":0,"7623":1,"7659":0,"7686":1,"7748":0,"7799":1,"7809":0,"7864":1,"7928":0,"8006":1,"8093":0,"8126":1,"8136":0,"8257":1,"8266":0,"8290":1,"8299":0,"8348":1,"8359":0,"8460":1,"8519":0,"8558":1,"8567":0,"8604":1,"8616":0,"8664":1,"8672":0}', + ), + Um = JSON.parse( + '{"113":1,"120":0,"196":1,"204":0,"227":1,"236":0,"354":1,"363":0,"456":1,"466":0,"476":1,"486":0,"728":1,"736":0,"859":1,"865":0,"953":1,"961":0,"976":1,"986":0,"1112":1,"1120":0,"1211":1,"1219":0,"1267":1,"1277":0,"1308":1,"1317":0,"1347":1,"1357":0,"1601":1,"1609":0,"1659":1,"1668":0,"1720":1,"1730":0,"1814":1,"1851":0,"1904":1,"1913":0,"1981":1,"1989":0,"2027":1,"2035":0,"2157":1,"2164":0,"2172":1,"2181":0,"2221":1,"2229":0,"2268":1,"2278":0,"2298":1,"2309":0,"2361":1,"2370":0,"2443":1,"2450":0,"2472":1,"2481":0,"2502":1,"2511":0,"2541":1,"2549":0,"2572":1,"2582":0,"2602":1,"2613":0,"2661":1,"2669":0,"2694":1,"2706":0,"2735":1,"2797":0,"2819":1,"2831":0,"2846":1,"2858":0,"2875":1,"2885":0,"2937":1,"2947":0,"2993":1,"3001":0,"3020":1,"3029":0,"3093":1,"3102":0,"3129":1,"3229":0,"3286":1,"3295":0,"3316":1,"3325":0,"3357":1,"3366":0,"3389":1,"3400":0,"3444":1,"3454":0,"3475":1,"3483":0,"3503":1,"3516":0,"3539":1,"3550":0,"3605":1,"3614":0,"3694":1,"3705":0,"3760":1,"3768":0,"3856":1,"3988":0,"4127":1,"4135":0,"4158":1,"4170":0,"4192":1,"4201":0,"4225":1,"4236":0,"4286":1,"4295":0,"4341":1,"4353":0,"4372":1,"4382":0,"4431":1,"4440":0,"4494":1,"4504":0,"4520":1,"4532":0,"4560":1,"4571":0,"4611":1,"4621":0,"4728":1,"4737":0,"4755":1,"4765":0,"4844":1,"4853":0,"4887":1,"4896":0,"4947":1,"4956":0,"4969":1,"4980":0,"5017":1,"5025":0,"5062":1,"5073":0,"5097":1,"5109":0,"5159":1,"5174":0,"5198":1,"5207":0,"5232":1,"5241":0,"5261":1,"5269":0,"5294":1,"5303":0,"5325":1,"5334":0,"5356":1,"5366":0,"5386":1,"5396":0,"5418":1,"5429":0,"5447":1,"5518":0,"5544":1,"5555":0,"5638":1,"5646":0,"5670":1,"5680":0,"5700":1,"5711":0,"5755":1,"5766":0,"5788":1,"5800":0,"5823":1,"5838":0,"5853":1,"5868":0,"5880":1,"5895":0,"5912":1,"5925":0,"5973":1,"5982":0,"5994":1,"6004":0,"6067":1,"6076":0,"6083":1,"6094":0,"6170":1,"6185":0,"6203":1,"6214":0,"6258":1,"6267":0,"6328":1,"6338":0,"6380":1,"6389":0,"6449":1,"6457":0,"6499":1,"6508":0,"6544":1,"6551":0,"6558":1,"6567":0,"6578":1,"6589":0,"6669":1,"6677":0,"6710":1,"6718":0,"6823":1,"6833":0,"6858":1,"6869":0,"7012":1,"7021":0,"7070":1,"7079":0,"7089":1,"7100":0,"7139":1,"7207":0,"7234":1,"7245":0,"7262":1,"7274":0,"7297":1,"7308":0,"7328":1,"7347":0,"7363":1,"7375":0,"7396":1,"7406":0,"7437":1,"7447":0,"7471":1,"7480":0,"7529":1,"7537":0,"7638":1,"7649":0,"7674":1,"7684":0,"7707":1,"7717":0,"7738":1,"7748":0,"7766":1,"7776":0,"7799":1,"7810":0,"7829":1,"7841":0,"7876":1,"7885":0,"8012":1,"8022":0,"8044":1,"8053":0,"8076":1,"8086":0,"8128":1,"8139":0,"8170":1,"8182":0,"8203":1,"8214":0,"8236":1,"8248":0,"8270":1,"8280":0,"8301":1,"8311":0,"8331":1,"8341":0,"8360":1,"8371":0,"8394":1,"8402":0,"8423":1,"8433":0,"8452":1,"8464":0,"8486":1,"8497":0,"8533":1,"8543":0,"8573":1,"8582":0}', + ), + jm = JSON.parse( + '{"61":1,"70":0,"112":1,"121":0,"168":1,"175":0,"221":1,"229":0,"282":1,"290":0,"325":1,"333":0,"390":1,"399":0,"473":1,"481":0,"523":1,"529":0,"580":1,"588":0,"628":1,"636":0,"930":1,"940":0,"973":1,"982":0,"1100":1,"1109":0,"1240":1,"1250":0,"1328":1,"1340":0,"1409":1,"1416":1,"1422":0,"1424":0,"1463":1,"1473":0,"1518":1,"1529":0,"1789":1,"1801":0,"1950":1,"1957":0,"1987":1,"1995":0,"2031":1,"2038":0,"2099":1,"2109":0,"2147":1,"2156":0,"2214":1,"2225":0,"2266":1,"2277":0,"2332":1,"2340":1,"2342":0,"2347":0,"2381":1,"2393":0,"2436":1,"2444":0,"2596":1,"2611":0,"2642":1,"2652":0,"2678":1,"2687":0,"2731":1,"2739":0,"2810":1,"2820":0,"3050":1,"3064":0,"3083":1,"3125":0,"3395":1,"3407":0,"3426":1,"3438":0,"3465":1,"3475":0,"3513":1,"3522":0,"3660":1,"3672":0,"3695":1,"3707":0,"3739":1,"3749":0,"3995":1,"4005":0,"4079":1,"4088":0,"4259":1,"4268":0,"4322":1,"4333":0,"4415":1,"4423":0,"4474":1,"4480":0,"4500":1,"4513":0,"4756":1,"4766":0,"4804":1,"4815":0,"4850":1,"4859":0,"4921":1,"4950":0,"4977":1,"4997":0,"5150":1,"5160":0}', + ), + Gm = JSON.parse( + '{"71":1,"77":0,"167":1,"174":0,"277":1,"285":0,"356":1,"365":0,"396":1,"409":0,"460":1,"469":0,"543":1,"551":0,"591":1,"599":0,"633":1,"640":0,"698":1,"705":0,"727":1,"734":0,"779":1,"788":0,"828":1,"835":0,"859":1,"867":0,"896":1,"904":0,"990":1,"997":0,"1041":1,"1104":0,"1138":1,"1149":0,"1203":1,"1212":0,"1229":1,"1238":0,"1260":1,"1267":0,"1292":1,"1332":0,"1376":1,"1387":0,"1406":1,"1414":0,"1426":1,"1438":0,"1461":1,"1469":0,"1514":1,"1524":0,"1543":1,"1550":0,"1568":1,"1578":0,"1633":1,"1641":0,"1728":1,"1735":0,"1759":1,"1765":0,"1785":1,"1792":0,"1858":1,"1866":0,"1925":1,"1932":0,"1961":1,"1972":0,"2019":1,"2027":0,"2087":1,"2096":0,"2126":1,"2133":0,"2153":1,"2164":0,"2243":1,"2251":0,"2369":1,"2374":0,"2445":1,"2456":0,"2500":1,"2507":0,"2512":1,"2518":0,"2554":1,"2561":0,"2611":1,"2620":0,"2662":1,"2674":0,"2741":1,"2750":0,"2828":1,"2838":0,"2880":1,"2890":0,"2929":1,"2937":0,"2963":1,"2971":0,"3021":1,"3031":0,"3048":1,"3056":0,"3080":1,"3090":0,"3148":1,"3156":0,"3198":1,"3206":0,"3277":1,"3285":0,"3337":1,"3346":0,"3386":1,"3396":0,"3425":1,"3435":0,"3460":1,"3468":0,"3502":1,"3511":0,"3535":1,"3543":0,"3674":1,"3681":0,"3699":1,"3707":0,"3721":1,"3729":0,"3757":1,"3766":0,"3884":1,"3889":0,"3894":0,"3917":1,"3925":0,"3941":1,"3949":0,"3973":1,"3979":0,"4003":1,"4013":0,"4020":1,"4029":0,"4111":1,"4118":0,"4146":1,"4157":0,"4253":1,"4260":0,"4302":1,"4309":0,"4332":1,"4343":0,"4371":1,"4380":0,"4405":1,"4413":0,"4455":1,"4468":0,"4523":1,"4530":0,"4692":1,"4700":0,"4727":1,"4735":0,"4768":1,"4775":0,"4793":1,"4801":0,"4833":1,"4839":0,"4895":1,"4902":0,"5078":1,"5084":0,"5160":1,"5189":0,"5243":1,"5250":0,"5302":1,"5309":0,"5355":1,"5364":0,"5417":1,"5424":0,"5464":1,"5472":0,"5529":1,"5539":0,"5669":1,"5676":0,"5709":0,"5787":1,"5795":0,"5878":1,"5886":0,"5991":1,"5998":0,"6040":1,"6048":0,"6107":1,"6115":0,"6221":1,"6232":0,"6280":1,"6288":0,"6337":1,"6344":0,"6433":1,"6442":0,"6494":1,"6529":0,"6612":1,"6621":0,"6643":1,"6652":0,"6685":1,"6694":0,"6715":1,"6723":0,"6757":1,"6771":0,"6819":1,"6827":0,"6851":1,"6859":0,"6878":1,"6886":0,"6911":1,"6923":0,"6947":1,"6956":0,"6991":1,"6999":0,"7017":1,"7025":0,"7078":1,"7086":0,"7142":1,"7148":0,"7159":1,"7171":0,"7219":1,"7230":0,"7247":1,"7309":0,"7373":1,"7382":0,"7439":1,"7447":0,"7484":1,"7492":0,"7511":1,"7519":0,"7588":1,"7595":0,"7640":1,"7648":0,"7676":1,"7685":0,"7703":1,"7713":0,"7736":1,"7741":0,"7747":1,"7753":0,"7759":1,"7772":0,"7875":1,"7881":0,"7972":1,"7979":0,"7988":1,"7995":0,"8134":1,"8143":0,"8156":1,"8166":0}', + ), + Vm = JSON.parse( + '{"85":1,"91":0,"172":1,"182":0,"230":1,"238":0,"284":1,"292":0,"361":1,"369":0,"414":1,"423":0,"445":1,"455":0,"519":1,"527":0,"600":1,"607":0,"664":1,"673":0,"721":1,"731":0,"755":1,"765":0,"858":1,"868":0,"1006":1,"1037":0,"1129":1,"1138":0,"1227":1,"1235":0,"1371":1,"1420":0,"1450":1,"1459":0,"1494":1,"1502":0,"1628":1,"1636":0,"1682":1,"1690":0,"1758":1,"1767":0,"1828":1,"1837":0,"1860":1,"1870":0,"1892":1,"1924":0,"1980":1,"1988":0,"2008":1,"2017":0,"2067":1,"2076":0,"2102":1,"2109":0,"2153":1,"2163":0,"2185":1,"2194":0,"2219":1,"2230":0,"2250":1,"2283":0,"2349":1,"2399":0,"2448":1,"2473":0,"2540":1,"2550":0,"2578":1,"2588":0,"2617":1,"2628":0,"2703":1,"2712":0,"2783":1,"2792":0,"2837":1,"2846":0,"2918":1,"2928":0,"2993":1,"3003":0,"3033":1,"3043":0,"3171":1,"3344":0,"3376":1,"3384":0,"3413":1,"3421":0,"3450":1,"3473":0,"3488":1,"3495":0,"3550":1,"3559":0,"3610":1,"3619":0,"3691":1,"3700":0,"3725":1,"3735":0,"3759":1,"3767":0,"3869":1,"3924":0,"3998":1,"4008":0,"4074":1,"4083":0,"4139":1,"4148":0,"4198":1,"4208":0,"4281":1,"4330":0,"4372":1,"4381":0,"4459":1,"4467":0,"4703":1,"4712":0,"4740":1,"4750":0,"4774":1,"4783":0,"4842":1,"4851":0,"4890":1,"4899":0,"4923":1,"4931":0,"4955":1,"4964":0,"5003":1,"5013":0,"5079":1,"5088":0,"5111":1,"5120":0,"5143":1,"5152":0,"5226":1,"5235":0,"5278":1,"5350":0,"5403":1,"5458":0,"5476":1,"5506":0,"5536":1,"5546":0,"5611":1,"5640":0,"5676":1,"5685":0,"5725":1,"5734":0,"5775":1,"5787":0,"5838":1,"5850":0,"5918":1,"5928":0,"6001":1,"6011":0,"6037":1,"6047":0,"6083":1,"6092":0,"6136":1,"6145":0,"6177":1,"6186":0,"6281":1,"6291":0,"6316":1,"6323":0,"6349":1,"6359":0,"6403":1,"6582":0,"6727":1,"6943":0,"7032":1,"7041":0,"7154":1,"7184":0,"7293":1,"7302":0,"7447":1,"7453":0,"7489":1,"7497":0,"7535":1,"7543":0,"7563":1,"7570":0,"7586":1,"7596":0,"7635":1,"7644":0,"7656":1,"7666":0,"7760":1,"7769":0,"7801":1,"7811":0,"7857":1,"7866":0,"7909":1,"7918":0,"7963":1,"7972":0,"8015":1,"8024":0,"8062":1,"8071":0,"8093":1,"8102":0,"8149":1,"8157":0,"8174":1,"8301":0,"8344":1,"8352":0,"8543":1,"8891":0,"8927":1,"8941":0,"8947":1,"9195":0,"9235":1,"9244":0,"9292":1,"9301":0,"9329":1,"9337":0,"9378":1,"9387":0,"9412":1,"9420":0,"9463":1,"9473":0,"9491":1,"9500":0,"9550":1,"9777":0,"9818":1,"9879":0}', + ), + Hm = JSON.parse( + '{"75":1,"83":0,"99":1,"106":0,"140":1,"147":0,"173":1,"180":0,"198":1,"205":0,"270":1,"276":0,"292":1,"298":0,"360":1,"369":0,"405":1,"411":0,"437":1,"446":0,"458":1,"466":0,"484":1,"493":0,"530":1,"537":0,"554":1,"561":0,"582":1,"589":0,"611":1,"617":0,"652":1,"686":0,"722":1,"728":0,"747":1,"753":0,"793":1,"801":0,"817":1,"825":0,"863":1,"869":0,"914":1,"921":0,"981":1,"987":0,"1004":1,"1013":0,"1037":1,"1044":0,"1069":1,"1076":0,"1087":1,"1095":0,"1106":1,"1115":0,"1131":1,"1139":0,"1165":1,"1173":0,"1207":1,"1214":0,"1253":1,"1262":0,"1281":1,"1289":0,"1318":1,"1327":0,"1372":1,"1405":0,"1425":1,"1433":0,"1449":1,"1457":0,"1492":1,"1499":0,"1511":1,"1518":0,"1563":1,"1595":0,"1632":1,"1656":0,"1679":1,"1688":0,"1704":1,"1712":0,"1737":1,"1792":0,"1805":1,"1815":0,"1861":1,"1907":0,"1948":1,"1957":0,"1971":1,"1979":0,"2020":1,"2029":0,"2045":1,"2052":0,"2067":1,"2077":0,"2092":1,"2101":0,"2119":1,"2127":0,"2154":1,"2162":0,"2191":1,"2200":0,"2212":1,"2219":0,"2225":1,"2244":0,"2260":1,"2267":0,"2278":1,"2286":0,"2339":1,"2346":0,"2374":1,"2383":0,"2409":1,"2419":0,"2446":1,"2454":0,"2476":1,"2484":0,"2507":1,"2516":0,"2526":1,"2534":0,"2552":1,"2561":0,"2574":1,"2582":0,"2609":1,"2620":0,"2641":1,"2649":0,"2665":1,"2672":0,"2691":1,"2698":0,"2724":1,"2731":0,"2741":1,"2748":0,"2787":1,"2794":0,"2811":1,"2818":0,"2828":1,"2837":0,"2854":1,"2863":0,"2908":1,"2918":0,"2932":1,"2940":0,"2956":1,"2966":0,"2974":1,"2983":0,"3018":1,"3025":0,"3033":1,"3040":0,"3053":1,"3060":0,"3105":1,"3115":0,"3131":1,"3140":0,"3154":1,"3162":0,"3167":1,"3175":0,"3198":1,"3205":0,"3222":1,"3230":0,"3245":1,"3253":0,"3291":1,"3300":0,"3316":1,"3324":0,"3347":1,"3356":0,"3365":1,"3372":0,"3395":1,"3404":0,"3414":1,"3422":0,"3446":1,"3452":0,"3458":1,"3464":0,"3485":1,"3491":0,"3507":1,"3516":0,"3533":1,"3540":0,"3555":1,"3563":0,"3580":1,"3589":0,"3607":1,"3614":0,"3628":1,"3637":0,"3647":1,"3656":0,"3659":1,"3665":0,"3669":1,"3675":0,"3678":1,"3684":0,"3686":1,"3693":0,"3695":1,"3701":0,"3704":1,"3710":0,"3712":1,"3718":0,"3721":1,"3727":0,"3730":1,"3736":0,"3740":1,"3746":0,"3806":1,"3812":0,"3845":1,"3878":0,"3893":1,"3900":0,"3947":1,"3955":0,"3960":1,"3967":0,"3983":1,"3991":0,"4032":1,"4038":0,"4054":1,"4062":0,"4072":1,"4079":0,"4085":1,"4142":0,"4155":1,"4163":0,"4173":1,"4184":0,"4200":1,"4207":0,"4227":1,"4234":0,"4255":1,"4262":0,"4273":1,"4282":0,"4294":1,"4301":0,"4321":1,"4331":0,"4343":1,"4353":0,"4363":1,"4410":0,"4418":1,"4426":0,"4445":1,"4453":0,"4457":1,"4467":0,"4483":1,"4491":0,"4494":1,"4503":0,"4511":1,"4531":0,"4538":1,"4548":0,"4560":1,"4570":0,"4585":1,"4592":0,"4632":1,"4639":0,"4653":1,"4660":0,"4679":1,"4685":0,"4707":1,"4713":0,"4722":1,"4728":0,"4746":1,"4760":0,"4770":1,"4778":0,"4788":1,"4795":0,"4825":1,"4832":0,"4854":1,"4861":0,"4873":1,"4880":0,"4896":1,"4903":0,"4926":1,"4934":0,"4970":1,"4977":0,"4990":1,"4998":0,"5017":1,"5023":0,"5039":1,"5047":0,"5064":1,"5072":0,"5091":1,"5097":0,"5122":1,"5131":0,"5150":1,"5157":0,"5185":1,"5190":0,"5222":1,"5230":0,"5251":1,"5273":0,"5305":1,"5312":0,"5333":1,"5343":0,"5352":1,"5360":0,"5398":1,"5405":0,"5431":1,"5437":0,"5466":1,"5472":0,"5480":1,"5487":0,"5504":1,"5513":0,"5521":1,"5527":0,"5548":1,"5556":0,"5572":1,"5579":0,"5595":1,"5632":0,"5666":1,"5673":0,"5687":1,"5694":0,"5709":1,"5718":0,"5749":1,"5756":0,"5790":1,"5797":0,"5821":1,"5827":0,"5838":1,"5848":0,"5860":1,"5870":0,"5890":1,"5919":0,"5933":1,"5940":0,"5962":1,"6075":0,"6097":1,"6104":0,"6163":1,"6170":0,"6182":1,"6189":0,"6213":1,"6220":0,"6228":1,"6236":0,"6264":1,"6271":0,"6285":1,"6293":0,"6299":1,"6441":0,"6479":1,"6511":0,"6525":1,"6533":0,"6577":1,"6613":0,"6628":1,"6637":0,"6649":1,"6658":0,"6672":1,"6681":0,"6699":1,"6706":0,"6746":1,"6753":0,"6770":1,"6778":0,"6822":1,"6828":0,"6832":1,"6841":0,"6853":1,"6880":0,"6890":1,"6899":0,"6907":1,"6917":0,"6957":1,"6965":0,"6983":1,"6991":0,"7004":1,"7012":0,"7031":1,"7040":0,"7077":1,"7085":0,"7094":1,"7102":0,"7109":1,"7117":0,"7152":1,"7160":0,"7179":1,"7238":0,"7274":1,"7281":0,"7306":1,"7354":0,"7374":1,"7618":0,"7623":1,"7665":0,"7727":1,"7735":0,"7771":1,"7781":0,"7802":1,"7809":0,"7828":1,"7836":0,"7864":1,"7872":0,"7899":1,"7906":0,"7925":1,"7932":0,"7950":1,"7957":0,"7990":1,"7997":0,"8016":1,"8024":0,"8032":1,"8061":0,"8089":1,"8096":0,"8114":1,"8121":0,"8150":1,"8156":0,"8208":1,"8215":0,"8227":1,"8235":0,"8254":1,"8260":0,"8310":1,"8344":0,"8379":1,"8389":0,"8400":1,"8406":0,"8415":1,"8422":0,"8429":1,"8435":0,"8475":1,"8510":0,"8528":1,"8534":0,"8554":1,"8559":0,"8596":1,"8602":0,"8642":1,"8650":0,"8669":1,"8676":0,"8714":1,"8747":0,"8764":1,"8793":0,"8829":1,"8836":0,"8845":1,"8852":0,"8876":1,"8883":0,"8906":1,"8912":0,"8938":1,"8944":1,"8968":0,"8980":1,"9010":0,"9021":1,"9029":0,"9035":1,"9042":0,"9046":1,"9053":0,"9057":1,"9063":0,"9067":1,"9074":0,"9078":1,"9088":0,"9091":1,"9098":0,"9101":1,"9108":0,"9111":1,"9117":0,"9120":1,"9127":0,"9130":1,"9136":0}' + ), + Xm = JSON.parse( + '{"80":1,"85":0,"165":1,"191":0,"285":1,"291":0,"365":1,"421":0,"476":1,"511":0,"570":1,"598":0,"647":1,"681":0,"721":1,"736":0,"748":1,"770":0,"777":1,"788":0,"883":1,"891":0,"932":1,"939":0,"980":1,"992":0,"1021":1,"1078":0,"1107":1,"1115":0,"1147":1,"1156":0,"1358":1,"1368":0,"1413":1,"1419":0,"1451":1,"1464":0,"1646":1,"1656":0,"1730":1,"1740":0,"1774":1,"1781":0,"1811":1,"1819":0,"1880":1,"1889":0,"1952":1,"1961":0,"2007":1,"2016":0,"2162":1,"2170":0,"2220":1,"2229":0,"2265":1,"2271":0,"2293":1,"2300":0,"2343":1,"2373":0,"2394":1,"2401":0,"2452":1,"2459":0,"2478":1,"2484":0,"2503":1,"2510":0,"2549":1,"2556":0,"2597":1,"2603":0,"2663":1,"2672":0,"2702":1,"2711":0,"2796":1,"2804":0,"2884":1,"2889":0,"3113":1,"3119":0,"3165":1,"3171":0,"3268":1,"3273":0,"3303":1,"3309":0,"3341":1,"3345":0,"3372":1,"3377":0,"3424":1,"3427":0,"3588":1,"3595":0,"3688":1,"3696":0,"4000":1,"4007":0,"4035":1,"4039":0,"4065":1,"4070":0,"4092":1,"4097":0,"4117":1,"4123":0,"4143":1,"4147":0,"4194":1,"4199":0,"4218":1,"4224":0,"4247":1,"4255":0,"4338":1,"4342":0,"4528":1,"4534":0,"4574":1,"4583":0,"4604":1,"4610":0,"4648":1,"4658":0,"4712":1,"4718":0,"4736":1,"4742":0,"4766":1,"4773":0,"4838":1,"4844":0,"4863":1,"4923":0,"4990":1,"4997":0,"5099":1,"5108":0,"5137":1,"5145":0,"5167":1,"5199":0,"5224":1,"5277":0,"5324":1,"5329":0,"5346":1,"5352":0,"5412":1,"5420":0,"5452":1,"5457":0,"5478":1,"5483":0,"5507":1,"5514":0,"5559":1,"5564":0,"5583":1,"5588":0,"5635":1,"5641":0,"5712":1,"5716":0,"5760":1,"5768":0,"5808":1,"5814":0,"5836":1,"5841":0,"5891":1,"5896":0,"5921":1,"5925":0,"5945":1,"5952":0,"5971":1,"5979":0,"6020":1,"6026":0,"6049":1,"6058":0,"6078":1,"6086":0,"6123":1,"6138":0,"6356":1,"6364":0,"6455":1,"6462":0,"6558":1,"6565":0,"6777":1,"6785":0,"6879":1,"6887":0,"6982":1,"6991":0,"7185":1,"7218":0,"7417":1,"7423":0,"7517":1,"7523":0,"7557":1,"7563":0,"7610":1,"7620":0,"7698":1,"7779":0,"7798":1,"7807":0,"7852":1,"7861":0,"7879":1,"7887":0,"7899":1,"7907":0,"7965":1,"7976":0,"8025":1,"8037":0,"8076":1,"8093":0,"8265":1,"8270":0,"8318":1,"8322":0,"8369":1,"8374":0,"8423":1,"8429":0,"8470":1,"8477":0,"8537":1,"8542":0,"8673":1,"8681":0,"8699":1,"8705":0,"8724":1,"8730":0,"8787":1,"8792":0,"8822":1,"8826":0,"8846":1,"8851":0,"8868":1,"8873":0,"8913":1,"8920":0,"8964":1,"8969":0,"8999":1,"9028":0,"9057":1,"9068":0,"9127":1,"9136":0,"9151":1,"9160":0,"9206":1,"9214":0,"9267":1,"9275":0,"9331":1,"9366":0,"9465":1,"9472":0,"9543":1,"9548":0,"9648":1,"9656":0,"9709":1,"9719":0,"9748":1,"9757":0,"9774":1,"9784":0,"9804":1,"9813":0,"9848":1,"9856":0,"9934":1,"9944":0,"9960":1,"9968":0,"9981":1,"9992":0,"10021":1,"10031":0,"10060":1,"10068":0,"10087":1,"10097":0,"10173":1,"10187":0,"10233":1,"10238":0,"10518":1,"10556":0}' + ), + zm = JSON.parse( + '{"48":1,"52":0,"74":1,"78":0,"114":1,"120":0,"143":1,"147":0,"194":1,"219":0,"245":1,"251":0,"267":1,"270":0,"275":1,"281":0,"324":1,"328":0,"341":1,"346":0,"369":1,"376":0,"388":1,"394":0,"419":1,"424":0,"443":1,"448":0,"469":1,"474":0,"495":1,"499":0,"515":1,"520":0,"533":1,"537":0,"553":1,"558":0,"569":1,"575":0,"599":1,"604":0,"660":1,"668":0,"698":1,"704":0,"745":1,"751":0,"762":1,"767":0,"819":1,"824":0,"854":1,"859":0,"886":1,"891":0,"933":1,"939":0,"971":1,"975":0,"981":1,"986":0,"996":1,"1001":0,"1012":1,"1017":0,"1022":1,"1027":0,"1040":1,"1045":0,"1054":1,"1060":0,"1075":1,"1080":0,"1095":1,"1100":0,"1112":1,"1117":0,"1142":1,"1149":0,"1170":1,"1175":0,"1203":1,"1208":0,"1233":1,"1240":0,"1311":1,"1316":0,"1331":1,"1336":0,"1347":1,"1352":0,"1368":1,"1372":0,"1384":1,"1389":0,"1406":1,"1410":0,"1423":1,"1427":0,"1443":1,"1448":0,"1458":1,"1463":0,"1473":1,"1478":0,"1495":1,"1500":0,"1515":1,"1520":0,"1537":1,"1543":0,"1557":1,"1565":0,"1583":1,"1591":0,"1609":1,"1614":0,"1648":1,"1672":0,"1688":1,"1694":0,"1711":1,"1716":0,"1735":1,"1740":0,"1780":1,"1783":0,"1822":1,"1825":0,"1926":1,"1932":0,"1940":1,"1945":0,"1967":1,"1971":0,"1978":1,"1984":0,"1998":1,"2003":0,"2023":1,"2029":0,"2043":1,"2050":0,"2062":1,"2068":0,"2105":1,"2110":0,"2144":1,"2150":0,"2201":1,"2207":0,"2214":1,"2219":0,"2241":1,"2246":0,"2268":1,"2275":0,"2296":1,"2320":0,"2339":1,"2381":0,"2404":1,"2410":0,"2430":1,"2439":0,"2455":1,"2460":0,"2468":1,"2474":0,"2539":1,"2544":0,"2573":1,"2578":0,"2600":1,"2665":0,"2734":1,"2740":0,"2754":1,"2759":0,"2771":1,"2778":0,"2804":1,"2812":0,"2864":1,"2870":0,"2891":1,"2897":0,"2944":1,"2950":0,"2992":1,"2996":0,"3005":1,"3011":0,"3030":1,"3035":0,"3045":1,"3051":0,"3068":1,"3073":0,"3083":1,"3090":0,"3110":1,"3115":0,"3122":1,"3127":0,"3148":1,"3153":0,"3163":1,"3169":0,"3264":1,"3270":0,"3304":1,"3310":0,"3342":1,"3349":0,"3387":1,"3394":0,"3428":1,"3434":0,"3443":1,"3447":0,"3465":1,"3470":0,"3497":1,"3503":0,"3540":1,"3545":0,"3568":1,"3572":0,"3585":1,"3591":0,"3603":1,"3609":0,"3637":1,"3643":0,"3702":1,"3707":0,"3711":1,"3717":0,"3815":1,"3821":0,"3878":1,"3883":0,"3905":1,"3910":0,"3917":1,"3922":0,"3931":1,"3937":0,"3972":1,"3979":0,"4019":1,"4027":0,"4040":1,"4048":0,"4059":1,"4067":0,"4085":1,"4091":0,"4103":1,"4111":0,"4120":1,"4128":0,"4152":1,"4158":0,"4178":1,"4183":0,"4191":1,"4200":0,"4212":1,"4219":0,"4223":1,"4235":0,"4244":1,"4254":0,"4261":1,"4270":0,"4292":1,"4300":0,"4344":1,"4352":0,"4376":1,"4383":0,"4398":1,"4404":0,"4415":1,"4422":0,"4432":1,"4440":0,"4526":1,"4532":0,"4537":1,"4543":0,"4563":1,"4568":0,"4574":1,"4581":0,"4612":1,"4617":0,"4629":1,"4636":0,"4673":1,"4678":0,"4686":1,"4691":0,"4708":1,"4714":0,"4729":1,"4735":0,"4753":1,"4757":0,"4766":1,"4823":0,"4849":1,"4856":0,"4878":1,"4903":0,"4917":1,"4922":0,"4929":1,"4936":0,"4957":1,"4964":0,"4978":1,"4986":0,"4996":1,"5005":0,"5044":1,"5052":0,"5074":1,"5079":0,"5174":1,"5180":0,"5222":1,"5230":0,"5305":1,"5313":0,"5384":1,"5391":0,"5460":1,"5467":0,"5482":1,"5489":0,"5506":1,"5513":0,"5530":1,"5538":0,"5583":1,"5590":0,"5627":1,"5635":0,"5653":1,"5694":0,"5781":1,"5786":0,"5795":1,"5801":0,"5828":1,"5834":0,"5867":1,"5869":0,"5872":1,"5875":0,"5904":1,"5908":0,"5941":1,"5949":0,"6019":1,"6025":0,"6099":1,"6105":0,"6178":1,"6184":0,"6209":1,"6215":0,"6283":1,"6288":0,"6395":1,"6399":0,"6416":1,"6420":0,"6443":1,"6447":0,"6470":1,"6475":0,"6491":1,"6495":0,"6510":1,"6514":0,"6542":1,"6547":0,"6551":1,"6558":0,"6588":1,"6592":0,"6608":1,"6613":0,"6631":1,"6635":0,"6667":1,"6673":0,"6689":1,"6694":0,"6706":1,"6713":0,"6727":1,"6732":0,"6752":1,"6759":0,"6773":1,"6778":0,"6787":1,"6794":0,"6808":1,"6814":0,"6826":1,"6832":0,"6847":1,"6853":0,"6884":1,"6889":0,"6905":1,"6910":0,"6916":1,"6922":0,"6929":1,"6936":0,"6946":1,"6954":0,"6966":1,"6972":0,"6984":1,"6990":0,"7024":1,"7027":0,"7041":1,"7046":0,"7060":1,"7066":0,"7090":1,"7098":0,"7110":1,"7118":0,"7128":1,"7136":0,"7159":1,"7164":0,"7198":1,"7202":0,"7219":1,"7224":0,"7239":1,"7243":0,"7259":1,"7264":0,"7276":1,"7282":0,"7309":1,"7319":0,"7338":1,"7342":0,"7360":1,"7366":0,"7380":1,"7385":0,"7401":1,"7406":0,"7417":1,"7423":0,"7439":1,"7444":0,"7456":1,"7462":0,"7526":1,"7532":0,"7546":1,"7552":0,"7606":1,"7612":0,"7641":1,"7646":0,"7710":1,"7714":0,"7729":1,"7734":0,"7763":1,"7769":0,"7805":1,"7853":0,"7905":1,"7911":0,"7925":1,"7930":0,"7943":1,"7949":0,"7969":1,"7973":0,"7988":1,"7993":0,"8017":1,"8023":0,"8057":1,"8064":0,"8096":1,"8104":0,"8126":1,"8130":0,"8219":1,"8226":0,"8299":1,"8304":0,"8333":1,"8339":0,"8361":1,"8366":0,"8379":1,"8384":0,"8417":1,"8422":0,"8456":1,"8461":0,"8477":1,"8482":0,"8503":1,"8512":0,"8524":1,"8531":0,"8546":1,"8550":0,"8558":1,"8564":0,"8574":1,"8578":0,"8586":1,"8592":0,"8650":1,"8657":0,"8669":1,"8677":0,"8692":1,"8697":0,"8732":1,"8737":0,"8746":1,"8751":0,"8774":1,"8778":0,"8822":1,"8829":0,"8916":1,"8921":0,"8972":1,"8978":0,"8983":1,"9003":0,"9031":1,"9038":0,"9070":1,"9074":0,"9146":1,"9151":0,"9188":1,"9195":0,"9220":1,"9226":0,"9237":1,"9243":0,"9260":1,"9266":0,"9284":1,"9289":0,"9308":1,"9315":0,"9336":1,"9343":0,"9382":1,"9389":0,"9411":1,"9419":0,"9444":1,"9452":0,"9482":1,"9489":0,"9524":1,"9531":0}' + ), + Wm = JSON.parse( + '{"130":1,"138":0,"243":1,"250":0,"358":1,"365":0,"594":1,"602":0,"709":1,"715":0,"797":1,"803":0,"821":1,"832":0,"903":1,"911":0,"1005":1,"1012":0,"1205":1,"1211":0,"1436":1,"1445":0,"1536":1,"1543":0,"1630":1,"1641":0,"1732":1,"1739":0,"1762":1,"1771":0,"1830":1,"1839":0,"1860":1,"1869":0,"1928":1,"1938":0,"1958":1,"1967":0,"2103":1,"2110":0,"2330":1,"2418":0,"2454":1,"2476":0,"2485":1,"2524":0,"2566":1,"2683":0,"2719":1,"2780":0,"2807":1,"2867":0,"2911":1,"2920":0,"2956":1,"2992":0,"3158":1,"3166":0,"3268":1,"3278":0,"3381":1,"3390":0,"3445":1,"3454":0,"3651":1,"3657":0,"3731":1,"3738":0,"3817":1,"3827":0,"3845":1,"3853":0,"3927":1,"3935":0,"3955":1,"3963":0,"4034":1,"4043":0,"4121":1,"4129":0,"4148":1,"4156":0,"4232":1,"4242":0,"4312":1,"4321":0,"4572":1,"4579":0,"4674":1,"4695":0,"4767":1,"4804":0,"4873":1,"4913":0,"4963":1,"5026":0,"5142":1,"5151":0}', + ), + qm = JSON.parse( + '{"81":1,"87":0,"159":1,"163":0,"205":1,"210":0,"234":1,"240":0,"290":1,"296":0,"330":1,"336":0,"352":1,"357":0,"438":1,"443":0,"465":1,"470":0,"495":1,"500":0,"539":1,"545":0,"559":1,"566":0,"594":1,"602":0,"621":1,"625":0,"661":1,"665":0,"739":1,"745":0,"786":1,"793":0,"821":1,"826":0,"874":1,"880":0,"903":1,"908":0,"929":1,"934":0,"954":1,"959":0,"980":1,"984":0,"1026":1,"1031":0,"1113":1,"1119":0,"1136":1,"1141":0,"1185":1,"1190":0,"1284":1,"1290":0,"1344":1,"1351":0,"1374":1,"1381":0,"1409":1,"1420":0,"1466":1,"1472":0,"1492":1,"1499":0,"1511":1,"1517":0,"1568":1,"1574":0,"1653":1,"1660":0,"1700":1,"1706":0,"1721":1,"1728":0,"1747":1,"1754":0,"1777":1,"1784":0,"1799":1,"1805":0,"1829":1,"1838":0,"1855":1,"1889":0,"1904":1,"1915":0,"1957":1,"2008":0,"2084":1,"2091":0,"2109":1,"2117":0,"2183":1,"2219":0,"2243":1,"2291":0,"2316":1,"2373":0,"2394":1,"2454":0,"2472":1,"2480":0,"2504":1,"2515":0,"2545":1,"2579":0,"2600":1,"2630":0,"2679":1,"2684":0,"2704":1,"2710":0,"2728":1,"2738":0,"2752":1,"2761":0,"2804":1,"2811":0,"2827":1,"2836":0,"2982":1,"2987":0,"3021":1,"3027":0,"3085":1,"3092":0,"3112":1,"3119":0,"3162":1,"3195":0,"3213":1,"3221":0,"3238":1,"3246":0,"3347":1,"3355":0,"3420":1,"3426":0,"3446":1,"3453":0,"3475":1,"3481":0,"3521":1,"3526":0,"3546":1,"3552":0,"3571":1,"3576":0,"3627":1,"3680":0,"3756":1,"3763":0,"3783":1,"3790":0,"3834":1,"3841":0,"3862":1,"3867":0,"3886":1,"3919":0,"4047":1,"4055":0,"4087":1,"4093":0,"4117":1,"4122":0,"4193":1,"4220":0,"4244":1,"4250":0,"4295":1,"4298":0,"4333":1,"4341":0,"4359":1,"4366":0,"4388":1,"4394":0,"4422":1,"4427":0,"4447":1,"4451":0,"4484":1,"4488":0,"4555":1,"4560":0,"4602":1,"4636":0,"4684":1,"4719":0,"4758":1,"4767":0,"4811":1,"4881":0,"4918":1,"4930":0,"4963":1,"4970":0,"5007":1,"5080":0,"5122":1,"5130":0,"5170":1,"5174":0,"5194":1,"5202":0,"5217":1,"5223":0,"5252":1,"5305":0,"5373":1,"5380":0,"5429":1,"5435":0,"5453":1,"5460":0,"5480":1,"5488":0,"5580":1,"5585":0,"5631":1,"5638":0,"5659":1,"5666":0,"5678":1,"5687":0,"5707":1,"5714":0,"5736":1,"5742":0,"5815":1,"5822":0,"5841":1,"5849":0,"5888":1,"5894":0,"5915":1,"5920":0,"5942":1,"5947":0,"5995":1,"6000":0,"6017":1,"6024":0,"6068":1,"6075":0,"6096":1,"6103":0,"6119":1,"6125":0,"6138":1,"6145":0,"6226":1,"6234":0,"6252":1,"6263":0,"6275":1,"6285":0,"6304":1,"6315":0,"6330":1,"6341":0,"6356":1,"6368":0,"6396":1,"6406":0,"6432":1,"6446":0,"6458":1,"6470":0,"6484":1,"6497":0,"6507":1,"6518":0,"6569":1,"6577":0,"6605":1,"6612":0,"6633":1,"6641":0,"6661":1,"6669":0,"6712":1,"6721":0,"6732":1,"6742":0,"6765":1,"6776":0,"6844":1,"6851":0,"6871":1,"6879":0,"6898":1,"6905":0,"6925":1,"6932":0,"6950":1,"6955":0,"6976":1,"6985":0}', + ), + $m = JSON.parse( + '{"329":1,"336":0,"457":1,"464":0,"490":1,"496":0,"524":1,"531":0,"682":1,"689":0,"764":1,"770":0,"801":1,"807":0,"830":1,"836":0,"1004":1,"1020":0,"1033":1,"1040":0,"1062":1,"1070":0,"1094":1,"1099":0,"1122":1,"1129":0,"1172":1,"1179":0,"1206":1,"1213":0,"1271":1,"1278":0,"1379":1,"1387":0,"1410":1,"1417":0,"1453":1,"1458":0,"1526":1,"1532":0,"1549":1,"1554":0,"1618":1,"1688":0,"1734":1,"1743":0,"1762":1,"1770":0,"1800":1,"1805":0,"1887":1,"1894":0,"1918":1,"1924":0,"1958":1,"1964":0,"2002":1,"2009":0,"2073":1,"2081":0,"2196":1,"2207":0,"2288":1,"2295":0,"2420":1,"2428":0,"2582":1,"2590":0,"2645":1,"2652":0,"2674":1,"2679":0,"2706":1,"2711":0,"2728":1,"2733":0,"2812":1,"2820":0,"2841":1,"2848":0,"2904":1,"2911":0,"3019":1,"3094":0,"3121":1,"3128":0,"3183":1,"3184":0,"3224":1,"3230":0,"3306":1,"3349":0,"3398":1,"3404":0,"3464":1,"3558":0,"3699":1,"3705":0,"3826":1,"3832":0,"3871":1,"3875":0,"3904":1,"3909":0,"3934":1,"3939":0,"4000":1,"4006":0,"4042":1,"4048":0,"4073":1,"4078":0,"4164":1,"4171":0,"4216":1,"4221":0,"4264":1,"4270":0,"4347":1,"4353":0,"4369":1,"4376":0,"4394":1,"4401":0,"4430":1,"4436":0,"4717":1,"4723":0,"4867":1,"4873":0,"4966":1,"4970":0,"5006":1,"5014":0,"5044":1,"5049":0,"5104":1,"5113":0,"5125":1,"5130":0,"5184":1,"5189":0,"5235":1,"5241":0,"5264":1,"5270":0,"5292":1,"5293":0,"5328":1,"5333":0,"5378":1,"5384":0,"5415":1,"5425":0,"5455":1,"5461":0,"5605":1,"5614":0,"5645":1,"5663":0,"5672":1,"5682":0,"5688":1,"5698":0,"5735":1,"5742":0,"5822":1,"5850":0,"5875":1,"5885":0,"5971":1,"5975":0,"5998":1,"6006":0,"6030":1,"6041":0,"6051":1,"6059":0,"6070":1,"6079":0,"6091":1,"6099":0,"6143":1,"6150":0,"6211":1,"6219":0,"6238":1,"6245":0,"6298":1,"6305":0,"6328":1,"6334":0,"6365":1,"6371":0,"6396":1,"6401":0,"6424":1,"6428":0,"6577":1,"6583":0,"6636":1,"6644":0,"6684":1,"6691":0,"6746":1,"6752":0,"6825":1,"6831":0,"6885":1,"6890":0,"6911":1,"6918":0,"6955":1,"6961":0,"7000":1,"7007":0,"7120":1,"7125":0,"7148":1,"7154":0,"7178":1,"7184":0,"7202":1,"7209":0,"7226":1,"7236":0,"7255":1,"7261":0,"7332":1,"7337":0,"7456":1,"7460":0,"7483":1,"7488":0,"7543":1,"7551":0,"7577":1,"7583":0,"7637":1,"7643":0,"7680":1,"7687":0,"7713":1,"7845":0,"7904":1,"8011":0,"8031":1,"8038":0,"8080":1,"8089":0,"8120":1,"8125":0,"8150":1,"8156":0,"8211":1,"8218":0,"8249":1,"8254":0,"8325":1,"8329":0,"8382":1,"8389":0,"8416":1,"8424":0,"8448":1,"8457":0,"8484":1,"8545":0,"8580":1,"8620":0,"8664":1,"8789":0,"8812":1,"8820":0,"8846":1,"8890":0,"8918":1,"8929":0,"8956":1,"8964":0,"9010":1,"9017":0,"9047":1,"9053":0,"9094":1,"9099":0,"9135":1,"9140":0,"9178":1,"9184":0,"9203":1,"9211":0}' + ), + Jm = JSON.parse( + '{"70":1,"77":0,"90":1,"99":0,"130":1,"149":0,"151":1,"166":0,"176":1,"188":0,"206":1,"215":0,"231":1,"238":0,"259":1,"267":0,"309":1,"316":0,"352":1,"379":0,"401":1,"411":0,"440":1,"446":0,"484":1,"491":0,"517":1,"522":0,"563":1,"587":0,"607":1,"638":0,"664":1,"669":0,"708":1,"717":0,"736":1,"743":0,"761":1,"767":0,"788":1,"794":0,"814":1,"820":0,"839":1,"846":0,"934":1,"987":0,"1031":1,"1084":0,"1094":1,"1100":0,"1125":1,"1187":0,"1238":1,"1291":0,"1354":1,"1382":0,"1403":1,"1423":0,"1457":1,"1466":0,"1507":1,"1543":0,"1563":1,"1569":0,"1618":1,"1632":0,"1649":1,"1657":0,"1676":1,"1682":0,"1694":1,"1702":0,"1713":1,"1724":0,"1753":1,"1758":0,"1803":1,"1810":0,"1837":1,"1858":0,"1887":1,"1899":0,"1913":1,"1922":0,"1945":1,"1952":0,"1983":1,"1988":0,"2004":1,"2011":0,"2058":1,"2065":0,"2082":1,"2090":0,"2112":1,"2118":0,"2166":1,"2172":0,"2244":1,"2252":0,"2271":1,"2279":0,"2303":1,"2309":0,"2330":1,"2336":0,"2360":1,"2366":0,"2407":1,"2413":0,"2438":1,"2445":0,"2461":1,"2469":0,"2492":1,"2498":0,"2521":1,"2527":0,"2547":1,"2553":0,"2574":1,"2581":0,"2603":1,"2609":0,"2627":1,"2634":0,"2656":1,"2663":0,"2705":1,"2712":0,"2742":1,"2748":0,"2761":1,"2769":0,"2794":1,"2801":0,"2845":1,"2851":0,"2868":1,"2907":0,"2939":1,"2946":0,"2955":1,"2962":0,"2989":1,"2996":0,"3052":1,"3061":0,"3139":1,"3145":0,"3188":1,"3194":0,"3224":1,"3227":0,"3244":1,"3250":0,"3283":1,"3293":0,"3314":1,"3321":0,"3354":1,"3361":0,"3393":1,"3399":0,"3460":1,"3466":0,"3480":1,"3486":0,"3514":1,"3521":0,"3572":1,"3580":0,"3638":1,"3646":0,"3679":1,"3687":0,"3702":1,"3712":0,"3750":1,"3759":0,"3786":1,"3795":0,"3855":1,"3861":0,"3882":1,"3887":0,"3907":1,"3913":0,"3929":1,"3936":0,"3949":1,"3955":0,"4071":1,"4075":0,"4095":1,"4099":0,"4153":1,"4160":0,"4171":1,"4178":0,"4209":1,"4217":0,"4234":1,"4243":0,"4263":1,"4271":0,"4320":1,"4326":0,"4346":1,"4353":0,"4373":1,"4379":0,"4410":1,"4416":0,"4448":1,"4456":0,"4493":1,"4500":0,"4530":1,"4535":0,"4557":1,"4563":0,"4599":1,"4608":0,"4635":1,"4641":0,"4659":1,"4666":0,"4685":1,"4694":0,"4724":1,"4733":0,"4748":1,"4755":0,"4772":1,"4781":0,"4819":1,"4830":0,"4853":1,"4862":0,"4880":1,"4888":0,"4946":1,"4955":0,"4968":1,"4979":0,"4998":1,"5009":0,"5042":1,"5050":0,"5079":1,"5112":0,"5159":1,"5165":0,"5187":1,"5246":0,"5270":1,"5331":0,"5361":1,"5370":0,"5402":1,"5412":0,"5442":1,"5452":0,"5481":1,"5490":0,"5503":1,"5511":0,"5534":1,"5543":0,"5598":1,"5602":0,"5623":1,"5627":0,"5659":1,"5670":0,"5713":1,"5721":0,"5787":1,"5795":0,"5808":1,"5820":0,"5858":1,"5867":0,"5878":1,"5886":0,"5897":1,"5912":0,"5921":1,"5935":0,"6016":1,"6024":0,"6044":1,"6051":0,"6062":1,"6069":0,"6121":1,"6128":0,"6144":1,"6154":0,"6186":1,"6194":0,"6252":1,"6257":0,"6282":1,"6288":0,"6311":1,"6316":0,"6338":1,"6347":0,"6363":1,"6373":0,"6389":1,"6398":0,"6443":1,"6451":0,"6474":1,"6482":0,"6500":1,"6506":0,"6525":1,"6532":0,"6552":1,"6560":0,"6575":1,"6586":0,"6599":1,"6609":0,"6619":1,"6629":0,"6690":1,"6700":0,"6710":1,"6717":0,"6742":1,"6752":0,"6757":1,"6774":0,"6797":1,"6804":0,"6825":1,"6832":0,"6851":1,"6858":0,"6878":1,"6887":0,"6930":1,"6935":0,"6961":1,"6969":0,"6990":1,"6997":0,"7016":1,"7022":0,"7043":1,"7051":0,"7068":1,"7075":0,"7126":1,"7131":0,"7161":1,"7167":0,"7187":1,"7193":0,"7213":1,"7220":0,"7235":1,"7241":0,"7272":1,"7280":0,"7316":1,"7325":0,"7341":1,"7348":0,"7369":1,"7376":0,"7405":1,"7413":0,"7561":1,"7569":0,"7587":1,"7591":0,"7638":1,"7643":0,"7669":1,"7674":0,"7703":1,"7710":0,"7736":1,"7742":0,"7776":1,"7783":0,"7811":1,"7819":0,"7888":1,"7894":0,"7923":1,"7931":0,"7997":1,"8003":0,"8029":1,"8035":0,"8057":1,"8062":0,"8084":1,"8092":0,"8127":1,"8133":0,"8151":1,"8159":0,"8169":1,"8177":0,"8205":1,"8227":0,"8268":1,"8275":0,"8313":1,"8320":0,"8351":1,"8377":0,"8434":1,"8463":0,"8490":1,"8502":0,"8518":1,"8526":0,"8546":1,"8582":0,"8601":1,"8660":0,"8692":1,"8722":0,"8817":1,"8826":0}' + ), + Km = JSON.parse( + '{"107":1,"114":0,"179":1,"187":0,"260":1,"267":0,"347":1,"354":0,"405":1,"412":0,"471":1,"671":0,"750":1,"757":0,"779":1,"787":0,"804":1,"813":0,"874":1,"882":0,"929":1,"936":0,"984":1,"990":0,"1040":1,"1047":0,"1206":1,"1213":0,"1259":1,"1267":0,"1316":1,"1323":0,"1356":1,"1696":0,"1716":1,"1726":0,"1763":1,"1771":0,"1833":1,"1841":0,"1887":1,"1898":0,"1970":1,"2074":0,"2148":1,"2155":0,"2206":1,"2214":0,"2290":1,"2298":0,"2344":1,"2352":0,"2501":1,"2507":0,"2621":1,"2629":0,"2727":1,"2736":0,"2789":1,"2797":0,"2863":1,"2871":0,"2919":1,"2943":0,"3071":1,"3079":0,"3161":1,"3168":0,"3250":1,"3332":0,"3389":1,"3398":0,"3426":1,"3436":0,"3455":1,"3463":0,"3522":1,"3528":0,"3616":1,"3623":0,"3741":1,"3748":0,"3840":1,"3848":0,"3890":1,"3899":0,"3983":1,"4040":0,"4116":1,"4124":0,"4174":1,"4181":0,"4211":1,"4292":0,"4332":1,"4341":0,"4373":1,"4381":0,"4421":1,"4480":0,"4526":1,"4533":0,"4580":1,"4588":0,"4600":1,"4616":0,"4649":1,"4684":0,"4718":1,"4728":0,"4750":1,"4758":0,"4788":1,"4839":0,"4935":1,"4944":0,"4984":1,"4993":0,"5021":1,"5032":0,"5068":1,"5076":0,"5101":1,"5110":0,"5144":1,"5153":0,"5200":1,"5209":0,"5258":1,"5295":0,"5324":1,"5332":0,"5355":1,"5363":0,"5421":1,"5430":0,"5521":1,"5528":0,"5557":1,"5643":0,"5683":1,"5715":0,"5829":1,"5837":0,"5887":1,"5894":0,"5933":1,"5941":0,"6014":1,"6022":0,"6183":1,"6192":0,"6278":1,"6285":0,"6331":1,"6340":0,"6374":1,"6381":0,"6437":1,"6444":0,"6488":1,"6496":0,"6542":1,"6548":0,"6589":1,"6599":0,"6639":1,"6648":0,"6704":1,"6714":0,"6767":1,"6774":0,"6803":1,"6811":0,"6865":1,"6875":0,"6938":1,"6944":0,"7016":1,"7024":0,"7046":1,"7055":0,"7085":1,"7092":0,"7149":1,"7158":0,"7206":1,"7214":0,"7334":1,"7341":0,"7464":1,"7471":0}', + ), + Qm = JSON.parse( + '{"177":1,"182":0,"239":1,"246":0,"313":1,"319":0,"405":1,"411":0,"453":1,"461":0,"484":1,"491":0,"525":1,"533":0,"628":1,"636":0,"647":1,"654":0,"667":1,"674":0,"701":1,"708":0,"730":1,"738":0,"759":1,"767":0,"792":1,"799":0,"851":1,"861":0,"889":1,"898":0,"922":1,"929":0,"946":1,"954":0,"993":1,"1001":0,"1098":1,"1104":0,"1161":1,"1168":0,"1201":1,"1208":0,"1221":1,"1229":0,"1397":1,"1403":0,"1468":1,"1477":0,"1551":1,"1559":0,"1603":1,"1611":0,"1641":1,"1650":0,"1697":1,"1704":0,"1735":1,"1742":0,"1803":1,"1811":0,"1882":1,"1890":0,"2027":1,"2035":0,"2066":1,"2074":0,"2123":1,"2130":0,"2186":1,"2193":0,"2230":1,"2238":0,"2252":1,"2260":0,"2309":1,"2317":0,"2348":1,"2356":0,"2413":1,"2419":0,"2435":1,"2443":0,"2475":1,"2483":0,"2492":1,"2499":0,"2679":1,"2687":0,"2725":1,"2734":0,"2766":1,"2774":0,"2800":1,"2808":0,"2828":1,"2836":0,"2888":1,"2896":0,"2921":1,"2929":0,"2951":1,"2959":0,"3023":1,"3031":0,"3072":1,"3080":0,"3178":1,"3187":0,"3278":1,"3286":0,"3328":1,"3335":0,"3364":1,"3372":0,"3448":1,"3455":0,"3502":1,"3510":0,"3526":1,"3534":0,"3551":1,"3558":0,"3581":1,"3588":0,"3610":1,"3618":0,"3695":1,"3703":0,"3773":1,"3782":0,"3809":1,"3816":0,"3831":1,"3839":0,"3849":1,"3857":0,"4085":1,"4094":0,"4180":1,"4188":0,"4247":1,"4254":0,"4339":1,"4348":0,"4408":1,"4416":0,"4498":1,"4508":0,"4589":1,"4598":0,"4633":1,"4641":0,"4671":1,"4679":0,"4719":1,"4728":0,"4759":1,"4768":0,"4807":1,"4815":0,"4827":1,"4835":0,"4851":1,"4858":0,"4872":1,"4880":0,"4899":1,"4906":0,"4926":1,"4933":0,"4982":1,"4990":0,"5027":1,"5035":0,"5058":1,"5067":0,"5106":1,"5114":0,"5155":1,"5163":0,"5199":1,"5208":0}', + ), + Zm = JSON.parse( + '{"58":1,"64":0,"165":1,"173":0,"193":1,"204":0,"219":1,"237":0,"273":1,"284":0,"304":1,"334":0,"460":1,"483":0,"564":1,"579":0,"595":1,"612":0,"628":1,"640":0,"699":1,"714":0,"862":1,"868":0,"875":1,"899":0,"924":1,"933":0,"953":1,"961":0,"1026":1,"1073":0,"1119":1,"1165":0,"1275":1,"1286":0,"1304":1,"1319":0,"1329":1,"1341":0,"1380":1,"1389":0,"1411":1,"1419":0,"1514":1,"1529":0,"1542":1,"1552":0,"1567":1,"1576":0,"1591":1,"1602":0,"1663":1,"1676":0,"1698":1,"1712":0,"1729":1,"1742":0,"1756":1,"1764":0,"1805":1,"1813":0,"1860":1,"1883":0,"1903":1,"1914":0,"1928":1,"1942":0,"1956":1,"1963":0,"1989":1,"1998":0,"2049":1,"2098":0,"2142":1,"2155":0,"2225":1,"2237":0,"2250":1,"2258":0,"2271":1,"2279":0,"2294":1,"2306":0,"2322":1,"2329":0,"2361":1,"2368":0,"2410":1,"2448":0,"2479":1,"2505":0,"2589":1,"2596":0,"2618":1,"2632":0,"2646":1,"2653":0,"2670":1,"2686":0,"2719":1,"2726":0,"2770":1,"2782":0,"2802":1,"2817":0,"2834":1,"2848":0,"2862":1,"2876":0,"2973":1,"2980":0,"3002":1,"3031":0,"3114":1,"3125":0,"3144":1,"3156":0,"3169":1,"3183":0,"3228":1,"3265":0,"3299":1,"3309":0,"3349":1,"3392":0,"3427":1,"3458":0,"3484":1,"3512":0,"3527":1,"3538":0,"3568":1,"3578":0,"3597":1,"3638":0,"3733":1,"3742":0,"3763":1,"3784":0,"3810":1,"3830":0,"3854":1,"3880":0,"3903":1,"3922":0,"3946":1,"3973":0,"3997":1,"4015":0,"4039":1,"4052":0,"4093":1,"4113":0,"4137":1,"4147":0,"4164":1,"4203":0,"4228":1,"4237":0,"4272":1,"4379":0,"4386":1,"4399":0,"4468":1,"4475":0,"4496":1,"4513":0,"4530":1,"4546":0,"4570":1,"4595":0,"4616":1,"4630":0,"4638":1,"4643":0,"4660":1,"4672":0,"4688":1,"4706":0,"4729":1,"4754":0,"4770":1,"4782":0,"4799":1,"4828":0,"4847":1,"4863":0,"4872":1,"4877":0,"4906":1,"4923":0,"4947":1,"4978":0,"4992":1,"5010":0,"5036":1,"5069":0,"5082":1,"5100":0,"5118":1,"5129":0,"5146":1,"5160":0,"5211":1,"5221":0,"5232":1,"5246":0,"5260":1,"5271":0,"5287":1,"5300":0,"5309":1,"5318":0,"5375":1,"5410":0,"5447":1,"5459":0,"5473":1,"5482":0,"5493":1,"5503":0,"5522":1,"5533":0,"5542":1,"5547":0,"5587":1,"5601":0,"5609":1,"5626":0,"5652":1,"5664":0,"5676":1,"5687":0,"5700":1,"5714":0,"5728":1,"5739":0,"5793":1,"5805":0,"5840":1,"5849":0,"5953":1,"5977":0,"5989":1,"5998":0,"6046":1,"6073":0,"6088":1,"6098":0,"6126":1,"6155":0,"6233":1,"6240":0,"6267":1,"6309":0,"6376":1,"6382":0,"6412":1,"6456":0,"6538":1,"6553":0,"6562":1,"6572":0,"6585":1,"6590":0,"6616":1,"6636":0,"6727":1,"6749":0,"6809":1,"6833":0,"6887":1,"6893":0,"6910":1,"6921":0,"6949":1,"6998":0,"7089":1,"7101":0,"7119":1,"7139":0,"7179":1,"7199":0,"7257":1,"7276":0,"7291":1,"7310":0,"7352":1,"7368":0,"7383":1,"7415":0}', + ), + ef = JSON.parse( + '{"56":1,"60":0,"142":1,"156":0,"159":1,"180":0,"199":1,"207":0,"272":1,"279":0,"310":1,"316":0,"373":1,"383":0,"386":1,"409":0,"437":1,"473":0,"535":1,"540":0,"619":1,"658":0,"731":1,"765":0,"787":1,"849":0,"874":1,"912":0,"1071":1,"1107":0,"1200":1,"1228":0,"1328":1,"1349":0,"1382":1,"1399":0,"1426":1,"1439":0,"1493":1,"1528":0,"1561":1,"1571":0,"1629":1,"1643":0,"1688":1,"1694":0,"1715":1,"1722":0,"1807":1,"1816":0,"1862":1,"1875":0,"1915":1,"1957":0,"1994":1,"2001":0,"2024":1,"2032":0,"2055":1,"2060":0,"2072":1,"2084":0,"2141":1,"2153":0,"2189":1,"2249":0,"2392":1,"2459":0,"2506":1,"2550":0,"2558":1,"2567":0,"2573":1,"2589":0,"2611":1,"2616":0,"2675":1,"2697":0,"2706":1,"2717":0,"2743":1,"2752":0,"2761":1,"2769":0,"2779":1,"2800":0,"2820":1,"2836":0,"2841":1,"2871":0,"2882":1,"2892":0,"2927":1,"3073":0,"3095":1,"3135":0,"3147":1,"3191":0,"3266":1,"3333":0,"3361":1,"3428":0,"3449":1,"3457":0,"3485":1,"3490":0,"3544":1,"3579":0,"3601":1,"3608":0,"3634":1,"3641":0,"3659":1,"3668":0,"3685":1,"3695":0,"3715":1,"3719":0,"3795":1,"3799":0,"3819":1,"3825":0,"3850":1,"3857":0,"3881":1,"3885":0,"3909":1,"3914":0,"3945":1,"3953":0,"3977":1,"3985":0,"4011":1,"4022":0,"4055":1,"4064":0,"4067":1,"4090":0,"4116":1,"4157":0,"4190":1,"4200":0,"4248":1,"4279":0,"4306":1,"4314":0,"4331":1,"4337":0,"4392":1,"4400":0,"4472":1,"4482":0,"4524":1,"4538":0,"4582":1,"4596":0,"4617":1,"4659":0,"4724":1,"4748":0,"4834":1,"4894":0,"4922":1,"4927":0,"5037":1,"5043":0,"5089":1,"5097":0,"5124":1,"5129":0,"5204":1,"5209":0,"5229":1,"5237":0,"5273":1,"5282":0,"5346":1,"5361":0,"5541":1,"5548":0,"5622":1,"5642":0,"5685":1,"5690":0,"5761":1,"5770":0,"5783":1,"5791":0,"5866":1,"5874":0,"5906":1,"5940":0,"5991":1,"6028":0,"6049":1,"6057":0,"6081":1,"6130":0,"6225":1,"6272":0,"6322":1,"6350":0,"6352":1,"6381":0,"6429":1,"6438":0,"6439":1,"6464":0,"6486":1,"6494":0,"6529":1,"6536":0,"6580":1,"6644":0,"6662":1,"6685":0,"6712":1,"6724":0,"6748":1,"6757":0,"6792":1,"6832":0,"6841":1,"6854":0,"7000":1,"7012":0,"7066":1,"7080":0,"7139":1,"7151":0,"7208":1,"7358":0,"7417":1,"7435":0,"7480":1,"7491":0,"7601":1,"7608":0,"7626":1,"7632":0,"7669":1,"7675":0,"7763":1,"7770":0,"7790":1,"7832":0,"7846":1,"7854":0,"7904":1,"7916":0,"7928":1,"7935":0,"7950":1,"7958":0,"8044":1,"8051":0,"8073":1,"8077":0,"8160":1,"8170":0,"8192":1,"8200":0,"8218":1,"8223":0,"8239":1,"8247":0,"8269":1,"8274":0,"8292":1,"8301":0,"8405":1,"8411":0,"8437":1,"8442":0,"8495":1,"8504":0,"8555":1,"8561":0,"8657":1,"8725":0,"8747":1,"8765":0,"8829":1,"8837":0,"8859":1,"8865":0,"8885":1,"8893":0,"9082":1,"9089":0,"9255":1,"9287":0,"9356":1,"9363":0,"9499":1,"9507":0,"9520":1,"9536":0,"9619":1,"9658":0}' + ), + tf = JSON.parse( + '{"46":1,"49":0,"83":1,"88":0,"113":1,"116":0,"138":1,"143":0,"211":1,"217":0,"272":1,"279":0,"309":1,"366":0,"427":1,"433":0,"465":1,"472":0,"505":1,"512":0,"579":1,"586":0,"654":1,"660":0,"691":1,"695":0,"720":1,"725":0,"765":1,"773":0,"789":1,"795":0,"928":1,"933":0,"973":1,"978":0,"1002":1,"1008":0,"1030":1,"1036":0,"1097":1,"1104":0,"1147":1,"1156":0,"1205":1,"1213":0,"1258":1,"1264":0,"1347":1,"1354":0,"1375":1,"1382":0,"1414":1,"1474":0,"1565":1,"1572":0,"1635":1,"1640":0,"1664":1,"1668":0,"1691":1,"1696":0,"1812":1,"1821":0,"1872":1,"1883":0,"1918":1,"1930":0,"1985":1,"1995":0,"2076":1,"2081":0,"2136":1,"2170":0,"2225":1,"2235":0,"2265":1,"2275":0,"2301":1,"2311":0,"2390":1,"2396":0,"2421":1,"2427":0,"2454":1,"2461":0,"2693":1,"2702":0,"2742":1,"2749":0,"2880":1,"2885":0,"2913":1,"2917":0,"2960":1,"2964":0,"3006":1,"3012":0,"3097":1,"3103":0,"3132":1,"3138":0,"3198":1,"3204":0,"3230":1,"3240":0,"3296":1,"3302":0,"3351":1,"3356":0,"3421":1,"3430":0,"3470":1,"3481":0,"3566":1,"3574":0,"3652":1,"3659":0,"3713":1,"3718":0,"3791":1,"3797":0,"3833":1,"3841":0,"3987":1,"3993":0,"4015":1,"4021":0,"4046":1,"4053":0,"4071":1,"4081":0,"4115":1,"4122":0,"4142":1,"4148":0,"4222":1,"4230":0,"4253":1,"4262":0,"4290":1,"4295":0,"4367":1,"4372":0,"4548":1,"4555":0,"4741":1,"4750":0,"4766":1,"4778":0,"4853":1,"4861":0,"5044":1,"5051":0,"5095":1,"5102":0,"5194":1,"5203":0,"5229":1,"5238":0,"5271":1,"5280":0,"5412":1,"5416":0,"5476":1,"5483":0,"5572":1,"5579":0,"5630":1,"5637":0,"5670":1,"5678":0,"5759":1,"5767":0,"5791":1,"5800":0,"5883":1,"5890":0,"5988":1,"5997":0,"6030":1,"6039":0,"6104":1,"6112":0,"6126":1,"6132":0,"6249":1,"6256":0,"6294":1,"6301":0,"6322":1,"6328":0,"6345":1,"6353":0,"6370":1,"6383":0,"6484":1,"6493":0,"6516":1,"6524":0,"6539":1,"6549":0,"6568":1,"6606":0,"6702":1,"6743":0,"6771":1,"6779":0,"6799":1,"6805":0,"6823":1,"6832":0,"6936":1,"7008":0,"7031":1,"7039":0,"7139":1,"7154":0,"7156":1,"7160":0,"7206":1,"7277":0,"7358":1,"7367":0,"7386":1,"7396":0,"7547":1,"7560":0,"7753":1,"7763":0,"7780":1,"7788":0,"7803":1,"7813":0,"7868":1,"7875":0,"7915":1,"7923":0,"8047":1,"8056":0,"8089":1,"8096":0,"8135":1,"8142":0,"8220":1,"8226":0,"8267":1,"8273":0,"8303":1,"8308":0,"8415":1,"8420":0,"8514":1,"8519":0,"8549":1,"8554":0,"8640":1,"8646":0,"8715":1,"8720":0,"8800":1,"8807":0,"8905":1,"8911":0,"8943":1,"8950":0,"9053":1,"9059":0,"9120":1,"9128":0,"9348":1,"9354":0,"9374":1,"9384":0,"9450":1,"9459":0,"9506":1,"9515":0,"9596":1,"9608":0,"9617":1,"9630":0,"9647":1,"9657":0,"9671":1,"9681":0,"9695":1,"9709":0,"9721":1,"9730":0,"9807":1,"9814":0,"9862":1,"9868":0,"9919":1,"9927":0,"9973":1,"9983":0,"10032":1,"10039":0}' + ), + af = JSON.parse( + '{"33":1,"40":0,"61":1,"69":0,"150":1,"156":0,"182":1,"190":0,"207":1,"216":0,"225":1,"254":0,"266":1,"275":0,"300":1,"389":0,"417":1,"425":0,"441":1,"511":0,"535":1,"625":0,"650":1,"662":0,"674":1,"741":0,"768":1,"857":0,"878":1,"887":0,"1213":1,"1221":0,"1250":1,"1258":0,"1310":1,"1317":0,"1367":1,"1376":0,"1488":1,"1504":0,"1542":1,"1549":0,"1595":1,"1602":0,"1681":1,"1688":0,"1767":1,"1775":0,"1919":1,"1929":0,"1941":1,"1951":0,"2016":1,"2026":0,"2105":1,"2114":0,"2131":1,"2141":0,"2160":1,"2169":0,"2188":1,"2197":0,"2217":1,"2226":0,"2248":1,"2257":0,"2312":1,"2319":0,"2328":1,"2338":0,"2349":1,"2358":0,"2376":1,"2384":0,"2422":1,"2429":0,"2445":1,"2452":0,"2492":1,"2501":0,"2518":1,"2526":0,"2608":1,"2616":0,"2622":1,"2630":0,"2634":1,"2641":0,"2800":1,"2808":0,"2840":1,"2848":0,"2874":1,"2883":0,"2938":1,"2946":0,"2979":1,"2988":0,"3029":1,"3038":0,"3072":1,"3081":0,"3096":1,"3109":0,"3215":1,"3223":0,"3276":1,"3342":0,"3379":1,"3390":0,"3441":1,"3451":0,"3483":1,"3491":0,"3557":1,"3568":0,"3713":1,"3721":0,"3746":1,"3755":0,"3788":1,"3796":0,"3807":1,"3817":0,"3833":1,"3871":0,"3918":1,"3927":0,"3937":1,"3948":0,"3973":1,"3984":0,"3995":1,"4005":0,"4033":1,"4044":0,"4088":1,"4097":0,"4118":1,"4127":0,"4143":1,"4154":0,"4172":1,"4185":0,"4235":1,"4245":0,"4276":1,"4285":0,"4304":1,"4314":0,"4400":1,"4411":0,"4439":1,"4448":0,"4480":1,"4493":0,"4504":1,"4515":0,"4536":1,"4546":0,"4605":1,"4610":0,"4630":1,"4687":0,"4826":1,"4836":0,"4931":1,"4939":0,"5164":1,"5172":0,"5203":1,"5211":0,"5260":1,"5266":0,"5314":1,"5325":0,"5398":1,"5406":0,"5426":1,"5441":0,"5482":1,"5494":0,"5544":1,"5553":0,"5830":1,"5897":0,"6032":1,"6093":0,"6207":1,"6217":0,"6262":1,"6269":0,"6314":1,"6321":0,"6367":1,"6375":0,"6421":1,"6431":0,"6498":1,"6508":0,"6672":1,"6679":0,"6787":1,"6795":0,"6881":1,"6916":0,"6993":1,"7002":0,"7011":1,"7023":0,"7091":1,"7099":0,"7136":1,"7146":0,"7157":1,"7167":0,"7224":1,"7235":0,"7254":1,"7263":0,"7283":1,"7292":0,"7358":1,"7364":0,"7423":1,"7432":0,"7452":1,"7461":0,"7481":1,"7491":0,"7519":1,"7527":0,"7547":1,"7556":0,"7587":1,"7595":0,"7716":1,"7724":0,"7768":1,"7775":0,"7791":1,"7800":0,"7817":1,"7827":0,"7843":1,"7851":0,"7891":1,"7899":0,"7928":1,"7935":0,"7955":1,"7965":0,"8018":1,"8026":0,"8036":1,"8044":0,"8063":1,"8071":0,"8102":1,"8111":0,"8142":1,"8148":0,"8253":1,"8260":0,"8286":1,"8293":0,"8359":1,"8365":0,"8374":1,"8404":0,"8449":1,"8455":0,"8523":1,"8532":0,"8563":1,"8572":0}', + ), + nf = JSON.parse( + '{"83":1,"92":0,"136":1,"143":0,"182":1,"191":0,"229":1,"265":0,"310":1,"319":0,"334":1,"343":0,"356":1,"368":0,"389":1,"400":0,"431":1,"457":0,"475":1,"483":0,"491":1,"500":0,"527":1,"535":0,"557":1,"567":0,"599":1,"609":0,"654":1,"663":0,"698":1,"708":0,"770":1,"779":0,"787":1,"796":0,"816":1,"825":0,"837":1,"846":0,"860":1,"870":0,"885":1,"893":0,"927":1,"935":0,"950":1,"960":0,"979":1,"1033":0,"1052":1,"1057":1,"1061":0,"1066":0,"1078":1,"1137":0,"1173":1,"1183":0,"1195":1,"1204":0,"1217":1,"1227":0,"1242":1,"1252":0,"1265":1,"1274":0,"1302":1,"1328":0,"1344":1,"1352":0,"1377":1,"1388":0,"1409":1,"1418":0,"1440":1,"1448":0,"1472":1,"1483":0,"1505":1,"1514":0,"1558":1,"1569":0,"1591":1,"1601":0,"1627":1,"1636":0,"1650":1,"1660":0,"1685":1,"1695":0,"1723":1,"1732":0,"1756":1,"1765":0,"1777":1,"1787":0,"1798":1,"1808":0,"1824":1,"1834":0,"1846":1,"1856":0,"1869":1,"1878":0,"1891":1,"1901":0,"1945":1,"1955":0,"1994":1,"2004":0,"2021":1,"2030":0,"2046":1,"2055":0,"2075":1,"2085":0,"2092":1,"2102":0,"2135":1,"2144":0,"2156":1,"2158":1,"2165":0,"2169":0,"2180":1,"2188":0,"2204":1,"2212":0,"2227":1,"2235":0,"2252":1,"2260":0,"2275":1,"2283":0,"2449":1,"2457":0,"2500":1,"2508":0,"2537":1,"2545":0,"2599":1,"2606":0,"2631":1,"2639":0,"2667":1,"2674":0,"2724":1,"2777":0,"2845":1,"2853":0,"2878":1,"2887":0,"2922":1,"2932":0,"2956":1,"2963":0,"2989":1,"2999":0,"3012":1,"3020":0,"3032":1,"3040":0,"3047":1,"3057":0,"3098":1,"3145":1,"3178":0,"3216":1,"3248":0,"3267":1,"3302":0,"3361":1,"3392":0,"3443":1,"3524":0,"3554":1,"3582":0,"3620":1,"3631":0,"3648":1,"3653":0,"3658":1,"3662":0,"3667":1,"3671":0,"3675":1,"3680":0,"3685":1,"3689":0,"3695":1,"3699":0,"3705":1,"3708":0,"3714":1,"3719":0,"3724":1,"3729":0,"3732":1,"3738":0,"3869":1,"3875":0,"3909":1,"3916":0,"3931":1,"3939":0,"3969":1,"3977":0,"3990":1,"3999":0,"4043":1,"4049":0,"4080":1,"4088":0,"4118":1,"4128":0,"4164":1,"4173":0,"4204":1,"4212":0,"4267":1,"4274":0,"4292":1,"4300":0,"4316":1,"4324":0,"4340":1,"4348":0,"4360":1,"4375":0,"4388":1,"4456":0,"4480":1,"4503":0,"4537":1,"4544":0,"4576":1,"4584":0,"4657":1,"4663":0,"4685":1,"4689":1,"4693":0,"4712":1,"4720":0,"4741":1,"4748":0,"4776":1,"4785":0,"4844":1,"4853":0,"4881":1,"4889":0,"4908":1,"4916":0,"4940":1,"4948":0,"4991":1,"4998":0,"5035":1,"5042":0,"5075":1,"5084":0,"5106":1,"5115":0,"5127":1,"5173":0,"5217":1,"5221":0,"5272":1,"5280":0,"5332":1,"5340":0,"5395":1,"5422":0,"5452":1,"5464":0,"5483":1,"5509":0,"5540":1,"5552":0,"5575":1,"5586":0,"5597":1,"5629":0,"5649":1,"5657":0,"5672":1,"5684":0,"5714":1,"5721":0,"5733":1,"5742":0,"5771":1,"5780":0,"5804":1,"5810":0,"5814":1,"5840":0,"5857":1,"5870":0,"5894":1,"5906":0,"5921":1,"6002":0,"6012":1,"6017":0,"6021":1,"6027":0,"6068":1,"6073":0,"6079":1,"6083":0,"6087":1,"6092":0,"6185":1,"6197":0,"6220":1,"6254":0,"6280":1,"6295":0,"6326":1,"6334":0,"6377":1,"6386":0,"6422":1,"6431":0,"6474":1,"6482":0,"6531":1,"6540":0,"6598":1,"6616":0,"6643":1,"6652":0,"6696":1,"6708":0,"6722":1,"6732":0,"6760":1,"6843":0,"6863":1,"6871":0,"6993":1,"7000":0,"7023":1,"7030":0,"7083":1,"7091":0,"7124":1,"7132":0,"7155":1,"7164":0,"7196":1,"7203":0,"7239":1,"7284":0,"7302":1,"7337":0,"7388":1,"7395":0,"7414":1,"7422":0,"7457":1,"7465":0,"7494":1,"7502":0,"7512":1,"7525":0,"7968":1,"8004":0,"8054":1,"8062":0,"8087":1,"8094":0,"8144":1,"8151":0,"8174":1,"8182":0,"8192":1,"8254":0,"8260":1,"8334":0,"8401":1,"8407":0,"8428":1,"8437":0,"8465":1,"8472":0,"8502":1,"8508":0,"8573":1,"8583":0,"8603":1,"8609":0,"8683":1,"8690":0,"8709":1,"8710":1,"8720":0,"8722":0,"8767":1,"8777":0,"8804":1,"8815":0,"8856":1,"8869":0,"8907":1,"8918":0,"8995":1,"9002":0,"9025":1,"9032":0,"9060":1,"9070":0,"9136":1,"9143":0,"9185":1,"9192":0,"9252":1,"9263":0,"9305":1,"9313":0,"9378":1,"9386":0,"9406":1,"9414":0,"9479":1,"9490":0,"9505":1,"9514":0,"9595":1,"9604":0,"9622":1,"9629":0,"9649":1,"9659":0,"9681":1,"9693":0,"9718":1,"9727":0,"9744":1,"9752":0,"9772":1,"9780":0,"9804":1,"9815":0,"10051":1,"10064":0,"10075":1,"10078":1,"10087":0,"10088":0,"10107":1,"10122":0,"10151":1,"10161":0,"10181":1,"10193":0,"10216":1,"10226":0,"10237":1,"10245":0,"10261":1,"10270":0,"10287":1,"10296":0,"10314":1,"10324":0,"10340":1,"10355":0,"10369":1,"10427":0,"10438":1,"10454":0,"10468":1,"10478":0,"10491":1,"10502":0,"10518":1,"10537":0,"10558":1,"10564":0,"10574":1,"10585":0,"10604":1,"10619":0,"10627":1,"10635":0,"10668":1,"10678":0,"10690":1,"10700":0,"10770":1,"10780":0,"10795":1,"10848":1,"10855":0,"10856":0,"10882":1,"10892":0,"10909":1,"10919":0,"10948":1,"10957":0,"10973":1,"10982":0,"11030":1,"11049":0,"11085":1,"11103":0,"11139":1,"11155":0,"11201":1,"11208":0,"11243":1,"11255":0,"11294":1,"11311":0,"11350":1,"11360":0,"11390":1,"11397":0,"11415":1,"11425":0,"11488":1,"11500":0}', + ), + sf = JSON.parse( + '{"122":1,"133":0,"168":1,"179":0,"218":1,"227":0,"263":1,"273":0,"293":1,"303":0,"331":1,"341":0,"371":1,"381":0,"428":1,"438":0,"464":1,"493":0,"513":1,"522":0,"543":1,"552":0,"571":1,"581":0,"702":1,"713":0,"848":1,"856":0,"876":1,"885":0,"905":1,"914":0,"943":1,"952":0,"982":1,"1008":0,"1059":1,"1068":0,"1108":1,"1117":0,"1135":1,"1145":0,"1176":1,"1187":0,"1220":1,"1229":0,"1344":1,"1352":0,"1430":1,"1438":0,"1513":1,"1521":0,"1603":1,"1610":0,"1693":1,"1703":0,"1774":1,"1786":0,"1866":1,"1876":0,"1949":1,"1960":0,"2041":1,"2051":0,"2122":1,"2132":0,"2213":1,"2224":0,"2297":1,"2306":0,"2388":1,"2396":0,"2471":1,"2478":0,"2560":1,"2569":0,"2689":1,"2696":0,"2881":1,"2891":0,"2929":1,"2938":0,"3029":1,"3035":0,"3067":1,"3073":0,"3104":1,"3111":0,"3190":1,"3199":0,"3277":1,"3284":0,"3392":1,"3400":0,"3480":1,"3490":0,"3536":1,"3542":0,"3570":1,"3573":1,"3580":0,"3631":1,"3639":0,"3658":1,"3665":0,"3700":1,"3709":0,"3756":1,"3765":0,"3879":1,"3886":0,"3903":1,"3911":0,"4079":1,"4088":0,"4165":1,"4174":0,"4192":1,"4201":0,"4277":1,"4285":0,"4322":1,"4330":0,"4376":1,"4386":0,"4424":1,"4432":0,"4451":1,"4460":0,"4487":1,"4497":0,"4532":1,"4541":0,"4558":1,"4568":0,"4611":1,"4621":0,"4654":1,"4662":0,"4733":1,"4742":0,"4770":1,"4780":0,"4816":1,"4825":0,"4869":1,"4878":0,"4892":1,"4901":0,"4935":1,"4945":0,"4975":1,"4986":0,"5009":1,"5016":0,"5063":1,"5071":0,"5096":1,"5104":0,"5134":1,"5142":0,"5164":1,"5171":0,"5207":1,"5216":0}', + ), + of = JSON.parse( + '{"70":1,"187":0,"293":1,"317":0,"322":1,"352":0,"455":1,"476":0,"567":1,"611":0,"699":1,"730":0,"734":1,"765":0,"804":1,"835":0,"906":1,"926":0,"976":1,"986":0,"1051":1,"1076":0,"1169":1,"1187":0,"1225":1,"1338":0,"1343":1,"1369":0,"1473":1,"1495":0,"1499":1,"1530":0,"1575":1,"1595":0,"1643":1,"1671":0,"1677":1,"1709":0,"1731":1,"1748":0,"1754":1,"1785":0,"1824":1,"1847":0,"1912":1,"1926":0,"1959":1,"1967":0,"1998":1,"2004":0,"2036":1,"2053":0,"2094":1,"2108":0,"2128":1,"2141":0,"2144":1,"2173":0,"2187":1,"2203":0,"2252":1,"2258":0,"2330":1,"2359":0,"2362":1,"2390":0,"2435":1,"2459":0,"2493":1,"2513":0,"2518":1,"2545":0,"2555":1,"2562":0,"2592":1,"2617":0,"2666":1,"2723":0,"2785":1,"2804":0,"2849":1,"2880":0,"2932":1,"2939":0,"2963":1,"2971":0,"2999":1,"3007":0,"3136":1,"3148":0,"3244":1,"3260":0,"3338":1,"3346":0,"3404":1,"3427":0,"3529":1,"3552":0,"3657":1,"3669":0,"3673":1,"3701":0,"3769":1,"3777":0,"3811":1,"3821":0,"3858":1,"3866":0,"3975":1,"3990":0,"4025":1,"4050":0,"4095":1,"4134":0,"4182":1,"4215":0,"4262":1,"4305":0,"4348":1,"4371":0,"4411":1,"4423":0,"4458":1,"4469":0,"4499":1,"4505":0,"4538":1,"4545":0,"4578":1,"4589":0,"4623":1,"4628":0,"4734":1,"4762":0,"4773":1,"4794":0,"4923":1,"4985":0,"5023":1,"5033":0,"5073":1,"5078":0,"5145":1,"5171":0,"5198":1,"5203":0,"5263":1,"5278":0,"5362":1,"5367":0,"5396":1,"5402":0,"5446":1,"5453":0,"5497":1,"5503":0,"5559":1,"5587":0,"5630":1,"5637":0,"5661":1,"5670":0,"5717":1,"5730":0,"5758":1,"5791":0,"5805":1,"5823":0,"5846":1,"5868":0,"5932":1,"5950":0,"5975":1,"5998":0,"6023":1,"6036":0,"6166":1,"6178":0,"6192":1,"6351":0,"6365":1,"6383":0,"6447":1,"6465":0,"6475":1,"6503":0,"6583":1,"6588":0,"6618":1,"6625":0,"6655":1,"6672":0,"6687":1,"6811":0,"6853":1,"6876":0,"6912":1,"6925":0,"6995":1,"7022":0,"7134":1,"7162":0,"7234":1,"7248":0,"7317":1,"7328":0,"7423":1,"7436":0,"7471":1,"7535":0,"7564":1,"7603":0,"7631":1,"7654":0,"7659":1,"7692":0,"7710":1,"7735":0,"7767":1,"7809":0,"7844":1,"7855":0,"7859":1,"7889":0,"7897":1,"7917":0,"7924":1,"7953":0,"7995":1,"8023":0,"8068":1,"8086":0,"8117":1,"8130":0,"8135":1,"8161":0,"8271":1,"8286":0,"8324":1,"8341":0,"8347":1,"8375":0,"8394":1,"8412":0,"8505":1,"8512":0,"8640":1,"8668":0,"8675":1,"8681":0,"8712":1,"8724":0,"8776":1,"8791":0,"8812":1,"8867":0,"8871":1,"8902":0,"8960":1,"8966":0,"9002":1,"9010":0,"9014":1,"9041":0}', + ), + rf = JSON.parse( + '{"87":1,"94":0,"134":1,"141":0,"227":1,"234":0,"410":1,"417":0,"531":1,"541":0,"564":1,"635":0,"704":1,"714":0,"781":1,"789":0,"841":1,"852":0,"904":1,"914":0,"999":1,"1008":0,"1022":1,"1032":0,"1076":1,"1086":0,"1156":1,"1165":0,"1187":1,"1197":0,"1271":1,"1281":0,"1326":1,"1336":0,"1360":1,"1420":0,"1527":1,"1536":0,"1588":1,"1598":0,"1652":1,"1660":0,"1700":1,"1709":0,"1789":1,"1797":0,"1809":1,"1820":0,"1850":1,"1859":0,"1880":1,"1888":0,"1907":1,"1915":0,"1930":1,"1941":0,"2034":1,"2043":0,"2068":1,"2078":0,"2101":1,"2109":0,"2123":1,"2133":0,"2157":1,"2163":0,"2228":1,"2237":0,"2250":1,"2262":0,"2300":1,"2311":0,"2333":1,"2339":0,"2348":1,"2360":0,"2403":1,"2411":0,"2440":1,"2446":0,"2470":1,"2478":0,"2738":1,"2747":0,"2789":1,"2866":0,"2922":1,"2935":0,"3022":1,"3031":0,"3065":1,"3127":0,"3162":1,"3172":0,"3360":1,"3526":0,"3559":1,"3570":0,"3669":1,"3677":0,"3780":1,"3789":0,"3815":1,"3824":0,"3885":1,"3893":0,"3949":1,"3997":0,"4059":1,"4069":0,"4116":1,"4128":0,"4156":1,"4165":0,"4195":1,"4209":0,"4227":1,"4240":0,"4277":1,"4286":0,"4316":1,"4323":0,"4406":1,"4413":0,"4421":1,"4431":0,"4474":1,"4483":0,"4504":1,"4512":0,"4543":1,"4617":0,"4650":1,"4661":0,"4718":1,"4725":0,"4823":1,"4832":0,"4865":1,"4886":0,"4966":1,"4972":0,"5028":1,"5035":0,"5108":1,"5116":0,"5190":1,"5198":0,"5225":1,"5234":0,"5260":1,"5269":0,"5340":1,"5347":0,"5356":1,"5365":0,"5438":1,"5446":0,"5519":1,"5527":0,"5562":1,"5569":0,"5662":1,"5670":0,"6062":1,"6071":0,"6175":1,"6181":0,"6264":1,"6326":0,"6364":1,"6373":0,"6415":1,"6517":0,"6556":1,"6604":0,"6634":1,"6694":0,"6735":1,"6744":0,"6875":1,"6883":0,"7017":1,"7024":0,"7059":1,"7067":0,"7116":1,"7123":0,"7160":1,"7167":0,"7194":1,"7201":0,"7212":1,"7223":0,"7251":1,"7258":0,"7265":1,"7272":0,"7348":1,"7356":0,"7511":1,"7518":0,"7557":1,"7563":0,"7616":1,"7623":0,"7728":1,"7735":0,"7792":1,"7800":0,"7861":1,"7869":0,"7919":1,"7927":0,"8011":1,"8019":0,"8068":1,"8186":0,"8235":1,"8244":0,"8600":1,"8609":0,"8728":1,"8738":0,"8914":1,"8921":0,"8945":1,"8956":0,"8998":1,"9006":0,"9187":1,"9195":0,"9325":1,"9332":0,"9386":1,"9394":0,"9450":1,"9456":0,"9590":1,"9597":0,"9644":1,"9652":0,"9701":1,"9708":0,"9758":1,"9764":0,"9849":1,"9856":0,"9916":1,"9925":0,"9953":1,"9961":0,"9985":1,"9991":0,"10141":1,"10151":0,"10213":1,"10220":0,"10263":1,"10273":0,"10331":1,"10341":0,"10480":1,"10487":0}', + ), + lf = JSON.parse( + '{"101":1,"109":0,"336":1,"344":0,"539":1,"549":0,"709":1,"717":0,"801":1,"810":0,"900":1,"910":0,"913":1,"932":0,"969":1,"1001":0,"1038":1,"1099":0,"1222":1,"1232":0,"1264":1,"1301":0,"1363":1,"1374":0,"1414":1,"1423":0,"1451":1,"1459":0,"1483":1,"1518":0,"1613":1,"1622":0,"1680":1,"1688":0,"1826":1,"1836":0,"1895":1,"1906":0,"1970":1,"1980":0,"2004":1,"2013":0,"2116":1,"2126":0,"2169":1,"2225":0,"2335":1,"2345":0,"2392":1,"2402":0,"2435":1,"2446":0,"2470":1,"2480":0,"2557":1,"2565":0,"2617":1,"2627":0,"2800":1,"2809":0,"2840":1,"2852":0,"2910":1,"2921":0,"2956":1,"2965":0,"2991":1,"3018":0,"3104":1,"3113":0,"3117":1,"3138":0,"3192":1,"3203":0,"3228":1,"3240":0,"3293":1,"3304":0,"3319":1,"3329":0,"3341":1,"3353":0,"3467":1,"3478":0,"3513":1,"3527":0,"3542":1,"3552":0,"3650":1,"3658":0,"3707":1,"3715":0,"3763":1,"3771":0,"3817":1,"3827":0,"3876":1,"3885":0,"3930":1,"3940":0,"4103":1,"4113":0,"4180":1,"4191":0,"4224":1,"4234":0,"4270":1,"4279":0,"4328":1,"4339":0,"4402":1,"4412":0,"4535":1,"4543":0,"4576":1,"4584":0,"4620":1,"4629":0,"4648":1,"4694":0,"4785":1,"4793":0,"4890":1,"4901":0,"5106":1,"5116":0,"5169":1,"5178":0,"5238":1,"5246":0,"5316":1,"5325":0,"5395":1,"5406":0,"5452":1,"5464":0,"5621":1,"5635":0,"5677":1,"5687":0,"5772":1,"5780":0,"5919":1,"5930":0,"5991":1,"6001":0,"6026":1,"6035":0,"6148":1,"6159":0,"6202":1,"6216":0,"6257":1,"6268":0,"6302":1,"6393":0,"6432":1,"6443":0,"6469":1,"6479":0,"6497":1,"6507":0,"6619":1,"6633":0,"6761":1,"6827":0,"6881":1,"6891":0,"6912":1,"6923":0,"6962":1,"6971":0,"7044":1,"7054":0,"7088":1,"7097":0,"7220":1,"7228":0,"7240":1,"7251":0,"7296":1,"7305":0,"7324":1,"7336":0,"7346":1,"7355":0,"7460":1,"7468":0,"7498":1,"7507":0,"7672":1,"7681":0,"7720":1,"7729":0,"7748":1,"7759":0,"7797":1,"7808":0,"7821":1,"7837":0,"7874":1,"7885":0,"7979":1,"7992":0,"8030":1,"8040":0,"8069":1,"8077":0,"8114":1,"8125":0,"8174":1,"8183":0,"8246":1,"8259":0,"8332":1,"8342":0,"8382":1,"8389":0,"8424":1,"8432":0,"8454":1,"8462":0,"8568":1,"8577":0,"8605":1,"8614":0,"8639":1,"8649":0,"8671":1,"8682":0,"8709":1,"8719":0,"8747":1,"8759":0,"8808":1,"8817":0,"8858":1,"8867":0,"8902":1,"8911":0,"8932":1,"8964":0,"9055":1,"9064":0,"9108":1,"9120":0,"9159":1,"9169":0,"9188":1,"9200":0,"9264":1,"9274":0,"9296":1,"9304":0,"9331":1,"9397":0,"9672":1,"9681":0}', + ), + cf = JSON.parse( + '{"148":1,"184":0,"371":1,"408":0,"586":1,"594":0,"618":1,"625":0,"708":1,"715":0,"818":1,"838":0,"849":1,"856":0,"1016":1,"1057":0,"1083":1,"1090":0,"1115":1,"1121":0,"1146":1,"1151":0,"1239":1,"1293":0,"1324":1,"1333":0,"1446":1,"1452":0,"1465":1,"1472":0,"1533":1,"1569":0,"1606":1,"1615":0,"1680":1,"1685":0,"1732":1,"1796":0,"1947":1,"1952":0,"1999":1,"2007":0,"2035":1,"2041":0,"2128":1,"2135":0,"2174":1,"2181":0,"2230":1,"2295":0,"2397":1,"2401":0,"2486":1,"2494":0,"2514":1,"2520":0,"2594":1,"2600":0,"2624":1,"2630":0,"2816":1,"2832":0,"2845":1,"2851":0,"2904":1,"2911":0,"2963":1,"2969":0,"3016":1,"3022":0,"3044":1,"3051":0,"3099":1,"3106":0,"3135":1,"3143":0,"3210":1,"3217":0,"3331":1,"3337":0,"3362":1,"3370":0,"3426":1,"3432":0,"3465":1,"3473":0,"3773":1,"3779":0,"3807":1,"3813":0,"3835":1,"3841":0,"3921":1,"3929":0,"3975":1,"3984":0,"4032":1,"4039":0,"4057":1,"4066":0,"4145":1,"4153":0,"4196":1,"4231":0,"4247":1,"4256":0,"4393":1,"4431":0,"4449":1,"4458":0,"4480":1,"4488":0,"4595":1,"4603":0,"4635":1,"4643":0,"4662":1,"4669":0,"4811":1,"4873":0,"4904":1,"4915":0,"4968":1,"4977":0,"4992":1,"5002":0,"5079":1,"5086":0,"5134":1,"5142":0,"5239":1,"5248":0,"5273":1,"5281":0,"5292":1,"5300":0,"5321":1,"5330":0,"5373":1,"5378":0,"5483":1,"5490":0,"5514":1,"5522":0,"5577":1,"5583":0,"5622":1,"5628":0,"5652":1,"5659":0,"5710":1,"5716":0,"5740":1,"5747":0,"5838":1,"5847":0,"5937":1,"5974":0,"5996":1,"6004":0,"6053":1,"6059":0,"6079":1,"6087":0,"6109":1,"6116":0,"6142":1,"6150":0,"6193":1,"6201":0,"6391":1,"6396":0,"6411":1,"6428":0,"6482":1,"6488":0,"6514":1,"6520":0,"6584":1,"6600":0,"6617":1,"6623":0,"6646":1,"6651":0,"6662":1,"6668":0,"6728":1,"6734":0,"6792":1,"6803":0,"6838":1,"6846":0,"6866":1,"6875":0,"6926":1,"6934":0,"6955":1,"6962":0,"6987":1,"6993":0,"7016":1,"7022":0,"7059":1,"7065":0,"7075":1,"7082":0,"7128":1,"7138":0,"7342":1,"7348":0,"7372":1,"7378":0,"7404":1,"7411":0,"7444":1,"7453":0,"7469":1,"7479":0,"7514":1,"7518":0,"7527":1,"7533":0,"7567":1,"7577":0,"7601":1,"7639":0,"7684":1,"7694":0,"7717":1,"7724":0,"7743":1,"7751":0,"7778":1,"7797":0,"7848":1,"7857":0,"7946":1,"7953":0,"7971":1,"7980":0,"8005":1,"8012":0,"8024":1,"8030":0,"8138":1,"8145":0,"8192":1,"8197":0,"8227":1,"8233":0,"8252":1,"8260":0,"8303":1,"8310":0,"8329":1,"8336":0,"8360":1,"8365":0,"8404":1,"8410":0,"8441":1,"8448":0,"8472":1,"8477":0,"8693":1,"8712":0,"8748":1,"8754":0,"8777":1,"8785":0,"8807":1,"8815":0,"8842":1,"8851":0,"8882":1,"8891":0,"8916":1,"8956":0,"8963":1,"8971":0,"9335":1,"9347":0,"9428":1,"9439":0,"9456":1,"9463":0}' + ), + df = JSON.parse( + '{"131":1,"137":0,"152":1,"158":0,"205":1,"212":0,"283":1,"289":0,"320":1,"327":0,"348":1,"355":0,"387":1,"393":0,"427":1,"434":0,"460":1,"468":0,"493":1,"501":0,"513":1,"520":0,"571":1,"577":0,"593":1,"600":0,"618":1,"625":0,"634":1,"641":0,"665":1,"673":0,"698":1,"705":0,"761":1,"767":0,"778":1,"786":0,"859":1,"867":0,"883":1,"890":0,"904":1,"911":0,"922":1,"929":0,"945":1,"954":0,"964":1,"972":0,"991":1,"999":0,"1049":1,"1056":0,"1066":1,"1073":0,"1093":1,"1101":0,"1145":1,"1153":0,"1168":1,"1175":0,"1192":1,"1199":0,"1210":1,"1217":0,"1228":1,"1254":0,"1278":1,"1285":0,"1331":1,"1339":0,"1353":1,"1360":0,"1376":1,"1383":0,"1431":1,"1439":0,"1477":1,"1484":0,"1495":1,"1502":0,"1511":1,"1518":0,"1530":1,"1538":0,"1564":1,"1570":0,"1644":1,"1651":0,"1665":1,"1672":0,"1683":1,"1690":0,"1703":1,"1710":0,"1744":1,"1752":0,"1780":1,"1785":0,"1789":1,"1797":0,"1814":1,"1819":0,"1823":1,"1829":0,"1846":1,"1851":0,"1857":1,"1862":0,"1874":1,"1881":0,"1895":1,"1904":0,"1914":1,"1924":0,"2008":1,"2015":0,"2021":1,"2029":0,"2045":1,"2052":0,"2062":1,"2068":0,"2085":1,"2091":0,"2097":1,"2103":0,"2125":1,"2132":0,"2151":1,"2157":0,"2166":1,"2172":0,"2189":1,"2196":0,"2202":1,"2209":0,"2226":1,"2232":0,"2238":1,"2244":0,"2260":1,"2267":0,"2291":1,"2299":0,"2310":1,"2317":0,"2327":1,"2334":0,"2362":1,"2369":0,"2375":1,"2384":0,"2404":1,"2410":0,"2418":1,"2425":0,"2444":1,"2451":0,"2477":1,"2484":0,"2508":1,"2516":0,"2530":1,"2538":0,"2579":1,"2587":0,"2595":1,"2638":0,"2670":1,"2677":0,"2688":1,"2697":0,"2728":1,"2735":0,"2740":1,"2747":0,"2761":1,"2769":0,"2783":1,"2791":0,"2804":1,"2811":0,"2819":1,"2827":0,"2834":1,"2841":0,"2848":1,"2855":0,"2870":1,"2878":0,"2891":1,"2899":0,"2905":1,"2914":0,"2936":1,"2943":0,"2973":1,"2980":0,"2993":1,"3000":0,"3009":1,"3017":0,"3047":1,"3056":0,"3081":1,"3091":0,"3117":1,"3124":0,"3210":1,"3215":0,"3219":1,"3226":0,"3250":1,"3255":0,"3259":1,"3266":0,"3303":1,"3311":0,"3348":1,"3354":0,"3362":1,"3369":0,"3398":1,"3404":0,"3412":1,"3419":0,"3428":1,"3437":0,"3448":1,"3455":0,"3500":1,"3505":0,"3510":1,"3518":0,"3529":1,"3536":0,"3539":1,"3546":0,"3592":1,"3599":0,"3620":1,"3627":0,"3640":1,"3646":0,"3651":1,"3659":0,"3674":1,"3682":0,"3734":1,"3739":0,"3745":1,"3752":0,"3766":1,"3774":0,"3782":1,"3790":0,"3800":1,"3808":0,"3821":1,"3845":0,"3867":1,"3874":0,"3899":1,"3907":0,"3920":1,"3928":0,"3938":1,"3946":0,"3960":1,"3968":0,"4020":1,"4028":0,"4063":1,"4070":0,"4081":1,"4089":0,"4098":1,"4106":0,"4110":1,"4114":1,"4124":0,"4151":1,"4159":0,"4209":1,"4217":0,"4228":1,"4237":0,"4244":1,"4250":0,"4255":1,"4263":0,"4306":1,"4313":0,"4326":1,"4333":0,"4353":1,"4359":0,"4370":1,"4377":0,"4385":1,"4393":0,"4408":1,"4421":0,"4440":1,"4448":0,"4463":1,"4471":0,"4495":1,"4502":0,"4513":1,"4521":0,"4542":1,"4550":0,"4583":1,"4589":0,"4592":1,"4601":0,"4638":1,"4646":0,"4655":1,"4662":0,"4669":1,"4677":0,"4691":1,"4701":0,"4722":1,"4730":0,"4742":1,"4751":0,"4764":1,"4808":0,"4825":1,"4832":0,"4836":1,"4844":0,"4849":1,"4898":0,"4925":1,"4931":0,"4937":1,"4945":0,"4970":1,"4976":0,"4982":1,"4990":0,"5013":1,"5020":0,"5033":1,"5041":0,"5056":1,"5065":0,"5079":1,"5087":0,"5104":1,"5112":0,"5126":1,"5135":0,"5152":1,"5159":0,"5162":1,"5170":0,"5184":1,"5190":0,"5194":1,"5200":0,"5239":1,"5248":0,"5310":1,"5317":0,"5327":1,"5333":0,"5337":1,"5342":0,"5347":1,"5354":0,"5364":1,"5372":0,"5382":1,"5391":0,"5400":1,"5409":0,"5417":1,"5426":0,"5437":1,"5444":0,"5449":1,"5457":0,"5471":1,"5479":0,"5492":1,"5500":0,"5507":1,"5515":0,"5538":1,"5544":0,"5548":1,"5557":0,"5564":1,"5572":0,"5581":1,"5587":0,"5593":1,"5600":0,"5616":1,"5623":0,"5633":1,"5642":0,"5652":1,"5660":0,"5670":1,"5676":0,"5680":1,"5688":0,"5702":1,"5711":0,"5722":1,"5730":0,"5735":1,"5743":0,"5757":1,"5765":0,"5778":1,"5785":0,"5792":1,"5798":0,"5812":1,"5820":0,"5829":1,"5836":0,"5846":1,"5854":0,"5863":1,"5869":0,"5882":1,"5891":0,"5919":1,"5927":0,"5932":1,"5939":0,"5944":1,"5952":0,"5970":1,"5983":0,"5989":1,"6011":0,"6022":1,"6030":0,"6062":1,"6069":0,"6074":1,"6080":0,"6085":1,"6093":0,"6106":1,"6111":0,"6116":1,"6122":0,"6142":1,"6147":0,"6152":1,"6158":0,"6169":1,"6175":0,"6182":1,"6190":0,"6205":1,"6212":0,"6218":1,"6227":0,"6241":1,"6246":0,"6254":1,"6261":0,"6276":1,"6284":0,"6312":1,"6322":0,"6370":1,"6376":0,"6465":1,"6471":0,"6477":1,"6486":0,"6502":1,"6507":0,"6513":1,"6520":0,"6536":1,"6541":0,"6547":1,"6555":0,"6572":1,"6577":0,"6582":1,"6589":0,"6610":1,"6617":0,"6644":1,"6650":0,"6655":1,"6662":0,"6680":1,"6686":0,"6690":1,"6697":0,"6717":1,"6725":0,"6751":1,"6757":0,"6762":1,"6770":0,"6788":1,"6794":0,"6798":1,"6806":0,"6822":1,"6830":0,"6853":1,"6862":0,"6874":1,"6882":0,"6894":1,"6902":0,"6917":1,"6928":0,"6936":1,"6944":0,"6951":1,"6959":0,"6965":1,"6972":0,"6980":1,"6986":0,"6990":1,"6996":0,"7037":1,"7043":0,"7048":1,"7055":0,"7073":1,"7079":0,"7083":1,"7091":0,"7110":1,"7116":0,"7120":1,"7129":0,"7145":1,"7153":0,"7171":1,"7178":0,"7181":1,"7190":0,"7208":1,"7214":0,"7219":1,"7227":0,"7239":1,"7245":0,"7260":1,"7267":0,"7273":1,"7280":0,"7285":1,"7292":0,"7307":1,"7314":0,"7323":1,"7329":0,"7345":1,"7352":0,"7358":1,"7365":0,"7381":1,"7387":0,"7404":1,"7412":0,"7416":1,"7423":0,"7440":1,"7448":0,"7484":1,"7492":0,"7515":1,"7523":0,"7546":1,"7552":0,"7558":1,"7567":0,"7603":1,"7610":0,"7620":1,"7627":0,"7638":1,"7645":0,"7657":1,"7665":0,"7677":1,"7683":0,"7695":1,"7702":0,"7712":1,"7720":0,"7731":1,"7738":0,"7749":1,"7756":0,"7767":1,"7774":0,"7783":1,"7792":0,"7800":1,"7808":0,"7818":1,"7826":0,"7837":1,"7844":0,"7855":1,"7862":0,"7868":1,"7874":0,"7879":1,"7884":0,"7922":1,"7931":0,"7941":1,"7945":1,"7950":0,"7951":0,"7968":1,"7975":0,"7993":1,"8020":0,"8033":1,"8043":0,"8058":1,"8068":0,"8090":1,"8098":0,"8104":1,"8116":0,"8136":1,"8144":0,"8210":1,"8218":0,"8228":1,"8237":0,"8247":1,"8255":0,"8265":1,"8272":0,"8282":1,"8290":0,"8302":1,"8309":0,"8336":1,"8344":0,"8353":1,"8362":0,"8373":1,"8381":0,"8390":1,"8399":0,"8410":1,"8416":0,"8422":1,"8427":0,"8434":1,"8440":0,"8446":1,"8451":0,"8454":1,"8460":0,"8499":1,"8507":0,"8535":1,"8542":0,"8595":1,"8604":0,"8633":1,"8641":0,"8697":1,"8703":0,"8723":1,"8728":0,"8733":1,"8739":0,"8767":1,"8774":0,"8794":1,"8799":0,"8803":1,"8809":0,"8839":1,"8846":0,"8864":1,"8870":0,"8875":1,"8880":0,"8909":1,"8915":0,"8927":1,"8932":0,"8937":1,"8941":0,"8945":1,"8950":0,"8975":1,"8981":0,"8985":1,"8992":0,"9008":1,"9014":0,"9019":1,"9025":0,"9046":1,"9052":0,"9055":1,"9062":0,"9079":1,"9086":0,"9091":1,"9097":0,"9119":1,"9159":0,"9178":1,"9222":0,"9245":1,"9303":0,"9326":1,"9334":0,"9394":1,"9398":0,"9411":1,"9418":0,"9427":1,"9435":0,"9445":1,"9453":0,"9463":1,"9472":0,"9482":1,"9490":0,"9502":1,"9510":0,"9520":1,"9528":0,"9538":1,"9545":0,"9556":1,"9563":0,"9573":1,"9582":0,"9592":1,"9599":0,"9609":1,"9617":0,"9629":1,"9637":0,"9646":1,"9654":0,"9670":1,"9678":0,"9683":1,"9691":0,"9699":1,"9707":0,"9718":1,"9726":0,"9735":1,"9743":0,"9753":1,"9761":0,"9770":1,"9778":0,"9787":1,"9795":0,"9804":1,"9812":0,"9834":1,"9836":1,"9841":0,"9869":1,"9876":0,"9901":1,"9908":0,"9932":1,"9938":0,"9985":1,"9991":0,"9998":1,"10005":0,"10023":1,"10028":0,"10032":1,"10039":0,"10056":1,"10062":0,"10067":1,"10074":0,"10093":1,"10100":0,"10110":1,"10116":0,"10121":1,"10129":0,"10147":1,"10154":0,"10160":1,"10167":0,"10181":1,"10188":0,"10195":1,"10201":0,"10206":1,"10212":0,"10217":1,"10223":0,"10259":1,"10265":0,"10278":1,"10285":0,"10299":1,"10307":0,"10312":1,"10318":0,"10334":1,"10340":0,"10345":1,"10350":1,"10352":0,"10353":0,"10368":1,"10408":0,"10418":1,"10427":0,"10443":1,"10452":0,"10469":1,"10477":0,"10498":1,"10505":0,"10539":1,"10545":0}', + ), + uf = JSON.parse( + '{"111":1,"116":0,"219":1,"225":0,"240":1,"245":0,"272":1,"280":0,"301":1,"306":0,"330":1,"335":0,"353":1,"359":0,"381":1,"387":0,"399":1,"407":0,"419":1,"430":0,"480":1,"541":0,"709":1,"718":0,"765":1,"770":0,"806":1,"810":0,"822":1,"827":0,"841":1,"846":0,"862":1,"868":0,"900":1,"910":0,"927":1,"934":0,"957":1,"963":0,"978":1,"983":0,"1009":1,"1016":0,"1030":1,"1037":0,"1045":1,"1053":0,"1062":1,"1069":0,"1077":1,"1085":0,"1118":1,"1124":0,"1146":1,"1153":0,"1205":1,"1211":0,"1228":1,"1233":0,"1366":1,"1371":0,"1403":1,"1408":0,"1434":1,"1443":0,"1453":1,"1459":0,"1475":1,"1485":0,"1502":1,"1509":0,"1558":1,"1564":0,"1584":1,"1590":0,"1612":1,"1619":0,"1637":1,"1643":0,"1657":1,"1662":0,"1721":1,"1727":0,"1754":1,"1758":0,"1819":1,"1825":0,"1840":1,"1847":0,"1881":1,"1890":0,"1915":1,"1922":0,"1941":1,"1948":0,"2013":1,"2022":0,"2083":1,"2090":0,"2108":1,"2114":0,"2125":1,"2131":0,"2160":1,"2166":0,"2238":1,"2245":0,"2293":1,"2299":0,"2314":1,"2320":0,"2371":1,"2377":0,"2428":1,"2432":0,"2485":1,"2492":0,"2525":1,"2531":0,"2543":1,"2549":0,"2561":1,"2567":0,"2580":1,"2585":0,"2613":1,"2619":0,"2648":1,"2654":0,"2687":1,"2724":0,"2732":1,"2739":0,"2754":1,"2759":0,"2778":1,"2782":0,"2810":1,"2816":0,"2841":1,"2847":0,"2878":1,"2888":0,"2907":1,"2915":0,"2935":1,"2940":0,"2982":1,"2989":0,"3010":1,"3018":0,"3061":1,"3068":0,"3302":1,"3313":0,"3353":1,"3412":0,"3433":1,"3440":0,"3459":1,"3463":0,"3492":1,"3558":0,"3579":1,"3612":0,"3628":1,"3634":0,"3658":1,"3684":0,"3695":1,"3701":0,"3735":1,"3769":0,"3776":1,"3783":0,"3801":1,"3810":0,"3834":1,"3879":0,"3901":1,"3909":0,"3935":1,"3940":0,"3961":1,"3973":0,"3985":1,"3992":0,"4032":1,"4063":0,"4120":1,"4128":0,"4170":1,"4179":0,"4206":1,"4213":0,"4236":1,"4244":0,"4272":1,"4278":0,"4285":1,"4292":0,"4317":1,"4326":0,"4341":1,"4349":0,"4358":1,"4362":0,"4395":1,"4400":0,"4417":1,"4421":0,"4445":1,"4450":0,"4476":1,"4480":0,"4491":1,"4496":0,"4509":1,"4515":0,"4554":1,"4582":0,"4613":1,"4620":0,"4652":1,"4661":0,"4676":1,"4684":0,"4690":1,"4699":0,"4735":1,"4747":0,"4761":1,"4768":0,"4787":1,"4794":0,"4821":1,"4828":0,"4911":1,"4955":0,"5390":1,"5431":0,"5482":1,"5502":0,"5533":1,"5547":0,"5560":1,"5572":0,"5598":1,"5609":0,"5626":1,"5635":0,"5648":1,"5659":0,"5679":1,"5687":0,"5711":1,"5720":0,"5754":1,"5766":0,"5780":1,"5791":0,"5832":1,"5845":0,"5928":1,"5940":0,"5957":1,"5966":0,"5987":1,"6002":0,"6062":1,"6075":0,"6112":1,"6121":0,"6134":1,"6146":0,"6167":1,"6175":0,"6194":1,"6203":0,"6236":1,"6264":0,"6485":1,"6493":0,"6509":1,"6516":0,"6585":1,"6592":0,"6627":1,"6652":0,"6696":1,"6704":0,"6724":1,"6731":0,"6819":1,"6829":0,"6850":1,"6874":0,"6887":1,"6893":0,"6928":1,"6934":0,"6965":1,"6969":0,"6999":1,"7006":0,"7069":1,"7074":0,"7121":1,"7146":0,"7172":1,"7178":0,"7198":1,"7201":0,"7225":1,"7230":0,"7253":1,"7259":0,"7285":1,"7290":0,"7302":1,"7308":0,"7322":1,"7327":0,"7356":1,"7360":0,"7369":1,"7376":0,"7385":1,"7390":0,"7405":1,"7409":0,"7435":1,"7441":0,"7495":1,"7500":0,"7520":1,"7523":0,"7549":1,"7554":0,"7573":1,"7577":0,"7599":1,"7603":0,"7661":1,"7668":0,"7695":1,"7701":0,"7729":1,"7734":0,"7917":1,"7926":0,"7952":1,"7960":0,"7986":1,"7995":0,"8009":1,"8017":0,"8023":1,"8033":0,"8041":1,"8052":0,"8105":1,"8116":0,"8128":1,"8134":0,"8152":1,"8159":0,"8170":1,"8176":0,"8201":1,"8208":0,"8229":1,"8238":0,"8298":1,"8306":0,"8529":1,"8538":0,"8566":1,"8574":0,"8593":1,"8599":0,"8627":1,"8633":0,"8646":1,"8650":0,"8677":1,"8682":0,"8703":1,"8705":0,"8755":1,"8761":0,"8785":1,"8790":0,"8862":1,"8869":0,"8890":1,"8895":0,"8914":1,"8921":0,"8982":1,"8988":0,"9003":1,"9008":0,"9062":1,"9066":0,"9087":1,"9093":0,"9165":1,"9174":0,"9212":1,"9218":0,"9241":1,"9250":0,"9391":1,"9399":0,"9418":1,"9424":0,"9442":1,"9451":0,"9470":1,"9475":0,"9496":1,"9503":0,"9523":1,"9529":0,"9552":1,"9561":0,"9604":1,"9617":0,"9628":1,"9637":0,"9654":1,"9662":0,"9692":1,"9698":0,"9713":1,"9718":0,"9743":1,"9751":0,"9770":1,"9774":0,"9793":1,"9797":0,"9848":1,"9855":0,"9957":1,"9963":0,"9985":1,"9991":0,"10012":1,"10018":0,"10037":1,"10042":0,"10067":1,"10072":0,"10096":1,"10101":0,"10122":1,"10128":0,"10173":1,"10181":0,"10249":1,"10300":0,"10418":1,"10428":0,"10438":1,"10448":0,"10471":1,"10482":0,"10529":1,"10535":0,"10549":1,"10557":0,"10571":1,"10578":0,"10592":1,"10598":0,"10613":1,"10620":0,"10640":1,"10646":0,"10668":1,"10673":0,"10681":1,"10687":0,"10719":1,"10724":0,"10739":1,"10745":0,"10770":1,"10775":0,"10829":1,"10836":0,"10861":1,"10869":0,"10902":1,"10907":0,"10923":1,"10928":0,"10940":1,"10945":0,"10959":1,"10964":0,"10995":1,"11003":0,"11042":1,"11050":0,"11120":1,"11183":0,"11211":1,"11219":0,"11235":1,"11242":0,"11365":1,"11383":0,"11416":1,"11426":0,"11470":1}' + ), + faAuto = JSON.parse( + '{"110":1,"128":0,"140":1,"148":0,"184":1,"189":0,"195":1,"199":0,"214":1,"218":0,"232":1,"237":0,"264":1,"268":0,"281":1,"286":0,"312":1,"317":0,"335":1,"341":0,"368":1,"372":0,"380":1,"384":0,"397":1,"403":0,"425":1,"430":0,"435":1,"441":0,"492":1,"500":0,"517":1,"522":0,"541":1,"545":0,"562":1,"568":0,"592":1,"597":0,"631":1,"637":0,"686":1,"692":0,"700":1,"704":0,"726":1,"730":0,"738":1,"742":0,"794":1,"801":0,"833":1,"839":0,"940":1,"947":0,"964":1,"972":0,"1003":1,"1015":0,"1020":1,"1025":0,"1037":1,"1042":0,"1050":1,"1055":0,"1071":1,"1077":0,"1095":1,"1101":0,"1109":1,"1113":0,"1126":1,"1132":0,"1157":1,"1163":0,"1180":1,"1185":0,"1197":1,"1202":0,"1223":1,"1229":0,"1246":1,"1252":0,"1280":1,"1285":0,"1304":1,"1307":0,"1312":1,"1313":0,"1323":1,"1327":0,"1339":1,"1343":0,"1360":1,"1365":0,"1374":1,"1377":0,"1415":1,"1419":0,"1430":1,"1435":0,"1453":1,"1458":0,"1492":1,"1496":0,"1498":1,"1525":0,"1551":1,"1557":0,"1563":1,"1572":0,"1592":1,"1596":0,"1598":1,"1602":0,"1623":1,"1630":0,"1639":1,"1646":0,"1679":1,"1712":0,"1717":1,"1722":0,"1730":1,"1736":0,"1816":1,"1822":0,"1854":1,"1885":0,"1918":1,"1929":0,"1964":1,"1971":0,"1989":1,"1994":0,"2066":1,"2072":0,"2096":1,"2102":0,"2156":1,"2160":0,"2164":1,"2168":0,"2196":1,"2197":0,"2208":1,"2213":0,"2261":1,"2270":0,"2284":1,"2292":0,"2316":1,"2326":0,"2350":1,"2362":0,"2377":1,"2414":0,"2455":1,"2497":0,"2562":1,"2569":0,"2577":1,"2582":0,"2603":1,"2608":0,"2638":1,"2644":0,"2689":1,"2696":0,"2728":1,"2737":0,"2769":1,"2773":0,"2800":1,"2808":0,"2832":1,"2837":0,"2846":1,"2851":0,"2858":1,"2862":0,"2868":1,"2872":0,"2889":1,"2895":0,"2905":1,"2916":0,"2936":1,"2941":0,"2962":1,"2966":0,"3009":1,"3014":0,"3051":1,"3056":0,"3063":1,"3068":0,"3075":1,"3081":0,"3158":1,"3162":0,"3165":1,"3171":0,"3191":1,"3195":0,"3197":1,"3203":0,"3223":1,"3229":0,"3241":1,"3248":0,"3291":1,"3297":0,"3332":1,"3338":0,"3377":1,"3384":0,"3402":1,"3410":0,"3438":1,"3444":0,"3494":1,"3501":0,"3512":1,"3518":0,"3587":1,"3592":0,"3605":1,"3611":0,"3633":1,"3639":0,"3692":1,"3699":0,"3717":1,"3724":0,"3731":1,"3736":0,"3742":1,"3747":0,"3785":1,"3791":0,"3811":1,"3816":0,"3830":1,"3834":0,"3836":1,"3840":0,"3845":1,"3862":0,"3899":1,"3902":0,"3905":1,"3907":0,"3914":1,"3918":0,"3951":1,"3957":0,"3965":1,"3971":0,"4009":1,"4017":0,"4049":1,"4057":0,"4089":1,"4096":0,"4126":1,"4136":0,"4167":1,"4170":0,"4200":1,"4211":0,"4245":1,"4251":0,"4269":1,"4277":0,"4304":1,"4309":0,"4350":1,"4354":0,"4369":1,"4370":0,"4383":1,"4388":0,"4414":1,"4419":0,"4426":1,"4432":0,"4502":1,"4507":0,"4530":1,"4536":0,"4553":1,"4560":0,"4591":1,"4600":0,"4621":1,"4627":0,"4656":1,"4663":0,"4688":1,"4698":0,"4711":1,"4720":0,"4732":1,"4741":0,"4783":1,"4792":0,"4844":1,"4848":0,"4851":1,"4856":0,"4937":1,"4942":0,"4964":1,"4970":0,"5000":1,"5007":0,"5038":1,"5045":0,"5077":1,"5084":0,"5103":1,"5111":0,"5150":1,"5157":0,"5212":1,"5225":0,"5264":1,"5273":0}' + ), + getAutopilotInputs = function (e, t, a = 1) { + const i = (function (e, t) { + switch (e) { + case "Dragonfly": + return Ym; + case "Solar Wind": + return Um; + case "Indestructable": + return jm; + case "8 Bit Shuffle": + return Gm; + case "Think Different": + return Vm; + case "Solar Abyss": + return Hm; + case "Glitched Out": + return Xm; + case "Milky Ways": + return zm; + case "Critical Hit (Extended)": + return Wm; + case "Silverdust": + return qm; + case "Frontier": + return $m; + case "Theory Of Everything 3": + return Jm; + case "Accelerated": + return Km; + case "Sky Fracture": + return Qm; + case "Daydreamer": + return Zm; + case "True Colors": + return ef; + case "Color": + return tf; + case "Coincidence": + return af; + case "Mutant": + return nf; + case "Overdrive": + return sf; + case "Cloud 9": + return of; + case "Last Tile": + return rf; + case "Virtual": + return cf; + case "Nacreous Snowmelt": + return df; + case "Rum n' Bass": + return uf; + case "Funky Adventures": + return faAuto; + default: + return {}; + } + })(t, a), + n = (function (e) { + const t = Math.round(e), + a = e - t; + return Math.abs(a) < 0.1 ? t : null; + })(e); + if (null === n) return null; + const s = i[String(n)]; + return void 0 !== s ? Boolean(s) : null; + }, + pf = function (e, t) { }, + gf = function () { }, + mf = function (e) { }; + const ff = makeSprite({ + init({ getContext: e, device: t, props: a }) { + if ((t.audio("audio/levels/level-complete.wav").play(0), a.world && a.checkpoints.length == 0)) { + const { online: i, achievementUnlocked: n } = e(Se), + { world: s, collectibles: o, score: r } = a; + i + ? (function (e, t, a, i, n, s) { + return ( + (o = this), + (r = void 0), + (c = function* () { + const { levelFileName: o, isCheckpoints: r } = yf( + t, + i, + n, + ); + yield bp + .completedLevel(e, o, r, i, n) + .then(({ hasPass: e, achievements: t }) => { + t.forEach(({ justUnlocked: t, achievement: i }) => { + t && + s(() => { + a(i, e); + }, 2e3); + }); + }); + }), + new ((l = void 0) || (l = Promise))(function (e, t) { + function a(e) { + try { + n(c.next(e)); + } catch (e) { + t(e); + } + } + function i(e) { + try { + n(c.throw(e)); + } catch (e) { + t(e); + } + } + function n(t) { + var n; + t.done + ? e(t.value) + : ((n = t.value), + n instanceof l + ? n + : new l(function (e) { + e(n); + })).then(a, i); + } + n((c = c.apply(o, r || [])).next()); + }) + ); + var o, r, l, c; + })(i.backend, s, n, o, r, t.timer.start).catch(() => { + (t.alert.ok( + "Failed to save achievement online, will try again later", + ), + Jp.addOfflineRequests(t.storage, [yf(s, o, r)])); + }) + : Jp.addOfflineRequests(t.storage, [yf(s, o, r)]); + } + return { frame: 0, opacity: 0 }; + }, + loop({ state: e }) { + e.opacity >= 1 || (e.frame++, e.frame > 100 && (e.opacity += 0.1)); + }, + render({ props: e, getContext: t, state: a, device: i }) { + const { animationAssets: n, animationRenderer: s } = t(Ws); + return [ + _e.Single( + { + width: i.size.fullWidth, + height: i.size.fullHeight, + sprites: () => [], + onPress: () => null, + }, + (e) => { + ((e.width = i.size.fullWidth), + (e.height = i.size.fullHeight)); + }, + ), + Hs({ + id: "Spine", + animationAssets: n, + animationRenderer: s, + fileNames: Qs.spineFiles.levelComplete, + loop: false, + animationName: "animation", + paused: false, + x: 0, + y: 0, + height: 0, + df: 1, + }), + ifConditional( + () => 0 !== a.opacity, + () => [ + Lo.Single( + { + opacity: a.opacity, + sprites: [ + c({ + testId: "FinishLevel", + font: { size: 50 }, + text: localize(e.checkpoints.length > 0 ? "PRACTICE COMPLETE!" : "LEVEL COMPLETE!"), + strokeColor: e.checkpoints.length > 0 ? Ve : Ye, + color: ve, + strokeThickness: 16, + y: 120, + }), + e.score && e.prevHighScore + ? e.score > e.prevHighScore + ? Sf.Single({ + attempts: e.attempts, + score: e.score, + isHighScore: true, + }) + : If.Single({ + attempts: e.attempts, + score: e.score, + highScore: e.prevHighScore, + }) + : e.score + ? Sf.Single({ + attempts: e.attempts, + score: e.score, + isHighScore: false, + }) + : void 0 !== e.prevBestAttempts + ? bf.Single({ + attempts: e.attempts, + prevBestAttempts: e.prevBestAttempts, + }) + : Ef.Single({ attempts: e.attempts }), + Yo.Single({ + text: localize("CONTINUE"), + width: 120, + height: 60, + x: 190, + y: -120, + strokeColor: Ye, + onPress: e.onContinue, }), ], - }), - ] - ); - }, + }, + (e) => { + e.opacity = a.opacity; + }, + ), + ], + ), + ]; + }, + }); + function yf(e, t, a) { + return { + type: "completedLevel", + levelFileName: Hl.getWorld(e.number)[ + e.levelIndex + ].levelFileName.replace(/-/g, "_"), + isCheckpoints: e.withCheckpoints, + collectibles: t, + highScore: a, + }; + } + const Ef = makeSprite({ + render: ({ props: { attempts: e } }) => [ + qe({ width: 500, height: 100, fillColor: Ce }), + qe({ width: 480, height: 80, fillColor: ve }), + c({ + font: { size: 20 }, + text: localize("TOTAL ATTEMPTS") + ":", + color: Ye, + x: -90, }), - iy = makeCustomSprite({ - render({ props: { song: e } }) { - const t = e ? hl.getSnippetName(e.fileName) : null; - return [ - We({ color: Re, width: 360, height: 290, y: -5, x: -5 }), - We({ color: ve, width: Wf, height: qf }), - r({ - fillColor: Re, - path: [ - [0, 0], - [10, 10], - [10, -10], - ], - anchorX: 14, - x: -180, + c({ + font: { size: 40 }, + text: e.toLocaleString(), + strokeColor: Ye, + color: ve, + strokeThickness: 7, + x: 130, + }), + ], + }), + bf = makeSprite({ + render: ({ props: { attempts: e, prevBestAttempts: t } }) => [ + qe({ width: 500, height: 140, fillColor: Ce }), + qe({ width: 480, height: 120, fillColor: ve }), + c({ + font: { size: 20 }, + text: localize("TOTAL ATTEMPTS") + ":", + color: Ye, + x: -90, + y: 25, + }), + c({ + font: { size: 40 }, + text: e.toLocaleString(), + strokeColor: Ye, + color: ve, + strokeThickness: 7, + x: 130, + y: 25, + }), + ifConditional( + () => e < t, + () => [ + c({ + font: { size: 15 }, + text: localize("NEW RECORD!"), + color: Te, + strokeColor: Ye, + strokeThickness: 4, + y: -5, }), - ...(zu.hasIAP() - ? [ - n({ - font: { size: 15 }, - text: "UNLOCKED WITH THE", - color: Be, - y: 35, - }), - n({ - font: { size: 15 }, - text: "ACHIEVEMENT PASS:", - color: Be, - y: 15, - }), - n({ - font: { size: 15 }, - text: "BEAT DRAGONFLY", - color: Me, - y: -15, - }), - n({ - font: { size: 15 }, - text: "WITHOUT CHECKPOINTS", - color: Me, - y: -35, - }), - ] - : [ - n({ - font: { size: 15 }, - text: "BEAT DRAGONFLY", - color: Me, - y: 20, - }), - n({ - font: { size: 15 }, - text: "WITHOUT CHECKPOINTS", - color: Me, - }), - n({ - font: { size: 15 }, - text: "TO UNLOCK", - color: Me, - y: -20, - }), - ]), - t - ? Gf({ - id: `LoadSong-${t}`, - assets: { audioFileNames: [t] }, - sprites: [ - Ro.Single({ - id: `PreviewSong-${t}`, - fileName: t, - loop: false, - paused: false, - fromPosition: 0, - overwrite: true, - isGameSfx: false, - }), - ], + ], + ), + c({ + font: { size: 15 }, + text: `${localize( + "PREVIOUS BEST", + )}: ${t.toLocaleString()} ${localize("ATTEMPT")}${1 === t ? "" : "S" + }`, + color: ve, + strokeColor: Ye, + strokeThickness: 4, + y: -25, + }), + ], + }), + Sf = makeSprite({ + render: ({ props: { attempts: e, score: t, isHighScore: a } }) => [ + qe({ width: 500, height: 140, fillColor: Ce }), + qe({ width: 480, height: 120, fillColor: ve }), + c({ + font: { size: 20 }, + text: localize("TOTAL ATTEMPTS") + ":", + color: Ye, + x: -90, + y: 25, + }), + c({ + font: { size: 40 }, + text: e.toLocaleString(), + strokeColor: Ye, + color: ve, + strokeThickness: 7, + x: 130, + y: 25, + }), + c({ + font: { size: 24 }, + text: `${localize(a ? "NEW HIGH SCORE" : "SCORE")}: ${t.toLocaleString()}`, + color: Te, + strokeColor: Ve, + strokeThickness: 4, + y: -20, + }), + ], + }), + If = makeSprite({ + render: ({ props: { attempts: e, score: t, highScore: a } }) => [ + qe({ width: 500, height: 160, fillColor: Ce }), + qe({ width: 480, height: 140, fillColor: ve }), + c({ + font: { size: 20 }, + text: localize("TOTAL ATTEMPTS") + ":", + color: Ye, + x: -90, + y: 30, + }), + c({ + font: { size: 40 }, + text: e.toLocaleString(), + strokeColor: Ye, + color: ve, + strokeThickness: 7, + x: 130, + y: 30, + }), + c({ + font: { size: 20 }, + text: `${localize("SCORE")}: ${t.toLocaleString()}`, + color: Te, + strokeColor: Ve, + strokeThickness: 4, + y: -10, + }), + c({ + font: { size: 18 }, + text: `${localize("HIGH SCORE")}: ${a.toLocaleString()}`, + color: Te, + strokeColor: Ve, + strokeThickness: 4, + y: -40, + }), + ], + }), + _f = (e) => { + if ("blocks" === e) + return { + fileName: "images/achievement/rewards/blocks.png", + width: 72, + height: 49, + }; + if (e.startsWith("missiles")) + return { + fileName: "images/achievement/rewards/missiles.png", + width: 72, + height: 49, + }; + if (e.startsWith("autopilot")) + return { + fileName: "images/achievement/rewards/autopilot.png", + width: 72, + height: 49, + }; + if (e.startsWith("slowmo")) + return { + fileName: "images/achievement/rewards/slowmo.png", + width: 72, + height: 49, + }; + if (e.startsWith("skin_")) { + const t = e.slice(5), + a = Wt.getSkin(t); + return { + fileName: `images/player/skins/${a.fileName}.png`, + width: a.size, + height: a.size, + }; + } + return e.startsWith("theme_") + ? { + fileName: "images/achievement/rewards/theme.png", + width: 72, + height: 49, + } + : e.startsWith("editor_") + ? { + fileName: "images/achievement/rewards/editor.png", + width: 72, + height: 49, + } + : { + fileName: "images/achievement/rewards/bonus.png", + width: 72, + height: 49, + }; + }; + const vf = makeSprite({ + init({ device: e, props: t, getState: a, getContext: i }) { + var n, s, o, r, l, c; + let d; + const { animationAssets: u } = i(Ws), + { settings: h } = i(Se), + p = Rf(e, h, t.level, a); + ((d = + t.startState && + xa.layoutConsistentWithState( + t.startState.layoutState, + t.level.layout, + ) + ? Object.assign( + Object.assign({}, tl(t.startState, t.level.boss)), + { + checkpoint: Object.assign( + Object.assign({}, t.startState.checkpoint), + { state: tl(t.startState, t.level.boss) }, + ), + bossState: + (!(null === (n = t.level.boss) || void 0 === n + ? void 0 + : n.mutatesState) && + t.startState.bossState) || + (null === (s = t.level.boss) || void 0 === s + ? void 0 + : s.initState({ + assets: u, + checkpointState: t.startState, + playSound: p.playSound, + pauseSound: p.pauseSound, + })) || + null, + }, + ) + : Zr( + t.level.layout, + t.level.boss, + u, + null, + p.playSound, + p.pauseSound, + )), + t.online || + e.audio(t.level.song.fileName).play({ + fromPosition: + (1 / 60) * d.frame + + t.level.songStartSecs + + h.headphonesDelay, + overwrite: true, + })); + const g = _r(t.level), + m = Ca.getInitFirstIndexes(), + f = Ca.getEmptyLayout(t.level.layout.properties), + y = xa.getInitState(f), + E = xa.getEmptyStateIndexes(); + return ( + Ca.setInViewLayoutAndState( + t.level.layout, + d.frame, + g.jumpFrames, + d.playerX, + d.playerY, + d.layoutState, + d.switchButtons.rot, + d.jumpSwitch.ratio, + d.switchBlockSpikes, + m, + f, + y, + E, + d.fallTypes, + ), + null === (o = t.didStart) || + void 0 === o || + o.call(t, d.checkpoint.index, false), + { + worker: Np(), + mutValues: { + levelState: d, + blockJumpUntilReleased: false, + landTimer: 0, + layoutFirstIndexes: m, + resetTimer: null, + checkpoints: [] + }, + bigMutValues: { + inViewLayout: f, + inViewLayoutState: y, + fullLayoutStateIndexes: E, + }, + paused: false, + pausedMusicDelay: 0, + playerInputIsDown: false, + hasStarted: !t.online, + tutorial: Qp( + (null === (r = t.world) || void 0 === r + ? void 0 + : r.tutorialType) || null, + (null === (l = t.world) || void 0 === l + ? void 0 + : l.showBoostersPrompt) || false, + ), + isAfkTimer: 600, + booster: null, + levelSpeeds: g, + df: 1, + powerupOut: null, + didAlertStorageError: false, + isFlyingLevel: + "flying" === + (null === (c = d.bossState) || void 0 === c + ? void 0 + : c.type), + sfx: p, + onReachedCheckpoint: (n, s, o) => { + var r; + const l = a(); + (null !== l.booster && + l.booster.frameStarted < + l.mutValues.levelState.frame - 180 && + !n && + (e + .audio(t.level.song.fileName) + .play({ overwrite: true, playbackRate: 1 }), + (l.booster = null), + (l.df = 1), + (l.mutValues.levelState.frame = Math.round( + l.mutValues.levelState.frame, + ))), + e.timer.start(() => { + Tf(t, l, e, i(Se).online, false, n, o); + }, 500), + mf(n), + null === (r = t.onReachedCheckpoint) || + void 0 === r || + r.call(t, n, l.mutValues.levelState.attempt, s)); + }, + onCrash: (n) => { + var s; + t.editor || e.audio(t.level.song.fileName).pause(); + const o = a(); + (e.timer.start(() => { + Tf(t, o, e, i(Se).online, true, false); + }, 500), + null === (s = t.didCrash) || + void 0 === s || + s.call( + t, + o.mutValues.levelState.frame, + n, + o.isAfkTimer <= 0, + ), + gf(), + null !== o.tutorial.boosterPrompt && + (o.tutorial.boosterPrompt = ((e, t, a) => + "waitingToShow" !== e + ? e + : t > 2e3 && a > 10 + ? "show" + : e)( + o.tutorial.boosterPrompt, + o.mutValues.levelState.frame, + o.mutValues.levelState.attempt, + ))); + }, + onReset: (n) => { + var s; + const o = a(); + (e.audio(t.level.song.fileName).play({ + fromPosition: + (1 / 60) * n + + t.level.songStartSecs + + i(Se).settings.headphonesDelay, + overwrite: true, + playbackRate: o.df, + }), + "autopilot" === + (null === (s = o.booster) || void 0 === s + ? void 0 + : s.booster.type) && + (o.booster.booster.playerInput = "up")); + }, + onOpenBooster: () => { + const e = a(); + null !== e.tutorial.boosterPrompt && + (e.tutorial.boosterPrompt = null); + }, + pressedBooster: (i) => { + const n = a(); + ((n.df = + "slowmo" === i.type && null === n.booster ? 0.5 : 1), + n.mutValues.levelState.crashed || + e + .audio(t.level.song.fileName) + .play({ overwrite: true, playbackRate: n.df }), + null === n.booster + ? (n.booster = { + booster: i, + frameStarted: n.mutValues.levelState.frame, }) - : null, - ]; - }, - }), - ny = makeCustomSprite({ - render: ({ - props: { - sprites: e, - width: t, - height: a, - radius: i, - bottomColour: n, - strokeColour: s, - strokeThickness: o, - onPress: r, + : (n.booster = null), + (n.mutValues.levelState.frame = Math.round( + n.mutValues.levelState.frame, + )), + (n.paused = false)); }, - device: l, - }) => [ - Clickable({ - id: "Clickable", - width: t, - height: a, - onPress: () => { - (l.audio("audio/global/button.wav").play(0), r()); - }, - sprites: (r) => [ - So({ - id: "RaiseRects", - width: t, - height: a, - raiseHeight: 5, - rad: i, - isPressed: r, - topColour: r ? ke : Re, - bottomColour: n, - stroke: { thickness: o, colour: s }, - shadowDir: "down", - sprites: e, - }), - ], + } + ); + }, + loop({ + props: props, + state: t, + device: a, + getInputs: i, + getContext: n, + }) { + var s, o, r, l, c, d, u, h, p, g, m; + const f = i(), + { settings: y } = n(Se); + if ( + (null === + (o = + null === (s = props.online) || void 0 === s + ? void 0 + : s.loop) || + void 0 === o || + o.call(s, t.mutValues.levelState), + !t.hasStarted) + ) { + if ( + !(null === (r = props.online) || void 0 === r + ? void 0 + : r.start) + ) + return; + ((t.hasStarted = true), + a.audio(props.level.song.fileName).play({ + fromPosition: props.level.songStartSecs + y.headphonesDelay, + overwrite: true, + })); + } + if (props.paused) + return void a.audio(props.level.song.fileName).pause(); + if (t.paused && !props.online) return; + const { level: E, editor: b, mockPlayerInput: S } = props, + { levelSpeeds: I, df: _ } = t, + { speed: v } = I; + (null !== t.tutorial.textState && + (t.tutorial.textState = ((e, t, a) => { + if (null === e || a) return e; + const i = Math.max(e.timer - 1, 0); + if ("init" === e.type) { + if ("tapToJump" === e.view && t > 200) + return Object.assign(Object.assign({}, e), { + view: "holdDown", + }); + if ("holdDown" === e.view && t > 370) + return Object.assign(Object.assign({}, e), { + view: "goodLuck", + timer: Kp, + }); + if ("goodLuck" === e.view && 0 === i) + return Object.assign(Object.assign({}, e), { + view: "end", + timer: Kp, + }); + } + if ("skateboard" === e.type) { + if ("crouch" === e.view && t > 80) + return Object.assign(Object.assign({}, e), { + view: "jump", + }); + if ("jump" === e.view && t > 180) + return Object.assign(Object.assign({}, e), { + view: "backflip", + timer: Kp, + }); + if ("backflip" === e.view && 0 === i) + return Object.assign(Object.assign({}, e), { + view: "end", + timer: Kp, + }); + } + return "end" === e.view && 0 === i + ? null + : Object.assign(Object.assign({}, e), { timer: i }); + })( + t.tutorial.textState, + t.mutValues.levelState.frame, + t.mutValues.levelState.crashed, + )), + t.isAfkTimer--); + const { + playerY: playerY, + playerGradY: R, + playerDir: O, + finishedLevel: finishedLevel, + bossState: w, + frame: A, + flyingAnchor, + } = t.mutValues.levelState; + if ( + b && + !t.mutValues.levelState.crashed && + !t.mutValues.levelState.finishedLevel + ) { + t.mutValues.levelState.frameCountSinceHistoryPush++; + const newFrameCountSinceHistoryPush = + 37.5 / Math.max(v, Math.abs(R)); + if ( + t.mutValues.levelState.frameCountSinceHistoryPush >= + newFrameCountSinceHistoryPush + ) { + t.mutValues.levelState.frameCountSinceHistoryPush = 0; + const e = tl( + t.mutValues.levelState, + props.level.boss || null, + ); + b.pushRunHistory(e); + } + } + (t.isFlyingLevel || + (t.mutValues.levelState.cameraY = hm( + playerY, + t.mutValues.levelState.cameraY, + finishedLevel, + flyingAnchor, + t.bigMutValues.inViewLayout.properties.useGround, + )), + (t.mutValues.levelState.cameraXOffset = pm( + t.mutValues.levelState.cameraXOffset, + O, + finishedLevel, + ))); + const isClassic = isSpecialTheme( + t.bigMutValues.inViewLayout.properties.theme.id, + ), + k = + be.pointInBox2( + (-a.size.fullWidth / 2 + (isClassic ? 35 : 50)) * + (n(Se).settings.mirrorMenuButton || + void 0 === props.backToMenu + ? -1 + : 1), + a.size.fullHeight / 2 - (isClassic ? 25 : 50), + 50, + isClassic ? 28 : 50, + f.pointer.x, + f.pointer.y, + ) || + (xm(t.tutorial.boosterPrompt, y.hideUi, props.world) && + be.pointInBox2( + (a.size.fullWidth / 2 - 80) * + (n(Se).settings.mirrorMenuButton ? -1 : 1), + a.size.fullHeight / 2 - 50, + Pm, + Mm, + f.pointer.x, + f.pointer.y, + )) || + (be.pointInBox2( + Mm / -2, + a.size.fullHeight / -2 + 40, + Pm, + Mm, + f.pointer.x, + f.pointer.y, + )) || (be.pointInBox2( + Pm / 2, + a.size.fullHeight / -2 + 40, + Mm, + Mm, + f.pointer.x, + f.pointer.y, + )), + N = Pl(w, A), + x = + ((f.pointer.pressed && !k) || + f.keysDown[" "] || + f.keysDown["w"] || + f.keysDown.ArrowUp || + "down" === S || + "justDown" === S) && + !finishedLevel && + !N, + P = x + ? f.pointer.justPressed || + f.keysJustPressed[" "] || + f.keysJustPressed["w"] || + f.keysJustPressed.ArrowUp || + "justDown" === S + ? "justDown" + : "down" + : "up"; + (x !== t.playerInputIsDown && + (null === (l = props.online) || + void 0 === l || + l.onInputChange(x), + (t.playerInputIsDown = x), + (t.isAfkTimer = 600)), + pf( + t.mutValues.levelState.frame, + "down" === P || "justDown" === P, + )); + let M = null; + if ( + "autopilot" === + (null === (c = t.booster) || void 0 === c + ? void 0 + : c.booster.type) + ) { + M = t.booster.booster.playerInput; + const e = getAutopilotInputs( + t.mutValues.levelState.frame, + E.name, + _, + ); + (null !== e + ? (M = e ? "justDown" : "up") + : "justDown" === M && (M = "down"), + (t.booster.booster.playerInput = M)); + } + let oldPowerupsLength = + t.mutValues.levelState.playerPowerups.filter( + (e) => e.item !== "playerStack", + ).length, + firstPowerup = t.mutValues.levelState.playerPowerups.filter( + (e) => e.item !== "playerStack", + )[0]; + if ( + ((null === (d = props.online) || void 0 === d + ? void 0 + : d.eliminated) && + !t.mutValues.levelState.crashed && + (t.mutValues.levelState.crashed = true), + dl({ + useBoosterDebug: y.showDebug, + mutValues: t.mutValues, + bigMutValues: t.bigMutValues, + booster: t.booster && t.booster.booster, + playerInput: M || P, + level: E, + levelSpeeds: I, + df: _, + animationAssets: n(Ws).animationAssets, + waitAtCheckpoint: + "royaleCheckpointKnockout" === + (null === + (h = + null === (u = props.online) || void 0 === u + ? void 0 + : u.mode) || void 0 === h + ? void 0 + : h.type) && + true === props.online.checkpointPlayerReached, + bottomLineTheme: E.layout.properties.theme.objects.bottom, + shouldResetOnCrash: + !b && + void 0 === S && + !(null === (p = props.online) || void 0 === p + ? void 0 + : p.eliminated), + sfx: t.sfx, + onReachedCheckpoint: t.onReachedCheckpoint, + onCrash: t.onCrash, + onReset: t.onReset, + disableReleaseBuffer: y.disableReleaseBuffer, }), - ], - }), - sy = makeCustomSprite({ - init: ({ device: e, updateState: t }) => ( - Promise.all([ - Jp.getAccount(e.storage, null, e.alert), - Jp.getLocal(e.storage), - ]).then( - ([ - { - data: { levelsProgress: e, lastOpenedWorld: a }, - }, - i, - ]) => { - t((t) => - Object.assign(Object.assign({}, t), { - isLoading: false, - levelsProgress: e, - world: a, - hasVisitedSuperLevelPack: i.data.hasVisitedSuperLevelPack, - }), - ); - }, + oldPowerupsLength - + t.mutValues.levelState.playerPowerups.filter( + (e) => e.item !== "playerStack", + ).length > + 0 + ? t.powerupOut + ? ((t.powerupOut.powerup = firstPowerup), + (t.powerupOut.timer = 60)) + : (t.powerupOut = { + powerup: firstPowerup, + timer: 60, + }) + : t.powerupOut && + (t.powerupOut.timer > 0 + ? t.powerupOut.timer-- + : (t.powerupOut = null)), + null === (g = props.online) || + void 0 === g || + g.onPlayerMove( + t.mutValues.levelState.playerX, + t.mutValues.levelState.playerY, ), + null === (m = props.online) || void 0 === m + ? void 0 + : m.serverPlayerPos) + ) { + const a = props.online.serverPlayerPos; + (props.online.didResync(), + Ca.setInViewLayoutAndState( + E.layout, + a.mutValues.levelState.frame, + I.jumpFrames, + a.mutValues.levelState.playerX, + a.mutValues.levelState.playerY, + a.mutValues.levelState.layoutState, + a.mutValues.levelState.switchButtons.rot, + a.mutValues.levelState.jumpSwitch.ratio, + a.mutValues.levelState.switchBlockSpikes, + a.mutValues.layoutFirstIndexes, + t.bigMutValues.inViewLayout, + t.bigMutValues.inViewLayoutState, + t.bigMutValues.fullLayoutStateIndexes, + a.mutValues.levelState.fallTypes, + ), + (t.mutValues = a.mutValues), + (t.playerInputIsDown = + "down" === a.playerInput || "justDown" === a.playerInput)); + } + }, + render({ props: e, state: t, device: a, getContext: i }) { + var n, s, o, r; + return [ + cm.Single( { - isLoading: true, - levelsProgress: [], - world: 1, - hasVisitedSuperLevelPack: false, - } + frame: t.mutValues.levelState.frame, + df: t.df, + attempt: t.mutValues.levelState.attempt, + playerX: t.mutValues.levelState.playerX, + playerY: t.mutValues.levelState.playerY, + playerGradY: t.mutValues.levelState.playerGradY, + playerRot: t.mutValues.levelState.playerRot, + playerDir: t.mutValues.levelState.playerDir, + playerScaleX: t.mutValues.levelState.playerScaleX, + playerScaleY: t.mutValues.levelState.playerScaleY, + playerScale: t.mutValues.levelState.playerScale, + playerPowerups: t.mutValues.levelState.playerPowerups, + isCompatible: t.mutValues.levelState.isCompatible, + playerPowerupOut: + (null === (n = t.powerupOut) || void 0 === n + ? void 0 + : n.powerup) || null, + playerJetpackFuel: t.mutValues.levelState.playerJetpackFuel, + playerUsingPowerup: + t.mutValues.levelState.playerUsingPowerup, + playerStacks: t.mutValues.levelState.playerStacks, + playerStackIndex: t.mutValues.levelState.playerStackIndex, + playerBullets: t.mutValues.levelState.playerBullets, + playerSkin: e.playerSkin, + playerJumping: t.mutValues.levelState.jumping, + playerSpeedMultiplier: + t.mutValues.levelState.playerSpeedMultiplier, + explosions: t.mutValues.levelState.explosions, + collectibles: t.mutValues.levelState.collectibles, + score: t.mutValues.levelState.score, + highScore: + (null === (s = e.world) || void 0 === s + ? void 0 + : s.highScore) || 0, + collectiblesTotal: e.level.layout.collectibles.filter( + (x) => x.form == "coin", + ).length, + touchingPortals: t.mutValues.levelState.touchingPortals, + justHitObject: t.mutValues.levelState.justHitObject, + bossState: t.mutValues.levelState.bossState, + switchRotation: t.mutValues.levelState.switchButtons.rot, + switchBlockSpikes: t.mutValues.levelState.switchBlockSpikes, + layout: t.bigMutValues.inViewLayout, + crashed: t.mutValues.levelState.crashed, + paused: t.paused || t.mutValues.levelState.finishedLevel, + finishedLevel: t.mutValues.levelState.finishedLevel, + isFlyingLevel: t.isFlyingLevel, + started: + false !== + (null === (o = e.online) || void 0 === o + ? void 0 + : o.start), + bottomLineObjects: + (null === (r = t.mutValues.levelState.bottomLine) || + void 0 === r + ? void 0 + : r.objects) || null, + layoutState: t.bigMutValues.inViewLayoutState, + layoutStateIndex: t.bigMutValues.fullLayoutStateIndexes, + landTimer: t.mutValues.landTimer, + jumpFrames: t.levelSpeeds.jumpFrames, + hasCheckpoints: e.hasCheckpoints, + maxFrame: e.maxFrame, + cameraX: 0, + cameraY: 0, + showAttempts: void 0 === e.editor, + playerName: "YOU", + tutorial: t.tutorial, + hidePlayer: Ll( + t.mutValues.levelState.bossState, + t.mutValues.levelState.frame, + t.mutValues.levelState.crashed, + ), + fadeOutAttempts: Ml(t.mutValues.levelState.bossState), + bgColor: t.mutValues.levelState.bgColor, + flash: t.flash, + gravity: t.gravity, + dashing: t.dashing, + isGravity: t.isGravity, + fallTypes: t.mutValues.levelState.fallTypes, + flyingAnchor: t.mutValues.levelState.flyingAnchor, + justDownInputTimer: + t.mutValues.levelState.justDownInputTimer, + jumping: t.mutValues.levelState.jumping, + levelSpeeds: t.levelSpeeds, + checkpoints: t.mutValues.checkpoints + }, + + (a) => { + var i, n, s, o, r; + ( + (a.checkpoints = t.mutValues.checkpoints), + (a.justDownInputTimer = + t.mutValues.levelState.justDownInputTimer), + (a.levelSpeeds = t.levelSpeeds), + (a.boosterDebug = t.mutValues.levelState.boosterDebug), + (a.jumping = t.mutValues.levelState.jumping), + (a.isGravity = t.mutValues.levelState.isGravity), + (a.flyingAnchor = t.mutValues.levelState.flyingAnchor), + (a.dashing = t.mutValues.levelState.dashing), + (a.frame = t.mutValues.levelState.frame), + (a.fallTypes = t.mutValues.levelState.fallTypes), + (a.df = t.df), + (a.attempt = t.mutValues.levelState.attempt), + (a.playerX = t.mutValues.levelState.playerX), + (a.playerY = t.mutValues.levelState.playerY), + (a.playerGradY = t.mutValues.levelState.playerGradY), + (a.playerRot = t.mutValues.levelState.playerRot), + (a.playerDir = t.mutValues.levelState.playerDir), + (a.playerScaleX = t.mutValues.levelState.playerScaleX), + (a.playerScaleY = t.mutValues.levelState.playerScaleY), + (a.playerScale = t.mutValues.levelState.playerScale), + (a.playerPowerups = + t.mutValues.levelState.playerPowerups), + (a.isCompatible = t.mutValues.levelState.isCompatible), + (a.playerPowerupOut = + (null === (i = t.powerupOut) || void 0 === i + ? void 0 + : i.powerup) || null), + (a.playerJetpackFuel = + t.mutValues.levelState.playerJetpackFuel), + (a.playerUsingPowerup = + t.mutValues.levelState.playerUsingPowerup), + (a.playerStacks = t.mutValues.levelState.playerStacks), + (a.playerStackIndex = + t.mutValues.levelState.playerStackIndex), + (a.playerBullets = t.mutValues.levelState.playerBullets), + (a.playerSkin = e.playerSkin), + (a.playerJumping = t.mutValues.levelState.jumping), + (a.playerSpeedMultiplier = + t.mutValues.levelState.playerSpeedMultiplier), + (a.explosions = t.mutValues.levelState.explosions), + (a.collectibles = t.mutValues.levelState.collectibles), + (a.score = t.mutValues.levelState.score), + (a.highScore = + (null === (n = e.world) || void 0 === n + ? void 0 + : n.highScore) || 0), + (a.collectiblesTotal = e.level.layout.collectibles.filter( + (x) => x.form == "coin", + ).length), + (a.touchingPortals = + t.mutValues.levelState.touchingPortals), + (a.justHitObject = t.mutValues.levelState.justHitObject), + (a.bossState = t.mutValues.levelState.bossState), + (a.switchRotation = + t.mutValues.levelState.switchButtons.rot), + (a.switchBlockSpikes = + t.mutValues.levelState.switchBlockSpikes), + (a.layout = t.bigMutValues.inViewLayout), + (a.crashed = t.mutValues.levelState.crashed), + (a.paused = + t.paused || t.mutValues.levelState.finishedLevel), + (a.finishedLevel = t.mutValues.levelState.finishedLevel), + (a.isFlyingLevel = t.isFlyingLevel), + (a.started = + false !== + (null === (s = e.online) || void 0 === s + ? void 0 + : s.start)), + (a.bottomLineObjects = + (null === (o = t.mutValues.levelState.bottomLine) || + void 0 === o + ? void 0 + : o.objects) || null), + (a.layoutState = t.bigMutValues.inViewLayoutState), + (a.layoutStateIndex = + t.bigMutValues.fullLayoutStateIndexes), + (a.landTimer = t.mutValues.landTimer), + (a.jumpFrames = t.levelSpeeds.jumpFrames), + (a.otherPlayersInfo = + null === (r = e.online) || void 0 === r + ? void 0 + : r.getOtherPlayersInfo( + t.mutValues.levelState.playerX, + t.mutValues.levelState.playerY, + )), + (a.hasCheckpoints = e.hasCheckpoints), + (a.maxFrame = e.maxFrame)); + const l = gm( + t.mutValues.levelState.playerX, + t.mutValues.levelState.cameraXOffset, + ); + ((a.cameraX = l), + (a.cameraY = t.mutValues.levelState.cameraY), + (a.bgColor = t.mutValues.levelState.bgColor || "#00FFFF"), + (a.flash = t.mutValues.levelState.flash || 0), + (a.gravity = t.mutValues.levelState.gravity || 0), + (a.showAttempts = void 0 === e.editor), + (a.tutorial = t.tutorial), + (a.hidePlayer = Ll( + t.mutValues.levelState.bossState, + t.mutValues.levelState.frame, + t.mutValues.levelState.crashed, + )), + (a.fadeOutAttempts = Ml( + t.mutValues.levelState.bossState, + ))); + }, ), - loop({ getInputs: e, state: t }) { - const a = e(); - return t.world > 1 && a.keysJustPressed.ArrowLeft - ? Object.assign(Object.assign({}, t), { world: t.world - 1 }) - : t.world < 4 && a.keysJustPressed.ArrowRight - ? Object.assign(Object.assign({}, t), { world: t.world + 1 }) - : t; - }, - render({ props: e, state: t, device: a, updateState: i }) { - const o = a.size.width + 2 * a.size.widthMargin, - l = a.size.height + 2 * a.size.heightMargin; - if (t.isLoading) + onChange( + () => { + var e; + return null === (e = t.booster) || void 0 === e + ? void 0 + : e.booster.type; + }, + () => { + if (!t.booster) return []; + const e = { + fileName: `images/achievement/rewards/${t.booster.booster.type}.png`, + width: 72, + height: 49, + }; return [ - n({ - text: `${localize("LOADING")}...`, - color: ve, - font: { size: 15 }, - }), + y( + { + fileName: e.fileName, + width: e.width, + height: e.height, + x: a.size.fullWidth / 2 - 130 - Pm / 2, + y: a.size.fullHeight / 2 - 50, + }, + (e) => { + ((e.x = a.size.fullWidth / 2 - 130 - Pm / 2), + (e.y = a.size.fullHeight / 2 - 50)); + }, + ), ]; - const c = e.view; - if ("inWorld" === c.type) { - const a = c.world, - i = t.levelsProgress.filter((e) => e.world === a); - return 0 === a - ? [ - ey({ - id: "BonusLevelsMenu", - playLevel: e.playLevel, - worldProgress: i, - onBack: () => { - e.updateView({ type: "worldsList" }); - }, - fadeInMusic: e.fadeInMusic, - fadeOutMusic: e.fadeOutMusic, - }), - ] - : [ - Jf({ - id: `WorldMap-${a}`, - world: a, - worldProgress: i, - playLevel: e.playLevel, - onBack: () => { - e.updateView({ type: "worldsList" }); - }, - fadeInMusic: e.fadeInMusic, - fadeOutMusic: e.fadeOutMusic, - showStartArrows: e.showStartArrows, - }), - ]; - } - const d = Hl.getWorlds(), - u = d.filter((e, a) => { - if (0 === a) return true; - const i = a, - n = d[a - 1].length; - return t.levelsProgress.some( - (e) => - e.world === i && - e.levelIndex === n - 1 && - (e.checkpoints.didFinish || e.noCheckpoints.didFinish), - ); - }), - h = t.world; - return [ - Fo({ - id: "BackButton", - text: localize("BACK"), - width: 80, - height: 40, - onPress: e.backToMainMenu, - x: -o / 2 + 60, - y: -l / 2 + 40, - }), - oy({ - id: "WorldButton", - world: h, - disabled: h == 5, //h > u.length, - onPress: () => { - (e.updateView({ type: "inWorld", world: h }), - Jp.saveAccount(a.storage, null, a.alert, a.now, { - lastOpenedWorld: h, - })); - }, - y: 20, - }), - n({ - text: `${localize("WORLD")} ${h}`, - color: ve, - strokeColor: Ye, - strokeThickness: 10, - font: { size: 35, align: "left" }, - x: -320, - y: 120, - }), - e.showStartArrows && 1 === h - ? zf({ id: "LevelsHelp", y: 150 }) - : null, - h < 5 - ? ny({ - id: "ArrowRightButton", - width: 80, - height: 90, - radius: 10, - bottomColour: ve, - strokeColour: Ye, - strokeThickness: 6, - sprites: (e) => [ - r({ - color: Ye, - thickness: 5, - fillColor: ve, - path: [ - [-21, 0], - [5, -25], - [14, -18], - [-3, 0], - [14, 18], - [5, 25], - [-21, 0], - [5, -25], - ], - scaleX: -1, - y: e, - }), - ], - onPress: () => { - i((e) => - Object.assign(Object.assign({}, e), { world: h + 1 }), - ); - }, - x: 230, - y: 20, - }) - : null, - h > 1 - ? ny({ - id: "ArrowLeftButton", - width: 80, - height: 90, - radius: 10, - bottomColour: ve, - strokeColour: Ye, - strokeThickness: 5, - sprites: (e) => [ - r({ - color: Ye, - thickness: 5, - fillColor: ve, - path: [ - [-21, 0], - [5, -25], - [14, -18], - [-3, 0], - [14, 18], - [5, 25], - [-21, 0], - [5, -25], - ], - y: e, - }), - ], - onPress: () => { - i((e) => - Object.assign(Object.assign({}, e), { world: h - 1 }), + }, + ), + ifConditional( + () => void 0 !== e.backToMenu && !e.online, + () => [ + gameplayOverlay.Single( + { + backToMenu: () => e.backToMenu(false), + paused: t.paused, + attempt: t.mutValues.levelState.attempt, + frame: t.mutValues.levelState.frame, + maxFrame: e.maxFrame, + theme: t.bigMutValues.inViewLayout.properties.theme.id, + fadeOutAttempts: + Ml(t.mutValues.levelState.bossState) || + i(Se).settings.fadeOutAttempts, + addCheckpoint: () => { + if (!t.mutValues.levelState.crashed) { + t.mutValues.checkpoints.push({ + state: tl(t.mutValues.levelState, e.level.boss) + }) + } + }, + removeCheckpoint: () => { + if (t.mutValues.checkpoints.length > 1) { + t.mutValues.checkpoints.pop() + } + }, + onResume: () => { + if ( + ((t.paused = false), + (t.sfx = Rf(a, i(Se).settings, e.level, () => t)), + !e.online && !t.mutValues.levelState.crashed) + ) { + const n = + i(Se).settings.headphonesDelay - + t.pausedMusicDelay; + 0 !== n + ? a.audio(e.level.song.fileName).play({ + overwrite: true, + playbackRate: t.df, + fromPosition: + a + .audio(e.level.song.fileName) + .getPosition() + n, + }) + : a.audio(e.level.song.fileName).play({ + overwrite: true, + playbackRate: t.df, + fromPosition: + (1 / 60) * t.mutValues.levelState.frame + + e.level.songStartSecs + + i(Se).settings.headphonesDelay, + }); + } + }, + onPause: () => { + (e.online || + ((t.pausedMusicDelay = + i(Se).settings.headphonesDelay), + a.audio(e.level.song.fileName).pause()), + (t.paused = true)); + }, + onReset: () => { + var n, s; + const { animationAssets: o } = i(Ws), + r = Zr( + e.level.layout, + e.level.boss, + o || null, + null, + t.sfx.playSound, + t.sfx.pauseSound, ); - }, - x: -230, - y: 20, - }) - : null, - n({ - text: `WARNING! Unfinished!`, - color: "white", - strokeColor: "red", - strokeThickness: 10, - font: { size: 24 }, - x: 0, - y: 160, - }), - s({ - color: 1 === h ? ve : Xe, - radius: 1 === h ? 8 : 5, - x: -80, - y: -150, - }), - s({ - color: 2 === h ? ve : Xe, - radius: 2 === h ? 8 : 5, - x: -40, - y: -150, - }), - s({ - color: 3 === h ? ve : Xe, - radius: 3 === h ? 8 : 5, - x: 0, - y: -150, - }), - s({ - color: 4 === h ? ve : Xe, - radius: 4 === h ? 8 : 5, - x: 40, - y: -150, - }), - s({ - color: 5 === h ? ve : Xe, - radius: 5 === h ? 8 : 5, - x: 80, - y: -150, - }), - Fo({ - id: "BonusButton", - width: 200, - height: 40, - text: "BONUS LEVELS", - onPress: () => { - (i((e) => - Object.assign(Object.assign({}, e), { - hasVisitedSuperLevelPack: true, - }), - ), - e.updateView({ - type: "inWorld", - world: 0, - backToWorld: h, - })); + a.audio(e.level.song.fileName).play({ + fromPosition: + e.level.songStartSecs + + i(Se).settings.headphonesDelay, + overwrite: true, + }); + const l = _r(e.level); + (Ca.setInViewLayoutAndState( + e.level.layout, + r.frame, + l.jumpFrames, + r.playerX, + r.playerY, + r.layoutState, + r.switchButtons.rot, + r.jumpSwitch.ratio, + r.switchBlockSpikes, + t.mutValues.layoutFirstIndexes, + t.bigMutValues.inViewLayout, + t.bigMutValues.inViewLayoutState, + t.bigMutValues.fullLayoutStateIndexes, + r.fallTypes, + ), + null === (n = e.didStart) || + void 0 === n || + n.call(e, 0, false), + (t.mutValues.levelState = r), + (t.mutValues.blockJumpUntilReleased = false), + (t.paused = false), + (t.mutValues.landTimer = 0), + (t.mutValues.checkpoints.length = 0), + (t.playerInputIsDown = false), + (t.hasStarted = true), + (t.mutValues.resetTimer = null), + (t.tutorial = Qp( + null, + (null === (s = e.world) || void 0 === s + ? void 0 + : s.showBoostersPrompt) || false, + )), + (t.isAfkTimer = 600), + (t.booster = null), + (t.levelSpeeds = l), + (t.df = 1), + (t.powerupOut = null), + e.world && + Jp.saveLevelProgress( + t.worker, + a.storage, + a.now, + e.level.name, + e.world.levelIndex, + e.world.number, + e.world.withCheckpoints, + false, + 1, + a.alert, + r.attempt, + null, + )); + }, }, - x: o / 2 - 125, - y: -l / 2 + 40, - }), - ...(t.hasVisitedSuperLevelPack - ? [] - : [ - // const o = a.size.width + 2 * a.size.widthMargin, - // l = a.size.height + 2 * a.size.heightMargin; - // - s({ - color: Ve, - radius: 12, - x: o / 2 - 125 + 100, - y: -l / 2 + 40 + 20, - opacity: 0.9, - }), - s({ - color: ve, - radius: 2, - x: o / 2 - 125 + 100, - y: -l / 2 + 40 + 20, - }), - ]), - ]; - }, - }), - oy = makeCustomSprite({ - render: ({ - props: { world: e, disabled: t, onPress: a }, - device: i, - }) => [ - Clickable({ - id: "Clickable", - width: 250, - height: 250, - disabled: t, - onPress: () => { - (i.audio("audio/global/button.wav").play(0), a()); - }, - sprites: (a) => { - return [ - We({ - width: 250, - height: 250, - rad: 40, - rotation: 45, - color: t ? ze : Ye, - }), - We({ - width: 230, - height: 230, - rad: 35, - rotation: 45, - color: ve, - }), - We({ - width: 210, - height: 210, - rad: 35, - rotation: 45, - color: t ? Xe : Re, - y: 14 - (a ? 10 : 0), - }), - l( - t - ? { - fileName: "images/mainMenu/lockIcon.png", - width: 40, - height: 40, - y: 14, - } - : { - fileName: `images/mainMenu/worldSelect/${e}.png`, - width: 220, - height: 220, - y: 14 - (a ? 10 : 0), - mask: - ((i = { - path: [ - [-110, 20], - [-110, -20], - [-20, -110], - [20, -110], - [110, -20], - [110, 20], - [20, 110], - [-20, 110], - [-110, 20], - ], - }), - { - type: "lineMask", - path: i.path, - x: i.x || 0, - y: i.y || 0, - }), - }, - ), - ]; - var i; - }, - }), - ], - }), - ry = (e) => e().toString(36).substr(2, 9); - let ly = null; - const cy = { - truncate: function (e, t = 10) { - return e.length > t ? `${e.slice(0, t)}...` : e; - }, - measureTexts: function (texts, font) { - if (null === ly) { - const e = document.createElement("canvas"); - ly = e.getContext("2d"); - } - const a = ly, - { - size: i, - weight: n = "normal", - style: s = "normal", - family: o, - } = font, - r = `${s} ${n} ${i ? `${i}px` : ""} ${o ? `${o}` : ""}`; - return ( - (a.font = r), - (a.textBaseline = font.baseline || "middle"), - (a.textAlign = font.align || "center"), - texts.map((e) => a.measureText(e).width) - ); - }, - splitTextIntoLines: function (e, t, a) { - const i = e.split(" "), - n = cy.measureTexts(i, t), - s = []; - let o = 0, - r = 0; - return ( - i.forEach((e, t) => { - const i = n[t]; - return s[o] - ? r + i > a - ? (o++, (s[o] = e), void (r = i)) - : ((s[o] += ` ${e}`), void (r += i)) - : ((s[o] = e), void (r = i)); - }), - s - ); - }, - }, - dy = makeCustomSprite({ - init: ({ - props: e, - preloadFiles: t, - updateState: a, - device: i, - }) => ( - t({ audioFileNames: [e.song.fileName] }).then(() => { - (a((t) => - Object.assign(Object.assign({}, t), { - songLoaded: e.song.fileName, - songDuration: i.audio(e.song.fileName).getDuration(), + (a) => { + const { settings: n } = i(Se); + (xm(t.tutorial.boosterPrompt, n.hideUi, e.world) + ? a.boosters + ? ((a.boosters.booster = + t.booster && t.booster.booster), + (a.boosters.showPrompt = + "show" === t.tutorial.boosterPrompt), + (a.boosters.onOpen = t.onOpenBooster), + (a.boosters.pressedBooster = t.pressedBooster)) + : (a.boosters = { + booster: t.booster && t.booster.booster, + showPrompt: "show" === t.tutorial.boosterPrompt, + onOpen: t.onOpenBooster, + pressedBooster: t.pressedBooster, + disableMissiles: canUseMissiles(e.level), + }) + : (a.boosters = void 0), + (a.paused = t.paused), + (a.hideUi = n.hideUi), + (a.isPractice = t.mutValues.checkpoints.length > 0), + (console.log(t.mutValues.checkpoints.length)), + (a.attempt = t.mutValues.levelState.attempt), + a.crashed || (a.frame = t.mutValues.levelState.frame), + (a.theme = + t.bigMutValues.inViewLayout.properties.theme.id), + (a.background = t.mutValues.levelState.bgColor), + (a.fadeOutAttempts = + Ml(t.mutValues.levelState.bossState) || + i(Se).settings.fadeOutAttempts)); + }, + ), + ], + ), + ifConditional( + () => t.mutValues.levelState.finishedLevel && !e.online, + () => { + var a, i; + return [ + ff.Single({ + attempts: t.mutValues.levelState.attempt, + score: t.mutValues.levelState.score.total, + collectibles: t.mutValues.levelState.collectibles, + prevHighScore: + (null === (a = e.world) || void 0 === a + ? void 0 + : a.highScore) || 0, + prevBestAttempts: ( + null === (i = e.world) || void 0 === i + ? void 0 + : i.withCheckpoints + ) + ? e.world.prevBestAttempts + : void 0, + onContinue: () => { + var t; + e.editor + ? e.editor.backToEditor() + : null === (t = e.backToMenu) || + void 0 === t || + t.call(e, true); + }, + world: e.world, + checkpoints: t.mutValues.checkpoints }), - ), - i - .audio(e.song.fileName) - .play({ fromPosition: 0, overwrite: true })); - }), - { songLoaded: null, songDuration: 0 } + ]; + }, ), - loop({ getInputs: e, state: t, props: a, device: i }) { - if (!a.waveformData || !t.songLoaded) return t; - const { - pointer: { x: n, y: s, pressed: o, justReleased: r }, - } = e(); - if (Math.abs(s) < 100) { - if (o) { - const e = (function (e) { - return B.clamp2(0, 1, (e + 350) / 700); - })(n), - i = e * t.songDuration; - i !== a.songStartSec && a.setSongStartMs(i); + ]; + }, + cleanup({ state: e }) { + Mp(e.worker); + }, + }), + Tf = (e, t, a, i, n, s, o) => { + return ( + (r = void 0), + (l = void 0), + (d = function* () { + if (e.world && t.mutValues.checkpoints.length === 0) { + const r = n ? 1 : 0, + l = yield Jp.saveLevelProgress( + t.worker, + a.storage, + a.now, + e.level.name, + e.world.levelIndex, + e.world.number, + e.world.withCheckpoints, + s, + Math.floor(t.mutValues.levelState.frame), + { + ok: () => { + t.didAlertStorageError || + ((t.didAlertStorageError = true), + a.alert.ok( + "Progress isn't being saved! Ensure you have enough storage space.", + )); + }, + okCancel: a.alert.okCancel, + }, + t.mutValues.levelState.attempt + r, + o, + t.mutValues.levelState.score.total, + r, + ); + s && + i && + i.signedInAccount && + (yield bp.updateAccountStorage(i.backend, l, a.now)); + } + }), + new ((c = void 0) || (c = Promise))(function (e, t) { + function a(e) { + try { + n(d.next(e)); + } catch (e) { + t(e); } - r && - i - .audio(a.song.fileName) - .play({ fromPosition: a.songStartSec, overwrite: true }); } - return t; - }, - render({ - props: { - song: e, - waveformData: t, - songStartSec: a, - onNext: i, - onBack: s, - }, - state: r, - device: l, - }) { - if (!t || !r.songLoaded) - return [ - n({ - text: `${localize("LOADING")}...`, - font: { size: 15 }, - color: ve, - }), - Fo({ - id: "NextButton", - width: 100, - height: 40, - text: localize("NEXT"), - onPress: i, - x: l.size.fullWidth / 2 - 70, - y: -l.size.fullHeight / 2 + 40, - }), - Fo({ - id: "BackButton", - text: localize("BACK"), - width: 80, - height: 40, - onPress: s, - x: -l.size.fullWidth / 2 + 60, - y: -l.size.fullHeight / 2 + 40, - }), - ]; - const c = a / r.songDuration; - const d = 700 * c - 350, - u = - (l.audio(e.fileName).getPosition() / r.songDuration) * 700 - - 350; - return [ - Dr({ - id: "Waveform", - song: e, - startFrame: 0, - direction: 1, - waveformData: t, - x: -350, - width: 700, - }), + function i(e) { + try { + n(d.throw(e)); + } catch (e) { + t(e); + } + } + function n(t) { + var n; + t.done + ? e(t.value) + : ((n = t.value), + n instanceof c + ? n + : new c(function (e) { + e(n); + })).then(a, i); + } + n((d = d.apply(r, l || [])).next()); + }) + ); + var r, l, c, d; + }, + Rf = (e, t, a, i) => ({ + playSound: (a) => { + Ga(a, e, t, { fromPosition: 0, playbackRate: i().df }); + }, + pauseSound: (t) => { + e.audio(t).pause(); + }, + enemyShoot: () => { + Ga("audio/levels/enemy/shoot.wav", e, t, { overwrite: true }); + }, + jump: (a) => { + (!a && t.muteJump) || + Ga( + `audio/levels/${a ? "skateboard/ollie" : "jump"}.wav`, + e, + t, + 0, + ); + }, + pauseSong: () => { + e.audio(a.song.fileName).pause(); + }, + fadeSong: () => { + e.audio(a.song.fileName).setVolume({ + type: "linear", + fadeTime: 2, + fadeTo: 0, + }); + }, + hitFlag: () => { + Ga("audio/levels/flag.wav", e, t, 0); + }, + hitSpring: () => { + Ga("audio/levels/spring.wav", e, t, 0); + }, + hitCollectible: () => { + Ga("audio/levels/coin-collect.wav", e, t, 0); + }, + hitSwitch: () => { + Ga("audio/levels/switch-button.mp3", e, t, 0); + }, + hitDirectionChange: () => { + Ga("audio/levels/direction-change.wav", e, t, 0); + }, + hitSpeedChange: (a, i) => { + let n; + ((n = i + ? "up" + (a < 1 ? 1 : a < 1.5 ? 2 : a < 2 ? 3 : a < 3 ? 4 : 5) + : "down" + + (a < 0.5 ? 5 : a < 1 ? 4 : a < 1.5 ? 3 : a < 2 ? 2 : 1)), + Ga(`audio/levels/speedChange/${n}.wav`, e, t, 0)); + }, + hitPortal: () => { + const a = e.random() < 0.5 ? 1 : 2; + Ga(`audio/levels/portal${a}.wav`, e, t, 0); + }, + pickupPowerup: (a) => { + switch (a) { + case "jetpack": + Ga("audio/levels/jetpack/pickup.wav", e, t, 0); + break; + case "gun": + Ga("audio/levels/gun/pickup.wav", e, t, 0); + break; + case "punch": + Ga("audio/levels/punch/pickup.wav", e, t, 0); + break; + case "playerStack": + Ga( + `audio/levels/stack/${B.clamp([1, 7])( + i().mutValues.levelState.playerStacks.length + 1, + )}.wav`, + e, + t, + 0, + ); + break; + case "doubleJump": + Ga("audio/levels/doubleJump/pickup.wav", e, t, 0); + } + }, + useUpPowerup: (a) => { + switch (a) { + case "jetpack": + Ga("audio/levels/jetpack/finish.wav", e, t, 0); + break; + case "gun": + Ga("audio/levels/gun/shoot.wav", e, t, 0); + break; + case "punch": + Ga("audio/levels/punch/use.wav", e, t, 0); + break; + case "doubleJump": + Ga("audio/levels/doubleJump/jump.wav", e, t, 0); + } + }, + addScore: () => { + Ga("audio/levels/skateboard/score/add.wav", e, t, 0); + }, + scoreMultiplier: (a) => { + Ga( + `audio/levels/skateboard/score/${Math.min(a, 10)}.wav`, + e, + t, + 0, + ); + }, + }), + ScreenBounds = makePureSprite({ + shouldRerender: () => false, + render: ({ + size: { width: e, height: t, widthMargin: a, heightMargin: i }, + }) => + a > 0 + ? [ o({ - color: ve, - opacity: 0.1, - height: 200, - width: 700 * (1 - c), - anchorX: 350 * -(1 - c), - x: d, - }), - o({ color: ve, opacity: 0.5, height: 200, width: 2, x: u }), - n({ - text: `${B.roundTo(2)(a)} s`, - font: { size: 15 }, - y: 110, - x: d, - color: ve, - }), - Fo({ - id: "BackButton", - text: localize("BACK"), - width: 80, - height: 40, - onPress: s, - x: -l.size.fullWidth / 2 + 60, - y: -l.size.fullHeight / 2 + 40, + width: a, + height: t, + color: "black", + opacity: 0.8, + x: -e / 2 - a / 2, }), - Fo({ - id: "NextButton", - width: 100, - height: 40, - text: localize("NEXT"), - onPress: i, - x: l.size.fullWidth / 2 - 70, - y: -l.size.fullHeight / 2 + 40, + o({ + width: a, + height: t, + color: "black", + opacity: 0.8, + x: e / 2 + a / 2, }), - ]; - }, - cleanup({ device: e, state: t }) { - t.songLoaded && e.audio(t.songLoaded).pause(); - }, - }); - var uy = function (e, t, a, i) { - return new (a || (a = Promise))(function (n, s) { + ] + : i > 0 + ? [ + o({ + width: e, + height: i, + color: "black", + opacity: 0.8, + y: -t / 2 - i / 2, + }), + o({ + width: e, + height: i, + color: "black", + opacity: 0.8, + y: t / 2 + i / 2, + }), + ] + : [], + }), + Cf = function (e) { + try { + const t = "string" == typeof e ? JSON.parse(e) : e, + a = Yd.jsonToData(t); + if (a instanceof Error) return a; + const i = a.data[0]; + return ((i.name = i.name.replace(/\n/g, "")), i); + } catch (e) { + return e; + } + }, + wf = function (e, t) { + const a = Yd.dataToJson([e], t); + return JSON.stringify(a); + }; + function Af(e) { + return new Promise(function (t, a) { + const i = new XMLHttpRequest(); + ((i.onload = function () { + t(new Response(i.response, { status: i.status || 200 })); + }), + (i.onerror = function () { + a(new TypeError(`Failed to load file: ${e.toString()}`)); + }), + i.open("GET", e), + (i.responseType = "arraybuffer"), + i.send(null)); + }); + } + function kf(e) { + return ( + (t = this), + (a = void 0), + (n = function* () { + try { + const t = e.split(".")[0].split("audio/tracks/")[1]; + return (yield Af(`waveforms/${t}-waveform.json`)).json(); + } catch (e) { + return null; + } + }), + new ((i = void 0) || (i = Promise))(function (e, s) { function o(e) { try { - l(i.next(e)); + l(n.next(e)); } catch (e) { s(e); } } function r(e) { try { - l(i.throw(e)); + l(n.throw(e)); } catch (e) { s(e); } } - function l(e) { - var t; - e.done - ? n(e.value) - : ((t = e.value), - t instanceof a - ? t - : new a(function (e) { - e(t); - })).then(o, r); - } - l((i = i.apply(e, t || [])).next()); - }); - }; - const UserlevelsView = makeCustomSprite({ - init: ({ updateState }) => { - let loadData = (page) => { - updateState((t) => - Object.assign(Object.assign({}, t), { - page: page, - loading: true, - data: null, - selectedLevel: null, - }), - ); - fetch(`https://www.userlevels.com/api/impossible/levels?page=${page}`).then( - (x) => x.json() - ).then((x) => updateState((t) => - Object.assign(Object.assign({}, t), { - loading: false, - data: x, - lastPage: x.last_page, - }), - )); - }; - loadData(1); - return { loading: true, page: 1, data: null, selectedLevel: null, lastPage: null, loadPageData: loadData}; - }, - loop: ({ state, getInputs, props }) => { - let inputs = getInputs().keysJustPressed; - inputs.Escape && props.goBack(); - if (state.loading) { - return Object.assign({}, state); + function l(t) { + var a; + t.done + ? e(t.value) + : ((a = t.value), + a instanceof i + ? a + : new i(function (e) { + e(a); + })).then(o, r); } - inputs.ArrowLeft && (state.data.prev_page_url && state.loadPageData(state.page - 1)); - inputs.ArrowRight && (state.data.next_page_url && state.loadPageData(state.page + 1)); - return Object.assign({}, state); + l((n = n.apply(t, a || [])).next()); + }) + ); + var t, a, i, n; + } + const Nf = makeCustomSprite({ + init: () => ({ + showSettings: false, + saved: false, + downloaded: false, + }), + render({ + device: e, + props: { + viewOffset: t, + onPressEdit: a, + onPressExport: i, + onPressMenu: s, + onSave: r, + levelName: l, + onChangeText: c, }, - render: ({ state, device, props }) => { - const { fullWidth: fullWidth, fullHeight: fullHeight } = device.size; - let levels = state?.data?.data; - - return [ - state.loading ? n({ - text: `${localize("LOADING")}...`, - color: ve, - font: { size: 15 }, - }) : ScrollContainer({ - id: "ChooseSongList", - containerWidth: fullWidth, - containerHeight: fullHeight - 140, - contentHeight: 40 * (levels.length + 1), - y: fullHeight / 2 - 70, - sprites: (t) => - levels.flatMap((a, s) => [ - Ar({ - id: `LevelButton-${s}`, - width: fullWidth - 240, - height: 30, - text: - `${a.title} - ${a.creator.name}`, - selected: state.selectedLevel === a, - colorLeft: xe, - colorMid: xe, - colorRight: xe, - selectedColorLeft: Re, - selectedColorMid: Re, - selectedColorRight: Re, - colorOpacities: [1, 0.75, 0], - noPress: t, - onPress: () => { - state.selectedLevel = a; - }, - x: -100, - y: -20 - 40 * s, + state: d, + updateState: u, + getContext: h, + }) { + const p = e.size.width + 2 * e.size.widthMargin, + g = e.size.height + 2 * e.size.heightMargin, + m = [ + o({ width: p, height: g, color: "#091045" }), + GridLines.Single({ + id: "GridLines", + parentOffset: t, + x: t.x, + y: t.y, + scaleX: t.scale, + scaleY: t.scale, + }), + ]; + return d.showSettings + ? [ + ...m, + Cm.Single({ + id: "SettingsMenu", + globalContextVal: h(Se), + goBack: () => { + u((e) => + Object.assign(Object.assign({}, e), { + showSettings: false, }), - ]), + ); + }, }), - Fo({ - id: "BackButton", - text: localize("BACK"), - width: 80, - height: 40, - onPress: props.goBack, - x: -fullWidth / 2 + 60, - y: -fullHeight / 2 + 40, + ] + : [ + ...m, + xf({ + id: "LevelName", + levelName: l, + onChangeText: (e) => { + (u((e) => + Object.assign(Object.assign({}, e), { + saved: false, + downloaded: false, + }), + ), + c(e)); + }, + y: 90, }), - Uf({ - id: "Title", - text: "USERLEVELS.COM", - width: 200, - height: 35, - x: -fullWidth / 2 + 120, - y: fullHeight / 2 - 40, + Fo({ + id: "EditButton", + text: localize("EDIT"), + width: 110, + height: 50, + strokeColor: Ye, + onPress: a, + x: -280, }), Fo({ - id: "LastPage", - text: "<", - width: 40, - height: 40, - disabled: state.loading, + id: "SaveButton", + text: + "loading" === d.saved + ? "SAVING" + : d.saved + ? "SAVED" + : localize("SAVE"), + width: 110, + height: 50, + strokeColor: Ye, + disabled: false !== d.saved, onPress: () => { - state.data.prev_page_url && state.loadPageData(state.page - 1) + (r().then(() => { + u((e) => + Object.assign(Object.assign({}, e), { + saved: true, + }), + ); + }), + u((e) => + Object.assign(Object.assign({}, e), { + saved: "loading", + downloaded: false, + }), + )); }, - x: -40, - y: -fullHeight / 2 + 40, + x: -140, }), - n({ - text: `${state.page}/${state.lastPage || "..."}`, - color: ve, - font: { size: 15, weight: 500 }, - y: -fullHeight / 2 + 40, + DropdownButton({ + id: "ExportButton", + options: ["CLIPBOARD", "FILE"], + choice: 0, + text: "EXPORT", + width: 110, + height: 50, + strokeColor: Ye, + onPress: (choice) => { + (u((e) => + Object.assign(Object.assign({}, e), { + downloaded: false, + }), + ), + i(choice).then((e) => { + e && + choice === 1 && + u((e) => + Object.assign(Object.assign({}, e), { + downloaded: true, + }), + ); + })); + }, + x: 0, }), + d.downloaded + ? n({ + text: localize("DOWNLOADED!"), + color: ve, + font: { size: 15 }, + y: -150, + }) + : null, Fo({ - id: "NextPage", - text: ">", - width: 40, - height: 40, - disabled: state.loading, + id: "SettingsButton", + text: localize("SETTINGS"), + width: 110, + height: 50, + strokeColor: Ye, onPress: () => { - state.data.next_page_url && state.loadPageData(state.page + 1) + u((e) => + Object.assign(Object.assign({}, e), { + showSettings: true, + downloaded: false, + }), + ); }, - x: 40, - y: -fullHeight / 2 + 40, + x: 140, }), + ((window.onbeforeunload = d.saved + ? undefined + : () => + "You have unsaved changes. Are you sure you want to return to the main menu?"), + void 0), Fo({ - id: "ImportButton", - text: localize("IMPORT"), - width: 100, - height: 40, - disabled: state.loading, + id: "ExitButton", + text: localize("MENU"), + width: 110, + height: 50, onPress: () => { - const n = Cf(state.selectedLevel.string), - s = (e) => { - (device.audio("audio/menu/error.wav").play(0), - (state.error = e)); - }; - if (n instanceof Error) return void s("Invalid level data"); - props.importLevel(n); - props.goBack(); + d.saved + ? s() + : e.alert.okCancel( + localize( + "You have unsaved changes. Are you sure you want to return to the main menu?", + ), + (e) => { + e && s(); + }, + ); }, - x: fullWidth / 2 - 70, - y: -fullHeight / 2 + 40, + strokeColor: Ye, + x: 280, + }), + document.fullscreenEnabled + ? vo({ + id: "FullScreen", + fullScreen: true, + onPress: () => { + if (document.fullscreenElement) { + document.exitFullscreen(); + } else { + document.documentElement + .requestFullscreen() + .catch((e) => { + throw e; + }); + } + }, + x: e.size.fullWidth / 2 - 40, + y: e.size.fullHeight / 2 - 40, + }) + : null + ]; + }, + }), + xf = makeCustomSprite({ + render({ props: { levelName: e, onChangeText: t } }) { + const a = 25; + return [ + r({ + fillColor: ve, + path: [ + [-200, -25], + [185, -25], + [210, 0], + [210, a], + [-175, a], + [-200, 0], + [-200, -25], + ], + y: -10, + }), + r({ + fillColor: we, + path: [ + [-200, -25], + [175, -25], + [200, 0], + [200, a], + [-175, a], + [-200, 0], + [-200, -25], + ], + }), + r({ + fillColor: ve, + path: [ + [-200, 0], + [-175, a], + [-70, a], + [-70, -10], + [-200, -10], + [-200, 0], + ], + }), + n({ + text: "LEVEL NAME", + color: Be, + font: { align: "left", size: 13 }, + x: -175, + y: 5, + }), + P({ + id: "NameInput", + fontName: "Montserrat", + fontSize: 15, + text: e, + onChangeText: t, + color: Be, + align: "left", + width: 200, + x: 50, + y: 90, }), ]; + }, + }), + Pf = function (e, t) { + const a = (660 - t.x) / t.scale, + i = (-t.x - 660) / t.scale, + n = (450 - t.y) / t.scale, + s = (-t.y - 450) / t.scale, + o = (e) => + (function (e, t, a, i, n, s) { + return e < a && e > i && t < n && t > s; + })(e.x, e.y, a, i, n, s); + return { + properties: e.properties, + blocks: e.blocks.filter(o), + spikes: e.spikes.filter(o), + platforms: e.platforms.filter(o), + directionChanges: e.directionChanges.filter(o), + speedChanges: e.speedChanges.filter(o), + saws: e.saws.filter(o), + flags: e.flags.filter(o), + powerups: e.powerups.filter(o), + enemies: [...e.enemies], + switchButtons: e.switchButtons.filter(o), + switchPlatforms: e.switchPlatforms.filter(o), + springs: e.springs.filter(o), + portals: e.portals.filter(o), + collectibles: e.collectibles.filter(o), + }; + }, + Mf = function (e, t, a, i) { + const { + frame: n, + layoutState: s, + switchButtons: o, + jumpSwitch: r, + playerX: l, + fallTypes, + } = t[a], + { jumpFrames: c } = _r(e), + d = Ca.clone(i); + return ( + Ca.setLayoutAtTime( + d, + s.enemies, + l, + n, + c, + o.rot, + r.ratio, + fallTypes, + ), + d + ); + }; + var Lf = function (e, t, a, i) { + return new (a || (a = Promise))(function (n, s) { + function o(e) { + try { + l(i.next(e)); + } catch (e) { + s(e); + } + } + function r(e) { + try { + l(i.throw(e)); + } catch (e) { + s(e); + } + } + function l(e) { + var t; + e.done + ? n(e.value) + : ((t = e.value), + t instanceof a + ? t + : new a(function (e) { + e(t); + })).then(o, r); } + l((i = i.apply(e, t || [])).next()); }); - const hy = makeCustomSprite({ - init: ({ device: e, updateState: t }) => ( - Promise.all([ - Jp.getSavedLevels(e.storage, e.now, e.alert), - Jp.getAccount(e.storage, null, e.alert), - Jp.getUserItems("all"), - ]).then( - ([ - { data: e }, - { - data: { levelsProgress: a }, - }, - i, - ]) => { - const n = i.filter(kp.isEditorItem), - s = i.filter(kp.isThemeItem), - o = i.filter(kp.isBonusLevelItem), - r = ql(a); + }; + const allFeatures = [ + "doubleJump", + "flyingEnemy", + "gun", + "jetpack", + "moveOnJump", + "saws", + "walkingEnemy", + "switchButton", + "playerStacks", + "collectible", + "spring", + "fallingPlatform", + "portals", + "skateboard", + "switchBlockSpike", + "punch", + "giantEnemy", + "speedChange", + "arrows", + ], + Df = makeCustomSprite({ + init({ props: e, updateState: t }) { + (!(function (e) { + Jp.getUserItems("editor") + .then((t) => { + const a = t.filter(kp.isEditorItem).map((e) => e.feature), + i = [ + ca.world1, + ...rt(t.filter(kp.isThemeItem).map((e) => e.theme)), + ].sort((e, t) => e.name.localeCompare(t.name)); + e((e) => + Object.assign(Object.assign({}, e), { + unlockedFeatures: { + type: "loaded", + editor: [...a, ...Tr], + themes: [...i, ...Rr], + }, + }), + ); + }) + .catch((t) => { + (console.error(t), + e((e) => + Object.assign(Object.assign({}, e), { + unlockedFeatures: { + type: "error", + message: t instanceof Error ? t.message : String(t), + }, + }), + )); + }); + })(t), + kf(e.savedLevel.level.song.fileName).then((e) => { t((t) => - Object.assign(Object.assign({}, t), { - data: { - editorItems: n, - themeItems: s, - bonusLevels: o, - levels: fy(e, r, n, s), - availableSongs: r, - }, - }), + Object.assign(Object.assign({}, t), { waveformData: e }), ); - }, - ), - { view: "main", data: "loading" } - ), + })); + const a = e.savedLevel.level.layout, + i = + e.savedLevel.settings.runHistory[ + e.savedLevel.settings.runHistoryIndex + ], + n = xa.sortLayoutState(i.layoutState, a), + { + viewOffset: s, + runHistory: o, + runHistoryIndex: r, + } = e.savedLevel.settings, + l = Pf(a, s), + c = Mf(e.savedLevel.level, o, r, l); + return { + view: "editing", + unlockedFeatures: { type: "loading" }, + levelEditorSettings: { viewOffset: s, actionHistory: [] }, + levelName: e.savedLevel.level.name, + layout: a, + sortedLayout: Ca.sortLayout(a), + sortedLevelState: el(i, n.sortedState), + sortedLayoutStateOriginalIndexes: n.originalIndexes, + runHistory: o, + runHistoryIndex: r, + themeLoaded: false, + initRunHistoryIndex: e.savedLevel.settings.runHistoryIndex, + waveformData: null, + inViewLayout: l, + inViewLayoutAtTime: c, + }; + }, render({ props: e, state: t, - device: a, - updateState: i, + updateState: a, + device: i, getContext: s, }) { - const o = a.size.height + 2 * a.size.heightMargin, - r = a.size.width + 2 * a.size.widthMargin; - if ("loading" === t.data) - return [ - n({ - text: `${localize("LOADING")}...`, - color: ve, - font: { size: 15 }, - }), - ]; - const { - levels: l, - availableSongs: c, - bonusLevels: d, - editorItems: u, - themeItems: h, - } = t.data; - if ("new" === t.view) - return [ - py({ - id: "NewLevel", - availableSongs: c, - selectSong: (t, i) => { - const n = Sr( - ry(a.random), - `Untitled-${l.length + 1}`, - t, - void 0, - null, - i, - ); - e.editLevel(ul(n)); - }, - backPressed: () => { - i((e) => - Object.assign(Object.assign({}, e), { view: "main" }), - ); - }, - fadeInMusic: e.fadeInMusic, - fadeOutMusic: e.fadeOutMusic, - }), - ]; - const importLevel = (e) => - uy(this, void 0, void 0, function* () { - const t = yield Jp.saveLevel( - a.storage, - a.now, - Object.assign(Object.assign({}, e), { id: ry(a.random) }), - a.alert, - ); - i((e) => - Object.assign(Object.assign({}, e), { - view: "main", - data: - "loading" === e.data - ? e.data - : Object.assign(Object.assign({}, e.data), { - levels: fy(t.data, c, u, h), - }), - }), - ); - const { online: n } = s(Se); - n && - n.signedInAccount && - (yield bp.updateLevelsStorage( - n.backend, - t.data.map(({ level: e }) => e), - a.now, - )); + const r = i.size.width + 2 * i.size.widthMargin, + l = i.size.height + 2 * i.size.heightMargin, + c = t.layout.properties.theme, + d = Yf({ + id: `ThemeLoader-${c.id}`, + theme: c, + onLoad: () => { + a((e) => + Object.assign(Object.assign({}, e), { + themeLoaded: true, + }), + ); + }, }); - if ("importType" === t.view) - return [ - my({ - id: "ImportType", - availableSongs: c, - items: { bonusLevels: d, editorItems: u, themeItems: h }, - goBack: () => { - i((e) => - Object.assign(Object.assign({}, e), { view: "main" }), - ); - }, - goToPasteText: () => { - i((e) => - Object.assign(Object.assign({}, e), { view: "import" }), - ); - }, - importLevel: importLevel, - }), - ]; - if ("import" === t.view) + if ("loaded" !== t.unlockedFeatures.type) return [ - gy({ - id: "ImportLevel", - availableSongs: c, - items: { bonusLevels: d, editorItems: u, themeItems: h }, - goBack: () => { - zu.supportsFiles() - ? i((e) => - Object.assign(Object.assign({}, e), { - view: "importType", - }), - ) - : i((e) => - Object.assign(Object.assign({}, e), { - view: "main", - }), - ); - }, - importLevel: importLevel, + d, + o({ width: r, height: l, color: "#091045" }), + Fo({ + id: "BackButton", + text: localize("BACK"), + width: 80, + height: 40, + onPress: e.backToMenu, + y: -50, }), + ...("loading" === t.unlockedFeatures.type + ? [ + n({ + text: `${localize("LOADING")}...`, + color: ve, + font: { size: 15 }, + }), + ] + : [ + n({ + text: `ERROR LOADING EDITOR: ${t.unlockedFeatures.message}`, + color: Ve, + font: { size: 15 }, + }), + ]), ]; - if ("userlevels" === t.view) + if ("menu" === t.view) return [ - UserlevelsView({ - id: "UserlevelsView", - goBack: () => { - i((e) => - Object.assign(Object.assign({}, e), { view: "main" }), + d, + Nf({ + id: "LevelEditorMenu", + viewOffset: t.levelEditorSettings.viewOffset, + levelName: t.levelName, + onChangeText: (e) => { + a((t) => + Object.assign(Object.assign({}, t), { levelName: e }), ); }, - importLevel: importLevel, - }) - ]; - - const g = () => { - i((e) => - Object.assign(Object.assign({}, e), { - view: zu.supportsFiles() ? "importType" : "import", - }), - ); - }; - return 0 === l.length - ? [ - Fo({ - id: "BackButton", - text: localize("BACK"), - width: 80, - height: 45, - onPress: e.backToMainMenu, - x: -r / 2 + 60, - y: -o / 2 + 40, - }), - Uf({ - id: "Title", - text: localize("LEVEL EDITOR"), - width: 200, - height: 35, - x: -r / 2 + 120, - y: o / 2 - 40, - }), - Fo({ - id: "NewButton", - text: localize("NEW"), - width: 120, - height: 45, - onPress: () => { - i((e) => - Object.assign(Object.assign({}, e), { view: "new" }), - ); - }, - x: -80, - }), - Fo({ - id: "ImportButton", - text: localize("IMPORT"), - width: 120, - height: 45, - onPress: g, - x: 80, - }), - ] - : [ - Fo({ - id: "BackButton", - text: localize("BACK"), - width: 80, - height: 40, - onPress: e.backToMainMenu, - x: -r / 2 + 60, - y: -o / 2 + 40, - }), - Uf({ - id: "Title", - text: localize("LEVEL EDITOR"), - width: 200, - height: 35, - x: -r / 2 + 120, - y: o / 2 - 40, - }), - Fo({ - id: "UserlevelsButton", - text: "USERLEVELS.COM", - width: 160, - height: 40, - onPress: () => { - i((e) => - Object.assign(Object.assign({}, e), { view: "userlevels" }), - ); - }, - x: ((-r / 2 + 60) + (r / 2 - 200)) / 2, - y: -o / 2 + 40, - }), - Fo({ - id: "NewButton", - text: localize("NEW"), - width: 80, - height: 40, - onPress: () => { - i((e) => - Object.assign(Object.assign({}, e), { view: "new" }), + onPressEdit: () => { + a((e) => + Object.assign(Object.assign({}, e), { + view: "editing", + }), + ); + }, + onSave: () => + Lf(this, void 0, void 0, function* () { + const a = Object.assign( + Object.assign({}, e.savedLevel.level), + { name: t.levelName, layout: t.layout }, + ), + n = yield Jp.saveLevel( + i.storage, + i.now, + a, + i.alert, + t.levelEditorSettings.viewOffset, + t.runHistory, + t.runHistoryIndex, + t.initRunHistoryIndex, + ), + { online: o } = s(Se); + o && + o.signedInAccount && + (yield bp.updateLevelsStorage( + o.backend, + n.data.map(({ level: e }) => e), + i.now, + )); + }), + onPressExport: (choice) => + Lf(this, void 0, void 0, function* () { + const a = Object.assign( + Object.assign({}, e.savedLevel.level), + { + name: t.levelName, + layout: Ca.sortLayout(t.layout), + }, + ), + n = wf(a, i.now); + if (choice !== 1) + return ( + i.clipboard.copy(n, (e) => { + if (e) + return ( + i.alert.ok( + `${localize("Error copying level JSON to clipboard:")} ${e.message}`, + ), + void i.log(n) + ); + i.alert.ok( + localize("Level JSON copied to clipboard. (Upload your levels to userlevels.com)"), + ); + }), + true + ); + try { + return yield zu.saveFile(`${a.name}.json`, n, "application/json"); + } catch (e) { + return ( + i.alert.ok(`Error saving file: ${e.message}`), + i.log(n), + false + ); + } + }), + onPressMenu: e.backToMenu, + }), + ]; + if ("editing" === t.view) { + const i = (i) => { + if ("undo" !== i.type) + a((t) => { + const a = Ba(i, t.layout, t.runHistory), + n = Pf(a.layout, t.levelEditorSettings.viewOffset), + s = Mf( + e.savedLevel.level, + a.runHistory, + t.runHistoryIndex, + n, ); - }, - x: r / 2 - 200, - y: -o / 2 + 40, - }), - Fo({ - id: "ImportButton", - text: localize("IMPORT"), - width: 100, - height: 40, - onPress: g, - x: r / 2 - 70, - y: -o / 2 + 40, - }), - ScrollContainer({ - id: "LevelsList", - containerWidth: r, - containerHeight: o - 140, - contentHeight: 60 * l.length + 30, - y: o / 2 - 70, - sprites: (t) => - l.flatMap( - ({ savedLevel: n, displayText: o, canEdit: l }, d) => { - const { level: p } = n, - g = -20 - 50 * d; - return [ - wr({ - id: `LevelsListItem-${d}`, - text: o, - colorLeft: xe, - colorMid: xe, - colorRight: xe, - colorOpacities: [1, 0.75, 0], - width: r - 40, - height: 40, - y: g, + return Object.assign(Object.assign({}, t), { + layout: a.layout, + runHistory: a.runHistory, + levelEditorSettings: Object.assign( + Object.assign({}, t.levelEditorSettings), + { + actionHistory: [ + Fa(i, t.layout), + ...t.levelEditorSettings.actionHistory.slice( + 0, + 100, + ), + ], + }, + ), + inViewLayout: n, + inViewLayoutAtTime: s, + themeLoaded: !a.newAssets, + }); + }); + else { + if (0 === t.levelEditorSettings.actionHistory.length) + return; + const [i, ...n] = t.levelEditorSettings.actionHistory; + a((t) => { + const a = (function (e, t, a) { + switch (e.type) { + case "undoPlaceObjects": + return Ba( + Object.assign(Object.assign({}, e), { + type: "eraseObjects", }), - Fo({ - id: `PlayLevelButton-${d}`, - width: 60, - height: 30, - text: localize("PLAY"), - fontSize: 12, - onPress: () => e.playLevel(vr(p)), - x: r / 2 - 205, - y: g, - noPress: t, + t, + a, + ); + case "undoMoveObjects": + return Ba( + Object.assign(Object.assign({}, e), { + type: "moveObjects", }), - Fo({ - id: `EditLevelButton-${d}`, - width: 60, - height: 30, - text: localize("EDIT"), - fontSize: 12, - disabled: !l, - onPress: () => e.editLevel(n), - x: r / 2 - 138, - y: g, - noPress: t, + t, + a, + ); + case "undoSetProperty": + return Ba( + { + type: "setProperty", + array: e.array, + index: e.index, + set: () => e.object, + }, + t, + a, + ); + case "undoEraseObjects": + return Ba( + Object.assign(Object.assign({}, e), { + type: "placeObjects", }), - Fo({ - id: `DeleteLevelButton-${d}`, - width: 70, - height: 30, - text: localize("DELETE"), - fontSize: 12, - onPress: () => { - a.alert.okCancel( - `${localize( - "Are you sure you want to delete level", - )} ${p.name}?`, - (e) => - uy(this, void 0, void 0, function* () { - if (!e) return; - const t = yield Jp.deleteLevel( - a.storage, - n, - a.alert, - a.now, - ), - { online: o } = s(Se); - (o && - o.signedInAccount && - (yield bp.updateLevelsStorage( - o.backend, - t.map(({ level: e }) => e), - a.now, - )), - i((e) => - Object.assign(Object.assign({}, e), { - data: - "loading" === e.data - ? e.data - : Object.assign( - Object.assign({}, e.data), - { - levels: fy(t, c, u, h), - }, - ), - }), - )); - }), - ); - }, - x: r / 2 - 65, - y: g, - noPress: t, + t, + a, + ); + case "undoChangeTheme": + return Ba( + Object.assign(Object.assign({}, e), { + type: "changeTheme", }), - ]; - }, - ), - }), - ]; - }, - }); - var customSong; - const py = makeCustomSprite({ - init: () => ({ - view: { - type: "chooseSong", - selectedSong: null, - selectedSongLoading: false, - }, - }), - render({ props: e, state: t, device: a, updateState: i }) { - const { fullWidth: n, fullHeight: s } = a.size; - if ("chooseSongStart" === t.view.type) { - const { - song: a, - songStartTimeSecs: o, - waveformData: r, - } = t.view; - return [ - Uf({ - id: "Title", - text: localize("SONG START"), - width: 200, - height: 35, - x: -n / 2 + 120, - y: s / 2 - 40, - }), - dy({ - id: "SongStartMenu", - song: a, - waveformData: r, - songStartSec: o, - setSongStartMs: (e) => { - i((t) => - "chooseSongStart" === t.view.type - ? Object.assign(Object.assign({}, t), { - view: Object.assign(Object.assign({}, t.view), { - songStartTimeSecs: e, - }), - }) - : t, - ); - }, - onNext: () => { - e.selectSong(a, o || 0); - }, - onBack: () => { - i((e) => - Object.assign(Object.assign({}, e), { - view: { - type: "chooseSong", - selectedSong: a, - selectedSongLoading: true, - }, - }), + t, + a, + ); + } + })(i, t.layout, t.runHistory), + s = Pf(a.layout, t.levelEditorSettings.viewOffset), + o = Mf( + e.savedLevel.level, + a.runHistory, + t.runHistoryIndex, + s, ); - }, - }), - ]; - } - const { selectedSong: o, selectedSongLoading: r } = t.view, - l = o && hl.getSnippetName(o.fileName); + return Object.assign(Object.assign({}, t), { + layout: a.layout, + runHistory: a.runHistory, + levelEditorSettings: Object.assign( + Object.assign({}, t.levelEditorSettings), + { actionHistory: n }, + ), + inViewLayout: s, + inViewLayoutAtTime: o, + themeLoaded: !a.newAssets, + }); + }); + } + }; return [ - Uf({ - id: "Title", - text: localize("CHOOSE SONG"), - width: 200, - height: 35, - x: -n / 2 + 120, - y: s / 2 - 40, - }), - ScrollContainer({ - id: "ChooseSongList", - containerWidth: n, - containerHeight: s - 140, - contentHeight: 40 * (e.availableSongs.length + 1), - y: s / 2 - 70, - sprites: (t) => - e.availableSongs.flatMap((a, s) => [ - Ar({ - id: `SongButton-${s}`, - width: n - 240, - height: 30, - text: - "custom" in a - ? `${localize(`Custom song`)}...` - : `${a.name} ${localize("by")} ${a.author} - ${ - a.bpm - } BPM ${a.length ? `(${a.length})` : ""}`, - selected: o === a, - colorLeft: xe, - colorMid: xe, - colorRight: xe, - selectedColorLeft: Re, - selectedColorMid: Re, - selectedColorRight: Re, - colorOpacities: [1, 0.75, 0], - noPress: t || r, - onPress: () => { - if ("custom" in a) { - customSong = { - name: "", - author: "", - fileName: "", - bpm: 120, - label: "", - isBonusSong: false, - custom: 1, - }; - - customSong.fileName = prompt("Link:"); - if ( - customSong.fileName == null || - customSong.fileName == "" - ) { - return; - } - customSong.name = prompt("Name:"); - if (customSong.name == null) { - return; - } - customSong.author = prompt("Author:"); - if ( - customSong.author == null || - customSong.author == "" - ) { - return; - } - customSong.bpm = prompt("BPM:"); - if ( - customSong.bpm == null || - customSong.bpm == "" - ) { - return; - } - for ( - var $i = 0; - $i < Object.keys(hl.songs).length; - $i++ - ) { - if ( - hl.songs[Object.keys(hl.songs)[$i]].bpm == - customSong.bpm - ) { - a = hl.songs[Object.keys(hl.songs)[$i]]; - } else { - a = hl.songs.dragonfly; - } - } - } else { - customSong = undefined; - } - o !== a && - (e.fadeOutMusic(), - i((e) => - "chooseSong" === e.view.type - ? Object.assign(Object.assign({}, e), { - view: Object.assign( - Object.assign({}, e.view), - { - selectedSong: a, - selectedSongLoading: true, - }, - ), - }) - : e, - )); - }, - x: -100, - y: -20 - 40 * s, - }), - ]), + d, + o({ + width: r, + height: l, + color: t.layout.properties.theme.colour, }), - ...(o && l + ...(s(Se).settings.animateEditor && t.themeLoaded ? [ - Gf({ - id: `LoadSong-${l}`, - assets: { audioFileNames: [l] }, - onLoad: () => { - i((e) => - "chooseSong" === e.view.type - ? Object.assign(Object.assign({}, e), { - view: Object.assign( - Object.assign({}, e.view), - { selectedSongLoading: false }, - ), - }) - : e, - ); - }, - sprites: [ - Ro.Single({ - id: `PreviewSong-${l}`, - fileName: l, - loop: false, - paused: false, - fromPosition: 0, - overwrite: true, - isGameSfx: false, - }), - ], - }), - Fo({ - id: "NextButton", - width: 100, - height: 40, - text: localize("NEXT"), - disabled: false, //r, - onPress: () => { - (i((e) => - Object.assign(Object.assign({}, e), { - view: { - type: "chooseSongStart", - song: o, - songStartTimeSecs: 0, - waveformData: null, - }, - }), + xg.Single( + { + id: "Background", + theme: t.layout.properties.theme, + cameraX: + -t.levelEditorSettings.viewOffset.x / + t.levelEditorSettings.viewOffset.scale, + cameraY: + -t.levelEditorSettings.viewOffset.y / + t.levelEditorSettings.viewOffset.scale, + paused: false, + switchBlockSpikes: + t.runHistory[t.runHistoryIndex].switchBlockSpikes, + playerScale: + t.runHistory[t.runHistoryIndex].playerScale, + bgColor: t.runHistory[t.runHistoryIndex].bgColor, + flash: 0, + speedMultiplier: + t.runHistory[t.runHistoryIndex] + .playerSpeedMultiplier, + plain: s(Se).settings.plainBackground, + frame: + t.levelEditorSettings.viewOffset.x + + t.levelEditorSettings.viewOffset.y, + jumpFrames: t.jumpFrames, + playerDir: 1, + crashed: false, + gravity: 1, + dashing: false, + isGravity: false, + scaleX: Math.max( + 1, + t.levelEditorSettings.viewOffset.scale, + ), + scaleY: Math.max( + 1, + t.levelEditorSettings.viewOffset.scale, + ), + }, + (e) => { + ((e.theme = t.layout.properties.theme), + (e.cameraX = + -t.levelEditorSettings.viewOffset.x / + t.levelEditorSettings.viewOffset.scale), + (e.cameraY = + -t.levelEditorSettings.viewOffset.y / + t.levelEditorSettings.viewOffset.scale), + (e.paused = t.paused), + (e.speedMultiplier = + t.runHistory[ + t.runHistoryIndex + ].playerSpeedMultiplier), + (e.bgColor = + t.runHistory[t.runHistoryIndex].bgColor), + (e.switchBlockSpikes = + t.runHistory[ + t.runHistoryIndex + ].switchBlockSpikes), + (e.playerScale = + t.runHistory[t.runHistoryIndex].playerScale), + (e.frame = 0), + (e.jumpFrames = t.jumpFrames), + (e.scaleX = Math.max( + 1, + t.levelEditorSettings.viewOffset.scale, + )), + (e.scaleY = Math.max( + 1, + t.levelEditorSettings.viewOffset.scale, + ))); + }, + ), + ] + : [ + o({ + color: infiniteBgTable( + 0, + t.runHistory[t.runHistoryIndex].bgColor || + "#00FFFF", + ), + width: r, + height: l, + show: t.layout.properties.theme.id === "infinite", + }), + o({ + color: "#250b05", + width: r, + height: l, + show: + t.layout.properties.theme.id === "dreamy" && + t.runHistory[t.runHistoryIndex] + .switchBlockSpikes === + (t.runHistory[t.runHistoryIndex].playerScale === + 1), + }), + o({ + color: "#9D0808", + width: r, + height: l, + opacity: Math.min( + 0.5, + t.runHistory[t.runHistoryIndex] + .playerSpeedMultiplier / 10, + ), + show: t.layout.properties.theme.id === "speed", + }), + o({ + color: + t.runHistory[t.runHistoryIndex].bgColor || + "#00FFFF", + width: r, + height: l, + show: t.layout.properties.theme.id === "classic", + }), + o({ + color: "black", + width: r, + height: l, + opacity: 0.3, + show: t.layout.properties.theme.id === "classic", + }), + ]), + + zr({ + id: "LevelEditor", + settings: t.levelEditorSettings, + setSettings: (t) => { + a((a) => { + let { inViewLayout: i, inViewLayoutAtTime: n } = a; + return ( + t.viewOffset && + ((i = Pf(a.layout, t.viewOffset)), + (n = Mf( + e.savedLevel.level, + a.runHistory, + a.runHistoryIndex, + i, + ))), + Object.assign(Object.assign({}, a), { + levelEditorSettings: Object.assign( + Object.assign({}, a.levelEditorSettings), + t, ), - kf(o.fileName).then((e) => { - i((t) => - "chooseSongStart" === t.view.type - ? Object.assign(Object.assign({}, t), { - view: Object.assign( - Object.assign({}, t.view), - { waveformData: e }, - ), - }) - : t, - ); - })); + inViewLayout: i, + inViewLayoutAtTime: n, + }) + ); + }); + }, + runHistory: t.runHistory, + runHistoryIndex: t.runHistoryIndex, + setHistoryIndex: (t) => { + a((a) => { + const i = Mf( + e.savedLevel.level, + a.runHistory, + t, + a.inViewLayout, + ); + return Object.assign(Object.assign({}, a), { + runHistoryIndex: t, + initRunHistoryIndex: Math.min( + t, + a.initRunHistoryIndex, + ), + inViewLayoutAtTime: i, + }); + }); + }, + features: allFeatures, + themes: t.unlockedFeatures.themes, + send: i, + level: Object.assign( + Object.assign({}, e.savedLevel.level), + { layout: t.layout }, + ), + waveformData: t.waveformData, + inViewLayout: t.inViewLayout, + inViewLayoutAtTime: t.inViewLayoutAtTime, + isLoading: !t.themeLoaded, + playerSkin: e.playerSkin, + }), + Ke({ + id: "PlayButton", + type: "play", + x: r / 2 - 50, + y: l / 2 - 50, + disabled: !t.themeLoaded, + onPress: () => { + a((e) => { + const t = Object.assign( + Object.assign({}, e.runHistory[e.runHistoryIndex]), + { + bossState: e.runHistory[e.runHistoryIndex] + .bossState + ? JSON.parse( + JSON.stringify( + e.runHistory[e.runHistoryIndex].bossState, + ), + ) + : null, }, - x: n / 2 - 70, - y: -s / 2 + 40, - }), - ] - : []), - Fo({ - id: "BackButton", - text: localize("BACK"), - width: 80, - height: 40, + ), + { sortedState: a, originalIndexes: i } = + xa.sortLayoutState(t.layoutState, e.layout); + return Object.assign(Object.assign({}, e), { + view: "playing", + sortedLayout: Ca.sortLayout(e.layout), + sortedLevelState: el(t, a), + sortedLayoutStateOriginalIndexes: i, + runHistory: e.runHistory.slice( + 0, + e.runHistoryIndex + 1, + ), + }); + }); + }, + }), + Bf.Single({ + id: "MenuButton", + globalContextVal: s(Se), onPress: () => { - (e.fadeInMusic(), e.backPressed()); + a((e) => + Object.assign(Object.assign({}, e), { view: "menu" }), + ); }, - x: -n / 2 + 60, - y: -s / 2 + 40, }), ]; - }, - }), - gy = makeCustomSprite({ - init: () => ({ json: "", error: "" }), - render({ props: e, state: t, device: a, updateState: i }) { - const s = a.size.width + 2 * a.size.widthMargin, - o = a.size.height + 2 * a.size.heightMargin, - { bonusLevels: r, editorItems: l, themeItems: c } = e.items; - return [ - Uf({ - id: "Title", - text: localize("IMPORT LEVEL"), - width: 200, - height: 35, - x: -s / 2 + 120, - y: o / 2 - 40, + } + return [ + d, + Ff.Single({ + id: "Level", + globalContextVal: s(Se), + spineContextVal: s(Ws), + level: Object.assign(Object.assign({}, e.savedLevel.level), { + layout: t.sortedLayout, }), - P({ - id: "LevelJsonInput", - fontName: "monospace", - fontSize: 20, - text: t.json, - onChangeText: (e) => { - i(() => ({ error: "", json: e })); + playerSkin: e.playerSkin, + startState: t.sortedLevelState, + pushRunHistory: (e) => { + a((t) => + Object.assign(Object.assign({}, t), { + runHistory: [ + ...t.runHistory, + el( + e, + xa.unsortLayoutState( + e.layoutState, + t.sortedLayoutStateOriginalIndexes, + ), + ), + ], + }), + ); + }, + backToEditor: () => { + a((e) => + Object.assign(Object.assign({}, e), { view: "editing" }), + ); + }, + }), + ScreenBounds({ id: "ScreenBounds" }), + Ke({ + id: "PlayButton", + type: "edit", + x: r / 2 - 50, + y: l / 2 - 50, + disabled: false, + onPress: () => { + (i.audio(e.savedLevel.level.song.fileName).pause(), + a((e) => + Object.assign(Object.assign({}, e), { + view: "editing", + }), + )); + }, + }), + ]; + }, + }), + Bf = makeSprite({ + render: ({ props: e, device: t }) => [ + Se.Single({ + context: () => e.globalContextVal, + sprites: [ + menuButtonSprite.Single( + { + hidden: false, + onPress: e.onPress, + x: -t.size.fullWidth / 2 + 50, + y: t.size.fullHeight / 2 - 50, }, - align: "left", - width: s - 40, - numberOfLines: 11, - }), - null, - Fo({ - id: "ImportButton", - width: 100, - height: 40, - text: localize("IMPORT"), - disabled: "" === t.json, - onPress: () => { - const n = Cf(t.json), - s = (e) => { - (a.audio("audio/menu/error.wav").play(0), - i((t) => - Object.assign(Object.assign({}, t), { error: e }), - )); - }; - if (n instanceof Error) return void s("Invalid level data"); - const o = kp.canEditLevel(n, l, c, e.availableSongs); - if (o) { - const e = kp.canPlayLevel(n, r); - if (e) return void s(e); - a.alert.ok(`${o}\nEditing is disabled for this level`); - } - e.importLevel(n); + (e) => { + ((e.x = -t.size.fullWidth / 2 + 50), + (e.y = t.size.fullHeight / 2 - 50)); }, - x: s / 2 - 70, - y: -o / 2 + 40, + ), + ], + }), + ], + }), + Ff = makeSprite({ + render: ({ props: e }) => [ + Se.Single({ + context: () => e.globalContextVal, + sprites: [ + Ws.Single({ + context: () => e.spineContextVal, + sprites: [ + vf.Single( + { + level: e.level, + startState: e.startState, + editor: { + pushRunHistory: e.pushRunHistory, + backToEditor: e.backToEditor, + }, + playerSkin: + "default" === e.playerSkin.fileName + ? e.level.layout.properties.theme.player + : e.playerSkin, + }, + (t) => { + ((t.level = e.level), + (t.startState = e.startState), + (t.editor.pushRunHistory = e.pushRunHistory), + (t.editor.backToEditor = e.backToEditor)); + }, + ), + ], }), - Fo({ - id: "BackButton", - text: localize("BACK"), - width: 80, - height: 40, - onPress: e.goBack, - x: -s / 2 + 60, - y: -o / 2 + 40, + ], + }), + ], + }), + Yf = makeCustomSprite({ + init({ preloadFiles: e, props: t }) { + e({ + imageFileNames: [ + ...Qs.getThemeImages(t.theme), + ...qs(t.theme.background), + ], + imageFileNamesScaleNearestPixel: Qs.getThemeImagesPixel( + t.theme, + ), + }).then(() => { + t.onLoad(); + }); + }, + render: () => [], + }), + Uf = makePureSprite({ + shouldRerender: (e, t) => e.text !== t.text, + render: ({ props: { text: e, width: t, height: a } }) => [ + We({ width: t, height: a, y: -5, color: Re }), + We({ width: t, height: a, color: ve }), + n({ font: { size: 20 }, text: e, color: Be }), + ], + }), + jf = makeCustomSprite({ + render: ({ props: { closeModal: e, width: t, height: a } }) => [ + Clickable({ + id: "ClickOutside", + onPressOutside: e, + width: t, + height: a, + sprites: () => [], + onPress: () => null, + }), + ], + }), + Gf = makeCustomSprite({ + init({ props: e, updateState: t, preloadFiles: a, device: i }) { + let n = null; + return ( + e.withContext + ? ((n = Fs( + e.withContext.animationContext, + e.withContext.spineFiles, + i.timer.start, + )), + Promise.all([n, a(e.assets)]).then(([a]) => { + var i; + (null === (i = e.onLoad) || void 0 === i || i.call(e), + t((e) => + Object.assign(Object.assign({}, e), { + animationAssets: a, + loaded: true, + }), + )); + })) + : a(e.assets).then(() => { + var a; + (null === (a = e.onLoad) || void 0 === a || a.call(e), + t((e) => + Object.assign(Object.assign({}, e), { loaded: true }), + )); }), - t.error - ? n({ - text: t.error, - color: Ve, - font: { size: 13 }, - y: -o / 2 + 40, - }) - : null, - ]; - }, + { loaded: false, animationAssets: n } + ); + }, + render: ({ props: e, state: t }) => + !t.loaded || (t.animationAssets && "then" in t.animationAssets) + ? e.loadingSprites || [] + : e.withContext && t.animationAssets + ? [ + Se.Sprite({ + context: e.withContext.globalContext, + sprites: [ + Ws.Sprite({ + context: { + animationAssets: t.animationAssets, + animationRenderer: + e.withContext.animationRenderer, + }, + sprites: e.sprites, + }), + ], + }), + ] + : e.sprites, + cleanup({ state: e }) { + e.animationAssets && + ("then" in e.animationAssets + ? e.animationAssets.then(Gs) + : Gs(e.animationAssets)); + }, + }), + Vf = makeCustomSprite({ + init: ({ + updateState: e, + preloadFiles: t, + props: a, + device: i, + }) => ({ + animationAssets: ("string" == typeof a.level + ? Hf(a.level) + : Promise.resolve(a.level) + ) + .then((e) => { + var n; + return Xf( + e, + a.playerSkin, + a.removeCheckpoints, + t, + i.timer.start, + a.animationContext, + null === (n = a.boss) || void 0 === n + ? void 0 + : n.fileNames, + ); + }) + .then(([t, i]) => { + const n = a.boss; + return ( + e(() => ({ + level: n + ? Object.assign(Object.assign({}, t), { + boss: n, + layout: n.overrideMovement + ? t.layout + : Ca.addBlocksFlat(t.layout), + }) + : t, + animationAssets: i, + })), + i + ); + }), + level: null, }), - my = makeCustomSprite({ - init: () => ({ error: "", loading: false }), - render({ props: e, state: t, device: a, updateState: i }) { - const s = a.size.width + 2 * a.size.widthMargin, - o = a.size.height + 2 * a.size.heightMargin, - { bonusLevels: r, editorItems: l, themeItems: c } = e.items; - return [ - Fo({ - id: "BackButton", - text: localize("BACK"), - width: 80, - height: 40, - onPress: e.goBack, - x: -s / 2 + 60, - y: -o / 2 + 40, - }), - Uf({ - id: "Title", - text: localize("LEVEL EDITOR"), - width: 200, - height: 35, - x: -s / 2 + 120, - y: o / 2 - 40, + render: ({ props: e, state: t }) => + !t.level || "then" in t.animationAssets + ? [ + n({ + text: `${localize("LOADING")}...`, + font: { size: 15 }, + color: ve, }), - Fo({ - id: "FromFileButton", - text: "OPEN FILE", - width: 140, - height: 45, - onPress: async () => { - i((e) => - Object.assign(Object.assign({}, e), { loading: true }), - ); - const t = (e) => { - (a.audio("audio/menu/error.wav").play(0), - i((t) => - Object.assign(Object.assign({}, t), { - error: e, - loading: false, - }), - )); - }; - let n; - try { - n = await zu.openFile(); - if (null == n) - return void i((e) => - Object.assign(Object.assign({}, e), { - loading: false, - }), - ); - } catch (e) { - console.error(e); - return void t("Failed to open file"); - } - const s = Cf(n); - if (s instanceof Error) - return void t("Invalid level data"); - const o = kp.canEditLevel(s, l, c, e.availableSongs); - if (o) { - const e = kp.canPlayLevel(s, r); - if (e) return void t(e); - a.alert.ok(`${o}\nEditing is disabled for this level`); - } - (e.importLevel(s), - i((e) => - Object.assign(Object.assign({}, e), { - loading: false, - }), - )); - }, - x: -100, + ] + : [ + Se.Sprite({ + context: e.globalContext, + sprites: [ + Ws.Sprite({ + context: { + animationAssets: t.animationAssets, + animationRenderer: e.animationRenderer, + }, + sprites: e.sprites(t.level), + }), + ], }), - Fo({ - id: "ImportButton", - text: "PASTE TEXT", - width: 140, - height: 45, - onPress: e.goToPasteText, + ], + cleanup({ state: e }) { + "then" in e.animationAssets + ? e.animationAssets.then(Gs) + : Gs(e.animationAssets); + }, + }); + function Hf(e) { + return Af(`levels/${e}.json`) + .then((e) => e.json()) + .then((e) => Cf(e)); + } + function Xf(e, t, a, i, n, s, o) { + return Promise.all([ + i({ + imageFileNames: [ + ...Qs.getThemeImages(e.layout.properties.theme), + ...Qs.getPlayerImages([t], []), + ...Qs.levelImages, + ...((null == o ? void 0 : o.images) || []), + ], + audioFileNames: [ + e.song.fileName, + ...Qs.levelSfx, + ...((null == o ? void 0 : o.audio) || []), + ], + imageFileNamesScaleNearestPixel: [ + ...Qs.getThemeImagesPixel(e.layout.properties.theme), + ...((null == o ? void 0 : o.pixelArtImages) || []), + ], + }).then(() => (a ? Ir(e) : e)), + Fs( + s, + [ + ...Qs.getThemeSpine(e.layout.properties.theme), + ...((null == o ? void 0 : o.spine) || []), + ], + n, + ), + ]); + } + const zf = makeCustomSprite({ + init: () => ({ arrowY: 0 }), + loop: ({ state: e }) => + e.arrowY > 10 ? { arrowY: -10 } : { arrowY: e.arrowY + 0.3 }, + render: ({ state: e }) => [ + r({ + path: [ + [-16, 0], + [-16, 20], + [16, 20], + [16, 0], + [40, 0], + [0, -32], + [-40, 0], + [-16, 0], + [-16, 20], + ], + color: Ye, + thickness: 3, + fillColor: ve, + y: -5 + Math.abs(e.arrowY), + }), + ], + }), + Wf = 350, + qf = 280, + //*level previewer + $f = makeCustomSprite({ + init: () => ({ checkpointsOn: true }), + render({ + props: { + worldLevel: { + song: e, + levelName: name, + difficulty: t, + maxFrames: a, + comingSoon: i, + author: author, + }, + levelProgress: s, + playLevel: o, + arrow: c, + showHighScore: d, + showStartArrows: u, + }, + state: { checkpointsOn: h }, + updateState: p, + }) { + const g = s.checkpoints.didFinish + ? "100%" + : `${Math.floor((s.checkpoints.furthestFrame / a) * 100)}%`, + offset = 0, + m = s.noCheckpoints.didFinish + ? "100%" + : `${Math.floor((s.noCheckpoints.furthestFrame / a) * 100)}%`, + f = c.facingLeft ? 1 : -1, + y = e.bpm < 120 ? 1 : e.bpm < 140 ? 2 : e.bpm < 170 ? 3 : 4, + E = hl.getSnippetName(e.fileName); + return [ + Clickable({ + id: "ClickInside", + width: Wf, + height: qf, + sprites: () => [], + onPress: () => null, + }), + We({ color: Re, width: 360, height: 290, y: -5, x: 5 * f }), + We({ color: ve, width: Wf, height: qf }), + r({ + fillColor: Re, + path: [ + [0, c.y], + [10 * -f, c.y + 10], + [10 * -f, c.y - 10], + ], + anchorX: 14 * -f, + x: (360 * f) / 2, + }), + n({ + font: { + size: 20, + align: "left", + baseline: "bottom", + weight: 800, + }, + text: (name).toUpperCase(), + color: Be, + x: -155, + y: 100, + }), + n({ + font: { + align: "left", + weight: 500, + baseline: "bottom", + style: "italic", + }, + text: author ? localize("level by") : localize("artist"), + color: Be, + x: -155, + y: 80, + }), + n({ + font: { + size: e.author.length > 20 ? 12 : 15, + align: "left", + weight: 600, + baseline: "bottom", + }, + text: author ? author : e.author, + color: Be, + x: -120 + (author ? 5 : 0), + y: 80, + }), + e.label + ? n({ + font: { + align: "right", + weight: 500, + baseline: "bottom", + style: "italic", + }, + text: e.label, + color: Be, + x: 155, + y: 80, + }) + : null, + r({ + thickness: 3, + color: Re, + path: [ + [-160, offset], + [95, offset], + ], + y: 70, + }), + l({ + fileName: `images/mainMenu/levelSelect/bpm/${y}.png`, + width: 64, + height: 36, + x: -110, + y: -5 + offset, + }), + n({ + font: { size: 15 }, + text: String(e.bpm), + color: Be, + x: -110, + y: 30 + offset, + strokeColor: Ce, + strokeThickness: 3, + }), + n({ + font: { weight: 500 }, + text: "BPM", + color: Be, + x: -110, + y: -40 + offset, + }), + l({ + fileName: `images/mainMenu/levelSelect/difficultyIconsModal/${Math.round( + Math.min(t, 10) + )}.png`, + width: 40, + height: 87, + anchorY: -40, + y: -30 + offset, + }), + n({ + font: { size: 15 }, + text: `${t}/10`, + color: Be, + y: 30 + offset, + strokeColor: Ce, + strokeThickness: 3, + }), + n({ + font: { weight: 500 }, + text: localize("DIFFICULTY"), + color: Be, + y: -40 + offset, + }), + l({ + fileName: `images/mainMenu/levelSelect/checkpointsIcon${s.checkpoints.didFinish ? "Complete" : "" + }.png`, + width: 48, + height: 45, + x: 85, + y: -5 + offset, + scaleX: h ? 1 : 0.7, + scaleY: h ? 1 : 0.7, + }), + l({ + fileName: `images/mainMenu/levelSelect/noCheckpointsIcon${s.noCheckpoints.didFinish ? "Complete" : "" + }.png`, + width: 62, + height: 46, + x: 135, + y: -5 + offset, + scaleX: h ? 0.7 : 1, + scaleY: h ? 0.7 : 1, + }), + n({ + font: { size: h ? 15 : 12 }, + text: g, + color: Be, + x: 85, + y: 30 + offset, + strokeColor: Ce, + strokeThickness: 3, + }), + n({ + font: { size: h ? 12 : 15 }, + text: m, + color: Be, + x: 135, + y: 30 + offset, + strokeColor: Ce, + strokeThickness: 3, + }), + n({ + font: { weight: 500 }, + text: localize("PROGRESS"), + color: Be, + x: 110, + y: -40 + offset, + }), + Tm({ + id: "CheckpointsButton", + text: localize("CHECKPOINTS"), + selected: h, + width: 170, + height: 40, + x: -60, + y: -90 + offset, + darkBg: true, + onPress: () => { + p((e) => + Object.assign(Object.assign({}, e), { + checkpointsOn: !e.checkpointsOn, + }), + ); + }, + }), + Fo({ + id: "PlayButton", + text: localize("PLAY"), + disabled: (!h && !s.checkpoints.didFinish) || i, + width: 70, + height: 40, + x: 100, + y: -90 + offset, + darkBg: true, + onPress: () => { + o(h); + }, + }), + u ? zf({ id: "LevelsHelp", x: 100, y: -30 }) : null, + i + ? n({ + text: localize("COMING SOON!"), + color: ve, + strokeColor: Ye, + strokeThickness: 3, x: 100, - }), - t.loading - ? n({ - text: `${localize("LOADING")}...`, - color: ve, - font: { size: 13 }, - y: -o / 2 + 40, - }) - : t.error - ? n({ - text: t.error, - color: Ve, - font: { size: 13 }, - y: -o / 2 + 40, - }) - : null, - ]; - }, - }); - function fy(e, t, a, i) { - return e - .map((e) => { - const n = e.level; - let s = n.name, - o = n.song.name, - r = n.song.author; - const l = () => - `${s} - ${o} ${localize("by")} ${r} - ${n.song.bpm} BPM`; - return ( - l().length > 60 && - ((r = cy.truncate(n.song.author, 10)), - l().length > 60 && - ((o = cy.truncate(n.song.name, 10)), - l().length > 60 && (s = cy.truncate(n.name, 10)))), - { - displayText: l(), - savedLevel: e, - canEdit: null === kp.canEditLevel(n, a, i, t), - } - ); - }) - .reverse(); - } - var yy = a(818); - const Ey = makeCustomSprite({ - render({ props: e, device: t }) { - const a = t.size.height + 2 * t.size.heightMargin, - i = t.size.width + 2 * t.size.widthMargin; - return [ - Fo({ - id: "BackButton", - text: "<-", - width: 40, - height: 30, - onPress: e.backToMainMenu, - x: -250, - y: a / 2 - 40, - }), - n({ - font: { size: 20 }, - text: "Test Cases", - color: "red", - y: a / 2 - 40, - }), - ScrollContainer({ - id: "ScrollContainer", - y: a / 2 - 80, - containerHeight: a - 80, - containerWidth: i, - contentHeight: 40 * yy.testCases.length + 20, - sprites: (t) => - yy.testCases.map((a, i) => - Fo({ - id: `BlockButton-${i}`, - width: 700, - height: 30, - text: a.name, - onPress: () => e.playTestCase(a), - y: -20 - 40 * i, - noPress: t, - }), - ), - }), - ]; - }, - }), - by = makeCustomSprite({ - init({ device: e }) { - e.audio("audio/menu/party-invite.wav").play(0); - }, - render({ props: e, device: { size: t } }) { - const { playerName: a, closeModal: i, confirm: s } = e, - r = t.height + 2 * t.heightMargin, - l = t.width + 2 * t.widthMargin; - return [ - o({ color: "black", opacity: 0.7, width: l, height: r }), - We({ width: 510, height: 160, color: Re, x: -5, y: -5 }), - We({ width: 500, height: 150, color: ve }), - n({ - text: `Party invite from ${cy.truncate(a, 18)}`, + y: -120 + offset, + }) + : null, + d + ? n({ + text: `${localize("HIGH SCORE")}: ${s.highScore.toLocaleString()}`, font: { size: 15 }, - color: Be, - y: 30, - }), - Fo({ - id: "CancelButton", - text: "IGNORE", - x: -75, + color: Te, + strokeColor: Ye, + strokeThickness: 3, + y: 55 + offset, + }) + : null, + h && s.bestAttempts + ? n({ + text: `${localize("PREVIOUS BEST")}: ${s.bestAttempts.toLocaleString()} ${localize("ATTEMPT")}${1 === s.bestAttempts ? "" : "S" + }`, + font: { size: 10, weight: 500, style: "italic" }, + color: Ye, + x: -60, + y: -120 + offset, + }) + : null, + Gf({ + id: `LoadSong-${E}`, + assets: { audioFileNames: [E] }, + sprites: [ + Ro.Single({ + id: `PreviewSong-${E}`, + fileName: E, + loop: false, + paused: false, + fromPosition: 0, + overwrite: true, + isGameSfx: false, + }), + ], + }), + ]; + }, + }), + Jf = makeCustomSprite({ + init: () => ({ selectedLevelIndex: null }), + render({ + props: e, + updateState: t, + device: a, + state: { selectedLevelIndex: i }, + }) { + const n = Hl.getWorld(e.world), + s = a.size.width + 2 * a.size.widthMargin, + o = a.size.height + 2 * a.size.heightMargin, + r = null === i ? null : n[i]; + return [ + Uf({ + id: "Title", + text: `${localize("WORLD")} ${e.world}`, + width: 200, + height: 35, + x: -s / 2 + 120, + y: o / 2 - 40, + }), + r && null !== i + ? jf({ + id: "InvisibleModal", + closeModal: () => { + (e.fadeInMusic(), + t((e) => + Object.assign(Object.assign({}, e), { + selectedLevelIndex: null, + }), + )); + }, + x: r.x - 225 * Math.sign(r.x - 1), y: -20, - width: 100, - height: 40, - darkBg: true, - onPress: i, - }), - Fo({ - id: "OkButton", - text: "JOIN PARTY!", - width: 150, - height: 40, - x: 75, + width: Wf, + height: qf, + }) + : null, + Kf({ + id: "MapView", + world: n, + worldProgress: e.worldProgress, + selectedWorldLevel: r, + onSelectLevel: (a) => { + (e.fadeOutMusic(), + t((e) => + Object.assign(Object.assign({}, e), { + selectedLevelIndex: a, + }), + )); + }, + showStartArrows: e.showStartArrows && null === r, + }), + r && null !== i + ? $f({ + id: `LevelView-${r.levelFileName}`, + worldLevel: r, + levelProgress: + e.worldProgress.find( + (e) => e.levelName === r.levelName, + ) || zl(e.world, i, r.levelName), + x: r.x - 225 * Math.sign(r.x - 1), y: -20, - darkBg: true, - onPress: s, - }), - ]; - }, - }), - Sy = makePureSprite({ - shouldRerender(e, t) { - if (null !== e.party && null !== t.party) { - if ( - e.party.members.length !== t.party.members.length || - e.party.id !== t.party.id - ) - return (t.onNewMember(), true); - } else if (e.party !== t.party) return true; - return ( - e.width !== t.width || - e.height !== t.height || - e.profile.playerName !== t.profile.playerName || - e.playerSkin.fileName !== t.playerSkin.fileName - ); + playLevel: (t) => { + e.playLevel(r, { + number: e.world, + levelIndex: i, + withCheckpoints: t, + }); + }, + arrow: { y: r.y, facingLeft: r.x >= 0 }, + showStartArrows: e.showStartArrows, + }) + : null, + Fo({ + id: "BackButton", + text: localize("BACK"), + width: 80, + height: 40, + onPress: () => { + (e.fadeInMusic(), e.onBack()); + }, + x: -s / 2 + 60, + y: -o / 2 + 40, + }), + ]; + }, + }), + Kf = makeCustomSprite({ + render({ + props: { + world: e, + worldProgress: t, + onSelectLevel: a, + selectedWorldLevel: i, + showStartArrows: n, }, - render({ - props: { - party: e, - width: t, - height: a, - profile: i, - playerSkin: s, - }, - }) { - const o = (null == e ? void 0 : e.members) || [ + }) { + const s = e.map((a, i) => { + const n = e[i], + s = t.find((e) => e.levelName === n.levelName); + return { + checkpointsComplete: + (null == s ? void 0 : s.checkpoints.didFinish) || false, + noCheckpointsComplete: + (null == s ? void 0 : s.noCheckpoints.didFinish) || false, + }; + }); + return [ + ...e.map(({ pathToLevel: e }) => + r({ color: ve, path: e, thickness: 3, lineCap: "round" }), + ), + ...e.map( + ( { - profileId: i.profileId, - playerName: i.playerName, - cxId: "", - skin: s, - rank: xu(i.xpPoints).rank, + levelFileName: e, + levelName: t, + unlockedByIndex: n, + x: o, + y: r, + difficulty: l, + boss: c, }, - ], - r = o.length > 1 && null !== e, - c = r ? 110 : 70, - d = cy.measureTexts( - o.map((e) => e.playerName), - { family: "Montserrat", size: 10, weight: 600 }, - ), - u = t - 45; - return [ - We({ - width: c, - height: 30, - color: Re, - x: 3 - t / 2 + c / 2, - y: a / 2 - 20, - }), - We({ - width: c, - height: 30, - color: Be, - x: -t / 2 + c / 2, - y: a / 2 - 20, - }), - n({ - text: r && e ? `PARTY ${o.length}/${e.maxMembers}` : "PARTY", - font: { size: 15, align: "left" }, - color: ve, - x: -t / 2 + 10, - y: a / 2 - 20, - }), - We({ color: Re, width: t, height: a - 31, x: 3, y: -20 }), - We({ color: Be, width: t, height: a - 30, y: -20 }), - ...o.flatMap((o, r) => { - const c = o.profileId === i.profileId, - h = (null == e ? void 0 : e.ownerId) === o.profileId, - p = c - ? i.playerName || i.profileId - : o.playerName || o.profileId, - g = c ? s : o.skin, - m = d[r], - f = a / 2 - 50 - 20 * r; - return [ - n({ - text: String(o.rank), - font: { size: 15 }, - color: ve, - x: -t / 2 + 15, - y: f, + d, + ) => { + const { checkpointsComplete: u, noCheckpointsComplete: h } = + s[d], + p = + null !== n && + !s[n].checkpointsComplete && + !s[n].noCheckpointsComplete && + true; + return Qf({ + id: `LevelButton-${e}`, + levelName: t, + checkpointsComplete: u, + noCheckpointsComplete: h, + difficulty: l, + isBoss: Boolean(c), + selected: (null == i ? void 0 : i.levelName) === t, + x: o, + y: r, + locked: false, //p, + onPress: () => a(d), + }); + }, + ), + n ? zf({ id: "LevelsHelp", x: e[0].x, y: e[0].y + 70 }) : null, + ]; + }, + }), + Qf = makeCustomSprite({ + render({ props: e }) { + let t = "", + a = 0, + i = 0; + return ( + e.locked + ? ((t = "Level_Locked.png"), (a = 45), (i = 73.5)) + : ((t = `difficultyIcons/${e.difficulty}.png`), + (a = 48), + (i = 121.5)), + [ + Clickable({ + id: "Clickable", + width: 60, + height: 160, + onPress: e.onPress, + disabled: e.locked, + sprites: () => [ + Uo({ + id: "SelectedLevelFade", + shouldShow: e.selected, + sprite: (e) => [ + l({ + fileName: + "images/mainMenu/levelSelect/difficultyIcons/background.png", + width: 73.5, + height: 136.5, + y: 25, + opacity: e, + }), + ], }), l({ - width: g.size / 3, - height: g.size / 3, - fileName: `images/player/skins/${g.fileName}.png`, - rotation: 45, - x: -t / 2 + 35, - y: f, + fileName: `images/mainMenu/levelSelect/${t}`, + width: a, + height: i, + anchorY: -i / 2, + y: -30, }), - n({ - text: - m > u - ? cy.truncate( - p, - Math.floor(Math.round(p.length * (u / m))) - 1, - ) - : p, - color: h ? ke : ve, - font: { align: "left", weight: 600 }, - x: -t / 2 + 45, - y: f, + e.locked + ? null + : n({ + text: e.levelName.toUpperCase(), + color: Oe, + font: { weight: 500 }, + y: -45, + }), + e.isBoss && !e.locked + ? n({ + text: "BOSS", + color: Oe, + font: { weight: 800 }, + y: -58, + }) + : null, + ], + }), + e.checkpointsComplete + ? l({ + fileName: "images/mainMenu/levelSelect/Star01.png", + width: 20, + height: 20, + x: -20, + y: 15 + 5 * e.difficulty * 1.5, + }) + : null, + e.noCheckpointsComplete + ? l({ + fileName: "images/mainMenu/levelSelect/Star02.png", + width: 20, + height: 20, + x: 20, + y: 15 + 5 * e.difficulty * 1.5, + }) + : null, + ] + ); + }, + }), + Zf = makeCustomSprite({ + init({ updateState: e, device: t, getContext: a }) { + const { online: i } = a(Se); + return ( + i && + bp + .getBuyableItems(i.backend) + .then((t) => { + e((e) => + Object.assign(Object.assign({}, e), { + passItem: + t.find( + (e) => "bonus_level_super_level_pack" === e.defId, + ) || "loading", }), - ]; + ); + }) + .catch((e) => { + t.alert.ok( + `Couldn't retrieve items from store: ${e.message}`, + ); + }), + { + passItem: "loading", + showBuyBlocksModal: null, + isPurchasing: false, + } + ); + }, + render({ + props: { didBuy: e, song: t }, + state: { showBuyBlocksModal: a, isPurchasing: i, passItem: s }, + device: o, + updateState: c, + getContext: d, + }) { + const u = null !== t, + h = t ? hl.getSnippetName(t.fileName) : null, + p = [ + We({ color: Re, width: 360, height: 290, y: -5, x: -5 }), + We({ color: ve, width: Wf, height: qf }), + u + ? r({ + fillColor: Re, + path: [ + [0, 0], + [10, 10], + [10, -10], + ], + anchorX: 14, + x: -180, + }) + : null, + l({ + fileName: `images/superLevelPack/${(null == t ? void 0 : t.name) || "Default" + }.png`, + x: -75, + y: 10, + width: 180, + height: 113, }), - ]; - }, - }), - Iy = makePureSprite({ - shouldRerender: (e, t) => - e.rank !== t.rank || e.rankPercent !== t.rankPercent, - render: ({ props: { width: e, rank: t, rankPercent: a } }) => [ - n({ - text: String(t), - color: ve, - font: { size: 22, align: "left", weight: 800 }, - x: -e / 2 + 47, - y: 8, - }), - n({ - text: "LEVEL", - color: ve, - font: { size: 10, align: "left", weight: 800 }, - x: -e / 2 + 10, - y: 5, - }), - o({ width: e - 20, height: 8, color: Ue, y: -10 }), - o({ - width: (e - 20) * a, - height: 8, - color: Te, - anchorX: (-(e - 20) * a) / 2, - x: -e / 2 + 10, - y: -10, - }), - ], - }), - _y = makeSprite({ - render: ({ props: e }) => [ - c( - { - color: Re, - strokeColor: Ye, - strokeThickness: 8, - font: { size: 30, align: "left", weight: 800 }, - x: -e.width / 2 - 10, - y: 45, - }, - (t) => { - t.text = `LEVEL ${e.rank}`; - }, - ), - m({ - color: Ye, - thickness: 22, - lineCap: "round", - path: [ - [-e.width / 2, 0], - [e.width / 2, 0], - ], - }), - m({ - color: Le, - thickness: 12, - lineCap: "round", - path: [ - [-e.width / 2, 0], - [e.width / 2, 0], - ], - }), - m( - { - color: Re, - thickness: 12, - lineCap: "round", + r({ + fillColor: ve, path: [ - [-e.width / 2, 0], - [-e.width / 2 + e.width * e.rankPercent, 0], + [-165, 66.5], + [-145, 66.5], + [-165, 46.5], ], - }, - (t) => { - t.path[1][0] = -e.width / 2 + e.width * e.rankPercent; - }, - ), - ], - }), - vy = makeCustomSprite({ - init({ props: e }) { - const { rank: t, rankPercent: a } = xu(e.profile.xpPoints); - return { - playerName: e.profile.playerName, - rank: t, - rankPercent: a, - updateName: null, - mockPlayerX: 0, - }; - }, - loop: ({ state: e }) => - Object.assign(Object.assign({}, e), { - mockPlayerX: e.mockPlayerX + 5, - }), - render({ - props: { - width: e, - height: t, - profile: a, - textInputX: i, - updatePlayerName: s, - playerSkin: o, - }, - state: { - playerName: r, - rank: l, - rankPercent: c, - updateName: d, - mockPlayerX: u, - }, - updateState: h, - getContext: p, - }) { - const g = r.trim(), - m = g.length > 20; - return [ - We({ - width: 110, - height: 30, - color: Re, - x: 3 - e / 2 + 55, - y: t / 2 - 20, }), - We({ - width: 110, - height: 30, + r({ + fillColor: ve, + path: [ + [15, -46.5], + [15, -26.5], + [-5, -46.5], + ], + }), + n({ + font: { size: 20 }, + text: u ? "UNLOCKED WITH THE" : "GET THE", color: Be, - x: -e / 2 + 55, - y: t / 2 - 20, + y: 115, }), n({ - text: localize("PROFILE"), - font: { size: 15 }, - color: ve, - x: -e / 2 + 55, - y: t / 2 - 20, + font: { size: 20 }, + text: "SUPER LEVEL PACK", + color: Be, + y: 90, }), - We({ color: Re, width: e, height: t - 31, x: 3, y: -20 }), - We({ color: Be, width: e, height: t - 30, y: -20 }), - Iy({ - id: "LevelBar", - width: e, - rank: l, - rankPercent: c, - y: t / 2 - 65, + n({ + font: { size: 12 }, + text: "INCLUDES LEVELS", + color: Be, + x: 95, + y: 55, }), - MockPlayerTrail.Single({ - id: "PlayerTrail", - skin: o, - mockPlayerX: u, - globalContextVal: p(Se), - isFront: false, + n({ + font: { size: 12 }, + text: "FOR YOU", + color: t === hl.songs.forYou ? He : Me, + x: 95, + y: 35, }), - To.Single({ id: "Player", skin: o, x: 20 }), - MockPlayerTrail.Single({ - id: "PlayerTrail", - skin: o, - mockPlayerX: u, - globalContextVal: p(Se), - isFront: true, + n({ + font: { size: 12 }, + text: "COOL FRIENDS", + color: t === hl.songs.coolFriends ? He : Me, + x: 95, + y: 15, }), - P({ - id: "Username", - fontName: "Montserrat", - fontSize: 15, - text: r, - onChangeText: (e) => { - h((t) => - Object.assign(Object.assign({}, t), { - playerName: e, - updateName: null, - }), - ); - }, - width: e - 20, - x: i, - y: -t / 2 + 105, - align: "left", + n({ + font: { size: 12 }, + text: "NACREOUS SNOWMELT", + x: 95, + color: t === hl.songs.nacreousSnowmelt ? He : Me, + y: -5, }), - null, - null !== d || m - ? n({ - text: m - ? "Too long" - : "updating" === d - ? "Updating..." - : "error" === d - ? "Failed" - : "", - color: Ve, - x: e / 2 - 40, - y: -t / 2 + 40, - }) - : g !== a.playerName && g.length > 0 - ? Fo({ - id: "UpdateName", - text: "UPDATE", - fontSize: 12, - width: 70, - height: 30, - x: e / 2 - 45, - y: -t / 2 + 40, - onPress: () => { - (h((e) => - Object.assign(Object.assign({}, e), { - updateName: "updating", - }), - ), - s(g) - .then(() => { - h((e) => - Object.assign(Object.assign({}, e), { - updateName: null, - }), - ); - }) - .catch(() => { - h((e) => - Object.assign(Object.assign({}, e), { - updateName: "error", - }), - ); - })); - }, - }) - : null, n({ - text: `ID ${a.profileId.slice(0, 8)}`, - color: ve, - font: { size: 12, align: "left", weight: 800 }, - x: -e / 2 + 10, - y: -t / 2 + 40, + font: { size: 12 }, + text: "AURA", + color: t === hl.songs.aura ? He : Me, + x: 95, + y: -25, }), - ]; - }, - }), - Ty = makeCustomSprite({ - init: () => ({ mockPlayerX: 0 }), - loop: ({ state: e }) => - Object.assign(Object.assign({}, e), { - mockPlayerX: e.mockPlayerX + 5, + h + ? Gf({ + id: `LoadSong-${h}`, + assets: { audioFileNames: [h] }, + sprites: [ + Ro.Single({ + id: `PreviewSong-${h}`, + fileName: h, + loop: false, + paused: false, + fromPosition: 0, + overwrite: true, + isGameSfx: false, + }), + ], + }) + : null, + ], + { online: g } = d(Se); + if (!g) return [...p, _m({ id: "GoOnline", y: -90 })]; + const { + blocksBalance: m, + backend: f, + updateBlocksBalance: y, + } = g, + E = (t) => { + bp.buyItem(f, t) + .then( + ({ balance: t, item: a }) => ( + y(t), + "bonusLevelItem" === a.type && e(a), + o.audio("audio/global/purchase-item.wav").play(), + Jp.addPurchasedItems([a], o.now) + ), + ) + .catch((e) => { + o.alert.ok(`Error buying item: ${e.message}`); + }) + .finally(() => { + c((e) => + Object.assign(Object.assign({}, e), { + isPurchasing: false, + }), + ); + }); + }; + return [ + ...p, + n({ + text: `BLOCKS: ${m}`, + color: ve, + strokeColor: Ye, + font: { size: 12 }, + strokeThickness: 4, + x: 120, + y: -55, }), - render: ({ - props: { width: e, height: t, playerSkin: a }, - state: { mockPlayerX: i }, - getContext: s, - }) => [ - We({ - width: 110, - height: 30, - color: Re, - x: 3 - e / 2 + 55, - y: t / 2 - 20, + Fo({ + id: "Add Blocks", + text: "+", + fontSize: 24, + width: 50, + height: 50, + onPress: () => { + c((e) => + Object.assign(Object.assign({}, e), { + showBuyBlocksModal: {}, + }), + ); + }, + x: 120, + y: -95, + strokeColor: Ye, + textColor: ve, + textStroke: Ye, + textStrokeThickness: 6, }), - We({ - width: 110, - height: 30, - color: Be, - x: -e / 2 + 55, - y: t / 2 - 20, + ...("loading" === s + ? [ + n({ + text: `${localize("LOADING")}...`, + font: { size: 20 }, + color: Ye, + x: -50, + y: -90, + }), + ] + : i + ? [ + n({ + text: `${localize("PURCHASING")}...`, + font: { size: 20 }, + color: Ye, + x: -50, + y: -90, + }), + ] + : [ + Fo({ + id: "BuyPack", + text: `BUY - ${s.blocksPrice} BLOCKS`, + width: 200, + height: 60, + onPress: () => { + (c((e) => + Object.assign(Object.assign({}, e), { + isPurchasing: true, + }), + ), + s.blocksPrice > m + ? c((e) => + Object.assign(Object.assign({}, e), { + showBuyBlocksModal: { + buyItemOnComplete: s, + }, + }), + ) + : E(s)); + }, + x: -50, + y: -90, + strokeColor: Ye, + textColor: ve, + textStroke: Ye, + textStrokeThickness: 4, + }), + ]), + a && + bm({ + id: "BuyBlocksModal", + x: -155, + onModalClose: () => { + c((e) => + Object.assign(Object.assign({}, e), { + showBuyBlocksModal: null, + isPurchasing: false, + }), + ); + }, + onPurchaseComplete: (e) => { + (a.buyItemOnComplete && + e >= a.buyItemOnComplete.blocksPrice && + E(a.buyItemOnComplete), + y(e), + c((e) => + Object.assign(Object.assign({}, e), { + showBuyBlocksModal: null, + }), + )); + }, }), - n({ - text: localize("PROFILE"), - font: { size: 15 }, - color: ve, - x: -e / 2 + 55, - y: t / 2 - 20, + ]; + }, + }), + ey = makeCustomSprite({ + init: ({ updateState: e, preloadFiles: t, device: a }) => ( + Promise.all([ + Jp.getUserItems("bonusLevel"), + Jp.getLocal(a.storage), + t({ imageFileNames: Qs.superLevelPackImages }), + ]).then(([t, i]) => { + (i.data.hasVisitedSuperLevelPack || + Jp.saveLocal(a.storage, a.alert, a.now, { + hasVisitedSuperLevelPack: true, + }), + e((e) => + Object.assign(Object.assign({}, e), { levelItems: t }), + )); + }), + { selectedLevelIndex: null, levelItems: "loading" } + ), + render({ + props: e, + device: { + size: { fullHeight: t, fullWidth: a }, + }, + state: { selectedLevelIndex: i, levelItems: s }, + updateState: o, + }) { + const r = [ + Uf({ + id: "Title", + text: localize("BONUS LEVELS"), + width: 200, + height: 35, + x: -a / 2 + 120, + y: t / 2 - 40, }), - We({ color: Re, width: e, height: t - 31, x: 3, y: -20 }), - We({ color: Be, width: e, height: t - 30, y: -20 }), - MockPlayerTrail.Single({ - id: "PlayerTrailBack", - skin: a, - mockPlayerX: i, - globalContextVal: s(Se), - isFront: false, + Fo({ + id: "BackButton", + text: localize("BACK"), + width: 80, + height: 40, + onPress: () => { + (e.fadeInMusic(), e.onBack()); + }, + x: -a / 2 + 60, + y: -t / 2 + 40, }), - To.Single({ id: "Player", skin: a, x: 20 }), - MockPlayerTrail.Single({ - id: "PlayerTrail", - skin: a, - mockPlayerX: i, - globalContextVal: s(Se), - isFront: true, + ]; + if ("loading" === s) + return [ + ...r, + n({ + text: `${localize("LOADING")}...`, + color: ve, + font: { size: 15 }, + }), + ]; + const l = null === i ? null : Hl.bonusLevels[i], + c = null !== l && ty(l, s), + d = !zu.hasIAP() || s.some((e) => "superLevelPack" === e.name), + u = t - 156, + h = (e) => { + o((t) => + "loading" === t.levelItems + ? t + : Object.assign(Object.assign({}, t), { + levelItems: [...t.levelItems, e], + selectedLevelIndex: + null === t.selectedLevelIndex + ? 1 + : t.selectedLevelIndex, + }), + ); + }; + return [ + We({ + color: ve, + width: 280, + height: u + 6, + x: -190, + strokeColor: Ye, + strokeThickness: 6, }), - /*n({ - text: "OFFLINE", - font: { size: 15 }, - color: Ve, - y: -t / 2 + 80, + null !== i + ? jf({ + id: "InvisibleModal", + closeModal: () => { + (e.fadeInMusic(), + o((e) => + Object.assign(Object.assign({}, e), { + selectedLevelIndex: null, + }), + )); + }, + x: 155, + width: Wf, + height: qf, + }) + : null, + ScrollContainer({ + id: "ScrollContainer", + containerHeight: u, + containerWidth: 250, + contentHeight: 80 * Math.ceil(Hl.bonusLevels.length) + 30, + y: u / 2, + x: -190, + sprites: (t) => [ + ...Hl.bonusLevels.map((a, n) => { + const r = !ty(a, s); + return ay({ + id: `Lvl-${n}`, + song: a.song, + + name: a.levelName, + author: a.author, + locked: r, + selected: i === n, + onPress: () => { + (e.fadeOutMusic(), + o((e) => + Object.assign(Object.assign({}, e), { + selectedLevelIndex: n, + }), + )); + }, + y: -50 - 80 * n, + noPress: t, + }); + }), + ], }), - _m({ id: "GoOnline", y: -t / 2 + 40 }),*/ - ], - }), - MockPlayerTrail = makeSprite({ - render: ({ props: e }) => [ - Se.Single({ - context: () => e.globalContextVal, - sprites: [ - playerTrail.Single( - { - x: 20 - e.mockPlayerX, - playerX: e.mockPlayerX, - playerY: 0, - playerDir: 1, - crashed: false, - paused: false, - skin: e.skin, - isFront: e.isFront, - playerScale: 1, - playerSpeedMultiplier: 1, - }, - (t) => { - ((t.x = 20 - e.mockPlayerX), - (t.playerX = e.mockPlayerX), - (t.skin = e.skin)); + ...r, + l && null !== i + ? true // c + ? $f({ + id: `LevelView-${l.levelFileName}`, + worldLevel: l, + levelProgress: + e.worldProgress.find( + (e) => e.levelName === l.levelName, + ) || zl(0, i, l.levelName), + x: 155, + playLevel: (t) => { + e.playLevel(l, { + number: 0, + levelIndex: i, + withCheckpoints: t, + }); }, - ), + arrow: { y: 0, facingLeft: false }, + showHighScore: + "carnival" === l.levelFileName || + "funky-adventures" === l.levelFileName, + showStartArrows: false, + }) + : "cloud-9" === l.levelFileName + ? iy({ id: "LockedModal", x: 155, song: l.song }) + : Zf({ + id: "BuySuperLevelPackModal", + x: 155, + song: l.song, + didBuy: h, + }) + : d + ? null + : Zf({ + id: "BuySuperLevelPackModal", + x: 155, + song: null, + didBuy: h, + }), + ]; + }, + }); + function ty(e, t) { + return "cloud-9" === e.levelFileName + ? t.some((e) => "cloud9" === e.name) + : !zu.hasIAP() || t.some((e) => "superLevelPack" === e.name); + } + const ay = makeCustomSprite({ + render({ + props: { + song: e, + name: name, + author: author, + selected: t, + locked: a, + onPress: i, + noPress: s, + }, + device: o, + }) { + let r = e.author.toLocaleUpperCase(); + return ( + r.length > 15 && (r = `${r.slice(0, 15)}...`), + [ + Clickable({ + id: "Clickable", + width: 240, + height: 65, + onPress: () => { + (o.audio("audio/global/button.wav").play(0), i()); + }, + disabled: s, + sprites: (i) => [ + So({ + id: "RaiseRects", + width: 240, + height: 65, + raiseHeight: 5, + rad: 5, + isPressed: i, + topColour: i ? ke : t ? Re : Le, + bottomColour: Ue, + stroke: { thickness: 2, colour: Ye }, + shadowDir: "down", + sprites: (t) => [ + n({ + font: { size: 15 }, + text: name.toLocaleUpperCase(), + color: Ue, + y: t + 8, + }), + n({ + font: { size: 15, weight: 500, style: "italic" }, + text: `${localize('by')} ${author ? author : r}`, + color: Ue, + y: t - 10, + }), + false //a + ? l({ + fileName: "images/mainMenu/lockIcon.png", + width: 40, + height: 40, + x: 90, + y: t, + }) + : null, + ], + }), ], }), - ], - }), - Oy = makeCustomSprite({ - init: () => ({ view: { type: "start" } }), - render({ - props: e, - state: { view: t }, - updateState: a, - device: i, - }) { - const { - onStart: s, - hasParty: o, - partySize: r, - width: l, - height: c, - } = e, - d = "isLeader" !== o || r <= 1, - u = "no" === o || r <= 1, - h = "notLeader" === o; - if ("pickFriendsMode" === t.type && !h) { - const { - selectedLevel: i, - availableLevels: o, - withCheckpoints: r, - } = t; - return [ - Fo({ - id: "BackButton", - text: localize("BACK"), - width: 80, - height: 40, - darkBg: true, - onPress: () => { - (e.fadeInMusic(), - a((e) => - Object.assign(Object.assign({}, e), { - view: { type: "start" }, - }), - )); - }, - x: -l / 2 + 50, - y: -c / 2 + 30, + ] + ); + }, + }), + iy = makeCustomSprite({ + render({ props: { song: e } }) { + const t = e ? hl.getSnippetName(e.fileName) : null; + return [ + We({ color: Re, width: 360, height: 290, y: -5, x: -5 }), + We({ color: ve, width: Wf, height: qf }), + r({ + fillColor: Re, + path: [ + [0, 0], + [10, 10], + [10, -10], + ], + anchorX: 14, + x: -180, + }), + ...(zu.hasIAP() + ? [ + n({ + font: { size: 15 }, + text: "UNLOCKED WITH THE", + color: Be, + y: 35, }), - Tm({ - id: "CheckpointsCheckbox", - text: localize("CHECKPOINTS"), - selected: r, - darkBg: true, - width: 170, - height: 40, - y: -c / 2 + 30, - onPress: () => { - a((e) => - "pickFriendsMode" !== e.view.type - ? e - : Object.assign(Object.assign({}, e), { - view: Object.assign(Object.assign({}, e.view), { - withCheckpoints: !e.view.withCheckpoints, - }), - }), - ); - }, + n({ + font: { size: 15 }, + text: "ACHIEVEMENT PASS:", + color: Be, + y: 15, }), - Fo({ - id: "StartButton", - text: "START", - width: 80, - height: 40, - darkBg: true, - disabled: null === i, - onPress: () => { - null !== i && - (e.fadeInMusic(), - s({ - type: "party", - withCheckpoints: r, - levelFileName: i.fileName, - })); - }, - x: l / 2 - 50, - y: -c / 2 + 30, + n({ + font: { size: 15 }, + text: "BEAT DRAGONFLY", + color: Me, + y: -15, }), - ...(null !== i - ? [ - Gf({ - id: `LoadSong-${i.snippetFileName}`, - assets: { audioFileNames: [i.snippetFileName] }, - sprites: [ - Ro.Single({ - id: `PreviewSong-${i.snippetFileName}`, - fileName: i.snippetFileName, - loop: false, - paused: false, - fromPosition: 0, - overwrite: true, - isGameSfx: false, - }), - ], - }), - ] - : []), - "loading" === o - ? n({ text: `${localize("LOADING")}...`, color: Be }) - : ScrollContainer({ - id: "ScrollContainer", - containerWidth: l, - containerHeight: c - 80, - contentHeight: 40 * o.length, - y: 20 + (c - 80) / 2, - sprites: (t) => - o.map( - ( - { - levelName: n, - fileName: s, - snippetFileName: o, - author: r, - }, - c, - ) => - Ar({ - id: `AvailableLevel-${c}`, - text: `${n} ${localize("by")} ${r}`, - width: l - 20, - height: 30, - y: 40 * -c - 20, - noPress: t, - selected: - (null == i ? void 0 : i.fileName) === s, - colorLeft: xe, - colorMid: xe, - colorRight: Ue, - selectedColorLeft: Re, - selectedColorMid: Re, - selectedColorRight: Ue, - onPress: () => { - (e.fadeOutMusic(), - a((e) => - "pickFriendsMode" !== e.view.type - ? e - : Object.assign(Object.assign({}, e), { - view: Object.assign( - Object.assign({}, e.view), - { - selectedLevel: { - fileName: s, - snippetFileName: o, - }, - }, - ), - }), - )); - }, - }), - ), - }), - ]; - } - if ("pickLocalLevel" === t.type) { - const e = [ - ...Hl.getWorlds() - .flat() - .filter((e) => !e.boss), - { levelName: "Test", levelFileName: "test-level" }, - { - levelName: "Test LBS", - levelFileName: "test-level-last-block-standing", - }, - ]; - return [ - ScrollContainer({ - id: "ScrollContainer", - containerWidth: l, - containerHeight: c - 80, - contentHeight: 40 * e.length, - y: 20 + (c - 80) / 2, - sprites: (t) => - e.map(({ levelName: e, levelFileName: a }, i) => - Fo({ - id: `AvailableLevel-${i}`, - text: e, - width: l - 20, - height: 30, - y: 40 * -i - 20, - noPress: t, - onPress: () => { - s({ type: "local", levelFileName: a }); - }, - }), - ), + n({ + font: { size: 15 }, + text: "WITHOUT CHECKPOINTS", + color: Me, + y: -35, + }), + ] + : [ + n({ + font: { size: 15 }, + text: "BEAT DRAGONFLY", + color: Me, + y: 20, + }), + n({ + font: { size: 15 }, + text: "WITHOUT CHECKPOINTS", + color: Me, + }), + n({ + font: { size: 15 }, + text: "TO UNLOCK", + color: Me, + y: -20, + }), + ]), + t + ? Gf({ + id: `LoadSong-${t}`, + assets: { audioFileNames: [t] }, + sprites: [ + Ro.Single({ + id: `PreviewSong-${t}`, + fileName: t, + loop: false, + paused: false, + fromPosition: 0, + overwrite: true, + isGameSfx: false, + }), + ], + }) + : null, + ]; + }, + }), + ny = makeCustomSprite({ + render: ({ + props: { + sprites: e, + width: t, + height: a, + radius: i, + bottomColour: n, + strokeColour: s, + strokeThickness: o, + onPress: r, + }, + device: l, + }) => [ + Clickable({ + id: "Clickable", + width: t, + height: a, + onPress: () => { + (l.audio("audio/global/button.wav").play(0), r()); + }, + sprites: (r) => [ + So({ + id: "RaiseRects", + width: t, + height: a, + raiseHeight: 5, + rad: i, + isPressed: r, + topColour: r ? ke : Re, + bottomColour: n, + stroke: { thickness: o, colour: s }, + shadowDir: "down", + sprites: e, + }), + ], + }), + ], + }), + sy = makeCustomSprite({ + init: ({ device: e, updateState: t }) => ( + Promise.all([ + Jp.getAccount(e.storage, null, e.alert), + Jp.getLocal(e.storage), + ]).then( + ([ + { + data: { levelsProgress: e, lastOpenedWorld: a }, + }, + i, + ]) => { + t((t) => + Object.assign(Object.assign({}, t), { + isLoading: false, + levelsProgress: e, + world: a, + hasVisitedSuperLevelPack: i.data.hasVisitedSuperLevelPack, }), - ]; - } + ); + }, + ), + { + isLoading: true, + levelsProgress: [], + world: 1, + hasVisitedSuperLevelPack: false, + } + ), + loop({ getInputs: e, state: t }) { + const a = e(); + return t.world > 1 && a.keysJustPressed.ArrowLeft + ? Object.assign(Object.assign({}, t), { world: t.world - 1 }) + : t.world < 4 && a.keysJustPressed.ArrowRight + ? Object.assign(Object.assign({}, t), { world: t.world + 1 }) + : t; + }, + render({ props: e, state: t, device: a, updateState: i }) { + const o = a.size.width + 2 * a.size.widthMargin, + l = a.size.height + 2 * a.size.heightMargin; + if (t.isLoading) return [ - h - ? n({ - text: "Waiting for party leader to start", - color: Be, - y: c / 2 - 30, - font: { size: 15 }, - }) - : null, - Fo({ - id: "StartRoyale", - text: "ROYALE", - width: 160, - fontSize: 20, - x: -90, - y: 30, - height: 50, - darkBg: true, - disabled: h, - onPress: () => s({ type: "royale" }), - }), - n({ - text: "Race online with up to", - color: Be, - font: { align: "left", weight: 800, size: 12 }, - x: -170, - y: -20, - }), - n({ - text: "60 players", - color: Be, - font: { align: "left", weight: 800, size: 12 }, - x: -170, - y: -35, - }), - Fo({ - id: "StartFriends", - text: "PARTY PLAY", - width: 160, - x: 90, - y: 30, - height: 50, - fontSize: 20, - darkBg: true, - disabled: d || h, - onPress: () => { - (a((e) => - Object.assign(Object.assign({}, e), { - view: { - type: "pickFriendsMode", - availableLevels: "loading", - withCheckpoints: true, - selectedLevel: null, - }, - }), - ), - Jp.getAccount(i.storage, null, i.alert).then( - ({ data: { levelsProgress: e } }) => { - a((t) => - Object.assign(Object.assign({}, t), { - view: { - type: "pickFriendsMode", - availableLevels: Wl(e), - withCheckpoints: true, - selectedLevel: null, - }, - }), - ); - }, - )); - }, - }), - n({ - text: u - ? "Add friends to your party" - : "Race against your party", - color: Be, - font: { align: "left", weight: 800, size: 12 }, - x: 10, - y: -20, - }), n({ - text: u ? "to race against them" : "to the end of the level", - color: Be, - font: { align: "left", weight: 800, size: 12 }, - x: 10, - y: -35, + text: `${localize("LOADING")}...`, + color: ve, + font: { size: 15 }, }), - null, - null, ]; - }, - }), - Cy = makeCustomSprite({ - init: () => ({ timeWithServer: 0 }), - loop: ({ props: e, state: t }) => - e.hasServer ? { timeWithServer: t.timeWithServer + 1 } : t, - render({ props: e, state: t }) { - const { - maxPlayers: a, - numPlayers: i, - isFriends: s, - hasServer: o, - } = e; - let r = "", - l = ""; - return ( - o && - (t.timeWithServer > 900 - ? ((r = "Launching new server..."), - (l = "(this may take longer than usual)")) - : (r = "Preparing game...")), - s - ? o || (r = "Finding server...") - : o || - (a === i - ? (r = "Players found, finding server...") - : ((r = "Finding players..."), a && (l = `${i}/${a}`))), - [ - n({ text: r, font: { size: 15 }, color: Be }), - l - ? n({ text: l, font: { size: 13 }, color: Be, y: -25 }) - : null, - ] - ); - }, - }); - const wy = makeCustomSprite({ - init: () => ({ - selectedFriend: null, - justInvitedIds: [], - view: "showFriends", - }), - render({ - props: { - width: e, - height: t, - friends: a, - friendRequests: i, - textInputX: s, - inPartyIds: o, - hasParty: r, - playState: l, - inviteToParty: c, - addFriend: d, - removeFriend: u, - removeFriendRequest: h, - profile: p, - }, - state: { selectedFriend: g, justInvitedIds: m, view: f }, - updateState: y, - device: E, - getContext: b, - }) { - if ("addFriend" === f) - return [ - Ay({ - id: "FindFriendsView", - profile: p, - width: e, - height: t, - goBack: () => { - y((e) => - Object.assign(Object.assign({}, e), { - view: "showFriends", - }), - ); + const c = e.view; + if ("inWorld" === c.type) { + const a = c.world, + i = t.levelsProgress.filter((e) => e.world === a); + return 0 === a + ? [ + ey({ + id: "BonusLevelsMenu", + playLevel: e.playLevel, + worldProgress: i, + onBack: () => { + e.updateView({ type: "worldsList" }); }, - textInputX: s, + fadeInMusic: e.fadeInMusic, + fadeOutMusic: e.fadeOutMusic, }), - ]; - if ("showFriendRequests" === f) - return [ - ky({ - id: "FriendsRequestsView", - friendRequests: i, - profile: p, - width: e, - height: t, - addFriend: d, - removeFriendRequest: h, - goBack: () => { - y((e) => - Object.assign(Object.assign({}, e), { - view: "showFriends", - }), - ); + ] + : [ + Jf({ + id: `WorldMap-${a}`, + world: a, + worldProgress: i, + playLevel: e.playLevel, + onBack: () => { + e.updateView({ type: "worldsList" }); }, + fadeInMusic: e.fadeInMusic, + fadeOutMusic: e.fadeOutMusic, + showStartArrows: e.showStartArrows, }), ]; - const S = null !== g && m.includes(g.profileId); - return [ - 0 === a.length - ? n({ - color: Be, - text: "Add friends to play together!", - font: { size: 12 }, - }) - : ScrollContainer({ - id: "FriendsList", - containerWidth: e, - containerHeight: t - 70, - contentHeight: 40 * a.length, - y: 25 + (t - 70) / 2, - sprites: (t) => - a.flatMap((a, i) => { - const n = 40 * -i - 20; - return [ - Ar({ - id: `Friend-${i}`, - text: `${a.playerName} - ID ${a.profileId.slice( - 0, - 8, - )}`, - width: e - 20, - height: 30, - y: n, - noPress: t, - selected: - (null == g ? void 0 : g.profileId) === - a.profileId, - colorLeft: Pe, - colorMid: Pe, - colorRight: Be, - selectedColorLeft: Re, - selectedColorMid: Re, - selectedColorRight: Be, - onPress: () => { - y((e) => - Object.assign(Object.assign({}, e), { - selectedFriend: a, - }), - ); - }, + } + const d = Hl.getWorlds(), + u = d.filter((e, a) => { + if (0 === a) return true; + const i = a, + n = d[a - 1].length; + return t.levelsProgress.some( + (e) => + e.world === i && + e.levelIndex === n - 1 && + (e.checkpoints.didFinish || e.noCheckpoints.didFinish), + ); + }), + h = t.world; + return [ + Fo({ + id: "BackButton", + text: localize("BACK"), + width: 80, + height: 40, + onPress: e.backToMainMenu, + x: -o / 2 + 60, + y: -l / 2 + 40, + }), + oy({ + id: "WorldButton", + world: h, + disabled: h == 5, //h > u.length, + onPress: () => { + (e.updateView({ type: "inWorld", world: h }), + Jp.saveAccount(a.storage, null, a.alert, a.now, { + lastOpenedWorld: h, + })); + }, + y: 20, + }), + n({ + text: `${localize("WORLD")} ${h}`, + color: ve, + strokeColor: Ye, + strokeThickness: 10, + font: { size: 35, align: "left" }, + x: -320, + y: 120, + }), + e.showStartArrows && 1 === h + ? zf({ id: "LevelsHelp", y: 150 }) + : null, + h < 5 + ? ny({ + id: "ArrowRightButton", + width: 80, + height: 90, + radius: 10, + bottomColour: ve, + strokeColour: Ye, + strokeThickness: 6, + sprites: (e) => [ + r({ + color: Ye, + thickness: 5, + fillColor: ve, + path: [ + [-21, 0], + [5, -25], + [14, -18], + [-3, 0], + [14, 18], + [5, 25], + [-21, 0], + [5, -25], + ], + scaleX: -1, + y: e, + }), + ], + onPress: () => { + i((e) => + Object.assign(Object.assign({}, e), { world: h + 1 }), + ); + }, + x: 230, + y: 20, + }) + : null, + h > 1 + ? ny({ + id: "ArrowLeftButton", + width: 80, + height: 90, + radius: 10, + bottomColour: ve, + strokeColour: Ye, + strokeThickness: 5, + sprites: (e) => [ + r({ + color: Ye, + thickness: 5, + fillColor: ve, + path: [ + [-21, 0], + [5, -25], + [14, -18], + [-3, 0], + [14, 18], + [5, 25], + [-21, 0], + [5, -25], + ], + y: e, + }), + ], + onPress: () => { + i((e) => + Object.assign(Object.assign({}, e), { world: h - 1 }), + ); + }, + x: -230, + y: 20, + }) + : null, + n({ + text: `WARNING! Unfinished!`, + color: "white", + strokeColor: "red", + strokeThickness: 10, + font: { size: 24 }, + x: 0, + y: 160, + }), + s({ + color: 1 === h ? ve : Xe, + radius: 1 === h ? 8 : 5, + x: -80, + y: -150, + }), + s({ + color: 2 === h ? ve : Xe, + radius: 2 === h ? 8 : 5, + x: -40, + y: -150, + }), + s({ + color: 3 === h ? ve : Xe, + radius: 3 === h ? 8 : 5, + x: 0, + y: -150, + }), + s({ + color: 4 === h ? ve : Xe, + radius: 4 === h ? 8 : 5, + x: 40, + y: -150, + }), + s({ + color: 5 === h ? ve : Xe, + radius: 5 === h ? 8 : 5, + x: 80, + y: -150, + }), + Fo({ + id: "BonusButton", + width: 200, + height: 40, + text: "BONUS LEVELS", + onPress: () => { + (i((e) => + Object.assign(Object.assign({}, e), { + hasVisitedSuperLevelPack: true, + }), + ), + e.updateView({ + type: "inWorld", + world: 0, + backToWorld: h, + })); + }, + x: o / 2 - 125, + y: -l / 2 + 40, + }), + ...(t.hasVisitedSuperLevelPack + ? [] + : [ + // const o = a.size.width + 2 * a.size.widthMargin, + // l = a.size.height + 2 * a.size.heightMargin; + // + s({ + color: Ve, + radius: 12, + x: o / 2 - 125 + 100, + y: -l / 2 + 40 + 20, + opacity: 0.9, + }), + s({ + color: ve, + radius: 2, + x: o / 2 - 125 + 100, + y: -l / 2 + 40 + 20, + }), + ]), + ]; + }, + }), + oy = makeCustomSprite({ + render: ({ + props: { world: e, disabled: t, onPress: a }, + device: i, + }) => [ + Clickable({ + id: "Clickable", + width: 250, + height: 250, + disabled: t, + onPress: () => { + (i.audio("audio/global/button.wav").play(0), a()); + }, + sprites: (a) => { + return [ + We({ + width: 250, + height: 250, + rad: 40, + rotation: 45, + color: t ? ze : Ye, + }), + We({ + width: 230, + height: 230, + rad: 35, + rotation: 45, + color: ve, + }), + We({ + width: 210, + height: 210, + rad: 35, + rotation: 45, + color: t ? Xe : Re, + y: 14 - (a ? 10 : 0), + }), + l( + t + ? { + fileName: "images/mainMenu/lockIcon.png", + width: 40, + height: 40, + y: 14, + } + : { + fileName: `images/mainMenu/worldSelect/${e}.png`, + width: 220, + height: 220, + y: 14 - (a ? 10 : 0), + mask: + ((i = { + path: [ + [-110, 20], + [-110, -20], + [-20, -110], + [20, -110], + [110, -20], + [110, 20], + [20, 110], + [-20, 110], + [-110, 20], + ], }), - Fo({ - id: `RemoveFriend-${i}`, - text: "X", - width: 30, - height: 25, - x: e / 2 - 30, - y: n, - strokeColor: Be, - darkBg: true, - noPress: t, - onPress: () => { - E.alert.okCancel( - `Are you sure you want to remove ${a.playerName} as a friend?`, - (e) => { - if (e) { - const { online: e } = b(Se); - if (!e) return; - bp.removeFriend(e.backend, a.profileId) - .then(() => { - u(a); - }) - .catch((e) => { - console.error( - "Failed to remove friend", - e, - ); - }); - } - }, - ); - }, + { + type: "lineMask", + path: i.path, + x: i.x || 0, + y: i.y || 0, }), - ]; - }), - }), - Fo({ - id: "InviteFriend", - text: S ? "SENT" : "INVITE TO PARTY", - disabled: - null === g || - S || - o.includes(g.profileId) || - "notLeader" === r || - "readyToStart" !== l.type, - width: 160, - height: 40, - x: 105, - y: -t / 2 + 30, - darkBg: true, - onPress: () => { - null !== g && - (E.audio("audio/menu/send.wav").play(0), - y((e) => - Object.assign(Object.assign({}, e), { - justInvitedIds: [...e.justInvitedIds, g.profileId], - }), - ), - c(g), - E.timer.start(() => { - y((e) => - Object.assign(Object.assign({}, e), { - justInvitedIds: at( - e.justInvitedIds, - e.justInvitedIds.indexOf(g.profileId), - ), - }), - ); - }, 2e3)); - }, - }), - Fo({ - id: "AddFriend", - text: "+ FRIEND", - width: 100, - height: 40, - x: -30, - y: -t / 2 + 30, - darkBg: true, - onPress: () => { - y((e) => - Object.assign(Object.assign({}, e), { - view: "addFriend", - }), - ); - }, - }), - Fo({ - id: "SeeRequests", - text: "REQUESTS", - width: 100, - height: 40, - x: -135, - y: -t / 2 + 30, - darkBg: true, - disabled: 0 === i.length, - onPress: () => { - y((e) => - Object.assign(Object.assign({}, e), { - view: "showFriendRequests", - }), - ); - }, + }, + ), + ]; + var i; + }, + }), + ], + }), + ry = (e) => e().toString(36).substr(2, 9); + let ly = null; + const cy = { + truncate: function (e, t = 10) { + return e.length > t ? `${e.slice(0, t)}...` : e; + }, + measureTexts: function (texts, font) { + if (null === ly) { + const e = document.createElement("canvas"); + ly = e.getContext("2d"); + } + const a = ly, + { + size: i, + weight: n = "normal", + style: s = "normal", + family: o, + } = font, + r = `${s} ${n} ${i ? `${i}px` : ""} ${o ? `${o}` : ""}`; + return ( + (a.font = r), + (a.textBaseline = font.baseline || "middle"), + (a.textAlign = font.align || "center"), + texts.map((e) => a.measureText(e).width) + ); + }, + splitTextIntoLines: function (e, t, a) { + const i = e.split(" "), + n = cy.measureTexts(i, t), + s = []; + let o = 0, + r = 0; + return ( + i.forEach((e, t) => { + const i = n[t]; + return s[o] + ? r + i > a + ? (o++, (s[o] = e), void (r = i)) + : ((s[o] += ` ${e}`), void (r += i)) + : ((s[o] = e), void (r = i)); + }), + s + ); + }, + }, + dy = makeCustomSprite({ + init: ({ + props: e, + preloadFiles: t, + updateState: a, + device: i, + }) => ( + t({ audioFileNames: [e.song.fileName] }).then(() => { + (a((t) => + Object.assign(Object.assign({}, t), { + songLoaded: e.song.fileName, + songDuration: i.audio(e.song.fileName).getDuration(), }), - Ny({ id: "Badge", friendRequests: i, x: -90, y: -t / 2 + 50 }), - ]; - }, - }), - Ay = makeCustomSprite({ - init: () => ({ - searchField: "", - searchedUsers: null, - addingState: null, - selectedUser: null, + ), + i + .audio(e.song.fileName) + .play({ fromPosition: 0, overwrite: true })); }), - render({ state: e, props: t, updateState: a, getContext: i }) { - const { - width: s, - height: o, - goBack: r, - textInputX: l, - profile: c, - } = t, - { - searchField: d, - searchedUsers: u, - selectedUser: h, - addingState: p, - } = e; + { songLoaded: null, songDuration: 0 } + ), + loop({ getInputs: e, state: t, props: a, device: i }) { + if (!a.waveformData || !t.songLoaded) return t; + const { + pointer: { x: n, y: s, pressed: o, justReleased: r }, + } = e(); + if (Math.abs(s) < 100) { + if (o) { + const e = (function (e) { + return B.clamp2(0, 1, (e + 350) / 700); + })(n), + i = e * t.songDuration; + i !== a.songStartSec && a.setSongStartMs(i); + } + r && + i + .audio(a.song.fileName) + .play({ fromPosition: a.songStartSec, overwrite: true }); + } + return t; + }, + render({ + props: { + song: e, + waveformData: t, + songStartSec: a, + onNext: i, + onBack: s, + }, + state: r, + device: l, + }) { + if (!t || !r.songLoaded) return [ n({ - text: "PLAYER NAME", - color: Be, - font: { align: "left" }, - x: -s / 2 + 10, - y: o / 2 - 25, - }), - P({ - id: "SearchField", - fontName: "Montserrat", - fontSize: 12, - text: d, - onChangeText: (e) => { - a((t) => - Object.assign(Object.assign({}, t), { searchField: e }), - ); - }, - width: s - 140, - x: l - 60, - y: o / 2 - 35, - align: "left", - }), - null, - Fo({ - id: "SearchButton", - text: "SEARCH", - width: 100, - height: 35, - darkBg: true, - x: s / 2 - 60, - y: o / 2 - 40, - disabled: "" === d, - onPress: () => { - const { online: e } = i(Se); - e && - (a((e) => - Object.assign(Object.assign({}, e), { - searchedUsers: "loading", - selectedUser: null, - addingState: null, - }), - ), - bp - .findUsersByName(e.backend, d) - .then((e) => { - a((t) => - Object.assign(Object.assign({}, t), { - isLoading: false, - searchedUsers: e.filter( - (e) => e.profileId !== c.profileId, - ), - }), - ); - }) - .catch((e) => { - a((t) => - Object.assign(Object.assign({}, t), { - isLoading: false, - searchedUsers: e, - }), - ); - })); - }, + text: `${localize("LOADING")}...`, + font: { size: 15 }, + color: ve, }), - "loading" === u - ? n({ color: Be, text: `${localize("LOADING")}...` }) - : null === u - ? null - : u instanceof Error - ? n({ color: Ve, text: u.message }) - : 0 === u.length - ? n({ color: Be, text: "No players found" }) - : ScrollContainer({ - id: "UserList", - containerWidth: s, - containerHeight: o - 120, - contentHeight: 40 * u.length, - y: (o - 120) / 2, - sprites: (e) => - u.map((t, i) => - Ar({ - id: `User-${i}`, - text: `${t.playerName} - ID ${t.profileId.slice( - 0, - 8, - )}`, - width: s - 20, - height: 30, - y: 40 * -i - 20, - noPress: e, - selected: - (null == h ? void 0 : h.profileId) === - t.profileId, - colorLeft: Pe, - colorMid: Pe, - colorRight: Be, - selectedColorLeft: Re, - selectedColorMid: Re, - selectedColorRight: Be, - onPress: () => { - a((e) => - Object.assign(Object.assign({}, e), { - selectedUser: t, - addingState: null, - }), - ); - }, - }), - ), - }), Fo({ - id: "BackButton", - text: localize("BACK"), + id: "NextButton", width: 100, height: 40, - darkBg: true, - onPress: r, - x: -85, - y: -o / 2 + 30, - }), - Fo({ - id: "AddFriend", - text: - "loading" === p - ? "SENDING..." - : "error" === p - ? "FAILED" - : "sent" === p - ? "SENT!" - : "SEND REQUEST", - disabled: null === h || null !== p, - width: 160, - height: 40, - x: 85, - y: -o / 2 + 30, - darkBg: true, - onPress: () => { - const { online: e } = i(Se); - e && - h && - (a((e) => - Object.assign(Object.assign({}, e), { - addingState: "loading", - }), - ), - bp - .sendFriendRequest(e.backend, c, h.profileId) - .then(() => { - a((e) => - Object.assign(Object.assign({}, e), { - addingState: "sent", - }), - ); - }) - .catch(() => { - a((e) => - Object.assign(Object.assign({}, e), { - addingState: "error", - }), - ); - })); - }, - }), - ]; - }, - }), - ky = makeCustomSprite({ - render({ props: e, getContext: t, device: a }) { - const { - width: i, - height: n, - goBack: s, - friendRequests: o, - profile: r, - removeFriendRequest: l, - addFriend: c, - } = e; - return [ - ScrollContainer({ - id: "FriendsList", - containerWidth: i, - containerHeight: n - 70, - contentHeight: 40 * o.length, - y: 25 + (n - 70) / 2, - sprites: (e) => - o.flatMap((n, d) => { - const u = 40 * -d - 20; - return [ - wr({ - id: `FriendRequest-${d}`, - text: `${n.playerName} - ID ${n.profileId.slice( - 0, - 8, - )}`, - colorLeft: xe, - colorMid: xe, - colorRight: Be, - width: i - 20, - height: 30, - y: u, - }), - Fo({ - id: `AcceptFriend-${d}`, - text: "✓", - width: 30, - height: 25, - x: i / 2 - 70, - y: u, - strokeColor: Be, - darkBg: true, - noPress: e, - onPress: () => { - return ( - (e = this), - (i = void 0), - (h = function* () { - const { online: e } = t(Se); - e && - (c(n), - l(d), - 1 === o.length && s(), - a.audio("audio/menu/accept.wav").play(0), - yield bp.addFriend(e.backend, n.profileId), - yield bp.acceptFriendRequest( - e.backend, - r, - n.profileId, - )); - }), - new ((u = void 0) || (u = Promise))(function ( - t, - a, - ) { - function n(e) { - try { - o(h.next(e)); - } catch (e) { - a(e); - } - } - function s(e) { - try { - o(h.throw(e)); - } catch (e) { - a(e); - } - } - function o(e) { - var a; - e.done - ? t(e.value) - : ((a = e.value), - a instanceof u - ? a - : new u(function (e) { - e(a); - })).then(n, s); - } - o((h = h.apply(e, i || [])).next()); - }) - ); - var e, i, u, h; - }, - }), - Fo({ - id: `RejectFriend-${d}`, - text: "X", - width: 30, - height: 25, - x: i / 2 - 30, - y: u, - strokeColor: Be, - darkBg: true, - noPress: e, - onPress: () => { - (l(d), 1 === o.length && s()); - }, - }), - ]; - }), + text: localize("NEXT"), + onPress: i, + x: l.size.fullWidth / 2 - 70, + y: -l.size.fullHeight / 2 + 40, }), Fo({ id: "BackButton", text: localize("BACK"), - width: 100, + width: 80, height: 40, - darkBg: true, onPress: s, - x: -85, - y: -n / 2 + 30, + x: -l.size.fullWidth / 2 + 60, + y: -l.size.fullHeight / 2 + 40, }), ]; - }, - }), - Ny = makeCustomSprite({ - render: ({ props: e }) => - 0 === e.friendRequests.length - ? [] - : [ - s({ color: Ve, radius: 10 }), - n({ color: ve, text: String(e.friendRequests.length) }), - ], - }), - xy = makeCustomSprite({ - init: ({ props: e, updateState: t }) => ( - Jp.getUserItems("skin").then((e) => { - const a = Object.values(Wt.skins) - .map((t) => { - const a = - t.fileName === Wt.default.fileName || - e.some((e) => e.skinName === t.fileName); - if (t.hidden && !a) return null; - if (a) return { skin: t, unlockText: null }; - const i = {}; - _u.forEach((e) => { - e.rewards.items.forEach((t) => { - if (t.defId.startsWith("skin_")) { - const a = t.defId.slice(5); - i[a] = { - name: e.name, - author: e.author, - isSuperLevelPack: "levelPack" === e.category, - }; - } - }); - }); - const n = i[t.fileName]; - if (!n) return { skin: t, unlockText: [""] }; - const s = cy.splitTextIntoLines( - zu.hasIAP() - ? `UNLOCKED WITH ${ - n.isSuperLevelPack - ? "THE SUPER LEVEL PACK" - : "THE ACHIEVEMENT PASS" - }: ${n.name.toLocaleUpperCase()}` - : `${n.name.toLocaleUpperCase()} TO UNLOCK`, - { family: "Montserrat", size: 10, weight: 800 }, - 120, - ); - return { skin: t, unlockText: [""] }; // s }; - }) - .filter(nt) - .sort( - (e, t) => - Number(null === t.unlockText) - - Number(null === e.unlockText), - ); - t((e) => - Object.assign(Object.assign({}, e), { allSkinItems: a }), - ); + const c = a / r.songDuration; + const d = 700 * c - 350, + u = + (l.audio(e.fileName).getPosition() / r.songDuration) * 700 - + 350; + return [ + Dr({ + id: "Waveform", + song: e, + startFrame: 0, + direction: 1, + waveformData: t, + x: -350, + width: 700, + }), + o({ + color: ve, + opacity: 0.1, + height: 200, + width: 700 * (1 - c), + anchorX: 350 * -(1 - c), + x: d, + }), + o({ color: ve, opacity: 0.5, height: 200, width: 2, x: u }), + n({ + text: `${B.roundTo(2)(a)} s`, + font: { size: 15 }, + y: 110, + x: d, + color: ve, + }), + Fo({ + id: "BackButton", + text: localize("BACK"), + width: 80, + height: 40, + onPress: s, + x: -l.size.fullWidth / 2 + 60, + y: -l.size.fullHeight / 2 + 40, + }), + Fo({ + id: "NextButton", + width: 100, + height: 40, + text: localize("NEXT"), + onPress: i, + x: l.size.fullWidth / 2 - 70, + y: -l.size.fullHeight / 2 + 40, + }), + ]; + }, + cleanup({ device: e, state: t }) { + t.songLoaded && e.audio(t.songLoaded).pause(); + }, + }); + var uy = function (e, t, a, i) { + return new (a || (a = Promise))(function (n, s) { + function o(e) { + try { + l(i.next(e)); + } catch (e) { + s(e); + } + } + function r(e) { + try { + l(i.throw(e)); + } catch (e) { + s(e); + } + } + function l(e) { + var t; + e.done + ? n(e.value) + : ((t = e.value), + t instanceof a + ? t + : new a(function (e) { + e(t); + })).then(o, r); + } + l((i = i.apply(e, t || [])).next()); + }); + }; + const UserlevelsView = makeCustomSprite({ + init: ({ updateState }) => { + let loadData = (page) => { + updateState((t) => + Object.assign(Object.assign({}, t), { + page: page, + loading: true, + data: null, + selectedLevel: null, + }), + ); + fetch(`https://www.userlevels.com/api/impossible/levels?page=${page}`).then( + (x) => x.json() + ).then((x) => updateState((t) => + Object.assign(Object.assign({}, t), { + loading: false, + data: x, + lastPage: x.last_page, }), + )); + }; + loadData(1); + return { loading: true, page: 1, data: null, selectedLevel: null, lastPage: null, loadPageData: loadData }; + }, + loop: ({ state, getInputs, props }) => { + let inputs = getInputs().keysJustPressed; + inputs.Escape && props.goBack(); + if (state.loading) { + return Object.assign({}, state); + } + inputs.ArrowLeft && (state.data.prev_page_url && state.loadPageData(state.page - 1)); + inputs.ArrowRight && (state.data.next_page_url && state.loadPageData(state.page + 1)); + return Object.assign({}, state); + }, + render: ({ state, device, props }) => { + const { fullWidth: fullWidth, fullHeight: fullHeight } = device.size; + let levels = state?.data?.data; + + return [ + state.loading ? n({ + text: `${localize("LOADING")}...`, + color: ve, + font: { size: 15 }, + }) : ScrollContainer({ + id: "ChooseSongList", + containerWidth: fullWidth, + containerHeight: fullHeight - 140, + contentHeight: 40 * (levels.length + 1), + y: fullHeight / 2 - 70, + sprites: (t) => + levels.flatMap((a, s) => [ + Ar({ + id: `LevelButton-${s}`, + width: fullWidth - 240, + height: 30, + text: + `${a.title} - ${a.creator.name}`, + selected: state.selectedLevel === a, + colorLeft: xe, + colorMid: xe, + colorRight: xe, + selectedColorLeft: Re, + selectedColorMid: Re, + selectedColorRight: Re, + colorOpacities: [1, 0.75, 0], + noPress: t, + onPress: () => { + state.selectedLevel = a; + }, + x: -100, + y: -20 - 40 * s, + }), + ]), + }), + Fo({ + id: "BackButton", + text: localize("BACK"), + width: 80, + height: 40, + onPress: props.goBack, + x: -fullWidth / 2 + 60, + y: -fullHeight / 2 + 40, + }), + Uf({ + id: "Title", + text: "USERLEVELS.COM", + width: 200, + height: 35, + x: -fullWidth / 2 + 120, + y: fullHeight / 2 - 40, + }), + Fo({ + id: "LastPage", + text: "<", + width: 40, + height: 40, + disabled: state.loading, + onPress: () => { + state.data.prev_page_url && state.loadPageData(state.page - 1) + }, + x: -40, + y: -fullHeight / 2 + 40, + }), + n({ + text: `${state.page}/${state.lastPage || "..."}`, + color: ve, + font: { size: 15, weight: 500 }, + y: -fullHeight / 2 + 40, + }), + Fo({ + id: "NextPage", + text: ">", + width: 40, + height: 40, + disabled: state.loading, + onPress: () => { + state.data.next_page_url && state.loadPageData(state.page + 1) + }, + x: 40, + y: -fullHeight / 2 + 40, + }), + Fo({ + id: "ImportButton", + text: localize("IMPORT"), + width: 100, + height: 40, + disabled: state.loading, + onPress: () => { + const n = Cf(state.selectedLevel.string), + s = (e) => { + (device.audio("audio/menu/error.wav").play(0), + (state.error = e)); + }; + if (n instanceof Error) return void s("Invalid level data"); + props.importLevel(n); + props.goBack(); + }, + x: fullWidth / 2 - 70, + y: -fullHeight / 2 + 40, + }), + ]; + } + }); + const hy = makeCustomSprite({ + init: ({ device: e, updateState: t }) => ( + Promise.all([ + Jp.getSavedLevels(e.storage, e.now, e.alert), + Jp.getAccount(e.storage, null, e.alert), + Jp.getUserItems("all"), + ]).then( + ([ + { data: e }, { - allSkinItems: "loading", - selectedSkinItem: { skin: e.playerSkin, unlockText: null }, - updatingSkin: false, - } - ), - render({ - props: { width: e, height: t, playerSkin: a, profileId: i }, - state: { allSkinItems: allSkinItems, selectedSkinItem: o, updatingSkin: r }, - updateState: c, - getContext: d, - }) { - if ("loading" === allSkinItems) - return [n({ text: `${localize("LOADING")}...`, color: Be })]; - const u = 0.6 * e, - h = 0.2 * -e; - return [ - We({ - color: Fe, - width: 120, - height: 110, - x: 110, - y: t / 2 - 75, - }), - n({ - text: localize(o.skin.name), - font: { size: 16, weight: 800 }, - color: ve, - x: 110, - y: t / 2 - 40, - strokeColor: Fe, - strokeThickness: 8, - }), - l({ - fileName: `images/player/skins/${o.skin.fileName}.png`, - width: o.skin.size, - height: o.skin.size, - x: 110, - y: o.skin.author ? t / 2 - 80 : t / 2 - 90, - rotation: 30, - }), - n({ - text: o.skin.author ? (`${localize('by')} ` + o.skin.author) : "", - x: 110, - y: t / 2 - 120, - color: ve, - font: { weight: 500 }, - }), - Fo({ - id: "EquipButton", - text: r ? "EQUIPPING" : "EQUIP", - width: 120, - height: 50, - darkBg: true, - disabled: - (r || - o.skin.fileName === a.fileName || - null !== o.unlockText, - false), - onPress: () => { - var { online: e, updatePlayerSkin: t } = d(Se); - e = false; // ha! - e && i - ? (bp - .equipSkin(e.backend, o.skin, i) - .then(() => { - (t(o.skin), - c((e) => - Object.assign(Object.assign({}, e), { - updatingSkin: false, - }), - )); - }) - .catch(() => { - c((e) => - Object.assign(Object.assign({}, e), { - updatingSkin: false, - }), - ); - }), - c((e) => - Object.assign(Object.assign({}, e), { - updatingSkin: true, - }), - )) - : t(o.skin); + data: { levelsProgress: a }, + }, + i, + ]) => { + const n = i.filter(kp.isEditorItem), + s = i.filter(kp.isThemeItem), + o = i.filter(kp.isBonusLevelItem), + r = ql(a); + t((t) => + Object.assign(Object.assign({}, t), { + data: { + editorItems: n, + themeItems: s, + bonusLevels: o, + levels: fy(e, r, n, s), + availableSongs: r, }, - x: 110, - y: t / 2 - 160, }), - ...(null === o.unlockText - ? [] - : [ - We({ - color: ve, - x: 110, - width: 130, - height: 10 * o.unlockText.length + 10, - y: t / 2 - 195 - 5 * o.unlockText.length, + ); + }, + ), + { view: "main", data: "loading" } + ), + render({ + props: e, + state: t, + device: a, + updateState: i, + getContext: s, + }) { + const o = a.size.height + 2 * a.size.heightMargin, + r = a.size.width + 2 * a.size.widthMargin; + if ("loading" === t.data) + return [ + n({ + text: `${localize("LOADING")}...`, + color: ve, + font: { size: 15 }, + }), + ]; + const { + levels: l, + availableSongs: c, + bonusLevels: d, + editorItems: u, + themeItems: h, + } = t.data; + if ("new" === t.view) + return [ + py({ + id: "NewLevel", + availableSongs: c, + selectSong: (t, i) => { + const n = Sr( + ry(a.random), + `Untitled-${l.length + 1}`, + t, + void 0, + null, + i, + ); + e.editLevel(ul(n)); + }, + backPressed: () => { + i((e) => + Object.assign(Object.assign({}, e), { view: "main" }), + ); + }, + fadeInMusic: e.fadeInMusic, + fadeOutMusic: e.fadeOutMusic, + }), + ]; + const importLevel = (e) => + uy(this, void 0, void 0, function* () { + const t = yield Jp.saveLevel( + a.storage, + a.now, + Object.assign(Object.assign({}, e), { id: ry(a.random) }), + a.alert, + ); + i((e) => + Object.assign(Object.assign({}, e), { + view: "main", + data: + "loading" === e.data + ? e.data + : Object.assign(Object.assign({}, e.data), { + levels: fy(t.data, c, u, h), }), - ...o.unlockText.map((e, a) => - n({ - text: e, - x: 110, - y: t / 2 - 200 - 10 * a, - color: Be, - font: { weight: 800 }, - }), - ), - ]), - ScrollContainer({ - id: "ScrollContainer", - containerHeight: t, - containerWidth: u, - contentHeight: 70 * Math.ceil(allSkinItems.length / 3) + 30, - y: t / 2, - x: h, - sprites: (e) => [ - ...allSkinItems.map((t, a) => { - const i = (a % 3) - 1, - n = Math.floor(a / 3), - s = t.skin.fileName === o.skin.fileName; - return Py({ - id: `SkinButton-${t.skin.fileName}`, - x: 70 * i, - y: -40 - 70 * n, - onPress: () => { - c((e) => - Object.assign(Object.assign({}, e), { - selectedSkinItem: t, - }), - ); - }, - noPress: e, - skinItem: t, - selected: s, - }); - }), - ], }), - ]; - }, - }), - Py = makeCustomSprite({ - render: ({ - props: { - skinItem: { skin: e, unlockText: t }, - onPress: a, - noPress: i, - selected: n, - }, - device: s, - }) => [ - Clickable({ - id: "Clickable", - width: 60, - height: 60, + ); + const { online: n } = s(Se); + n && + n.signedInAccount && + (yield bp.updateLevelsStorage( + n.backend, + t.data.map(({ level: e }) => e), + a.now, + )); + }); + if ("importType" === t.view) + return [ + my({ + id: "ImportType", + availableSongs: c, + items: { bonusLevels: d, editorItems: u, themeItems: h }, + goBack: () => { + i((e) => + Object.assign(Object.assign({}, e), { view: "main" }), + ); + }, + goToPasteText: () => { + i((e) => + Object.assign(Object.assign({}, e), { view: "import" }), + ); + }, + importLevel: importLevel, + }), + ]; + if ("import" === t.view) + return [ + gy({ + id: "ImportLevel", + availableSongs: c, + items: { bonusLevels: d, editorItems: u, themeItems: h }, + goBack: () => { + zu.supportsFiles() + ? i((e) => + Object.assign(Object.assign({}, e), { + view: "importType", + }), + ) + : i((e) => + Object.assign(Object.assign({}, e), { + view: "main", + }), + ); + }, + importLevel: importLevel, + }), + ]; + if ("userlevels" === t.view) + return [ + UserlevelsView({ + id: "UserlevelsView", + goBack: () => { + i((e) => + Object.assign(Object.assign({}, e), { view: "main" }), + ); + }, + importLevel: importLevel, + }) + ]; + + const g = () => { + i((e) => + Object.assign(Object.assign({}, e), { + view: zu.supportsFiles() ? "importType" : "import", + }), + ); + }; + return 0 === l.length + ? [ + Fo({ + id: "BackButton", + text: localize("BACK"), + width: 80, + height: 45, + onPress: e.backToMainMenu, + x: -r / 2 + 60, + y: -o / 2 + 40, + }), + Uf({ + id: "Title", + text: localize("LEVEL EDITOR"), + width: 200, + height: 35, + x: -r / 2 + 120, + y: o / 2 - 40, + }), + Fo({ + id: "NewButton", + text: localize("NEW"), + width: 120, + height: 45, onPress: () => { - (s.audio("audio/global/button.wav").play(0), a()); + i((e) => + Object.assign(Object.assign({}, e), { view: "new" }), + ); }, - disabled: i || n, - sprites: (a) => { - const i = true; // null === t; - return [ - So({ - id: "RaiseRects", - width: 60, - height: 60, - raiseHeight: 5, - rad: 5, - isPressed: a, - topColour: n ? Re : a ? ke : i ? Pe : ze, - bottomColour: i || n ? xe : Xe, - sprites: (t) => [ - l({ - fileName: `images/player/skins/${e.fileName}.png`, - testId: `SkinButton-${e.fileName}`, - width: e.size, - height: e.size, - y: t, - opacity: i ? void 0 : 0.5, - }), - ], - }), - ]; + x: -80, + }), + Fo({ + id: "ImportButton", + text: localize("IMPORT"), + width: 120, + height: 45, + onPress: g, + x: 80, + }), + ] + : [ + Fo({ + id: "BackButton", + text: localize("BACK"), + width: 80, + height: 40, + onPress: e.backToMainMenu, + x: -r / 2 + 60, + y: -o / 2 + 40, + }), + Uf({ + id: "Title", + text: localize("LEVEL EDITOR"), + width: 200, + height: 35, + x: -r / 2 + 120, + y: o / 2 - 40, + }), + Fo({ + id: "UserlevelsButton", + text: "USERLEVELS.COM", + width: 160, + height: 40, + onPress: () => { + i((e) => + Object.assign(Object.assign({}, e), { view: "userlevels" }), + ); }, + x: ((-r / 2 + 60) + (r / 2 - 200)) / 2, + y: -o / 2 + 40, }), - ], - }), - My = makeCustomSprite({ - init: () => ({ tab: "skins" }), - render({ - props: { - width: e, - height: t, - inPartyIds: a, - hasParty: i, - onStart: s, - friends: o, - friendRequests: r, - playState: l, - inviteToParty: c, - addFriend: d, - removeFriend: u, - removeFriendRequest: h, - textInputX: p, - profile: g, - playerSkin: m, - fadeInMusic: f, - fadeOutMusic: y, - }, - state: { tab: E }, - updateState: b, - }) { - const S = { type: "linearHoriz", width: 80, colors: [xe, De] }, - I = t - 30, - _ = -20, - v = [ - ...("play" === E - ? [ - We({ - width: 110, - height: 40, - color: Ge, - x: 3 - e / 2 + 55, - y: t / 2 - 20, - }), - We({ - width: 110, + Fo({ + id: "NewButton", + text: localize("NEW"), + width: 80, + height: 40, + onPress: () => { + i((e) => + Object.assign(Object.assign({}, e), { view: "new" }), + ); + }, + x: r / 2 - 200, + y: -o / 2 + 40, + }), + Fo({ + id: "ImportButton", + text: localize("IMPORT"), + width: 100, + height: 40, + onPress: g, + x: r / 2 - 70, + y: -o / 2 + 40, + }), + ScrollContainer({ + id: "LevelsList", + containerWidth: r, + containerHeight: o - 140, + contentHeight: 60 * l.length + 30, + y: o / 2 - 70, + sprites: (t) => + l.flatMap( + ({ savedLevel: n, displayText: o, canEdit: l }, d) => { + const { level: p } = n, + g = -20 - 50 * d; + return [ + wr({ + id: `LevelsListItem-${d}`, + text: o, + colorLeft: xe, + colorMid: xe, + colorRight: xe, + colorOpacities: [1, 0.75, 0], + width: r - 40, height: 40, - color: ve, - x: -e / 2 + 55, - y: t / 2 - 20, - }), - n({ - text: localize("PLAY"), - font: { size: 18 }, - color: Ae, - gradient: S, - x: -e / 2 + 55, - y: t / 2 - 20, + y: g, }), - ] - : [ Fo({ - id: "PlayTabButton", + id: `PlayLevelButton-${d}`, + width: 60, + height: 30, text: localize("PLAY"), - width: 110, - height: 35, - fontSize: 15, - shadowDir: "right", - x: -e / 2 + 55, - y: t / 2 - 20, - onPress: () => { - b((e) => - Object.assign(Object.assign({}, e), { - tab: "play", - }), - ); - }, - }), - ]), - ...("friends" === E - ? [ - We({ - width: 110, - height: 40, - color: Ge, - x: 3 - e / 2 + 180, - y: t / 2 - 20, - }), - We({ - width: 110, - height: 40, - color: ve, - x: -e / 2 + 180, - y: t / 2 - 20, - }), - n({ - text: "FRIENDS", - font: { size: 18 }, - color: Ae, - gradient: S, - x: -e / 2 + 180, - y: t / 2 - 20, + fontSize: 12, + onPress: () => e.playLevel(vr(p)), + x: r / 2 - 205, + y: g, + noPress: t, }), - ] - : [ Fo({ - id: "FriendsTabButton", - text: "FRIENDS", - width: 110, - height: 35, - fontSize: 15, - shadowDir: "right", - x: -e / 2 + 180, - y: t / 2 - 20, - onPress: () => { - b((e) => - Object.assign(Object.assign({}, e), { - tab: "friends", - }), - ); - }, - }), - Ny({ - id: "Badge", - friendRequests: r, - x: -e / 2 + 235, - y: t / 2 - 5, - }), - ]), - ...("skins" === E - ? [ - We({ - width: 110, - height: 40, - color: Ge, - x: 3 - e / 2 + 305, - y: t / 2 - 20, - }), - We({ - width: 110, - height: 40, - color: ve, - x: -e / 2 + 305, - y: t / 2 - 20, - }), - n({ - text: localize("SKINS"), - font: { size: 18 }, - color: Ae, - gradient: S, - x: -e / 2 + 305, - y: t / 2 - 20, + id: `EditLevelButton-${d}`, + width: 60, + height: 30, + text: localize("EDIT"), + fontSize: 12, + disabled: !l, + onPress: () => e.editLevel(n), + x: r / 2 - 138, + y: g, + noPress: t, }), - ] - : [ Fo({ - id: "SkinsTabButton", - text: localize("SKINS"), - width: 110, - height: 35, - fontSize: 15, - shadowDir: "right", - x: -e / 2 + 305, - y: t / 2 - 20, + id: `DeleteLevelButton-${d}`, + width: 70, + height: 30, + text: localize("DELETE"), + fontSize: 12, onPress: () => { - b((e) => - Object.assign(Object.assign({}, e), { - tab: "skins", - }), + a.alert.okCancel( + `${localize( + "Are you sure you want to delete level", + )} ${p.name}?`, + (e) => + uy(this, void 0, void 0, function* () { + if (!e) return; + const t = yield Jp.deleteLevel( + a.storage, + n, + a.alert, + a.now, + ), + { online: o } = s(Se); + (o && + o.signedInAccount && + (yield bp.updateLevelsStorage( + o.backend, + t.map(({ level: e }) => e), + a.now, + )), + i((e) => + Object.assign(Object.assign({}, e), { + data: + "loading" === e.data + ? e.data + : Object.assign( + Object.assign({}, e.data), + { + levels: fy(t, c, u, h), + }, + ), + }), + )); + }), ); }, + x: r / 2 - 65, + y: g, + noPress: t, }), - ]), - We({ - gradient: { - type: "linearHoriz", - width: e, - colors: [Ne, De], + ]; }, - width: e, - height: I, - x: 3, - y: -24, + ), + }), + ]; + }, + }); + var customSong; + const py = makeCustomSprite({ + init: () => ({ + view: { + type: "chooseSong", + selectedSong: null, + selectedSongLoading: false, + }, + }), + render({ props: e, state: t, device: a, updateState: i }) { + const { fullWidth: n, fullHeight: s } = a.size; + if ("chooseSongStart" === t.view.type) { + const { + song: a, + songStartTimeSecs: o, + waveformData: r, + } = t.view; + return [ + Uf({ + id: "Title", + text: localize("SONG START"), + width: 200, + height: 35, + x: -n / 2 + 120, + y: s / 2 - 40, + }), + dy({ + id: "SongStartMenu", + song: a, + waveformData: r, + songStartSec: o, + setSongStartMs: (e) => { + i((t) => + "chooseSongStart" === t.view.type + ? Object.assign(Object.assign({}, t), { + view: Object.assign(Object.assign({}, t.view), { + songStartTimeSecs: e, + }), + }) + : t, + ); + }, + onNext: () => { + e.selectSong(a, o || 0); + }, + onBack: () => { + i((e) => + Object.assign(Object.assign({}, e), { + view: { + type: "chooseSong", + selectedSong: a, + selectedSongLoading: true, + }, + }), + ); + }, + }), + ]; + } + const { selectedSong: o, selectedSongLoading: r } = t.view, + l = o && hl.getSnippetName(o.fileName); + return [ + Uf({ + id: "Title", + text: localize("CHOOSE SONG"), + width: 200, + height: 35, + x: -n / 2 + 120, + y: s / 2 - 40, + }), + ScrollContainer({ + id: "ChooseSongList", + containerWidth: n, + containerHeight: s - 140, + contentHeight: 40 * (e.availableSongs.length + 1), + y: s / 2 - 70, + sprites: (t) => + e.availableSongs.flatMap((a, s) => [ + Ar({ + id: `SongButton-${s}`, + width: n - 240, + height: 30, + text: + "custom" in a + ? `${localize(`Custom song`)}...` + : `${a.name} ${localize("by")} ${a.author} - ${a.bpm + } BPM ${a.length ? `(${a.length})` : ""}`, + selected: o === a, + colorLeft: xe, + colorMid: xe, + colorRight: xe, + selectedColorLeft: Re, + selectedColorMid: Re, + selectedColorRight: Re, + colorOpacities: [1, 0.75, 0], + noPress: t || r, + onPress: () => { + if ("custom" in a) { + customSong = { + name: "", + author: "", + fileName: "", + bpm: 120, + label: "", + isBonusSong: false, + custom: 1, + }; + + customSong.fileName = prompt("Link:"); + if ( + customSong.fileName == null || + customSong.fileName == "" + ) { + return; + } + customSong.name = prompt("Name:"); + if (customSong.name == null) { + return; + } + customSong.author = prompt("Author:"); + if ( + customSong.author == null || + customSong.author == "" + ) { + return; + } + customSong.bpm = prompt("BPM:"); + if ( + customSong.bpm == null || + customSong.bpm == "" + ) { + return; + } + for ( + var $i = 0; + $i < Object.keys(hl.songs).length; + $i++ + ) { + if ( + hl.songs[Object.keys(hl.songs)[$i]].bpm == + customSong.bpm + ) { + a = hl.songs[Object.keys(hl.songs)[$i]]; + } else { + a = hl.songs.dragonfly; + } + } + } else { + customSong = undefined; + } + o !== a && + (e.fadeOutMusic(), + i((e) => + "chooseSong" === e.view.type + ? Object.assign(Object.assign({}, e), { + view: Object.assign( + Object.assign({}, e.view), + { + selectedSong: a, + selectedSongLoading: true, + }, + ), + }) + : e, + )); + }, + x: -100, + y: -20 - 40 * s, }), - We({ color: ve, width: e, height: I, y: _ }), - ]; - return "loading" === l.type - ? [...v, n({ text: `${localize("LOADING")}...`, color: Be })] - : "play" === E - ? [ - ...v, - "error" === l.type - ? n({ text: l.message, color: Ve }) - : "readyToStart" === l.type - ? Oy({ - id: "StartOnlineMenu", - hasParty: i, - partySize: a.length, - onStart: s, - width: e, - height: I, - y: _, - fadeInMusic: f, - fadeOutMusic: y, + ]), + }), + ...(o && l + ? [ + Gf({ + id: `LoadSong-${l}`, + assets: { audioFileNames: [l] }, + onLoad: () => { + i((e) => + "chooseSong" === e.view.type + ? Object.assign(Object.assign({}, e), { + view: Object.assign( + Object.assign({}, e.view), + { selectedSongLoading: false }, + ), + }) + : e, + ); + }, + sprites: [ + Ro.Single({ + id: `PreviewSong-${l}`, + fileName: l, + loop: false, + paused: false, + fromPosition: 0, + overwrite: true, + isGameSfx: false, + }), + ], + }), + Fo({ + id: "NextButton", + width: 100, + height: 40, + text: localize("NEXT"), + disabled: false, //r, + onPress: () => { + (i((e) => + Object.assign(Object.assign({}, e), { + view: { + type: "chooseSongStart", + song: o, + songStartTimeSecs: 0, + waveformData: null, + }, + }), + ), + kf(o.fileName).then((e) => { + i((t) => + "chooseSongStart" === t.view.type + ? Object.assign(Object.assign({}, t), { + view: Object.assign( + Object.assign({}, t.view), + { waveformData: e }, + ), }) - : "matchmaking" === l.type - ? Cy({ - id: "Matchmaking", - isFriends: l.isFriends, - numPlayers: l.numPlayers, - maxPlayers: l.maxPlayers, - hasServer: Boolean(l.server), - y: _, - }) - : null, - ] - : "skins" === E - ? [ - ...v, - xy({ - id: "SkinsMenu", - width: e, - height: I, - playerSkin: m, - profileId: g.profileId, - y: _, + : t, + ); + })); + }, + x: n / 2 - 70, + y: -s / 2 + 40, + }), + ] + : []), + Fo({ + id: "BackButton", + text: localize("BACK"), + width: 80, + height: 40, + onPress: () => { + (e.fadeInMusic(), e.backPressed()); + }, + x: -n / 2 + 60, + y: -s / 2 + 40, + }), + ]; + }, + }), + gy = makeCustomSprite({ + init: () => ({ json: "", error: "" }), + render({ props: e, state: t, device: a, updateState: i }) { + const s = a.size.width + 2 * a.size.widthMargin, + o = a.size.height + 2 * a.size.heightMargin, + { bonusLevels: r, editorItems: l, themeItems: c } = e.items; + return [ + Uf({ + id: "Title", + text: localize("IMPORT LEVEL"), + width: 200, + height: 35, + x: -s / 2 + 120, + y: o / 2 - 40, + }), + P({ + id: "LevelJsonInput", + fontName: "monospace", + fontSize: 20, + text: t.json, + onChangeText: (e) => { + i(() => ({ error: "", json: e })); + }, + align: "left", + width: s - 40, + numberOfLines: 11, + }), + null, + Fo({ + id: "ImportButton", + width: 100, + height: 40, + text: localize("IMPORT"), + disabled: "" === t.json, + onPress: () => { + const n = Cf(t.json), + s = (e) => { + (a.audio("audio/menu/error.wav").play(0), + i((t) => + Object.assign(Object.assign({}, t), { error: e }), + )); + }; + if (n instanceof Error) return void s("Invalid level data"); + const o = kp.canEditLevel(n, l, c, e.availableSongs); + if (o) { + const e = kp.canPlayLevel(n, r); + if (e) return void s(e); + a.alert.ok(`${o}\nEditing is disabled for this level`); + } + e.importLevel(n); + }, + x: s / 2 - 70, + y: -o / 2 + 40, + }), + Fo({ + id: "BackButton", + text: localize("BACK"), + width: 80, + height: 40, + onPress: e.goBack, + x: -s / 2 + 60, + y: -o / 2 + 40, + }), + t.error + ? n({ + text: t.error, + color: Ve, + font: { size: 13 }, + y: -o / 2 + 40, + }) + : null, + ]; + }, + }), + my = makeCustomSprite({ + init: () => ({ error: "", loading: false }), + render({ props: e, state: t, device: a, updateState: i }) { + const s = a.size.width + 2 * a.size.widthMargin, + o = a.size.height + 2 * a.size.heightMargin, + { bonusLevels: r, editorItems: l, themeItems: c } = e.items; + return [ + Fo({ + id: "BackButton", + text: localize("BACK"), + width: 80, + height: 40, + onPress: e.goBack, + x: -s / 2 + 60, + y: -o / 2 + 40, + }), + Uf({ + id: "Title", + text: localize("LEVEL EDITOR"), + width: 200, + height: 35, + x: -s / 2 + 120, + y: o / 2 - 40, + }), + Fo({ + id: "FromFileButton", + text: "OPEN FILE", + width: 140, + height: 45, + onPress: async () => { + i((e) => + Object.assign(Object.assign({}, e), { loading: true }), + ); + const t = (e) => { + (a.audio("audio/menu/error.wav").play(0), + i((t) => + Object.assign(Object.assign({}, t), { + error: e, + loading: false, }), - ] - : [ - ...v, - wy({ - id: "FriendsMenu", - width: e, - height: I, - friends: o, - friendRequests: r, - textInputX: p, - inPartyIds: a, - hasParty: i, - playState: l, - inviteToParty: c, - addFriend: d, - removeFriend: u, - removeFriendRequest: h, - profile: g, - y: _, + )); + }; + let n; + try { + n = await zu.openFile(); + if (null == n) + return void i((e) => + Object.assign(Object.assign({}, e), { + loading: false, }), - ]; - }, - }), - Ly = makeCustomSprite({ - render({ - props: e, - device: { - size: { fullWidth: t, fullHeight: a }, - }, - }) { - const { closeModal: i } = e; - return [ - Clickable({ - id: "ClickOutside", - onPressOutside: i, - width: 500, - height: 320, - sprites: () => [], - onPress: () => null, - }), - o({ color: "black", opacity: 0.7, width: t, height: a }), - We({ width: 510, height: 330, color: Re, x: -5, y: -5 }), - We({ width: 500, height: 320, color: ve }), - n({ text: "ROYALE", color: Be, font: { size: 20 }, y: 130 }), - n({ - text: "Race up to 60 online players in a randomly chosen level", - color: Be, - font: { size: 13, weight: 600 }, - y: 105, - }), - n({ - text: "Reach the next checkpoint before others to qualify", - color: Be, - font: { size: 13, weight: 600 }, - y: 85, - }), - n({ - text: "The elimination timer starts when at least one player qualifies", - color: Be, - font: { size: 13, weight: 600 }, - y: 65, - }), - n({ - text: "Every checkpoint will reduce the number of places left", - color: Be, - font: { size: 13, weight: 600 }, - y: 45, - }), - n({ - text: "By the end of the level, only one place will be available for the winner!", - color: Be, - font: { size: 13, weight: 600 }, - y: 25, - }), - n({ - text: "PARTY PLAY", - color: Be, - font: { size: 20 }, - y: -20, - }), - n({ - text: "Race against players in your party", - color: Be, - font: { size: 13, weight: 600 }, - y: -45, - }), - n({ - text: "The party leader can choose a level they've unlocked to race in", - color: Be, - font: { size: 13, weight: 600 }, - y: -65, - }), - n({ - text: "There are no knockouts, the winner is the first to the final checkpoint!", - color: Be, - font: { size: 13, weight: 600 }, - y: -85, - }), - Fo({ - id: "CloseButton", - text: "CLOSE", - y: -130, - width: 100, - height: 40, - darkBg: true, - onPress: i, - }), - ]; - }, - }); - const Dy = makeCustomSprite({ - init({ props: e, updateState: t, getState: a, device: i }) { - function n(e) { - switch (e.type) { - case "invite": - t((t) => - Object.assign(Object.assign({}, t), { - modal: { - type: "joinParty", - lobbyId: e.lobbyId, - playerName: e.from.playerName, - }, + ); + } catch (e) { + console.error(e); + return void t("Failed to open file"); + } + const s = Cf(n); + if (s instanceof Error) + return void t("Invalid level data"); + const o = kp.canEditLevel(s, l, c, e.availableSongs); + if (o) { + const e = kp.canPlayLevel(s, r); + if (e) return void t(e); + a.alert.ok(`${o}\nEditing is disabled for this level`); + } + (e.importLevel(s), + i((e) => + Object.assign(Object.assign({}, e), { + loading: false, }), - ); - break; - case "friendRequest": - t((t) => { - const a = t.friends.map((e) => e.profileId), - n = t.friendRequests.map((e) => e.profileId); - if ( - !a.includes(e.from.profileId) && - !n.includes(e.from.profileId) - ) { - i.audio("audio/menu/party-invite.wav").play({ - overwrite: true, - }); - const a = [...t.friendRequests, e.from]; - return ( - Jp.addFriendRequests( - i.storage, - i.alert, - i.now, - a, - true, - ), - Object.assign(Object.assign({}, t), { - friendRequests: a, - }) - ); - } - return t; - }); - break; - case "friendRequestAccept": - t((t) => { - const a = { - profileId: e.from.profileId, - playerName: e.from.playerName, - }; - return t.friends - .map((e) => e.profileId) - .includes(a.profileId) - ? t - : Object.assign(Object.assign({}, t), { - friends: [...t.friends, a], - }); - }); - } + )); + }, + x: -100, + }), + Fo({ + id: "ImportButton", + text: "PASTE TEXT", + width: 140, + height: 45, + onPress: e.goToPasteText, + x: 100, + }), + t.loading + ? n({ + text: `${localize("LOADING")}...`, + color: ve, + font: { size: 13 }, + y: -o / 2 + 40, + }) + : t.error + ? n({ + text: t.error, + color: Ve, + font: { size: 13 }, + y: -o / 2 + 40, + }) + : null, + ]; + }, + }); + function fy(e, t, a, i) { + return e + .map((e) => { + const n = e.level; + let s = n.name, + o = n.song.name, + r = n.song.author; + const l = () => + `${s} - ${o} ${localize("by")} ${r} - ${n.song.bpm} BPM`; + return ( + l().length > 60 && + ((r = cy.truncate(n.song.author, 10)), + l().length > 60 && + ((o = cy.truncate(n.song.name, 10)), + l().length > 60 && (s = cy.truncate(n.name, 10)))), + { + displayText: l(), + savedLevel: e, + canEdit: null === kp.canEditLevel(n, a, i, t), } - return ( - (function () { - return ( - (s = this), - (o = void 0), - (l = function* () { - const { friends: s, friendRequests: o } = - yield bp.setupOnline( - e.backend, - n, - By(t, a, e, e.backend), - ); - let r = []; - if ( - (o.length > 0 - ? (i.audio("audio/menu/party-invite.wav").play(0), - (r = yield Jp.addFriendRequests( - i.storage, - i.alert, - i.now, - o, - false, - ))) - : (r = (yield Jp.getAccount(i.storage, null, i.alert)) - .data.friendRequests), - t((e) => - Object.assign(Object.assign({}, e), { - friends: s, - friendRequests: r, - playState: { type: "readyToStart" }, - }), - ), - e.party && e.party.ownerId === e.profile.profileId) - ) { - const a = e.party.members.filter( - (t) => t.profileId !== e.profile.profileId, - ); - i.timer.start(() => { - bp.createFriendsLobby( - e.backend, - a, - e.profile, - e.playerSkin, - ).catch(Fy(t)); - }, 3e3); - } + ); + }) + .reverse(); + } + var yy = a(818); + const Ey = makeCustomSprite({ + render({ props: e, device: t }) { + const a = t.size.height + 2 * t.size.heightMargin, + i = t.size.width + 2 * t.size.widthMargin; + return [ + Fo({ + id: "BackButton", + text: "<-", + width: 40, + height: 30, + onPress: e.backToMainMenu, + x: -250, + y: a / 2 - 40, + }), + n({ + font: { size: 20 }, + text: "Test Cases", + color: "red", + y: a / 2 - 40, + }), + ScrollContainer({ + id: "ScrollContainer", + y: a / 2 - 80, + containerHeight: a - 80, + containerWidth: i, + contentHeight: 40 * yy.testCases.length + 20, + sprites: (t) => + yy.testCases.map((a, i) => + Fo({ + id: `BlockButton-${i}`, + width: 700, + height: 30, + text: a.name, + onPress: () => e.playTestCase(a), + y: -20 - 40 * i, + noPress: t, + }), + ), + }), + ]; + }, + }), + by = makeCustomSprite({ + init({ device: e }) { + e.audio("audio/menu/party-invite.wav").play(0); + }, + render({ props: e, device: { size: t } }) { + const { playerName: a, closeModal: i, confirm: s } = e, + r = t.height + 2 * t.heightMargin, + l = t.width + 2 * t.widthMargin; + return [ + o({ color: "black", opacity: 0.7, width: l, height: r }), + We({ width: 510, height: 160, color: Re, x: -5, y: -5 }), + We({ width: 500, height: 150, color: ve }), + n({ + text: `Party invite from ${cy.truncate(a, 18)}`, + font: { size: 15 }, + color: Be, + y: 30, + }), + Fo({ + id: "CancelButton", + text: "IGNORE", + x: -75, + y: -20, + width: 100, + height: 40, + darkBg: true, + onPress: i, + }), + Fo({ + id: "OkButton", + text: "JOIN PARTY!", + width: 150, + height: 40, + x: 75, + y: -20, + darkBg: true, + onPress: s, + }), + ]; + }, + }), + Sy = makePureSprite({ + shouldRerender(e, t) { + if (null !== e.party && null !== t.party) { + if ( + e.party.members.length !== t.party.members.length || + e.party.id !== t.party.id + ) + return (t.onNewMember(), true); + } else if (e.party !== t.party) return true; + return ( + e.width !== t.width || + e.height !== t.height || + e.profile.playerName !== t.profile.playerName || + e.playerSkin.fileName !== t.playerSkin.fileName + ); + }, + render({ + props: { + party: e, + width: t, + height: a, + profile: i, + playerSkin: s, + }, + }) { + const o = (null == e ? void 0 : e.members) || [ + { + profileId: i.profileId, + playerName: i.playerName, + cxId: "", + skin: s, + rank: xu(i.xpPoints).rank, + }, + ], + r = o.length > 1 && null !== e, + c = r ? 110 : 70, + d = cy.measureTexts( + o.map((e) => e.playerName), + { family: "Montserrat", size: 10, weight: 600 }, + ), + u = t - 45; + return [ + We({ + width: c, + height: 30, + color: Re, + x: 3 - t / 2 + c / 2, + y: a / 2 - 20, + }), + We({ + width: c, + height: 30, + color: Be, + x: -t / 2 + c / 2, + y: a / 2 - 20, + }), + n({ + text: r && e ? `PARTY ${o.length}/${e.maxMembers}` : "PARTY", + font: { size: 15, align: "left" }, + color: ve, + x: -t / 2 + 10, + y: a / 2 - 20, + }), + We({ color: Re, width: t, height: a - 31, x: 3, y: -20 }), + We({ color: Be, width: t, height: a - 30, y: -20 }), + ...o.flatMap((o, r) => { + const c = o.profileId === i.profileId, + h = (null == e ? void 0 : e.ownerId) === o.profileId, + p = c + ? i.playerName || i.profileId + : o.playerName || o.profileId, + g = c ? s : o.skin, + m = d[r], + f = a / 2 - 50 - 20 * r; + return [ + n({ + text: String(o.rank), + font: { size: 15 }, + color: ve, + x: -t / 2 + 15, + y: f, + }), + l({ + width: g.size / 3, + height: g.size / 3, + fileName: `images/player/skins/${g.fileName}.png`, + rotation: 45, + x: -t / 2 + 35, + y: f, + }), + n({ + text: + m > u + ? cy.truncate( + p, + Math.floor(Math.round(p.length * (u / m))) - 1, + ) + : p, + color: h ? ke : ve, + font: { align: "left", weight: 600 }, + x: -t / 2 + 45, + y: f, + }), + ]; + }), + ]; + }, + }), + Iy = makePureSprite({ + shouldRerender: (e, t) => + e.rank !== t.rank || e.rankPercent !== t.rankPercent, + render: ({ props: { width: e, rank: t, rankPercent: a } }) => [ + n({ + text: String(t), + color: ve, + font: { size: 22, align: "left", weight: 800 }, + x: -e / 2 + 47, + y: 8, + }), + n({ + text: "LEVEL", + color: ve, + font: { size: 10, align: "left", weight: 800 }, + x: -e / 2 + 10, + y: 5, + }), + o({ width: e - 20, height: 8, color: Ue, y: -10 }), + o({ + width: (e - 20) * a, + height: 8, + color: Te, + anchorX: (-(e - 20) * a) / 2, + x: -e / 2 + 10, + y: -10, + }), + ], + }), + _y = makeSprite({ + render: ({ props: e }) => [ + c( + { + color: Re, + strokeColor: Ye, + strokeThickness: 8, + font: { size: 30, align: "left", weight: 800 }, + x: -e.width / 2 - 10, + y: 45, + }, + (t) => { + t.text = `LEVEL ${e.rank}`; + }, + ), + m({ + color: Ye, + thickness: 22, + lineCap: "round", + path: [ + [-e.width / 2, 0], + [e.width / 2, 0], + ], + }), + m({ + color: Le, + thickness: 12, + lineCap: "round", + path: [ + [-e.width / 2, 0], + [e.width / 2, 0], + ], + }), + m( + { + color: Re, + thickness: 12, + lineCap: "round", + path: [ + [-e.width / 2, 0], + [-e.width / 2 + e.width * e.rankPercent, 0], + ], + }, + (t) => { + t.path[1][0] = -e.width / 2 + e.width * e.rankPercent; + }, + ), + ], + }), + vy = makeCustomSprite({ + init({ props: e }) { + const { rank: t, rankPercent: a } = xu(e.profile.xpPoints); + return { + playerName: e.profile.playerName, + rank: t, + rankPercent: a, + updateName: null, + mockPlayerX: 0, + }; + }, + loop: ({ state: e }) => + Object.assign(Object.assign({}, e), { + mockPlayerX: e.mockPlayerX + 5, + }), + render({ + props: { + width: e, + height: t, + profile: a, + textInputX: i, + updatePlayerName: s, + playerSkin: o, + }, + state: { + playerName: r, + rank: l, + rankPercent: c, + updateName: d, + mockPlayerX: u, + }, + updateState: h, + getContext: p, + }) { + const g = r.trim(), + m = g.length > 20; + return [ + We({ + width: 110, + height: 30, + color: Re, + x: 3 - e / 2 + 55, + y: t / 2 - 20, + }), + We({ + width: 110, + height: 30, + color: Be, + x: -e / 2 + 55, + y: t / 2 - 20, + }), + n({ + text: localize("PROFILE"), + font: { size: 15 }, + color: ve, + x: -e / 2 + 55, + y: t / 2 - 20, + }), + We({ color: Re, width: e, height: t - 31, x: 3, y: -20 }), + We({ color: Be, width: e, height: t - 30, y: -20 }), + Iy({ + id: "LevelBar", + width: e, + rank: l, + rankPercent: c, + y: t / 2 - 65, + }), + MockPlayerTrail.Single({ + id: "PlayerTrail", + skin: o, + mockPlayerX: u, + globalContextVal: p(Se), + isFront: false, + }), + To.Single({ id: "Player", skin: o, x: 20 }), + MockPlayerTrail.Single({ + id: "PlayerTrail", + skin: o, + mockPlayerX: u, + globalContextVal: p(Se), + isFront: true, + }), + P({ + id: "Username", + fontName: "Montserrat", + fontSize: 15, + text: r, + onChangeText: (e) => { + h((t) => + Object.assign(Object.assign({}, t), { + playerName: e, + updateName: null, }), - new ((r = void 0) || (r = Promise))(function (e, t) { - function a(e) { - try { - n(l.next(e)); - } catch (e) { - t(e); - } - } - function i(e) { - try { - n(l.throw(e)); - } catch (e) { - t(e); - } - } - function n(t) { - var n; - t.done - ? e(t.value) - : ((n = t.value), - n instanceof r - ? n - : new r(function (e) { - e(n); - })).then(a, i); - } - n((l = l.apply(s, o || [])).next()); - }) ); - var s, o, r, l; - })().catch(Fy(t)), - { - playState: { type: "loading" }, - friends: [], - friendRequests: [], - modal: null, - inviteToParty: null, - startTimer: null, - } - ); - }, - loop({ state: e, props: t }) { - if (null === e.startTimer) return e; - const a = - "matchmaking" === e.playState.type - ? e.playState.server - : void 0; - if (a) { - const i = `ws://${a.address}:${a.port}`; - return ( - t.playOnline({ - url: i, - passcode: a.passcode, - localLevelFileName: null, - isLocalDev: false, - }), - e - ); - } - return e.startTimer <= 0 - ? Object.assign(Object.assign({}, e), { - playState: { - type: "error", - message: "No server set, can't start game", + }, + width: e - 20, + x: i, + y: -t / 2 + 105, + align: "left", + }), + null, + null !== d || m + ? n({ + text: m + ? "Too long" + : "updating" === d + ? "Updating..." + : "error" === d + ? "Failed" + : "", + color: Ve, + x: e / 2 - 40, + y: -t / 2 + 40, + }) + : g !== a.playerName && g.length > 0 + ? Fo({ + id: "UpdateName", + text: "UPDATE", + fontSize: 12, + width: 70, + height: 30, + x: e / 2 - 45, + y: -t / 2 + 40, + onPress: () => { + (h((e) => + Object.assign(Object.assign({}, e), { + updateName: "updating", + }), + ), + s(g) + .then(() => { + h((e) => + Object.assign(Object.assign({}, e), { + updateName: null, + }), + ); + }) + .catch(() => { + h((e) => + Object.assign(Object.assign({}, e), { + updateName: "error", + }), + ); + })); }, }) - : Object.assign(Object.assign({}, e), { - startTimer: e.startTimer - 1, - }); - }, - render({ props: e, state: t, updateState: a, device: i }) { + : null, + n({ + text: `ID ${a.profileId.slice(0, 8)}`, + color: ve, + font: { size: 12, align: "left", weight: 800 }, + x: -e / 2 + 10, + y: -t / 2 + 40, + }), + ]; + }, + }), + Ty = makeCustomSprite({ + init: () => ({ mockPlayerX: 0 }), + loop: ({ state: e }) => + Object.assign(Object.assign({}, e), { + mockPlayerX: e.mockPlayerX + 5, + }), + render: ({ + props: { width: e, height: t, playerSkin: a }, + state: { mockPlayerX: i }, + getContext: s, + }) => [ + We({ + width: 110, + height: 30, + color: Re, + x: 3 - e / 2 + 55, + y: t / 2 - 20, + }), + We({ + width: 110, + height: 30, + color: Be, + x: -e / 2 + 55, + y: t / 2 - 20, + }), + n({ + text: localize("PROFILE"), + font: { size: 15 }, + color: ve, + x: -e / 2 + 55, + y: t / 2 - 20, + }), + We({ color: Re, width: e, height: t - 31, x: 3, y: -20 }), + We({ color: Be, width: e, height: t - 30, y: -20 }), + MockPlayerTrail.Single({ + id: "PlayerTrailBack", + skin: a, + mockPlayerX: i, + globalContextVal: s(Se), + isFront: false, + }), + To.Single({ id: "Player", skin: a, x: 20 }), + MockPlayerTrail.Single({ + id: "PlayerTrail", + skin: a, + mockPlayerX: i, + globalContextVal: s(Se), + isFront: true, + }), + /*n({ + text: "OFFLINE", + font: { size: 15 }, + color: Ve, + y: -t / 2 + 80, + }), + _m({ id: "GoOnline", y: -t / 2 + 40 }),*/ + ], + }), + MockPlayerTrail = makeSprite({ + render: ({ props: e }) => [ + Se.Single({ + context: () => e.globalContextVal, + sprites: [ + playerTrail.Single( + { + x: 20 - e.mockPlayerX, + playerX: e.mockPlayerX, + playerY: 0, + playerDir: 1, + crashed: false, + paused: false, + skin: e.skin, + isFront: e.isFront, + playerScale: 1, + playerSpeedMultiplier: 1, + }, + (t) => { + ((t.x = 20 - e.mockPlayerX), + (t.playerX = e.mockPlayerX), + (t.skin = e.skin)); + }, + ), + ], + }), + ], + }), + Oy = makeCustomSprite({ + init: () => ({ view: { type: "start" } }), + render({ + props: e, + state: { view: t }, + updateState: a, + device: i, + }) { + const { + onStart: s, + hasParty: o, + partySize: r, + width: l, + height: c, + } = e, + d = "isLeader" !== o || r <= 1, + u = "no" === o || r <= 1, + h = "notLeader" === o; + if ("pickFriendsMode" === t.type && !h) { const { - party: n, - updateParty: s, - profile: o, - playerSkin: r, - backend: l, - updatePlayerName: c, - fadeInMusic: d, - fadeOutMusic: u, - } = e, - { friends: h, friendRequests: p, playState: g, modal: m } = t, - f = i.size.height + 2 * i.size.heightMargin, - y = i.size.width + 2 * i.size.widthMargin, - E = - null !== n - ? n.ownerId === o.profileId - ? "isLeader" - : "notLeader" - : "no", - b = 30, - S = 0.5 * y, - I = 0.15 * y, - _ = y - 40 - 60 - S - I; + selectedLevel: i, + availableLevels: o, + withCheckpoints: r, + } = t; return [ Fo({ - id: "MainMenuButton", - text: "MAIN MENU", - width: 140, - height: 40, - onPress: () => { - (s(null), bp.deregisterOnline(l), e.backToMainMenu()); - }, - x: -y / 2 + 70 + b, - y: -f / 2 + 20 + b, - }), - Fo({ - id: "HelpButton", - text: "HELP", - width: 100, + id: "BackButton", + text: localize("BACK"), + width: 80, height: 40, + darkBg: true, onPress: () => { - a((e) => - Object.assign(Object.assign({}, e), { - modal: { type: "help" }, - }), - ); - }, - x: y / 2 - 50 - b, - y: -f / 2 + 20 + b, - }), - My({ - id: "OnlineMenuTabs", - width: S, - height: f - 60 - 60, - hasParty: E, - inPartyIds: - (null == n ? void 0 : n.members.map((e) => e.profileId)) || - [], - playState: g, - friends: h, - friendRequests: p, - profile: o, - playerSkin: r, - fadeInMusic: d, - fadeOutMusic: u, - onStart: (t) => { - if ("local" === t.type) - return void e.playOnline({ - url: `ws://${window.location.hostname}:9313`, - passcode: "", - localLevelFileName: t.levelFileName, - isLocalDev: true, - }); - const i = - (null == n - ? void 0 - : n.members.filter( - (e) => e.profileId !== o.profileId, - )) || []; - ("party" === t.type - ? bp - .startFriendsServerLobby(l, i, { - checkpoints: t.withCheckpoints, - levelFileName: t.levelFileName, - }) - .catch(Fy(a)) - : bp.findLobby(l, i).catch(Fy(a)), + (e.fadeInMusic(), a((e) => Object.assign(Object.assign({}, e), { - playState: { - type: "matchmaking", - numPlayers: 1 + i.length, - isFriends: "party" === t.type, - server: null, - }, + view: { type: "start" }, }), )); }, - inviteToParty: (t) => { - n - ? bp.inviteToParty(l, o, t, n).catch(() => { - console.error("Invite error"); - }) - : (a((e) => - Object.assign(Object.assign({}, e), { - inviteToParty: t, - }), - ), - bp - .createFriendsLobby(l, [], e.profile, e.playerSkin) - .catch(Fy(a))); - }, - addFriend: (e) => { - a((t) => - t.friends.map((e) => e.profileId).includes(e.profileId) - ? t - : Object.assign(Object.assign({}, t), { - friends: [...t.friends, e], + x: -l / 2 + 50, + y: -c / 2 + 30, + }), + Tm({ + id: "CheckpointsCheckbox", + text: localize("CHECKPOINTS"), + selected: r, + darkBg: true, + width: 170, + height: 40, + y: -c / 2 + 30, + onPress: () => { + a((e) => + "pickFriendsMode" !== e.view.type + ? e + : Object.assign(Object.assign({}, e), { + view: Object.assign(Object.assign({}, e.view), { + withCheckpoints: !e.view.withCheckpoints, }), + }), ); }, - removeFriend: (e) => { - a((t) => - Object.assign(Object.assign({}, t), { - friends: t.friends.filter( - (t) => t.profileId !== e.profileId, - ), - }), - ); - }, - removeFriendRequest: (e) => { - a((t) => { - const a = at(t.friendRequests, e); - return ( - Jp.addFriendRequests( - i.storage, - i.alert, - i.now, - a, - true, - ), - Object.assign(Object.assign({}, t), { - friendRequests: a, - }) - ); - }); - }, - textInputX: -y / 2 + b + S / 2, - x: -y / 2 + b + S / 2, - y: 30, - }), - vy({ - id: "ProfileView", - profile: o, - playerSkin: r, - updatePlayerName: c, - width: _, - height: f - 60 - 60, - textInputX: null !== m ? -2e3 : -y / 2 + b + S + 20 + _ / 2, - x: -y / 2 + b + S + 20 + _ / 2, - y: 30, }), - Sy({ - id: "PartyList", - party: n, - profile: o, - playerSkin: r, - onNewMember: () => i.audio("audio/menu/accept.wav").play(0), - width: I, - height: f - 60 - 60, - x: y / 2 - b - I / 2, - y: 30, + Fo({ + id: "StartButton", + text: "START", + width: 80, + height: 40, + darkBg: true, + disabled: null === i, + onPress: () => { + null !== i && + (e.fadeInMusic(), + s({ + type: "party", + withCheckpoints: r, + levelFileName: i.fileName, + })); + }, + x: l / 2 - 50, + y: -c / 2 + 30, }), - m && - ("joinParty" === m.type - ? by({ - id: "JoinPartyModal", - playerName: m.playerName, - closeModal: () => { - a((e) => - Object.assign(Object.assign({}, e), { - modal: null, - }), - ); - }, - confirm: () => { - (a((e) => - Object.assign(Object.assign({}, e), { - playState: { type: "loading" }, - modal: null, - }), - ), - bp - .joinFriendsLobby( - l, - m.lobbyId, - e.playerSkin, - xu(o.xpPoints).rank, - ) - .catch(Fy(a)) - .then(() => { - i.audio("audio/menu/accept.wav").play(0); - })); - }, - }) - : Ly({ - id: "HelpModal", - closeModal: () => { - a((e) => - Object.assign(Object.assign({}, e), { - modal: null, - }), - ); + ...(null !== i + ? [ + Gf({ + id: `LoadSong-${i.snippetFileName}`, + assets: { audioFileNames: [i.snippetFileName] }, + sprites: [ + Ro.Single({ + id: `PreviewSong-${i.snippetFileName}`, + fileName: i.snippetFileName, + loop: false, + paused: false, + fromPosition: 0, + overwrite: true, + isGameSfx: false, + }), + ], + }), + ] + : []), + "loading" === o + ? n({ text: `${localize("LOADING")}...`, color: Be }) + : ScrollContainer({ + id: "ScrollContainer", + containerWidth: l, + containerHeight: c - 80, + contentHeight: 40 * o.length, + y: 20 + (c - 80) / 2, + sprites: (t) => + o.map( + ( + { + levelName: n, + fileName: s, + snippetFileName: o, + author: r, + }, + c, + ) => + Ar({ + id: `AvailableLevel-${c}`, + text: `${n} ${localize("by")} ${r}`, + width: l - 20, + height: 30, + y: 40 * -c - 20, + noPress: t, + selected: + (null == i ? void 0 : i.fileName) === s, + colorLeft: xe, + colorMid: xe, + colorRight: Ue, + selectedColorLeft: Re, + selectedColorMid: Re, + selectedColorRight: Ue, + onPress: () => { + (e.fadeOutMusic(), + a((e) => + "pickFriendsMode" !== e.view.type + ? e + : Object.assign(Object.assign({}, e), { + view: Object.assign( + Object.assign({}, e.view), + { + selectedLevel: { + fileName: s, + snippetFileName: o, + }, + }, + ), + }), + )); + }, + }), + ), + }), + ]; + } + if ("pickLocalLevel" === t.type) { + const e = [ + ...Hl.getWorlds() + .flat() + .filter((e) => !e.boss), + { levelName: "Test", levelFileName: "test-level" }, + { + levelName: "Test LBS", + levelFileName: "test-level-last-block-standing", + }, + ]; + return [ + ScrollContainer({ + id: "ScrollContainer", + containerWidth: l, + containerHeight: c - 80, + contentHeight: 40 * e.length, + y: 20 + (c - 80) / 2, + sprites: (t) => + e.map(({ levelName: e, levelFileName: a }, i) => + Fo({ + id: `AvailableLevel-${i}`, + text: e, + width: l - 20, + height: 30, + y: 40 * -i - 20, + noPress: t, + onPress: () => { + s({ type: "local", levelFileName: a }); }, - })), + }), + ), + }), ]; - }, - }), - By = (e, t, a, i) => (n) => { - switch (n.type) { - case "friendsLobby": - const { inviteToParty: s } = t(); - (s && - bp.inviteToParty(i, a.profile, s, n.lobby).catch(() => { - console.error("Invite error"); - }), - e((e) => + } + return [ + h + ? n({ + text: "Waiting for party leader to start", + color: Be, + y: c / 2 - 30, + font: { size: 15 }, + }) + : null, + Fo({ + id: "StartRoyale", + text: "ROYALE", + width: 160, + fontSize: 20, + x: -90, + y: 30, + height: 50, + darkBg: true, + disabled: h, + onPress: () => s({ type: "royale" }), + }), + n({ + text: "Race online with up to", + color: Be, + font: { align: "left", weight: 800, size: 12 }, + x: -170, + y: -20, + }), + n({ + text: "60 players", + color: Be, + font: { align: "left", weight: 800, size: 12 }, + x: -170, + y: -35, + }), + Fo({ + id: "StartFriends", + text: "PARTY PLAY", + width: 160, + x: 90, + y: 30, + height: 50, + fontSize: 20, + darkBg: true, + disabled: d || h, + onPress: () => { + (a((e) => Object.assign(Object.assign({}, e), { - playState: - "matchmaking" === e.playState.type - ? e.playState - : { type: "readyToStart" }, - inviteToParty: null, + view: { + type: "pickFriendsMode", + availableLevels: "loading", + withCheckpoints: true, + selectedLevel: null, + }, }), ), - a.updateParty(n.lobby)); - break; - case "restartFriendsLobby": { - const { party: t } = a; - t && - t.ownerId === a.profile.profileId && - bp - .createFriendsLobby( - i, - t.members.filter( - (e) => e.profileId !== a.profile.profileId, - ), - a.profile, - a.playerSkin, - ) - .catch(Fy(e)); - break; - } - case "royaleLobby": { - const t = n.lobby.id, - a = n.lobby.totalMembers, - i = n.lobby.maxMembers; - e((e) => - "matchmaking" === e.playState.type - ? Object.assign(Object.assign({}, e), { - playState: { - type: "matchmaking", - isFriends: false, - lobbyId: t, - numPlayers: a, - maxPlayers: i || e.playState.maxPlayers, - server: e.playState.server, - }, - }) - : Object.assign(Object.assign({}, e), { - playState: { - type: "matchmaking", - isFriends: false, - lobbyId: t, - numPlayers: a, - maxPlayers: i, - server: null, + Jp.getAccount(i.storage, null, i.alert).then( + ({ data: { levelsProgress: e } }) => { + a((t) => + Object.assign(Object.assign({}, t), { + view: { + type: "pickFriendsMode", + availableLevels: Wl(e), + withCheckpoints: true, + selectedLevel: null, + }, + }), + ); + }, + )); + }, + }), + n({ + text: u + ? "Add friends to your party" + : "Race against your party", + color: Be, + font: { align: "left", weight: 800, size: 12 }, + x: 10, + y: -20, + }), + n({ + text: u ? "to race against them" : "to the end of the level", + color: Be, + font: { align: "left", weight: 800, size: 12 }, + x: 10, + y: -35, + }), + null, + null, + ]; + }, + }), + Cy = makeCustomSprite({ + init: () => ({ timeWithServer: 0 }), + loop: ({ props: e, state: t }) => + e.hasServer ? { timeWithServer: t.timeWithServer + 1 } : t, + render({ props: e, state: t }) { + const { + maxPlayers: a, + numPlayers: i, + isFriends: s, + hasServer: o, + } = e; + let r = "", + l = ""; + return ( + o && + (t.timeWithServer > 900 + ? ((r = "Launching new server..."), + (l = "(this may take longer than usual)")) + : (r = "Preparing game...")), + s + ? o || (r = "Finding server...") + : o || + (a === i + ? (r = "Players found, finding server...") + : ((r = "Finding players..."), a && (l = `${i}/${a}`))), + [ + n({ text: r, font: { size: 15 }, color: Be }), + l + ? n({ text: l, font: { size: 13 }, color: Be, y: -25 }) + : null, + ] + ); + }, + }); + const wy = makeCustomSprite({ + init: () => ({ + selectedFriend: null, + justInvitedIds: [], + view: "showFriends", + }), + render({ + props: { + width: e, + height: t, + friends: a, + friendRequests: i, + textInputX: s, + inPartyIds: o, + hasParty: r, + playState: l, + inviteToParty: c, + addFriend: d, + removeFriend: u, + removeFriendRequest: h, + profile: p, + }, + state: { selectedFriend: g, justInvitedIds: m, view: f }, + updateState: y, + device: E, + getContext: b, + }) { + if ("addFriend" === f) + return [ + Ay({ + id: "FindFriendsView", + profile: p, + width: e, + height: t, + goBack: () => { + y((e) => + Object.assign(Object.assign({}, e), { + view: "showFriends", + }), + ); + }, + textInputX: s, + }), + ]; + if ("showFriendRequests" === f) + return [ + ky({ + id: "FriendsRequestsView", + friendRequests: i, + profile: p, + width: e, + height: t, + addFriend: d, + removeFriendRequest: h, + goBack: () => { + y((e) => + Object.assign(Object.assign({}, e), { + view: "showFriends", + }), + ); + }, + }), + ]; + const S = null !== g && m.includes(g.profileId); + return [ + 0 === a.length + ? n({ + color: Be, + text: "Add friends to play together!", + font: { size: 12 }, + }) + : ScrollContainer({ + id: "FriendsList", + containerWidth: e, + containerHeight: t - 70, + contentHeight: 40 * a.length, + y: 25 + (t - 70) / 2, + sprites: (t) => + a.flatMap((a, i) => { + const n = 40 * -i - 20; + return [ + Ar({ + id: `Friend-${i}`, + text: `${a.playerName} - ID ${a.profileId.slice( + 0, + 8, + )}`, + width: e - 20, + height: 30, + y: n, + noPress: t, + selected: + (null == g ? void 0 : g.profileId) === + a.profileId, + colorLeft: Pe, + colorMid: Pe, + colorRight: Be, + selectedColorLeft: Re, + selectedColorMid: Re, + selectedColorRight: Be, + onPress: () => { + y((e) => + Object.assign(Object.assign({}, e), { + selectedFriend: a, + }), + ); }, }), - ); - break; - } - case "friendsServer": { - const t = n.lobby.id, - a = n.lobby.members.length, - i = n.lobby.maxMembers; - e((e) => - "matchmaking" === e.playState.type - ? Object.assign(Object.assign({}, e), { - playState: { - type: "matchmaking", - isFriends: true, - lobbyId: t, - numPlayers: a, - maxPlayers: i || e.playState.maxPlayers, - server: e.playState.server, - }, - }) - : Object.assign(Object.assign({}, e), { - playState: { - type: "matchmaking", - isFriends: true, - lobbyId: t, - numPlayers: a, - maxPlayers: i, - server: null, + Fo({ + id: `RemoveFriend-${i}`, + text: "X", + width: 30, + height: 25, + x: e / 2 - 30, + y: n, + strokeColor: Be, + darkBg: true, + noPress: t, + onPress: () => { + E.alert.okCancel( + `Are you sure you want to remove ${a.playerName} as a friend?`, + (e) => { + if (e) { + const { online: e } = b(Se); + if (!e) return; + bp.removeFriend(e.backend, a.profileId) + .then(() => { + u(a); + }) + .catch((e) => { + console.error( + "Failed to remove friend", + e, + ); + }); + } + }, + ); }, }), - ); - break; - } - case "server": - e((e) => - "matchmaking" !== e.playState.type - ? Object.assign(Object.assign({}, e), { - playState: { - type: "matchmaking", - isFriends: true, - lobbyId: "", - numPlayers: 1, - server: n.server, - }, - }) - : Object.assign(Object.assign({}, e), { - playState: Object.assign( - Object.assign({}, e.playState), - { server: n.server }, - ), + ]; + }), + }), + Fo({ + id: "InviteFriend", + text: S ? "SENT" : "INVITE TO PARTY", + disabled: + null === g || + S || + o.includes(g.profileId) || + "notLeader" === r || + "readyToStart" !== l.type, + width: 160, + height: 40, + x: 105, + y: -t / 2 + 30, + darkBg: true, + onPress: () => { + null !== g && + (E.audio("audio/menu/send.wav").play(0), + y((e) => + Object.assign(Object.assign({}, e), { + justInvitedIds: [...e.justInvitedIds, g.profileId], }), - ); - break; - case "exit": - (console.error("Exit lobby", n.reason), - e((e) => - Object.assign(Object.assign({}, e), { - playState: { type: "error", message: n.reason }, - }), - )); - break; - case "failedJoin": - e((e) => + ), + c(g), + E.timer.start(() => { + y((e) => + Object.assign(Object.assign({}, e), { + justInvitedIds: at( + e.justInvitedIds, + e.justInvitedIds.indexOf(g.profileId), + ), + }), + ); + }, 2e3)); + }, + }), + Fo({ + id: "AddFriend", + text: "+ FRIEND", + width: 100, + height: 40, + x: -30, + y: -t / 2 + 30, + darkBg: true, + onPress: () => { + y((e) => Object.assign(Object.assign({}, e), { - playState: { - type: "error", - message: "Failed to join lobby", - }, + view: "addFriend", }), ); - break; - case "startGame": - e((e) => - Object.assign(Object.assign({}, e), { startTimer: 300 }), + }, + }), + Fo({ + id: "SeeRequests", + text: "REQUESTS", + width: 100, + height: 40, + x: -135, + y: -t / 2 + 30, + darkBg: true, + disabled: 0 === i.length, + onPress: () => { + y((e) => + Object.assign(Object.assign({}, e), { + view: "showFriendRequests", + }), ); - } - }, - Fy = (e) => (t) => { - e((e) => - Object.assign(Object.assign({}, e), { - playState: { - type: "error", - message: - t instanceof Error ? t.message : "Can't connect online", + }, + }), + Ny({ id: "Badge", friendRequests: i, x: -90, y: -t / 2 + 50 }), + ]; + }, + }), + Ay = makeCustomSprite({ + init: () => ({ + searchField: "", + searchedUsers: null, + addingState: null, + selectedUser: null, + }), + render({ state: e, props: t, updateState: a, getContext: i }) { + const { + width: s, + height: o, + goBack: r, + textInputX: l, + profile: c, + } = t, + { + searchField: d, + searchedUsers: u, + selectedUser: h, + addingState: p, + } = e; + return [ + n({ + text: "PLAYER NAME", + color: Be, + font: { align: "left" }, + x: -s / 2 + 10, + y: o / 2 - 25, + }), + P({ + id: "SearchField", + fontName: "Montserrat", + fontSize: 12, + text: d, + onChangeText: (e) => { + a((t) => + Object.assign(Object.assign({}, t), { searchField: e }), + ); + }, + width: s - 140, + x: l - 60, + y: o / 2 - 35, + align: "left", + }), + null, + Fo({ + id: "SearchButton", + text: "SEARCH", + width: 100, + height: 35, + darkBg: true, + x: s / 2 - 60, + y: o / 2 - 40, + disabled: "" === d, + onPress: () => { + const { online: e } = i(Se); + e && + (a((e) => + Object.assign(Object.assign({}, e), { + searchedUsers: "loading", + selectedUser: null, + addingState: null, + }), + ), + bp + .findUsersByName(e.backend, d) + .then((e) => { + a((t) => + Object.assign(Object.assign({}, t), { + isLoading: false, + searchedUsers: e.filter( + (e) => e.profileId !== c.profileId, + ), + }), + ); + }) + .catch((e) => { + a((t) => + Object.assign(Object.assign({}, t), { + isLoading: false, + searchedUsers: e, + }), + ); + })); + }, + }), + "loading" === u + ? n({ color: Be, text: `${localize("LOADING")}...` }) + : null === u + ? null + : u instanceof Error + ? n({ color: Ve, text: u.message }) + : 0 === u.length + ? n({ color: Be, text: "No players found" }) + : ScrollContainer({ + id: "UserList", + containerWidth: s, + containerHeight: o - 120, + contentHeight: 40 * u.length, + y: (o - 120) / 2, + sprites: (e) => + u.map((t, i) => + Ar({ + id: `User-${i}`, + text: `${t.playerName} - ID ${t.profileId.slice( + 0, + 8, + )}`, + width: s - 20, + height: 30, + y: 40 * -i - 20, + noPress: e, + selected: + (null == h ? void 0 : h.profileId) === + t.profileId, + colorLeft: Pe, + colorMid: Pe, + colorRight: Be, + selectedColorLeft: Re, + selectedColorMid: Re, + selectedColorRight: Be, + onPress: () => { + a((e) => + Object.assign(Object.assign({}, e), { + selectedUser: t, + addingState: null, + }), + ); + }, + }), + ), + }), + Fo({ + id: "BackButton", + text: localize("BACK"), + width: 100, + height: 40, + darkBg: true, + onPress: r, + x: -85, + y: -o / 2 + 30, + }), + Fo({ + id: "AddFriend", + text: + "loading" === p + ? "SENDING..." + : "error" === p + ? "FAILED" + : "sent" === p + ? "SENT!" + : "SEND REQUEST", + disabled: null === h || null !== p, + width: 160, + height: 40, + x: 85, + y: -o / 2 + 30, + darkBg: true, + onPress: () => { + const { online: e } = i(Se); + e && + h && + (a((e) => + Object.assign(Object.assign({}, e), { + addingState: "loading", + }), + ), + bp + .sendFriendRequest(e.backend, c, h.profileId) + .then(() => { + a((e) => + Object.assign(Object.assign({}, e), { + addingState: "sent", + }), + ); + }) + .catch(() => { + a((e) => + Object.assign(Object.assign({}, e), { + addingState: "error", + }), + ); + })); }, }), - ); + ]; }, - Yy = makeCustomSprite({ - render({ - getContext: e, - device: { size: t, alert: a }, - props: { accountState: i, closeModal: s }, - }) { - const { sendAccountAction: r, online: c } = e(Se), - d = t.height + 2 * t.heightMargin, - u = t.width + 2 * t.widthMargin, - h = "loggedIn" === i.type ? i.profile : null, - p = [ - Clickable({ - id: "SignInButton", - sprites: (e) => [ - l({ - fileName: `images/mainMenu/googlesignin_button${ - e ? "_pressed" : "" - }.png`, - testId: "GoogleSignInButton", - width: 127, - height: 31, + }), + ky = makeCustomSprite({ + render({ props: e, getContext: t, device: a }) { + const { + width: i, + height: n, + goBack: s, + friendRequests: o, + profile: r, + removeFriendRequest: l, + addFriend: c, + } = e; + return [ + ScrollContainer({ + id: "FriendsList", + containerWidth: i, + containerHeight: n - 70, + contentHeight: 40 * o.length, + y: 25 + (n - 70) / 2, + sprites: (e) => + o.flatMap((n, d) => { + const u = 40 * -d - 20; + return [ + wr({ + id: `FriendRequest-${d}`, + text: `${n.playerName} - ID ${n.profileId.slice( + 0, + 8, + )}`, + colorLeft: xe, + colorMid: xe, + colorRight: Be, + width: i - 20, + height: 30, + y: u, }), - ], - width: 127, - height: 31, - y: 30, - disabled: !h, - opacity: h ? 1 : 0.5, - onPress: () => { - h && r({ type: "signInWithGoogle", profile: h }); - }, - }), - ], - g = "requestingAuth" === i.type; - return [ - Clickable({ - id: "ClickOutside", - onPressOutside: () => { - (g && zu.cancelGoogleSignIn(), s()); - }, - width: 300, - height: 230, - sprites: () => [], - onPress: () => null, - }), - o({ color: "black", opacity: 0.7, width: u, height: d }), - We({ width: 310, height: 240, color: Re, x: -5, y: -5 }), - We({ width: 300, height: 230, color: ve }), - Fo({ - id: "CloseButton", - text: g ? "CANCEL" : "CLOSE", - y: -80, - width: 80, - height: 40, - darkBg: true, - onPress: () => { - g ? zu.cancelGoogleSignIn() : s(); - }, - }), - ...((null == c ? void 0 : c.signedInAccount) - ? [ Fo({ - id: "Delete", - text: "DELETE ACCOUNT", - width: 180, - height: 40, + id: `AcceptFriend-${d}`, + text: "✓", + width: 30, + height: 25, + x: i / 2 - 70, + y: u, + strokeColor: Be, darkBg: true, - textColor: Ve, - y: 80, + noPress: e, onPress: () => { - a.okCancel( - "Are you sure you want to delete your online account?", - (e) => { - e && r({ type: "deleteAccount" }); - }, + return ( + (e = this), + (i = void 0), + (h = function* () { + const { online: e } = t(Se); + e && + (c(n), + l(d), + 1 === o.length && s(), + a.audio("audio/menu/accept.wav").play(0), + yield bp.addFriend(e.backend, n.profileId), + yield bp.acceptFriendRequest( + e.backend, + r, + n.profileId, + )); + }), + new ((u = void 0) || (u = Promise))(function ( + t, + a, + ) { + function n(e) { + try { + o(h.next(e)); + } catch (e) { + a(e); + } + } + function s(e) { + try { + o(h.throw(e)); + } catch (e) { + a(e); + } + } + function o(e) { + var a; + e.done + ? t(e.value) + : ((a = e.value), + a instanceof u + ? a + : new u(function (e) { + e(a); + })).then(n, s); + } + o((h = h.apply(e, i || [])).next()); + }) ); + var e, i, u, h; }, }), Fo({ - id: "Detach", - text: "DETACH ACCOUNT", - width: 180, - height: 40, - darkBg: true, - onPress: () => { - r({ type: "detachAccount" }); - }, - y: 30, - }), - Fo({ - id: "SignOut", - text: "SIGN OUT", - width: 180, - height: 40, + id: `RejectFriend-${d}`, + text: "X", + width: 30, + height: 25, + x: i / 2 - 30, + y: u, + strokeColor: Be, darkBg: true, + noPress: e, onPress: () => { - r({ type: "signOut" }); + (l(d), 1 === o.length && s()); }, - y: -20, }), - ] - : "requestingAuth" === i.type || "signingIn" === i.type - ? [n({ text: "Signing in", color: Be, y: 30 })] - : "signingOut" === i.type - ? [n({ text: "Signing out", color: Be, y: 30 })] - : "deleting" === i.type - ? [n({ text: "Deleting", color: Ve, y: 30 })] - : p), - ]; - }, - }), - Uy = { bronze: 1, silver: 2, gold: 3, levelPack: 4 }, - jy = (e, t, a) => { - const i = []; - return ( - e.rewards.blocks > 0 && - i.push({ - icon: _f("blocks"), - lines: [`${e.rewards.blocks} BLOCKS`], - }), - e.rewards.items.forEach((e) => { - i.push({ - icon: _f(e.defId), - lines: cy.splitTextIntoLines( - e.name.toLocaleUpperCase(), - t, - a, - ), - }); + ]; + }), }), - i - ); + Fo({ + id: "BackButton", + text: localize("BACK"), + width: 100, + height: 40, + darkBg: true, + onPress: s, + x: -85, + y: -n / 2 + 30, + }), + ]; }, - Gy = (e, t) => - Uy[e.category] - Uy[t.category] || e.name.localeCompare(t.name), - Vy = makeCustomSprite({ - init({ props: e, updateState: t, device: a, getContext: i }) { - const { online: n } = i(Se); - return ( - n && - bp - .getBuyableItems(n.backend) - .then((e) => { - t((t) => - Object.assign(Object.assign({}, t), { - passItem: - e.find((e) => "achievement_pass" === e.defId) || - "loading", - }), - ); - }) - .catch((t) => { - a.alert.ok( - `Couldn't retrieve items from store: ${t.message}`, - () => { - e.closeMenu(); - }, - ); - }), - { - passItem: "loading", - showBuyBlocksModal: null, - isPurchasing: false, - } - ); - }, - render({ - props: { didBuy: e, closeMenu: t }, - state: { showBuyBlocksModal: a, isPurchasing: i, passItem: s }, - device: r, - updateState: c, - getContext: d, - }) { - const u = r.size.width + 2 * r.size.widthMargin, - h = r.size.height + 2 * r.size.heightMargin, - { online: p } = d(Se); - if (!p) return []; - const { - blocksBalance: g, - backend: m, - updateBlocksBalance: f, - } = p, - y = (a) => { - bp.buyItem(m, a) - .then( - ({ balance: t, item: a }) => ( - f(t), - e(), - r.audio("audio/global/purchase-item.wav").play(), - Jp.addPurchasedItems([a], r.now) - ), - ) - .then(() => { - t(); - }) - .catch((e) => { - r.alert.ok(`Error buying item: ${e.message}`); - }) - .finally(() => { - c((e) => - Object.assign(Object.assign({}, e), { - isPurchasing: false, - }), - ); - }); - }; - return [ - o({ color: "black", opacity: 0.7, width: u, height: h }), - Clickable({ - id: "BlockBehind", - width: u, - height: h, - sprites: () => [], - onPress: () => null, - }), - o({ width: 700, height: 350, color: ve }), - n({ - font: { size: 38 }, - text: "CAN YOU BEAT", - strokeColor: Ye, - color: ve, - strokeThickness: 11, - y: 160, - }), - n({ - font: { size: 38 }, - text: "THE IMPOSSIBLE", - strokeColor: Ye, - color: ve, - strokeThickness: 11, - y: 125, - }), - l({ - fileName: "images/achievement/buy-pass-marks.png", - width: 49, - height: 42, - x: 210, - y: 137, - }), - Fo({ - id: "CloseButton", - text: "X", - x: 350, - y: 165, - width: 40, - height: 40, - onPress: t, - strokeColor: Ye, - }), - n({ - text: "EARN REWARDS FOR UNLOCKING ACHIEVEMENTS", - color: Ye, - font: { size: 18 }, - y: 90, - }), - We({ - x: 0, - width: 680, - height: 140, - strokeColor: Re, - strokeThickness: 6, - }), - l({ - fileName: "images/achievement/skater-screenshot.png", - x: -190, - width: 200, - height: 113, - }), - o({ - color: Ye, - width: 10, - height: 10, - rotation: 45, - x: -60, - y: 30, - }), - n({ - text: "INCLUDES BONUS LEVEL CLOUD 9", - color: Ye, - font: { size: 18, align: "left" }, - x: -45, - y: 30, - }), - o({ color: Te, width: 10, height: 10, rotation: 45, x: -60 }), - n({ - text: "ONLINE PLAYER SKINS", - color: Ye, - font: { size: 18, align: "left" }, - x: -45, - }), - o({ - color: Ye, - width: 10, - height: 10, - rotation: 45, - x: -60, - y: -30, - }), - n({ - text: "1000+ BLOCKS TO SPEND", - color: Ye, - font: { size: 18, align: "left" }, - x: -45, - y: -30, - }), - n({ - text: `BLOCKS: ${g}`, - color: ve, - strokeColor: Ye, - font: { size: 15 }, - strokeThickness: 5, - x: 200, - y: -95, - }), - Fo({ - id: "Add Blocks", - text: "+", - fontSize: 30, - width: 60, - height: 60, - onPress: () => { - c((e) => - Object.assign(Object.assign({}, e), { - showBuyBlocksModal: {}, - }), - ); - }, - x: 200, - y: -140, - strokeColor: Ye, - textColor: ve, - textStroke: Ye, - textStrokeThickness: 6, - }), - n({ - text: "ACHIEVEMENT PASS", - color: ve, - strokeColor: Ye, - font: { size: 20 }, - strokeThickness: 6, - x: -50, - y: -95, - }), - ...("loading" === s - ? [ - n({ - text: `${localize("LOADING")}...`, - font: { size: 20 }, - color: Ye, - x: -50, - y: -140, + }), + Ny = makeCustomSprite({ + render: ({ props: e }) => + 0 === e.friendRequests.length + ? [] + : [ + s({ color: Ve, radius: 10 }), + n({ color: ve, text: String(e.friendRequests.length) }), + ], + }), + xy = makeCustomSprite({ + init: ({ props: e, updateState: t }) => ( + Jp.getUserItems("skin").then((e) => { + const a = Object.values(Wt.skins) + .map((t) => { + const a = + t.fileName === Wt.default.fileName || + e.some((e) => e.skinName === t.fileName); + if (t.hidden && !a) return null; + if (a) return { skin: t, unlockText: null }; + const i = {}; + _u.forEach((e) => { + e.rewards.items.forEach((t) => { + if (t.defId.startsWith("skin_")) { + const a = t.defId.slice(5); + i[a] = { + name: e.name, + author: e.author, + isSuperLevelPack: "levelPack" === e.category, + }; + } + }); + }); + const n = i[t.fileName]; + if (!n) return { skin: t, unlockText: [""] }; + const s = cy.splitTextIntoLines( + zu.hasIAP() + ? `UNLOCKED WITH ${n.isSuperLevelPack + ? "THE SUPER LEVEL PACK" + : "THE ACHIEVEMENT PASS" + }: ${n.name.toLocaleUpperCase()}` + : `${n.name.toLocaleUpperCase()} TO UNLOCK`, + { family: "Montserrat", size: 10, weight: 800 }, + 120, + ); + return { skin: t, unlockText: [""] }; // s }; + }) + .filter(nt) + .sort( + (e, t) => + Number(null === t.unlockText) - + Number(null === e.unlockText), + ); + t((e) => + Object.assign(Object.assign({}, e), { allSkinItems: a }), + ); + }), + { + allSkinItems: "loading", + selectedSkinItem: { skin: e.playerSkin, unlockText: null }, + updatingSkin: false, + } + ), + render({ + props: { width: e, height: t, playerSkin: a, profileId: i }, + state: { allSkinItems: allSkinItems, selectedSkinItem: o, updatingSkin: r }, + updateState: c, + getContext: d, + }) { + if ("loading" === allSkinItems) + return [n({ text: `${localize("LOADING")}...`, color: Be })]; + const u = 0.6 * e, + h = 0.2 * -e; + return [ + We({ + color: Fe, + width: 120, + height: 110, + x: 110, + y: t / 2 - 75, + }), + n({ + text: localize(o.skin.name), + font: { size: 16, weight: 800 }, + color: ve, + x: 110, + y: t / 2 - 40, + strokeColor: Fe, + strokeThickness: 8, + }), + l({ + fileName: `images/player/skins/${o.skin.fileName}.png`, + width: o.skin.size, + height: o.skin.size, + x: 110, + y: o.skin.author ? t / 2 - 80 : t / 2 - 90, + rotation: 30, + }), + n({ + text: o.skin.author ? (`${localize('by')} ` + o.skin.author) : "", + x: 110, + y: t / 2 - 120, + color: ve, + font: { weight: 500 }, + }), + Fo({ + id: "EquipButton", + text: r ? "EQUIPPING" : "EQUIP", + width: 120, + height: 50, + darkBg: true, + disabled: + (r || + o.skin.fileName === a.fileName || + null !== o.unlockText, + false), + onPress: () => { + var { online: e, updatePlayerSkin: t } = d(Se); + e = false; // ha! + e && i + ? (bp + .equipSkin(e.backend, o.skin, i) + .then(() => { + (t(o.skin), + c((e) => + Object.assign(Object.assign({}, e), { + updatingSkin: false, + }), + )); + }) + .catch(() => { + c((e) => + Object.assign(Object.assign({}, e), { + updatingSkin: false, + }), + ); }), - ] - : i - ? [ - n({ - text: `${localize("PURCHASING")}...`, - font: { size: 20 }, - color: Ye, - x: -50, - y: -140, - }), - ] - : [ - Fo({ - id: "BuyPass", - text: `${localize("BUY")} - ${s.blocksPrice} ${localize( - "BLOCKS", - )}`, - width: 250, - height: 60, - onPress: () => { - (c((e) => - Object.assign(Object.assign({}, e), { - isPurchasing: true, - }), - ), - s.blocksPrice > g - ? c((e) => - Object.assign(Object.assign({}, e), { - showBuyBlocksModal: { - buyItemOnComplete: s, - }, - }), - ) - : y(s)); - }, - x: -50, - y: -140, - strokeColor: Ye, - textColor: ve, - textStroke: Ye, - textStrokeThickness: 5, - }), - ]), - a && - bm({ - id: "BuyBlocksModal", - onModalClose: () => { c((e) => Object.assign(Object.assign({}, e), { - showBuyBlocksModal: null, - isPurchasing: false, + updatingSkin: true, }), - ); - }, - onPurchaseComplete: (e) => { - (a.buyItemOnComplete && - e >= a.buyItemOnComplete.blocksPrice && - y(a.buyItemOnComplete), - f(e), + )) + : t(o.skin); + }, + x: 110, + y: t / 2 - 160, + }), + ...(null === o.unlockText + ? [] + : [ + We({ + color: ve, + x: 110, + width: 130, + height: 10 * o.unlockText.length + 10, + y: t / 2 - 195 - 5 * o.unlockText.length, + }), + ...o.unlockText.map((e, a) => + n({ + text: e, + x: 110, + y: t / 2 - 200 - 10 * a, + color: Be, + font: { weight: 800 }, + }), + ), + ]), + ScrollContainer({ + id: "ScrollContainer", + containerHeight: t, + containerWidth: u, + contentHeight: 70 * Math.ceil(allSkinItems.length / 3) + 30, + y: t / 2, + x: h, + sprites: (e) => [ + ...allSkinItems.map((t, a) => { + const i = (a % 3) - 1, + n = Math.floor(a / 3), + s = t.skin.fileName === o.skin.fileName; + return Py({ + id: `SkinButton-${t.skin.fileName}`, + x: 70 * i, + y: -40 - 70 * n, + onPress: () => { c((e) => Object.assign(Object.assign({}, e), { - showBuyBlocksModal: null, + selectedSkinItem: t, }), - )); - }, + ); + }, + noPress: e, + skinItem: t, + selected: s, + }); }), + ], + }), + ]; + }, + }), + Py = makeCustomSprite({ + render: ({ + props: { + skinItem: { skin: e, unlockText: t }, + onPress: a, + noPress: i, + selected: n, + }, + device: s, + }) => [ + Clickable({ + id: "Clickable", + width: 60, + height: 60, + onPress: () => { + (s.audio("audio/global/button.wav").play(0), a()); + }, + disabled: i || n, + sprites: (a) => { + const i = true; // null === t; + return [ + So({ + id: "RaiseRects", + width: 60, + height: 60, + raiseHeight: 5, + rad: 5, + isPressed: a, + topColour: n ? Re : a ? ke : i ? Pe : ze, + bottomColour: i || n ? xe : Xe, + sprites: (t) => [ + l({ + fileName: `images/player/skins/${e.fileName}.png`, + testId: `SkinButton-${e.fileName}`, + width: e.size, + height: e.size, + y: t, + opacity: i ? void 0 : 0.5, + }), + ], + }), + ]; + }, + }), + ], + }), + My = makeCustomSprite({ + init: () => ({ tab: "skins" }), + render({ + props: { + width: e, + height: t, + inPartyIds: a, + hasParty: i, + onStart: s, + friends: o, + friendRequests: r, + playState: l, + inviteToParty: c, + addFriend: d, + removeFriend: u, + removeFriendRequest: h, + textInputX: p, + profile: g, + playerSkin: m, + fadeInMusic: f, + fadeOutMusic: y, + }, + state: { tab: E }, + updateState: b, + }) { + const S = { type: "linearHoriz", width: 80, colors: [xe, De] }, + I = t - 30, + _ = -20, + v = [ + ...("play" === E + ? [ + We({ + width: 110, + height: 40, + color: Ge, + x: 3 - e / 2 + 55, + y: t / 2 - 20, + }), + We({ + width: 110, + height: 40, + color: ve, + x: -e / 2 + 55, + y: t / 2 - 20, + }), + n({ + text: localize("PLAY"), + font: { size: 18 }, + color: Ae, + gradient: S, + x: -e / 2 + 55, + y: t / 2 - 20, + }), + ] + : [ + Fo({ + id: "PlayTabButton", + text: localize("PLAY"), + width: 110, + height: 35, + fontSize: 15, + shadowDir: "right", + x: -e / 2 + 55, + y: t / 2 - 20, + onPress: () => { + b((e) => + Object.assign(Object.assign({}, e), { + tab: "play", + }), + ); + }, + }), + ]), + ...("friends" === E + ? [ + We({ + width: 110, + height: 40, + color: Ge, + x: 3 - e / 2 + 180, + y: t / 2 - 20, + }), + We({ + width: 110, + height: 40, + color: ve, + x: -e / 2 + 180, + y: t / 2 - 20, + }), + n({ + text: "FRIENDS", + font: { size: 18 }, + color: Ae, + gradient: S, + x: -e / 2 + 180, + y: t / 2 - 20, + }), + ] + : [ + Fo({ + id: "FriendsTabButton", + text: "FRIENDS", + width: 110, + height: 35, + fontSize: 15, + shadowDir: "right", + x: -e / 2 + 180, + y: t / 2 - 20, + onPress: () => { + b((e) => + Object.assign(Object.assign({}, e), { + tab: "friends", + }), + ); + }, + }), + Ny({ + id: "Badge", + friendRequests: r, + x: -e / 2 + 235, + y: t / 2 - 5, + }), + ]), + ...("skins" === E + ? [ + We({ + width: 110, + height: 40, + color: Ge, + x: 3 - e / 2 + 305, + y: t / 2 - 20, + }), + We({ + width: 110, + height: 40, + color: ve, + x: -e / 2 + 305, + y: t / 2 - 20, + }), + n({ + text: localize("SKINS"), + font: { size: 18 }, + color: Ae, + gradient: S, + x: -e / 2 + 305, + y: t / 2 - 20, + }), + ] + : [ + Fo({ + id: "SkinsTabButton", + text: localize("SKINS"), + width: 110, + height: 35, + fontSize: 15, + shadowDir: "right", + x: -e / 2 + 305, + y: t / 2 - 20, + onPress: () => { + b((e) => + Object.assign(Object.assign({}, e), { + tab: "skins", + }), + ); + }, + }), + ]), + We({ + gradient: { + type: "linearHoriz", + width: e, + colors: [Ne, De], + }, + width: e, + height: I, + x: 3, + y: -24, + }), + We({ color: ve, width: e, height: I, y: _ }), ]; + return "loading" === l.type + ? [...v, n({ text: `${localize("LOADING")}...`, color: Be })] + : "play" === E + ? [ + ...v, + "error" === l.type + ? n({ text: l.message, color: Ve }) + : "readyToStart" === l.type + ? Oy({ + id: "StartOnlineMenu", + hasParty: i, + partySize: a.length, + onStart: s, + width: e, + height: I, + y: _, + fadeInMusic: f, + fadeOutMusic: y, + }) + : "matchmaking" === l.type + ? Cy({ + id: "Matchmaking", + isFriends: l.isFriends, + numPlayers: l.numPlayers, + maxPlayers: l.maxPlayers, + hasServer: Boolean(l.server), + y: _, + }) + : null, + ] + : "skins" === E + ? [ + ...v, + xy({ + id: "SkinsMenu", + width: e, + height: I, + playerSkin: m, + profileId: g.profileId, + y: _, + }), + ] + : [ + ...v, + wy({ + id: "FriendsMenu", + width: e, + height: I, + friends: o, + friendRequests: r, + textInputX: p, + inPartyIds: a, + hasParty: i, + playState: l, + inviteToParty: c, + addFriend: d, + removeFriend: u, + removeFriendRequest: h, + profile: g, + y: _, + }), + ]; + }, + }), + Ly = makeCustomSprite({ + render({ + props: e, + device: { + size: { fullWidth: t, fullHeight: a }, }, - }), - Hy = function (e) { - return "cache" === e.type - ? Jp.getLocal(e.storage, { - ok: () => null, - okCancel: () => null, - }).then((e) => e.data.offlineCache.achievements) - : bp.getAchievements(e.backend); + }) { + const { closeModal: i } = e; + return [ + Clickable({ + id: "ClickOutside", + onPressOutside: i, + width: 500, + height: 320, + sprites: () => [], + onPress: () => null, + }), + o({ color: "black", opacity: 0.7, width: t, height: a }), + We({ width: 510, height: 330, color: Re, x: -5, y: -5 }), + We({ width: 500, height: 320, color: ve }), + n({ text: "ROYALE", color: Be, font: { size: 20 }, y: 130 }), + n({ + text: "Race up to 60 online players in a randomly chosen level", + color: Be, + font: { size: 13, weight: 600 }, + y: 105, + }), + n({ + text: "Reach the next checkpoint before others to qualify", + color: Be, + font: { size: 13, weight: 600 }, + y: 85, + }), + n({ + text: "The elimination timer starts when at least one player qualifies", + color: Be, + font: { size: 13, weight: 600 }, + y: 65, + }), + n({ + text: "Every checkpoint will reduce the number of places left", + color: Be, + font: { size: 13, weight: 600 }, + y: 45, + }), + n({ + text: "By the end of the level, only one place will be available for the winner!", + color: Be, + font: { size: 13, weight: 600 }, + y: 25, + }), + n({ + text: "PARTY PLAY", + color: Be, + font: { size: 20 }, + y: -20, + }), + n({ + text: "Race against players in your party", + color: Be, + font: { size: 13, weight: 600 }, + y: -45, + }), + n({ + text: "The party leader can choose a level they've unlocked to race in", + color: Be, + font: { size: 13, weight: 600 }, + y: -65, + }), + n({ + text: "There are no knockouts, the winner is the first to the final checkpoint!", + color: Be, + font: { size: 13, weight: 600 }, + y: -85, + }), + Fo({ + id: "CloseButton", + text: "CLOSE", + y: -130, + width: 100, + height: 40, + darkBg: true, + onPress: i, + }), + ]; }, - Xy = makeCustomSprite({ - init({ - props: e, - updateState: t, - device: a, - getContext: i, - preloadFiles: n, - }) { - const { online: s } = i(Se), - o = s - ? { type: "online", backend: s.backend } - : { - type: "cache", - encryptedCache: Jp.getEncryptedStorage(), - storage: a.storage, - }; - return ( - Promise.all([ - Hy(o), - Jp.getUserItems("all"), - Jp.getOfflineRequests(a.storage), - n({ - imageFileNames: [ - ...Qs.achievementImages, - ...Qs.getPlayerImages(Object.values(Wt.skins), []), - ], - audioFileNames: Qs.achievementSfx, + }); + const Dy = makeCustomSprite({ + init({ props: e, updateState: t, getState: a, device: i }) { + function n(e) { + switch (e.type) { + case "invite": + t((t) => + Object.assign(Object.assign({}, t), { + modal: { + type: "joinParty", + lobbyId: e.lobbyId, + playerName: e.from.playerName, + }, }), - ]) - .then(([e, t, i]) => - Jp.saveLocalOfflineCache(a.storage, a.now, { - achievements: e, - }).then(() => ({ - achievements: e, - items: t, - offlineRequests: i, - })), - ) - .then(({ achievements: e, items: a, offlineRequests: i }) => { - t((t) => + ); + break; + case "friendRequest": + t((t) => { + const a = t.friends.map((e) => e.profileId), + n = t.friendRequests.map((e) => e.profileId); + if ( + !a.includes(e.from.profileId) && + !n.includes(e.from.profileId) + ) { + i.audio("audio/menu/party-invite.wav").play({ + overwrite: true, + }); + const a = [...t.friendRequests, e.from]; + return ( + Jp.addFriendRequests( + i.storage, + i.alert, + i.now, + a, + true, + ), Object.assign(Object.assign({}, t), { - achievements: e.sort(Gy), - hasPass: - !zu.hasIAP() || - a.some( - (e) => - "passItem" === e.type && - "achievement" === e.passType, - ), - hasSuperLevelPack: - !zu.hasIAP() || - a.some( - (e) => - "bonusLevelItem" === e.type && - "superLevelPack" === e.name, - ), - hasPendingAchievements: i.some( - (e) => "completedLevel" === e.type, - ), - }), + friendRequests: a, + }) ); - }) - .catch((t) => { - (console.error(t), - a.alert.ok("Failed to load achievements"), - e.backToMainMenu()); - }), - { - achievements: "loading", - showBuyPassModal: false, - hasPass: false, - hasSuperLevelPack: false, - hasPendingAchievements: false, - } + } + return t; + }); + break; + case "friendRequestAccept": + t((t) => { + const a = { + profileId: e.from.profileId, + playerName: e.from.playerName, + }; + return t.friends + .map((e) => e.profileId) + .includes(a.profileId) + ? t + : Object.assign(Object.assign({}, t), { + friends: [...t.friends, a], + }); + }); + } + } + return ( + (function () { + return ( + (s = this), + (o = void 0), + (l = function* () { + const { friends: s, friendRequests: o } = + yield bp.setupOnline( + e.backend, + n, + By(t, a, e, e.backend), + ); + let r = []; + if ( + (o.length > 0 + ? (i.audio("audio/menu/party-invite.wav").play(0), + (r = yield Jp.addFriendRequests( + i.storage, + i.alert, + i.now, + o, + false, + ))) + : (r = (yield Jp.getAccount(i.storage, null, i.alert)) + .data.friendRequests), + t((e) => + Object.assign(Object.assign({}, e), { + friends: s, + friendRequests: r, + playState: { type: "readyToStart" }, + }), + ), + e.party && e.party.ownerId === e.profile.profileId) + ) { + const a = e.party.members.filter( + (t) => t.profileId !== e.profile.profileId, + ); + i.timer.start(() => { + bp.createFriendsLobby( + e.backend, + a, + e.profile, + e.playerSkin, + ).catch(Fy(t)); + }, 3e3); + } + }), + new ((r = void 0) || (r = Promise))(function (e, t) { + function a(e) { + try { + n(l.next(e)); + } catch (e) { + t(e); + } + } + function i(e) { + try { + n(l.throw(e)); + } catch (e) { + t(e); + } + } + function n(t) { + var n; + t.done + ? e(t.value) + : ((n = t.value), + n instanceof r + ? n + : new r(function (e) { + e(n); + })).then(a, i); + } + n((l = l.apply(s, o || [])).next()); + }) ); - }, - render({ - props: e, - state: t, - device: a, - updateState: i, - getContext: s, - }) { - const o = a.size.width + 2 * a.size.widthMargin, - r = a.size.height + 2 * a.size.heightMargin, - { - showBuyPassModal: l, - achievements: c, - hasPass: d, - hasSuperLevelPack: u, - hasPendingAchievements: h, - } = t, - { online: p } = s(Se), - g = [ - Uf({ - id: "Title", - text: localize("ACHIEVEMENTS"), - width: 200, - height: 35, - x: -o / 2 + 120, - y: r / 2 - 40, - }), - Fo({ - id: "BackButton", - text: localize("BACK"), - width: 80, - height: 40, - onPress: e.backToMainMenu, - x: -o / 2 + 60, - y: -r / 2 + 40, + var s, o, r, l; + })().catch(Fy(t)), + { + playState: { type: "loading" }, + friends: [], + friendRequests: [], + modal: null, + inviteToParty: null, + startTimer: null, + } + ); + }, + loop({ state: e, props: t }) { + if (null === e.startTimer) return e; + const a = + "matchmaking" === e.playState.type + ? e.playState.server + : void 0; + if (a) { + const i = `ws://${a.address}:${a.port}`; + return ( + t.playOnline({ + url: i, + passcode: a.passcode, + localLevelFileName: null, + isLocalDev: false, + }), + e + ); + } + return e.startTimer <= 0 + ? Object.assign(Object.assign({}, e), { + playState: { + type: "error", + message: "No server set, can't start game", + }, + }) + : Object.assign(Object.assign({}, e), { + startTimer: e.startTimer - 1, + }); + }, + render({ props: e, state: t, updateState: a, device: i }) { + const { + party: n, + updateParty: s, + profile: o, + playerSkin: r, + backend: l, + updatePlayerName: c, + fadeInMusic: d, + fadeOutMusic: u, + } = e, + { friends: h, friendRequests: p, playState: g, modal: m } = t, + f = i.size.height + 2 * i.size.heightMargin, + y = i.size.width + 2 * i.size.widthMargin, + E = + null !== n + ? n.ownerId === o.profileId + ? "isLeader" + : "notLeader" + : "no", + b = 30, + S = 0.5 * y, + I = 0.15 * y, + _ = y - 40 - 60 - S - I; + return [ + Fo({ + id: "MainMenuButton", + text: "MAIN MENU", + width: 140, + height: 40, + onPress: () => { + (s(null), bp.deregisterOnline(l), e.backToMainMenu()); + }, + x: -y / 2 + 70 + b, + y: -f / 2 + 20 + b, + }), + Fo({ + id: "HelpButton", + text: "HELP", + width: 100, + height: 40, + onPress: () => { + a((e) => + Object.assign(Object.assign({}, e), { + modal: { type: "help" }, }), - ]; - return "loading" === c - ? [ - ...g, - n({ - text: `${localize("LOADING")}...`, - color: ve, - font: { size: 15 }, + ); + }, + x: y / 2 - 50 - b, + y: -f / 2 + 20 + b, + }), + My({ + id: "OnlineMenuTabs", + width: S, + height: f - 60 - 60, + hasParty: E, + inPartyIds: + (null == n ? void 0 : n.members.map((e) => e.profileId)) || + [], + playState: g, + friends: h, + friendRequests: p, + profile: o, + playerSkin: r, + fadeInMusic: d, + fadeOutMusic: u, + onStart: (t) => { + if ("local" === t.type) + return void e.playOnline({ + url: `ws://${window.location.hostname}:9313`, + passcode: "", + localLevelFileName: t.levelFileName, + isLocalDev: true, + }); + const i = + (null == n + ? void 0 + : n.members.filter( + (e) => e.profileId !== o.profileId, + )) || []; + ("party" === t.type + ? bp + .startFriendsServerLobby(l, i, { + checkpoints: t.withCheckpoints, + levelFileName: t.levelFileName, + }) + .catch(Fy(a)) + : bp.findLobby(l, i).catch(Fy(a)), + a((e) => + Object.assign(Object.assign({}, e), { + playState: { + type: "matchmaking", + numPlayers: 1 + i.length, + isFriends: "party" === t.type, + server: null, + }, }), - ] - : [ - ...g, - ...(p - ? d - ? [] - : [ - n({ - text: "COLLECT YOUR REWARDS WITH", - font: { size: 15 }, - color: ve, - x: 30, - y: r / 2 - 35, - }), - n({ - text: "THE ACHIEVEMENT PASS!", - font: { size: 15 }, - color: ve, - x: 30, - y: r / 2 - 55, - }), - Fo({ - id: "GetPass", - text: "GET IT NOW", - onPress: () => { - i((e) => - Object.assign(Object.assign({}, e), { - showBuyPassModal: true, - }), - ); - }, - width: 120, - height: 40, - x: 260, - y: r / 2 - 40, - }), - ] - : [ - n({ - text: "OFFLINE", - font: { size: 15 }, - color: Ve, - x: 30, - y: r / 2 - (h ? 35 : 40), - }), - h - ? n({ - text: "GO ONLINE TO UNLOCK YOUR ACHIEVEMENTS", - font: { size: 12 }, - color: Ve, - x: 30, - y: r / 2 - 53, - }) - : null, - _m({ id: "GoOnline", x: 260, y: r / 2 - 40 }), - ]), - ScrollContainer({ - id: "AchievementsList", - showScrollBar: true, - containerWidth: o - 18, - containerHeight: r - 130, - contentHeight: 100 * c.length, - y: r / 2 - 70, - sprites: () => - c.map((e, t) => - zy({ - id: `Row-${e.id}`, - achievement: e, - locked: "levelPack" === e.category ? !u : !d, - width: o, - y: 100 * -t - 50, - }), - ), + )); + }, + inviteToParty: (t) => { + n + ? bp.inviteToParty(l, o, t, n).catch(() => { + console.error("Invite error"); + }) + : (a((e) => + Object.assign(Object.assign({}, e), { + inviteToParty: t, }), - l - ? Vy({ - id: "BuyPassModal", - closeMenu: () => { - i((e) => - Object.assign(Object.assign({}, e), { - showBuyPassModal: false, - }), - ); - }, - didBuy: () => { - i((e) => - Object.assign(Object.assign({}, e), { - hasPass: true, - }), - ); - }, - }) - : null, - ]; - }, - }), - zy = makeCustomSprite({ - init: ({ props: e }) => ({ - collected: e.achievement.rewards.collected, - rewards: jy( - e.achievement, - { family: "Montserrat", size: 10, weight: 800 }, - 90, - ), - nameLines: cy.splitTextIntoLines( - e.achievement.name.toLocaleUpperCase(), - { family: "Montserrat", size: 14, weight: 800 }, - 220, - ), + ), + bp + .createFriendsLobby(l, [], e.profile, e.playerSkin) + .catch(Fy(a))); + }, + addFriend: (e) => { + a((t) => + t.friends.map((e) => e.profileId).includes(e.profileId) + ? t + : Object.assign(Object.assign({}, t), { + friends: [...t.friends, e], + }), + ); + }, + removeFriend: (e) => { + a((t) => + Object.assign(Object.assign({}, t), { + friends: t.friends.filter( + (t) => t.profileId !== e.profileId, + ), + }), + ); + }, + removeFriendRequest: (e) => { + a((t) => { + const a = at(t.friendRequests, e); + return ( + Jp.addFriendRequests( + i.storage, + i.alert, + i.now, + a, + true, + ), + Object.assign(Object.assign({}, t), { + friendRequests: a, + }) + ); + }); + }, + textInputX: -y / 2 + b + S / 2, + x: -y / 2 + b + S / 2, + y: 30, }), - render({ - props: { achievement: e, width: t, locked: a }, - state: { collected: i, rewards: s, nameLines: o }, - getContext: c, - updateState: d, - device: u, - }) { - const { online: h } = c(Se), - p = t / 2 - 20, - g = 38, - m = [ - [-p, g], - [p, g], - [p, -28], - [p - 20, -48], - [-p, -48], - [-p, g], - [0, g], - ]; - return [ - r({ path: m, fillColor: Re }), - r({ - path: [ - [-p, g], - [p, g], - [p, -18], - [p - 20, -38], - [-p, -38], - [-p, g], - ], - fillColor: ve, - }), - r({ - path: [ - [-8, -8], - [8, -8], - [0, 8], - ], - fillColor: - "bronze" === e.category - ? "#DB7D11" - : "silver" === e.category - ? "#C8C8C8" - : "gold" === e.category - ? "#F7DB31" - : Ye, - x: -t / 2 + 50, - y: 5, - }), - n({ - text: - "levelPack" === e.category - ? "BONUS" - : localize(e.category.toLocaleUpperCase()), - font: { size: 8, weight: 600 }, - color: - "bronze" === e.category - ? "#DB7D11" - : "silver" === e.category - ? "#C8C8C8" - : "gold" === e.category - ? "#F7DB31" - : Ye, - x: -t / 2 + 50, - y: -10, + vy({ + id: "ProfileView", + profile: o, + playerSkin: r, + updatePlayerName: c, + width: _, + height: f - 60 - 60, + textInputX: null !== m ? -2e3 : -y / 2 + b + S + 20 + _ / 2, + x: -y / 2 + b + S + 20 + _ / 2, + y: 30, + }), + Sy({ + id: "PartyList", + party: n, + profile: o, + playerSkin: r, + onNewMember: () => i.audio("audio/menu/accept.wav").play(0), + width: I, + height: f - 60 - 60, + x: y / 2 - b - I / 2, + y: 30, + }), + m && + ("joinParty" === m.type + ? by({ + id: "JoinPartyModal", + playerName: m.playerName, + closeModal: () => { + a((e) => + Object.assign(Object.assign({}, e), { + modal: null, + }), + ); + }, + confirm: () => { + (a((e) => + Object.assign(Object.assign({}, e), { + playState: { type: "loading" }, + modal: null, + }), + ), + bp + .joinFriendsLobby( + l, + m.lobbyId, + e.playerSkin, + xu(o.xpPoints).rank, + ) + .catch(Fy(a)) + .then(() => { + i.audio("audio/menu/accept.wav").play(0); + })); + }, + }) + : Ly({ + id: "HelpModal", + closeModal: () => { + a((e) => + Object.assign(Object.assign({}, e), { + modal: null, + }), + ); + }, + })), + ]; + }, + }), + By = (e, t, a, i) => (n) => { + switch (n.type) { + case "friendsLobby": + const { inviteToParty: s } = t(); + (s && + bp.inviteToParty(i, a.profile, s, n.lobby).catch(() => { + console.error("Invite error"); }), - ...o.map((e, a) => - n({ - font: { align: "left", size: 14, weight: 800 }, - text: e, - color: Ue, - x: -t / 2 + 80, - y: 1 === o.length ? 0 : (2 === o.length ? 7 : 15) - 15 * a, + e((e) => + Object.assign(Object.assign({}, e), { + playState: + "matchmaking" === e.playState.type + ? e.playState + : { type: "readyToStart" }, + inviteToParty: null, + }), + ), + a.updateParty(n.lobby)); + break; + case "restartFriendsLobby": { + const { party: t } = a; + t && + t.ownerId === a.profile.profileId && + bp + .createFriendsLobby( + i, + t.members.filter( + (e) => e.profileId !== a.profile.profileId, + ), + a.profile, + a.playerSkin, + ) + .catch(Fy(e)); + break; + } + case "royaleLobby": { + const t = n.lobby.id, + a = n.lobby.totalMembers, + i = n.lobby.maxMembers; + e((e) => + "matchmaking" === e.playState.type + ? Object.assign(Object.assign({}, e), { + playState: { + type: "matchmaking", + isFriends: false, + lobbyId: t, + numPlayers: a, + maxPlayers: i || e.playState.maxPlayers, + server: e.playState.server, + }, + }) + : Object.assign(Object.assign({}, e), { + playState: { + type: "matchmaking", + isFriends: false, + lobbyId: t, + numPlayers: a, + maxPlayers: i, + server: null, + }, + }), + ); + break; + } + case "friendsServer": { + const t = n.lobby.id, + a = n.lobby.members.length, + i = n.lobby.maxMembers; + e((e) => + "matchmaking" === e.playState.type + ? Object.assign(Object.assign({}, e), { + playState: { + type: "matchmaking", + isFriends: true, + lobbyId: t, + numPlayers: a, + maxPlayers: i || e.playState.maxPlayers, + server: e.playState.server, + }, + }) + : Object.assign(Object.assign({}, e), { + playState: { + type: "matchmaking", + isFriends: true, + lobbyId: t, + numPlayers: a, + maxPlayers: i, + server: null, + }, }), - ), - ...s.flatMap((e, t) => { - let a = null; - if (e.icon) { - const i = e.icon.fileName.includes("player/skins") - ? 0.8 - : Math.min(1, 40 / Math.max(e.icon.width, e.icon.height)); - a = l({ - fileName: e.icon.fileName, - width: e.icon.width * i, - height: e.icon.height * i, - x: 95 * t - 20, - y: 13, - }); - } - return [ - a, - ...e.lines.map((e, a) => - n({ - font: { size: 10, weight: 800 }, - text: e, - color: Ue, - x: 95 * t - 20, - y: -10 - 10 * a, - }), + ); + break; + } + case "server": + e((e) => + "matchmaking" !== e.playState.type + ? Object.assign(Object.assign({}, e), { + playState: { + type: "matchmaking", + isFriends: true, + lobbyId: "", + numPlayers: 1, + server: n.server, + }, + }) + : Object.assign(Object.assign({}, e), { + playState: Object.assign( + Object.assign({}, e.playState), + { server: n.server }, ), - ]; + }), + ); + break; + case "exit": + (console.error("Exit lobby", n.reason), + e((e) => + Object.assign(Object.assign({}, e), { + playState: { type: "error", message: n.reason }, + }), + )); + break; + case "failedJoin": + e((e) => + Object.assign(Object.assign({}, e), { + playState: { + type: "error", + message: "Failed to join lobby", + }, }), - e.unlocked ? null : r({ path: m, fillColor: Ue, opacity: 0.5 }), - r({ path: m, color: Ye, thickness: 4 }), - e.unlocked - ? i - ? n({ - text: - "loading" === i - ? `${localize("LOADING")}...` - : localize("COLLECTED!"), - color: Ye, - font: { size: 16 }, - x: t / 2 - 90, - }) - : Fo({ - // achivements menu - id: "CollectButton", - text: localize("COLLECT"), - width: 100, - height: 45, - x: t / 2 - 90, - disabled: false, - strokeColor: Ye, - onPress: async () => { - /* - return wh( - e.itemId, - e.version, - e.defId, - e.quantity, - null !== (t = e.usesLeft) && void 0 !== t - ? t - : void 0 - ); - */ - /* - function wh( - e, // itemId - t, // itemVersion - a, // name - i, // defId - n = 1 //usesLeft - */ - var s = await Jp.getEncryptedStorage(), - items = [ - ...s.ownedItems, - ...e.rewards.items.map((r) => - bp.getItemFromResponse( - r.itemId, - r.version || 1, - r.defId, - r.quantity || 1, - ), - ), - ]; - Jp.saveEncryptedStorage(u.now, { - ownedItems: items, - }); - u.audio("audio/achievement/rewards-collect.wav").play( - 0, - ); - d((e) => - Object.assign(Object.assign({}, e), { - collected: true, - }), - ); - - return; - h && - (bp - .collectAchievementRewards(h.backend, e) - .then( - ({ items: e, balance: t }) => ( - h.updateBlocksBalance(t), - Jp.saveEncryptedStorage(u.now, { - ownedItems: e, - }) - ), - ) - .then(() => { - (u - .audio( - "audio/achievement/rewards-collect.wav", - ) - .play(0), - d((e) => - Object.assign(Object.assign({}, e), { - collected: true, - }), - )); - }) - .catch(() => { - d((e) => - Object.assign(Object.assign({}, e), { - collected: false, - }), - ); - }), - d((e) => - Object.assign(Object.assign({}, e), { - collected: "loading", - }), - )); - }, - }) - : l({ - fileName: "images/mainMenu/lockIcon.png", - width: 40, - height: 40, - x: t / 2 - 90, - }), - ]; - }, - }), - Wy = makeCustomSprite({ - render({ - props: { - text: e, - shadowOffsetX: t, - shadowOffsetY: a, - onPress: i, - beatSize: s, - disabled: disabled, + ); + break; + case "startGame": + e((e) => + Object.assign(Object.assign({}, e), { startTimer: 300 }), + ); + } + }, + Fy = (e) => (t) => { + e((e) => + Object.assign(Object.assign({}, e), { + playState: { + type: "error", + message: + t instanceof Error ? t.message : "Can't connect online", }, - device: o, - }) { - const ox = 8 * -t * 0.75 + t, - oy = 8 * -a * 0.75 + a; - return [ + }), + ); + }, + Yy = makeCustomSprite({ + render({ + getContext: e, + device: { size: t, alert: a }, + props: { accountState: i, closeModal: s }, + }) { + const { sendAccountAction: r, online: c } = e(Se), + d = t.height + 2 * t.heightMargin, + u = t.width + 2 * t.widthMargin, + h = "loggedIn" === i.type ? i.profile : null, + p = [ Clickable({ - id: "Clickable", - width: 100, - height: 100, - onPress: () => { - if (!disabled) { - (o.audio("audio/global/button.wav").play(0), i()); - } - }, - sprites: (t) => [ + id: "SignInButton", + sprites: (e) => [ l({ - fileName: "images/mainMenu/rhythm-button-lines.png", - width: 220 + 25 * s, - height: 220 + 25 * s, - }), - We({ - width: 110, - height: 110, - rad: 10, - rotation: 45, - color: disabled ? "#FFFFFF" : Te, - strokeColor: disabled ? ze : Me, - strokeThickness: 3, + fileName: `images/mainMenu/googlesignin_button${e ? "_pressed" : "" + }.png`, + testId: "GoogleSignInButton", + width: 127, + height: 31, }), - //* - We({ - width: 100, - height: 100, - rotation: 45, - rad: 10, - color: disabled ? Xe : t ? ke : Re, - x: ox, - y: oy - +!disabled * (t ? 3 : 0), + ], + width: 127, + height: 31, + y: 30, + disabled: !h, + opacity: h ? 1 : 0.5, + onPress: () => { + h && r({ type: "signInWithGoogle", profile: h }); + }, + }), + ], + g = "requestingAuth" === i.type; + return [ + Clickable({ + id: "ClickOutside", + onPressOutside: () => { + (g && zu.cancelGoogleSignIn(), s()); + }, + width: 300, + height: 230, + sprites: () => [], + onPress: () => null, + }), + o({ color: "black", opacity: 0.7, width: u, height: d }), + We({ width: 310, height: 240, color: Re, x: -5, y: -5 }), + We({ width: 300, height: 230, color: ve }), + Fo({ + id: "CloseButton", + text: g ? "CANCEL" : "CLOSE", + y: -80, + width: 80, + height: 40, + darkBg: true, + onPress: () => { + g ? zu.cancelGoogleSignIn() : s(); + }, + }), + ...((null == c ? void 0 : c.signedInAccount) + ? [ + Fo({ + id: "Delete", + text: "DELETE ACCOUNT", + width: 180, + height: 40, + darkBg: true, + textColor: Ve, + y: 80, + onPress: () => { + a.okCancel( + "Are you sure you want to delete your online account?", + (e) => { + e && r({ type: "deleteAccount" }); + }, + ); + }, + }), + Fo({ + id: "Detach", + text: "DETACH ACCOUNT", + width: 180, + height: 40, + darkBg: true, + onPress: () => { + r({ type: "detachAccount" }); + }, + y: 30, + }), + Fo({ + id: "SignOut", + text: "SIGN OUT", + width: 180, + height: 40, + darkBg: true, + onPress: () => { + r({ type: "signOut" }); + }, + y: -20, + }), + ] + : "requestingAuth" === i.type || "signingIn" === i.type + ? [n({ text: "Signing in", color: Be, y: 30 })] + : "signingOut" === i.type + ? [n({ text: "Signing out", color: Be, y: 30 })] + : "deleting" === i.type + ? [n({ text: "Deleting", color: Ve, y: 30 })] + : p), + ]; + }, + }), + Uy = { bronze: 1, silver: 2, gold: 3, levelPack: 4 }, + jy = (e, t, a) => { + const i = []; + return ( + e.rewards.blocks > 0 && + i.push({ + icon: _f("blocks"), + lines: [`${e.rewards.blocks} BLOCKS`], + }), + e.rewards.items.forEach((e) => { + i.push({ + icon: _f(e.defId), + lines: cy.splitTextIntoLines( + e.name.toLocaleUpperCase(), + t, + a, + ), + }); + }), + i + ); + }, + Gy = (e, t) => + Uy[e.category] - Uy[t.category] || e.name.localeCompare(t.name), + Vy = makeCustomSprite({ + init({ props: e, updateState: t, device: a, getContext: i }) { + const { online: n } = i(Se); + return ( + n && + bp + .getBuyableItems(n.backend) + .then((e) => { + t((t) => + Object.assign(Object.assign({}, t), { + passItem: + e.find((e) => "achievement_pass" === e.defId) || + "loading", }), - n({ - font: { size: 20, style: "italic" }, - text: e, - rotation: -8, - color: disabled ? ze : t ? Ae : Be, - x: ox, - y: oy - +!disabled * (t ? 3 : 0), + ); + }) + .catch((t) => { + a.alert.ok( + `Couldn't retrieve items from store: ${t.message}`, + () => { + e.closeMenu(); + }, + ); + }), + { + passItem: "loading", + showBuyBlocksModal: null, + isPurchasing: false, + } + ); + }, + render({ + props: { didBuy: e, closeMenu: t }, + state: { showBuyBlocksModal: a, isPurchasing: i, passItem: s }, + device: r, + updateState: c, + getContext: d, + }) { + const u = r.size.width + 2 * r.size.widthMargin, + h = r.size.height + 2 * r.size.heightMargin, + { online: p } = d(Se); + if (!p) return []; + const { + blocksBalance: g, + backend: m, + updateBlocksBalance: f, + } = p, + y = (a) => { + bp.buyItem(m, a) + .then( + ({ balance: t, item: a }) => ( + f(t), + e(), + r.audio("audio/global/purchase-item.wav").play(), + Jp.addPurchasedItems([a], r.now) + ), + ) + .then(() => { + t(); + }) + .catch((e) => { + r.alert.ok(`Error buying item: ${e.message}`); + }) + .finally(() => { + c((e) => + Object.assign(Object.assign({}, e), { + isPurchasing: false, + }), + ); + }); + }; + return [ + o({ color: "black", opacity: 0.7, width: u, height: h }), + Clickable({ + id: "BlockBehind", + width: u, + height: h, + sprites: () => [], + onPress: () => null, + }), + o({ width: 700, height: 350, color: ve }), + n({ + font: { size: 38 }, + text: "CAN YOU BEAT", + strokeColor: Ye, + color: ve, + strokeThickness: 11, + y: 160, + }), + n({ + font: { size: 38 }, + text: "THE IMPOSSIBLE", + strokeColor: Ye, + color: ve, + strokeThickness: 11, + y: 125, + }), + l({ + fileName: "images/achievement/buy-pass-marks.png", + width: 49, + height: 42, + x: 210, + y: 137, + }), + Fo({ + id: "CloseButton", + text: "X", + x: 350, + y: 165, + width: 40, + height: 40, + onPress: t, + strokeColor: Ye, + }), + n({ + text: "EARN REWARDS FOR UNLOCKING ACHIEVEMENTS", + color: Ye, + font: { size: 18 }, + y: 90, + }), + We({ + x: 0, + width: 680, + height: 140, + strokeColor: Re, + strokeThickness: 6, + }), + l({ + fileName: "images/achievement/skater-screenshot.png", + x: -190, + width: 200, + height: 113, + }), + o({ + color: Ye, + width: 10, + height: 10, + rotation: 45, + x: -60, + y: 30, + }), + n({ + text: "INCLUDES BONUS LEVEL CLOUD 9", + color: Ye, + font: { size: 18, align: "left" }, + x: -45, + y: 30, + }), + o({ color: Te, width: 10, height: 10, rotation: 45, x: -60 }), + n({ + text: "ONLINE PLAYER SKINS", + color: Ye, + font: { size: 18, align: "left" }, + x: -45, + }), + o({ + color: Ye, + width: 10, + height: 10, + rotation: 45, + x: -60, + y: -30, + }), + n({ + text: "1000+ BLOCKS TO SPEND", + color: Ye, + font: { size: 18, align: "left" }, + x: -45, + y: -30, + }), + n({ + text: `BLOCKS: ${g}`, + color: ve, + strokeColor: Ye, + font: { size: 15 }, + strokeThickness: 5, + x: 200, + y: -95, + }), + Fo({ + id: "Add Blocks", + text: "+", + fontSize: 30, + width: 60, + height: 60, + onPress: () => { + c((e) => + Object.assign(Object.assign({}, e), { + showBuyBlocksModal: {}, }), - ], - }), - ]; - }, - }), - qy = makeCustomSprite({ - init({ device: e, props: t }) { - const a = e.size.height + 2 * e.size.heightMargin, - i = a / 800; - return { - scrollY: -a / 2 - 50 - (t.isEndOfGame ? 500 * i : 0), - speedY: i, - }; - }, - loop: ({ state: e }) => - Object.assign(Object.assign({}, e), { - scrollY: e.scrollY + e.speedY, + ); + }, + x: 200, + y: -140, + strokeColor: Ye, + textColor: ve, + textStroke: Ye, + textStrokeThickness: 6, }), - render({ props: e, device: t, state: { scrollY: a, speedY: i } }) { - const n = t.size.width + 2 * t.size.widthMargin, - s = t.size.height + 2 * t.size.heightMargin, - o = 1 + e.beatSize / 20; - return [ - ...(e.isEndOfGame + n({ + text: "ACHIEVEMENT PASS", + color: ve, + strokeColor: Ye, + font: { size: 20 }, + strokeThickness: 6, + x: -50, + y: -95, + }), + ...("loading" === s + ? [ + n({ + text: `${localize("LOADING")}...`, + font: { size: 20 }, + color: Ye, + x: -50, + y: -140, + }), + ] + : i ? [ - Uo({ - id: "FadingBack", - shouldShow: a > -s / 2 + 180 * i, - fadeFrames: 30, - sprite: (t) => [ - Fo({ - id: "BackButton", - text: localize("BACK"), - width: 80, - height: 40, - onPress: e.backToMainMenu, - x: -n / 2 + 60, - y: -s / 2 + 40, - opacity: t, - }), - ], - }), - og({ - id: "Text1", - text: localize("YOU MADE IT"), - delay: 0, - showTime: 450, - y: 20, - }), - og({ - id: "Text2", - text: - localize( - "checkpoints" === e.isEndOfGame - ? "NOW TRY WITHOUT CHECKPOINTS" - : "THANK YOU FOR PLAYING", - ) + "!", - delay: 225, - showTime: 450, - y: -20, - }), - ] + n({ + text: `${localize("PURCHASING")}...`, + font: { size: 20 }, + color: Ye, + x: -50, + y: -140, + }), + ] : [ - Uf({ - id: "Title", - text: localize("CREDITS"), - width: 200, - height: 35, - x: -n / 2 + 120, - y: s / 2 - 40, - }), - Fo({ - id: "BackButton", - text: localize("BACK"), - width: 80, - height: 40, - onPress: e.backToMainMenu, - x: -n / 2 + 60, - y: -s / 2 + 40, - }), - ]), - l({ - fileName: "images/mainMenu/flukegames.png", - y: a, - width: 160, - height: 100, - scaleX: o, - scaleY: o, - }), - $y({ id: "Content", y: a - 50, beatScale: o }), - ]; - }, - }), - $y = makeCustomSprite({ - init() { - const e = [ - ["CREATED BY", ["ED BENTLEY"]], - ["MODDED BY", ["d016"]], - ["INSPIRED BY", ["Alfredo/Outline Gamer"]], - [ - "SPECIAL THANKS TO", - [ - "GatoNegro", - "mikhael", - "Jfour Robs", - "WaterFire", - "BroodingAcorn (GD)", - "Mincofficial", - ], - ], - ["GAME ARTIST", ["ŁUKASZ WIŚNIEWSKI"]], - ["UI ARTIST", ["SYLWIA GAWEL"]], - ["PIXEL ARTIST", ["NICO NOWAK"]], - ["BACKGROUND ARTIST", ["EMMA LI"]], - ["ARTWORK FROM", ["ROOM 8 STUDIO", "IGU ART"]], - ["SFX AND MUSIC EDITING", ["LUKE THOMAS"]], - void 0, - [ - "MARKETING", - ["JAMES MCGREGOR", "ELLIOT BENTLEY", "ANASTASIYA LEE"], - ], - void 0, - ["MENU MUSIC", ["MONSTAZ. - POPCORN FUNK"]], - [ - "LEVEL MUSIC BY", - [ - ...new Set( - Object.values(hl.songs) - .map((e) => e.author.toLocaleUpperCase()) - .sort(), - ), - ], // it was really funny to have four GEOXORs in there :D - ], - void 0, - [ - "PLAYTESTERS", - [ - "MICHAEL STEC", - "LEE NISSIM", - "IVAN TCHERNEV", - "MICHAEL EVANS", - "MARCUS FORD", - "GABRIEL BROWN", - ], - ], - void 0, - ["GAME ENGINE", ["REPLAY.JS.ORG"]], - ]; - let t = 0; - return { - content: e - .flatMap((e) => { - if (!e) return ((t -= 50), null); - t -= 70; - const [a, i] = e, - n = [{ text: a, format: "small", y: t }]; - return ( - i.forEach((e) => { - ((t -= 25), n.push({ text: e, format: "big", y: t })); + Fo({ + id: "BuyPass", + text: `${localize("BUY")} - ${s.blocksPrice} ${localize( + "BLOCKS", + )}`, + width: 250, + height: 60, + onPress: () => { + (c((e) => + Object.assign(Object.assign({}, e), { + isPurchasing: true, + }), + ), + s.blocksPrice > g + ? c((e) => + Object.assign(Object.assign({}, e), { + showBuyBlocksModal: { + buyItemOnComplete: s, + }, + }), + ) + : y(s)); + }, + x: -50, + y: -140, + strokeColor: Ye, + textColor: ve, + textStroke: Ye, + textStrokeThickness: 5, + }), + ]), + a && + bm({ + id: "BuyBlocksModal", + onModalClose: () => { + c((e) => + Object.assign(Object.assign({}, e), { + showBuyBlocksModal: null, + isPurchasing: false, + }), + ); + }, + onPurchaseComplete: (e) => { + (a.buyItemOnComplete && + e >= a.buyItemOnComplete.blocksPrice && + y(a.buyItemOnComplete), + f(e), + c((e) => + Object.assign(Object.assign({}, e), { + showBuyBlocksModal: null, }), - n - ); - }) - .filter(nt), - }; - }, - render: ({ state: { content: e }, props: { beatScale: t } }) => - e.map(({ text: e, format: a, y: i }) => { - const s = "small" === a; - return n({ - text: localize(e), - color: s ? Oe : ve, - y: i, - font: s - ? { size: 12, weight: 500 } - : { size: 20, weight: 800 }, - scaleX: s ? 1 : t, - scaleY: s ? 1 : t, - }); + )); + }, }), - }), - news = makeCustomSprite({ - render({ - props: { - updateView: e, - backToMainMenu: t, - newsID: id, - message: message, - }, - device: a, - }) { - const i = a.size.width + 2 * a.size.widthMargin, - nn = a.size.height + 2 * a.size.heightMargin, - s = nn / 2 - 40; - localStorage.setItem("news", id); - function createNewsText(m) { - const length = m.split("\n").length, - start = (length + 1) / 2 - 1, - size = 20; - - return m.split("\n").map((message, i) => - n({ - font: { size: size }, - text: localize(message), - color: "white", - y: start * size - i * size, - }), - ); - } - return [ - Uf({ - id: "Title", - text: localize("NEWS"), - width: 200, - height: 35, - x: -i / 2 + 120, - y: s, - }), - Fo({ - id: "BackButton", - text: localize("BACK"), - width: 80, - height: 40, - onPress: t, - x: -i / 2 + 60, - y: -nn / 2 + 40, - }), - ...createNewsText(message), - ]; - }, - }), - competition = makeCustomSprite({ - render({ props: { updateView: e, backToMainMenu: t }, device: a }) { - const i = a.size.width + 2 * a.size.widthMargin, - nn = a.size.height + 2 * a.size.heightMargin, - s = nn / 2 - 40; - - return [ - Uf({ - id: "Title", - text: localize("COMPETITION"), - width: 200, - height: 35, - x: -i / 2 + 120, - y: s, - }), - - Fo({ - id: "BackButton", - text: localize("BACK"), - width: 80, - height: 40, - onPress: t, - x: -i / 2 + 60, - y: -nn / 2 + 40, - }), - Fo({ - id: "TrailerButton", - text: localize("WATCH TRAILER"), - width: 150, - height: 40, - onPress: () => - zu.openLink(""), // link does not exist - x: 0, - y: -nn / 2 + 80, - }), + ]; + }, + }), + Hy = function (e) { + return "cache" === e.type + ? Jp.getLocal(e.storage, { + ok: () => null, + okCancel: () => null, + }).then((e) => e.data.offlineCache.achievements) + : bp.getAchievements(e.backend); + }, + Xy = makeCustomSprite({ + init({ + props: e, + updateState: t, + device: a, + getContext: i, + preloadFiles: n, + }) { + const { online: s } = i(Se), + o = s + ? { type: "online", backend: s.backend } + : { + type: "cache", + encryptedCache: Jp.getEncryptedStorage(), + storage: a.storage, + }; + return ( + Promise.all([ + Hy(o), + Jp.getUserItems("all"), + Jp.getOfflineRequests(a.storage), n({ - text: "Nothing here yet...", - color: ve, - x: 0, - y: 10, - font: { size: 20 }, + imageFileNames: [ + ...Qs.achievementImages, + ...Qs.getPlayerImages(Object.values(Wt.skins), []), + ], + audioFileNames: Qs.achievementSfx, }), - n({ - text: "...But you can help make some levels!", - color: ve, - x: 0, - y: -10, - font: { size: 20 }, + ]) + .then(([e, t, i]) => + Jp.saveLocalOfflineCache(a.storage, a.now, { + achievements: e, + }).then(() => ({ + achievements: e, + items: t, + offlineRequests: i, + })), + ) + .then(({ achievements: e, items: a, offlineRequests: i }) => { + t((t) => + Object.assign(Object.assign({}, t), { + achievements: e.sort(Gy), + hasPass: + !zu.hasIAP() || + a.some( + (e) => + "passItem" === e.type && + "achievement" === e.passType, + ), + hasSuperLevelPack: + !zu.hasIAP() || + a.some( + (e) => + "bonusLevelItem" === e.type && + "superLevelPack" === e.name, + ), + hasPendingAchievements: i.some( + (e) => "completedLevel" === e.type, + ), + }), + ); + }) + .catch((t) => { + (console.error(t), + a.alert.ok("Failed to load achievements"), + e.backToMainMenu()); }), - ]; - }, - }), - Jy = makeCustomSprite({ - render({ props: { updateView: e, backToMainMenu: t }, device: a }) { - const i = a.size.width + 2 * a.size.widthMargin, - n = a.size.height + 2 * a.size.heightMargin, - s = n / 2 - 40; - return [ + { + achievements: "loading", + showBuyPassModal: false, + hasPass: false, + hasSuperLevelPack: false, + hasPendingAchievements: false, + } + ); + }, + render({ + props: e, + state: t, + device: a, + updateState: i, + getContext: s, + }) { + const o = a.size.width + 2 * a.size.widthMargin, + r = a.size.height + 2 * a.size.heightMargin, + { + showBuyPassModal: l, + achievements: c, + hasPass: d, + hasSuperLevelPack: u, + hasPendingAchievements: h, + } = t, + { online: p } = s(Se), + g = [ Uf({ id: "Title", - text: localize("MENU"), - width: 200, - height: 35, - x: -i / 2 + 120, - y: s, - }), - Fo({ - id: "Credits", - text: "CREDITS", - onPress: () => { - e({ type: "credits", endOfGame: null }); - }, - width: 200, - height: 40, - y: s - 50, - }), - Fo({ - id: "Settings", - text: localize("SETTINGS"), - onPress: () => { - e({ type: "settings" }); - }, - width: 200, - height: 40, - y: s - 100, - }), - Fo({ - id: "repo", - width: 200, - height: 40, - text: localize("GITHUB REPO"), - onPress: () => { - zu.openLink("https://github.com/e016/tig2plus"); - }, - y: s - 150, - }), - - /*Fo({ - id: "TC", - width: 200, - height: 40, - text: "TERMS OF SERVICE", - onPress: () => { - zu.openLink("./terms-of-service.html"); - }, - y: s - 200, - }), - Fo({ - id: "Priv", - width: 200, - height: 40, - text: "PRIVACY POLICY", - onPress: () => { - zu.openLink("./privacy-policy.html"); - }, - y: s - 250, - }),*/ - Fo({ - id: "lang", - width: 200, - height: 40, - text: localize("CHANGE LANGUAGE"), - onPress: () => { - if (LANG == "") { - LANG = "es"; - } else { - LANG = ""; - } - a.storage.setItem("lang", LANG); - }, - y: s - 200, - }), - Fo({ - id: "deleteRunHistory", - width: 200, - height: 40, - text: localize("ERASE RUN HISTORY"), - onPress: () => { - if ( - window.confirm( - "This PERMANENTLY erases the run history from your created levels. ONLY DO THIS if you are running out of storage or have corrupted levels.", - ) - ) { - a.storage.setItem("savedLevelsSettings"); - } - }, - y: s - 250, - }), - Fo({ - id: "userlevels", + text: localize("ACHIEVEMENTS"), width: 200, - height: 40, - text: "USERLEVELS.COM", - onPress: () => { - zu.openLink("https://userlevels.com"); - }, - y: s - 300, + height: 35, + x: -o / 2 + 120, + y: r / 2 - 40, }), Fo({ id: "BackButton", text: localize("BACK"), width: 80, height: 40, - onPress: t, - x: -i / 2 + 60, - y: -n / 2 + 40, - }), - ]; - }, - }), - Ky = makeCustomSprite({ - render({ props: e, device: t }) { - const { fullWidth: a, fullHeight: i } = t.size, - n = 0.5 * a, - s = a - 40 - 60 - n - 0.15 * a; - return [ - Fo({ - id: "MainMenuButton", - text: "MAIN MENU", - width: 140, - height: 40, onPress: e.backToMainMenu, - x: -a / 2 + 70 + 30, - y: -i / 2 + 20 + 30, + x: -o / 2 + 60, + y: -r / 2 + 40, }), - Qy({ - id: "TabsMenu", - width: n, - height: i - 60 - 60, - playerSkin: e.playerSkin, - x: -a / 2 + 30 + n / 2, - y: 30, + ]; + return "loading" === c + ? [ + ...g, + n({ + text: `${localize("LOADING")}...`, + color: ve, + font: { size: 15 }, }), - Ty({ - id: "ProfileView", - width: s, - height: i - 60 - 60, - playerSkin: e.playerSkin, - x: -a / 2 + 30 + n + 20 + s / 2, - y: 30, + ] + : [ + ...g, + ...(p + ? d + ? [] + : [ + n({ + text: "COLLECT YOUR REWARDS WITH", + font: { size: 15 }, + color: ve, + x: 30, + y: r / 2 - 35, + }), + n({ + text: "THE ACHIEVEMENT PASS!", + font: { size: 15 }, + color: ve, + x: 30, + y: r / 2 - 55, + }), + Fo({ + id: "GetPass", + text: "GET IT NOW", + onPress: () => { + i((e) => + Object.assign(Object.assign({}, e), { + showBuyPassModal: true, + }), + ); + }, + width: 120, + height: 40, + x: 260, + y: r / 2 - 40, + }), + ] + : [ + n({ + text: "OFFLINE", + font: { size: 15 }, + color: Ve, + x: 30, + y: r / 2 - (h ? 35 : 40), + }), + h + ? n({ + text: "GO ONLINE TO UNLOCK YOUR ACHIEVEMENTS", + font: { size: 12 }, + color: Ve, + x: 30, + y: r / 2 - 53, + }) + : null, + _m({ id: "GoOnline", x: 260, y: r / 2 - 40 }), + ]), + ScrollContainer({ + id: "AchievementsList", + showScrollBar: true, + containerWidth: o - 18, + containerHeight: r - 130, + contentHeight: 100 * c.length, + y: r / 2 - 70, + sprites: () => + c.map((e, t) => + zy({ + id: `Row-${e.id}`, + achievement: e, + locked: "levelPack" === e.category ? !u : !d, + width: o, + y: 100 * -t - 50, + }), + ), }), + l + ? Vy({ + id: "BuyPassModal", + closeMenu: () => { + i((e) => + Object.assign(Object.assign({}, e), { + showBuyPassModal: false, + }), + ); + }, + didBuy: () => { + i((e) => + Object.assign(Object.assign({}, e), { + hasPass: true, + }), + ); + }, + }) + : null, ]; - }, + }, + }), + zy = makeCustomSprite({ + init: ({ props: e }) => ({ + collected: e.achievement.rewards.collected, + rewards: jy( + e.achievement, + { family: "Montserrat", size: 10, weight: 800 }, + 90, + ), + nameLines: cy.splitTextIntoLines( + e.achievement.name.toLocaleUpperCase(), + { family: "Montserrat", size: 14, weight: 800 }, + 220, + ), }), - Qy = makeCustomSprite({ - render({ props: { width: e, height: t, playerSkin: a } }) { - const i = { type: "linearHoriz", width: 80, colors: [xe, De] }, - s = t - 30; - return [ - /*Fo({ - id: "PlayTabButton", - text: localize("PLAY"), - width: 110, - height: 35, - fontSize: 15, - shadowDir: "right", - x: -e / 2 + 55, - y: t / 2 - 20, - disabled: true, - onPress: () => {}, - }), - Fo({ - id: "FriendsTabButton", - text: localize("FRIENDS"), - width: 110, - height: 35, - fontSize: 15, - shadowDir: "right", - x: -e / 2 + 180, - y: t / 2 - 20, - disabled: true, - onPress: () => {}, - }),*/ - We({ - width: 110, - height: 40, - color: Ge, - x: 3 - e / 2 + 305, - y: t / 2 - 20, + render({ + props: { achievement: e, width: t, locked: a }, + state: { collected: i, rewards: s, nameLines: o }, + getContext: c, + updateState: d, + device: u, + }) { + const { online: h } = c(Se), + p = t / 2 - 20, + g = 38, + m = [ + [-p, g], + [p, g], + [p, -28], + [p - 20, -48], + [-p, -48], + [-p, g], + [0, g], + ]; + return [ + r({ path: m, fillColor: Re }), + r({ + path: [ + [-p, g], + [p, g], + [p, -18], + [p - 20, -38], + [-p, -38], + [-p, g], + ], + fillColor: ve, + }), + r({ + path: [ + [-8, -8], + [8, -8], + [0, 8], + ], + fillColor: + "bronze" === e.category + ? "#DB7D11" + : "silver" === e.category + ? "#C8C8C8" + : "gold" === e.category + ? "#F7DB31" + : Ye, + x: -t / 2 + 50, + y: 5, + }), + n({ + text: + "levelPack" === e.category + ? "BONUS" + : localize(e.category.toLocaleUpperCase()), + font: { size: 8, weight: 600 }, + color: + "bronze" === e.category + ? "#DB7D11" + : "silver" === e.category + ? "#C8C8C8" + : "gold" === e.category + ? "#F7DB31" + : Ye, + x: -t / 2 + 50, + y: -10, + }), + ...o.map((e, a) => + n({ + font: { align: "left", size: 14, weight: 800 }, + text: e, + color: Ue, + x: -t / 2 + 80, + y: 1 === o.length ? 0 : (2 === o.length ? 7 : 15) - 15 * a, }), - We({ - width: 110, + ), + ...s.flatMap((e, t) => { + let a = null; + if (e.icon) { + const i = e.icon.fileName.includes("player/skins") + ? 0.8 + : Math.min(1, 40 / Math.max(e.icon.width, e.icon.height)); + a = l({ + fileName: e.icon.fileName, + width: e.icon.width * i, + height: e.icon.height * i, + x: 95 * t - 20, + y: 13, + }); + } + return [ + a, + ...e.lines.map((e, a) => + n({ + font: { size: 10, weight: 800 }, + text: e, + color: Ue, + x: 95 * t - 20, + y: -10 - 10 * a, + }), + ), + ]; + }), + e.unlocked ? null : r({ path: m, fillColor: Ue, opacity: 0.5 }), + r({ path: m, color: Ye, thickness: 4 }), + e.unlocked + ? i + ? n({ + text: + "loading" === i + ? `${localize("LOADING")}...` + : localize("COLLECTED!"), + color: Ye, + font: { size: 16 }, + x: t / 2 - 90, + }) + : Fo({ + // achivements menu + id: "CollectButton", + text: localize("COLLECT"), + width: 100, + height: 45, + x: t / 2 - 90, + disabled: false, + strokeColor: Ye, + onPress: async () => { + /* + return wh( + e.itemId, + e.version, + e.defId, + e.quantity, + null !== (t = e.usesLeft) && void 0 !== t + ? t + : void 0 + ); + */ + /* + function wh( + e, // itemId + t, // itemVersion + a, // name + i, // defId + n = 1 //usesLeft + */ + var s = await Jp.getEncryptedStorage(), + items = [ + ...s.ownedItems, + ...e.rewards.items.map((r) => + bp.getItemFromResponse( + r.itemId, + r.version || 1, + r.defId, + r.quantity || 1, + ), + ), + ]; + Jp.saveEncryptedStorage(u.now, { + ownedItems: items, + }); + u.audio("audio/achievement/rewards-collect.wav").play( + 0, + ); + d((e) => + Object.assign(Object.assign({}, e), { + collected: true, + }), + ); + + return; + h && + (bp + .collectAchievementRewards(h.backend, e) + .then( + ({ items: e, balance: t }) => ( + h.updateBlocksBalance(t), + Jp.saveEncryptedStorage(u.now, { + ownedItems: e, + }) + ), + ) + .then(() => { + (u + .audio( + "audio/achievement/rewards-collect.wav", + ) + .play(0), + d((e) => + Object.assign(Object.assign({}, e), { + collected: true, + }), + )); + }) + .catch(() => { + d((e) => + Object.assign(Object.assign({}, e), { + collected: false, + }), + ); + }), + d((e) => + Object.assign(Object.assign({}, e), { + collected: "loading", + }), + )); + }, + }) + : l({ + fileName: "images/mainMenu/lockIcon.png", + width: 40, height: 40, - color: ve, - x: -e / 2 + 305, - y: t / 2 - 20, + x: t / 2 - 90, }), + ]; + }, + }), + Wy = makeCustomSprite({ + render({ + props: { + text: e, + shadowOffsetX: t, + shadowOffsetY: a, + onPress: i, + beatSize: s, + disabled: disabled, + }, + device: o, + }) { + const ox = 8 * -t * 0.75 + t, + oy = 8 * -a * 0.75 + a; + return [ + Clickable({ + id: "Clickable", + width: 100, + height: 100, + onPress: () => { + if (!disabled) { + (o.audio("audio/global/button.wav").play(0), i()); + } + }, + sprites: (t) => [ + l({ + fileName: "images/mainMenu/rhythm-button-lines.png", + width: 220 + 25 * s, + height: 220 + 25 * s, + }), + We({ + width: 110, + height: 110, + rad: 10, + rotation: 45, + color: disabled ? "#FFFFFF" : Te, + strokeColor: disabled ? ze : Me, + strokeThickness: 3, + }), + //* + We({ + width: 100, + height: 100, + rotation: 45, + rad: 10, + color: disabled ? Xe : t ? ke : Re, + x: ox, + y: oy - +!disabled * (t ? 3 : 0), + }), + n({ + font: { size: 20, style: "italic" }, + text: e, + rotation: -8, + color: disabled ? ze : t ? Ae : Be, + x: ox, + y: oy - +!disabled * (t ? 3 : 0), + }), + ], + }), + ]; + }, + }), + qy = makeCustomSprite({ + init({ device: e, props: t }) { + const a = e.size.height + 2 * e.size.heightMargin, + i = a / 800; + return { + scrollY: -a / 2 - 50 - (t.isEndOfGame ? 500 * i : 0), + speedY: i, + }; + }, + loop: ({ state: e }) => + Object.assign(Object.assign({}, e), { + scrollY: e.scrollY + e.speedY, + }), + render({ props: e, device: t, state: { scrollY: a, speedY: i } }) { + const n = t.size.width + 2 * t.size.widthMargin, + s = t.size.height + 2 * t.size.heightMargin, + o = 1 + e.beatSize / 20; + return [ + ...(e.isEndOfGame + ? [ + Uo({ + id: "FadingBack", + shouldShow: a > -s / 2 + 180 * i, + fadeFrames: 30, + sprite: (t) => [ + Fo({ + id: "BackButton", + text: localize("BACK"), + width: 80, + height: 40, + onPress: e.backToMainMenu, + x: -n / 2 + 60, + y: -s / 2 + 40, + opacity: t, + }), + ], + }), + og({ + id: "Text1", + text: localize("YOU MADE IT"), + delay: 0, + showTime: 450, + y: 20, + }), + og({ + id: "Text2", + text: + localize( + "checkpoints" === e.isEndOfGame + ? "NOW TRY WITHOUT CHECKPOINTS" + : "THANK YOU FOR PLAYING", + ) + "!", + delay: 225, + showTime: 450, + y: -20, + }), + ] + : [ + Uf({ + id: "Title", + text: localize("CREDITS"), + width: 200, + height: 35, + x: -n / 2 + 120, + y: s / 2 - 40, + }), + Fo({ + id: "BackButton", + text: localize("BACK"), + width: 80, + height: 40, + onPress: e.backToMainMenu, + x: -n / 2 + 60, + y: -s / 2 + 40, + }), + ]), + l({ + fileName: "images/mainMenu/flukegames.png", + y: a, + width: 160, + height: 100, + scaleX: o, + scaleY: o, + }), + $y({ id: "Content", y: a - 50, beatScale: o }), + ]; + }, + }), + $y = makeCustomSprite({ + init() { + const e = [ + ["CREATED BY", ["ED BENTLEY"]], + ["MODDED BY", ["d016"]], + ["PORTED BY", ["SnowyDaFox"]], + ["INSPIRED BY", ["Alfredo/Outline Gamer"]], + [ + "SPECIAL THANKS TO", + [ + "GatoNegro", + "mikhael", + "Jfour Robs", + "WaterFire", + "BroodingAcorn (GD)", + "Mincofficial", + ], + ], + ["GAME ARTIST", ["ŁUKASZ WIŚNIEWSKI"]], + ["UI ARTIST", ["SYLWIA GAWEL"]], + ["PIXEL ARTIST", ["NICO NOWAK"]], + ["BACKGROUND ARTIST", ["EMMA LI"]], + ["ARTWORK FROM", ["ROOM 8 STUDIO", "IGU ART"]], + ["SFX AND MUSIC EDITING", ["LUKE THOMAS"]], + void 0, + [ + "MARKETING", + ["JAMES MCGREGOR", "ELLIOT BENTLEY", "ANASTASIYA LEE"], + ], + void 0, + ["MENU MUSIC", ["MONSTAZ. - POPCORN FUNK"]], + [ + "LEVEL MUSIC BY", + [ + ...new Set( + Object.values(hl.songs) + .map((e) => e.author.toLocaleUpperCase()) + .sort(), + ), + ], // it was really funny to have four GEOXORs in there :D + ], + void 0, + [ + "PLAYTESTERS", + [ + "MICHAEL STEC", + "LEE NISSIM", + "IVAN TCHERNEV", + "MICHAEL EVANS", + "MARCUS FORD", + "GABRIEL BROWN", + ], + ], + void 0, + ["GAME ENGINE", ["REPLAY.JS.ORG"]], + ]; + let t = 0; + return { + content: e + .flatMap((e) => { + if (!e) return ((t -= 50), null); + t -= 70; + const [a, i] = e, + n = [{ text: a, format: "small", y: t }]; + return ( + i.forEach((e) => { + ((t -= 25), n.push({ text: e, format: "big", y: t })); + }), + n + ); + }) + .filter(nt), + }; + }, + render: ({ state: { content: e }, props: { beatScale: t } }) => + e.map(({ text: e, format: a, y: i }) => { + const s = "small" === a; + return n({ + text: localize(e), + color: s ? Oe : ve, + y: i, + font: s + ? { size: 12, weight: 500 } + : { size: 20, weight: 800 }, + scaleX: s ? 1 : t, + scaleY: s ? 1 : t, + }); + }), + }), + news = makeCustomSprite({ + render({ + props: { + updateView: e, + backToMainMenu: t, + newsID: id, + message: message, + }, + device: a, + }) { + const i = a.size.width + 2 * a.size.widthMargin, + nn = a.size.height + 2 * a.size.heightMargin, + s = nn / 2 - 40; + localStorage.setItem("news", id); + function createNewsText(m) { + const length = m.split("\n").length, + start = (length + 1) / 2 - 1, + size = 20; + + return m.split("\n").map((message, i) => n({ - text: localize("SKINS"), - font: { size: 18 }, - color: Ae, - gradient: i, - x: 3 - e / 2 + 300, //-e / 2 + 305, - y: t / 2 - 20, - }), - We({ - gradient: { type: "linearHoriz", width: e, colors: [Ne, De] }, - width: e, - height: s, - x: 3, - y: -24, - }), - We({ color: ve, width: e, height: s, y: -20 }), - xy({ - id: "SkinsMenu", - width: e, - height: s, - playerSkin: a, - profileId: null, - y: -20, + font: { size: size }, + text: localize(message), + color: "white", + y: start * size - i * size, }), - ]; - }, - }), - Zy = makeCustomSprite({ - init({ getContext: e, updateState: t, device: a, props: i }) { - const { online: n } = e(Se); - return ( - n && - Promise.all([ - bp.getBuyableItems(n.backend), - Jp.getUserItems("all"), - ]) - .then(([e, a]) => { - const i = kp.getBoosterItems(a); - t((t) => - Object.assign(Object.assign({}, t), { - items: { - canBuy: kp.removeBoughtItems(e, a), - owned: Object.assign( - { boosters: i }, - kp.calculateNumberBoosters(i), - ), - }, - }), - ); - }) - .catch((e) => { - a.alert.ok(`Couldn't load store: ${e.message}`, () => { - i.backToMainMenu(); - }); - }), - { items: "loading", isBuying: false, showBuyBlocksModal: null } ); - }, - render({ - props: e, - state: t, - device: a, - updateState: i, - getContext: s, - }) { - const o = a.size.width + 2 * a.size.widthMargin, - r = a.size.height + 2 * a.size.heightMargin, - { showBuyBlocksModal: l, items: c } = t, - { online: d } = s(Se); - if (!d) return []; - const u = [ - Fo({ - id: "BackButton", - text: "<-", - width: 40, - height: 30, - onPress: e.backToMainMenu, - x: -250, - y: r / 2 - 40, - }), - n({ - text: "Store", - color: "white", - font: { size: 20 }, - y: r / 2 - 40, - }), - ], - { blocksBalance: h, updateBlocksBalance: p, backend: g } = d; - if ("loading" === c) - return [ - ...u, - n({ - text: `${localize("LOADING")}...`, - color: ve, - font: { size: 15 }, - }), - ]; - const m = (e) => { - (i((e) => - Object.assign(Object.assign({}, e), { isBuying: true }), - ), - bp - .buyItem(g, e) - .then( - ({ balance: e, item: t }) => ( - p(e), - ((e) => { - i((t) => { - if ("loading" === t.items) return t; - if ("boosterItem" === e.type) { - const a = [...t.items.owned.boosters, e]; - return Object.assign(Object.assign({}, t), { - items: Object.assign( - Object.assign({}, t.items), - { - owned: Object.assign( - { boosters: a }, - kp.calculateNumberBoosters(a), - ), - }, - ), - }); - } - return Object.assign(Object.assign({}, t), { - items: Object.assign(Object.assign({}, t.items), { - canBuy: t.items.canBuy.filter( - (t) => t.defId !== e.defId, - ), - }), - }); - }); - })(t), - Jp.addPurchasedItems([t], a.now) - ), + } + return [ + Uf({ + id: "Title", + text: localize("NEWS"), + width: 200, + height: 35, + x: -i / 2 + 120, + y: s, + }), + Fo({ + id: "BackButton", + text: localize("BACK"), + width: 80, + height: 40, + onPress: t, + x: -i / 2 + 60, + y: -nn / 2 + 40, + }), + ...createNewsText(message), + ]; + }, + }), + competition = makeCustomSprite({ + render({ props: { updateView: e, backToMainMenu: t }, device: a }) { + const i = a.size.width + 2 * a.size.widthMargin, + nn = a.size.height + 2 * a.size.heightMargin, + s = nn / 2 - 40; + + return [ + Uf({ + id: "Title", + text: localize("COMPETITION"), + width: 200, + height: 35, + x: -i / 2 + 120, + y: s, + }), + + Fo({ + id: "BackButton", + text: localize("BACK"), + width: 80, + height: 40, + onPress: t, + x: -i / 2 + 60, + y: -nn / 2 + 40, + }), + Fo({ + id: "TrailerButton", + text: localize("WATCH TRAILER"), + width: 150, + height: 40, + onPress: () => + zu.openLink(""), // link does not exist + x: 0, + y: -nn / 2 + 80, + }), + n({ + text: "Nothing here yet...", + color: ve, + x: 0, + y: 10, + font: { size: 20 }, + }), + n({ + text: "...But you can help make some levels!", + color: ve, + x: 0, + y: -10, + font: { size: 20 }, + }), + ]; + }, + }), + Jy = makeCustomSprite({ + render({ props: { updateView: e, backToMainMenu: t }, device: a }) { + const i = a.size.width + 2 * a.size.widthMargin, + n = a.size.height + 2 * a.size.heightMargin, + s = n / 2 - 40; + return [ + Uf({ + id: "Title", + text: localize("MENU"), + width: 200, + height: 35, + x: -i / 2 + 120, + y: s, + }), + Fo({ + id: "Credits", + text: "CREDITS", + onPress: () => { + e({ type: "credits", endOfGame: null }); + }, + width: 200, + height: 40, + y: s - 50, + }), + Fo({ + id: "Settings", + text: localize("SETTINGS"), + onPress: () => { + e({ type: "settings" }); + }, + width: 200, + height: 40, + y: s - 100, + }), + Fo({ + id: "repo", + width: 200, + height: 40, + text: localize("GITHUB REPO"), + onPress: () => { + zu.openLink("https://github.com/e016/tig2plus"); + }, + y: s - 150, + }), + + /*Fo({ + id: "TC", + width: 200, + height: 40, + text: "TERMS OF SERVICE", + onPress: () => { + zu.openLink("./terms-of-service.html"); + }, + y: s - 200, + }), + Fo({ + id: "Priv", + width: 200, + height: 40, + text: "PRIVACY POLICY", + onPress: () => { + zu.openLink("./privacy-policy.html"); + }, + y: s - 250, + }),*/ + Fo({ + id: "lang", + width: 200, + height: 40, + text: localize("CHANGE LANGUAGE"), + onPress: () => { + if (LANG == "") { + LANG = "es"; + } else { + LANG = ""; + } + a.storage.setItem("lang", LANG); + }, + y: s - 200, + }), + Fo({ + id: "deleteRunHistory", + width: 200, + height: 40, + text: localize("ERASE RUN HISTORY"), + onPress: () => { + if ( + window.confirm( + "This PERMANENTLY erases the run history from your created levels. ONLY DO THIS if you are running out of storage or have corrupted levels.", ) - .catch((e) => { - a.alert.ok(`Error buying item: ${e.message}`); - }) - .finally(() => { - i((e) => - Object.assign(Object.assign({}, e), { - isBuying: false, - }), - ); - })); - }; + ) { + a.storage.setItem("savedLevelsSettings"); + } + }, + y: s - 250, + }), + Fo({ + id: "userlevels", + width: 200, + height: 40, + text: "USERLEVELS.COM", + onPress: () => { + zu.openLink("https://userlevels.com"); + }, + y: s - 300, + }), + Fo({ + id: "BackButton", + text: localize("BACK"), + width: 80, + height: 40, + onPress: t, + x: -i / 2 + 60, + y: -n / 2 + 40, + }), + ]; + }, + }), + Ky = makeCustomSprite({ + render({ props: e, device: t }) { + const { fullWidth: a, fullHeight: i } = t.size, + n = 0.5 * a, + s = a - 40 - 60 - n - 0.15 * a; + return [ + Fo({ + id: "MainMenuButton", + text: "MAIN MENU", + width: 140, + height: 40, + onPress: e.backToMainMenu, + x: -a / 2 + 70 + 30, + y: -i / 2 + 20 + 30, + }), + Qy({ + id: "TabsMenu", + width: n, + height: i - 60 - 60, + playerSkin: e.playerSkin, + x: -a / 2 + 30 + n / 2, + y: 30, + }), + Ty({ + id: "ProfileView", + width: s, + height: i - 60 - 60, + playerSkin: e.playerSkin, + x: -a / 2 + 30 + n + 20 + s / 2, + y: 30, + }), + ]; + }, + }), + Qy = makeCustomSprite({ + render({ props: { width: e, height: t, playerSkin: a } }) { + const i = { type: "linearHoriz", width: 80, colors: [xe, De] }, + s = t - 30; + return [ + /*Fo({ + id: "PlayTabButton", + text: localize("PLAY"), + width: 110, + height: 35, + fontSize: 15, + shadowDir: "right", + x: -e / 2 + 55, + y: t / 2 - 20, + disabled: true, + onPress: () => {}, + }), + Fo({ + id: "FriendsTabButton", + text: localize("FRIENDS"), + width: 110, + height: 35, + fontSize: 15, + shadowDir: "right", + x: -e / 2 + 180, + y: t / 2 - 20, + disabled: true, + onPress: () => {}, + }),*/ + We({ + width: 110, + height: 40, + color: Ge, + x: 3 - e / 2 + 305, + y: t / 2 - 20, + }), + We({ + width: 110, + height: 40, + color: ve, + x: -e / 2 + 305, + y: t / 2 - 20, + }), + n({ + text: localize("SKINS"), + font: { size: 18 }, + color: Ae, + gradient: i, + x: 3 - e / 2 + 300, //-e / 2 + 305, + y: t / 2 - 20, + }), + We({ + gradient: { type: "linearHoriz", width: e, colors: [Ne, De] }, + width: e, + height: s, + x: 3, + y: -24, + }), + We({ color: ve, width: e, height: s, y: -20 }), + xy({ + id: "SkinsMenu", + width: e, + height: s, + playerSkin: a, + profileId: null, + y: -20, + }), + ]; + }, + }), + Zy = makeCustomSprite({ + init({ getContext: e, updateState: t, device: a, props: i }) { + const { online: n } = e(Se); + return ( + n && + Promise.all([ + bp.getBuyableItems(n.backend), + Jp.getUserItems("all"), + ]) + .then(([e, a]) => { + const i = kp.getBoosterItems(a); + t((t) => + Object.assign(Object.assign({}, t), { + items: { + canBuy: kp.removeBoughtItems(e, a), + owned: Object.assign( + { boosters: i }, + kp.calculateNumberBoosters(i), + ), + }, + }), + ); + }) + .catch((e) => { + a.alert.ok(`Couldn't load store: ${e.message}`, () => { + i.backToMainMenu(); + }); + }), + { items: "loading", isBuying: false, showBuyBlocksModal: null } + ); + }, + render({ + props: e, + state: t, + device: a, + updateState: i, + getContext: s, + }) { + const o = a.size.width + 2 * a.size.widthMargin, + r = a.size.height + 2 * a.size.heightMargin, + { showBuyBlocksModal: l, items: c } = t, + { online: d } = s(Se); + if (!d) return []; + const u = [ + Fo({ + id: "BackButton", + text: "<-", + width: 40, + height: 30, + onPress: e.backToMainMenu, + x: -250, + y: r / 2 - 40, + }), + n({ + text: "Store", + color: "white", + font: { size: 20 }, + y: r / 2 - 40, + }), + ], + { blocksBalance: h, updateBlocksBalance: p, backend: g } = d; + if ("loading" === c) return [ ...u, n({ - text: `Blocks: ${h}`, - color: "black", - font: { align: "right" }, - x: o / 2 - 90, - y: r / 2 - 50, + text: `${localize("LOADING")}...`, + color: ve, + font: { size: 15 }, }), - Fo({ - id: "Add Blocks", - text: "+", - width: 20, - height: 20, - onPress: () => { + ]; + const m = (e) => { + (i((e) => + Object.assign(Object.assign({}, e), { isBuying: true }), + ), + bp + .buyItem(g, e) + .then( + ({ balance: e, item: t }) => ( + p(e), + ((e) => { + i((t) => { + if ("loading" === t.items) return t; + if ("boosterItem" === e.type) { + const a = [...t.items.owned.boosters, e]; + return Object.assign(Object.assign({}, t), { + items: Object.assign( + Object.assign({}, t.items), + { + owned: Object.assign( + { boosters: a }, + kp.calculateNumberBoosters(a), + ), + }, + ), + }); + } + return Object.assign(Object.assign({}, t), { + items: Object.assign(Object.assign({}, t.items), { + canBuy: t.items.canBuy.filter( + (t) => t.defId !== e.defId, + ), + }), + }); + }); + })(t), + Jp.addPurchasedItems([t], a.now) + ), + ) + .catch((e) => { + a.alert.ok(`Error buying item: ${e.message}`); + }) + .finally(() => { i((e) => Object.assign(Object.assign({}, e), { - showBuyBlocksModal: {}, + isBuying: false, }), ); - }, - x: o / 2 - 70, - y: r / 2 - 50, + })); + }; + return [ + ...u, + n({ + text: `Blocks: ${h}`, + color: "black", + font: { align: "right" }, + x: o / 2 - 90, + y: r / 2 - 50, + }), + Fo({ + id: "Add Blocks", + text: "+", + width: 20, + height: 20, + onPress: () => { + i((e) => + Object.assign(Object.assign({}, e), { + showBuyBlocksModal: {}, + }), + ); + }, + x: o / 2 - 70, + y: r / 2 - 50, + }), + n({ text: "Inventory:", color: "black", y: r / 2 - 80 }), + n({ + text: `Autopilot Boosters: ${c.owned.numAutopilots}`, + color: "black", + x: -200, + y: r / 2 - 100, + }), + n({ + text: `Missile Boosters: ${c.owned.numMissiles}`, + color: "black", + y: r / 2 - 100, + }), + n({ + text: `Slow Motion Boosters: ${c.owned.numSlowMotions}`, + color: "black", + x: 200, + y: r / 2 - 100, + }), + t.isBuying + ? n({ text: "Processing...", color: "black" }) + : ScrollContainer({ + id: "ItemsList", + containerWidth: 700, + containerHeight: r - 130, + contentHeight: 40 * (c.canBuy.length + 1), + y: r / 2 - 130, + sprites: (e) => + c.canBuy.map((t, a) => + Fo({ + id: `BlockButton-${a}`, + width: 700, + height: 30, + text: `${t.name} - ${t.blocksPrice} blocks`, + onPress: () => { + t.blocksPrice > h + ? i((e) => + Object.assign(Object.assign({}, e), { + showBuyBlocksModal: { + buyItemOnComplete: t, + }, + }), + ) + : m(t); + }, + noPress: e, + y: 40 * -(a + 1), + }), + ), }), - n({ text: "Inventory:", color: "black", y: r / 2 - 80 }), + l && + bm({ + id: "BuyBlocksModal", + onModalClose: () => { + i((e) => + Object.assign(Object.assign({}, e), { + showBuyBlocksModal: null, + }), + ); + }, + onPurchaseComplete: (e) => { + (l.buyItemOnComplete && + e >= l.buyItemOnComplete.blocksPrice && + m(l.buyItemOnComplete), + p(e), + i((e) => + Object.assign(Object.assign({}, e), { + showBuyBlocksModal: null, + }), + )); + }, + }), + ]; + }, + }); + const eE = () => G.getJumpFrames(114), + tE = makeCustomSprite({ + init({ + preloadFiles: e, + updateState: updateState, + device: a, + props: i, + getContext: n, + }) { + const s = + ("credits" === i.view.type && i.view.endOfGame), + o = `audio/tracks/monstaz-popcorn-funk${s ? "-credits" : "" + }.mp3`; + return ( + e({ + imageFileNames: Qs.mainMenuImages, + audioFileNames: [ + ...Qs.mainMenuAudio, + "audio/tracks/monstaz-popcorn-funk-credits.mp3", + o, + ], + }).then(() => { + const { settings: e } = n(Se); + ((e.muteMenuMusic && + !s) || + a.audio(o).play({ loop: true, overwrite: true }), + updateState((e) => + Object.assign(Object.assign({}, e), { loading: false }), + )); + }), + { loading: true, frame: 0, modal: null, menuMusicFile: o, readNews: true } + ); + }, + loop({ state: e }) { + if (e.loading) return e; + const t = e.frame + 1; + let newArrowY = e.arrowY + 0.3; + newArrowY > 10 && (newArrowY = -10); + return Object.assign(Object.assign({}, e), { + frame: t >= eE() ? t - eE() : t, + arrowY: newArrowY, + }); + }, + render({ + props: e, + state: t, + device: a, + getContext: i, + updateState: updateState, + }) { + const { news: newsMessage, id: newsID, title: newsTitle } = _NEWS; + const { + view: o, + updateView: r, + updatePlayerName: c, + accountState: d, + updateParty: u, + } = e, + h = () => { + r({ type: "main" }); + }, + p = () => { + a.audio(t.menuMusicFile).pause(); + }, + g = () => { + a.audio(t.menuMusicFile).setVolume({ + type: "linear", + fadeTime: 0.5, + fadeTo: 0, + }); + }, + m = () => { + a.audio(t.menuMusicFile).setVolume({ + type: "linear", + fadeTime: 0.5, + fadeTo: 1, + }); + }, + f = a.size.height + 2 * a.size.heightMargin, + mostLeft = a.size.width + 2 * a.size.widthMargin; + if (t.loading) + return [ n({ - text: `Autopilot Boosters: ${c.owned.numAutopilots}`, - color: "black", - x: -200, - y: r / 2 - 100, + text: localize(`${localize("LOADING")}...`), + font: { size: 15 }, + color: ve, }), + ]; + const E = t.frame / eE(), + b = E > 0.9 ? 10 * (E - 0.9) : E < 0.2 ? 5 * (0.2 - E) : 0; + if ("competition" === o.type) { + return [ + competition({ id: "News", updateView: r, backToMainMenu: h }), + ]; + } + if ("main" === o.type) { + const isLoggingIn = "requestingAuth" === d.type || "signingIn" === d.type, + o = "loggedIn" === d.type && "anon" !== d.auth, + { online: c } = i(Se), + u = Math.max(120, f / 2 - 180), + h = Math.min(-152, -f / 2 + 150); + return [ n({ - text: `Missile Boosters: ${c.owned.numMissiles}`, - color: "black", - y: r / 2 - 100, + text: version, + color: Re, + font: { align: "left" }, + x: -mostLeft / 2 + 20, + y: -f / 2 + 20, }), - n({ - text: `Slow Motion Boosters: ${c.owned.numSlowMotions}`, - color: "black", - x: 200, - y: r / 2 - 100, + l({ + fileName: "images/mainMenu/logo.png", + width: 221, + height: 94, + y: u, }), - t.isBuying - ? n({ text: "Processing...", color: "black" }) - : ScrollContainer({ - id: "ItemsList", - containerWidth: 700, - containerHeight: r - 130, - contentHeight: 40 * (c.canBuy.length + 1), - y: r / 2 - 130, - sprites: (e) => - c.canBuy.map((t, a) => - Fo({ - id: `BlockButton-${a}`, - width: 700, - height: 30, - text: `${t.name} - ${t.blocksPrice} blocks`, - onPress: () => { - t.blocksPrice > h - ? i((e) => - Object.assign(Object.assign({}, e), { - showBuyBlocksModal: { - buyItemOnComplete: t, - }, - }), - ) - : m(t); - }, - noPress: e, - y: 40 * -(a + 1), - }), - ), + Wy({ + id: "Levels", + text: localize("LEVELS"), + onPress: () => + r({ + type: "levels", + worldsView: { type: "worldsList" }, }), - l && - bm({ - id: "BuyBlocksModal", - onModalClose: () => { - i((e) => - Object.assign(Object.assign({}, e), { - showBuyBlocksModal: null, - }), - ); - }, - onPurchaseComplete: (e) => { - (l.buyItemOnComplete && - e >= l.buyItemOnComplete.blocksPrice && - m(l.buyItemOnComplete), - p(e), - i((e) => - Object.assign(Object.assign({}, e), { - showBuyBlocksModal: null, - }), - )); - }, - }), - ]; - }, - }); - const eE = () => G.getJumpFrames(114), - tE = makeCustomSprite({ - init({ - preloadFiles: e, - updateState: updateState, - device: a, - props: i, - getContext: n, - }) { - const s = - ("credits" === i.view.type && i.view.endOfGame), - o = `audio/tracks/monstaz-popcorn-funk${ - s ? "-credits" : "" - }.mp3`; - return ( - e({ - imageFileNames: Qs.mainMenuImages, - audioFileNames: [ - ...Qs.mainMenuAudio, - "audio/tracks/monstaz-popcorn-funk-credits.mp3", - o, - ], - }).then(() => { - const { settings: e } = n(Se); - ((e.muteMenuMusic && - !s) || - a.audio(o).play({ loop: true, overwrite: true }), - updateState((e) => - Object.assign(Object.assign({}, e), { loading: false }), - )); + y: -30, + x: -200, + disabled: false, // alright... + shadowOffsetX: -1, + shadowOffsetY: 0, + beatSize: b, + }), + Wy({ + id: "Editor", + text: localize("EDITOR"), + onPress: () => r({ type: "editor" }), + y: -30, + shadowOffsetX: 0, + shadowOffsetY: -1, + beatSize: b, + }), + Wy({ + id: "Online", + text: localize("SKINS"), //ONLINE"), + onPress: () => r({ type: "online" }), + x: 200, + y: -30, + shadowOffsetX: 1, + shadowOffsetY: 0, + beatSize: b, }), - { loading: true, frame: 0, modal: null, menuMusicFile: o, readNews: true } - ); - }, - loop({ state: e }) { - if (e.loading) return e; - const t = e.frame + 1; - let newArrowY = e.arrowY + 0.3; - newArrowY > 10 && (newArrowY = -10); - return Object.assign(Object.assign({}, e), { - frame: t >= eE() ? t - eE() : t, - arrowY: newArrowY, - }); - }, - render({ - props: e, - state: t, - device: a, - getContext: i, - updateState: updateState, - }) { - const { news: newsMessage, id: newsID, title: newsTitle } = _NEWS; - const { - view: o, - updateView: r, - updatePlayerName: c, - accountState: d, - updateParty: u, - } = e, - h = () => { - r({ type: "main" }); - }, - p = () => { - a.audio(t.menuMusicFile).pause(); - }, - g = () => { - a.audio(t.menuMusicFile).setVolume({ - type: "linear", - fadeTime: 0.5, - fadeTo: 0, - }); - }, - m = () => { - a.audio(t.menuMusicFile).setVolume({ - type: "linear", - fadeTime: 0.5, - fadeTo: 1, - }); - }, - f = a.size.height + 2 * a.size.heightMargin, - mostLeft = a.size.width + 2 * a.size.widthMargin; - if (t.loading) - return [ - n({ - text: localize(`${localize("LOADING")}...`), - font: { size: 15 }, - color: ve, - }), - ]; - const E = t.frame / eE(), - b = E > 0.9 ? 10 * (E - 0.9) : E < 0.2 ? 5 * (0.2 - E) : 0; - if ("competition" === o.type) { - return [ - competition({ id: "News", updateView: r, backToMainMenu: h }), - ]; - } - if ("main" === o.type) { - const isLoggingIn = "requestingAuth" === d.type || "signingIn" === d.type, - o = "loggedIn" === d.type && "anon" !== d.auth, - { online: c } = i(Se), - u = Math.max(120, f / 2 - 180), - h = Math.min(-152, -f / 2 + 150); - return [ - n({ - text: version, - color: Re, - font: { align: "left" }, - x: -mostLeft / 2 + 20, - y: -f / 2 + 20, - }), - l({ - fileName: "images/mainMenu/logo.png", - width: 221, - height: 94, - y: u, - }), - Wy({ - id: "Levels", - text: localize("LEVELS"), - onPress: () => - r({ - type: "levels", - worldsView: { type: "worldsList" }, - }), - y: -30, - x: -200, - disabled: false, // alright... - shadowOffsetX: -1, - shadowOffsetY: 0, - beatSize: b, - }), - Wy({ - id: "Editor", - text: localize("EDITOR"), - onPress: () => r({ type: "editor" }), - y: -30, - shadowOffsetX: 0, - shadowOffsetY: -1, - beatSize: b, - }), - Wy({ - id: "Online", - text: localize("SKINS"), //ONLINE"), - onPress: () => r({ type: "online" }), - x: 200, - y: -30, - shadowOffsetX: 1, - shadowOffsetY: 0, - beatSize: b, - }), - - Fo({ - id: "MoreButton", - text: localize("MORE"), - width: 170, - height: 40, - darkText: true, - onPress: () => { - r({ type: "more" }); - }, - x: -100, - y: h, - }), - Fo({ - id: "NewsButton", - text: localize("NEWS"), - width: 170, - height: 40, - darkText: true, - onPress: () => { - r({ type: "news" }); - }, - x: 100, - y: h, - }), - - ...(localStorage.getItem("news") == newsID - ? [] - : [ - s({ - radius: 13, - color: Ve, - x: 185, - y: h + 20, - opacity: 0.9, - }), - s({ - radius: 2, + Fo({ + id: "MoreButton", + text: localize("MORE"), + width: 170, + height: 40, + darkText: true, + onPress: () => { + r({ type: "more" }); + }, + x: -100, + y: h, + }), + Fo({ + id: "NewsButton", + text: localize("NEWS"), + width: 170, + height: 40, + darkText: true, + onPress: () => { + r({ type: "news" }); + }, + x: 100, + y: h, + }), + + + ...(localStorage.getItem("news") == newsID + ? [] + : [ + s({ + radius: 13, + color: Ve, + x: 185, + y: h + 20, + opacity: 0.9, + }), + s({ + radius: 2, + color: ve, + x: 185, + y: h + 20, + }), + ...(newsID == 5 + ? [ + y( + { + fileName: "images/level/arrow-up.png", + width: 14, + height: 8, + x: 200, + y: h, + rotation: -90, + }, + (a) => { + a.x = 200 + Math.abs(t.arrowY); + }, + ), + n({ + text: localize("IMPORTANT!"), + font: { align: "left", size: 13 }, color: ve, - x: 185, - y: h + 20, + x: 220, + y: h, }), - ...(newsID == 5 - ? [ - y( - { - fileName: "images/level/arrow-up.png", - width: 14, - height: 8, - x: 200, - y: h, - rotation: -90, - }, - (a) => { - a.x = 200 + Math.abs(t.arrowY); - }, - ), - n({ - text: localize("IMPORTANT!"), - font: { align: "left", size: 13 }, - color: ve, - x: 220, - y: h, - }), - ] - : []), - ]), - /*Fo({ - id: "AchievementsButton", - text: localize("ACHIEVEMENTS"), - width: 170, - height: 40, - darkText: true, + ] + : []), + ]), + /*Fo({ + id: "AchievementsButton", + text: localize("ACHIEVEMENTS"), + width: 170, + height: 40, + darkText: true, + onPress: () => { + r({ type: "achievements" }); + }, + x: -100, + y: h, + }),*/ + n({ + text: localize(currentJoke), + font: { align: "center", size: 13 }, + color: Te, + strokeThickness: 2, + x: 0, + y: u - 50, + }), + document.fullscreenEnabled + ? vo({ + id: "FullScreen", + fullScreen: true, onPress: () => { - r({ type: "achievements" }); + if (document.fullscreenElement) { + document.exitFullscreen(); + } else { + document.documentElement + .requestFullscreen() + .catch((e) => { + throw e; + }); + } }, - x: -100, - y: h, - }),*/ - n({ - text: localize(currentJoke), - font: { align: "center", size: 13 }, - color: Te, - strokeThickness: 2, - x: 0, - y: u - 50, - }), - document.fullscreenEnabled - ? vo({ - id: "FullScreen", - fullScreen: true, + x: mostLeft / 2 - 40, + y: f / 2 - 40, + }) + : null, + //Fo({ + // id: "Account", + // text: a ? "..." : o ? "ACCOUNT" : "LOG IN", + // width: 120, + // height: 40, + // darkText: true, + // onPress: () => { + // s((e) => + // Object.assign(Object.assign({}, e), { modal: "signIn" }) + // ); + // }, + // x: -y / 2 + 80, + // y: f / 2 - 40, + // }), + ...(c + ? zu.hasIAP() + ? [ + n({ + text: `BLOCKS: ${c.blocksBalance}`, + font: { align: "right", size: 13 }, + color: Te, + strokeColor: Ye, + strokeThickness: 2, + x: mostLeft / 2 - 60, + y: f / 2 - 40, + }), + Fo({ + id: "AddBlocks", + text: "+", + width: 30, + height: 30, onPress: () => { - if (document.fullscreenElement) { - document.exitFullscreen(); - } else { - document.documentElement - .requestFullscreen() - .catch((e) => { - throw e; - }); - } + updateState((e) => + Object.assign(Object.assign({}, e), { + modal: "blocks", + }), + ); }, x: mostLeft / 2 - 40, y: f / 2 - 40, - }) - : null, - //Fo({ - // id: "Account", - // text: a ? "..." : o ? "ACCOUNT" : "LOG IN", - // width: 120, - // height: 40, - // darkText: true, - // onPress: () => { - // s((e) => - // Object.assign(Object.assign({}, e), { modal: "signIn" }) - // ); - // }, - // x: -y / 2 + 80, - // y: f / 2 - 40, - // }), - ...(c - ? zu.hasIAP() - ? [ - n({ - text: `BLOCKS: ${c.blocksBalance}`, - font: { align: "right", size: 13 }, - color: Te, - strokeColor: Ye, - strokeThickness: 2, - x: mostLeft / 2 - 60, - y: f / 2 - 40, - }), - Fo({ - id: "AddBlocks", - text: "+", - width: 30, - height: 30, - onPress: () => { - updateState((e) => - Object.assign(Object.assign({}, e), { - modal: "blocks", - }), - ); - }, - x: mostLeft / 2 - 40, - y: f / 2 - 40, - }), - ] - : [] - : []) /*[ + }), + ] + : [] + : []) /*[ n({ text: localize("OFFLINE"), font: { size: 15 }, @@ -74394,1613 +74395,1732 @@ var version = "v1.17.2"; }), _m({ id: "GoOnline", x: y / 2 - 80, y: f / 2 - 40 }), ]),*/, - null, - null, - "signIn" === t.modal - ? Yy({ - id: "PlatformSignInModal", - accountState: d, - closeModal: () => { - updateState((e) => - Object.assign(Object.assign({}, e), { - modal: null, - }), - ); - }, - }) - : "blocks" === t.modal - ? bm({ - id: "BuyBlocksModal", - onModalClose: () => { + null, + null, + "signIn" === t.modal + ? Yy({ + id: "PlatformSignInModal", + accountState: d, + closeModal: () => { + updateState((e) => + Object.assign(Object.assign({}, e), { + modal: null, + }), + ); + }, + }) + : "blocks" === t.modal + ? bm({ + id: "BuyBlocksModal", + onModalClose: () => { + updateState((e) => + Object.assign(Object.assign({}, e), { + modal: null, + }), + ); + }, + onPurchaseComplete: (e) => { + c && + (c.updateBlocksBalance(e), updateState((e) => Object.assign(Object.assign({}, e), { modal: null, }), - ); - }, - onPurchaseComplete: (e) => { - c && - (c.updateBlocksBalance(e), - updateState((e) => - Object.assign(Object.assign({}, e), { - modal: null, - }), - )); - }, - }) - : null, - ]; - } - if ("levels" === o.type) - return [ - sy({ - id: "WorldsMenu", - playLevel: (t, a) => { - (p(), e.playWorldLevel(t, a)); - }, - view: o.worldsView, - updateView: (e) => { - r({ type: "levels", worldsView: e }); - }, - fadeInMusic: m, - fadeOutMusic: g, - backToMainMenu: h, - showStartArrows: e.showStartArrows, - }), - ]; - if ("testCases" === o.type) - return [ - Ey({ - id: "TestCasesList", - playTestCase: (t) => { - (p(), e.playTestCase(t)); - }, - backToMainMenu: h, - }), - ]; - if ("editor" === o.type) - return [ - hy({ - id: "LevelEditorMenu", - editLevel: (t) => { - (p(), e.editLevel(t)); - }, - playLevel: (t) => { - (p(), e.playEditorLevel(t)); - }, - fadeInMusic: m, - fadeOutMusic: g, - backToMainMenu: h, - }), - ]; - if ("store" === o.type) - return [Zy({ id: "StoreMenu", backToMainMenu: h })]; - if ("achievements" === o.type) - return [Xy({ id: "AchievementsMenu", backToMainMenu: h })]; - if ("online" === o.type) { - if ("loggedIn" !== d.type) - return [ - Gf({ - id: "OnlineMenuOfflineAssets", - assets: { - imageFileNames: Qs.getPlayerImages( - Object.values(Wt.skins), - [], - ), + )); }, - sprites: [ - Ky({ - id: "OnlineMenuOffline", - playerSkin: e.playerSkin, - backToMainMenu: h, - }), - ], - }), - ]; - const { profile: t, party: a, backend: n } = d; - return [ - Gf({ - id: "OnlineMenuAssets", - assets: { - imageFileNames: Qs.getPlayerImages( - Object.values(Wt.skins), - [], - ), - }, - sprites: [ - Dy({ - id: "OnlineMenu", - profile: t, - playerSkin: e.playerSkin, - updatePlayerName: c, - backend: n, - party: a, - updateParty: u, - playOnline: ({ - url: a, - passcode: n, - localLevelFileName: s, - isLocalDev: o, - }) => { - return ( - (r = this), - (l = void 0), - (d = function* () { - const { online: r } = i(Se); - if (r) - if ((p(), bp.deregisterOnline(r.backend), o)) { - let i; - (s && (i = yield Hf(s)), - e.playOnline({ - url: a, - passcode: n, - profile: Object.assign( - Object.assign({}, t), - { profileId: t.playerName }, - ), - level: i, - })); - } else - e.playOnline({ - url: a, - passcode: n, - profile: t, - }); - }), - new ((c = void 0) || (c = Promise))(function ( - e, - t, - ) { - function a(e) { - try { - n(d.next(e)); - } catch (e) { - t(e); - } - } - function i(e) { - try { - n(d.throw(e)); - } catch (e) { - t(e); - } - } - function n(t) { - var n; - t.done - ? e(t.value) - : ((n = t.value), - n instanceof c - ? n - : new c(function (e) { - e(n); - })).then(a, i); - } - n((d = d.apply(r, l || [])).next()); - }) - ); - var r, l, c, d; - }, - fadeInMusic: m, - fadeOutMusic: g, - backToMainMenu: h, - }), - ], - }), - ]; - } - if ("more" === o.type) - return [Jy({ id: "More", updateView: r, backToMainMenu: h })]; - if ("news" === o.type) - return [ - news({ - id: "News", - updateView: r, - backToMainMenu: h, - newsID: newsID, - title: newsTitle, - message: newsMessage, - }), - ]; - const S = () => { - r({ type: "more" }); - }; - return "credits" === o.type - ? [ - qy({ - id: "Credits", - beatSize: b, - isEndOfGame: o.endOfGame, - backToMainMenu: S, - }), - ] - : "settings" === o.type - ? [ - Cm.Single({ - id: "SettingsMenu", - globalContextVal: i(Se), - goBack: S, - onMenuMusicMute: (e) => { - e - ? a.audio(t.menuMusicFile).pause() - : a - .audio(t.menuMusicFile) - .play({ loop: true, overwrite: true }); - }, - }), - ] - : []; - }, - }), - aE = makeCustomSprite({ - init({ props: e }) { - const { testCase: t, bpm: a = t.bpm } = e, - i = t.inputs[1]; - let n, - s = {}; - if (t.bpm !== a) { - const e = t.bpm / a; - n = (function (e, t) { - switch (e.type) { - case "canLastUntilFrame": - return Object.assign(Object.assign({}, e), { - frame: Math.round(e.frame * t), - }); - case "crashesByFrame": - return Object.assign(Object.assign({}, e), { - frame: Math.round(e.frame * t), - notBefore: - void 0 !== e.notBefore - ? Math.round(e.notBefore * t) - : void 0, - }); - } - })(t.expectations, e); - for (const a in t.inputs) - s[Math.ceil(Number(a) * e)] = t.inputs[a]; - } else ((n = t.expectations), (s = t.inputs)); - return { - frame: 1, - scaledInputs: s, - scaledExpectations: n, - mockPlayerInput: "tap-on" === i ? "justDown" : "up", - result: "waiting", - refreshCount: 0, - }; - }, - loop({ state: e, getInputs: t, device: a }) { - let { mockPlayerInput: i, result: n } = e; - const { scaledInputs: s, scaledExpectations: o } = e; - if ("waiting" !== n) return e; - t().pointer.justPressed && a.log(e.frame); - const r = s[e.frame]; - switch ( - ("tap-on" === r - ? (i = "justDown") - : "tap-off" === r - ? (i = "up") - : r || "justDown" !== i || (i = "down"), - o.type) - ) { - case "crashesByFrame": - e.frame > o.frame && (n = "failed"); - break; - case "canLastUntilFrame": - e.frame > o.frame && (n = "passed"); - } - return { - frame: e.frame + 1, - scaledInputs: s, - scaledExpectations: o, - mockPlayerInput: i, - result: n, - refreshCount: e.refreshCount, - }; - }, - render({ - props: { testCase: e, backToMenu: t, bpm: a = e.bpm }, - state: i, - device: s, - updateState: o, - getContext: r, - }) { - const l = s.size.width + 2 * s.size.widthMargin, - c = s.size.height + 2 * s.size.heightMargin, - d = i.scaledExpectations; - if (e.level instanceof Error) - return [n({ text: "Failed to decode level", color: "black" })]; - const u = Sr( - "test_id", - e.name, - Object.assign(Object.assign({}, hl.songs.lighthouse), { - bpm: a, + }) + : null, + ]; + } + if ("levels" === o.type) + return [ + sy({ + id: "WorldsMenu", + playLevel: (t, a) => { + (p(), e.playWorldLevel(t, a)); + }, + view: o.worldsView, + updateView: (e) => { + r({ type: "levels", worldsView: e }); + }, + fadeInMusic: m, + fadeOutMusic: g, + backToMainMenu: h, + showStartArrows: e.showStartArrows, }), - e.level.layout, - ); + ]; + if ("testCases" === o.type) return [ - iE.Single({ - id: "PlayLevelContainer", - level: u, - backToMenu: t, - mockPlayerInput: i.mockPlayerInput, - paused: "waiting" !== i.result, - refreshCount: i.refreshCount, - globalContextVal: r(Se), - spineContextVal: r(Ws), - didCrash: () => { - switch (d.type) { - case "crashesByFrame": - o((e) => - Object.assign(Object.assign({}, e), { - result: - i.frame > (d.notBefore || 0) - ? "passed" - : "failed", - }), - ); - break; - case "canLastUntilFrame": - o((e) => - Object.assign(Object.assign({}, e), { - result: "failed", - }), - ); - } + Ey({ + id: "TestCasesList", + playTestCase: (t) => { + (p(), e.playTestCase(t)); }, + backToMainMenu: h, }), - n({ text: e.name, color: "white", y: c / 2 - 20 }), - "waiting" === i.result - ? null - : n({ - testId: "Result", - text: i.result, - color: "passed" === i.result ? "green" : "red", - y: c / 2 - 40, - }), - Fo({ - id: "ReplayButton", - x: l / 2 - 50, - y: c / 2 - 50, - text: "Replay", - width: 80, - height: 50, - onPress: () => { - o((e) => - Object.assign(Object.assign({}, e), { - frame: 0, - mockPlayerInput: "up", - result: "waiting", - refreshCount: e.refreshCount + 1, - }), - ); + ]; + if ("editor" === o.type) + return [ + hy({ + id: "LevelEditorMenu", + editLevel: (t) => { + (p(), e.editLevel(t)); + }, + playLevel: (t) => { + (p(), e.playEditorLevel(t)); }, + fadeInMusic: m, + fadeOutMusic: g, + backToMainMenu: h, }), ]; - }, - }), - iE = makeSprite({ - render: ({ props: e }) => [ - Se.Single({ - context: () => e.globalContextVal, - sprites: [ - Ws.Single({ - context: () => e.spineContextVal, - sprites: [ - onChange( - () => e.refreshCount, - () => [ - vf.Single( - { - level: e.level, - backToMenu: e.backToMenu, - mockPlayerInput: e.mockPlayerInput, - paused: e.paused, - didCrash: e.didCrash, - playerSkin: Wt.default, - }, - (t) => { - ((t.level = e.level), - (t.backToMenu = e.backToMenu), - (t.mockPlayerInput = e.mockPlayerInput), - (t.paused = e.paused), - (t.didCrash = e.didCrash)); - }, - ), - ], + if ("store" === o.type) + return [Zy({ id: "StoreMenu", backToMainMenu: h })]; + if ("achievements" === o.type) + return [Xy({ id: "AchievementsMenu", backToMainMenu: h })]; + if ("online" === o.type) { + if ("loggedIn" !== d.type) + return [ + Gf({ + id: "OnlineMenuOfflineAssets", + assets: { + imageFileNames: Qs.getPlayerImages( + Object.values(Wt.skins), + [], ), + }, + sprites: [ + Ky({ + id: "OnlineMenuOffline", + playerSkin: e.playerSkin, + backToMainMenu: h, + }), ], }), - ], - }), - ], - }); - function nE(e, t) { - e.isClosed || - e.socket.readyState !== e.socket.OPEN || - e.socket.send(JSON.stringify(t)); - } - const sE = function e({ - url: t, - onOpen: a, - onRealtimeMessage: i, - onDisconnect: n, - onReconnect: s, - timer: o, - }) { - try { - const r = new WebSocket(t), - l = { socket: r, isClosed: false }; - let c, - d = false; - return ( - (r.onopen = () => { - ((d = true), a(l)); - }), - (r.onerror = () => { - (n(l, true), r.close()); + ]; + const { profile: t, party: a, backend: n } = d; + return [ + Gf({ + id: "OnlineMenuAssets", + assets: { + imageFileNames: Qs.getPlayerImages( + Object.values(Wt.skins), + [], + ), + }, + sprites: [ + Dy({ + id: "OnlineMenu", + profile: t, + playerSkin: e.playerSkin, + updatePlayerName: c, + backend: n, + party: a, + updateParty: u, + playOnline: ({ + url: a, + passcode: n, + localLevelFileName: s, + isLocalDev: o, + }) => { + return ( + (r = this), + (l = void 0), + (d = function* () { + const { online: r } = i(Se); + if (r) + if ((p(), bp.deregisterOnline(r.backend), o)) { + let i; + (s && (i = yield Hf(s)), + e.playOnline({ + url: a, + passcode: n, + profile: Object.assign( + Object.assign({}, t), + { profileId: t.playerName }, + ), + level: i, + })); + } else + e.playOnline({ + url: a, + passcode: n, + profile: t, + }); + }), + new ((c = void 0) || (c = Promise))(function ( + e, + t, + ) { + function a(e) { + try { + n(d.next(e)); + } catch (e) { + t(e); + } + } + function i(e) { + try { + n(d.throw(e)); + } catch (e) { + t(e); + } + } + function n(t) { + var n; + t.done + ? e(t.value) + : ((n = t.value), + n instanceof c + ? n + : new c(function (e) { + e(n); + })).then(a, i); + } + n((d = d.apply(r, l || [])).next()); + }) + ); + var r, l, c, d; + }, + fadeInMusic: m, + fadeOutMusic: g, + backToMainMenu: h, + }), + ], }), - (r.onclose = () => { - d && - !l.isClosed && - (n(l, true), - (function a(r) { - if (r >= 10) return void n(l, false); - if (l.isClosed) return; - const d = e({ - url: t, - onOpen: () => { - (void 0 !== c && o.cancel(c), - d instanceof Error || s(d)); - }, - onRealtimeMessage: i, - onDisconnect: n, - onReconnect: s, - timer: o, - }); - c = o.start(() => { - a(r + 1); - }, 500); - })(0)); + ]; + } + if ("more" === o.type) + return [Jy({ id: "More", updateView: r, backToMainMenu: h })]; + if ("news" === o.type) + return [ + news({ + id: "News", + updateView: r, + backToMainMenu: h, + newsID: newsID, + title: newsTitle, + message: newsMessage, }), - (r.onmessage = function (e) { - const t = JSON.parse(e.data); - i(l, t); + ]; + const S = () => { + r({ type: "more" }); + }; + return "credits" === o.type + ? [ + qy({ + id: "Credits", + beatSize: b, + isEndOfGame: o.endOfGame, + backToMainMenu: S, }), - l - ); - } catch (e) { - const t = e; - return (console.error(t.message), t); - } - }, - oE = function (e) { - ((e.isClosed = true), e.socket.close()); - }, - rE = function (e, t, a, i, n, s) { - nE(e, { - type: "init", - id: t, - passcode: a, - username: i, - version: n, - hasSkin: s, - }); - }, - lE = function (e, t, a) { - nE(e, { type: "gotSetup", id: t, passcode: a }); - }, - cE = function (e, t, a) { - nE(e, { type: "readyToStart", id: t, passcode: a }); - }, - dE = function (e, t, a) { - nE(e, { type: "resync", id: t, passcode: a }); - }, - uE = function (e, t, a) { - nE(e, { type: "leavingGame", id: t, passcode: a }); - }, - hE = function (e, t, a) { - nE(e, { type: "leaderEndGame", id: t, passcode: a }); - }, - pE = function (e, t, a, i) { - nE(e, { type: "watchPlayer", id: t, passcode: a, inc: i }); + ] + : "settings" === o.type + ? [ + Cm.Single({ + id: "SettingsMenu", + globalContextVal: i(Se), + goBack: S, + onMenuMusicMute: (e) => { + e + ? a.audio(t.menuMusicFile).pause() + : a + .audio(t.menuMusicFile) + .play({ loop: true, overwrite: true }); + }, + }), + ] + : []; }, - gE = function (e, t, a, i, n) { - nE(e, { type: "input", id: t, passcode: a, input: i, frame: n }); + }), + aE = makeCustomSprite({ + init({ props: e }) { + const { testCase: t, bpm: a = t.bpm } = e, + i = t.inputs[1]; + let n, + s = {}; + if (t.bpm !== a) { + const e = t.bpm / a; + n = (function (e, t) { + switch (e.type) { + case "canLastUntilFrame": + return Object.assign(Object.assign({}, e), { + frame: Math.round(e.frame * t), + }); + case "crashesByFrame": + return Object.assign(Object.assign({}, e), { + frame: Math.round(e.frame * t), + notBefore: + void 0 !== e.notBefore + ? Math.round(e.notBefore * t) + : void 0, + }); + } + })(t.expectations, e); + for (const a in t.inputs) + s[Math.ceil(Number(a) * e)] = t.inputs[a]; + } else ((n = t.expectations), (s = t.inputs)); + return { + frame: 1, + scaledInputs: s, + scaledExpectations: n, + mockPlayerInput: "tap-on" === i ? "justDown" : "up", + result: "waiting", + refreshCount: 0, + }; }, - mE = function (e, t) { - switch (e) { - case "knockout": - return { - type: "royaleCheckpointKnockout", - timeoutFrames: 1500, - timeoutTimeoutFrames: 5400, - }; - case "friends": - return { - type: "friendsRaceToFinish", - useCheckpoints: true, - leaderId: t, - }; - case "friends-no-cp": - return { - type: "friendsRaceToFinish", - useCheckpoints: false, - leaderId: t, - }; - default: - return { type: "royaleLastBlockStanding" }; + loop({ state: e, getInputs: t, device: a }) { + let { mockPlayerInput: i, result: n } = e; + const { scaledInputs: s, scaledExpectations: o } = e; + if ("waiting" !== n) return e; + t().pointer.justPressed && a.log(e.frame); + const r = s[e.frame]; + switch ( + ("tap-on" === r + ? (i = "justDown") + : "tap-off" === r + ? (i = "up") + : r || "justDown" !== i || (i = "down"), + o.type) + ) { + case "crashesByFrame": + e.frame > o.frame && (n = "failed"); + break; + case "canLastUntilFrame": + e.frame > o.frame && (n = "passed"); } - }; - kc({ checkpoints: yc, levelFileName: mc }); - a(1670); - const fE = function (e) { return { - lastCheckpointFrame: 0, - playerStates: Array.from({ length: 59 }).map(() => ({ - playerInput: "up", - mutValues: { - levelState: Zr(e.layout, null, null, null), - blockJumpUntilReleased: false, - landTimer: 0, - resetTimer: null, - layoutFirstIndexes: Ca.getInitFirstIndexes(), - checkpoints: [], - }, - frameOffset: st(-5, 5, Math.random), - atNextCheckpoint: false, - eliminated: false, - })), + frame: e.frame + 1, + scaledInputs: s, + scaledExpectations: o, + mockPlayerInput: i, + result: n, + refreshCount: e.refreshCount, }; }, - yE = function (e, t, a, i) { - return i - ? e - : Object.assign(Object.assign({}, e), { - playerStates: e.playerStates.map((e) => { - let { playerInput: i, atNextCheckpoint: n } = e; - const { frameOffset: s, mutValues: o, eliminated: r } = e; - if (r) return e; - const l = getAutopilotInputs(o.levelState.frame, t.name), - c = getAutopilotInputs(o.levelState.frame + s, t.name), - d = c || (false === l ? l : c); - return ( - null !== d - ? (i = d ? "justDown" : "up") - : "justDown" === i && (i = "down"), - dl({ - mutValues: o, - playerInput: i, - booster: null, - levelSpeeds: a, - df: 1, - level: t, - waitAtCheckpoint: n, - onCrash: () => null, - onReachedCheckpoint: () => { - n = true; - }, - onReset: () => null, - shouldResetOnCrash: true, - bottomLineTheme: - t.layout.properties.theme.objects.bottom, - }), - { - mutValues: o, - atNextCheckpoint: n, - playerInput: i, - frameOffset: - o.levelState.frame % 300 == 0 - ? st(-10, 10, Math.random) - : s, - eliminated: false, - } - ); - }), - }); + render({ + props: { testCase: e, backToMenu: t, bpm: a = e.bpm }, + state: i, + device: s, + updateState: o, + getContext: r, + }) { + const l = s.size.width + 2 * s.size.widthMargin, + c = s.size.height + 2 * s.size.heightMargin, + d = i.scaledExpectations; + if (e.level instanceof Error) + return [n({ text: "Failed to decode level", color: "black" })]; + const u = Sr( + "test_id", + e.name, + Object.assign(Object.assign({}, hl.songs.lighthouse), { + bpm: a, + }), + e.level.layout, + ); + return [ + iE.Single({ + id: "PlayLevelContainer", + level: u, + backToMenu: t, + mockPlayerInput: i.mockPlayerInput, + paused: "waiting" !== i.result, + refreshCount: i.refreshCount, + globalContextVal: r(Se), + spineContextVal: r(Ws), + didCrash: () => { + switch (d.type) { + case "crashesByFrame": + o((e) => + Object.assign(Object.assign({}, e), { + result: + i.frame > (d.notBefore || 0) + ? "passed" + : "failed", + }), + ); + break; + case "canLastUntilFrame": + o((e) => + Object.assign(Object.assign({}, e), { + result: "failed", + }), + ); + } + }, + }), + n({ text: e.name, color: "white", y: c / 2 - 20 }), + "waiting" === i.result + ? null + : n({ + testId: "Result", + text: i.result, + color: "passed" === i.result ? "green" : "red", + y: c / 2 - 40, + }), + Fo({ + id: "ReplayButton", + x: l / 2 - 50, + y: c / 2 - 50, + text: "Replay", + width: 80, + height: 50, + onPress: () => { + o((e) => + Object.assign(Object.assign({}, e), { + frame: 0, + mockPlayerInput: "up", + result: "waiting", + refreshCount: e.refreshCount + 1, + }), + ); + }, + }), + ]; }, - EE = function (e, t, a, i, n, s, o) { - if (i % 5 == 0) { - const { lastCheckpointFrame: r, playerStates: l } = a, - c = "number" == typeof e ? null : e, - d = ( - c - ? [ - { mutValues: { levelState: c }, atNextCheckpoint: t }, - ...l, - ] - : l - ).map( - ({ mutValues: { levelState: e }, atNextCheckpoint: t }) => { - var a; - return [ - e.playerX, - e.playerY, - e.playerRot, - e.playerScaleX, - e.playerScaleY, - e.crashed || e.finishedLevel || t || o ? 0 : e.playerDir, - "playerStack" === + }), + iE = makeSprite({ + render: ({ props: e }) => [ + Se.Single({ + context: () => e.globalContextVal, + sprites: [ + Ws.Single({ + context: () => e.spineContextVal, + sprites: [ + onChange( + () => e.refreshCount, + () => [ + vf.Single( + { + level: e.level, + backToMenu: e.backToMenu, + mockPlayerInput: e.mockPlayerInput, + paused: e.paused, + didCrash: e.didCrash, + playerSkin: Wt.default, + }, + (t) => { + ((t.level = e.level), + (t.backToMenu = e.backToMenu), + (t.mockPlayerInput = e.mockPlayerInput), + (t.paused = e.paused), + (t.didCrash = e.didCrash)); + }, + ), + ], + ), + ], + }), + ], + }), + ], + }); + function nE(e, t) { + e.isClosed || + e.socket.readyState !== e.socket.OPEN || + e.socket.send(JSON.stringify(t)); + } + const sE = function e({ + url: t, + onOpen: a, + onRealtimeMessage: i, + onDisconnect: n, + onReconnect: s, + timer: o, + }) { + try { + const r = new WebSocket(t), + l = { socket: r, isClosed: false }; + let c, + d = false; + return ( + (r.onopen = () => { + ((d = true), a(l)); + }), + (r.onerror = () => { + (n(l, true), r.close()); + }), + (r.onclose = () => { + d && + !l.isClosed && + (n(l, true), + (function a(r) { + if (r >= 10) return void n(l, false); + if (l.isClosed) return; + const d = e({ + url: t, + onOpen: () => { + (void 0 !== c && o.cancel(c), + d instanceof Error || s(d)); + }, + onRealtimeMessage: i, + onDisconnect: n, + onReconnect: s, + timer: o, + }); + c = o.start(() => { + a(r + 1); + }, 500); + })(0)); + }), + (r.onmessage = function (e) { + const t = JSON.parse(e.data); + i(l, t); + }), + l + ); + } catch (e) { + const t = e; + return (console.error(t.message), t); + } + }, + oE = function (e) { + ((e.isClosed = true), e.socket.close()); + }, + rE = function (e, t, a, i, n, s) { + nE(e, { + type: "init", + id: t, + passcode: a, + username: i, + version: n, + hasSkin: s, + }); + }, + lE = function (e, t, a) { + nE(e, { type: "gotSetup", id: t, passcode: a }); + }, + cE = function (e, t, a) { + nE(e, { type: "readyToStart", id: t, passcode: a }); + }, + dE = function (e, t, a) { + nE(e, { type: "resync", id: t, passcode: a }); + }, + uE = function (e, t, a) { + nE(e, { type: "leavingGame", id: t, passcode: a }); + }, + hE = function (e, t, a) { + nE(e, { type: "leaderEndGame", id: t, passcode: a }); + }, + pE = function (e, t, a, i) { + nE(e, { type: "watchPlayer", id: t, passcode: a, inc: i }); + }, + gE = function (e, t, a, i, n) { + nE(e, { type: "input", id: t, passcode: a, input: i, frame: n }); + }, + mE = function (e, t) { + switch (e) { + case "knockout": + return { + type: "royaleCheckpointKnockout", + timeoutFrames: 1500, + timeoutTimeoutFrames: 5400, + }; + case "friends": + return { + type: "friendsRaceToFinish", + useCheckpoints: true, + leaderId: t, + }; + case "friends-no-cp": + return { + type: "friendsRaceToFinish", + useCheckpoints: false, + leaderId: t, + }; + default: + return { type: "royaleLastBlockStanding" }; + } + }; + kc({ checkpoints: yc, levelFileName: mc }); + a(1670); + const fE = function (e) { + return { + lastCheckpointFrame: 0, + playerStates: Array.from({ length: 59 }).map(() => ({ + playerInput: "up", + mutValues: { + levelState: Zr(e.layout, null, null, null), + blockJumpUntilReleased: false, + landTimer: 0, + resetTimer: null, + layoutFirstIndexes: Ca.getInitFirstIndexes(), + checkpoints: [], + }, + frameOffset: st(-5, 5, Math.random), + atNextCheckpoint: false, + eliminated: false, + })), + }; + }, + yE = function (e, t, a, i) { + return i + ? e + : Object.assign(Object.assign({}, e), { + playerStates: e.playerStates.map((e) => { + let { playerInput: i, atNextCheckpoint: n } = e; + const { frameOffset: s, mutValues: o, eliminated: r } = e; + if (r) return e; + const l = getAutopilotInputs(o.levelState.frame, t.name), + c = getAutopilotInputs(o.levelState.frame + s, t.name), + d = c || (false === l ? l : c); + return ( + null !== d + ? (i = d ? "justDown" : "up") + : "justDown" === i && (i = "down"), + dl({ + mutValues: o, + playerInput: i, + booster: null, + levelSpeeds: a, + df: 1, + level: t, + waitAtCheckpoint: n, + onCrash: () => null, + onReachedCheckpoint: () => { + n = true; + }, + onReset: () => null, + shouldResetOnCrash: true, + bottomLineTheme: + t.layout.properties.theme.objects.bottom, + }), + { + mutValues: o, + atNextCheckpoint: n, + playerInput: i, + frameOffset: + o.levelState.frame % 300 == 0 + ? st(-10, 10, Math.random) + : s, + eliminated: false, + } + ); + }), + }); + }, + EE = function (e, t, a, i, n, s, o) { + if (i % 5 == 0) { + const { lastCheckpointFrame: r, playerStates: l } = a, + c = "number" == typeof e ? null : e, + d = ( + c + ? [ + { mutValues: { levelState: c }, atNextCheckpoint: t }, + ...l, + ] + : l + ).map( + ({ mutValues: { levelState: e }, atNextCheckpoint: t }) => { + var a; + return [ + e.playerX, + e.playerY, + e.playerRot, + e.playerScaleX, + e.playerScaleY, + e.crashed || e.finishedLevel || t || o ? 0 : e.playerDir, + "playerStack" === (null === (a = e.playerPowerups) || void 0 === a ? void 0 : a.item) - ? e.playerStacks.map(({ y: e }) => e) - : [], - e.crashed, - 0 === e.playerGradY || - (e.playerPowerups.some( - (e) => - e.item === "playerStack" || e.item === "jetpack", - ) - ? 0 - : 1), - ]; + ? e.playerStacks.map(({ y: e }) => e) + : [], + e.crashed, + 0 === e.playerGradY || + (e.playerPowerups.some( + (e) => + e.item === "playerStack" || e.item === "jetpack", + ) + ? 0 + : 1), + ]; + }, + ), + u = + l.reduce((e, t) => e + (t.atNextCheckpoint ? 1 : 0), 0) + + (t ? 1 : 0), + h = r + 3600 - i; + if ("number" == typeof e) { + const t = e - 1; + s({ + type: "watch", + f: i, + info: d, + atCh: u, + t: h, + watching: [ + l[t].mutValues.levelState.playerX, + { + [i + 8]: l[t].playerInput, + [i + 7]: l[t].playerInput, + [i + 6]: l[t].playerInput, + [i + 5]: l[t].playerInput, + [i + 4]: l[t].playerInput, + [i + 3]: l[t].playerInput, + [i + 2]: l[t].playerInput, + [i + 1]: l[t].playerInput, + [i]: l[t].playerInput, }, - ), - u = - l.reduce((e, t) => e + (t.atNextCheckpoint ? 1 : 0), 0) + - (t ? 1 : 0), - h = r + 3600 - i; - if ("number" == typeof e) { - const t = e - 1; + ], + }); + } else s({ type: "info", f: i, info: d, atCh: u, t: h }); + if (u >= n || h <= 0) { + const e = l + .map(({ atNextCheckpoint: e }, t) => ({ + atNextCheckpoint: e, + index: t + 1, + })) + .filter((e) => !e.atNextCheckpoint) + .map((e) => e.index); + if (u <= 1) s({ - type: "watch", - f: i, - info: d, - atCh: u, - t: h, - watching: [ - l[t].mutValues.levelState.playerX, - { - [i + 8]: l[t].playerInput, - [i + 7]: l[t].playerInput, - [i + 6]: l[t].playerInput, - [i + 5]: l[t].playerInput, - [i + 4]: l[t].playerInput, - [i + 3]: l[t].playerInput, - [i + 2]: l[t].playerInput, - [i + 1]: l[t].playerInput, - [i]: l[t].playerInput, - }, - ], + type: "gameOver", + winnerIndexes: t + ? [0] + : l + .map((e, t) => ({ + playerIndex: t, + atNextCheckpoint: e.atNextCheckpoint, + })) + .filter((e) => e.atNextCheckpoint) + .map((e) => e.playerIndex), + rankingsByIndex: t + ? [1, ...l.map((e, t) => t + 2)] + : [l.length + 1, ...l.map((e, t) => t + 1)], + xpByIndex: [100, ...l.map((e, t) => 10 * t)], }); - } else s({ type: "info", f: i, info: d, atCh: u, t: h }); - if (u >= n || h <= 0) { - const e = l - .map(({ atNextCheckpoint: e }, t) => ({ - atNextCheckpoint: e, - index: t + 1, - })) - .filter((e) => !e.atNextCheckpoint) - .map((e) => e.index); - if (u <= 1) - s({ - type: "gameOver", - winnerIndexes: t - ? [0] - : l - .map((e, t) => ({ - playerIndex: t, - atNextCheckpoint: e.atNextCheckpoint, - })) - .filter((e) => e.atNextCheckpoint) - .map((e) => e.playerIndex), - rankingsByIndex: t - ? [1, ...l.map((e, t) => t + 2)] - : [l.length + 1, ...l.map((e, t) => t + 1)], - xpByIndex: [100, ...l.map((e, t) => 10 * t)], - }); - else if ( - (s({ - type: "resume", - fromFrame: i + 270, - chPlayers: Math.ceil(u / 2), - eliminated: t ? e : [0, ...e], - }), + else if ( + (s({ + type: "resume", + fromFrame: i + 270, + chPlayers: Math.ceil(u / 2), + eliminated: t ? e : [0, ...e], + }), !t) - ) { - const e = l.findIndex((e) => e.atNextCheckpoint); - setTimeout(() => { - s({ - type: "watchPlayerState", - f: i, - info: l[e], - index: e + 1, - viewCount: 2, - }); - }, 3e3); - } - return Object.assign(Object.assign({}, a), { - lastCheckpointFrame: i, - playerStates: l.map((e) => - Object.assign(Object.assign({}, e), { - eliminated: !e.atNextCheckpoint, - atNextCheckpoint: false, - mutValues: Object.assign(Object.assign({}, e.mutValues), { - levelState: Object.assign( - Object.assign({}, e.mutValues.levelState), - { crashed: !e.atNextCheckpoint }, - ), - }), - }), - ), - }); + ) { + const e = l.findIndex((e) => e.atNextCheckpoint); + setTimeout(() => { + s({ + type: "watchPlayerState", + f: i, + info: l[e], + index: e + 1, + viewCount: 2, + }); + }, 3e3); } + return Object.assign(Object.assign({}, a), { + lastCheckpointFrame: i, + playerStates: l.map((e) => + Object.assign(Object.assign({}, e), { + eliminated: !e.atNextCheckpoint, + atNextCheckpoint: false, + mutValues: Object.assign(Object.assign({}, e.mutValues), { + levelState: Object.assign( + Object.assign({}, e.mutValues.levelState), + { crashed: !e.atNextCheckpoint }, + ), + }), + }), + ), + }); } + } + }, + bE = makeSprite({ + init: ({ props: e }) => ({ + cameraY: e.viewingPlayer.state.mutValues.levelState.playerY, + cameraXOffset: 0, + }), + loop({ state: e, props: t }) { + var a; + (null === (a = t.loop) || void 0 === a || a.call(t), + (e.cameraY = hm( + t.viewingPlayer.state.mutValues.levelState.playerY, + e.cameraY, + false, + t.viewingPlayer.state.mutValues.levelState.flyingAnchor, + )), + (e.cameraScale = 2), + (e.cameraXOffset = pm( + e.cameraXOffset, + t.viewingPlayer.state.mutValues.levelState.playerDir, + false, + ))); }, - bE = makeSprite({ - init: ({ props: e }) => ({ - cameraY: e.viewingPlayer.state.mutValues.levelState.playerY, - cameraXOffset: 0, - }), - loop({ state: e, props: t }) { - var a; - (null === (a = t.loop) || void 0 === a || a.call(t), - (e.cameraY = hm( - t.viewingPlayer.state.mutValues.levelState.playerY, - e.cameraY, - false, - t.viewingPlayer.state.mutValues.levelState.flyingAnchor, - )), - (e.cameraScale = 2), - (e.cameraXOffset = pm( - e.cameraXOffset, - t.viewingPlayer.state.mutValues.levelState.playerDir, - false, - ))); - }, - render({ props: e, state: t }) { - var a; - return [ - cm.Single( - { - playerName: e.viewingPlayer.username, - frame: e.viewingPlayer.state.mutValues.levelState.frame, - df: 1, - attempt: e.viewingPlayer.state.mutValues.levelState.attempt, - playerX: e.viewingPlayer.state.mutValues.levelState.playerX, - playerY: e.viewingPlayer.state.mutValues.levelState.playerY, - playerGradY: - e.viewingPlayer.state.mutValues.levelState.playerGradY, - playerRot: - e.viewingPlayer.state.mutValues.levelState.playerRot, - playerDir: - e.viewingPlayer.state.mutValues.levelState.playerDir, - playerScaleX: - e.viewingPlayer.state.mutValues.levelState.playerScaleX, - playerScaleY: - e.viewingPlayer.state.mutValues.levelState.playerScaleY, + render({ props: e, state: t }) { + var a; + return [ + cm.Single( + { + playerName: e.viewingPlayer.username, + frame: e.viewingPlayer.state.mutValues.levelState.frame, + df: 1, + attempt: e.viewingPlayer.state.mutValues.levelState.attempt, + playerX: e.viewingPlayer.state.mutValues.levelState.playerX, + playerY: e.viewingPlayer.state.mutValues.levelState.playerY, + playerGradY: + e.viewingPlayer.state.mutValues.levelState.playerGradY, + playerRot: + e.viewingPlayer.state.mutValues.levelState.playerRot, + playerDir: + e.viewingPlayer.state.mutValues.levelState.playerDir, + playerScaleX: + e.viewingPlayer.state.mutValues.levelState.playerScaleX, + playerScaleY: + e.viewingPlayer.state.mutValues.levelState.playerScaleY, - playerPowerups: - e.viewingPlayer.state.mutValues.levelState.playerPowerups, - isCompatible: - e.viewingPlayer.state.mutValues.levelState.isCompatible, - playerPowerupOut: null, - playerStacks: - e.viewingPlayer.state.mutValues.levelState.playerStacks, - playerStackIndex: - e.viewingPlayer.state.mutValues.levelState - .playerStackIndex, - playerSkin: e.viewingPlayer.skin, - playerJumping: - e.viewingPlayer.state.mutValues.levelState.jumping, - explosions: - e.viewingPlayer.state.mutValues.levelState.explosions, - touchingPortals: - e.viewingPlayer.state.mutValues.levelState - .touchingPortals, - justHitObject: - e.viewingPlayer.state.mutValues.levelState.justHitObject, - score: e.viewingPlayer.state.mutValues.levelState.score, - highScore: 0, - collectibles: - e.viewingPlayer.state.mutValues.levelState.collectibles, - collectiblesTotal: e.level.layout.collectibles.filter( - (x) => x.form == "coin", - ).length, - playerSpeedMultiplier: - e.viewingPlayer.state.mutValues.levelState - .playerSpeedMultiplier, - playerJetpackFuel: - e.viewingPlayer.state.mutValues.levelState - .playerJetpackFuel, - playerUsingPowerup: - e.viewingPlayer.state.mutValues.levelState - .playerUsingPowerup, - playerBullets: - e.viewingPlayer.state.mutValues.levelState.playerBullets, - bossState: null, - isFlyingLevel: false, - switchRotation: - e.viewingPlayer.state.mutValues.levelState.switchButtons - .rot, - switchBlockSpikes: - e.viewingPlayer.state.mutValues.levelState - .switchBlockSpikes, - layout: e.viewingPlayer.state.bigMutValues.inViewLayout, - crashed: e.viewingPlayer.state.mutValues.levelState.crashed, - paused: false, - finishedLevel: - e.viewingPlayer.state.mutValues.levelState.finishedLevel, - started: true, - bottomLineObjects: - (null === - (a = - e.viewingPlayer.state.mutValues.levelState - .bottomLine) || void 0 === a - ? void 0 - : a.objects) || null, - layoutState: - e.viewingPlayer.state.bigMutValues.inViewLayoutState, - layoutStateIndex: - e.viewingPlayer.state.bigMutValues.fullLayoutStateIndexes, - jumpFrames: e.levelSpeeds.jumpFrames, - landTimer: e.viewingPlayer.state.mutValues.landTimer, - otherPlayersInfo: e.otherPlayersInfo, - cameraX: gm( - e.viewingPlayer.state.mutValues.levelState.playerX, - t.cameraXOffset, - ), - cameraY: t.cameraY, - showAttempts: true, - hidePlayer: false, - fadeOutAttempts: false, - playerScale: - e.viewingPlayer.state.mutValues.levelState.playerScale, - bgColor: t.bgColor, - flash: t.flash, - gravity: t.gravity, - dashing: t.dashing, - isGravity: t.isGravity, - fallTypes: t.fallTypes, - flyingAnchor: t.flyingAnchor, - }, - (a) => { - var i; - const { - level: n, - levelSpeeds: s, - viewingPlayer: { - username: o, - state: { - mutValues: { levelState: r, landTimer: l }, - bigMutValues: { - inViewLayout: c, - inViewLayoutState: d, - fullLayoutStateIndexes: u, - }, + playerPowerups: + e.viewingPlayer.state.mutValues.levelState.playerPowerups, + isCompatible: + e.viewingPlayer.state.mutValues.levelState.isCompatible, + playerPowerupOut: null, + playerStacks: + e.viewingPlayer.state.mutValues.levelState.playerStacks, + playerStackIndex: + e.viewingPlayer.state.mutValues.levelState + .playerStackIndex, + playerSkin: e.viewingPlayer.skin, + playerJumping: + e.viewingPlayer.state.mutValues.levelState.jumping, + explosions: + e.viewingPlayer.state.mutValues.levelState.explosions, + touchingPortals: + e.viewingPlayer.state.mutValues.levelState + .touchingPortals, + justHitObject: + e.viewingPlayer.state.mutValues.levelState.justHitObject, + score: e.viewingPlayer.state.mutValues.levelState.score, + highScore: 0, + collectibles: + e.viewingPlayer.state.mutValues.levelState.collectibles, + collectiblesTotal: e.level.layout.collectibles.filter( + (x) => x.form == "coin", + ).length, + playerSpeedMultiplier: + e.viewingPlayer.state.mutValues.levelState + .playerSpeedMultiplier, + playerJetpackFuel: + e.viewingPlayer.state.mutValues.levelState + .playerJetpackFuel, + playerUsingPowerup: + e.viewingPlayer.state.mutValues.levelState + .playerUsingPowerup, + playerBullets: + e.viewingPlayer.state.mutValues.levelState.playerBullets, + bossState: null, + isFlyingLevel: false, + switchRotation: + e.viewingPlayer.state.mutValues.levelState.switchButtons + .rot, + switchBlockSpikes: + e.viewingPlayer.state.mutValues.levelState + .switchBlockSpikes, + layout: e.viewingPlayer.state.bigMutValues.inViewLayout, + crashed: e.viewingPlayer.state.mutValues.levelState.crashed, + paused: false, + finishedLevel: + e.viewingPlayer.state.mutValues.levelState.finishedLevel, + started: true, + bottomLineObjects: + (null === + (a = + e.viewingPlayer.state.mutValues.levelState + .bottomLine) || void 0 === a + ? void 0 + : a.objects) || null, + layoutState: + e.viewingPlayer.state.bigMutValues.inViewLayoutState, + layoutStateIndex: + e.viewingPlayer.state.bigMutValues.fullLayoutStateIndexes, + jumpFrames: e.levelSpeeds.jumpFrames, + landTimer: e.viewingPlayer.state.mutValues.landTimer, + otherPlayersInfo: e.otherPlayersInfo, + cameraX: gm( + e.viewingPlayer.state.mutValues.levelState.playerX, + t.cameraXOffset, + ), + cameraY: t.cameraY, + showAttempts: true, + hidePlayer: false, + fadeOutAttempts: false, + playerScale: + e.viewingPlayer.state.mutValues.levelState.playerScale, + bgColor: t.bgColor, + flash: t.flash, + gravity: t.gravity, + dashing: t.dashing, + isGravity: t.isGravity, + fallTypes: t.fallTypes, + flyingAnchor: t.flyingAnchor, + }, + (a) => { + var i; + const { + level: n, + levelSpeeds: s, + viewingPlayer: { + username: o, + state: { + mutValues: { levelState: r, landTimer: l }, + bigMutValues: { + inViewLayout: c, + inViewLayoutState: d, + fullLayoutStateIndexes: u, }, - skin: h, }, - otherPlayersInfo: p, - } = e; - ( - (a.checkpoints = e.viewingPlayer.state.mutValues.checkpoints), - (a.isGravity = r.isGravity), - (a.flyingAnchor = r.flyingAnchor), - (a.dashing = r.dashing), - (a.fallTypes = r.fallTypes), - (a.playerName = o), - (a.frame = r.frame), - (a.attempt = r.attempt), - (a.playerX = r.playerX), - (a.playerY = r.playerY), - (a.playerGradY = r.playerGradY), - (a.playerRot = r.playerRot), - (a.playerDir = r.playerDir), - (a.playerScaleX = r.playerScaleX), - (a.playerScaleY = r.playerScaleY), - (a.playerScale = r.playerScale), - (a.playerPowerups = r.playerPowerups), - (a.isCompatible = r.isCompatible), - (a.playerStacks = r.playerStacks), - (a.playerStackIndex = r.playerStackIndex), - (a.playerSkin = h), - (a.playerJumping = r.jumping), - (a.playerSpeedMultiplier = - e.viewingPlayer.state.mutValues.levelState.playerSpeedMultiplier), - (a.explosions = r.explosions), - (a.touchingPortals = r.touchingPortals), - (a.justHitObject = r.justHitObject), - (a.score = r.score), - (a.collectibles = r.collectibles), - (a.collectiblesTotal = n.layout.collectibles.length), - (a.playerJetpackFuel = r.playerJetpackFuel), - (a.playerUsingPowerup = r.playerUsingPowerup), - (a.playerBullets = r.playerBullets), - (a.switchRotation = r.switchButtons.rot), - (a.switchBlockSpikes = r.switchBlockSpikes), - (a.layout = c), - (a.crashed = r.crashed), - (a.finishedLevel = r.finishedLevel), - (a.bottomLineObjects = - (null === (i = r.bottomLine) || void 0 === i - ? void 0 - : i.objects) || null), - (a.layoutState = d), - (a.layoutStateIndex = u), - (a.jumpFrames = s.jumpFrames), - (a.landTimer = l), - (a.otherPlayersInfo = p), - (a.cameraX = gm(r.playerX, t.cameraXOffset)), - (a.cameraY = t.cameraY)); - a.bgColor = t.bgColor; - a.flash = t.flash; - a.gravity = t.gravity; - }, - ), - ]; - }, - }), - SE = makeSprite({ - render: ({ props: e }) => [ - qe({ - width: 240, - height: 60, - fillColor: we, - color: Ae, - thickness: 3, - }), - c({ - text: "VIEWING", - color: ve, - font: { size: 12 }, - strokeColor: Ye, - strokeThickness: 4, - y: 15, - }), - c({ - text: e.username, - color: ve, - font: { size: 20 }, - strokeColor: Ye, - strokeThickness: 5, - y: -5, - }), - ifConditional( - () => !e.loadingNewPlayer, - () => [ - Yo.Single({ - text: "<", - width: 30, - height: 40, - x: -140, - darkBg: true, - strokeColor: Ae, - onPress: () => { - e.viewNextPlayer("backwards"); - }, - }), - Yo.Single({ - text: ">", - width: 30, - height: 40, - x: 140, - darkBg: true, - strokeColor: Ae, - onPress: () => { - e.viewNextPlayer("forwards"); + skin: h, }, - }), - ], + otherPlayersInfo: p, + } = e; + ( + (a.checkpoints = e.viewingPlayer.state.mutValues.checkpoints), + (a.isGravity = r.isGravity), + (a.flyingAnchor = r.flyingAnchor), + (a.dashing = r.dashing), + (a.fallTypes = r.fallTypes), + (a.playerName = o), + (a.frame = r.frame), + (a.attempt = r.attempt), + (a.playerX = r.playerX), + (a.playerY = r.playerY), + (a.playerGradY = r.playerGradY), + (a.playerRot = r.playerRot), + (a.playerDir = r.playerDir), + (a.playerScaleX = r.playerScaleX), + (a.playerScaleY = r.playerScaleY), + (a.playerScale = r.playerScale), + (a.playerPowerups = r.playerPowerups), + (a.isCompatible = r.isCompatible), + (a.playerStacks = r.playerStacks), + (a.playerStackIndex = r.playerStackIndex), + (a.playerSkin = h), + (a.playerJumping = r.jumping), + (a.playerSpeedMultiplier = + e.viewingPlayer.state.mutValues.levelState.playerSpeedMultiplier), + (a.explosions = r.explosions), + (a.touchingPortals = r.touchingPortals), + (a.justHitObject = r.justHitObject), + (a.score = r.score), + (a.collectibles = r.collectibles), + (a.collectiblesTotal = n.layout.collectibles.length), + (a.playerJetpackFuel = r.playerJetpackFuel), + (a.playerUsingPowerup = r.playerUsingPowerup), + (a.playerBullets = r.playerBullets), + (a.switchRotation = r.switchButtons.rot), + (a.switchBlockSpikes = r.switchBlockSpikes), + (a.layout = c), + (a.crashed = r.crashed), + (a.finishedLevel = r.finishedLevel), + (a.bottomLineObjects = + (null === (i = r.bottomLine) || void 0 === i + ? void 0 + : i.objects) || null), + (a.layoutState = d), + (a.layoutStateIndex = u), + (a.jumpFrames = s.jumpFrames), + (a.landTimer = l), + (a.otherPlayersInfo = p), + (a.cameraX = gm(r.playerX, t.cameraXOffset)), + (a.cameraY = t.cameraY)); + a.bgColor = t.bgColor; + a.flash = t.flash; + a.gravity = t.gravity; + }, ), - ], + ]; + }, + }), + SE = makeSprite({ + render: ({ props: e }) => [ + qe({ + width: 240, + height: 60, + fillColor: we, + color: Ae, + thickness: 3, + }), + c({ + text: "VIEWING", + color: ve, + font: { size: 12 }, + strokeColor: Ye, + strokeThickness: 4, + y: 15, + }), + c({ + text: e.username, + color: ve, + font: { size: 20 }, + strokeColor: Ye, + strokeThickness: 5, + y: -5, + }), + ifConditional( + () => !e.loadingNewPlayer, + () => [ + Yo.Single({ + text: "<", + width: 30, + height: 40, + x: -140, + darkBg: true, + strokeColor: Ae, + onPress: () => { + e.viewNextPlayer("backwards"); + }, + }), + Yo.Single({ + text: ">", + width: 30, + height: 40, + x: 140, + darkBg: true, + strokeColor: Ae, + onPress: () => { + e.viewNextPlayer("forwards"); + }, + }), + ], + ), + ], + }), + IE = makeSprite({ + init: ({ props: e }) => ({ + timerText: null !== e.timeoutTimer ? _E(e.timeoutTimer) : null, }), - IE = makeSprite({ - init: ({ props: e }) => ({ - timerText: null !== e.timeoutTimer ? _E(e.timeoutTimer) : null, - }), - loop({ state: e, props: t, device: a }) { - if (null === t.timeoutTimer) - return void (null !== e.timerText && (e.timerText = null)); - const i = _E(t.timeoutTimer); - i !== e.timerText && - (a.audio("audio/online/timer-tick.wav").play(0), + loop({ state: e, props: t, device: a }) { + if (null === t.timeoutTimer) + return void (null !== e.timerText && (e.timerText = null)); + const i = _E(t.timeoutTimer); + i !== e.timerText && + (a.audio("audio/online/timer-tick.wav").play(0), (e.timerText = i)); - }, - render: ({ props: e, state: t }) => [ - m({ - fillColor: Me, - opacity: 0.5, - path: [ - [-78, -20], - [80, -20], - [105, 5], - [105, 28], - [-58, 28], - [-78, 8], - [-78, -12], - ], - }), - m({ - fillColor: we, - path: [ - [-90, -20], - [70, -20], - [90, 0], - [90, 20], - [-70, 20], - [-90, 0], - [-90, -20], - ], - }), - c({ + }, + render: ({ props: e, state: t }) => [ + m({ + fillColor: Me, + opacity: 0.5, + path: [ + [-78, -20], + [80, -20], + [105, 5], + [105, 28], + [-58, 28], + [-78, 8], + [-78, -12], + ], + }), + m({ + fillColor: we, + path: [ + [-90, -20], + [70, -20], + [90, 0], + [90, 20], + [-70, 20], + [-90, 0], + [-90, -20], + ], + }), + c({ + color: "white", + font: { size: 10 }, + text: "QUALIFIED", + x: -30, + y: 10, + strokeColor: Ye, + strokeThickness: 4, + }), + c( + { color: "white", - font: { size: 10 }, - text: "QUALIFIED", + font: { size: 15 }, x: -30, - y: 10, + y: -8, strokeColor: Ye, - strokeThickness: 4, + strokeThickness: 5.5, + }, + (t) => { + t.text = `${e.reached} / ${e.total}`; + }, + ), + ifConditional( + () => null !== t.timerText, + () => [ + c( + { + color: "white", + font: { size: 15 }, + x: 40, + strokeColor: Ye, + strokeThickness: 5.5, + }, + (e) => { + e.text = t.timerText; + }, + ), + ], + ), + ], + }); + function _E(e) { + return B.formatSeconds(Math.max(0, Math.round(e / 60))); + } + const vE = makeSprite({ + init: ({ props: { delayFrames: e, shouldShow: t } }) => ({ + timer: t ? e : 0, + }), + loop({ state: e, props: { shouldShow: t, delayFrames: a } }) { + t ? (e.timer = a) : e.timer > 0 && e.timer--; + }, + render: ({ props: e, state: t }) => [ + ifConditional(() => t.timer > 0, e.sprites), + ], + }), + TE = makeCustomSprite({ + init: ({ props: { delayFrames: e } }) => ({ timer: e }), + loop: ({ state: e }) => (e.timer > 0 ? { timer: e.timer - 1 } : e), + render: ({ props: e, state: t }) => (t.timer > 0 ? [] : e.sprites), + }), + RE = makeSprite({ + init({ props: e, device: t }) { + var a; + const i = e.rankingsByIndex + .map((t, a) => ({ + name: e.namesByPlayerIndex[a], + rank: t, + playerIndex: a, + })) + .filter(({ rank: e }) => null !== e) + .sort((e, t) => e.rank - t.rank), + n = e.winnerPlayerIndexes.includes(e.playerIndex); + (t.audio(`audio/online/${n ? "win" : "game-over"}.wav`).play(), + t.audio("audio/online/xp.wav").play({ loop: true })); + const s = + (null === (a = e.xp) || void 0 === a ? void 0 : a.prev) || 0; + return { + playerName: e.namesByPlayerIndex[e.playerIndex], + finalPlayerRanks: i.map(({ name: e, rank: t }) => `${t}. ${e}`), + rankIndex: i.findIndex((t) => t.playerIndex === e.playerIndex), + didWin: n, + animateXp: s, + rankInfo: xu(s), + isPlaying: true, + }; + }, + loop({ state: e, props: t, device: a }) { + var i, n, s; + if ( + (null === (i = t.xp) || void 0 === i ? void 0 : i.new) && + e.animateXp < + (null === (n = t.xp) || void 0 === n ? void 0 : n.new) + ) { + const a = + e.animateXp + + ((null === (s = t.xp) || void 0 === s ? void 0 : s.new) + + 30 - + e.animateXp) / + 200; + return ((e.animateXp = a), void (e.rankInfo = xu(a))); + } + e.isPlaying && + (a.audio("audio/online/xp.wav").pause(), (e.isPlaying = false)); + }, + render({ props: e, state: t }) { + const a = [ + [-75, 100], + [75, 100], + [75, -80], + [55, -100], + [-75, -100], + [-75, 100], + [0, 100], + ]; + return [ + p({ width: 600, height: 250, color: ve, y: -25 }), + c({ + font: { size: 40 }, + text: t.didWin ? "YOU WON!" : "GAME OVER", + strokeColor: Ye, + color: ve, + strokeThickness: 12, + y: 95, }), - c( - { - color: "white", - font: { size: 15 }, - x: -30, - y: -8, - strokeColor: Ye, - strokeThickness: 5.5, - }, - (t) => { - t.text = `${e.reached} / ${e.total}`; - }, - ), - ifConditional( - () => null !== t.timerText, - () => [ - c( - { - color: "white", - font: { size: 15 }, - x: 40, - strokeColor: Ye, - strokeThickness: 5.5, - }, - (e) => { - e.text = t.timerText; - }, - ), - ], - ), - ], - }); - function _E(e) { - return B.formatSeconds(Math.max(0, Math.round(e / 60))); - } - const vE = makeSprite({ - init: ({ props: { delayFrames: e, shouldShow: t } }) => ({ - timer: t ? e : 0, - }), - loop({ state: e, props: { shouldShow: t, delayFrames: a } }) { - t ? (e.timer = a) : e.timer > 0 && e.timer--; - }, - render: ({ props: e, state: t }) => [ - ifConditional(() => t.timer > 0, e.sprites), - ], - }), - TE = makeCustomSprite({ - init: ({ props: { delayFrames: e } }) => ({ timer: e }), - loop: ({ state: e }) => (e.timer > 0 ? { timer: e.timer - 1 } : e), - render: ({ props: e, state: t }) => (t.timer > 0 ? [] : e.sprites), - }), - RE = makeSprite({ - init({ props: e, device: t }) { - var a; - const i = e.rankingsByIndex - .map((t, a) => ({ - name: e.namesByPlayerIndex[a], - rank: t, - playerIndex: a, - })) - .filter(({ rank: e }) => null !== e) - .sort((e, t) => e.rank - t.rank), - n = e.winnerPlayerIndexes.includes(e.playerIndex); - (t.audio(`audio/online/${n ? "win" : "game-over"}.wav`).play(), - t.audio("audio/online/xp.wav").play({ loop: true })); - const s = - (null === (a = e.xp) || void 0 === a ? void 0 : a.prev) || 0; - return { - playerName: e.namesByPlayerIndex[e.playerIndex], - finalPlayerRanks: i.map(({ name: e, rank: t }) => `${t}. ${e}`), - rankIndex: i.findIndex((t) => t.playerIndex === e.playerIndex), - didWin: n, - animateXp: s, - rankInfo: xu(s), - isPlaying: true, - }; - }, - loop({ state: e, props: t, device: a }) { - var i, n, s; - if ( - (null === (i = t.xp) || void 0 === i ? void 0 : i.new) && - e.animateXp < - (null === (n = t.xp) || void 0 === n ? void 0 : n.new) - ) { - const a = - e.animateXp + - ((null === (s = t.xp) || void 0 === s ? void 0 : s.new) + - 30 - - e.animateXp) / - 200; - return ((e.animateXp = a), void (e.rankInfo = xu(a))); - } - e.isPlaying && - (a.audio("audio/online/xp.wav").pause(), (e.isPlaying = false)); - }, - render({ props: e, state: t }) { - const a = [ - [-75, 100], - [75, 100], - [75, -80], - [55, -100], - [-75, -100], - [-75, 100], - [0, 100], - ]; - return [ - p({ width: 600, height: 250, color: ve, y: -25 }), - c({ - font: { size: 40 }, - text: t.didWin ? "YOU WON!" : "GAME OVER", - strokeColor: Ye, - color: ve, - strokeThickness: 12, - y: 95, - }), - m({ path: a, fillColor: Le, x: -180, y: -35 }), - Bo.Single({ - containerHeight: 200, - containerWidth: 150, - contentHeight: 25 * (t.finalPlayerRanks.length + 1), - x: -180, - y: 65, - initScrollY: 25 * (t.rankIndex + 1) - 75, - sprites: () => [ - d({ - props: (e, a) => ({ - x: -60, - font: { align: "left", size: 15 }, - text: e, - color: t.rankIndex === a ? Ae : Be, - y: -25 * (a + 1), - }), - array: () => t.finalPlayerRanks, - }), - ], - }), - m({ - path: [ - [75, -80], - [55, -100], - [75, -100], - ], - fillColor: ve, - x: -180, - y: -35, - }), - m({ path: a, color: Ye, thickness: 4, x: -180, y: -35 }), - c({ - font: { size: 20 }, - text: "PLAYERS", - strokeColor: Ye, - color: ve, - strokeThickness: 6, - x: -180, - y: 65, - }), - m({ - path: [ - [-150, 70], - [150, 70], - [150, -30], - [120, -70], - [-150, -70], - [-150, 70], - [0, 70], - ], - color: Ye, - thickness: 4, - x: 80, - y: -25, - }), - c({ - font: { size: 25, align: "right" }, - text: t.playerName, - strokeColor: Ye, - color: ve, - strokeThickness: 8, - x: 80, - y: 45, - }), - ifConditional( - () => void 0 !== e.xp, - () => [ - c({ - font: { size: 25, align: "left" }, - text: `+${e.xp.new - e.xp.prev} XP`, - strokeColor: Ye, - color: Re, - strokeThickness: 8, - x: 100, - y: 45, + m({ path: a, fillColor: Le, x: -180, y: -35 }), + Bo.Single({ + containerHeight: 200, + containerWidth: 150, + contentHeight: 25 * (t.finalPlayerRanks.length + 1), + x: -180, + y: 65, + initScrollY: 25 * (t.rankIndex + 1) - 75, + sprites: () => [ + d({ + props: (e, a) => ({ + x: -60, + font: { align: "left", size: 15 }, + text: e, + color: t.rankIndex === a ? Ae : Be, + y: -25 * (a + 1), }), - ], - ), - _y.Single( - { - width: 200, - rank: t.rankInfo.rank, - rankPercent: t.rankInfo.rankPercent, - x: 60, - y: -50, - }, - (e) => { - ((e.rank = t.rankInfo.rank), - (e.rankPercent = t.rankInfo.rankPercent)); - }, - ), - Yo.Single({ - text: localize("CONTINUE"), - width: 140, - height: 60, - x: 210, - y: -140, - textColor: ve, - textStroke: Ye, - textStrokeThickness: 4, - strokeColor: Ye, - onPress: e.onContinue, - }), - ]; - }, - }), - OE = makeSprite({ - render: ({ props: e }) => [ - d({ - props: (e, t) => ({ - font: { size: 16, align: "left" }, - strokeColor: Ye, - strokeThickness: 4, - y: -20 * t, - }), - update: (e, t, a) => { - ((e.color = t.finished ? Te : ve), - (e.text = `${a + 1}. ${t.name}`)); - }, - array: () => e.orderInfo, + array: () => t.finalPlayerRanks, + }), + ], }), - ], - }), - CE = makeSprite({ - render: ({ props: e }) => [ - Se.Single({ - context: () => e.globalContextVal, - sprites: [ - wE.Single( - { - profile: e.profile, - playerSkin: e.playerSkin, - url: e.url, - passcode: e.passcode, - level: e.level, - animationRenderer: e.animationRenderer, - animationContext: e.animationContext, - isPartyLeader: e.isPartyLeader, - increaseXp: e.increaseXp, - backToMenu: e.backToMenu, - }, - (t) => { - ((t.profile = e.profile), - (t.playerSkin = e.playerSkin), - (t.url = e.url), - (t.passcode = e.passcode), - (t.level = e.level), - (t.animationRenderer = e.animationRenderer), - (t.animationContext = e.animationContext), - (t.isPartyLeader = e.isPartyLeader), - (t.increaseXp = e.increaseXp), - (t.backToMenu = e.backToMenu)); - }, - ), + m({ + path: [ + [75, -80], + [55, -100], + [75, -100], ], + fillColor: ve, + x: -180, + y: -35, }), - ], - }), - wE = makeSprite({ - init({ - props: e, - getState: t, - device: a, - preloadFiles: i, - getContext: n, - }) { - const s = sE({ - url: e.url, - onOpen: (a) => { - ((t().connection = "connected"), - rE( - a, - e.profile.profileId, - e.passcode, - e.profile.playerName, - 9, - "default" !== e.playerSkin.fileName, - )); + m({ path: a, color: Ye, thickness: 4, x: -180, y: -35 }), + c({ + font: { size: 20 }, + text: "PLAYERS", + strokeColor: Ye, + color: ve, + strokeThickness: 6, + x: -180, + y: 65, + }), + m({ + path: [ + [-150, 70], + [150, 70], + [150, -30], + [120, -70], + [-150, -70], + [-150, 70], + [0, 70], + ], + color: Ye, + thickness: 4, + x: 80, + y: -25, + }), + c({ + font: { size: 25, align: "right" }, + text: t.playerName, + strokeColor: Ye, + color: ve, + strokeThickness: 8, + x: 80, + y: 45, + }), + ifConditional( + () => void 0 !== e.xp, + () => [ + c({ + font: { size: 25, align: "left" }, + text: `+${e.xp.new - e.xp.prev} XP`, + strokeColor: Ye, + color: Re, + strokeThickness: 8, + x: 100, + y: 45, + }), + ], + ), + _y.Single( + { + width: 200, + rank: t.rankInfo.rank, + rankPercent: t.rankInfo.rankPercent, + x: 60, + y: -50, }, - onRealtimeMessage: (s, o) => { - var r, l, c, d, u, h, p; - const g = t(), - { settings: m } = n(Se); - switch (o.type) { - case "setup": - (lE(s, e.profile.profileId, e.passcode), - Hf(o.levelFileName) - .then((t) => - Xf( - t, - e.playerSkin, - !o.withCheckpoints, - i, - a.timer.start, - e.animationContext, - { - images: [ - ...Qs.getPlayerImages( - Object.values(Wt.skins), - Object.values(Wt.skins), - ), - ...Qs.onlineImages, - ], - spine: Qs.onlineSpine, - audio: Qs.onlineSfx, + (e) => { + ((e.rank = t.rankInfo.rank), + (e.rankPercent = t.rankInfo.rankPercent)); + }, + ), + Yo.Single({ + text: localize("CONTINUE"), + width: 140, + height: 60, + x: 210, + y: -140, + textColor: ve, + textStroke: Ye, + textStrokeThickness: 4, + strokeColor: Ye, + onPress: e.onContinue, + }), + ]; + }, + }), + OE = makeSprite({ + render: ({ props: e }) => [ + d({ + props: (e, t) => ({ + font: { size: 16, align: "left" }, + strokeColor: Ye, + strokeThickness: 4, + y: -20 * t, + }), + update: (e, t, a) => { + ((e.color = t.finished ? Te : ve), + (e.text = `${a + 1}. ${t.name}`)); + }, + array: () => e.orderInfo, + }), + ], + }), + CE = makeSprite({ + render: ({ props: e }) => [ + Se.Single({ + context: () => e.globalContextVal, + sprites: [ + wE.Single( + { + profile: e.profile, + playerSkin: e.playerSkin, + url: e.url, + passcode: e.passcode, + level: e.level, + animationRenderer: e.animationRenderer, + animationContext: e.animationContext, + isPartyLeader: e.isPartyLeader, + increaseXp: e.increaseXp, + backToMenu: e.backToMenu, + }, + (t) => { + ((t.profile = e.profile), + (t.playerSkin = e.playerSkin), + (t.url = e.url), + (t.passcode = e.passcode), + (t.level = e.level), + (t.animationRenderer = e.animationRenderer), + (t.animationContext = e.animationContext), + (t.isPartyLeader = e.isPartyLeader), + (t.increaseXp = e.increaseXp), + (t.backToMenu = e.backToMenu)); + }, + ), + ], + }), + ], + }), + wE = makeSprite({ + init({ + props: e, + getState: t, + device: a, + preloadFiles: i, + getContext: n, + }) { + const s = sE({ + url: e.url, + onOpen: (a) => { + ((t().connection = "connected"), + rE( + a, + e.profile.profileId, + e.passcode, + e.profile.playerName, + 9, + "default" !== e.playerSkin.fileName, + )); + }, + onRealtimeMessage: (s, o) => { + var r, l, c, d, u, h, p; + const g = t(), + { settings: m } = n(Se); + switch (o.type) { + case "setup": + (lE(s, e.profile.profileId, e.passcode), + Hf(o.levelFileName) + .then((t) => + Xf( + t, + e.playerSkin, + !o.withCheckpoints, + i, + a.timer.start, + e.animationContext, + { + images: [ + ...Qs.getPlayerImages( + Object.values(Wt.skins), + Object.values(Wt.skins), + ), + ...Qs.onlineImages, + ], + spine: Qs.onlineSpine, + audio: Qs.onlineSfx, + }, + ), + ) + .then(([t, a]) => { + const i = e.level || t; + (cE(s, e.profile.profileId, e.passcode), + (g.status = { + type: "waitingToStart", + level: i, + levelSpeeds: _r(i), + realtime: s, + spineContext: { + animationAssets: a, + animationRenderer: e.animationRenderer, }, - ), - ) - .then(([t, a]) => { - const i = e.level || t; - (cE(s, e.profile.profileId, e.passcode), - (g.status = { - type: "waitingToStart", - level: i, - levelSpeeds: _r(i), - realtime: s, - spineContext: { - animationAssets: a, - animationRenderer: e.animationRenderer, - }, - }), - g.mockSocket && (g.mockStates = fE(i))); - }), - (g.playerIndex = o.i), - (g.status = { type: "loadingLevel", realtime: s })); - break; - case "start": - ((g.namesByPlayerIndex = o.namesByIndex), - (g.skinsByPlayerIndex = o.skinsByIndex.map(Wt.getSkin)), - (g.playerSkin = g.skinsByPlayerIndex[g.playerIndex]), - (g.mode = mE(o.mode, "")), - o.chPlayers && - (g.checkpoint = { - resumeTimer: null, - playerReached: false, - reached: 0, - total: o.chPlayers, - timeoutTimer: null, - songPosition: 0, - }), - (g.startingIn = (60 * o.time) / 1000), - (g.countdownDf = 4500 / Math.max(o.time - 200, 200)), - a.timer.start(() => { - if ("error" === g.status.type) return; - if ("waitingToStart" !== g.status.type) - return void (g.status = { - type: "error", - message: - "Sorry, the game started before you finished setting up", - }); - const t = e.level || g.status.level; - g.status = { - type: "started", - level: t, - levelSpeeds: _r(t), - spineContext: g.status.spineContext, - realtime: s, - }; - }, o.time)); - break; - case "resume": { - if (!g.checkpoint || "started" !== g.status.type) return; - a.audio("audio/online/round-finish.wav").play(); - const t = e.level || g.status.level; - if ( - ("royaleCheckpointKnockout" === - (null === (r = g.mode) || void 0 === r - ? void 0 - : r.type) && - a.audio(t.song.fileName).setVolume({ - type: "linear", - fadeTime: 1, - fadeTo: 0, - }), + }), + g.mockSocket && (g.mockStates = fE(i))); + }), + (g.playerIndex = o.i), + (g.status = { type: "loadingLevel", realtime: s })); + break; + case "start": + ((g.namesByPlayerIndex = o.namesByIndex), + (g.skinsByPlayerIndex = o.skinsByIndex.map(Wt.getSkin)), + (g.playerSkin = g.skinsByPlayerIndex[g.playerIndex]), + (g.mode = mE(o.mode, "")), + o.chPlayers && + (g.checkpoint = { + resumeTimer: null, + playerReached: false, + reached: 0, + total: o.chPlayers, + timeoutTimer: null, + songPosition: 0, + }), + (g.startingIn = (60 * o.time) / 1000), + (g.countdownDf = 4500 / Math.max(o.time - 200, 200)), + a.timer.start(() => { + if ("error" === g.status.type) return; + if ("waitingToStart" !== g.status.type) + return void (g.status = { + type: "error", + message: + "Sorry, the game started before you finished setting up", + }); + const t = e.level || g.status.level; + g.status = { + type: "started", + level: t, + levelSpeeds: _r(t), + spineContext: g.status.spineContext, + realtime: s, + }; + }, o.time)); + break; + case "resume": { + if (!g.checkpoint || "started" !== g.status.type) return; + a.audio("audio/online/round-finish.wav").play(); + const t = e.level || g.status.level; + if ( + ("royaleCheckpointKnockout" === + (null === (r = g.mode) || void 0 === r + ? void 0 + : r.type) && + a.audio(t.song.fileName).setVolume({ + type: "linear", + fadeTime: 1, + fadeTo: 0, + }), (g.checkpoint.reached = 0), (g.checkpoint.total = o.chPlayers), g.viewingPlayer) - ) { - o.eliminated.includes(g.viewingPlayer.playerIndex) && - ((g.viewingPlayer.eliminated = true), + ) { + o.eliminated.includes(g.viewingPlayer.playerIndex) && + ((g.viewingPlayer.eliminated = true), a.audio(t.song.fileName).pause()); - break; - } - if (o.eliminated.includes(g.playerIndex)) { - (a.audio(t.song.fileName).pause(), - a.timer.start(() => { - pE(s, e.profile.profileId, e.passcode, null); - }, 3e3), - (g.eliminated = true)); - break; - } - const i = o.fromFrame - g.globalFrame, - n = i * (1000 / 60) - 200; - ((g.checkpoint.resumeTimer = i), - (g.countdownDf = 4500 / Math.max(n, 200))); break; } - case "gameOver": { - const { - winnerIndexes: i, - rankingsByIndex: s, - xpByIndex: r, - } = o; - function l() { - const t = r[g.playerIndex], - o = e.profile.xpPoints, - l = o + t, - { rank: c } = xu(o), - { rank: d } = xu(l), - { online: u, achievementUnlocked: h } = n(Se); - if ("started" === g.status.type) { - const t = e.level || g.status.level; - a.audio(t.song.fileName).setVolume({ - type: "linear", - fadeTime: 1, - fadeTo: 0, - }); - } - (u && - d >= 10 && - Hy({ - type: "cache", - encryptedCache: Jp.getEncryptedStorage(), - storage: a.storage, - }).then((e) => { - c < 10 || + if (o.eliminated.includes(g.playerIndex)) { + (a.audio(t.song.fileName).pause(), + a.timer.start(() => { + pE(s, e.profile.profileId, e.passcode, null); + }, 3e3), + (g.eliminated = true)); + break; + } + const i = o.fromFrame - g.globalFrame, + n = i * (1000 / 60) - 200; + ((g.checkpoint.resumeTimer = i), + (g.countdownDf = 4500 / Math.max(n, 200))); + break; + } + case "gameOver": { + const { + winnerIndexes: i, + rankingsByIndex: s, + xpByIndex: r, + } = o; + function l() { + const t = r[g.playerIndex], + o = e.profile.xpPoints, + l = o + t, + { rank: c } = xu(o), + { rank: d } = xu(l), + { online: u, achievementUnlocked: h } = n(Se); + if ("started" === g.status.type) { + const t = e.level || g.status.level; + a.audio(t.song.fileName).setVolume({ + type: "linear", + fadeTime: 1, + fadeTo: 0, + }); + } + (u && + d >= 10 && + Hy({ + type: "cache", + encryptedCache: Jp.getEncryptedStorage(), + storage: a.storage, + }).then((e) => { + c < 10 || !e.some((e) => "xp_rank10" === e.id && e.unlocked) - ? bp - .reachedRank(u.backend, 10) - .then( - ({ achievements: t, hasPass: i }) => ( - t.forEach((t) => { - if (t.justUnlocked) { - h(t.achievement, i); - const a = e.find( - (e) => e.id === t.achievement.id, - ); - a && (a.unlocked = true); - } - }), - Jp.saveLocalOfflineCache( - a.storage, - a.now, - { achievements: e }, - ) - ), + ? bp + .reachedRank(u.backend, 10) + .then( + ({ achievements: t, hasPass: i }) => ( + t.forEach((t) => { + if (t.justUnlocked) { + h(t.achievement, i); + const a = e.find( + (e) => e.id === t.achievement.id, + ); + a && (a.unlocked = true); + } + }), + Jp.saveLocalOfflineCache( + a.storage, + a.now, + { achievements: e }, ) - .catch((e) => { - (a.alert.ok( - "Failed to save achievement online, try again in the next game", - ), - console.error(e)); - }) - : d >= 100 && - (c < 100 || - !e.some( - (e) => "xp_rank100" === e.id && e.unlocked, - )) && - bp - .reachedRank(u.backend, 100) - .then( - ({ achievements: t, hasPass: i }) => ( - t.forEach((t) => { - if (t.justUnlocked) { - h(t.achievement, i); - const a = e.find( - (e) => e.id === t.achievement.id, - ); - a && (a.unlocked = true); - } - }), - Jp.saveLocalOfflineCache( - a.storage, - a.now, - { achievements: e }, - ) - ), + ), + ) + .catch((e) => { + (a.alert.ok( + "Failed to save achievement online, try again in the next game", + ), + console.error(e)); + }) + : d >= 100 && + (c < 100 || + !e.some( + (e) => "xp_rank100" === e.id && e.unlocked, + )) && + bp + .reachedRank(u.backend, 100) + .then( + ({ achievements: t, hasPass: i }) => ( + t.forEach((t) => { + if (t.justUnlocked) { + h(t.achievement, i); + const a = e.find( + (e) => e.id === t.achievement.id, + ); + a && (a.unlocked = true); + } + }), + Jp.saveLocalOfflineCache( + a.storage, + a.now, + { achievements: e }, ) - .catch((e) => { - (a.alert.ok( - "Failed to save achievement online, try again in the next game", - ), - console.error(e)); - }); - }), - e.increaseXp(t), - (g.rankings = { - winnerPlayerIndexes: i, - rankingsByIndex: s, - xp: { prev: o, new: l }, - }), - (g.checkpoint = - g.checkpoint && - Object.assign(Object.assign({}, g.checkpoint), { - resumeTimer: null, - timeoutTimer: null, - })), - (g.isGameOver = true)); - } - t().viewingPlayer ? a.timer.start(l, 1000) : l(); - break; - } - case "leaderLeft": - t().isGameOver && (oE(s), e.backToMenu()); - break; - case "initInfo": { - const e = { - globalFrame: 0, - info: o.info.map(({ name: e, skin: t }, a) => ({ - username: e, - skin: Wt.getSkin(t), - x: et.initialPosition.x, - y: et.initialPosition.y, - rotation: 0, - scaleX: 1, - scaleY: 1, - playerStack: [], - speed: 0, - rotSpeed: 0, - deathTimer: 0, - playerIndex: a, - resetTimer: null, - frame: 0, - checkpoint: null, + ), + ) + .catch((e) => { + (a.alert.ok( + "Failed to save achievement online, try again in the next game", + ), + console.error(e)); + }); + }), + e.increaseXp(t), + (g.rankings = { + winnerPlayerIndexes: i, + rankingsByIndex: s, + xp: { prev: o, new: l }, + }), + (g.checkpoint = + g.checkpoint && + Object.assign(Object.assign({}, g.checkpoint), { + resumeTimer: null, + timeoutTimer: null, })), - }, - t = o.info[g.playerIndex]; - if (!t) - return void (g.status = { - type: "error", - message: "Failed to receive player data from server", - }); - ((g.futureInfo = [ - Object.assign(Object.assign({}, e), { globalFrame: 1 }), - ]), - (g.latestInfo = e), - (g.otherPlayersY = Array.from({ - length: o.info.length, - }).fill(et.initialPosition.y)), - (g.playerSkin = Wt.getSkin(t.skin))); - break; + (g.isGameOver = true)); } - case "info": { - if ( - "waitForServer" === g.status.type || - "error" === g.status.type || - g.viewingPlayer - ) - return; - const { - lastInfo: e, - checkpoint: t, - otherPlayersY: a, + t().viewingPlayer ? a.timer.start(l, 1000) : l(); + break; + } + case "leaderLeft": + t().isGameOver && (oE(s), e.backToMenu()); + break; + case "initInfo": { + const e = { + globalFrame: 0, + info: o.info.map(({ name: e, skin: t }, a) => ({ + username: e, + skin: Wt.getSkin(t), + x: et.initialPosition.x, + y: et.initialPosition.y, + rotation: 0, + scaleX: 1, + scaleY: 1, + playerStack: [], + speed: 0, + rotSpeed: 0, + deathTimer: 0, + playerIndex: a, + resetTimer: null, + frame: 0, + checkpoint: null, + })), + }, + t = o.info[g.playerIndex]; + if (!t) + return void (g.status = { + type: "error", + message: "Failed to receive player data from server", + }); + ((g.futureInfo = [ + Object.assign(Object.assign({}, e), { globalFrame: 1 }), + ]), + (g.latestInfo = e), + (g.otherPlayersY = Array.from({ + length: o.info.length, + }).fill(et.initialPosition.y)), + (g.playerSkin = Wt.getSkin(t.skin))); + break; + } + case "info": { + if ( + "waitForServer" === g.status.type || + "error" === g.status.type || + g.viewingPlayer + ) + return; + const { + lastInfo: e, + checkpoint: t, + otherPlayersY: a, + } = AE( + o.info, + g.latestInfo.info, + g.otherPlayersY, + o.atCh, + o.t, + g.checkpoint, + g.namesByPlayerIndex, + g.skinsByPlayerIndex, + "loadingLevel" === g.status.type + ? { + jumpFrames: 0, + speed: 0, + coefficients: { a: 0, b: 0 }, + } + : g.status.levelSpeeds, + ); + ((g.eliminated = + ("royaleLastBlockStanding" === + (null === (l = g.mode) || void 0 === l + ? void 0 + : l.type) && + null === o.info[g.playerIndex]) || + g.eliminated), + (g.futureInfo = [ + ...g.futureInfo, + { globalFrame: o.f, info: e }, + ]), + (g.checkpoint = t), + (g.lastInfoFrame = g.globalFrame), + (g.otherPlayersY = a), + (g.orderInfo = + null === (c = o.o) || void 0 === c + ? void 0 + : c.map(([e, t]) => ({ + name: g.namesByPlayerIndex[e] || "", + finished: Boolean(t), + })))); + break; + } + case "resync": { + if ("started" !== g.status.type) return; + const e = g.status.level; + (o.info.mutValues.levelState.crashed + ? a.audio(e.song.fileName).pause() + : a.audio(e.song.fileName).play({ + fromPosition: + (1 / 60) * o.info.mutValues.levelState.frame + + m.headphonesDelay, + overwrite: true, + }), + (g.serverPlayerPos = o.info), + (g.globalFrame = o.f - 1), + (null === (d = g.checkpoint) || void 0 === d + ? void 0 + : d.playerReached) && + (g.checkpoint.playerReached = false)); + break; + } + case "watchPlayerState": { + if ("started" !== g.status.type) return; + const e = g.status.level; + o.info.mutValues.levelState.crashed || + a.audio(e.song.fileName).play({ + fromPosition: + (1 / 60) * o.info.mutValues.levelState.frame + + m.headphonesDelay, + overwrite: true, + }); + const t = Ca.getEmptyLayout(e.layout.properties), + i = xa.getInitState(t), + s = xa.getEmptyStateIndexes(); + ((g.viewingPlayer = { + eliminated: false, + playerIndex: o.index, + futureInputs: [], + sfx: Rf(a, n(Se).settings, e, () => ({ + df: 1, + mutValues: g.viewingPlayer.state.mutValues, + })), + state: Object.assign(Object.assign({}, o.info), { + bigMutValues: { + inViewLayout: t, + inViewLayoutState: i, + fullLayoutStateIndexes: s, + }, + }), + loadingNewPlayer: false, + }), + Ca.setInViewLayoutAndState( + e.layout, + o.info.mutValues.levelState.frame, + g.status.levelSpeeds.jumpFrames, + o.info.mutValues.levelState.playerX, + o.info.mutValues.levelState.playerY, + o.info.mutValues.levelState.layoutState, + o.info.mutValues.levelState.switchButtons.rot, + o.info.mutValues.levelState.jumpSwitch.ratio, + o.info.mutValues.levelState.switchBlockSpikes, + g.viewingPlayer.state.mutValues.layoutFirstIndexes, + g.viewingPlayer.state.bigMutValues.inViewLayout, + g.viewingPlayer.state.bigMutValues.inViewLayoutState, + g.viewingPlayer.state.bigMutValues + .fullLayoutStateIndexes, + o.info.mutValues.levelState.fallTypes, + ), + (g.globalFrame = o.f), + (g.lastInfoFrame = g.globalFrame), + (g.viewCount = o.viewCount)); + break; + } + case "watch": { + if (!g.viewingPlayer || "started" !== g.status.type) + return; + const [e, t] = o.watching, + { + lastInfo: a, + checkpoint: i, + otherPlayersY: n, } = AE( o.info, g.latestInfo.info, @@ -76010,627 +76130,507 @@ var version = "v1.17.2"; g.checkpoint, g.namesByPlayerIndex, g.skinsByPlayerIndex, - "loadingLevel" === g.status.type - ? { - jumpFrames: 0, - speed: 0, - coefficients: { a: 0, b: 0 }, - } - : g.status.levelSpeeds, - ); - ((g.eliminated = - ("royaleLastBlockStanding" === - (null === (l = g.mode) || void 0 === l - ? void 0 - : l.type) && - null === o.info[g.playerIndex]) || - g.eliminated), - (g.futureInfo = [ - ...g.futureInfo, - { globalFrame: o.f, info: e }, - ]), - (g.checkpoint = t), - (g.lastInfoFrame = g.globalFrame), - (g.otherPlayersY = a), - (g.orderInfo = - null === (c = o.o) || void 0 === c - ? void 0 - : c.map(([e, t]) => ({ - name: g.namesByPlayerIndex[e] || "", - finished: Boolean(t), - })))); - break; - } - case "resync": { - if ("started" !== g.status.type) return; - const e = g.status.level; - (o.info.mutValues.levelState.crashed - ? a.audio(e.song.fileName).pause() - : a.audio(e.song.fileName).play({ - fromPosition: - (1 / 60) * o.info.mutValues.levelState.frame + - m.headphonesDelay, - overwrite: true, - }), - (g.serverPlayerPos = o.info), - (g.globalFrame = o.f - 1), - (null === (d = g.checkpoint) || void 0 === d + g.status.levelSpeeds, + ); + ((g.viewingPlayer.futureInputs = [ + ...g.viewingPlayer.futureInputs, + ...Object.entries(t).map(([t, a]) => ({ + globalFrame: Number(t), + input: a, + playerX: Number(t) === o.f ? e : void 0, + })), + ].sort( + (e, t) => + e.globalFrame - t.globalFrame || + (e.playerX ? (t.playerX ? 0 : -1) : 1), + )), + (g.futureInfo = [ + ...g.futureInfo, + { globalFrame: o.f, info: a }, + ]), + (g.checkpoint = i), + (g.lastInfoFrame = g.globalFrame), + (g.otherPlayersY = n), + (g.orderInfo = + null === (u = o.o) || void 0 === u ? void 0 - : d.playerReached) && - (g.checkpoint.playerReached = false)); - break; - } - case "watchPlayerState": { - if ("started" !== g.status.type) return; - const e = g.status.level; - o.info.mutValues.levelState.crashed || - a.audio(e.song.fileName).play({ - fromPosition: - (1 / 60) * o.info.mutValues.levelState.frame + - m.headphonesDelay, - overwrite: true, - }); - const t = Ca.getEmptyLayout(e.layout.properties), - i = xa.getInitState(t), - s = xa.getEmptyStateIndexes(); - ((g.viewingPlayer = { - eliminated: false, - playerIndex: o.index, - futureInputs: [], - sfx: Rf(a, n(Se).settings, e, () => ({ - df: 1, - mutValues: g.viewingPlayer.state.mutValues, - })), - state: Object.assign(Object.assign({}, o.info), { - bigMutValues: { - inViewLayout: t, - inViewLayoutState: i, - fullLayoutStateIndexes: s, - }, - }), - loadingNewPlayer: false, - }), - Ca.setInViewLayoutAndState( - e.layout, - o.info.mutValues.levelState.frame, - g.status.levelSpeeds.jumpFrames, - o.info.mutValues.levelState.playerX, - o.info.mutValues.levelState.playerY, - o.info.mutValues.levelState.layoutState, - o.info.mutValues.levelState.switchButtons.rot, - o.info.mutValues.levelState.jumpSwitch.ratio, - o.info.mutValues.levelState.switchBlockSpikes, - g.viewingPlayer.state.mutValues.layoutFirstIndexes, - g.viewingPlayer.state.bigMutValues.inViewLayout, - g.viewingPlayer.state.bigMutValues.inViewLayoutState, - g.viewingPlayer.state.bigMutValues - .fullLayoutStateIndexes, - o.info.mutValues.levelState.fallTypes, - ), - (g.globalFrame = o.f), - (g.lastInfoFrame = g.globalFrame), - (g.viewCount = o.viewCount)); - break; - } - case "watch": { - if (!g.viewingPlayer || "started" !== g.status.type) - return; - const [e, t] = o.watching, - { - lastInfo: a, - checkpoint: i, - otherPlayersY: n, - } = AE( - o.info, - g.latestInfo.info, - g.otherPlayersY, - o.atCh, - o.t, - g.checkpoint, - g.namesByPlayerIndex, - g.skinsByPlayerIndex, - g.status.levelSpeeds, - ); - ((g.viewingPlayer.futureInputs = [ - ...g.viewingPlayer.futureInputs, - ...Object.entries(t).map(([t, a]) => ({ - globalFrame: Number(t), - input: a, - playerX: Number(t) === o.f ? e : void 0, - })), - ].sort( - (e, t) => - e.globalFrame - t.globalFrame || - (e.playerX ? (t.playerX ? 0 : -1) : 1), - )), - (g.futureInfo = [ - ...g.futureInfo, - { globalFrame: o.f, info: a }, - ]), - (g.checkpoint = i), - (g.lastInfoFrame = g.globalFrame), - (g.otherPlayersY = n), - (g.orderInfo = - null === (u = o.o) || void 0 === u + : u.map(([e, t]) => ({ + name: g.namesByPlayerIndex[e] || "", + finished: Boolean(t), + })))); + break; + } + case "watchingCount": { + const e = + null !== + (p = + null === (h = g.viewingPlayer) || void 0 === h ? void 0 - : u.map(([e, t]) => ({ - name: g.namesByPlayerIndex[e] || "", - finished: Boolean(t), - })))); - break; - } - case "watchingCount": { - const e = - null !== - (p = - null === (h = g.viewingPlayer) || void 0 === h - ? void 0 - : h.playerIndex) && void 0 !== p - ? p - : g.playerIndex; - g.viewCount = o.viewCountByIndex[e] || 0; - break; - } - case "error": { - const t = o.error, - i = (() => { - switch (t.type) { - case "versions": - return `Please download the latest update to play. Yours: v${t.client}, min: v${t.server}`; - case "gameAlreadyStarted": - return "Sorry, the game has already started."; - case "gameTimeout": - return "overtime" === t.reason - ? "Exceeded maximum game time." - : "Sorry, not enough players joined to start the game."; - } - })(); - ((g.status = { type: "error", message: i || "Error" }), - a.timer.start(() => { - (oE(s), e.backToMenu()); - }, 3e3)); - break; - } + : h.playerIndex) && void 0 !== p + ? p + : g.playerIndex; + g.viewCount = o.viewCountByIndex[e] || 0; + break; + } + case "error": { + const t = o.error, + i = (() => { + switch (t.type) { + case "versions": + return `Please download the latest update to play. Yours: v${t.client}, min: v${t.server}`; + case "gameAlreadyStarted": + return "Sorry, the game has already started."; + case "gameTimeout": + return "overtime" === t.reason + ? "Exceeded maximum game time." + : "Sorry, not enough players joined to start the game."; + } + })(); + ((g.status = { type: "error", message: i || "Error" }), + a.timer.start(() => { + (oE(s), e.backToMenu()); + }, 3e3)); + break; } - }, - onDisconnect: (i, n) => { - const s = t(); - s.isGameOver - ? oE(i) - : ((s.connection = n ? "reconnecting" : "disconnected"), - (s.status = - "started" === s.status.type || "error" === s.status.type - ? s.status - : { - type: "error", - message: "Failed to connect to game.", - }), - n || a.timer.start(e.backToMenu, 3e3)); - }, - onReconnect: (e) => { - const a = t(); - ((a.connection = "connected"), - (a.status = - "error" === a.status.type - ? a.status - : Object.assign(Object.assign({}, a.status), { - realtime: e, - }))); - }, - timer: a.timer, - }); - return ( - s instanceof Error && a.timer.start(e.backToMenu, 3e3), - { - futureInfo: [], - latestInfo: { globalFrame: 0, info: [] }, - otherPlayersY: [], - playerMovementHistory: [], - otherPlayers: [], - checkForResyncTimer: 30, - resyncTimerDebounce: 0, - aheadOfServerFrames: { avg: 0, n: 0 }, - status: - s instanceof Error - ? { type: "error", message: s.message } - : { type: "waitForServer", realtime: s }, - playerIndex: 0, - playerSkin: Wt.default, - namesByPlayerIndex: [], - skinsByPlayerIndex: [], - startingIn: null, - countdownDf: 1, - eliminated: false, - finished: false, - globalFrame: 0, - rankings: null, - connection: "connecting", - mode: null, - lastInfoFrame: 0, - viewingPlayer: null, - viewCount: 0, - isGameOver: false, - mockSocket: void 0, - levelMenuOpen: false, } - ); - }, - cleanup({ state: e }) { - var t; - null === (t = e.mockSocket) || void 0 === t || t.stopServer(); - }, - loop({ state: e, props: t, device: a, getContext: i }) { - var n, s, o; - if ("started" !== e.status.type) - return void (e.startingIn && e.startingIn--); - (e.mockStates && - (e.mockStates = yE( - e.mockStates, - e.status.level, - e.status.levelSpeeds, - void 0 !== e.checkpoint && null !== e.checkpoint.resumeTimer, - )), - e.checkForResyncTimer > 0 && e.checkForResyncTimer--, - e.resyncTimerDebounce > 0 && e.resyncTimerDebounce--); - const r = e.playerMovementHistory.findIndex( - (t) => t.frame === e.latestInfo.globalFrame, - ); - if (-1 !== r && !e.viewingPlayer) { - const i = e.playerMovementHistory[r], - s = e.latestInfo.info[e.playerIndex]; - e.playerMovementHistory = e.playerMovementHistory.slice(r + 1); - const o = - e.futureInfo.length > 0 - ? e.futureInfo[e.futureInfo.length - 1] - : e.latestInfo, - l = e.globalFrame - o.globalFrame, - { avg: c, n: d } = e.aheadOfServerFrames; - if ( - ((e.aheadOfServerFrames.avg = (c * d + l) / (d + 1)), - e.aheadOfServerFrames.n++, - null !== s && - !(null === (n = e.checkpoint) || void 0 === n - ? void 0 - : n.reached) && - (Math.abs(i.x - s.x) > 1 || - o.globalFrame - e.globalFrame > 18 || - (e.aheadOfServerFrames.avg > 10 && - e.aheadOfServerFrames.n > 2))) - ) - return ( - a.log( - `Resyncing with server. Lag: ${ - o.globalFrame - e.globalFrame - }, x diff: ${i.x - s.x}`, - ), - dE(e.status.realtime, t.profile.profileId, t.passcode), - (e.futureInfo = []), - (e.globalFrame = o.globalFrame), - (e.playerMovementHistory = []), - (e.checkForResyncTimer = 30), - (e.resyncTimerDebounce = 120), - void (e.aheadOfServerFrames = { avg: 0, n: 0 }) - ); + }, + onDisconnect: (i, n) => { + const s = t(); + s.isGameOver + ? oE(i) + : ((s.connection = n ? "reconnecting" : "disconnected"), + (s.status = + "started" === s.status.type || "error" === s.status.type + ? s.status + : { + type: "error", + message: "Failed to connect to game.", + }), + n || a.timer.start(e.backToMenu, 3e3)); + }, + onReconnect: (e) => { + const a = t(); + ((a.connection = "connected"), + (a.status = + "error" === a.status.type + ? a.status + : Object.assign(Object.assign({}, a.status), { + realtime: e, + }))); + }, + timer: a.timer, + }); + return ( + s instanceof Error && a.timer.start(e.backToMenu, 3e3), + { + futureInfo: [], + latestInfo: { globalFrame: 0, info: [] }, + otherPlayersY: [], + playerMovementHistory: [], + otherPlayers: [], + checkForResyncTimer: 30, + resyncTimerDebounce: 0, + aheadOfServerFrames: { avg: 0, n: 0 }, + status: + s instanceof Error + ? { type: "error", message: s.message } + : { type: "waitForServer", realtime: s }, + playerIndex: 0, + playerSkin: Wt.default, + namesByPlayerIndex: [], + skinsByPlayerIndex: [], + startingIn: null, + countdownDf: 1, + eliminated: false, + finished: false, + globalFrame: 0, + rankings: null, + connection: "connecting", + mode: null, + lastInfoFrame: 0, + viewingPlayer: null, + viewCount: 0, + isGameOver: false, + mockSocket: void 0, + levelMenuOpen: false, } + ); + }, + cleanup({ state: e }) { + var t; + null === (t = e.mockSocket) || void 0 === t || t.stopServer(); + }, + loop({ state: e, props: t, device: a, getContext: i }) { + var n, s, o; + if ("started" !== e.status.type) + return void (e.startingIn && e.startingIn--); + (e.mockStates && + (e.mockStates = yE( + e.mockStates, + e.status.level, + e.status.levelSpeeds, + void 0 !== e.checkpoint && null !== e.checkpoint.resumeTimer, + )), + e.checkForResyncTimer > 0 && e.checkForResyncTimer--, + e.resyncTimerDebounce > 0 && e.resyncTimerDebounce--); + const r = e.playerMovementHistory.findIndex( + (t) => t.frame === e.latestInfo.globalFrame, + ); + if (-1 !== r && !e.viewingPlayer) { + const i = e.playerMovementHistory[r], + s = e.latestInfo.info[e.playerIndex]; + e.playerMovementHistory = e.playerMovementHistory.slice(r + 1); + const o = + e.futureInfo.length > 0 + ? e.futureInfo[e.futureInfo.length - 1] + : e.latestInfo, + l = e.globalFrame - o.globalFrame, + { avg: c, n: d } = e.aheadOfServerFrames; if ( - (e.globalFrame++, - true === - (null === (s = e.viewingPlayer) || void 0 === s + ((e.aheadOfServerFrames.avg = (c * d + l) / (d + 1)), + e.aheadOfServerFrames.n++, + null !== s && + !(null === (n = e.checkpoint) || void 0 === n ? void 0 - : s.loadingNewPlayer) || e.isGameOver) - ); - else { - if ( - "no-messages" === e.connection && - !t.disableDisconnects && - e.lastInfoFrame + 1200 < e.globalFrame - ) - return ( - a.timer.start(() => { - ("started" === e.status.type && oE(e.status.realtime), - t.backToMenu()); - }, 3e3), - void (e.connection = "disconnected") - ); - if ( - "connected" === e.connection && - !t.disableDisconnects && - ((!e.viewingPlayer && - e.lastInfoFrame + 120 < e.globalFrame) || - e.lastInfoFrame + 360 < e.globalFrame) - ) - return void (e.connection = "no-messages"); - if ( - "no-messages" === e.connection && - e.lastInfoFrame + 120 > e.globalFrame - ) - return void (e.connection = "connected"); - } - const l = - e.futureInfo.filter((t) => t.globalFrame <= e.globalFrame) - .length - 1; + : n.reached) && + (Math.abs(i.x - s.x) > 1 || + o.globalFrame - e.globalFrame > 18 || + (e.aheadOfServerFrames.avg > 10 && + e.aheadOfServerFrames.n > 2))) + ) + return ( + a.log( + `Resyncing with server. Lag: ${o.globalFrame - e.globalFrame + }, x diff: ${i.x - s.x}`, + ), + dE(e.status.realtime, t.profile.profileId, t.passcode), + (e.futureInfo = []), + (e.globalFrame = o.globalFrame), + (e.playerMovementHistory = []), + (e.checkForResyncTimer = 30), + (e.resyncTimerDebounce = 120), + void (e.aheadOfServerFrames = { avg: 0, n: 0 }) + ); + } + if ( + (e.globalFrame++, + true === + (null === (s = e.viewingPlayer) || void 0 === s + ? void 0 + : s.loadingNewPlayer) || e.isGameOver) + ); + else { + if ( + "no-messages" === e.connection && + !t.disableDisconnects && + e.lastInfoFrame + 1200 < e.globalFrame + ) + return ( + a.timer.start(() => { + ("started" === e.status.type && oE(e.status.realtime), + t.backToMenu()); + }, 3e3), + void (e.connection = "disconnected") + ); + if ( + "connected" === e.connection && + !t.disableDisconnects && + ((!e.viewingPlayer && + e.lastInfoFrame + 120 < e.globalFrame) || + e.lastInfoFrame + 360 < e.globalFrame) + ) + return void (e.connection = "no-messages"); if ( - (-1 !== l && - ((e.latestInfo = e.futureInfo[l]), + "no-messages" === e.connection && + e.lastInfoFrame + 120 > e.globalFrame + ) + return void (e.connection = "connected"); + } + const l = + e.futureInfo.filter((t) => t.globalFrame <= e.globalFrame) + .length - 1; + if ( + (-1 !== l && + ((e.latestInfo = e.futureInfo[l]), (e.futureInfo = e.futureInfo.slice(l + 1))), (e.otherPlayersY = e.otherPlayersY.map((t, a) => { const i = e.latestInfo.info[a]; return i ? t + (i.y - t) / 4 : t; })), e.viewingPlayer) - ) { - const { futureInputs: n, sfx: s } = e.viewingPlayer; - if (n.length > 3) { - const r = n.findIndex((t) => t.globalFrame >= e.globalFrame); - if (-1 !== r) { - const { playerX: l, input: c } = n[r], - d = n.slice(r + 1), - { level: u, levelSpeeds: h } = e.status; - dl({ - mutValues: e.viewingPlayer.state.mutValues, - bigMutValues: e.viewingPlayer.state.bigMutValues, - booster: null, - playerInput: c, - levelSpeeds: h, - df: 1, - level: u, - waitAtCheckpoint: false, - shouldResetOnCrash: - "royaleLastBlockStanding" !== - (null === (o = e.mode) || void 0 === o + ) { + const { futureInputs: n, sfx: s } = e.viewingPlayer; + if (n.length > 3) { + const r = n.findIndex((t) => t.globalFrame >= e.globalFrame); + if (-1 !== r) { + const { playerX: l, input: c } = n[r], + d = n.slice(r + 1), + { level: u, levelSpeeds: h } = e.status; + dl({ + mutValues: e.viewingPlayer.state.mutValues, + bigMutValues: e.viewingPlayer.state.bigMutValues, + booster: null, + playerInput: c, + levelSpeeds: h, + df: 1, + level: u, + waitAtCheckpoint: false, + shouldResetOnCrash: + "royaleLastBlockStanding" !== + (null === (o = e.mode) || void 0 === o + ? void 0 + : o.type), + onCrash: () => { + a.audio(u.song.fileName).pause(); + }, + onReachedCheckpoint: () => { + var t; + "royaleCheckpointKnockout" === + (null === (t = e.mode) || void 0 === t ? void 0 - : o.type), - onCrash: () => { - a.audio(u.song.fileName).pause(); - }, - onReachedCheckpoint: () => { - var t; - "royaleCheckpointKnockout" === - (null === (t = e.mode) || void 0 === t - ? void 0 - : t.type) && - a.audio(u.song.fileName).setVolume({ - type: "linear", - fadeTime: 1, - fadeTo: 0, - }); - }, - onReset: (e) => { - const { settings: t } = i(Se); - a.audio(u.song.fileName).play({ - fromPosition: (1 / 60) * e + t.headphonesDelay, - overwrite: true, + : t.type) && + a.audio(u.song.fileName).setVolume({ + type: "linear", + fadeTime: 1, + fadeTo: 0, }); - }, - bottomLineTheme: u.layout.properties.theme.objects.bottom, - sfx: s, - }); - const p = - e.viewingPlayer.state.mutValues.levelState.playerX; - return ( - e.resyncTimerDebounce <= 0 && - !e.viewingPlayer.loadingNewPlayer && - void 0 !== l && - Math.abs(l - p) > 1 && - (a.log( - "Viewing player out of sync with server. x diff: " + - (l - p), - ), - pE( - e.status.realtime, - t.profile.profileId, - t.passcode, - 0, - ), - (e.resyncTimerDebounce = 120), - (e.viewingPlayer.loadingNewPlayer = true)), - void (e.viewingPlayer.futureInputs = d) - ); - } + }, + onReset: (e) => { + const { settings: t } = i(Se); + a.audio(u.song.fileName).play({ + fromPosition: (1 / 60) * e + t.headphonesDelay, + overwrite: true, + }); + }, + bottomLineTheme: u.layout.properties.theme.objects.bottom, + sfx: s, + }); + const p = + e.viewingPlayer.state.mutValues.levelState.playerX; + return ( + e.resyncTimerDebounce <= 0 && + !e.viewingPlayer.loadingNewPlayer && + void 0 !== l && + Math.abs(l - p) > 1 && + (a.log( + "Viewing player out of sync with server. x diff: " + + (l - p), + ), + pE( + e.status.realtime, + t.profile.profileId, + t.passcode, + 0, + ), + (e.resyncTimerDebounce = 120), + (e.viewingPlayer.loadingNewPlayer = true)), + void (e.viewingPlayer.futureInputs = d) + ); } - e.globalFrame--; - } else if ( - e.checkpoint && - null !== e.checkpoint.resumeTimer && - (e.checkpoint.resumeTimer--, e.checkpoint.resumeTimer <= 0) - ) { - const { settings: t } = i(Se); - (a.audio(e.status.level.song.fileName).play({ - overwrite: true, - fromPosition: e.checkpoint.songPosition + t.headphonesDelay, - }), - (e.checkpoint.resumeTimer = null), - (e.checkpoint.playerReached = false)); } - }, - render: ({ props: e, state: t, device: a }) => [ - conditional( - () => "error" === t.status.type, - () => [ - Yo.Single({ - text: localize("BACK"), - width: 80, - height: 40, - onPress: e.backToMenu, - y: -60, - }), - c({ text: t.status.message, color: Ve }), - ], - () => [ - conditional( - () => - "waitForServer" === t.status.type || - "loadingLevel" === t.status.type, - () => [ - Yo.Single({ - text: localize("BACK"), - width: 80, - height: 40, - onPress: e.backToMenu, - y: -60, - }), - c({ color: ve, font: { size: 15 } }, (e) => { - e.text = - "connecting" === t.connection - ? "CONNECTING TO GAME..." - : `${localize("LOADING")}...`; - }), - ], - () => { - const i = () => { - const { realtime: a } = t.status; - (uE(a, e.profile.profileId, e.passcode), - oE(a), - e.backToMenu()); - }, - n = () => { - var e; - const a = - t.isGameOver && - "royaleLastBlockStanding" === - (null === (e = t.mode) || void 0 === e - ? void 0 - : e.type) && - !(t.finished || t.eliminated); - return Boolean(t.isGameOver && !a && t.rankings); - }; - return [ - Ws.Single({ - context: () => t.status.spineContext, - sprites: [ - conditional( - () => null !== t.viewingPlayer, - () => [ - onChange( - () => t.viewingPlayer.playerIndex, - () => { - var e; - const i = t.viewingPlayer.playerIndex, - n = t.namesByPlayerIndex[i] || ""; - return [ - bE.Single( - { - level: t.status.level, - levelSpeeds: t.status.levelSpeeds, - viewingPlayer: { - state: t.viewingPlayer.state, - skin: - t.skinsByPlayerIndex[i] || - Wt.default, - username: n, - }, - otherPlayersInfo: om( - t.latestInfo.info, - t.otherPlayersY, - false, - 0, - t.viewingPlayer.state.mutValues - .levelState.playerX, - t.viewingPlayer.state.mutValues - .levelState.playerY, - a.size.fullWidth, - a.size.fullHeight, - t.viewingPlayer.playerIndex, - "friendsRaceToFinish" === - (null === (e = t.mode) || - void 0 === e - ? void 0 - : e.type), - ), - loop: - t.mockStates && - t.mockSocket && - t.checkpoint && - (() => { - const e = EE( - i, - t.checkpoint.playerReached, - t.mockStates, - t.globalFrame, - t.checkpoint.total, - t.mockSocket.serverMessage.ref, - null !== - t.checkpoint.resumeTimer, - ); - e && (t.mockStates = e); - }), - }, - (e) => { - var i; - e.viewingPlayer.state = - t.viewingPlayer.state; - const n = - t.globalFrame - - t.latestInfo.globalFrame, - s = n > 0 && !t.isGameOver; - e.otherPlayersInfo = om( - t.latestInfo.info, - t.otherPlayersY, - s, - n, - t.viewingPlayer.state.mutValues - .levelState.playerX, - t.viewingPlayer.state.mutValues - .levelState.playerY, - a.size.fullWidth, - a.size.fullHeight, - t.viewingPlayer.playerIndex, - "friendsRaceToFinish" === - (null === (i = t.mode) || - void 0 === i - ? void 0 - : i.type), - ); - }, - ), - ]; - }, - ), - ], - () => { - var s; - return [ - vf.Single( - { - backToMenu: i, - level: t.status.level, - paused: n(), - playerSkin: t.playerSkin, - online: { - onInputChange: (a) => { - (gE( - t.status.realtime, - e.profile.profileId, - e.passcode, - a, - t.globalFrame, - ), - (t.checkForResyncTimer = 30)); + e.globalFrame--; + } else if ( + e.checkpoint && + null !== e.checkpoint.resumeTimer && + (e.checkpoint.resumeTimer--, e.checkpoint.resumeTimer <= 0) + ) { + const { settings: t } = i(Se); + (a.audio(e.status.level.song.fileName).play({ + overwrite: true, + fromPosition: e.checkpoint.songPosition + t.headphonesDelay, + }), + (e.checkpoint.resumeTimer = null), + (e.checkpoint.playerReached = false)); + } + }, + render: ({ props: e, state: t, device: a }) => [ + conditional( + () => "error" === t.status.type, + () => [ + Yo.Single({ + text: localize("BACK"), + width: 80, + height: 40, + onPress: e.backToMenu, + y: -60, + }), + c({ text: t.status.message, color: Ve }), + ], + () => [ + conditional( + () => + "waitForServer" === t.status.type || + "loadingLevel" === t.status.type, + () => [ + Yo.Single({ + text: localize("BACK"), + width: 80, + height: 40, + onPress: e.backToMenu, + y: -60, + }), + c({ color: ve, font: { size: 15 } }, (e) => { + e.text = + "connecting" === t.connection + ? "CONNECTING TO GAME..." + : `${localize("LOADING")}...`; + }), + ], + () => { + const i = () => { + const { realtime: a } = t.status; + (uE(a, e.profile.profileId, e.passcode), + oE(a), + e.backToMenu()); + }, + n = () => { + var e; + const a = + t.isGameOver && + "royaleLastBlockStanding" === + (null === (e = t.mode) || void 0 === e + ? void 0 + : e.type) && + !(t.finished || t.eliminated); + return Boolean(t.isGameOver && !a && t.rankings); + }; + return [ + Ws.Single({ + context: () => t.status.spineContext, + sprites: [ + conditional( + () => null !== t.viewingPlayer, + () => [ + onChange( + () => t.viewingPlayer.playerIndex, + () => { + var e; + const i = t.viewingPlayer.playerIndex, + n = t.namesByPlayerIndex[i] || ""; + return [ + bE.Single( + { + level: t.status.level, + levelSpeeds: t.status.levelSpeeds, + viewingPlayer: { + state: t.viewingPlayer.state, + skin: + t.skinsByPlayerIndex[i] || + Wt.default, + username: n, }, - getOtherPlayersInfo: () => - om( - [], - t.otherPlayersY, - false, - 0, - 0, - 0, - a.size.fullWidth, - a.size.fullHeight, - t.playerIndex, - false, - ), - eliminated: t.eliminated, - start: "started" === t.status.type, - mode: t.mode, - checkpointPlayerReached: - null === (s = t.checkpoint) || + otherPlayersInfo: om( + t.latestInfo.info, + t.otherPlayersY, + false, + 0, + t.viewingPlayer.state.mutValues + .levelState.playerX, + t.viewingPlayer.state.mutValues + .levelState.playerY, + a.size.fullWidth, + a.size.fullHeight, + t.viewingPlayer.playerIndex, + "friendsRaceToFinish" === + (null === (e = t.mode) || + void 0 === e + ? void 0 + : e.type), + ), + loop: + t.mockStates && + t.mockSocket && + t.checkpoint && + (() => { + const e = EE( + i, + t.checkpoint.playerReached, + t.mockStates, + t.globalFrame, + t.checkpoint.total, + t.mockSocket.serverMessage.ref, + null !== + t.checkpoint.resumeTimer, + ); + e && (t.mockStates = e); + }), + }, + (e) => { + var i; + e.viewingPlayer.state = + t.viewingPlayer.state; + const n = + t.globalFrame - + t.latestInfo.globalFrame, + s = n > 0 && !t.isGameOver; + e.otherPlayersInfo = om( + t.latestInfo.info, + t.otherPlayersY, + s, + n, + t.viewingPlayer.state.mutValues + .levelState.playerX, + t.viewingPlayer.state.mutValues + .levelState.playerY, + a.size.fullWidth, + a.size.fullHeight, + t.viewingPlayer.playerIndex, + "friendsRaceToFinish" === + (null === (i = t.mode) || + void 0 === i + ? void 0 + : i.type), + ); + }, + ), + ]; + }, + ), + ], + () => { + var s; + return [ + vf.Single( + { + backToMenu: i, + level: t.status.level, + paused: n(), + playerSkin: t.playerSkin, + online: { + onInputChange: (a) => { + (gE( + t.status.realtime, + e.profile.profileId, + e.passcode, + a, + t.globalFrame, + ), + (t.checkForResyncTimer = 30)); + }, + getOtherPlayersInfo: () => + om( + [], + t.otherPlayersY, + false, + 0, + 0, + 0, + a.size.fullWidth, + a.size.fullHeight, + t.playerIndex, + false, + ), + eliminated: t.eliminated, + start: "started" === t.status.type, + mode: t.mode, + checkpointPlayerReached: + null === (s = t.checkpoint) || void 0 === s - ? void 0 - : s.playerReached, - onPlayerMove: (e, a) => { - t.checkForResyncTimer <= 0 && - ((t.checkForResyncTimer = 30), + ? void 0 + : s.playerReached, + onPlayerMove: (e, a) => { + t.checkForResyncTimer <= 0 && + ((t.checkForResyncTimer = 30), (t.playerMovementHistory = [ ...t.playerMovementHistory, { @@ -76639,57 +76639,57 @@ var version = "v1.17.2"; y: a, }, ])); - }, - serverPlayerPos: t.serverPlayerPos, - didResync: () => { - t.serverPlayerPos = void 0; - }, - loop: - t.mockStates && - t.mockSocket && - t.checkpoint && - ((e) => { - const a = EE( - e, - t.checkpoint.playerReached, - t.mockStates, - t.globalFrame, - t.checkpoint.total, - t.mockSocket.serverMessage.ref, - null !== t.checkpoint.resumeTimer, - ); - a && (t.mockStates = a); - }), }, - didCrash: () => { - var i; - "royaleLastBlockStanding" === - (null === (i = t.mode) || void 0 === i - ? void 0 - : i.type) && - (a.timer.start(() => { - t.isGameOver || - pE( - t.status.realtime, - e.profile.profileId, - e.passcode, - null, - ); - }, 3e3), - (t.eliminated = true)); + serverPlayerPos: t.serverPlayerPos, + didResync: () => { + t.serverPlayerPos = void 0; }, - onReachedCheckpoint: (i) => { - var n; - let s = 0; - ("started" === t.status.type && - "royaleCheckpointKnockout" === - (null === (n = t.mode) || - void 0 === n - ? void 0 - : n.type) && - ((s = a - .audio(t.status.level.song.fileName) - .getPosition()), + loop: + t.mockStates && + t.mockSocket && + t.checkpoint && + ((e) => { + const a = EE( + e, + t.checkpoint.playerReached, + t.mockStates, + t.globalFrame, + t.checkpoint.total, + t.mockSocket.serverMessage.ref, + null !== t.checkpoint.resumeTimer, + ); + a && (t.mockStates = a); + }), + }, + didCrash: () => { + var i; + "royaleLastBlockStanding" === + (null === (i = t.mode) || void 0 === i + ? void 0 + : i.type) && + (a.timer.start(() => { + t.isGameOver || + pE( + t.status.realtime, + e.profile.profileId, + e.passcode, + null, + ); + }, 3e3), + (t.eliminated = true)); + }, + onReachedCheckpoint: (i) => { + var n; + let s = 0; + ("started" === t.status.type && + "royaleCheckpointKnockout" === + (null === (n = t.mode) || + void 0 === n + ? void 0 + : n.type) && + ((s = a + .audio(t.status.level.song.fileName) + .getPosition()), a .audio(t.status.level.song.fileName) .setVolume({ @@ -76697,1818 +76697,1743 @@ var version = "v1.17.2"; fadeTime: 1, fadeTo: 0, })), - i && - a.timer.start(() => { - t.isGameOver || - pE( - t.status.realtime, - e.profile.profileId, - e.passcode, - null, - ); - }, 3e3), - i - ? (t.finished = true) - : t.checkpoint && - (t.checkpoint = Object.assign( - Object.assign({}, t.checkpoint), - { - playerReached: true, - songPosition: s, - }, - ))); - }, + i && + a.timer.start(() => { + t.isGameOver || + pE( + t.status.realtime, + e.profile.profileId, + e.passcode, + null, + ); + }, 3e3), + i + ? (t.finished = true) + : t.checkpoint && + (t.checkpoint = Object.assign( + Object.assign({}, t.checkpoint), + { + playerReached: true, + songPosition: s, + }, + ))); }, - (e) => { - var i; - ((e.paused = n()), - (e.online.eliminated = t.eliminated), - (e.online.start = - "started" === t.status.type), - (e.online.mode = t.mode), - (e.online.checkpointPlayerReached = - null === (i = t.checkpoint) || + }, + (e) => { + var i; + ((e.paused = n()), + (e.online.eliminated = t.eliminated), + (e.online.start = + "started" === t.status.type), + (e.online.mode = t.mode), + (e.online.checkpointPlayerReached = + null === (i = t.checkpoint) || void 0 === i - ? void 0 - : i.playerReached), - (e.online.serverPlayerPos = - t.serverPlayerPos), - (e.playerSkin = t.playerSkin), - (e.online.getOtherPlayersInfo = ( + ? void 0 + : i.playerReached), + (e.online.serverPlayerPos = + t.serverPlayerPos), + (e.playerSkin = t.playerSkin), + (e.online.getOtherPlayersInfo = ( + e, + i, + ) => { + var s; + const o = + t.globalFrame - + t.latestInfo.globalFrame, + r = o > 0 && !t.isGameOver; + return om( + "connected" !== t.connection || n() + ? [] + : t.latestInfo.info, + t.otherPlayersY, + r, + o, e, i, - ) => { - var s; - const o = - t.globalFrame - - t.latestInfo.globalFrame, - r = o > 0 && !t.isGameOver; - return om( - "connected" !== t.connection || n() - ? [] - : t.latestInfo.info, - t.otherPlayersY, - r, - o, - e, - i, - a.size.fullWidth, - a.size.fullHeight, - t.playerIndex, - "friendsRaceToFinish" === - (null === (s = t.mode) || - void 0 === s - ? void 0 - : s.type), - ); - })); - }, - ), - ]; - }, - ), - ifConditional( - () => void 0 !== t.checkpoint && !t.isGameOver, - () => [ - IE.Single( - { - reached: t.checkpoint.reached, - total: t.checkpoint.total, - timeoutTimer: t.checkpoint.timeoutTimer, - x: a.size.fullWidth / 2 - 150, - y: a.size.fullHeight / 2 - 50, - }, - (e) => { - ((e.reached = t.checkpoint.reached), - (e.total = t.checkpoint.total), - (e.timeoutTimer = - t.checkpoint.timeoutTimer), - (e.x = a.size.fullWidth / 2 - 150), - (e.y = a.size.fullHeight / 2 - 50)); + a.size.fullWidth, + a.size.fullHeight, + t.playerIndex, + "friendsRaceToFinish" === + (null === (s = t.mode) || + void 0 === s + ? void 0 + : s.type), + ); + })); }, ), - ], - ), - ifConditional( - () => void 0 !== t.orderInfo && !t.isGameOver, - () => [ - OE.Single( - { - orderInfo: t.orderInfo, - x: -a.size.fullWidth / 2 + 20, - y: a.size.fullHeight / 2 - 120, - }, - (e) => { - ((e.orderInfo = t.orderInfo), - (e.x = -a.size.fullWidth / 2 + 20), - (e.y = a.size.fullHeight / 2 - 120)); - }, + ]; + }, + ), + ifConditional( + () => void 0 !== t.checkpoint && !t.isGameOver, + () => [ + IE.Single( + { + reached: t.checkpoint.reached, + total: t.checkpoint.total, + timeoutTimer: t.checkpoint.timeoutTimer, + x: a.size.fullWidth / 2 - 150, + y: a.size.fullHeight / 2 - 50, + }, + (e) => { + ((e.reached = t.checkpoint.reached), + (e.total = t.checkpoint.total), + (e.timeoutTimer = + t.checkpoint.timeoutTimer), + (e.x = a.size.fullWidth / 2 - 150), + (e.y = a.size.fullHeight / 2 - 50)); + }, + ), + ], + ), + ifConditional( + () => void 0 !== t.orderInfo && !t.isGameOver, + () => [ + OE.Single( + { + orderInfo: t.orderInfo, + x: -a.size.fullWidth / 2 + 20, + y: a.size.fullHeight / 2 - 120, + }, + (e) => { + ((e.orderInfo = t.orderInfo), + (e.x = -a.size.fullWidth / 2 + 20), + (e.y = a.size.fullHeight / 2 - 120)); + }, + ), + ], + ), + ifConditional( + () => t.viewCount > 0, + () => [ + y( + { + fileName: "images/online/eye-icon.png", + width: 30, + height: 20, + x: -a.size.fullWidth / 2 + 130, + y: a.size.fullHeight / 2 - 50, + }, + (e) => { + ((e.x = -a.size.fullWidth / 2 + 130), + (e.y = a.size.fullHeight / 2 - 50)); + }, + ), + c( + { + color: ve, + font: { size: 16, align: "left" }, + strokeColor: Ye, + strokeThickness: 4, + x: -a.size.fullWidth / 2 + 150, + y: a.size.fullHeight / 2 - 50, + }, + (e) => { + ((e.text = String(t.viewCount)), + (e.x = -a.size.fullWidth / 2 + 150), + (e.y = a.size.fullHeight / 2 - 50)); + }, + ), + ], + ), + conditional( + () => null !== t.viewingPlayer, + () => [ + onChange( + () => t.viewingPlayer.playerIndex, + () => { + const i = t.viewingPlayer.playerIndex, + n = t.namesByPlayerIndex[i] || ""; + return [ + SE.Single( + { + loadingNewPlayer: + t.viewingPlayer.loadingNewPlayer, + username: n, + viewNextPlayer: (a) => { + ((t.viewingPlayer.loadingNewPlayer = true), + pE( + t.status.realtime, + e.profile.profileId, + e.passcode, + "forwards" === a ? 1 : -1, + )); + }, + y: -a.size.fullHeight / 2 + 50, + }, + (e) => { + ((e.loadingNewPlayer = + t.viewingPlayer.loadingNewPlayer), + (e.y = + -a.size.fullHeight / 2 + 50)); + }, + ), + ifConditional( + () => + t.viewingPlayer.eliminated && + !t.isGameOver, + () => [ + c({ + color: ve, + text: "ELIMINATED!", + font: { size: 30 }, + y: 20, + strokeColor: Ye, + strokeThickness: 8, + }), + ], + ), + ]; + }, + ), + ], + () => { + var i; + return [ + ifConditional( + () => null !== t.mode, + () => [ + jo.Single( + { + shouldShow: + "waitingToStart" === t.status.type, + sprite: (e) => [ + c( + { + color: ve, + text: + "royaleCheckpointKnockout" === + t.mode.type + ? "CHECKPOINT KNOCKOUT!" + : "royaleLastBlockStanding" === + t.mode.type + ? "LAST BLOCK STANDING!" + : "RACE TO THE FINISH!", + y: -150, + font: { size: 20 }, + strokeColor: Ye, + strokeThickness: 6, + }, + (t) => { + t.opacity = e.ref; + }, + ), + ], + }, + (e) => { + e.shouldShow = + "waitingToStart" === t.status.type; + }, + ), + ], ), - ], - ), - ifConditional( - () => t.viewCount > 0, - () => [ - y( + jo.Single( { - fileName: "images/online/eye-icon.png", - width: 30, - height: 20, - x: -a.size.fullWidth / 2 + 130, - y: a.size.fullHeight / 2 - 50, + shouldShow: Boolean( + (null === (i = t.checkpoint) || + void 0 === i + ? void 0 + : i.playerReached) && + !t.isGameOver && + null === t.checkpoint.resumeTimer, + ), + sprite: (e) => [ + c( + { + color: ve, + text: "WAITING FOR OTHER PLAYERS", + y: -150, + font: { size: 20 }, + strokeColor: Ye, + strokeThickness: 6, + }, + (t) => { + t.opacity = e.ref; + }, + ), + ], }, (e) => { - ((e.x = -a.size.fullWidth / 2 + 130), - (e.y = a.size.fullHeight / 2 - 50)); + var a; + e.shouldShow = Boolean( + (null === (a = t.checkpoint) || + void 0 === a + ? void 0 + : a.playerReached) && + !t.isGameOver && + null === t.checkpoint.resumeTimer, + ); }, ), - c( + vE.Single( { - color: ve, - font: { size: 16, align: "left" }, - strokeColor: Ye, - strokeThickness: 4, - x: -a.size.fullWidth / 2 + 150, - y: a.size.fullHeight / 2 - 50, + delayFrames: 120, + shouldShow: + void 0 !== t.checkpoint && + null !== t.checkpoint.resumeTimer, + sprites: () => [ + Hs( + { + id: "ResumeCountdown", + animationAssets: + t.status.spineContext + .animationAssets, + animationRenderer: + e.animationRenderer, + fileNames: + Qs.spineFiles.countdownResume, + animationName: "animation", + loop: false, + paused: false, + x: 0, + y: 0, + height: 0, + df: t.countdownDf, + onEvent: kE(a.audio), + }, + (e) => { + e.df = t.countdownDf; + }, + ), + ], }, (e) => { - ((e.text = String(t.viewCount)), - (e.x = -a.size.fullWidth / 2 + 150), - (e.y = a.size.fullHeight / 2 - 50)); + e.shouldShow = + void 0 !== t.checkpoint && + null !== t.checkpoint.resumeTimer; }, ), - ], - ), - conditional( - () => null !== t.viewingPlayer, - () => [ - onChange( - () => t.viewingPlayer.playerIndex, - () => { - const i = t.viewingPlayer.playerIndex, - n = t.namesByPlayerIndex[i] || ""; - return [ - SE.Single( + ifConditional( + () => t.eliminated && !t.isGameOver, + () => [ + c({ + color: ve, + text: "ELIMINATED!", + font: { size: 30 }, + y: 20, + strokeColor: Ye, + strokeThickness: 8, + }), + ], + ), + jo.Single( + { + shouldShow: t.finished && !t.isGameOver, + sprite: (e) => [ + qe( { - loadingNewPlayer: - t.viewingPlayer.loadingNewPlayer, - username: n, - viewNextPlayer: (a) => { - ((t.viewingPlayer.loadingNewPlayer = true), - pE( - t.status.realtime, - e.profile.profileId, - e.passcode, - "forwards" === a ? 1 : -1, - )); - }, - y: -a.size.fullHeight / 2 + 50, + width: 400, + height: 150, + fillColor: Re, + color: Ae, + thickness: 3, }, - (e) => { - ((e.loadingNewPlayer = - t.viewingPlayer.loadingNewPlayer), - (e.y = - -a.size.fullHeight / 2 + 50)); + (t) => { + t.opacity = e.ref; }, ), - ifConditional( - () => - t.viewingPlayer.eliminated && - !t.isGameOver, - () => [ - c({ - color: ve, - text: "ELIMINATED!", - font: { size: 30 }, - y: 20, - strokeColor: Ye, - strokeThickness: 8, - }), - ], - ), - ]; - }, - ), - ], - () => { - var i; - return [ - ifConditional( - () => null !== t.mode, - () => [ - jo.Single( + c( { - shouldShow: - "waitingToStart" === t.status.type, - sprite: (e) => [ - c( - { - color: ve, - text: - "royaleCheckpointKnockout" === - t.mode.type - ? "CHECKPOINT KNOCKOUT!" - : "royaleLastBlockStanding" === - t.mode.type - ? "LAST BLOCK STANDING!" - : "RACE TO THE FINISH!", - y: -150, - font: { size: 20 }, - strokeColor: Ye, - strokeThickness: 6, - }, - (t) => { - t.opacity = e.ref; - }, - ), - ], + font: { size: 30 }, + text: localize("LEVEL COMPLETE!"), + strokeColor: Ye, + color: ve, + strokeThickness: 8, }, - (e) => { - e.shouldShow = - "waitingToStart" === t.status.type; + (t) => { + t.opacity = e.ref; }, ), ], - ), - jo.Single( - { - shouldShow: Boolean( - (null === (i = t.checkpoint) || - void 0 === i - ? void 0 - : i.playerReached) && - !t.isGameOver && - null === t.checkpoint.resumeTimer, + }, + (e) => { + e.shouldShow = + t.finished && !t.isGameOver; + }, + ), + ]; + }, + ), + jo.Single( + { + shouldShow: n(), + sprite: (a) => [ + ifConditional( + () => null !== t.rankings, + () => [ + RE.Single( + { + winnerPlayerIndexes: + t.rankings.winnerPlayerIndexes, + rankingsByIndex: + t.rankings.rankingsByIndex, + playerIndex: t.playerIndex, + xp: t.rankings.xp, + namesByPlayerIndex: + t.namesByPlayerIndex, + onContinue: () => { + var a; + const { realtime: i } = t.status; + (e.isPartyLeader && + "friendsRaceToFinish" === + (null === (a = t.mode) || + void 0 === a + ? void 0 + : a.type) && + hE( + i, + e.profile.profileId, + e.passcode, + ), + oE(i), + e.backToMenu()); + }, + opacity: a.ref, + }, + (e) => { + e.opacity = a.ref; + }, + ), + ], + ), + ], + }, + (e) => { + e.shouldShow = n(); + }, + ), + onChange( + () => t.connection, + () => { + switch (t.connection) { + case "no-messages": + return [ + c({ + text: "LOST CONNECTION WITH SERVER", + color: ve, + strokeColor: Ye, + strokeThickness: 6, + font: { size: 20 }, + y: 20, + }), + ]; + case "reconnecting": + return [ + c({ + text: localize("ATTEMPTING TO REJOIN"), + color: ve, + strokeColor: Ye, + strokeThickness: 6, + font: { size: 20 }, + y: 20, + }), + ]; + case "disconnected": + return [ + c({ + text: localize( + "FAILED TO RECONNECT, GOING BACK TO MAIN MENU", ), - sprite: (e) => [ - c( - { - color: ve, - text: "WAITING FOR OTHER PLAYERS", - y: -150, - font: { size: 20 }, - strokeColor: Ye, - strokeThickness: 6, - }, - (t) => { - t.opacity = e.ref; - }, - ), - ], - }, - (e) => { - var a; - e.shouldShow = Boolean( - (null === (a = t.checkpoint) || - void 0 === a - ? void 0 - : a.playerReached) && - !t.isGameOver && - null === t.checkpoint.resumeTimer, - ); - }, - ), - vE.Single( - { - delayFrames: 120, - shouldShow: - void 0 !== t.checkpoint && - null !== t.checkpoint.resumeTimer, - sprites: () => [ - Hs( - { - id: "ResumeCountdown", - animationAssets: - t.status.spineContext - .animationAssets, - animationRenderer: - e.animationRenderer, - fileNames: - Qs.spineFiles.countdownResume, - animationName: "animation", - loop: false, - paused: false, - x: 0, - y: 0, - height: 0, - df: t.countdownDf, - onEvent: kE(a.audio), - }, - (e) => { - e.df = t.countdownDf; - }, - ), + color: ve, + strokeColor: Ye, + strokeThickness: 6, + font: { size: 20 }, + y: 20, + }), + ]; + case "connecting": + return [ + c({ + text: `${localize("CONNECTING")}...`, + color: ve, + strokeColor: Ye, + strokeThickness: 6, + font: { size: 30 }, + y: 20, + }), + ]; + case "connected": + return [ + conditional( + () => + "started" !== t.status.type && + null === t.startingIn, + () => [ + c({ + text: "STARTING SOON...", + color: ve, + strokeColor: Ye, + strokeThickness: 6, + font: { size: 30 }, + y: 20, + }), ], - }, - (e) => { - e.shouldShow = - void 0 !== t.checkpoint && - null !== t.checkpoint.resumeTimer; - }, - ), - ifConditional( - () => t.eliminated && !t.isGameOver, - () => [ - c({ - color: ve, - text: "ELIMINATED!", - font: { size: 30 }, - y: 20, - strokeColor: Ye, - strokeThickness: 8, - }), - ], - ), - jo.Single( - { - shouldShow: t.finished && !t.isGameOver, - sprite: (e) => [ - qe( - { - width: 400, - height: 150, - fillColor: Re, - color: Ae, - thickness: 3, - }, - (t) => { - t.opacity = e.ref; - }, - ), - c( + () => [ + vE.Single( { - font: { size: 30 }, - text: localize("LEVEL COMPLETE!"), - strokeColor: Ye, - color: ve, - strokeThickness: 8, + delayFrames: 120, + shouldShow: + "started" !== t.status.type, + sprites: () => [ + Hs( + { + id: "StartCountdown", + animationAssets: + t.status.spineContext + .animationAssets, + animationRenderer: + e.animationRenderer, + fileNames: + Qs.spineFiles + .countdownStart, + animationName: "animation", + loop: false, + paused: false, + x: 0, + y: 0, + height: 0, + df: t.countdownDf, + onEvent: kE(a.audio), + }, + (e) => { + e.df = t.countdownDf; + }, + ), + ifConditional( + () => false, + () => [ + c({ + text: "start", + color: ve, + testId: "Started", + }), + ], + ), + ], }, - (t) => { - t.opacity = e.ref; + (e) => { + e.shouldShow = + "started" !== t.status.type; }, ), ], + ), + ]; + } + }, + ), + onChange( + () => { + var e; + return null === (e = t.mode) || void 0 === e + ? void 0 + : e.type; + }, + () => { + var a; + return [ + gameplayOverlay.Single( + { + paused: t.levelMenuOpen, + attempt: t.attempt, + backToMenu: i, + onEndGame: + e.isPartyLeader && + "friendsRaceToFinish" === + (null === (a = t.mode) || void 0 === a + ? void 0 + : a.type) + ? () => { + hE( + t.status.realtime, + e.profile.profileId, + e.passcode, + ); + } + : void 0, + onResume: () => { + t.levelMenuOpen = false; }, - (e) => { - e.shouldShow = - t.finished && !t.isGameOver; + onPause: () => { + t.levelMenuOpen = true; }, - ), - ]; - }, - ), - jo.Single( + }, + (e) => { + e.paused = t.levelMenuOpen; + }, + ), + ]; + }, + ), + ], + }), + jo.Single( + { + shouldShow: false, + sprite: (e) => [ + c( { - shouldShow: n(), - sprite: (a) => [ - ifConditional( - () => null !== t.rankings, - () => [ - RE.Single( - { - winnerPlayerIndexes: - t.rankings.winnerPlayerIndexes, - rankingsByIndex: - t.rankings.rankingsByIndex, - playerIndex: t.playerIndex, - xp: t.rankings.xp, - namesByPlayerIndex: - t.namesByPlayerIndex, - onContinue: () => { - var a; - const { realtime: i } = t.status; - (e.isPartyLeader && - "friendsRaceToFinish" === - (null === (a = t.mode) || - void 0 === a - ? void 0 - : a.type) && - hE( - i, - e.profile.profileId, - e.passcode, - ), - oE(i), - e.backToMenu()); - }, - opacity: a.ref, - }, - (e) => { - e.opacity = a.ref; - }, - ), - ], - ), - ], - }, - (e) => { - e.shouldShow = n(); - }, - ), - onChange( - () => t.connection, - () => { - switch (t.connection) { - case "no-messages": - return [ - c({ - text: "LOST CONNECTION WITH SERVER", - color: ve, - strokeColor: Ye, - strokeThickness: 6, - font: { size: 20 }, - y: 20, - }), - ]; - case "reconnecting": - return [ - c({ - text: localize("ATTEMPTING TO REJOIN"), - color: ve, - strokeColor: Ye, - strokeThickness: 6, - font: { size: 20 }, - y: 20, - }), - ]; - case "disconnected": - return [ - c({ - text: localize( - "FAILED TO RECONNECT, GOING BACK TO MAIN MENU", - ), - color: ve, - strokeColor: Ye, - strokeThickness: 6, - font: { size: 20 }, - y: 20, - }), - ]; - case "connecting": - return [ - c({ - text: `${localize("CONNECTING")}...`, - color: ve, - strokeColor: Ye, - strokeThickness: 6, - font: { size: 30 }, - y: 20, - }), - ]; - case "connected": - return [ - conditional( - () => - "started" !== t.status.type && - null === t.startingIn, - () => [ - c({ - text: "STARTING SOON...", - color: ve, - strokeColor: Ye, - strokeThickness: 6, - font: { size: 30 }, - y: 20, - }), - ], - () => [ - vE.Single( - { - delayFrames: 120, - shouldShow: - "started" !== t.status.type, - sprites: () => [ - Hs( - { - id: "StartCountdown", - animationAssets: - t.status.spineContext - .animationAssets, - animationRenderer: - e.animationRenderer, - fileNames: - Qs.spineFiles - .countdownStart, - animationName: "animation", - loop: false, - paused: false, - x: 0, - y: 0, - height: 0, - df: t.countdownDf, - onEvent: kE(a.audio), - }, - (e) => { - e.df = t.countdownDf; - }, - ), - ifConditional( - () => false, - () => [ - c({ - text: "start", - color: ve, - testId: "Started", - }), - ], - ), - ], - }, - (e) => { - e.shouldShow = - "started" !== t.status.type; - }, - ), - ], - ), - ]; - } - }, - ), - onChange( - () => { - var e; - return null === (e = t.mode) || void 0 === e - ? void 0 - : e.type; + color: ve, + strokeColor: Ye, + strokeThickness: 4, + text: "RESYNCED WITH SERVER", + y: 20, + font: { size: 15 }, }, - () => { - var a; - return [ - gameplayOverlay.Single( - { - paused: t.levelMenuOpen, - attempt: t.attempt, - backToMenu: i, - onEndGame: - e.isPartyLeader && - "friendsRaceToFinish" === - (null === (a = t.mode) || void 0 === a - ? void 0 - : a.type) - ? () => { - hE( - t.status.realtime, - e.profile.profileId, - e.passcode, - ); - } - : void 0, - onResume: () => { - t.levelMenuOpen = false; - }, - onPause: () => { - t.levelMenuOpen = true; - }, - }, - (e) => { - e.paused = t.levelMenuOpen; - }, - ), - ]; + (t) => { + t.opacity = e.ref; }, ), ], - }), - jo.Single( - { - shouldShow: false, - sprite: (e) => [ - c( - { - color: ve, - strokeColor: Ye, - strokeThickness: 4, - text: "RESYNCED WITH SERVER", - y: 20, - font: { size: 15 }, - }, - (t) => { - t.opacity = e.ref; - }, - ), - ], - }, - (e) => { - e.shouldShow = t.resyncTimerDebounce > 60; - }, - ), - ]; - }, - ), - ], - ), - ], - }); - function AE(e, t, a, i, n, s, o, r, l) { - const { speed: c, jumpFrames: d } = l, - u = 90 / d, - h = [...a]; - return { - lastInfo: e.map((e, a) => { - if (null === e) return null; - const [i, n, s, l, d, p, g, m, f] = e, - y = t[a]; - return y - ? (y.deathTimer > 0 && !m && (h[a] = n), - { - username: y.username, - skin: y.skin, - playerIndex: y.playerIndex, - x: i, - y: n, - rotation: s, - scaleX: l, - scaleY: d, - speed: p * c, - rotSpeed: f * u * p, - deathTimer: m ? y.deathTimer + 1 : 0, - playerStack: g, - }) - : { - username: o[a] || "", - skin: r[a] || Wt.default, - x: i, - y: n, - rotation: s, - scaleX: l, - scaleY: d, - speed: p * c, - rotSpeed: f * u * p, - deathTimer: m ? 1 : 0, - playerIndex: a, - playerStack: g, - }; + }, + (e) => { + e.shouldShow = t.resyncTimerDebounce > 60; + }, + ), + ]; + }, + ), + ], + ), + ], + }); + function AE(e, t, a, i, n, s, o, r, l) { + const { speed: c, jumpFrames: d } = l, + u = 90 / d, + h = [...a]; + return { + lastInfo: e.map((e, a) => { + if (null === e) return null; + const [i, n, s, l, d, p, g, m, f] = e, + y = t[a]; + return y + ? (y.deathTimer > 0 && !m && (h[a] = n), + { + username: y.username, + skin: y.skin, + playerIndex: y.playerIndex, + x: i, + y: n, + rotation: s, + scaleX: l, + scaleY: d, + speed: p * c, + rotSpeed: f * u * p, + deathTimer: m ? y.deathTimer + 1 : 0, + playerStack: g, + }) + : { + username: o[a] || "", + skin: r[a] || Wt.default, + x: i, + y: n, + rotation: s, + scaleX: l, + scaleY: d, + speed: p * c, + rotSpeed: f * u * p, + deathTimer: m ? 1 : 0, + playerIndex: a, + playerStack: g, + }; + }), + otherPlayersY: h, + checkpoint: + s && + Object.assign(Object.assign({}, s), { + reached: null != i ? i : s.reached, + timeoutTimer: null != n ? n : null, }), - otherPlayersY: h, - checkpoint: - s && - Object.assign(Object.assign({}, s), { - reached: null != i ? i : s.reached, - timeoutTimer: null != n ? n : null, - }), - }; - } - function kE(e) { - return (t) => { - switch (t) { - case "3": - case "2": - case "1": - e("audio/online/countdown-123.wav").play(0); - break; - case "start": - e("audio/online/countdown-start.wav").play(0); - break; - case "go": - e("audio/online/countdown-go.wav").play(0); - } - }; - } - var NE = function (e, t, a, i) { - return new (a || (a = Promise))(function (n, s) { - function o(e) { - try { - l(i.next(e)); - } catch (e) { - s(e); - } - } - function r(e) { - try { - l(i.throw(e)); - } catch (e) { - s(e); - } + }; + } + function kE(e) { + return (t) => { + switch (t) { + case "3": + case "2": + case "1": + e("audio/online/countdown-123.wav").play(0); + break; + case "start": + e("audio/online/countdown-start.wav").play(0); + break; + case "go": + e("audio/online/countdown-go.wav").play(0); + } + }; + } + var NE = function (e, t, a, i) { + return new (a || (a = Promise))(function (n, s) { + function o(e) { + try { + l(i.next(e)); + } catch (e) { + s(e); } - function l(e) { - var t; - e.done - ? n(e.value) - : ((t = e.value), - t instanceof a - ? t - : new a(function (e) { - e(t); - })).then(o, r); + } + function r(e) { + try { + l(i.throw(e)); + } catch (e) { + s(e); } - l((i = i.apply(e, t || [])).next()); - }); - }; - const xE = - ({ - save: e, - error: t, - getBackend: a, - syncProfile: i, - handleAnonAuth: n, - handleAppleAttach: s, - handleGoogleAttach: o, - handleGoogleSignout: r, - reconnect: l, - handleSignout: c, - handleAccountDelete: d, - requestAppleAuth: u, - requestGoogleAuth: h, - detachApple: p, - detachGoogle: g, - }) => - (m, f) => { - const y = (a, i) => (n) => { - ("string" == typeof n - ? n === bp.UPDATE_LOGIN_ERROR - ? t("Update to the latest version to go online") - : n === bp.EXPIRED_LOGIN_ERROR - ? t("Login expired") - : n === bp.USER_NOT_FOUND - ? (bp.resetUser(i), - t( - "Failed to find user account, created a new one for you", - )) - : n === bp.OFFLINE || t(`${a}: ${n}`) - : n instanceof Error - ? n.message.includes("OGL_CANCELLED") || - t(`${a}: ${n.message}`) - : t(a), - e({ type: "offline" }, { type: "none" })); - }; - switch (m.type) { - case "init": - case "offline": - if ("goOnline" === f.type) { - const t = a(), - s = "none" !== f.auth.type, - o = "none" === f.auth.type ? { type: "anon" } : f.auth; - return ( - NE(void 0, void 0, void 0, function* () { - const a = yield (s ? l : n)(t), - { playerSkin: r } = a, - c = (function (e, t) { - var a = {}; - for (var i in e) - Object.prototype.hasOwnProperty.call(e, i) && - t.indexOf(i) < 0 && - (a[i] = e[i]); - if ( - null != e && - "function" == typeof Object.getOwnPropertySymbols - ) { - var n = 0; - for ( - i = Object.getOwnPropertySymbols(e); - n < i.length; - n++ - ) - t.indexOf(i[n]) < 0 && - Object.prototype.propertyIsEnumerable.call( - e, - i[n], - ) && - (a[i[n]] = e[i[n]]); - } - return a; - })(a, ["playerSkin"]), - d = yield i(c, r, t, o, false); - e( - { - type: "loggedIn", - auth: o.type, - authId: "anon" === o.type ? null : o.id, - party: null, - backend: t, - profile: d, - }, - o, - ); - }).catch(y("Failed to go online", t)), - { type: "signingIn", auth: o.type } - ); - } - return m; - case "signingIn": - case "signingOut": - case "requestingAuth": - case "deleting": - return m; - case "loggedIn": - switch (f.type) { - case "signInWithApple": - return ( - ((t, n, o = a()) => { - NE(void 0, void 0, void 0, function* () { - const { userId: a, idToken: r } = yield u(n), - l = { type: "apple", id: a }; - e({ type: "signingIn", auth: "apple" }, l); - const c = yield s(o, a, r); - c.didCancel - ? e( - { - type: "loggedIn", - auth: "anon", - authId: null, - party: null, - backend: o, - profile: t, - }, - { type: "anon" }, - ) - : (c.newProfile && - (t = yield i( - c.newProfile, - c.newProfile.playerSkin, - o, - l, - true, - )), - e( - { - type: "loggedIn", - auth: "apple", - authId: a, - party: null, - backend: o, - profile: t, - }, - l, - )); - }).catch(y("Failed to sign in with Apple", o)); - })(f.profile, false, m.backend), - { type: "requestingAuth", auth: "apple" } - ); - case "signInWithGoogle": - return ( - ((t, n = a()) => { - NE(void 0, void 0, void 0, function* () { - const { id: a, idToken: s } = yield h(), - r = { type: "google", id: a }, - l = yield o(n, a, s); - l.didCancel - ? e( - { - type: "loggedIn", - auth: "anon", - authId: null, - party: null, - backend: n, - profile: t, - }, - { type: "anon" }, - ) - : (l.newProfile && - (t = yield i( - l.newProfile, - l.newProfile.playerSkin, - n, - r, - true, - )), - e( - { - type: "loggedIn", - auth: "google", - authId: a, - party: null, - backend: n, - profile: t, - }, - r, - )); - }).catch(y("Failed to sign in with Google", n)); - })(f.profile, m.backend), - { type: "requestingAuth", auth: "apple" } + } + function l(e) { + var t; + e.done + ? n(e.value) + : ((t = e.value), + t instanceof a + ? t + : new a(function (e) { + e(t); + })).then(o, r); + } + l((i = i.apply(e, t || [])).next()); + }); + }; + const xE = + ({ + save: e, + error: t, + getBackend: a, + syncProfile: i, + handleAnonAuth: n, + handleAppleAttach: s, + handleGoogleAttach: o, + handleGoogleSignout: r, + reconnect: l, + handleSignout: c, + handleAccountDelete: d, + requestAppleAuth: u, + requestGoogleAuth: h, + detachApple: p, + detachGoogle: g, + }) => + (m, f) => { + const y = (a, i) => (n) => { + ("string" == typeof n + ? n === bp.UPDATE_LOGIN_ERROR + ? t("Update to the latest version to go online") + : n === bp.EXPIRED_LOGIN_ERROR + ? t("Login expired") + : n === bp.USER_NOT_FOUND + ? (bp.resetUser(i), + t( + "Failed to find user account, created a new one for you", + )) + : n === bp.OFFLINE || t(`${a}: ${n}`) + : n instanceof Error + ? n.message.includes("OGL_CANCELLED") || + t(`${a}: ${n.message}`) + : t(a), + e({ type: "offline" }, { type: "none" })); + }; + switch (m.type) { + case "init": + case "offline": + if ("goOnline" === f.type) { + const t = a(), + s = "none" !== f.auth.type, + o = "none" === f.auth.type ? { type: "anon" } : f.auth; + return ( + NE(void 0, void 0, void 0, function* () { + const a = yield (s ? l : n)(t), + { playerSkin: r } = a, + c = (function (e, t) { + var a = {}; + for (var i in e) + Object.prototype.hasOwnProperty.call(e, i) && + t.indexOf(i) < 0 && + (a[i] = e[i]); + if ( + null != e && + "function" == typeof Object.getOwnPropertySymbols + ) { + var n = 0; + for ( + i = Object.getOwnPropertySymbols(e); + n < i.length; + n++ + ) + t.indexOf(i[n]) < 0 && + Object.prototype.propertyIsEnumerable.call( + e, + i[n], + ) && + (a[i[n]] = e[i[n]]); + } + return a; + })(a, ["playerSkin"]), + d = yield i(c, r, t, o, false); + e( + { + type: "loggedIn", + auth: o.type, + authId: "anon" === o.type ? null : o.id, + party: null, + backend: t, + profile: d, + }, + o, ); - case "signOut": - return ( - ("google" === m.auth ? r() : Promise.resolve()) - .then(() => c(m.backend)) - .then((e) => - i(e, Wt.default, m.backend, { type: "anon" }, true), - ) - .then((t) => { - e( + }).catch(y("Failed to go online", t)), + { type: "signingIn", auth: o.type } + ); + } + return m; + case "signingIn": + case "signingOut": + case "requestingAuth": + case "deleting": + return m; + case "loggedIn": + switch (f.type) { + case "signInWithApple": + return ( + ((t, n, o = a()) => { + NE(void 0, void 0, void 0, function* () { + const { userId: a, idToken: r } = yield u(n), + l = { type: "apple", id: a }; + e({ type: "signingIn", auth: "apple" }, l); + const c = yield s(o, a, r); + c.didCancel + ? e( { type: "loggedIn", auth: "anon", authId: null, party: null, - backend: m.backend, + backend: o, profile: t, }, { type: "anon" }, - ); - }) - .catch(() => { - t("Failed to sign out"); - }), - { type: "signingOut" } - ); - case "detachAccount": { - const a = "google" === m.auth ? g : p; - return m.authId - ? (a(m.backend, m.authId) - .then(() => { + ) + : (c.newProfile && + (t = yield i( + c.newProfile, + c.newProfile.playerSkin, + o, + l, + true, + )), e( { type: "loggedIn", - auth: "anon", - authId: null, + auth: "apple", + authId: a, party: null, - backend: m.backend, - profile: m.profile, + backend: o, + profile: t, }, - { type: "anon" }, - ); - }) - .catch(() => { - t("Failed to detach"); - }), - { type: "signingOut" }) - : (t( - "No auth ID saved. Please sign out, sign in and try again.", - ), - m); - } - case "deleteAccount": - return ( - d(m.backend) - .then((e) => - i(e, Wt.default, m.backend, { type: "anon" }, true), - ) - .then((t) => { - e( + l, + )); + }).catch(y("Failed to sign in with Apple", o)); + })(f.profile, false, m.backend), + { type: "requestingAuth", auth: "apple" } + ); + case "signInWithGoogle": + return ( + ((t, n = a()) => { + NE(void 0, void 0, void 0, function* () { + const { id: a, idToken: s } = yield h(), + r = { type: "google", id: a }, + l = yield o(n, a, s); + l.didCancel + ? e( { type: "loggedIn", auth: "anon", authId: null, party: null, - backend: m.backend, + backend: n, profile: t, }, { type: "anon" }, - ); - }) - .catch(() => { - t("Failed to delete account"); - }), - { type: "deleting" } - ); - default: - return m; + ) + : (l.newProfile && + (t = yield i( + l.newProfile, + l.newProfile.playerSkin, + n, + r, + true, + )), + e( + { + type: "loggedIn", + auth: "google", + authId: a, + party: null, + backend: n, + profile: t, + }, + r, + )); + }).catch(y("Failed to sign in with Google", n)); + })(f.profile, m.backend), + { type: "requestingAuth", auth: "apple" } + ); + case "signOut": + return ( + ("google" === m.auth ? r() : Promise.resolve()) + .then(() => c(m.backend)) + .then((e) => + i(e, Wt.default, m.backend, { type: "anon" }, true), + ) + .then((t) => { + e( + { + type: "loggedIn", + auth: "anon", + authId: null, + party: null, + backend: m.backend, + profile: t, + }, + { type: "anon" }, + ); + }) + .catch(() => { + t("Failed to sign out"); + }), + { type: "signingOut" } + ); + case "detachAccount": { + const a = "google" === m.auth ? g : p; + return m.authId + ? (a(m.backend, m.authId) + .then(() => { + e( + { + type: "loggedIn", + auth: "anon", + authId: null, + party: null, + backend: m.backend, + profile: m.profile, + }, + { type: "anon" }, + ); + }) + .catch(() => { + t("Failed to detach"); + }), + { type: "signingOut" }) + : (t( + "No auth ID saved. Please sign out, sign in and try again.", + ), + m); } + case "deleteAccount": + return ( + d(m.backend) + .then((e) => + i(e, Wt.default, m.backend, { type: "anon" }, true), + ) + .then((t) => { + e( + { + type: "loggedIn", + auth: "anon", + authId: null, + party: null, + backend: m.backend, + profile: t, + }, + { type: "anon" }, + ); + }) + .catch(() => { + t("Failed to delete account"); + }), + { type: "deleting" } + ); + default: + return m; + } + } + }, + PE = ["#6b0d54", "#be1c6a", "#c5452d", "#11b07f", "#c59413"], + ME = makeCustomSprite({ + init({ device: { random: e, size: t } }) { + const a = t.width + 2 * t.widthMargin, + i = t.height + 2 * t.heightMargin; + return { + triangles: Array.from({ length: 15 }).map((t, n) => { + const s = 1 * e() + 1, + o = e() * Math.PI * 2; + return { + speedX: Math.cos(o) * s, + speedY: Math.sin(o) * s, + rotSpeed: ot(e) * (1 * e() + 1), + x: e() * a - a / 2, + y: e() * i - i / 2, + rot: 360 * e(), + width: 5 + 10 * e(), + height: 5 + 10 * e(), + color: PE[n % 5], + alpha: 0.5 * e() + 0.5, + }; + }), + }; + }, + loop({ state: e, device: { size: t } }) { + const a = t.width + 2 * t.widthMargin, + i = t.height + 2 * t.heightMargin; + return { + triangles: e.triangles.map((e) => { + let t = e.x + e.speedX, + n = e.y + e.speedY; + return ( + t > a / 2 + 50 + ? (t -= a + 100) + : t < -a / 2 - 50 && (t += a + 100), + n > i / 2 + 50 + ? (n -= i + 100) + : n < -i / 2 - 50 && (n += i + 100), + Object.assign(Object.assign({}, e), { + x: t, + y: n, + rot: e.rot + e.rotSpeed, + }) + ); + }), + }; + }, + render: ({ state: e }) => [ + ...e.triangles.map((e) => + r({ + fillColor: e.color, + path: [ + [-e.width, -e.height], + [e.width, -e.height], + [0, e.height], + ], + x: e.x, + y: e.y, + rotation: e.rot, + opacity: e.alpha, + }), + ), + ], + }), + LE = makeCustomSprite({ + init({ props: e, device: t, preloadFiles: a, updateState: i }) { + const n = jy( + e.achievement, + { family: "Montserrat", size: 16, weight: 800 }, + 120, + ); + return ( + Promise.all([ + Jp.getUserItems("bonusLevel"), + a({ + imageFileNames: [ + ...Qs.achievementImages, + ...n + .map((e) => { + var t; + return null === (t = e.icon) || void 0 === t + ? void 0 + : t.fileName; + }) + .filter(nt), + ], + audioFileNames: Qs.achievementSfx, + }), + ]).then(([e]) => { + (t + .audio("audio/achievement/achievement-unlocked.wav") + .play(0), + i((t) => + Object.assign(Object.assign({}, t), { + loading: false, + hasSuperLevelPack: true, + }), + )); + }), + { + loading: true, + showModal: "none", + arrowX: 0, + collected: e.achievement.rewards.collected, + rewards: n, + hasSuperLevelPack: false, } - }, - PE = ["#6b0d54", "#be1c6a", "#c5452d", "#11b07f", "#c59413"], - ME = makeCustomSprite({ - init({ device: { random: e, size: t } }) { - const a = t.width + 2 * t.widthMargin, - i = t.height + 2 * t.heightMargin; - return { - triangles: Array.from({ length: 15 }).map((t, n) => { - const s = 1 * e() + 1, - o = e() * Math.PI * 2; - return { - speedX: Math.cos(o) * s, - speedY: Math.sin(o) * s, - rotSpeed: ot(e) * (1 * e() + 1), - x: e() * a - a / 2, - y: e() * i - i / 2, - rot: 360 * e(), - width: 5 + 10 * e(), - height: 5 + 10 * e(), - color: PE[n % 5], - alpha: 0.5 * e() + 0.5, - }; + ); + }, + loop: ({ state: e }) => + Object.assign(Object.assign({}, e), { + arrowX: e.arrowX > 10 ? -10 : e.arrowX + 0.3, + }), + render({ + props: e, + state: t, + updateState: a, + getContext: i, + device: s, + }) { + const { online: c } = i(Se), + { achievement: d, hasPass: u, didBuyPass: h } = e, + { + showModal: p, + rewards: g, + hasSuperLevelPack: m, + collected: f, + } = t, + y = s.size.width + 2 * s.size.widthMargin, + E = s.size.height + 2 * s.size.heightMargin; + return t.loading + ? [] + : [ + Clickable({ + id: "BlockBehind", + width: y, + height: E, + sprites: () => [], + onPress: () => null, }), - }; - }, - loop({ state: e, device: { size: t } }) { - const a = t.width + 2 * t.widthMargin, - i = t.height + 2 * t.heightMargin; - return { - triangles: e.triangles.map((e) => { - let t = e.x + e.speedX, - n = e.y + e.speedY; - return ( - t > a / 2 + 50 - ? (t -= a + 100) - : t < -a / 2 - 50 && (t += a + 100), - n > i / 2 + 50 - ? (n -= i + 100) - : n < -i / 2 - 50 && (n += i + 100), - Object.assign(Object.assign({}, e), { - x: t, - y: n, - rot: e.rot + e.rotSpeed, - }) - ); + o({ width: 700, height: 300, color: ve }), + n({ + font: { size: 38 }, + text: "ACHIEVEMENT UNLOCKED!", + strokeColor: Ye, + color: ve, + strokeThickness: 11, + y: 150, }), - }; - }, - render: ({ state: e }) => [ - ...e.triangles.map((e) => - r({ - fillColor: e.color, - path: [ - [-e.width, -e.height], - [e.width, -e.height], - [0, e.height], - ], - x: e.x, - y: e.y, - rotation: e.rot, - opacity: e.alpha, + Fo({ + id: "CloseButton", + text: "X", + width: 40, + height: 40, + x: 340, + y: 150, + strokeColor: Ye, + onPress: e.onClose, }), - ), - ], - }), - LE = makeCustomSprite({ - init({ props: e, device: t, preloadFiles: a, updateState: i }) { - const n = jy( - e.achievement, - { family: "Montserrat", size: 16, weight: 800 }, - 120, - ); - return ( - Promise.all([ - Jp.getUserItems("bonusLevel"), - a({ - imageFileNames: [ - ...Qs.achievementImages, - ...n - .map((e) => { - var t; - return null === (t = e.icon) || void 0 === t - ? void 0 - : t.fileName; - }) - .filter(nt), - ], - audioFileNames: Qs.achievementSfx, - }), - ]).then(([e]) => { - (t - .audio("audio/achievement/achievement-unlocked.wav") - .play(0), - i((t) => - Object.assign(Object.assign({}, t), { - loading: false, - hasSuperLevelPack: true, + n({ + font: { size: 20 }, + text: d.name.toLocaleUpperCase(), + color: Ye, + y: 110, + }), + We({ width: 577, height: 150, color: Ce }), + We({ width: 557, height: 130, color: ve }), + n({ + font: { size: 20 }, + text: "REWARDS", + strokeColor: Ye, + color: ve, + strokeThickness: 5, + y: 72, + }), + ...g.flatMap((e, t) => { + const a = + 1 === g.length + ? 0 + : (2 === g.length ? -70 : -140) + 140 * t; + return [ + e.icon + ? l({ + fileName: e.icon.fileName, + width: e.icon.width, + height: e.icon.height, + x: a, + y: 30, + }) + : null, + ...e.lines.map((e, t) => + n({ + font: { size: 16, weight: 800 }, + text: e, + color: Ye, + x: a, + y: -10 - 16 * t, }), - )); + ), + ]; }), - { - loading: true, - showModal: "none", - arrowX: 0, - collected: e.achievement.rewards.collected, - rewards: n, - hasSuperLevelPack: false, - } - ); - }, - loop: ({ state: e }) => - Object.assign(Object.assign({}, e), { - arrowX: e.arrowX > 10 ? -10 : e.arrowX + 0.3, - }), - render({ - props: e, - state: t, - updateState: a, - getContext: i, - device: s, - }) { - const { online: c } = i(Se), - { achievement: d, hasPass: u, didBuyPass: h } = e, - { - showModal: p, - rewards: g, - hasSuperLevelPack: m, - collected: f, - } = t, - y = s.size.width + 2 * s.size.widthMargin, - E = s.size.height + 2 * s.size.heightMargin; - return t.loading - ? [] - : [ - Clickable({ - id: "BlockBehind", - width: y, - height: E, - sprites: () => [], - onPress: () => null, - }), - o({ width: 700, height: 300, color: ve }), - n({ - font: { size: 38 }, - text: "ACHIEVEMENT UNLOCKED!", - strokeColor: Ye, - color: ve, - strokeThickness: 11, - y: 150, - }), - Fo({ - id: "CloseButton", - text: "X", - width: 40, - height: 40, - x: 340, - y: 150, - strokeColor: Ye, - onPress: e.onClose, - }), - n({ - font: { size: 20 }, - text: d.name.toLocaleUpperCase(), - color: Ye, - y: 110, - }), - We({ width: 577, height: 150, color: Ce }), - We({ width: 557, height: 130, color: ve }), - n({ - font: { size: 20 }, - text: "REWARDS", - strokeColor: Ye, - color: ve, - strokeThickness: 5, - y: 72, - }), - ...g.flatMap((e, t) => { - const a = - 1 === g.length - ? 0 - : (2 === g.length ? -70 : -140) + 140 * t; - return [ - e.icon - ? l({ - fileName: e.icon.fileName, - width: e.icon.width, - height: e.icon.height, - x: a, - y: 30, - }) - : null, - ...e.lines.map((e, t) => - n({ - font: { size: 16, weight: 800 }, - text: e, - color: Ye, - x: a, - y: -10 - 16 * t, - }), - ), - ]; - }), - ...(("levelPack" === d.category ? m : u) - ? [ - f - ? n({ - text: - "loading" === f - ? localize("LOADING") - : localize("COLLECTED!"), - color: Ye, - font: { size: 16 }, - x: zu.hasIAP() ? 130 : 0, - y: -130, - }) - : Fo({ - id: "CollectButton", - text: localize("COLLECT"), - width: 120, - height: 60, - x: zu.hasIAP() ? 130 : 0, - y: -130, - strokeColor: Ye, - onPress: () => { - Jp.saveEncryptedStorage(s.now, { - ownedItems: d.rewards.items, - }); - return; - (bp - .collectAchievementRewards(c.backend, d) - .then( - ({ items: e, balance: t }) => ( - c.updateBlocksBalance(t), - Jp.saveEncryptedStorage(s.now, { - ownedItems: e, - }) - ), - ) - .then(() => { - (s - .audio( - "audio/achievement/rewards-collect.wav", - ) - .play(0), - a((e) => - Object.assign(Object.assign({}, e), { - collected: true, - }), - )); - }) - .catch(() => { - a((e) => - Object.assign(Object.assign({}, e), { - collected: false, - }), - ); - }), - a((e) => - Object.assign(Object.assign({}, e), { - collected: "loading", - }), - )); - }, - }), - ] - : [ - l({ - fileName: "images/achievement/rewards-hidden.png", - width: 577, - height: 167, - y: 8, - }), - n({ - font: { size: 15, weight: 800 }, - text: "COLLECT YOUR REWARDS WITH", - color: Ye, - x: -120, - y: -112, - }), - n({ - font: { size: 15, weight: 800 }, - text: "THE ACHIEVEMENT PASS!", - color: Ye, - x: -120, - y: -128, - }), - r({ - path: [ - [-8, 12], - [8, 0], - [-8, -12], - [-8, 12], - ], - fillColor: Ye, - x: 30 + Math.abs(t.arrowX), - y: -120, - }), - Fo({ - id: "GetButton", - text: "GET IT NOW", - width: 120, - height: 60, - x: 130, - y: -130, - strokeColor: Ye, - onPress: () => { + ...(("levelPack" === d.category ? m : u) + ? [ + f + ? n({ + text: + "loading" === f + ? localize("LOADING") + : localize("COLLECTED!"), + color: Ye, + font: { size: 16 }, + x: zu.hasIAP() ? 130 : 0, + y: -130, + }) + : Fo({ + id: "CollectButton", + text: localize("COLLECT"), + width: 120, + height: 60, + x: zu.hasIAP() ? 130 : 0, + y: -130, + strokeColor: Ye, + onPress: () => { + Jp.saveEncryptedStorage(s.now, { + ownedItems: d.rewards.items, + }); + return; + (bp + .collectAchievementRewards(c.backend, d) + .then( + ({ items: e, balance: t }) => ( + c.updateBlocksBalance(t), + Jp.saveEncryptedStorage(s.now, { + ownedItems: e, + }) + ), + ) + .then(() => { + (s + .audio( + "audio/achievement/rewards-collect.wav", + ) + .play(0), + a((e) => + Object.assign(Object.assign({}, e), { + collected: true, + }), + )); + }) + .catch(() => { a((e) => Object.assign(Object.assign({}, e), { - showModal: "buyPass", + collected: false, }), ); - }, - }), - ]), - "buyPass" === p - ? Vy({ - id: "BuyPassModal", - closeMenu: () => { + }), a((e) => Object.assign(Object.assign({}, e), { - showModal: "none", + collected: "loading", }), - ); - }, - didBuy: h, - }) - : null, - ]; - }, - }), - DE = makeCustomSprite({ - render({ props: e }) { - const { onAccept: t } = e; - return [ - We({ - width: 400, - height: 300, - color: ve, - strokeColor: Ye, - strokeThickness: 8, - }), - n({ - text: "PLEASE CONFIRM YOU AGREE TO OUR", - font: { size: 15 }, - color: Be, - y: 100, - }), - Fo({ - id: "TC", - width: 180, - height: 40, - text: "TERMS OF SERVICE", - darkBg: true, - darkText: true, - onPress: () => { - zu.openLink("./terms-of-service.html"); - }, - y: 40, - }), - Fo({ - id: "Priv", - width: 180, - height: 40, - text: "PRIVACY POLICY", - darkBg: true, - darkText: true, - onPress: () => { - zu.openLink("./privacy-policy.html"); - }, - y: -10, - }), - Fo({ - id: "Accept", - width: 120, - height: 60, - text: "ACCEPT", - darkBg: true, - onPress: t, - y: -100, - }), - ]; - }, - }), - BE = makeSprite({ - init: ({ getState: e, preloadFiles: t, props: a, device: i }) => ({ - spineContext: ("string" == typeof a.level - ? Hf(a.level) - : Promise.resolve(a.level) - ) - .then((e) => { - var n; - return Xf( - e, - a.playerSkin, - a.removeCheckpoints, - t, - i.timer.start, - a.animationContext, - null === (n = a.boss) || void 0 === n - ? void 0 - : n.fileNames, - ); - }) - .then(([t, i]) => { - const n = a.boss, - s = e(); - return ( - (s.level = t), - (s.spineContext = { - animationRenderer: a.animationRenderer, - animationAssets: i, + )); + }, + }), + ] + : [ + l({ + fileName: "images/achievement/rewards-hidden.png", + width: 577, + height: 167, + y: 8, }), - n && - ((s.level.boss = n), - (s.level.layout = n.overrideMovement - ? t.layout - : Ca.addBlocksFlat(t.layout))), - i - ); - }), - level: null, - backToMenu: (e) => { - (a.world.number > 2 && - e && - Jp.getLocal(i.storage).then((e) => { - e.data.hasAskedForReview || - (zu.requestReview(), + n({ + font: { size: 15, weight: 800 }, + text: "COLLECT YOUR REWARDS WITH", + color: Ye, + x: -120, + y: -112, + }), + n({ + font: { size: 15, weight: 800 }, + text: "THE ACHIEVEMENT PASS!", + color: Ye, + x: -120, + y: -128, + }), + r({ + path: [ + [-8, 12], + [8, 0], + [-8, -12], + [-8, 12], + ], + fillColor: Ye, + x: 30 + Math.abs(t.arrowX), + y: -120, + }), + Fo({ + id: "GetButton", + text: "GET IT NOW", + width: 120, + height: 60, + x: 130, + y: -130, + strokeColor: Ye, + onPress: () => { + a((e) => + Object.assign(Object.assign({}, e), { + showModal: "buyPass", + }), + ); + }, + }), + ]), + "buyPass" === p + ? Vy({ + id: "BuyPassModal", + closeMenu: () => { + a((e) => + Object.assign(Object.assign({}, e), { + showModal: "none", + }), + ); + }, + didBuy: h, + }) + : null, + ]; + }, + }), + DE = makeCustomSprite({ + render({ props: e }) { + const { onAccept: t } = e; + return [ + We({ + width: 400, + height: 300, + color: ve, + strokeColor: Ye, + strokeThickness: 8, + }), + n({ + text: "PLEASE CONFIRM YOU AGREE TO OUR", + font: { size: 15 }, + color: Be, + y: 100, + }), + Fo({ + id: "TC", + width: 180, + height: 40, + text: "TERMS OF SERVICE", + darkBg: true, + darkText: true, + onPress: () => { + zu.openLink("./terms-of-service.html"); + }, + y: 40, + }), + Fo({ + id: "Priv", + width: 180, + height: 40, + text: "PRIVACY POLICY", + darkBg: true, + darkText: true, + onPress: () => { + zu.openLink("./privacy-policy.html"); + }, + y: -10, + }), + Fo({ + id: "Accept", + width: 120, + height: 60, + text: "ACCEPT", + darkBg: true, + onPress: t, + y: -100, + }), + ]; + }, + }), + BE = makeSprite({ + init: ({ getState: e, preloadFiles: t, props: a, device: i }) => ({ + spineContext: ("string" == typeof a.level + ? Hf(a.level) + : Promise.resolve(a.level) + ) + .then((e) => { + var n; + return Xf( + e, + a.playerSkin, + a.removeCheckpoints, + t, + i.timer.start, + a.animationContext, + null === (n = a.boss) || void 0 === n + ? void 0 + : n.fileNames, + ); + }) + .then(([t, i]) => { + const n = a.boss, + s = e(); + return ( + (s.level = t), + (s.spineContext = { + animationRenderer: a.animationRenderer, + animationAssets: i, + }), + n && + ((s.level.boss = n), + (s.level.layout = n.overrideMovement + ? t.layout + : Ca.addBlocksFlat(t.layout))), + i + ); + }), + level: null, + backToMenu: (e) => { + (a.world.number > 2 && + e && + Jp.getLocal(i.storage).then((e) => { + e.data.hasAskedForReview || + (zu.requestReview(), Jp.saveLocal(i.storage, i.alert, i.now, { hasAskedForReview: true, })); - }), - e && a.world.isEndOfGame - ? a.updateView({ - type: "menu", - menuView: { - type: "credits", - endOfGame: a.world.isEndOfGame, - }, - }) - : a.updateView({ - type: "menu", - menuView: { - type: "levels", - worldsView: { - type: "inWorld", - world: a.world.number, - backToWorld: a.world.number || 1, - }, - }, - })); - }, - didStart: (t, i) => { - const n = e(); - !i && - n.level && - Jl(a.world.withCheckpoints, a.world.number, n.level, t); - }, - onReachedCheckpoint: (t, i, n) => { - const s = e(); - s.level && - (Kl( + }), + e && a.world.isEndOfGame + ? a.updateView({ + type: "menu", + menuView: { + type: "credits", + endOfGame: a.world.isEndOfGame, + }, + }) + : a.updateView({ + type: "menu", + menuView: { + type: "levels", + worldsView: { + type: "inWorld", + world: a.world.number, + backToWorld: a.world.number || 1, + }, + }, + })); + }, + didStart: (t, i) => { + const n = e(); + !i && + n.level && + Jl(a.world.withCheckpoints, a.world.number, n.level, t); + }, + onReachedCheckpoint: (t, i, n) => { + const s = e(); + s.level && + (Kl( + a.world.withCheckpoints, + a.world.number, + s.level, + n - 1, + i, + ), + t || + Jl( a.world.withCheckpoints, a.world.number, s.level, - n - 1, - i, - ), - t || - Jl( - a.world.withCheckpoints, - a.world.number, - s.level, - n + 1, - )); - }, - }), - render: ({ props: e, state: t }) => [ - conditional( - () => !t.level || "then" in t.spineContext, - () => [ - c({ - text: `${localize("LOADING")}...`, - font: { size: 15 }, - color: ve, - }), - ], - () => [ - Se.Single({ - context: () => e.globalContext, - sprites: [ - Ws.Single({ - context: () => t.spineContext, - sprites: [ - vf.Single( - { - level: t.level, - startState: e.world.startState, - hasCheckpoints: e.world.withCheckpoints, - maxFrame: e.world.maxFrame, - world: e.world, - backToMenu: t.backToMenu, - didStart: t.didStart, - onReachedCheckpoint: t.onReachedCheckpoint, - playerSkin: - "default" === e.playerSkin.fileName - ? t.level.layout.properties.theme.player - : e.playerSkin, - }, - (a) => { - ((a.level = t.level), - (a.startState = e.world.startState), - (a.hasCheckpoints = e.world.withCheckpoints), - (a.maxFrame = e.world.maxFrame), - (a.world = e.world), - (a.backToMenu = t.backToMenu), - (a.didStart = t.didStart), - (a.onReachedCheckpoint = - t.onReachedCheckpoint)); - }, - ), - ], - }), - ], - }), - ], - ), - ], - cleanup({ state: e }) { - "then" in e.spineContext - ? e.spineContext.then(Gs) - : Gs(e.spineContext.animationAssets); + n + 1, + )); }, }), - FE = makeSprite({ - init: ({ getState: e, preloadFiles: t, props: a, device: i }) => ({ - spineContext: Xf( - a.level, - a.playerSkin, - false, - t, - i.timer.start, - a.animationContext, - a.level.boss ? a.level.boss.fileNames : null, - ).then( - ([t, i]) => ( - (e().spineContext = { - animationRenderer: a.animationRenderer, - animationAssets: i, - }), - i - ), - ), - backToMenu: () => { - a.updateView({ type: "menu", menuView: { type: "editor" } }); - }, - }), - render: ({ props: e, state: t }) => [ - conditional( - () => "then" in t.spineContext, - () => [ - c({ - text: `${localize("LOADING")}...`, - font: { size: 15 }, - color: ve, - }), - ], - () => [ - Se.Single({ - context: () => e.globalContext, - sprites: [ - Ws.Single({ - context: () => t.spineContext, - sprites: [ - vf.Single({ - level: e.level, + render: ({ props: e, state: t }) => [ + conditional( + () => !t.level || "then" in t.spineContext, + () => [ + c({ + text: `${localize("LOADING")}...`, + font: { size: 15 }, + color: ve, + }), + ], + () => [ + Se.Single({ + context: () => e.globalContext, + sprites: [ + Ws.Single({ + context: () => t.spineContext, + sprites: [ + vf.Single( + { + level: t.level, + startState: e.world.startState, + hasCheckpoints: e.world.withCheckpoints, + maxFrame: e.world.maxFrame, + world: e.world, backToMenu: t.backToMenu, + didStart: t.didStart, + onReachedCheckpoint: t.onReachedCheckpoint, playerSkin: "default" === e.playerSkin.fileName - ? e.level.layout.properties.theme.player + ? t.level.layout.properties.theme.player : e.playerSkin, - }), - ], - }), - ], - }), - ], + }, + (a) => { + ((a.level = t.level), + (a.startState = e.world.startState), + (a.hasCheckpoints = e.world.withCheckpoints), + (a.maxFrame = e.world.maxFrame), + (a.world = e.world), + (a.backToMenu = t.backToMenu), + (a.didStart = t.didStart), + (a.onReachedCheckpoint = + t.onReachedCheckpoint)); + }, + ), + ], + }), + ], + }), + ], + ), + ], + cleanup({ state: e }) { + "then" in e.spineContext + ? e.spineContext.then(Gs) + : Gs(e.spineContext.animationAssets); + }, + }), + FE = makeSprite({ + init: ({ getState: e, preloadFiles: t, props: a, device: i }) => ({ + spineContext: Xf( + a.level, + a.playerSkin, + false, + t, + i.timer.start, + a.animationContext, + a.level.boss ? a.level.boss.fileNames : null, + ).then( + ([t, i]) => ( + (e().spineContext = { + animationRenderer: a.animationRenderer, + animationAssets: i, + }), + i ), - ], - cleanup({ state: e }) { - "then" in e.spineContext - ? e.spineContext.then(Gs) - : Gs(e.spineContext.animationAssets); + ), + backToMenu: () => { + a.updateView({ type: "menu", menuView: { type: "editor" } }); }, - }); - var YE = function (e, t, a, i) { - return new (a || (a = Promise))(function (n, s) { - function o(e) { - try { - l(i.next(e)); - } catch (e) { - s(e); - } - } - function r(e) { - try { - l(i.throw(e)); - } catch (e) { - s(e); - } + }), + render: ({ props: e, state: t }) => [ + conditional( + () => "then" in t.spineContext, + () => [ + c({ + text: `${localize("LOADING")}...`, + font: { size: 15 }, + color: ve, + }), + ], + () => [ + Se.Single({ + context: () => e.globalContext, + sprites: [ + Ws.Single({ + context: () => t.spineContext, + sprites: [ + vf.Single({ + level: e.level, + backToMenu: t.backToMenu, + playerSkin: + "default" === e.playerSkin.fileName + ? e.level.layout.properties.theme.player + : e.playerSkin, + }), + ], + }), + ], + }), + ], + ), + ], + cleanup({ state: e }) { + "then" in e.spineContext + ? e.spineContext.then(Gs) + : Gs(e.spineContext.animationAssets); + }, + }); + var YE = function (e, t, a, i) { + return new (a || (a = Promise))(function (n, s) { + function o(e) { + try { + l(i.next(e)); + } catch (e) { + s(e); } - function l(e) { - var t; - e.done - ? n(e.value) - : ((t = e.value), - t instanceof a - ? t - : new a(function (e) { - e(t); - })).then(o, r); + } + function r(e) { + try { + l(i.throw(e)); + } catch (e) { + s(e); } - l((i = i.apply(e, t || [])).next()); - }); - }; - const UE = { - dimensions: "scale-up", - nativeSpriteMap: { - TextInput: k, - PinchRecogniser: Gr, - Spine: { - create: () => {}, - loop: ({ - props: { - animationRenderer: e, - runtime: { skeleton: t }, - }, - utils: a, - }) => { - e( - t, - a.size.width + 2 * a.size.widthMargin, - a.size.height + 2 * a.size.heightMargin, - a.isLastFrame, - ); - }, - cleanup: () => {}, + } + function l(e) { + var t; + e.done + ? n(e.value) + : ((t = e.value), + t instanceof a + ? t + : new a(function (e) { + e(t); + })).then(o, r); + } + l((i = i.apply(e, t || [])).next()); + }); + }; + const UE = { + dimensions: "scale-up", + nativeSpriteMap: { + TextInput: k, + PinchRecogniser: Gr, + Spine: { + create: () => { }, + loop: ({ + props: { + animationRenderer: e, + runtime: { skeleton: t }, }, - SpineWithRuntime: Xs, - ShaderBg: createShaderBg, + utils: a, + }) => { + e( + t, + a.size.width + 2 * a.size.widthMargin, + a.size.height + 2 * a.size.heightMargin, + a.isLastFrame, + ); }, - imageResolution: 3, - maxPixels: 2e6, + cleanup: () => { }, }, - jE = { - id: "Game", - size: { - width: 750, - height: 375, - maxWidthMargin: 100, - maxHeightMargin: 150, - }, - defaultFont: { family: "Montserrat", size: 10, weight: 900 }, - backgroundColor: Ue, + SpineWithRuntime: Xs, + ShaderBg: createShaderBg, + }, + imageResolution: 3, + maxPixels: 2e6, + }, + jE = { + id: "Game", + size: { + width: 750, + height: 375, + maxWidthMargin: 100, + maxHeightMargin: 150, }, - GE = window.onerror; - window.onerror = (e, t, a, i, n) => { - var s, o; - (Ql( - null !== - (o = - null !== (s = null == n ? void 0 : n.stack) && void 0 !== s - ? s - : null == n - ? void 0 - : n.message) && void 0 !== o - ? o - : String(e), - ), - null == GE || GE(e, t, a, i, n)); - }; - const VE = makeCustomSprite({ - init({ updateState: e, device: t, preloadFiles: a, getState: i }) { - const n = xE({ - save: (a, i) => { - (Jp.saveLocal(t.storage, t.alert, t.now, { auth: i }), - e( - (i) => ( - HE(e, t), - Object.assign(Object.assign({}, i), { - accountState: a, - view: - "loading" === i.view.type - ? { type: "menu", menuView: { type: "main" } } - : i.view, - }) - ), - )); - }, - error: (e) => { - "offline" === i().accountState.type || t.alert.ok(e); - }, - syncProfile: (a, i, n, s, o) => - YE(this, void 0, void 0, function* () { - const [r, l, c] = yield Promise.all([ - Jp.getAccount(t.storage, null, t.alert), - Jp.getOfflineRequests(t.storage), - bp.syncProfile(n), - ]), - { account: d, levels: u, attributes: h } = c; - e( - (a) => ( - HE(e, t), - Object.assign(Object.assign({}, a), { - attributes: h, - playerSkin: i, - }) - ), - ); - let { ownedItems: p } = c, - g = r.data.settings; - const m = yield Jp.saveEncryptedStorage(t.now, { - ownedItems: p, - playerSkin: i, - }); - if ( - (l.length > 0 && - (yield Promise.all([ - ...l.map((a) => - bp - .completedLevel( - n, - a.levelFileName, - a.isCheckpoints, - a.collectibles, - a.highScore, - ) - .then(({ hasPass: a, achievements: i }) => { - i.forEach( - ({ justUnlocked: i, achievement: n }) => { - i && - e( - (i) => ( - HE(e, t), - Object.assign(Object.assign({}, i), { - hasAchievementPass: true, - achievementModalQueue: [ - ...i.achievementModalQueue, - n, - ], - }) - ), - ); - }, - ); - }) - .catch((e) => { - console.error(e); - }), - ), - Jp.clearOfflineRequests(t.storage), - ])), - m.spentItemDefIds.length > 0) - ) { - for (const e of m.spentItemDefIds) { - const t = p.find((t) => t.defId === e); - if (!t || !kp.isBoosterItem(t)) continue; - const a = yield bp.useItem(n, t).catch((e) => { - console.error("Failed to use item", e); - }); - a && (p = kp.useUpOneBooster(a, p)); - } - yield Jp.saveEncryptedStorage(t.now, { - ownedItems: p, - spentItemDefIds: [], - }); - } - if (("anon" === s.type || "none" === s.type) && !o) - return ( - e( - (a) => ( - HE(e, t), - Object.assign(Object.assign({}, a), { - view: - "loading" === a.view.type - ? { type: "menu", menuView: { type: "main" } } - : a.view, - settings: g, + defaultFont: { family: "Montserrat", size: 10, weight: 900 }, + backgroundColor: Ue, + }, + GE = window.onerror; + window.onerror = (e, t, a, i, n) => { + var s, o; + (Ql( + null !== + (o = + null !== (s = null == n ? void 0 : n.stack) && void 0 !== s + ? s + : null == n + ? void 0 + : n.message) && void 0 !== o + ? o + : String(e), + ), + null == GE || GE(e, t, a, i, n)); + }; + const VE = makeCustomSprite({ + init({ updateState: e, device: t, preloadFiles: a, getState: i }) { + const n = xE({ + save: (a, i) => { + (Jp.saveLocal(t.storage, t.alert, t.now, { auth: i }), + e( + (i) => ( + HE(e, t), + Object.assign(Object.assign({}, i), { + accountState: a, + view: + "loading" === i.view.type + ? { type: "menu", menuView: { type: "main" } } + : i.view, + }) + ), + )); + }, + error: (e) => { + "offline" === i().accountState.type || t.alert.ok(e); + }, + syncProfile: (a, i, n, s, o) => + YE(this, void 0, void 0, function* () { + const [r, l, c] = yield Promise.all([ + Jp.getAccount(t.storage, null, t.alert), + Jp.getOfflineRequests(t.storage), + bp.syncProfile(n), + ]), + { account: d, levels: u, attributes: h } = c; + e( + (a) => ( + HE(e, t), + Object.assign(Object.assign({}, a), { + attributes: h, + playerSkin: i, + }) + ), + ); + let { ownedItems: p } = c, + g = r.data.settings; + const m = yield Jp.saveEncryptedStorage(t.now, { + ownedItems: p, + playerSkin: i, + }); + if ( + (l.length > 0 && + (yield Promise.all([ + ...l.map((a) => + bp + .completedLevel( + n, + a.levelFileName, + a.isCheckpoints, + a.collectibles, + a.highScore, + ) + .then(({ hasPass: a, achievements: i }) => { + i.forEach( + ({ justUnlocked: i, achievement: n }) => { + i && + e( + (i) => ( + HE(e, t), + Object.assign(Object.assign({}, i), { + hasAchievementPass: true, + achievementModalQueue: [ + ...i.achievementModalQueue, + n, + ], + }) + ), + ); + }, + ); }) - ), + .catch((e) => { + console.error(e); + }), ), - a - ); - let f = Promise.resolve(), - y = Promise.resolve(); - if (o) - ((f = Jp.saveAccount( - t.storage, - null, - t.alert, - t.now, - d.data, - r.data, - )), - (y = Jp.saveAllLevels( - t.storage, - u.data.map((e) => ul(e)), - t.alert, - t.now, - )), - (g = d.data.settings)); - else { - const e = yield Jp.getSavedLevels( - t.storage, - t.now, - t.alert, - ); - if (r.dateUpdated !== d.dateUpdated) { - let e, a; - r.dateUpdated > d.dateUpdated - ? ((e = r.data), (a = d.data)) - : ((e = d.data), (a = r.data)); - const i = Iu.merge(e, a); - ((f = Promise.all([ - bp.updateAccountStorage(n, i, t.now), - Jp.saveAccount( - t.storage, - null, - t.alert, - t.now, - i, - r.data, - ), - ])), - (g = e.settings)); - } - if (e.dateUpdated !== u.dateUpdated) { - let a, i; - e.dateUpdated > u.dateUpdated - ? ((a = e.data), (i = u.data.map((e) => ul(e)))) - : ((a = u.data.map((e) => ul(e))), (i = e.data)); - const s = Yd.merge(a, i); - y = Promise.all([ - bp.updateLevelsStorage( - n, - s.map(({ level: e }) => e), - t.now, - ), - Jp.saveAllLevels(t.storage, s, t.alert, t.now), - ]); - } + Jp.clearOfflineRequests(t.storage), + ])), + m.spentItemDefIds.length > 0) + ) { + for (const e of m.spentItemDefIds) { + const t = p.find((t) => t.defId === e); + if (!t || !kp.isBoosterItem(t)) continue; + const a = yield bp.useItem(n, t).catch((e) => { + console.error("Failed to use item", e); + }); + a && (p = kp.useUpOneBooster(a, p)); } + yield Jp.saveEncryptedStorage(t.now, { + ownedItems: p, + spentItemDefIds: [], + }); + } + if (("anon" === s.type || "none" === s.type) && !o) return ( - yield Promise.all([f, y]), e( (a) => ( HE(e, t), @@ -78523,128 +78448,203 @@ var version = "v1.17.2"; ), a ); - }), - getBackend: () => - bp.getBackend(() => { - (Jp.saveLocal(t.storage, t.alert, t.now, {}), - e( - (a) => ( - HE(e, t), - Object.assign(Object.assign({}, a), { - accountState: { type: "offline" }, - view: - "loading" === a.view.type - ? { type: "menu", menuView: { type: "main" } } - : a.view, - }) + let f = Promise.resolve(), + y = Promise.resolve(); + if (o) + ((f = Jp.saveAccount( + t.storage, + null, + t.alert, + t.now, + d.data, + r.data, + )), + (y = Jp.saveAllLevels( + t.storage, + u.data.map((e) => ul(e)), + t.alert, + t.now, + )), + (g = d.data.settings)); + else { + const e = yield Jp.getSavedLevels( + t.storage, + t.now, + t.alert, + ); + if (r.dateUpdated !== d.dateUpdated) { + let e, a; + r.dateUpdated > d.dateUpdated + ? ((e = r.data), (a = d.data)) + : ((e = d.data), (a = r.data)); + const i = Iu.merge(e, a); + ((f = Promise.all([ + bp.updateAccountStorage(n, i, t.now), + Jp.saveAccount( + t.storage, + null, + t.alert, + t.now, + i, + r.data, ), - )); - }), - handleAnonAuth: (e) => bp.authenticate(e), - handleAppleAttach: (e, a, i) => - bp.attachIdentity( - e, - { type: "apple", userId: a, idToken: i }, - t.alert.okCancel, - ), - handleGoogleAttach: (e, a, i) => - bp.attachIdentity( - e, - { type: "google", id: a, idToken: i }, - t.alert.okCancel, - ), - reconnect: (e) => bp.relogin(e), - handleGoogleSignout: zu.googleSignOut, - handleSignout: bp.logout, - handleAccountDelete: bp.deleteAccount, - requestAppleAuth: Hu.appleSignIn, - requestGoogleAuth: zu.googleSignIn, - detachApple: (e, t) => - bp.detachIdentity(e, { type: "apple", userId: t }), - detachGoogle: (e, t) => - bp.detachIdentity(e, { type: "google", id: t }), - }); - Promise.all([ - Jp.getLocal(t.storage, t.alert), - Jp.getAccount(t.storage, null, t.alert), - Jp.getEncryptedStorage(), - a({ audioFileNames: Qs.globalSfx }), - ]).then(([a, i, s]) => { - a.firstTimePlaying - ? _p - .clear() - .catch((e) => { - console.error("Couldn't clear existing storage", e); - }) - .finally(() => { - e( - (a) => ( - HE(e, t), - Object.assign(Object.assign({}, a), { - view: { type: "termsConditions" }, - settings: i.data.settings, - playerSkin: s.playerSkin, - }) - ), - ); - }) - : e( - (o) => ( - $l(t.log), + ])), + (g = e.settings)); + } + if (e.dateUpdated !== u.dateUpdated) { + let a, i; + e.dateUpdated > u.dateUpdated + ? ((a = e.data), (i = u.data.map((e) => ul(e)))) + : ((a = u.data.map((e) => ul(e))), (i = e.data)); + const s = Yd.merge(a, i); + y = Promise.all([ + bp.updateLevelsStorage( + n, + s.map(({ level: e }) => e), + t.now, + ), + Jp.saveAllLevels(t.storage, s, t.alert, t.now), + ]); + } + } + return ( + yield Promise.all([f, y]), + e( + (a) => ( HE(e, t), - Object.assign(Object.assign({}, o), { - accountState: n(o.accountState, { - type: "goOnline", - auth: a.data.auth, - }), + Object.assign(Object.assign({}, a), { + view: + "loading" === a.view.type + ? { type: "menu", menuView: { type: "main" } } + : a.view, + settings: g, + }) + ), + ), + a + ); + }), + getBackend: () => + bp.getBackend(() => { + (Jp.saveLocal(t.storage, t.alert, t.now, {}), + e( + (a) => ( + HE(e, t), + Object.assign(Object.assign({}, a), { + accountState: { type: "offline" }, + view: + "loading" === a.view.type + ? { type: "menu", menuView: { type: "main" } } + : a.view, + }) + ), + )); + }), + handleAnonAuth: (e) => bp.authenticate(e), + handleAppleAttach: (e, a, i) => + bp.attachIdentity( + e, + { type: "apple", userId: a, idToken: i }, + t.alert.okCancel, + ), + handleGoogleAttach: (e, a, i) => + bp.attachIdentity( + e, + { type: "google", id: a, idToken: i }, + t.alert.okCancel, + ), + reconnect: (e) => bp.relogin(e), + handleGoogleSignout: zu.googleSignOut, + handleSignout: bp.logout, + handleAccountDelete: bp.deleteAccount, + requestAppleAuth: Hu.appleSignIn, + requestGoogleAuth: zu.googleSignIn, + detachApple: (e, t) => + bp.detachIdentity(e, { type: "apple", userId: t }), + detachGoogle: (e, t) => + bp.detachIdentity(e, { type: "google", id: t }), + }); + Promise.all([ + Jp.getLocal(t.storage, t.alert), + Jp.getAccount(t.storage, null, t.alert), + Jp.getEncryptedStorage(), + a({ audioFileNames: Qs.globalSfx }), + ]).then(([a, i, s]) => { + a.firstTimePlaying + ? _p + .clear() + .catch((e) => { + console.error("Couldn't clear existing storage", e); + }) + .finally(() => { + e( + (a) => ( + HE(e, t), + Object.assign(Object.assign({}, a), { + view: { type: "termsConditions" }, settings: i.data.settings, playerSkin: s.playerSkin, }) ), ); - }); - const { renderer: s, context: o } = Bs(); - return { - view: { type: "loading" }, - accountState: { type: "init" }, - settings: null, - attributes: { notifySuperLevelPack: false }, - accountStateMachine: n, - onPressQueue: [], - onScrollQueue: [], - hasAchievementPass: true, - achievementModalQueue: [], - animationContext: o, - animationRenderer: s, - globalContextVal: null, - updateView: (t) => { - e((e) => Object.assign(Object.assign({}, e), { view: t })); - }, - isFirstTimePlaying: false, - playerSkin: Wt.default, - }; - }, - loop: ({ state: e }) => { - var n = {}; - n = - e && e.onPressQueue.length > 0 - ? (e.onPressQueue[e.onPressQueue.length - 1](), - Object.assign(Object.assign({}, e), { onPressQueue: [] })) - : e; - n = - n && n.onScrollQueue.length > 0 - ? (n.onScrollQueue[n.onScrollQueue.length - 1](), - Object.assign(Object.assign({}, n), { onScrollQueue: [] })) - : n; - return n; - }, - render({ state: e, device: t, updateState: a }) { - var i; - if ("loading" === e.view.type || !e.globalContextVal) - return [ - ME({ id: "MenuBackground" }), - "signingIn" === e.accountState.type && e.globalContextVal - ? /*Se.Sprite({ + }) + : e( + (o) => ( + $l(t.log), + HE(e, t), + Object.assign(Object.assign({}, o), { + accountState: n(o.accountState, { + type: "goOnline", + auth: a.data.auth, + }), + settings: i.data.settings, + playerSkin: s.playerSkin, + }) + ), + ); + }); + const { renderer: s, context: o } = Bs(); + return { + view: { type: "loading" }, + accountState: { type: "init" }, + settings: null, + attributes: { notifySuperLevelPack: false }, + accountStateMachine: n, + onPressQueue: [], + onScrollQueue: [], + hasAchievementPass: true, + achievementModalQueue: [], + animationContext: o, + animationRenderer: s, + globalContextVal: null, + updateView: (t) => { + e((e) => Object.assign(Object.assign({}, e), { view: t })); + }, + isFirstTimePlaying: false, + playerSkin: Wt.default, + }; + }, + loop: ({ state: e }) => { + var n = {}; + n = + e && e.onPressQueue.length > 0 + ? (e.onPressQueue[e.onPressQueue.length - 1](), + Object.assign(Object.assign({}, e), { onPressQueue: [] })) + : e; + n = + n && n.onScrollQueue.length > 0 + ? (n.onScrollQueue[n.onScrollQueue.length - 1](), + Object.assign(Object.assign({}, n), { onScrollQueue: [] })) + : n; + return n; + }, + render({ state: e, device: t, updateState: a }) { + var i; + if ("loading" === e.view.type || !e.globalContextVal) + return [ + ME({ id: "MenuBackground" }), + "signingIn" === e.accountState.type && e.globalContextVal + ? /*Se.Sprite({ context: e.globalContextVal, sprites: [ n({ @@ -78678,654 +78678,653 @@ var version = "v1.17.2"; }), ], })*/ a((e) => - Object.assign(Object.assign({}, e), { - accountState: { type: "offline" }, - view: { - type: "menu", - menuView: { type: "main" }, - }, - }), - ) - : n({ - text: `${localize("LOADING")}...`, - font: { size: 15 }, - color: ve, - }), - ]; - if ("termsConditions" === e.view.type) { - ($l(t.log), - a( - (e) => ( - HE(a, t), - Object.assign(Object.assign({}, e), { - accountState: e.accountStateMachine(e.accountState, { - type: "goOnline", - auth: vu.getDefaultData().auth, - }), - view: { type: "loading" }, - isFirstTimePlaying: true, - }) - ), - )); - return []; - } - /*return [ - Se.Sprite({ - context: e.globalContextVal, - sprites: [ - ME({ id: "MenuBackground" }), - DE({ - id: "TermsConditionsModal", - onAccept: () => { - $l(t.log), - a( - (e) => ( - HE(a, t), - Object.assign(Object.assign({}, e), { - accountState: e.accountStateMachine( - e.accountState, - { - type: "goOnline", - auth: vu.getDefaultData().auth, - } - ), - view: { type: "loading" }, - isFirstTimePlaying: true, - }) - ) - ); - }, - }), - ], + Object.assign(Object.assign({}, e), { + accountState: { type: "offline" }, + view: { + type: "menu", + menuView: { type: "main" }, + }, + }), + ) + : n({ + text: `${localize("LOADING")}...`, + font: { size: 15 }, + color: ve, }), - ];*/ - const s = - e.achievementModalQueue.length > 0 - ? Uo({ - id: `AchievementModal-${ - (null === (i = e.achievementModalQueue[0]) || - void 0 === i - ? void 0 - : i.id) || "" - }`, - initShow: false, - shouldShow: true, - sprite: (i) => [ - LE({ - id: "Modal", - achievement: e.achievementModalQueue[0], - hasPass: e.hasAchievementPass, - didBuyPass: () => { - a( - (e) => ( - HE(a, t), - Object.assign(Object.assign({}, e), { - hasAchievementPass: true, - }) - ), - ); - }, - onClose: () => { - a( - (e) => ( - HE(a, t), - Object.assign(Object.assign({}, e), { - achievementModalQueue: - e.achievementModalQueue.slice(1), - }) - ), - ); - }, - opacity: i, - }), - ], - }) - : null, - o = e.playerSkin; - if ("menu" === e.view.type) - return [ - Se.Sprite({ - context: e.globalContextVal, - sprites: [ - ME({ id: "MenuBackground" }), - tE({ - id: "Menu", - accountState: e.accountState, - view: e.view.menuView, - updateView: (e) => { - a((t) => - Object.assign(Object.assign({}, t), { - view: { type: "menu", menuView: e }, - }), - ); - }, - playerSkin: o, - updateParty: (e) => { + ]; + if ("termsConditions" === e.view.type) { + ($l(t.log), + a( + (e) => ( + HE(a, t), + Object.assign(Object.assign({}, e), { + accountState: e.accountStateMachine(e.accountState, { + type: "goOnline", + auth: vu.getDefaultData().auth, + }), + view: { type: "loading" }, + isFirstTimePlaying: true, + }) + ), + )); + return []; + } + /*return [ + Se.Sprite({ + context: e.globalContextVal, + sprites: [ + ME({ id: "MenuBackground" }), + DE({ + id: "TermsConditionsModal", + onAccept: () => { + $l(t.log), a( - (i) => ( + (e) => ( HE(a, t), - "loggedIn" === i.accountState.type - ? i.accountState.party && e && 0 === e.maxMembers - ? Object.assign(Object.assign({}, i), { - accountState: Object.assign( - Object.assign({}, i.accountState), - { - party: Object.assign( - Object.assign({}, e), - { - maxMembers: - i.accountState.party.maxMembers, - }, - ), - }, - ), - }) - : Object.assign(Object.assign({}, i), { - accountState: Object.assign( - Object.assign({}, i.accountState), - { party: e }, - ), - }) - : i - ), + Object.assign(Object.assign({}, e), { + accountState: e.accountStateMachine( + e.accountState, + { + type: "goOnline", + auth: vu.getDefaultData().auth, + } + ), + view: { type: "loading" }, + isFirstTimePlaying: true, + }) + ) ); - }, - updatePlayerName: (i) => - YE(this, void 0, void 0, function* () { - (a( - (e) => ( - HE(a, t), - "loggedIn" !== e.accountState.type - ? e - : Object.assign(Object.assign({}, e), { - accountState: Object.assign( - Object.assign({}, e.accountState), + }, + }), + ], + }), + ];*/ + const s = + e.achievementModalQueue.length > 0 + ? Uo({ + id: `AchievementModal-${(null === (i = e.achievementModalQueue[0]) || + void 0 === i + ? void 0 + : i.id) || "" + }`, + initShow: false, + shouldShow: true, + sprite: (i) => [ + LE({ + id: "Modal", + achievement: e.achievementModalQueue[0], + hasPass: e.hasAchievementPass, + didBuyPass: () => { + a( + (e) => ( + HE(a, t), + Object.assign(Object.assign({}, e), { + hasAchievementPass: true, + }) + ), + ); + }, + onClose: () => { + a( + (e) => ( + HE(a, t), + Object.assign(Object.assign({}, e), { + achievementModalQueue: + e.achievementModalQueue.slice(1), + }) + ), + ); + }, + opacity: i, + }), + ], + }) + : null, + o = e.playerSkin; + if ("menu" === e.view.type) + return [ + Se.Sprite({ + context: e.globalContextVal, + sprites: [ + ME({ id: "MenuBackground" }), + tE({ + id: "Menu", + accountState: e.accountState, + view: e.view.menuView, + updateView: (e) => { + a((t) => + Object.assign(Object.assign({}, t), { + view: { type: "menu", menuView: e }, + }), + ); + }, + playerSkin: o, + updateParty: (e) => { + a( + (i) => ( + HE(a, t), + "loggedIn" === i.accountState.type + ? i.accountState.party && e && 0 === e.maxMembers + ? Object.assign(Object.assign({}, i), { + accountState: Object.assign( + Object.assign({}, i.accountState), + { + party: Object.assign( + Object.assign({}, e), { - profile: Object.assign( - Object.assign( - {}, - e.accountState.profile, - ), - { playerName: i }, - ), + maxMembers: + i.accountState.party.maxMembers, }, ), - }) - ), + }, + ), + }) + : Object.assign(Object.assign({}, i), { + accountState: Object.assign( + Object.assign({}, i.accountState), + { party: e }, + ), + }) + : i + ), + ); + }, + updatePlayerName: (i) => + YE(this, void 0, void 0, function* () { + (a( + (e) => ( + HE(a, t), + "loggedIn" !== e.accountState.type + ? e + : Object.assign(Object.assign({}, e), { + accountState: Object.assign( + Object.assign({}, e.accountState), + { + profile: Object.assign( + Object.assign( + {}, + e.accountState.profile, + ), + { playerName: i }, + ), + }, + ), + }) ), - "loggedIn" === e.accountState.type && - (yield bp.updatePlayerName( - e.accountState.backend, - i, - ))); + ), + "loggedIn" === e.accountState.type && + (yield bp.updatePlayerName( + e.accountState.backend, + i, + ))); + }), + playEditorLevel: (e) => { + a((t) => + Object.assign(Object.assign({}, t), { + view: { type: "levelEditorLevel", level: e }, + isFirstTimePlaying: false, }), - playEditorLevel: (e) => { - a((t) => - Object.assign(Object.assign({}, t), { - view: { type: "levelEditorLevel", level: e }, - isFirstTimePlaying: false, - }), - ); - }, - playWorldLevel: (e, i) => - YE(this, void 0, void 0, function* () { - let n = null, - s = false; - const { data: o } = yield Jp.getAccount( - t.storage, - null, - t.alert, - ), - r = o.levelsProgress.find( - (t) => t.levelName === e.levelName, - ); - let l; - (e.levelName === Hl.firstLevelName && - (r - ? ((n = - r.noCheckpoints.furthestFrame < 400 && - r.checkpoints.furthestFrame < 400 - ? "init" - : null), - (s = r.checkpoints.furthestFrame < 2e3)) - : ((n = "init"), (s = true))), - e.levelName === Hl.skateboardLevelName && - (n = r - ? r.noCheckpoints.furthestFrame < 400 && - r.checkpoints.furthestFrame < 400 - ? "skateboard" - : null - : "skateboard"), - i.withCheckpoints && - (l = - (null == r - ? void 0 - : r.checkpoints.lastCheckpointState) || - void 0)); - const c = null == r ? void 0 : r.bestAttempts; - let d = null; - ("overdrive" === e.levelFileName && - (i.withCheckpoints && - !(null == r ? void 0 : r.checkpoints.didFinish) && - (d = "checkpoints"), + ); + }, + playWorldLevel: (e, i) => + YE(this, void 0, void 0, function* () { + let n = null, + s = false; + const { data: o } = yield Jp.getAccount( + t.storage, + null, + t.alert, + ), + r = o.levelsProgress.find( + (t) => t.levelName === e.levelName, + ); + let l; + (e.levelName === Hl.firstLevelName && + (r + ? ((n = + r.noCheckpoints.furthestFrame < 400 && + r.checkpoints.furthestFrame < 400 + ? "init" + : null), + (s = r.checkpoints.furthestFrame < 2e3)) + : ((n = "init"), (s = true))), + e.levelName === Hl.skateboardLevelName && + (n = r + ? r.noCheckpoints.furthestFrame < 400 && + r.checkpoints.furthestFrame < 400 + ? "skateboard" + : null + : "skateboard"), + i.withCheckpoints && + (l = + (null == r + ? void 0 + : r.checkpoints.lastCheckpointState) || + void 0)); + const c = null == r ? void 0 : r.bestAttempts; + let d = null; + ("overdrive" === e.levelFileName && + (i.withCheckpoints && + !(null == r ? void 0 : r.checkpoints.didFinish) && + (d = "checkpoints"), i.withCheckpoints || - (null == r - ? void 0 - : r.noCheckpoints.didFinish) || - (d = "noCheckpoints")), - a( - (t) => ( - Object.assign(Object.assign({}, t), { - view: { - type: "level", - levelFileName: e.levelFileName, - boss: e.boss, - world: Object.assign(Object.assign({}, i), { - tutorialType: n, - showBoostersPrompt: s, - startState: l, - highScore: - (null == r ? void 0 : r.highScore) || 0, - maxFrame: e.maxFrames, - prevBestAttempts: null === c ? void 0 : c, - isEndOfGame: d, - }), - }, - isFirstTimePlaying: false, - }) - ), - )); + (null == r + ? void 0 + : r.noCheckpoints.didFinish) || + (d = "noCheckpoints")), + a( + (t) => ( + Object.assign(Object.assign({}, t), { + view: { + type: "level", + levelFileName: e.levelFileName, + boss: e.boss, + world: Object.assign(Object.assign({}, i), { + tutorialType: n, + showBoostersPrompt: s, + startState: l, + highScore: + (null == r ? void 0 : r.highScore) || 0, + maxFrame: e.maxFrames, + prevBestAttempts: null === c ? void 0 : c, + isEndOfGame: d, + }), + }, + isFirstTimePlaying: false, + }) + ), + )); + }), + playTestCase: (e) => { + a((t) => + Object.assign(Object.assign({}, t), { + view: { type: "testCase", testCase: e }, }), - playTestCase: (e) => { - a((t) => - Object.assign(Object.assign({}, t), { - view: { type: "testCase", testCase: e }, - }), - ); - }, - editLevel: (e) => { - a((t) => - Object.assign(Object.assign({}, t), { - view: { - type: "levelEditor", - level: e, - assets: { - imageFileNames: [ - ...Qs.editorImages, - ...Qs.levelImages, - ...Qs.getPlayerImages([o], []), - ...(e.level.boss - ? e.level.boss.fileNames.images - ? e.level.boss.fileNames.images - : [] - : []), - ], - imageFileNamesScaleNearestPixel: [ - ...(e.level.boss - ? e.level.boss.fileNames.pixelArtImages - ? e.level.boss.fileNames.pixelArtImages - : [] - : []), - ], - audioFileNames: [ - e.level.song.fileName, - ...Qs.levelSfx, - ...Qs.editorSfx, - ...(e.level.boss - ? e.level.boss.fileNames.audio - : []), - ], - }, - }, - isFirstTimePlaying: false, - }), - ); - }, - playOnline: ({ - url: e, - passcode: i, - profile: n, - level: s, - }) => { - a((o) => { - HE(a, t); - const r = - "loggedIn" === o.accountState.type && - null !== o.accountState.party && - o.accountState.party.ownerId === n.profileId; - return Object.assign(Object.assign({}, o), { - view: { - type: "online", - profile: n, - url: e, - passcode: i, - localLevel: s, - isPartyLeader: r, - }, - accountState: r - ? o.accountState - : Object.assign( - Object.assign({}, o.accountState), - { party: null }, - ), - isFirstTimePlaying: false, - }); - }); - }, - showStartArrows: e.isFirstTimePlaying, - }), - s, - ], - }), - ]; - if ("level" === e.view.type) { - const t = e.view.world; - return [ - BE.Single({ - id: "LoadWorldLevel", - level: e.view.levelFileName, - boss: e.view.boss, - removeCheckpoints: !t.withCheckpoints, - globalContext: e.globalContextVal, - animationContext: e.animationContext, - animationRenderer: e.animationRenderer, - world: t, - updateView: e.updateView, - playerSkin: o, - }), - null !== s - ? Se.Sprite({ context: e.globalContextVal, sprites: [s] }) - : null, - ]; - } - if ("levelEditorLevel" === e.view.type) - return [ - FE.Single({ - id: "LoadPlayLevelEditorLevel", - level: e.view.level, - globalContext: e.globalContextVal, - animationContext: e.animationContext, - animationRenderer: e.animationRenderer, - updateView: e.updateView, - playerSkin: o, - }), - null !== s - ? Se.Sprite({ context: e.globalContextVal, sprites: [s] }) - : null, - ]; - if ("online" === e.view.type) - return [ - CE.Single({ - id: "PlayOnline", - globalContextVal: e.globalContextVal, - profile: e.view.profile, - url: e.view.url, - passcode: e.view.passcode, - level: e.view.localLevel, - animationRenderer: e.animationRenderer, - animationContext: e.animationContext, - isPartyLeader: e.view.isPartyLeader, - playerSkin: o, - increaseXp: (e) => { - a( - (i) => ( - HE(a, t), - "loggedIn" !== i.accountState.type - ? i - : Object.assign(Object.assign({}, i), { - accountState: Object.assign( - Object.assign({}, i.accountState), + ); + }, + editLevel: (e) => { + a((t) => + Object.assign(Object.assign({}, t), { + view: { + type: "levelEditor", + level: e, + assets: { + imageFileNames: [ + ...Qs.editorImages, + ...Qs.levelImages, + ...Qs.getPlayerImages([o], []), + ...(e.level.boss + ? e.level.boss.fileNames.images + ? e.level.boss.fileNames.images + : [] + : []), + ], + imageFileNamesScaleNearestPixel: [ + ...(e.level.boss + ? e.level.boss.fileNames.pixelArtImages + ? e.level.boss.fileNames.pixelArtImages + : [] + : []), + ], + audioFileNames: [ + e.level.song.fileName, + ...Qs.levelSfx, + ...Qs.editorSfx, + ...(e.level.boss + ? e.level.boss.fileNames.audio + : []), + ], + }, + }, + isFirstTimePlaying: false, + }), + ); + }, + playOnline: ({ + url: e, + passcode: i, + profile: n, + level: s, + }) => { + a((o) => { + HE(a, t); + const r = + "loggedIn" === o.accountState.type && + null !== o.accountState.party && + o.accountState.party.ownerId === n.profileId; + return Object.assign(Object.assign({}, o), { + view: { + type: "online", + profile: n, + url: e, + passcode: i, + localLevel: s, + isPartyLeader: r, + }, + accountState: r + ? o.accountState + : Object.assign( + Object.assign({}, o.accountState), + { party: null }, + ), + isFirstTimePlaying: false, + }); + }); + }, + showStartArrows: e.isFirstTimePlaying, + }), + s, + ], + }), + ]; + if ("level" === e.view.type) { + const t = e.view.world; + return [ + BE.Single({ + id: "LoadWorldLevel", + level: e.view.levelFileName, + boss: e.view.boss, + removeCheckpoints: !t.withCheckpoints, + globalContext: e.globalContextVal, + animationContext: e.animationContext, + animationRenderer: e.animationRenderer, + world: t, + updateView: e.updateView, + playerSkin: o, + }), + null !== s + ? Se.Sprite({ context: e.globalContextVal, sprites: [s] }) + : null, + ]; + } + if ("levelEditorLevel" === e.view.type) + return [ + FE.Single({ + id: "LoadPlayLevelEditorLevel", + level: e.view.level, + globalContext: e.globalContextVal, + animationContext: e.animationContext, + animationRenderer: e.animationRenderer, + updateView: e.updateView, + playerSkin: o, + }), + null !== s + ? Se.Sprite({ context: e.globalContextVal, sprites: [s] }) + : null, + ]; + if ("online" === e.view.type) + return [ + CE.Single({ + id: "PlayOnline", + globalContextVal: e.globalContextVal, + profile: e.view.profile, + url: e.view.url, + passcode: e.view.passcode, + level: e.view.localLevel, + animationRenderer: e.animationRenderer, + animationContext: e.animationContext, + isPartyLeader: e.view.isPartyLeader, + playerSkin: o, + increaseXp: (e) => { + a( + (i) => ( + HE(a, t), + "loggedIn" !== i.accountState.type + ? i + : Object.assign(Object.assign({}, i), { + accountState: Object.assign( + Object.assign({}, i.accountState), + { + profile: Object.assign( + Object.assign({}, i.accountState.profile), { - profile: Object.assign( - Object.assign({}, i.accountState.profile), - { - xpPoints: - i.accountState.profile.xpPoints + e, - }, - ), + xpPoints: + i.accountState.profile.xpPoints + e, }, ), - }) - ), - ); - }, - backToMenu: () => - a((e) => - Object.assign(Object.assign({}, e), { - view: { - type: "menu", - menuView: - "loggedIn" !== e.accountState.type - ? { type: "main" } - : { type: "online" }, - }, - }), - ), - }), - null !== s - ? Se.Sprite({ context: e.globalContextVal, sprites: [s] }) - : null, - ]; - if ("testCase" === e.view.type) { - const t = void 0, - i = e.view.testCase; - return [ - Vf({ - id: "LoadTestCase", - level: i.level, - removeCheckpoints: false, - globalContext: e.globalContextVal, - animationContext: e.animationContext, - animationRenderer: e.animationRenderer, - sprites: () => [ - aE({ - id: "PlayTestCase", - testCase: i, - bpm: t, - backToMenu: () => - a((e) => - Object.assign(Object.assign({}, e), { - view: { - type: "menu", - menuView: { type: "testCases" }, }, - }), - ), + ), + }) + ), + ); + }, + backToMenu: () => + a((e) => + Object.assign(Object.assign({}, e), { + view: { + type: "menu", + menuView: + "loggedIn" !== e.accountState.type + ? { type: "main" } + : { type: "online" }, + }, }), - s, - ], - playerSkin: o, - }), - ]; - } - const r = [ - n({ - text: `${localize("LOADING")}...`, - font: { size: 15 }, - color: ve, + ), }), + null !== s + ? Se.Sprite({ context: e.globalContextVal, sprites: [s] }) + : null, ]; + if ("testCase" === e.view.type) { + const t = void 0, + i = e.view.testCase; return [ - Gf({ - id: "LevelEditorAssets", - withContext: { - spineFiles: [ - ...Qs.getThemeSpine(ca.world1), - ...(e.view.level.level.boss - ? e.view.level.level.boss.fileNames.spine || [] - : []), - ], - globalContext: e.globalContextVal, - animationContext: e.animationContext, - animationRenderer: e.animationRenderer, - }, - assets: e.view.assets, - loadingSprites: r, - sprites: [ - Df({ - id: "LevelEditorContainer", - savedLevel: e.view.level, + Vf({ + id: "LoadTestCase", + level: i.level, + removeCheckpoints: false, + globalContext: e.globalContextVal, + animationContext: e.animationContext, + animationRenderer: e.animationRenderer, + sprites: () => [ + aE({ + id: "PlayTestCase", + testCase: i, + bpm: t, backToMenu: () => - a( - (e) => ( - (window.onbeforeunload = undefined), - Object.assign(Object.assign({}, e), { - view: { - type: "menu", - menuView: { type: "editor" }, - }, - }) - ), + a((e) => + Object.assign(Object.assign({}, e), { + view: { + type: "menu", + menuView: { type: "testCases" }, + }, + }), ), - playerSkin: o, }), s, ], + playerSkin: o, }), ]; - }, - }); - function HE(e, t) { - e((a) => - a.settings - ? Object.assign(Object.assign({}, a), { - globalContextVal: { - addToOnPressQueue: (t) => { - e((e) => - Object.assign(Object.assign({}, e), { - onPressQueue: [...e.onPressQueue, t], - }), - ); - }, - addToOnScrollQueue: (t) => { - e((e) => + } + const r = [ + n({ + text: `${localize("LOADING")}...`, + font: { size: 15 }, + color: ve, + }), + ]; + return [ + Gf({ + id: "LevelEditorAssets", + withContext: { + spineFiles: [ + ...Qs.getThemeSpine(ca.world1), + ...(e.view.level.level.boss + ? e.view.level.level.boss.fileNames.spine || [] + : []), + ], + globalContext: e.globalContextVal, + animationContext: e.animationContext, + animationRenderer: e.animationRenderer, + }, + assets: e.view.assets, + loadingSprites: r, + sprites: [ + Df({ + id: "LevelEditorContainer", + savedLevel: e.view.level, + backToMenu: () => + a( + (e) => ( + (window.onbeforeunload = undefined), Object.assign(Object.assign({}, e), { - onScrollQueue: [...e.onScrollQueue, t], - }), - ); - }, - settings: a.settings, - updateSettings: (a) => { - e((i) => - i.settings - ? (HE(e, t), - Object.assign(Object.assign({}, i), { - settings: Object.assign( - Object.assign({}, i.settings), - a, - ), - })) - : i, - ); - }, - updatePlayerSkin: (a) => { - (Jp.saveEncryptedStorage(t.now, { playerSkin: a }), + view: { + type: "menu", + menuView: { type: "editor" }, + }, + }) + ), + ), + playerSkin: o, + }), + s, + ], + }), + ]; + }, + }); + function HE(e, t) { + e((a) => + a.settings + ? Object.assign(Object.assign({}, a), { + globalContextVal: { + addToOnPressQueue: (t) => { + e((e) => + Object.assign(Object.assign({}, e), { + onPressQueue: [...e.onPressQueue, t], + }), + ); + }, + addToOnScrollQueue: (t) => { + e((e) => + Object.assign(Object.assign({}, e), { + onScrollQueue: [...e.onScrollQueue, t], + }), + ); + }, + settings: a.settings, + updateSettings: (a) => { + e((i) => + i.settings + ? (HE(e, t), + Object.assign(Object.assign({}, i), { + settings: Object.assign( + Object.assign({}, i.settings), + a, + ), + })) + : i, + ); + }, + updatePlayerSkin: (a) => { + (Jp.saveEncryptedStorage(t.now, { playerSkin: a }), + e( + (i) => ( + HE(e, t), + Object.assign(Object.assign({}, i), { + playerSkin: a, + }) + ), + )); + }, + online: true + ? null + : "loggedIn" === a.accountState.type + ? { + signedInAccount: "anon" !== a.accountState.auth, + backend: a.accountState.backend, + blocksBalance: a.accountState.profile.blocksBalance, + updateBlocksBalance: (a) => { e( (i) => ( HE(e, t), - Object.assign(Object.assign({}, i), { - playerSkin: a, - }) - ), - )); - }, - online: true - ? null - : "loggedIn" === a.accountState.type - ? { - signedInAccount: "anon" !== a.accountState.auth, - backend: a.accountState.backend, - blocksBalance: a.accountState.profile.blocksBalance, - updateBlocksBalance: (a) => { - e( - (i) => ( - HE(e, t), - "loggedIn" === i.accountState.type - ? Object.assign(Object.assign({}, i), { - accountState: Object.assign( - Object.assign({}, i.accountState), - { - profile: Object.assign( - Object.assign( - {}, - i.accountState.profile, - ), - { blocksBalance: a }, - ), - }, - ), - }) - : i + "loggedIn" === i.accountState.type + ? Object.assign(Object.assign({}, i), { + accountState: Object.assign( + Object.assign({}, i.accountState), + { + profile: Object.assign( + Object.assign( + {}, + i.accountState.profile, + ), + { blocksBalance: a }, + ), + }, ), - ); - }, - attributes: a.attributes, - updateAttributes: (a) => { - e((i) => { - if ( - (HE(e, t), "loggedIn" === i.accountState.type) - ) { - const e = Object.assign( - Object.assign({}, i.attributes), - a, - ); - return ( - bp - .updateAttributes( - i.accountState.backend, - e, - ) - .catch(() => { - console.error( - "Failed to update attributes", - ); - }), - Object.assign(Object.assign({}, i), { - attributes: e, - }) + }) + : i + ), + ); + }, + attributes: a.attributes, + updateAttributes: (a) => { + e((i) => { + if ( + (HE(e, t), "loggedIn" === i.accountState.type) + ) { + const e = Object.assign( + Object.assign({}, i.attributes), + a, + ); + return ( + bp + .updateAttributes( + i.accountState.backend, + e, + ) + .catch(() => { + console.error( + "Failed to update attributes", ); - } - return i; - }); - }, + }), + Object.assign(Object.assign({}, i), { + attributes: e, + }) + ); } - : null, - sendAccountAction: (a) => { - (HE(e, t), - e((e) => - Object.assign(Object.assign({}, e), { - accountState: e.accountStateMachine( - e.accountState, - a, - ), - }), - )); - }, - achievementUnlocked: (a, i) => { - (HE(e, t), - e((e) => - Object.assign(Object.assign({}, e), { - hasAchievementPass: true, - achievementModalQueue: [ - ...e.achievementModalQueue, - a, - ], - }), - )); - }, - }, - }) - : a, - ); - } - }, - 2062: function (e, t, a) { - var i, n; - !(function (s, o) { - "use strict"; - void 0 === - (n = - "function" == + return i; + }); + }, + } + : null, + sendAccountAction: (a) => { + (HE(e, t), + e((e) => + Object.assign(Object.assign({}, e), { + accountState: e.accountStateMachine( + e.accountState, + a, + ), + }), + )); + }, + achievementUnlocked: (a, i) => { + (HE(e, t), + e((e) => + Object.assign(Object.assign({}, e), { + hasAchievementPass: true, + achievementModalQueue: [ + ...e.achievementModalQueue, + a, + ], + }), + )); + }, + }, + }) + : a, + ); + } + }, + 2062: function (e, t, a) { + var i, n; + !(function (s, o) { + "use strict"; + void 0 === + (n = + "function" == typeof (i = function () { var e = {}; function t(e, t) { @@ -79530,12 +79529,12 @@ var version = "v1.17.2"; function () { for ( var e = this.calcPoints, - a = e.length, - i = e[0].x, - s = e[0].y, - o = e[0].x, - r = e[0].y, - l = 1; + a = e.length, + i = e[0].x, + s = e[0].y, + o = e[0].x, + r = e[0].y, + l = 1; l < a; l++ ) { @@ -79553,11 +79552,11 @@ var version = "v1.17.2"; function () { for ( var e = this.calcPoints, - a = e.length, - i = 0, - n = 0, - s = 0, - o = 0; + a = e.length, + i = 0, + n = 0, + s = 0, + o = 0; o < a; o++ ) { @@ -79601,9 +79600,9 @@ var version = "v1.17.2"; function u(e, t, a) { for ( var i = Number.MAX_VALUE, - n = -Number.MAX_VALUE, - s = e.length, - o = 0; + n = -Number.MAX_VALUE, + s = e.length, + o = 0; o < s; o++ ) { @@ -79619,10 +79618,10 @@ var version = "v1.17.2"; h = d.dot(n); if ( (u(a, n, r), - u(i, n, c), - (c[0] += h), - (c[1] += h), - r[0] > c[1] || c[0] > r[1]) + u(i, n, c), + (c[0] += h), + (c[1] += h), + r[0] > c[1] || c[0] > r[1]) ) return (o.push(d), l.push(r), l.push(c), true); if (s) { @@ -79634,17 +79633,17 @@ var version = "v1.17.2"; r[1] < c[1] ? ((m = r[1] - c[0]), (s.bInA = false)) : (m = - (p = r[1] - c[0]) < (g = c[1] - r[0]) ? p : -g)) + (p = r[1] - c[0]) < (g = c[1] - r[0]) ? p : -g)) : ((s.bInA = false), r[1] > c[1] ? ((m = r[0] - c[1]), (s.aInB = false)) : (m = - (p = r[1] - c[0]) < (g = c[1] - r[0]) ? p : -g)); + (p = r[1] - c[0]) < (g = c[1] - r[0]) ? p : -g)); var f = Math.abs(m); f < s.overlap && ((s.overlap = f), - s.overlapN.copy(n), - m < 0 && s.overlapN.reverse()); + s.overlapN.copy(n), + m < 0 && s.overlapN.reverse()); } return (o.push(d), l.push(r), l.push(c), false); } @@ -79660,13 +79659,13 @@ var version = "v1.17.2"; function y(e, t, a) { for ( var i = o.pop().copy(t.pos).add(t.offset).sub(e.pos), - n = t.r, - s = n * n, - r = e.calcPoints, - l = r.length, - c = o.pop(), - d = o.pop(), - u = 0; + n = t.r, + s = n * n, + r = e.calcPoints, + l = r.length, + c = o.pop(), + d = o.pop(), + u = 0; u < l; u++ ) { @@ -79697,8 +79696,8 @@ var version = "v1.17.2"; } else if (b === f) { if ( (c.copy(e.edges[h]), - d.copy(i).sub(r[h]), - (b = p(c, d)) === g) + d.copy(i).sub(r[h]), + (b = p(c, d)) === g) ) { if ((_ = d.len()) > n) return (o.push(i), o.push(c), o.push(d), false); @@ -79713,8 +79712,8 @@ var version = "v1.17.2"; return (o.push(i), o.push(I), o.push(d), false); a && ((E = I), - (y = n - _), - (_ >= 0 || y < 2 * n) && (a.bInA = false)); + (y = n - _), + (_ >= 0 || y < 2 * n) && (a.bInA = false)); } E && a && @@ -79723,7 +79722,7 @@ var version = "v1.17.2"; } return ( a && - ((a.a = e), + ((a.a = e), (a.b = t), a.overlapV.copy(a.overlapN).scale(a.overlap)), o.push(i), @@ -79735,10 +79734,10 @@ var version = "v1.17.2"; function E(e, t, a) { for ( var i = e.calcPoints, - n = i.length, - s = t.calcPoints, - o = s.length, - r = 0; + n = i.length, + s = t.calcPoints, + o = s.length, + r = 0; r < n; r++ ) @@ -79747,7 +79746,7 @@ var version = "v1.17.2"; if (h(e.pos, t.pos, i, s, t.normals[r], a)) return false; return ( a && - ((a.a = e), + ((a.a = e), (a.b = t), a.overlapV.copy(a.overlapN).scale(a.overlap)), true @@ -79767,11 +79766,11 @@ var version = "v1.17.2"; }), (e.testCircleCircle = function (e, t, a) { var i = o - .pop() - .copy(t.pos) - .add(t.offset) - .sub(e.pos) - .sub(e.offset), + .pop() + .copy(t.pos) + .add(t.offset) + .sub(e.pos) + .sub(e.offset), n = e.r + t.r, s = n * n, r = i.len2(); @@ -79807,14 +79806,14 @@ var version = "v1.17.2"; e ); }) - ? i.call(t, a, t, e) - : i) || (e.exports = n); - })(); - }, - 6754: () => {}, - 2480: () => {}, - 818: () => {}, + ? i.call(t, a, t, e) + : i) || (e.exports = n); + })(); }, + 6754: () => { }, + 2480: () => { }, + 818: () => { }, + }, t = {}; function a(i) { var n = t[i]; @@ -79870,4 +79869,4 @@ var version = "v1.17.2"; (a.b = document.baseURI || self.location.href)); var n = a(6154); game = n; -})(); +})(); \ No newline at end of file From 5566fc4b880187d172cb184abf83323e15f8e995 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 8 Aug 2026 11:48:27 +0700 Subject: [PATCH 2/5] Fullscreen on mobile only --- game/game.js | 98 +++++++++++++++++++++++++++++++--------------------- 1 file changed, 59 insertions(+), 39 deletions(-) diff --git a/game/game.js b/game/game.js index e233518..bbe0281 100644 --- a/game/game.js +++ b/game/game.js @@ -3,7 +3,7 @@ var game; var bgOnly = false, showcaseOnly = false; -var version = "v1.17.1"; +var version = "v1.17.2"; (() => { var e = { 8465: (e, t, a) => { @@ -24736,6 +24736,15 @@ var version = "v1.17.1"; let n = new vn(t); if (null != i) this.loadSequence(t, a, i); else { + if (!this.atlas.findRegion) { + throw new Error( + "Region not found in atlas: " + + a + + " (region attachment: " + + t + + ") THIS IS NORMAL!! JUST REFRESH THE PAGE!" + ) + } let e = this.atlas.findRegion(a); if (!e) throw new Error( @@ -34041,12 +34050,8 @@ var version = "v1.17.1"; }), ], }), - vo = makeCustomSprite({ render({ props: e }) { - if (e.fullScreen) { - return []; - }; const t = e.large ? 1.2 : 1; return [ e.isSelected || e.isOpen @@ -35433,6 +35438,7 @@ var version = "v1.17.1"; }), Po = makeSprite({ render: ({ props: e }) => [ + // real switch imageArray({ fileName: `images/themes/${e.theme}/switch-platform.png`, props: (e) => ({ width: e.width, height: e.height }), @@ -35446,18 +35452,14 @@ var version = "v1.17.1"; e.inGame && e.inGame.playerX, e.inGame && e.inGame.fallTypes, e.inGame && e.inGame.playerDir, - )), - (n.direction = t.direction)); - ((n.scale = { - x: 1, - y: n.direction == 0 || n.direction == 180 ? 1 : -1, - }), - (n.rotation = - t.rotation + (void 0 !== n.editor ? t.direction : 0))); + ))); + n.rotation = + t.rotation; n.scaleY = n.direction == 0 || n.direction == 180 ? 1 : -1; }, array: () => e.switchPlatforms, }), + // editor only ifConditional( () => void 0 !== e.editor, () => [ @@ -35474,7 +35476,7 @@ var version = "v1.17.1"; (e.x = t.x + a), (e.y = t.y), (e.rotation = - (0 === t.rotation ? -90 : 0) + t.direction)); + (0 === t.rotation - t.direction ? -90 : 0) + t.direction)); }, array: () => e.switchPlatforms, }), @@ -37772,6 +37774,11 @@ var version = "v1.17.1"; }, Tr = [], Rr = [], + setSwitchRotation = function (e) { + e.rotation = e.initPosition == "up" ? -90 : 0; + e.rotation += e.direction; + return e; + }, objPropsMenu = function (e, t, a, i, debug) { switch (t.type) { case "spike": @@ -40507,7 +40514,7 @@ var version = "v1.17.1"; set: (e) => Object.assign(Object.assign({}, e), { initPosition: "up", - rotation: -90, + rotation: -90 + t.direction, }), }); }); @@ -40525,7 +40532,7 @@ var version = "v1.17.1"; set: (e) => Object.assign(Object.assign({}, e), { initPosition: "right", - rotation: 0, + rotation: 0 + t.direction, }), }); }); @@ -40546,9 +40553,9 @@ var version = "v1.17.1"; array: "switchPlatforms", index: j, set: (e) => - Object.assign(Object.assign({}, e), { + setSwitchRotation(Object.assign(Object.assign({}, e), { direction: 0, - }), + })) }); }); }, @@ -40563,9 +40570,9 @@ var version = "v1.17.1"; array: "switchPlatforms", index: j, set: (e) => - Object.assign(Object.assign({}, e), { + setSwitchRotation(Object.assign(Object.assign({}, e), { direction: 270, - }), + })) }); }); }, @@ -40580,9 +40587,9 @@ var version = "v1.17.1"; array: "switchPlatforms", index: j, set: (e) => - Object.assign(Object.assign({}, e), { + setSwitchRotation(Object.assign(Object.assign({}, e), { direction: 180, - }), + })) }); }); }, @@ -40597,9 +40604,9 @@ var version = "v1.17.1"; array: "switchPlatforms", index: j, set: (e) => - Object.assign(Object.assign({}, e), { + setSwitchRotation(Object.assign(Object.assign({}, e), { direction: 90, - }), + })) }); }); }, @@ -42243,7 +42250,7 @@ var version = "v1.17.1"; inViewLayout: h, inViewLayoutAtTime: inViewLayoutAtTime, fullLayout: g, - justPlacedObject: m, + justPlacedObject: justPlacedObject, noSpace: f, isLoading: y, playerSkin: E, @@ -42273,7 +42280,7 @@ var version = "v1.17.1"; }), ]; const b = a ? t : e.map((e) => g[e.array][e.index]), - S = (m && g[m.array][m.index]) || null, + S = (justPlacedObject && g[justPlacedObject.array][justPlacedObject.index]) || null, I = e.length > 0 ? e @@ -42498,7 +42505,7 @@ var version = "v1.17.1"; runHistory: runHistory, runHistoryIndex: i, }), - Dr({ + /*Dr({ id: "Waveform", song: c, x: runHistory[i].playerX, @@ -42508,7 +42515,20 @@ var version = "v1.17.1"; waveformData: waveformData, waveformLengthInBeats: 10, speedMultiplier: runHistory[i].playerSpeedMultiplier, - }), + }),*/ + ...([30, 50, 70].map((x) => m({ + color: Be, + opacity: 0.8, + thickness: 5, + x: runHistory[i].playerX + x * runHistory[i].playerDir, + y: runHistory[i].playerY, + path: [ + [0, 15], + [15, 0], + [0, -15] + ], + scaleX: runHistory[i].playerDir, + }))), _ && Er( Object.assign(Object.assign({ id: "SelectedBorder" }, _), { @@ -45603,6 +45623,7 @@ var version = "v1.17.1"; bpm: 132, isBonusSong: true, }, + forYou: { name: "For You (+ Waterfall mashup)", author: "ColBreakz & EXODIE, SkybreakEDM", @@ -45610,6 +45631,12 @@ var version = "v1.17.1"; bpm: 145, isBonusSong: true, }, + zenith: { + name: "Nana", + author: "Geoxor", + fileName: "audio/tracks/geoxor-nana.mp3", + bpm: 128, + }, chaozFantasy: { name: "Chaoz Fantasy", @@ -45683,12 +45710,6 @@ var version = "v1.17.1"; length: "12 mins", isBonusSong: true, }, - zenith: { - name: "Zenith", - author: "Geoxor", - fileName: "audio/tracks/geoxor-zenith.mp3", - bpm: 128, - }, superUltra: { name: "Super Ultra", author: "MDK", @@ -62724,7 +62745,7 @@ var version = "v1.17.1"; { containerHeight: a.size.fullHeight - 70 + 50, containerWidth: a.size.fullWidth, - contentHeight: 850 + mouseSettingOffset, + contentHeight: 900 + mouseSettingOffset, y: (a.size.fullHeight - 70) / 2 + 35, sprites: (o) => [ c({ @@ -63184,7 +63205,7 @@ var version = "v1.17.1"; () => [ Rm.Single( { - text: "HIDE MOUSE WHEN PLAYING", + text: "HIDE MOUSE & BUTTONS WHEN PLAYING", selected: false, onPress: () => { var a; @@ -66212,7 +66233,7 @@ var version = "v1.17.1"; strokeColor: Ye, x: 280, }), - document.fullscreenEnabled + document.fullscreenEnabled && e.isTouchScreen ? vo({ id: "FullScreen", fullScreen: true, @@ -73461,7 +73482,6 @@ var version = "v1.17.1"; const e = [ ["CREATED BY", ["ED BENTLEY"]], ["MODDED BY", ["d016"]], - ["PORTED BY", ["SnowyDaFox"]], ["INSPIRED BY", ["Alfredo/Outline Gamer"]], [ "SPECIAL THANKS TO", @@ -74323,7 +74343,7 @@ var version = "v1.17.1"; x: 0, y: u - 50, }), - document.fullscreenEnabled + document.fullscreenEnabled && a.isTouchScreen ? vo({ id: "FullScreen", fullScreen: true, From e9150f4e15dc5901804da6e1939b625d5c0ffdc2 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 8 Aug 2026 11:56:20 +0700 Subject: [PATCH 3/5] Minor text change --- game/game.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/game/game.js b/game/game.js index bbe0281..c1afb38 100644 --- a/game/game.js +++ b/game/game.js @@ -63205,7 +63205,7 @@ var version = "v1.17.2"; () => [ Rm.Single( { - text: "HIDE MOUSE & BUTTONS WHEN PLAYING", + text: "HIDE MOUSE WHEN PLAYING", selected: false, onPress: () => { var a; From 0bd51b353dc862542b1357bb19583871693672df Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 8 Aug 2026 13:29:46 +0700 Subject: [PATCH 4/5] Cursor now reappears on Winning Screen --- game/game.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/game/game.js b/game/game.js index c1afb38..40993ec 100644 --- a/game/game.js +++ b/game/game.js @@ -65563,7 +65563,7 @@ var version = "v1.17.2"; gameplayOverlay.Single( { backToMenu: () => e.backToMenu(false), - paused: t.paused, + paused: t.paused || t.mutValues.levelState.finishedLevel, attempt: t.mutValues.levelState.attempt, frame: t.mutValues.levelState.frame, maxFrame: e.maxFrame, From 2b7f37cdfdb6e6b07703cb9c1c1cb1383749233a Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 8 Aug 2026 13:52:30 +0700 Subject: [PATCH 5/5] Cursor on Winning screen should actually work now --- game/game.js | 174 ++++++++++++++++++++++++++------------------------- 1 file changed, 89 insertions(+), 85 deletions(-) diff --git a/game/game.js b/game/game.js index 40993ec..fd8af6e 100644 --- a/game/game.js +++ b/game/game.js @@ -20122,12 +20122,12 @@ var version = "v1.17.2"; testId: (t, a) => { var i, n; return `Block-${null !== - (n = - null === (i = e.inGame) || void 0 === i - ? void 0 - : i.indexes[a]) && void 0 !== n - ? n - : a + (n = + null === (i = e.inGame) || void 0 === i + ? void 0 + : i.indexes[a]) && void 0 !== n + ? n + : a }`; }, }), @@ -20170,12 +20170,12 @@ var version = "v1.17.2"; testId: (t, a) => { var i, n; return `Block-${null !== - (n = - null === (i = e.inGame) || void 0 === i - ? void 0 - : i.indexes[a]) && void 0 !== n - ? n - : a + (n = + null === (i = e.inGame) || void 0 === i + ? void 0 + : i.indexes[a]) && void 0 !== n + ? n + : a }`; }, }), @@ -20220,12 +20220,12 @@ var version = "v1.17.2"; testId: (t, a) => { var i, n; return `Block-${null !== - (n = - null === (i = e.inGame) || void 0 === i - ? void 0 - : i.indexes[a]) && void 0 !== n - ? n - : a + (n = + null === (i = e.inGame) || void 0 === i + ? void 0 + : i.indexes[a]) && void 0 !== n + ? n + : a }`; }, }), @@ -20268,12 +20268,12 @@ var version = "v1.17.2"; testId: (t, a) => { var i, n; return `Block-${null !== - (n = - null === (i = e.inGame) || void 0 === i - ? void 0 - : i.indexes[a]) && void 0 !== n - ? n - : a + (n = + null === (i = e.inGame) || void 0 === i + ? void 0 + : i.indexes[a]) && void 0 !== n + ? n + : a }`; }, }), @@ -20317,12 +20317,12 @@ var version = "v1.17.2"; testId: (t, a) => { var i, n; return `Block-${null !== - (n = - null === (i = e.inGame) || void 0 === i - ? void 0 - : i.indexes[a]) && void 0 !== n - ? n - : a + (n = + null === (i = e.inGame) || void 0 === i + ? void 0 + : i.indexes[a]) && void 0 !== n + ? n + : a }`; }, }), @@ -20366,12 +20366,12 @@ var version = "v1.17.2"; testId: (t, a) => { var i, n; return `Block-${null !== - (n = - null === (i = e.inGame) || void 0 === i - ? void 0 - : i.indexes[a]) && void 0 !== n - ? n - : a + (n = + null === (i = e.inGame) || void 0 === i + ? void 0 + : i.indexes[a]) && void 0 !== n + ? n + : a }`; }, }), @@ -20413,12 +20413,12 @@ var version = "v1.17.2"; testId: (t, a) => { var i, n; return `Block-${null !== - (n = - null === (i = e.inGame) || void 0 === i - ? void 0 - : i.indexes[a]) && void 0 !== n - ? n - : a + (n = + null === (i = e.inGame) || void 0 === i + ? void 0 + : i.indexes[a]) && void 0 !== n + ? n + : a }`; }, }), @@ -20460,12 +20460,12 @@ var version = "v1.17.2"; testId: (t, a) => { var i, n; return `Block-${null !== - (n = - null === (i = e.inGame) || void 0 === i - ? void 0 - : i.indexes[a]) && void 0 !== n - ? n - : a + (n = + null === (i = e.inGame) || void 0 === i + ? void 0 + : i.indexes[a]) && void 0 !== n + ? n + : a }`; }, }), @@ -20513,12 +20513,12 @@ var version = "v1.17.2"; testId: (t, a) => { var i, n; return `Block-${null !== - (n = - null === (i = e.inGame) || void 0 === i - ? void 0 - : i.indexes[a]) && void 0 !== n - ? n - : a + (n = + null === (i = e.inGame) || void 0 === i + ? void 0 + : i.indexes[a]) && void 0 !== n + ? n + : a }`; }, }), @@ -20557,12 +20557,12 @@ var version = "v1.17.2"; testId: (t, a) => { var i, n; return `Block-${null !== - (n = - null === (i = e.inGame) || void 0 === i - ? void 0 - : i.indexes[a]) && void 0 !== n - ? n - : a + (n = + null === (i = e.inGame) || void 0 === i + ? void 0 + : i.indexes[a]) && void 0 !== n + ? n + : a }`; }, }), @@ -20988,8 +20988,8 @@ var version = "v1.17.2"; testId: (t, a) => { var i; return `Spike-${null === (i = e.inGame) || void 0 === i - ? void 0 - : i.indexes[a] + ? void 0 + : i.indexes[a] }`; }, }), @@ -21027,8 +21027,8 @@ var version = "v1.17.2"; testId: (t, a) => { var i; return `Spike-${null === (i = e.inGame) || void 0 === i - ? void 0 - : i.indexes[a] + ? void 0 + : i.indexes[a] }`; }, }), @@ -21066,8 +21066,8 @@ var version = "v1.17.2"; testId: (t, a) => { var i; return `Spike-${null === (i = e.inGame) || void 0 === i - ? void 0 - : i.indexes[a] + ? void 0 + : i.indexes[a] }`; }, }), @@ -21105,8 +21105,8 @@ var version = "v1.17.2"; testId: (t, a) => { var i; return `Spike-${null === (i = e.inGame) || void 0 === i - ? void 0 - : i.indexes[a] + ? void 0 + : i.indexes[a] }`; }, }), @@ -21146,8 +21146,8 @@ var version = "v1.17.2"; testId: (t, a) => { var i; return `Spike-${null === (i = e.inGame) || void 0 === i - ? void 0 - : i.indexes[a] + ? void 0 + : i.indexes[a] }`; }, }), @@ -21187,8 +21187,8 @@ var version = "v1.17.2"; testId: (t, a) => { var i; return `Spike-${null === (i = e.inGame) || void 0 === i - ? void 0 - : i.indexes[a] + ? void 0 + : i.indexes[a] }`; }, }), @@ -21227,8 +21227,8 @@ var version = "v1.17.2"; testId: (t, a) => { var i; return `Spike-${null === (i = e.inGame) || void 0 === i - ? void 0 - : i.indexes[a] + ? void 0 + : i.indexes[a] }`; }, }), @@ -21266,8 +21266,8 @@ var version = "v1.17.2"; testId: (t, a) => { var i; return `Spike-${null === (i = e.inGame) || void 0 === i - ? void 0 - : i.indexes[a] + ? void 0 + : i.indexes[a] }`; }, }), @@ -56880,10 +56880,10 @@ var version = "v1.17.2"; () => [y( { fileName: `images/level/boss3/asteroid${e.asteroid.radius <= 15 - ? "60" - : e.asteroid.radius <= 25 - ? "120" - : "210" + ? "60" + : e.asteroid.radius <= 25 + ? "120" + : "210" }.png`, width: 2.4 * e.asteroid.radius, height: 2.4 * e.asteroid.radius, @@ -63385,7 +63385,9 @@ var version = "v1.17.2"; loop({ props: e, getInputs: t, device: a, getContext: i }) { const { settings: cursorSettings } = i(Se); const desiredCursor = - cursorSettings.hideMouseWhenPlaying && !e.paused + cursorSettings.hideMouseWhenPlaying && + !e.paused && + !e.finishedLevel ? "none" : "default"; if (document.body.style.cursor !== desiredCursor) { @@ -65563,7 +65565,8 @@ var version = "v1.17.2"; gameplayOverlay.Single( { backToMenu: () => e.backToMenu(false), - paused: t.paused || t.mutValues.levelState.finishedLevel, + paused: t.paused, + finishedLevel: t.mutValues.levelState.finishedLevel, attempt: t.mutValues.levelState.attempt, frame: t.mutValues.levelState.frame, maxFrame: e.maxFrame, @@ -65710,6 +65713,7 @@ var version = "v1.17.2"; }) : (a.boosters = void 0), (a.paused = t.paused), + (a.finishedLevel = t.mutValues.levelState.finishedLevel), (a.hideUi = n.hideUi), (a.isPractice = t.mutValues.checkpoints.length > 0), (console.log(t.mutValues.checkpoints.length)), @@ -78763,9 +78767,9 @@ var version = "v1.17.2"; e.achievementModalQueue.length > 0 ? Uo({ id: `AchievementModal-${(null === (i = e.achievementModalQueue[0]) || - void 0 === i - ? void 0 - : i.id) || "" + void 0 === i + ? void 0 + : i.id) || "" }`, initShow: false, shouldShow: true,