/* Metro module 4483; source: modules/roblox_subgame_detection/RobloxSubgameUtils.tsx; dependencies: [5, 4266, 661, 4484, 22, 4485, 3847, 2] */ import Module00005 from '../../by-id/module-00005.js'; /* Metro dependency 5 */ import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */ import * as RunningGameStoreNativeModule from '../game_detection/RunningGameStore.native.tsx'; /* Metro dependency 4266 */ import * as RobloxSubgameTypesModule from './RobloxSubgameTypes.tsx'; /* Metro dependency 4484 */ function _fun38208(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#38208, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4661:6, offset: 0x010b9d58, size: 322 bytes, params: 8, frame: 21 const env0_0 = require; const hasSubgameInfoChanged2 = hasSubgameInfoChanged; const isRobloxSubgame2 = isRobloxSubgame; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); (FileImportTrackerModule).fileFinishedImporting('modules/roblox_subgame_detection/RobloxSubgameUtils.tsx'); exports.keyForRobloxGame = keyForRobloxGame; exports.hasRunningGameChanged = hasRunningGameChanged; exports.hasSubgameInfoChanged = hasSubgameInfoChanged2; exports.updateRunningGameWithRobloxSubgameInfo = updateRunningGameWithRobloxSubgameInfo; exports.convertMapToRobloxSubgameInfo = convertMapToRobloxSubgameInfo; exports.getSubgameMetadata = getSubgameMetadata; exports.maybeAddAdditionalGameMetadata = maybeAddAdditionalGameMetadata; exports.isRobloxSubgame = isRobloxSubgame2; exports.isRobloxSubgameApplication = function({thirdPartySkus}) { return thirdPartySkus.some(_fun38221); }; exports.isRobloxSubgameGame = isRobloxSubgameGame; exports.openRobloxURLWithRootPlaceId = function() { return _openRobloxURLWithRootPlaceId.apply(this, arguments); }; exports.maybeTransformRobloxSubgameToRoblox = maybeTransformRobloxSubgameToRoblox; function hasSubgameInfoChanged(a0, a1) { // fn#38209, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4661:183, offset: 0x010b9e9a, size: 98 bytes, params: 3, frame: 17 var r1; var r2; let value = a0 == null; let r0 = value && a1 != null; if (!r0) { value = a0 != null; r1 = value && a1 == null; if (!r1) { value = a0 != null; r2 = value && a1 != null; if (r2) { value = importDefault(22) /* metro dependency 22 */; value = !value.isEqual(a0, a1); r2 = value; } r1 = r2; } r0 = r1; } return r0; } function isRobloxSubgame(a0) { // fn#38210, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4661:304, offset: 0x010b9efc, size: 68 bytes, params: 2, frame: 13 const distributor = a0.distributor; const ROBLOX = Distributors.ROBLOX; return distributor === ROBLOX && a0.id !== (require(4484) /* metro dependency 4484: RobloxSubgameTypes */).ROBLOX_APPLICATION_ID; } function _openRobloxURLWithRootPlaceId() { // fn#38211, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4661:402, offset: 0x010b9f40, size: 48 bytes, params: 1, frame: 14 return Module00005(_fun38213).apply(this, arguments); function* _fun38213(a0) { // fn#38213, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4661:483, offset: 0x010b9f79, size: 103 bytes, params: 2, frame: 14 if (true) { value = environment.__proto__.__proto__; var value3 = env2_1(env2_2[5]); var getRobloxSubgameURL = value3.getRobloxSubgameURL; yield Reflect.apply(getRobloxSubgameURL, value3, [a0]); var value4 = undefined; if (false) { return value4; } yield env2_1(env2_2[6])(value4); } } } function keyForRobloxGame(a0) { // fn#38214, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4661:697, offset: 0x010b9fe0, size: 147 bytes, params: 2, frame: 19 var r1; var r0; var sku; var gameMetadata; const distributor = a0.distributor; var value; const ROBLOX = Distributors.ROBLOX; const value2 = null; if (distributor !== ROBLOX) { r0 = value2; } else { sku = a0.sku; if (value2 != sku) { sku = a0.sku; gameMetadata = a0.gameMetadata; r1 = value2 == gameMetadata ? undefined : gameMetadata[(require(4484) /* metro dependency 4484: RobloxSubgameTypes */).RobloxMetadataKeys.PLACE_ID]; value = ''; value = value + sku + ':' + (value2 != r1 ? r1 : value); r0 = value; } else { r0 = value2; } } return r0; } function hasRunningGameChanged(a0, a1, a2) { // fn#38215, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4661:909, offset: 0x010ba073, size: 213 bytes, params: 4, frame: 20 var r1; var r4; var r0; var value3; var hasSubgameInfoChangedBinding; var property; const distributor = a0.distributor; const ROBLOX = Distributors.ROBLOX; const value2 = distributor === ROBLOX; if (value2) { value3 = null; r1 = value3 != a2 && a0.id !== a2.id; if (!r1) { hasSubgameInfoChangedBinding = hasSubgameInfoChanged; if (a0.distributor !== Distributors.ROBLOX) { r4 = value3; } else if (value3 == a0.gameMetadata) { r4 = value3; } else if (value3 == a0.sku) { r4 = value3; } else { property = a0.gameMetadata[(require(4484) /* metro dependency 4484: RobloxSubgameTypes */).RobloxMetadataKeys.PLACE_ID]; r4 = {placeId: value3 != property ? property : value3, universeId: a0.sku}; } r1 = hasSubgameInfoChangedBinding(r4, a1); } r0 = r1; } else { r0 = value2; } return r0; } function updateRunningGameWithRobloxSubgameInfo(a0, {subgameInfo, application}) { // fn#38216, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4661:1345, offset: 0x010ba148, size: 778 bytes, params: 3, frame: 24 const RobloxMetadataKeys = (RobloxSubgameTypesModule).RobloxMetadataKeys; var Date; var object; var isDetectionEnabledBinding; var object2; var name; var ROBLOX; var object3; const ROBLOX_APPLICATION_ID = (RobloxSubgameTypesModule).ROBLOX_APPLICATION_ID; var Math; var floor; var Object; const object4 = {}; copyDataProperties(object4, a0, undefined); const Number = global.Number; const value3 = Number(a0.gameMetadata?.[RobloxMetadataKeys.ROBLOX_TIME_STARTED]); const r4 = global.isNaN(value3) || value3 === 0 ? a0.start ?? global.Date.now() : value3; if (subgameInfo == null) { if (isRobloxSubgame(a0)) { object4.id = ROBLOX_APPLICATION_ID; object4.name = DistributorNames[Distributors.ROBLOX]; } object4.gameMetadata = undefined; object4.sku = undefined; object4.start = r4; object4.lastFocused = global.Math.floor(r4 / 1000); } else { object = {}; if (application == null) { object4.id = ROBLOX_APPLICATION_ID; object4.name = DistributorNames[Distributors.ROBLOX]; object4.start = r4; } else { isDetectionEnabledBinding = isDetectionEnabled; object2 = {}; object2.exePath = a0.exePath; name = application.name; object2.name = name; object2.id = application.id; ROBLOX = Distributors.ROBLOX; object2.distributor = ROBLOX; if (isDetectionEnabledBinding(object2)) { isDetectionEnabledBinding = isDetectionEnabled; object3 = {}; object3.exePath = a0.exePath; ROBLOX = Distributors.ROBLOX; object3.name = DistributorNames[ROBLOX]; object3.id = ROBLOX_APPLICATION_ID; ROBLOX = Distributors.ROBLOX; object3.distributor = ROBLOX; if (isDetectionEnabledBinding(object3)) { object4.id = application.id; name = application.name; object4.name = name; name = application.name; object4.gameName = name; Date = global.Date; object4.start = Date.now(); Math = global.Math; floor = Math.floor; Date = global.Date; object4.lastFocused = Reflect.apply(floor, Math, [Date.now() / 1000]); } else { object4.id = ROBLOX_APPLICATION_ID; object4.name = DistributorNames[Distributors.ROBLOX]; object4.start = r4; } } else { object4.id = ROBLOX_APPLICATION_ID; object4.name = DistributorNames[Distributors.ROBLOX]; object4.start = r4; } } object[RobloxMetadataKeys.ROBLOX_TIME_STARTED] = r4.toString(); object4.sku = subgameInfo.universeId ?? undefined; if (subgameInfo.placeId != null) { object[RobloxMetadataKeys.PLACE_ID] = subgameInfo.placeId; } Object = global.Object; object4.gameMetadata = Object.keys(object).length > 0 ? object : undefined; } return object4; } function convertMapToRobloxSubgameInfo(a0) { // fn#38217, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4661:2370, offset: 0x010ba452, size: 172 bytes, params: 2, frame: 16 const NativeRobloxSubgameKeys = (RobloxSubgameTypesModule).NativeRobloxSubgameKeys; const UNIVERSE_ID = NativeRobloxSubgameKeys.UNIVERSE_ID; const value2 = null; return value2 == a0[UNIVERSE_ID] || value2 == a0[NativeRobloxSubgameKeys.PLACE_ID] ? value2 : {universeId: a0[NativeRobloxSubgameKeys.UNIVERSE_ID], placeId: a0[NativeRobloxSubgameKeys.PLACE_ID]}; } function getSubgameMetadata(a0) { // fn#38218, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4661:2662, offset: 0x010ba4fe, size: 168 bytes, params: 2, frame: 17 const RobloxMetadataKeys = (RobloxSubgameTypesModule).RobloxMetadataKeys; const distributor = a0.distributor; const ROBLOX = Distributors.ROBLOX; const value2 = null; return distributor !== ROBLOX ? value2 : value2 != a0.gameMetadata && value2 != a0.gameMetadata[RobloxMetadataKeys.PLACE_ID] ? global.JSON.stringify({placeId: a0.gameMetadata[RobloxMetadataKeys.PLACE_ID]}) : value2; } function maybeAddAdditionalGameMetadata(a0) { // fn#38219, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4661:2923, offset: 0x010ba5a6, size: 196 bytes, params: 2, frame: 16 const RobloxMetadataKeys = (require(4484) /* metro dependency 4484: RobloxSubgameTypes */).RobloxMetadataKeys; const distributor = a0.distributor; const ROBLOX = Distributors.ROBLOX; return distributor !== ROBLOX || a0.gameMetadata == null || (a0.gameMetadata[RobloxMetadataKeys.ROBLOX_TIME_STARTED] == null || a0.id === (require(4484) /* metro dependency 4484: RobloxSubgameTypes */).ROBLOX_APPLICATION_ID) || a0.gameName == null ? {} : {name: a0.gameName, sync_id: a0.gameMetadata[RobloxMetadataKeys.ROBLOX_TIME_STARTED]}; } function isRobloxSubgameApplication({thirdPartySkus}) { // fn#38220, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4661:3302, offset: 0x010ba66a, size: 29 bytes, params: 2, frame: 11 return thirdPartySkus.some(function({distributor}) { return distributor === Distributors.ROBLOX; }); function _fun38221({distributor}) { // fn#38221, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4661:3371, offset: 0x010ba687, size: 28 bytes, params: 2, frame: 2 const ROBLOX = Distributors.ROBLOX; return distributor === ROBLOX; } } function isRobloxSubgameGame(a0) { // fn#38222, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4661:3424, offset: 0x010ba6a3, size: 72 bytes, params: 2, frame: 13 const id = a0.id; const ROBLOX_GAME_ID = (RobloxSubgameTypesModule).ROBLOX_GAME_ID; return id !== ROBLOX_GAME_ID && a0.thirdPartySkus.some(function({distributor}) { return distributor === Distributors.ROBLOX; }); } function maybeTransformRobloxSubgameToRoblox(a0) { // fn#38225, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4661:3717, offset: 0x010ba6eb, size: 145 bytes, params: 2, frame: 17 var r0; const ROBLOX_APPLICATION_ID = (RobloxSubgameTypesModule).ROBLOX_APPLICATION_ID; var object; const value = a0; const distributor = value.distributor; const ROBLOX = Distributors.ROBLOX; if (distributor !== ROBLOX) { r0 = value; } else if (value.id === ROBLOX_APPLICATION_ID) { r0 = value; } else { object = {}; copyDataProperties(object, value, require); object['id'] = ROBLOX_APPLICATION_ID; object['name'] = DistributorNames[Distributors.ROBLOX]; r0 = object; } return r0; } } global.__d(_fun38208, 4483, [5, 4266, 661, 4484, 22, 4485, 3847, 2]) /* metro module 4483, dependencies: [5, 4266, 661, 4484, 22, 4485, 3847, 2] */;