/* Metro module 13049; source: modules/rpc/server/commands/subscriptions.tsx; dependencies: [5, 661, 8076, 13050, 683, 13051, 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 */ function _fun99657(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#99657, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13239:6, offset: 0x021d05b1, size: 201 bytes, params: 8, frame: 20 const env0_0 = require; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const RPCCommands = ConstantsModule.RPCCommands; object = {}; const SUBSCRIBE = RPCCommands.SUBSCRIBE; object[SUBSCRIBE] = {handler: function({server, socket, evt, args}) { return args(_fun99659)(); }}; const UNSUBSCRIBE = RPCCommands.UNSUBSCRIBE; object[UNSUBSCRIBE] = {handler: handler_99664}; (FileImportTrackerModule).fileFinishedImporting('modules/rpc/server/commands/subscriptions.tsx'); exports.default = object; function handler_99658({server, socket, evt, args}) { // fn#99658, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13239:191, offset: 0x021d067a, size: 72 bytes, params: 2, frame: 11 return args(_fun99660)(); function _fun99659() { // fn#99659, offset: 0x021d06c2, size: 11 bytes, params: 1, frame: 1 return _fun99660; } function* _fun99660() { // fn#99660, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13239:230, offset: 0x021d06cd, size: 682 bytes, params: 1, frame: 25 var environment; var binding; var object; var value7; var track; var RPC_SUBSCRIPTION_REQUESTED; var value9; var validate; var value11; var handler; var binding3; var Promise; var promise; var value14; var value15; if (false) { return undefined; } var env0_0; var env0_1; value = environment.__proto__; const property = env1_0.events[env1_2]; if (property == null) { value14 = environment.__proto__.__proto__; binding = env2_1; value15 = binding(env2_2[2]); binding = env1_2; value = 'Invalid event: ' + binding; value = new value15({errorCode: env2_5.INVALID_EVENT}, value); throw value; } const value5 = env2_1(env2_2[3])(env1_1.authorization.scopes, property.scope); binding = env2_1; const binding2 = env2_2; if (value5) { value7 = binding(binding2[4]); track = value7.track; RPC_SUBSCRIPTION_REQUESTED = env2_4.RPC_SUBSCRIPTION_REQUESTED; object = {event: env1_2}; object.scope = typeof property.scope === 'object' ? global.JSON.stringify(property.scope) : property.scope; binding = env1_1; object.application_id = binding.application.id; object.socket_scope = binding.authorization.scopes.toString(); Reflect.apply(track, value7, [RPC_SUBSCRIPTION_REQUESTED, object]); if (property.validation == null) { handler = property.handler; binding = env1_3; binding3 = env1_1; env0_0 = Reflect.apply(handler, property, [{args: binding, socket: binding3}]); env0_1 = env2_0(env2_2[5]).getInitialSubscriptionPayload(binding3, env1_2, binding); Promise = global.Promise; value = Object.create(Promise.prototype, {constructor: {value: Promise}}); promise = new Promise(_fun99661); return promise instanceof Object ? promise : value; } binding = env1_0; yield binding.getJoi(); value9 = undefined; if (false) { return value9; } validate = value9.validate; binding = env1_3; value11 = property.validation(value9); object = {convert: false}; if (Reflect.apply(validate, value9, [binding, value11, object]).error != null) { value = env2_1(env2_2[2]); value = new value({errorCode: env2_5.INVALID_PAYLOAD}, 'Invalid subscription parameters provided'); throw value; } handler = property.handler; binding = env1_3; binding3 = env1_1; env0_0 = Reflect.apply(handler, property, [{args: binding, socket: binding3}]); env0_1 = env2_0(env2_2[5]).getInitialSubscriptionPayload(binding3, env1_2, binding); Promise = global.Promise; value = Object.create(Promise.prototype, {constructor: {value: Promise}}); promise = new Promise(_fun99661); return promise instanceof Object ? promise : value; } value = binding(binding2[2]); const INVALID_PERMISSIONS = env2_5.INVALID_PERMISSIONS; value = new value({errorCode: INVALID_PERMISSIONS}, 'Not authenticated or invalid scope'); throw value; function _fun99661(a0) { // fn#99661, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13239:971, offset: 0x021d0977, size: 48 bytes, params: 2, frame: 11 global.setImmediate(_fun99662); a0({evt: env2_2}); function _fun99662() { // fn#99662, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13239:989, offset: 0x021d09a7, size: 87 bytes, params: 1, frame: 19 let binding = env3_0; binding.addSubscription(env3_1, env3_2, env3_3, env1_0); if (env1_1 != null) { binding = env3_0; binding.dispatchToSubscriptions(env3_2, _fun99663, env1_1); } function _fun99663({socket}) { // fn#99663, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13239:1059, offset: 0x021d09fe, size: 32 bytes, params: 2, frame: 2 return socket.id === env4_1.id; } } } } } function handler_99664({server, socket, evt, args}) { // fn#99664, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13239:1125, offset: 0x021d0a1e, size: 156 bytes, params: 2, frame: 16 var value; var defaultImport; if (server.events[evt] == null) { defaultImport = importDefault(8076) /* metro dependency 8076: RPCError */; ({}).errorCode = RPCErrors.INVALID_EVENT; value = 'Invalid event: ' + evt; value = new defaultImport(); throw value; } server.removeSubscription(socket, evt, args); return {evt: evt}; } } global.__d(_fun99657, 13049, [5, 661, 8076, 13050, 683, 13051, 2]) /* metro module 13049, dependencies: [5, 661, 8076, 13050, 683, 13051, 2] */;