Files
2026-07-28 01:06:53 +03:00

1262 lines
63 KiB
TypeScript

/* Metro module 12392; source: lib/RTCControlSocket.tsx; dependencies: [6, 7, 15, 17, 18, 691, 4291, 672, 561, 3, 4303, 477, 44, 4479, 2] */
import Logger from '../modules/debug/Logger.tsx'; /* Metro dependency 3 */
import ClassCallCheck from '../by-id/module-00006-ClassCallCheck.js'; /* Metro dependency 6 */
import CreateClass from '../by-id/module-00007-CreateClass.js'; /* Metro dependency 7 */
import PossibleConstructorReturn from '../by-id/module-00015-PossibleConstructorReturn.js'; /* Metro dependency 15 */
import Module00017 from '../by-id/module-00017.js'; /* Metro dependency 17 */
import Inherits from '../by-id/module-00018-Inherits.js'; /* Metro dependency 18 */
import Module00044 from '../by-id/module-00044.js'; /* Metro dependency 44 */
import Backoff from '../external/discord_common/js/packages/backoff/Backoff.tsx'; /* Metro dependency 561 */
import DeveloperOptionsStore from '../stores/DeveloperOptionsStore.tsx'; /* Metro dependency 691 */
import * as FileImportTrackerModule from '../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as PlatformUtilsModule from '../utils/PlatformUtils.tsx'; /* Metro dependency 477 */
import * as ConstantsModule from '../external/discord_common/js/packages/media-engine/Constants.tsx'; /* Metro dependency 4291 */
import * as TimeUtilsModule from '../external/discord_common/js/packages/time-utils/TimeUtils.tsx'; /* Metro dependency 4303 */
function _fun94431(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#94431, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12578:6, offset: 0x02117798, size: 1537 bytes, params: 8, frame: 30
const env0_0 = require;
const noop_94435 = function() {
};
const convertCodecs = function(a0) {
return a0.map(_fun94437);
};
const convertStreamParametersToWire = function(a0) {
return a0?.map(_fun94439);
};
const convertStreamParametersFromWire = function(a0) {
var r0;
r0 = a0?.map(_fun94441);
r0 = r0 ?? [];
return r0;
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = ConstantsModule;
const env0_9 = value.MediaEngineContextTypes;
const env0_10 = value.MediaTypes;
const env0_11 = value.SpeakingFlags;
object = {IDENTIFY: 0};
object[0] = 'IDENTIFY';
object.SELECT_PROTOCOL = 1;
object[1] = 'SELECT_PROTOCOL';
object.READY = 2;
object[2] = 'READY';
object.HEARTBEAT = 3;
object[3] = 'HEARTBEAT';
object.SELECT_PROTOCOL_ACK = 4;
object[4] = 'SELECT_PROTOCOL_ACK';
object.SPEAKING = 5;
object[5] = 'SPEAKING';
object.HEARTBEAT_ACK = 6;
object[6] = 'HEARTBEAT_ACK';
object.RESUME = 7;
object[7] = 'RESUME';
object.HELLO = 8;
object[8] = 'HELLO';
object.RESUMED = 9;
object[9] = 'RESUMED';
object.CLIENT_CONNECT = 11;
object[11] = 'CLIENT_CONNECT';
object.VIDEO = 12;
object[12] = 'VIDEO';
object.CLIENT_DISCONNECT = 13;
object[13] = 'CLIENT_DISCONNECT';
object.SESSION_UPDATE = 14;
object[14] = 'SESSION_UPDATE';
object.MEDIA_SINK_WANTS = 15;
object[15] = 'MEDIA_SINK_WANTS';
object.VOICE_BACKEND_VERSION = 16;
object[16] = 'VOICE_BACKEND_VERSION';
object.CHANNEL_OPTIONS_UPDATE = 17;
object[17] = 'CHANNEL_OPTIONS_UPDATE';
object.FLAGS = 18;
object[18] = 'FLAGS';
object.PLATFORM = 20;
object[20] = 'PLATFORM';
object.DAVE_PROTOCOL_PREPARE_TRANSITION = 21;
object[21] = 'DAVE_PROTOCOL_PREPARE_TRANSITION';
object.DAVE_PROTOCOL_EXECUTE_TRANSITION = 22;
object[22] = 'DAVE_PROTOCOL_EXECUTE_TRANSITION';
object.DAVE_PROTOCOL_READY_FOR_TRANSITION = 23;
object[23] = 'DAVE_PROTOCOL_READY_FOR_TRANSITION';
object.DAVE_PROTOCOL_PREPARE_EPOCH = 24;
object[24] = 'DAVE_PROTOCOL_PREPARE_EPOCH';
object.MLS_EXTERNAL_SENDER_PACKAGE = 25;
object[25] = 'MLS_EXTERNAL_SENDER_PACKAGE';
object.MLS_KEY_PACKAGE = 26;
object[26] = 'MLS_KEY_PACKAGE';
object.MLS_PROPOSALS = 27;
object[27] = 'MLS_PROPOSALS';
object.MLS_COMMIT_WELCOME = 28;
object[28] = 'MLS_COMMIT_WELCOME';
object.MLS_PREPARE_COMMIT_TRANSITION = 29;
object[29] = 'MLS_PREPARE_COMMIT_TRANSITION';
object.MLS_WELCOME = 30;
object[30] = 'MLS_WELCOME';
object.MLS_INVALID_COMMIT_WELCOME = 31;
object[31] = 'MLS_INVALID_COMMIT_WELCOME';
object.CLIENT_CANNOT_REACH_RTC_SERVER = 32;
object[32] = 'CLIENT_CANNOT_REACH_RTC_SERVER';
const object2 = {AUTHENTICATION_FAILED: 4004};
object2[4004] = 'AUTHENTICATION_FAILED';
object2.INVALID_SESSION = 4006;
object2[4006] = 'INVALID_SESSION';
object2.SERVER_NOT_FOUND = 4011;
object2[4011] = 'SERVER_NOT_FOUND';
object2.SERVER_CRASH = 4015;
object2[4015] = 'SERVER_CRASH';
object2.CANCELED = 4016;
object2[4016] = 'CANCELED';
object2.HEARTBEAT_TIMEOUT = 4800;
object2[4800] = 'HEARTBEAT_TIMEOUT';
object2.UNRESUMABLE = 4801;
object2[4801] = 'UNRESUMABLE';
object2.RESET_BACKOFF = 4802;
object2[4802] = 'RESET_BACKOFF';
const object3 = {DISCONNECTED: 0};
object3[0] = 'DISCONNECTED';
object3.CONNECTING = 1;
object3[1] = 'CONNECTING';
object3.IDENTIFYING = 2;
object3[2] = 'IDENTIFYING';
object3.RESUMING = 3;
object3[3] = 'RESUMING';
object3.CONNECTED = 4;
object3[4] = 'CONNECTED';
object3.RECONNECTING = 5;
object3[5] = 'RECONNECTING';
let Millis = (importDefault(672) /* metro dependency 672: Durations */).Millis;
let SECOND = Millis.SECOND;
const env0_15 = 20 * SECOND;
Millis = (importDefault(672) /* metro dependency 672: Durations */).Millis;
const MINUTE = Millis.MINUTE;
const env0_16 = 1 * MINUTE;
Millis = (importDefault(672) /* metro dependency 672: Durations */).Millis;
SECOND = Millis.SECOND;
const env0_17 = 5 * SECOND;
value = importDefault(4479) /* metro dependency 4479: TypedEventEmitter */;
value = _fun94442(value);
(FileImportTrackerModule).fileFinishedImporting('lib/RTCControlSocket.tsx');
exports.default = value;
exports.RTCSocketOpcode = object;
exports.SocketEvent = {Connecting: 'connecting', Connect: 'connect', Disconnect: 'disconnect', Resuming: 'resuming',
Ready: 'ready', Speaking: 'speaking', Video: 'video', Ping: 'ping', ClientConnect: 'client-connect',
ClientDisconnect: 'client-disconnect', Codecs: 'codecs', MediaSessionId: 'media-session-id',
MediaSinkWants: 'media-sink-wants', VoiceBackendVersion: 'voice-backend-version',
KeyframeInterval: 'keyframe-interval',
ChannelOptionsUpdateSecureFramesProtocol: 'update-secure-frames-protocol', Flags: 'flags', Platform: 'platform',
SDP: 'sdp', Encryption: 'encryption', BandwidthEstimationExperiment: 'bandwidth-estimation-experiment',
SecureFramesInit: 'secure-frames-init', SecureFramesPrepareTransition: 'secure-frames-prepare-transition',
SecureFramesExecuteTransition: 'secure-frames-execute-transition',
SecureFramesPrepareEpoch: 'secure-frames-prepare-epoch',
MLSExternalSenderPackage: 'mls-external-sender-package', MLSProposals: 'mls-proposals',
MLSPrepareCommitTransition: 'mls-prepare-commit-transition', MLSWelcome: 'mls-welcome',
ReceiveMessage: 'receive-message', SendMessage: 'send-message'};
function _isNativeReflectConstruct_94432() { // fn#94432, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12578:229, offset: 0x02117d99, size: 98 bytes, params: 1, frame: 18
var Boolean;
var prototype;
var valueOf;
var call;
var Reflect;
var construct;
var closure;
var value;
var error;
try {
Boolean = global.Boolean;
prototype = Boolean.prototype;
valueOf = prototype.valueOf;
call = valueOf.call;
Reflect = global.Reflect;
construct = Reflect.construct;
Boolean = global.Boolean;
closure = function() {
};
value = Reflect.apply(construct, Reflect, [Boolean, [], closure]);
value = Reflect.apply(call, valueOf, [value]);
var result = !value;
} catch (error) {
}
return (_isNativeReflectConstruct_94432_isNativeReflectConstruct = function() {
return !!result;
})();
}
function convertCodecs(a0) { // fn#94436, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12578:2524, offset: 0x02117dfb, size: 24 bytes, params: 2, frame: 11
return a0.map(function(a0) {
return {name: a0.name, type: a0.type, priority: 1000 * a0.priority, payload_type: a0.payloadType,
rtx_payload_type: a0.rtxPayloadType, encode: a0.encode, decode: a0.decode};
});
}
function convertStreamParametersToWire(a0) { // fn#94438, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12578:2714, offset: 0x02117e71, size: 35 bytes, params: 2, frame: 12
return a0?.map(_fun94439);
}
function convertStreamParametersFromWire(a0) { // fn#94440, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12578:3065, offset: 0x02117f39, size: 43 bytes, params: 2, frame: 13
let r0 = a0?.map(_fun94441);
r0 = r0 ?? [];
return r0;
function _fun94441(a0) { // fn#94441, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12578:3153, offset: 0x02117f64, size: 247 bytes, params: 2, frame: 5
var object;
const object2 = {};
const type = a0.type;
let r1 = type === 'audio' ? MediaTypes.AUDIO : type === 'test' ? MediaTypes.TEST : type === 'screen' ? MediaTypes.SCREEN : MediaTypes.VIDEO;
object2.type = r1;
object2.rid = a0.rid;
object2.ssrc = a0.ssrc;
object2.rtxSsrc = a0.rtx_ssrc;
object2.active = a0.active;
object2.quality = a0.quality;
object2.maxBitrate = a0.max_bitrate;
object2.maxFrameRate = a0.max_framerate;
let max_resolution = a0.max_resolution;
if (max_resolution != null) {
object = {};
max_resolution = a0.max_resolution;
object.type = max_resolution.type;
max_resolution = a0.max_resolution;
object.width = max_resolution.width;
max_resolution = a0.max_resolution;
object.height = max_resolution.height;
r1 = object;
} else {
r1 = undefined;
}
object2.maxResolution = r1;
return object2;
}
}
function _fun94442(a0) { // fn#94442, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12578:4657, offset: 0x0211805b, size: 1002 bytes, params: 2, frame: 16
const RTCControlSocket2 = RTCControlSocket;
Inherits(RTCControlSocket2, a0);
return CreateClass(RTCControlSocket2, [{key: 'createWebSocket', value: value_94444}, {key: 'send', value: value_94452},
{key: 'sendBinary', value: value_94453}, {key: 'doResumeOrClose', value: value_94454}, {key: 'doResume',
value: value_94455}, {key: 'handleHello', value: value_94456}, {key: 'handleReady', value: value_94457},
{key: 'handleResumed', value: function() {
this.backoff.succeed();
}}, {key: 'handleClose', value: value_94459}, {key: 'disconnect', value: value_94461}, {key: 'reconnect',
value: value_94462}, {key: 'cleanupWebSocket', value: value_94464}, {key: 'cleanupState', value: function() {
this.serverId = null;
this.channelId = null;
this.sessionId = null;
this.token = null;
this.resumable = false;
this.lastRecvSeqNum = null;
}}, {key: 'parseWebSocketMessage', value: value_94466}, {key: 'clearHelloTimeout', value: function() {
if (this.helloTimeout != null) {
global.clearTimeout(this.helloTimeout);
this.helloTimeout = null;
}
}}, {key: 'handleHeartbeatAck', value: value_94468}, {key: 'handleHeartbeatTimeout', value: function() {
var env0_0 = this;
this.cleanupWebSocket(_fun94470);
var property = this.backoff;
var value = property.fail(_fun94471);
property = this.logger;
value /= 1000;
value = value.toFixed(2);
property.warn('[HEARTBEAT ACK TIMEOUT] reconnecting in ' + value + ' seconds.');
}}, {key: 'startHeartbeater', value: value_94472}, {key: 'sendHeartbeat', value: value_94474},
{key: 'stopHeartbeater', value: function() {
if (this.heartbeater !== null) {
global.clearInterval(this.heartbeater);
this.heartbeater = null;
}
if (this.expeditedHeartbeatTimeout !== null) {
global.clearTimeout(this.expeditedHeartbeatTimeout);
this.expeditedHeartbeatTimeout = null;
}
}}, {key: 'connect', value: value_94476}, {key: 'identify', value: value_94477}, {key: 'expeditedHeartbeat',
value: value_94478}, {key: 'resetBackoff', value: value_94480}, {key: 'close', value: value_94481},
{key: 'destroy', value: function() {
this.close();
}}, {key: 'selectProtocol', value: value_94484}, {key: 'updateSession', value: value_94485}, {key: 'speaking',
value: value_94486}, {key: 'video', value: value_94487}, {key: 'mediaSinkWants', value: value_94488},
{key: 'secureFramesReadyForTransition', value: value_94489}, {key: 'sendMLSKeyPackage', value: value_94490},
{key: 'sendMLSCommitWelcome', value: value_94491}, {key: 'flagMLSInvalidCommitWelcome', value: value_94492},
{key: 'noRoute', value: value_94493}, {key: 'setHeartbeatIntervalModifier', value: function(a0) {
this.heartbeatIntervalModifier = a0;
}}]);
function RTCControlSocket(a0) { // fn#94443, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12578:4669, offset: 0x02118445, size: 404 bytes, params: 2, frame: 21
let value = a1;
const r7 = value !== undefined ? value : MediaEngineContextTypes.DEFAULT;
value = environment.__proto__;
env1_3(this, RTCControlSocket);
const value3 = env1_6(RTCControlSocket);
const value6 = env1_5(this, _isNativeReflectConstruct_94432() ? global.Reflect.construct(value3, [],
env1_6(this).constructor) : value3.apply(this, undefined));
const defaultImport = Backoff;
const value7 = Object.create(defaultImport.prototype, {constructor: {value: defaultImport}});
const defaultImport3 = new defaultImport(1000, 5000);
value6.backoff = defaultImport3 instanceof Object ? defaultImport3 : value7;
value6.serverVersion = 0;
value6.url = a0;
const defaultImport2 = Logger;
const value10 = 'RTCControlSocket(' + r7 + ')';
const value11 = Object.create(defaultImport2.prototype, {constructor: {value: defaultImport2}});
const defaultImport22 = new defaultImport2(value10);
value6.logger = defaultImport22 instanceof Object ? defaultImport22 : value11;
value6.logger.enableNativeLogger(true);
value6.webSocket = null;
const DISCONNECTED = env1_14.DISCONNECTED;
value6.connectionState = DISCONNECTED;
value6.helloTimeout = null;
value6.lastHeartbeatAckTime = null;
value6.heartbeatInterval = null;
value6.heartbeater = null;
value6.heartbeatAck = true;
value6.expeditedHeartbeatTimeout = null;
value6.heartbeatIntervalModifier = 1;
value6.connectionStartTime = 0;
value6.lastRecvSeqNum = null;
value6.sessionId = null;
value6.serverId = null;
value6.channelId = null;
value6.token = null;
value6.resumable = false;
return value6;
}
function value_94444() { // fn#94444, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12578:5470, offset: 0x021185d9, size: 304 bytes, params: 1, frame: 17
var environment;
const logger = this.logger;
logger.info('[CONNECT] ' + this.url);
let webSocket = this.webSocket;
if (webSocket !== null) {
this.logger.error('Connect called with already existing websocket');
this.cleanupWebSocket(function(a0) {
return a0.close(4000);
});
}
const value = environment.__proto__;
this.connectionStartTime = TimeUtilsModule.now();
this.helloTimeout = global.setTimeout(_fun94446, env1_15);
const WebSocket = global.WebSocket;
webSocket = new WebSocket('' + this.url + '?v=9');
this.webSocket = webSocket;
webSocket.binaryType = 'arraybuffer';
webSocket.onopen = onopen_94447;
webSocket.onmessage = onmessage_94448;
webSocket.onerror = onerror_94450;
webSocket.onclose = onclose_94451;
function _fun94446() { // fn#94446, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12578:5727, offset: 0x0211871f, size: 101 bytes, params: 1, frame: 17
let value = environment.__proto__.__proto__;
value = require(4303) /* metro dependency 4303: TimeUtils */;
value = value.now();
const binding = env0_0;
value -= binding.connectionStartTime;
const handleClose = binding.handleClose;
value = 'The connection timed out after ' + value + ' ms - did not receive OP_HELLO in time.';
Reflect.apply(handleClose, binding, [false, 0, value]);
}
function value_94444Onopen() { // fn#94447, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12578:5973, owner: value_94444.onopen, offset: 0x02118784, size: 265 bytes, params: 1, frame: 23
var binding;
const connectionState = env0_0.connectionState;
const CONNECTING = env2_14.CONNECTING;
if (connectionState === CONNECTING) {
binding = env0_0;
binding.emit(env2_18.Connect);
} else if (env0_0.connectionState === env2_14.RECONNECTING) {
env0_0.doResumeOrClose();
}
binding = env0_0;
const CONNECTED = env2_14.CONNECTED;
binding.connectionState = CONNECTED;
let value = TimeUtilsModule;
value = value.now();
value -= binding.connectionStartTime;
const logger = binding.logger;
logger.info('[CONNECTED] ' + binding.url + ' in ' + value + ' ms');
const emit = binding.emit;
const Ping = env2_18.Ping;
const Math = global.Math;
Reflect.apply(emit, binding, [Ping, Math.round(value / 2)]);
}
function value_94444Onmessage(a0) { // fn#94448, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12578:6278, owner: value_94444.onmessage, offset: 0x0211888d, size: 2235 bytes, params: 2, frame: 24
var r8;
var dave_protocol_version;
var logger;
var items2;
var DataView;
var buffer;
var byteOffset;
var value6;
var dataView;
var uint16;
var value9;
var value10;
var uint162;
var value13;
var speaking;
var SecureFramesInit;
let binding = env0_0;
const {op, seq, d} = binding.parseWebSocketMessage(a0);
let emit = binding.emit;
const ReceiveMessage = env2_18.ReceiveMessage;
Reflect.apply(emit, binding, [ReceiveMessage, op, d]);
if (seq) {
env0_0.lastRecvSeqNum = seq;
}
if (DeveloperOptionsStore.isLoggingGatewayEvents) {
if (d instanceof global.Uint8Array) {
items2 = [];
arraySpread(items2, d, 0, undefined);
env0_0.logger.info('~> ' + op + ': 0x' + items2.map(function(a0) {
return a0.toString(16).padStart(2, '0');
}).join(''));
} else {
logger = env0_0.logger;
logger.info('~> ' + op + ': ' + global.JSON.stringify(d));
}
}
const HELLO = env2_12.HELLO;
if (HELLO === op) {
binding = env0_0;
binding.clearHelloTimeout();
binding.handleHello(d);
} else if (env2_12.READY === op) {
env0_0.handleReady(d);
} else if (env2_12.RESUMED === op) {
env0_0.handleResumed(d);
} else if (env2_12.SELECT_PROTOCOL_ACK === op) {
if (d.bandwidth_estimation_experiment) {
binding = env0_0;
binding.emit(env2_18.BandwidthEstimationExperiment, d.bandwidth_estimation_experiment);
}
binding = env0_0;
binding.emit(env2_18.Codecs, d.audio_codec, d.video_codec);
if (d.media_session_id) {
binding = env0_0;
binding.emit(env2_18.MediaSessionId, d.media_session_id);
}
if (d.sdp) {
binding = env0_0;
binding.emit(env2_18.SDP, d.sdp);
} else if (d.mode) {
binding = env0_0;
binding.emit(env2_18.Encryption, d.mode, d.secret_key);
}
if (d.keyframe_interval) {
binding = env0_0;
binding.emit(env2_18.KeyframeInterval, d.keyframe_interval);
}
binding = env0_0;
emit = binding.emit;
SecureFramesInit = env2_18.SecureFramesInit;
dave_protocol_version = d.dave_protocol_version;
dave_protocol_version = !dave_protocol_version ? 0 : dave_protocol_version;
Reflect.apply(emit, binding, [SecureFramesInit, dave_protocol_version]);
env0_0.resumable = true;
} else if (env2_12.SPEAKING === op) {
speaking = d.speaking;
r8 = typeof speaking !== 'boolean' ? speaking : speaking ? SpeakingFlags.VOICE : SpeakingFlags.NONE;
binding = env0_0;
binding.emit(env2_18.Speaking, d.user_id, d.ssrc, r8);
} else if (env2_12.HEARTBEAT === op) {
env0_0.sendHeartbeat();
} else if (env2_12.HEARTBEAT_ACK === op) {
env0_0.handleHeartbeatAck(d);
} else if (env2_12.VIDEO === op) {
binding = env0_0;
binding.emit(env2_18.Video, d.user_id, d.audio_ssrc, d.video_ssrc, convertStreamParametersFromWire(d.streams));
} else if (env2_12.CLIENT_CONNECT === op) {
binding = env0_0;
binding.emit(env2_18.ClientConnect, d.user_ids);
} else if (env2_12.CLIENT_DISCONNECT === op) {
binding = env0_0;
binding.emit(env2_18.ClientDisconnect, d.user_id);
} else if (env2_12.SESSION_UPDATE === op) {
if (!(d.audio_codec == null && d.video_codec == null)) {
binding = env0_0;
binding.emit(env2_18.Codecs, d.audio_codec, d.video_codec);
}
if (d.media_session_id != null) {
binding = env0_0;
binding.emit(env2_18.MediaSessionId, d.media_session_id);
}
if (d.keyframe_interval) {
binding = env0_0;
binding.emit(env2_18.KeyframeInterval, d.keyframe_interval);
}
} else if (env2_12.MEDIA_SINK_WANTS === op) {
binding = env0_0;
binding.emit(env2_18.MediaSinkWants, d);
} else if (env2_12.VOICE_BACKEND_VERSION === op) {
if (d.voice != null && d.rtc_worker != null) {
binding = env0_0;
binding.emit(env2_18.VoiceBackendVersion, d.voice, d.rtc_worker);
}
} else if (env2_12.FLAGS === op) {
if (d.flags != null && d.user_id != null) {
binding = env0_0;
binding.emit(env2_18.Flags, d.user_id, d.flags);
}
} else if (env2_12.PLATFORM === op) {
if (d.platform != null && d.user_id != null) {
binding = env0_0;
binding.emit(env2_18.Platform, d.user_id, d.platform);
}
} else if (env2_12.DAVE_PROTOCOL_PREPARE_TRANSITION === op) {
if (d.transition_id != null && d.protocol_version != null) {
binding = env0_0;
binding.emit(env2_18.SecureFramesPrepareTransition, d.transition_id, d.protocol_version);
}
} else if (env2_12.DAVE_PROTOCOL_EXECUTE_TRANSITION === op) {
if (d.transition_id != null) {
binding = env0_0;
binding.emit(env2_18.SecureFramesExecuteTransition, d.transition_id);
}
} else if (env2_12.DAVE_PROTOCOL_PREPARE_EPOCH === op) {
if (d.epoch != null && d.protocol_version != null) {
binding = env0_0;
binding.emit(env2_18.SecureFramesPrepareEpoch, d.epoch, d.protocol_version);
}
} else if (env2_12.MLS_EXTERNAL_SENDER_PACKAGE === op) {
binding = env0_0;
binding.emit(env2_18.MLSExternalSenderPackage, d);
} else if (env2_12.MLS_PROPOSALS === op) {
binding = env0_0;
binding.emit(env2_18.MLSProposals, d);
} else if (env2_12.MLS_PREPARE_COMMIT_TRANSITION === op) {
DataView = global.DataView;
buffer = d.buffer;
byteOffset = d.byteOffset;
value10 = Object.create(DataView.prototype, {constructor: {value: DataView}});
dataView = new DataView(buffer, byteOffset, 2);
uint162 = (dataView instanceof Object ? dataView : value10).getUint16(0, false);
value13 = d.slice(2);
binding = env0_0;
binding.emit(env2_18.MLSPrepareCommitTransition, uint162, value13);
} else if (env2_12.MLS_WELCOME === op) {
DataView = global.DataView;
buffer = d.buffer;
byteOffset = d.byteOffset;
value6 = Object.create(DataView.prototype, {constructor: {value: DataView}});
dataView = new DataView(buffer, byteOffset, 2);
uint16 = (dataView instanceof Object ? dataView : value6).getUint16(0, false);
value9 = d.slice(2);
binding = env0_0;
binding.emit(env2_18.MLSWelcome, uint16, value9);
} else {
env0_0.logger.info('Unhandled op ' + op);
}
}
function value_94444Onerror() { // fn#94450, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12578:9287, owner: value_94444.onerror, offset: 0x0211916f, size: 32 bytes, params: 1, frame: 15
return env0_0.handleClose(false, 0, 'An error with the websocket occurred');
}
function value_94444Onclose({wasClean, code, reason}) { // fn#94451, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12578:9363, owner: value_94444.onclose, offset: 0x0211918f, size: 42 bytes, params: 2, frame: 15
return env0_0.handleClose(wasClean, code, reason);
}
}
function value_94452(a0) { // fn#94452, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12578:9439, offset: 0x021191b9, size: 206 bytes, params: 2, frame: 22
var JSON;
var value2;
var error;
let value = a1;
const r5 = value !== undefined ? value : null;
const webSocket = this.webSocket;
if (webSocket != null) {
if (webSocket.readyState === global.WebSocket.OPEN) {
JSON = global.JSON;
value = JSON.stringify({op: a0, d: r5});
value2 = environment.__proto__;
if (DeveloperOptionsStore.isLoggingGatewayEvents) {
this.logger.info('<~ ' + value);
}
this.emit(env1_18.SendMessage, a0, r5);
try {
webSocket.send(value);
} catch (error) {
}
}
}
}
function value_94454() { // fn#94454, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12578:9887, offset: 0x0211931b, size: 168 bytes, params: 1, frame: 17
const value2 = (TimeUtilsModule).now();
if (this.serverId === null) {
this.disconnect(false, env1_13.UNRESUMABLE, 'Cannot resume connection.');
} else if (this.channelId === null) {
this.disconnect(false, env1_13.UNRESUMABLE, 'Cannot resume connection.');
} else if (this.token === null) {
this.disconnect(false, env1_13.UNRESUMABLE, 'Cannot resume connection.');
} else if (this.sessionId === null) {
this.disconnect(false, env1_13.UNRESUMABLE, 'Cannot resume connection.');
} else if (this.resumable) {
if (this.lastHeartbeatAckTime == null) {
this.doResume();
this.lastHeartbeatAckTime = value2;
} else if (value2 - this.lastHeartbeatAckTime <= env1_16) {
this.doResume();
this.lastHeartbeatAckTime = value2;
} else {
this.disconnect(false, env1_13.UNRESUMABLE, 'Cannot resume connection.');
}
} else {
this.disconnect(false, env1_13.UNRESUMABLE, 'Cannot resume connection.');
}
}
function value_94455() { // fn#94455, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12578:10220, offset: 0x021193c3, size: 269 bytes, params: 1, frame: 26
const r4 = this.lastRecvSeqNum ?? -1;
const logger = this.logger;
const info = logger.info;
const serverId = this.serverId;
value = '';
Reflect.apply(info, logger,
['[RESUME] resuming session. serverId=' + (serverId ?? value) + ' channelId=' + (this.channelId ?? value) + ' sessionId=' + (this.sessionId ?? value) + ' seqAck=' + r4]);
const emit = this.emit;
value = environment.__proto__;
const Resuming = env1_18.Resuming;
Reflect.apply(emit, this, [Resuming]);
const RESUMING = env1_14.RESUMING;
this.connectionState = RESUMING;
const send = this.send;
const RESUME = env1_12.RESUME;
Reflect.apply(send, this, [RESUME, {token: this.token, session_id: this.sessionId, server_id: this.serverId,
channel_id: this.channelId, seq_ack: r4}]);
}
function value_94456(a0) { // fn#94456, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12578:10672, offset: 0x021194d0, size: 368 bytes, params: 2, frame: 25
const isPlatformEmbedded = (PlatformUtilsModule).isPlatformEmbedded;
var Math;
const v = a0.v;
let value = 3;
this.serverVersion = v ?? value;
if (this.serverVersion <= value) {
value = environment.__proto__;
value = 0.1;
this.heartbeatInterval = a0.heartbeat_interval * (isPlatformEmbedded ? 0.25 : value);
} else {
this.heartbeatInterval = a0.heartbeat_interval * this.heartbeatIntervalModifier;
value = environment.__proto__;
if (!isPlatformEmbedded) {
Math = global.Math;
this.heartbeatInterval = Math.min(env1_17, this.heartbeatInterval ?? global.NaN);
}
}
value = environment.__proto__;
value = require(4303) /* metro dependency 4303: TimeUtils */;
value = value.now();
value -= this.connectionStartTime;
const logger = this.logger;
logger.info('[HELLO] heartbeat interval: ' + (this.heartbeatInterval ?? '??') + ', version: ' + this.serverVersion + ', took ' + value + ' ms');
this.startHeartbeater();
}
function value_94457({ip, port, modes, ssrc, streams, experiments}) { // fn#94457, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12578:11268, offset: 0x02119640, size: 223 bytes, params: 2, frame: 25
this.backoff.succeed();
const value = environment.__proto__;
this.logger.info('[READY] took ' + ((TimeUtilsModule).now() - this.connectionStartTime) + ' ms');
if (this.serverVersion >= 6) {
this.send(env1_12.VOICE_BACKEND_VERSION, {});
}
const emit = this.emit;
const Ready = env1_18.Ready;
Reflect.apply(emit, this, [Ready, ip, port, modes, ssrc, convertStreamParametersFromWire(streams), experiments]);
}
function value_94459(a0, a1, a2) { // fn#94459, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12578:11644, offset: 0x02119736, size: 343 bytes, params: 4, frame: 29
var logger;
var warn;
var value3;
let value = a0;
const env0_2 = a1;
const env0_3 = a2;
const DISCONNECTED = env1_14.DISCONNECTED;
this.connectionState = DISCONNECTED;
const r4 = value || false;
this.cleanupWebSocket();
const AUTHENTICATION_FAILED = env1_13.AUTHENTICATION_FAILED;
if (a1 === AUTHENTICATION_FAILED) {
return this.disconnect(r4, a1, a2);
}
const SERVER_CRASH = env1_13.SERVER_CRASH;
if (a1 === SERVER_CRASH) {
return this.disconnect(r4, a1, a2);
}
const SERVER_NOT_FOUND = env1_13.SERVER_NOT_FOUND;
if (a1 === SERVER_NOT_FOUND) {
return this.disconnect(r4, a1, a2);
}
const INVALID_SESSION = env1_13.INVALID_SESSION;
if (a1 === INVALID_SESSION) {
return this.disconnect(r4, a1, a2);
}
if (this.backoff.fails > 3) {
this.logger.warn('[WS CLOSED] Backoff exceed. Resetting.');
this.disconnect(r4, a1, a2);
} else {
value = this.backoff.fail(_fun94460);
logger = this.logger;
warn = logger.warn;
value3 = r4.toString();
value /= 1000;
value = value.toFixed(2);
Reflect.apply(warn, logger,
['[WS CLOSED] (clean: ' + value3 + ', code: ' + a1 + ', reason: ' + a2 + ') retrying in ' + value + ' seconds.']);
}
function _fun94460() { // fn#94460, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12578:11992, offset: 0x0211988d, size: 34 bytes, params: 1, frame: 15
const binding = env0_0;
return binding.reconnect(env0_1, require, importDefault);
}
}
function value_94461(a0, a1, a2) { // fn#94461, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12578:12173, offset: 0x021198af, size: 159 bytes, params: 4, frame: 24
const logger = this.logger;
logger.warn('[DISCONNECT] (' + a0.toString() + ', ' + a1 + ', ' + a2 + ')');
this.cleanupWebSocket();
this.cleanupState();
value = environment.__proto__;
const DISCONNECTED = env1_14.DISCONNECTED;
this.connectionState = DISCONNECTED;
const emit = this.emit;
const Disconnect = env1_18.Disconnect;
Reflect.apply(emit, this, [Disconnect, a0, a1, a2]);
}
function value_94462(a0, a1, a2) { // fn#94462, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12578:12387, offset: 0x0211994e, size: 126 bytes, params: 4, frame: 22
var environment;
const logger = this.logger;
logger.info('[RECONNECT] wasClean=' + a0.toString() + ' code=' + a1 + ' reason=' + a2);
this.cleanupWebSocket(function(a0) {
return a0.close(4000);
});
value = environment.__proto__;
const RECONNECTING = env1_14.RECONNECTING;
this.connectionState = RECONNECTING;
this.createWebSocket();
}
function value_94464(a0) { // fn#94464, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12578:12614, offset: 0x021199cc, size: 108 bytes, params: 2, frame: 14
var value;
var noop_94435Binding;
this.stopHeartbeater();
this.clearHelloTimeout();
const webSocket = this.webSocket;
this.webSocket = null;
if (webSocket != null) {
value = environment.__proto__;
noop_94435Binding = noop_94435;
webSocket.onopen = noop_94435Binding;
webSocket.onmessage = noop_94435Binding;
webSocket.onerror = noop_94435Binding;
webSocket.onclose = noop_94435Binding;
if (a0 != null) {
a0(webSocket);
}
}
this.backoff.cancel();
}
function value_94468(a0) { // fn#94468, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12578:13423, offset: 0x02119b61, size: 204 bytes, params: 2, frame: 19
let value = a0;
this.logger.info('Heartbeat ACK received');
const r8 = this.serverVersion >= 8 ? value.t : value;
const emit = this.emit;
value = environment.__proto__;
const Ping = env1_18.Ping;
value = require(4303) /* metro dependency 4303: TimeUtils */;
Reflect.apply(emit, this, [Ping, value.now() - r8]);
value = require(4303) /* metro dependency 4303: TimeUtils */;
this.lastHeartbeatAckTime = value.now();
this.heartbeatAck = true;
if (this.expeditedHeartbeatTimeout !== null) {
global.clearTimeout(this.expeditedHeartbeatTimeout);
this.expeditedHeartbeatTimeout = null;
this.logger.info('Expedited heartbeat succeeded');
}
}
function value_94469() { // fn#94469, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12578:13826, offset: 0x02119c2d, size: 126 bytes, params: 1, frame: 15
this.cleanupWebSocket(function(a0) {
return a0.close(4000);
});
let value = this.backoff.fail(_fun94471);
const logger = this.logger;
const warn = logger.warn;
value /= 1000;
value = value.toFixed(2);
Reflect.apply(warn, logger, ['[HEARTBEAT ACK TIMEOUT] reconnecting in ' + value + ' seconds.']);
function _fun94471() { // fn#94471, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12578:13903, offset: 0x02119cab, size: 43 bytes, params: 1, frame: 15
const binding = env0_0;
const reconnect = binding.reconnect;
const HEARTBEAT_TIMEOUT = env2_13.HEARTBEAT_TIMEOUT;
return Reflect.apply(reconnect, binding, [false, HEARTBEAT_TIMEOUT, 'Heartbeat timeout.']);
}
}
function value_94472() { // fn#94472, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12578:14092, offset: 0x02119cd6, size: 173 bytes, params: 1, frame: 19
var environment;
const value = environment.__proto__;
(Module00044)(this.heartbeatInterval != null,
'RTCControlSocket: Heartbeat interval should never null here.');
const logger = this.logger;
logger.info('Starting heartbeat with interval: ' + this.heartbeatInterval);
if (this.heartbeater !== null) {
global.clearInterval(this.heartbeater);
}
this.heartbeatAck = true;
this.heartbeater = global.setInterval(_fun94473, this.heartbeatInterval);
function _fun94473() { // fn#94473, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12578:14393, offset: 0x02119d83, size: 70 bytes, params: 1, frame: 11
const heartbeatAck = env0_0.heartbeatAck;
const binding = env0_0;
if (heartbeatAck) {
binding.heartbeatAck = false;
binding.sendHeartbeat();
} else if (binding.expeditedHeartbeatTimeout === null) {
env0_0.handleHeartbeatTimeout();
}
}
}
function value_94474() { // fn#94474, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12578:14584, offset: 0x02119dc9, size: 236 bytes, params: 1, frame: 17
var r4;
var send;
var value;
var HEARTBEAT;
var lastRecvSeqNum;
var object;
if (this.serverVersion >= 8) {
lastRecvSeqNum = this.lastRecvSeqNum;
value = -1;
r4 = lastRecvSeqNum ?? value;
this.logger.info('Sending heartbeat with last received sequence number: ' + r4);
send = this.send;
value = environment.__proto__;
HEARTBEAT = env1_12.HEARTBEAT;
object = {};
value = require(4303) /* metro dependency 4303: TimeUtils */;
object.t = value.now();
object.seq_ack = r4;
Reflect.apply(send, this, [HEARTBEAT, object]);
} else {
this.logger.info('Sending heartbeat');
send = this.send;
value = environment.__proto__;
HEARTBEAT = env1_12.HEARTBEAT;
value = require(4303) /* metro dependency 4303: TimeUtils */;
Reflect.apply(send, this, [HEARTBEAT, value.now()]);
}
}
function value_94476() { // fn#94476, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12578:15144, offset: 0x02119f08, size: 103 bytes, params: 1, frame: 12
var r0;
const connectionState = this.connectionState;
const value = environment.__proto__;
const DISCONNECTED = env1_14.DISCONNECTED;
if (connectionState !== DISCONNECTED) {
this.logger.error('Cannot start a new connection, connection state is not disconnected');
r0 = false;
} else {
this.connectionState = env1_14.CONNECTING;
this.createWebSocket();
this.emit(env1_18.Connecting);
r0 = true;
}
return r0;
}
function value_94477({serverId, channelId, userId, sessionId, token, maxDaveProtocolVersion, video, streamParameters}) { // fn#94477, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12578:15404, offset: 0x02119f6f, size: 179 bytes, params: 2, frame: 23
video = !(video === undefined) && video;
this.serverId = serverId;
this.channelId = channelId;
this.sessionId = sessionId;
this.token = token;
const value = environment.__proto__;
const IDENTIFYING = env1_14.IDENTIFYING;
this.connectionState = IDENTIFYING;
const send = this.send;
const IDENTIFY = env1_12.IDENTIFY;
const object = {server_id: serverId, channel_id: channelId, user_id: userId, session_id: sessionId, token: token,
max_dave_protocol_version: maxDaveProtocolVersion, video: video};
object.streams = convertStreamParametersToWire(streamParameters);
Reflect.apply(send, this, [IDENTIFY, object]);
}
function value_94478(a0) { // fn#94478, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12578:15812, offset: 0x0211a022, size: 235 bytes, params: 2, frame: 18
var logger;
let value = a1;
const value2 = a2;
const r8 = value !== undefined ? value : '';
if (this.webSocket != null) {
logger = this.logger;
value = '';
logger.info('Performing an expedited heartbeat ' + (value === r8 ? value : 'reason: ' + r8));
this.heartbeatAck = false;
this.sendHeartbeat();
if (this.expeditedHeartbeatTimeout !== null) {
global.clearTimeout(this.expeditedHeartbeatTimeout);
}
this.expeditedHeartbeatTimeout = global.setTimeout(_fun94479, a0);
} else {
if (!(value2 !== undefined) || value2) {
return this.resetBackoff(r8);
}
logger = this.logger;
value = '';
logger.info('Expedited heartbeat requested, but is disconnected and a reset was not requested ' + (value === r8 ? value : 'reason: ' + r8));
}
return false;
function _fun94479() { // fn#94479, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12578:16107, offset: 0x0211a10d, size: 45 bytes, params: 1, frame: 10
const binding = env0_0;
binding.expeditedHeartbeatTimeout = null;
if (binding.heartbeatAck === false) {
env0_0.handleHeartbeatTimeout();
}
}
}
function value_94480() { // fn#94480, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12578:16409, offset: 0x0211a13a, size: 151 bytes, params: 1, frame: 17
var logger;
var reconnect;
let value = a0;
const r6 = value !== undefined ? value : '';
let r0 = this.backoff.fails > 0 && this.webSocket == null;
if (r0) {
logger = this.logger;
value = '';
logger.info('Connection backoff reset ' + (value === r6 ? value : 'for reason: ' + r6));
this.backoff.succeed();
reconnect = this.reconnect;
value = environment.__proto__;
Reflect.apply(reconnect, this, [false, env1_13.RESET_BACKOFF, 'Reset backoff.']);
value = true;
r0 = value;
}
return r0;
}
function value_94481() { // fn#94481, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12578:16651, offset: 0x0211a1d1, size: 114 bytes, params: 1, frame: 17
this.logger.info('CLOSE');
this.cleanupWebSocket(function(a0) {
return a0.close(4000);
});
this.cleanupState();
const DISCONNECTED = env1_14.DISCONNECTED;
this.connectionState = DISCONNECTED;
const emit = this.emit;
const Disconnect = env1_18.Disconnect;
Reflect.apply(emit, this, [Disconnect, true, 1000, 'Force Close']);
}
function value_94484(a0, a1, a2, a3) { // fn#94484, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12578:16907, offset: 0x0211a254, size: 382 bytes, params: 5, frame: 20
var r10;
var r0;
var r4;
var r5;
var sdp;
var Boolean;
var object;
var value6;
let object2 = {};
let value = null;
if (value == a2) {
r4 = object2;
r5 = value;
} else if ('sdp' in a2) {
sdp = a2.sdp;
if (value == sdp) {
r0 = 'address' in a2 && value != a2.address;
r0 = r0 && a2.address !== '';
if (r0) {
Boolean = global.Boolean;
r0 = Boolean(a2.port);
r10 = Boolean;
}
r0 = r0 && value != a2.mode;
r0 = r0 && a2.mode !== '';
value = undefined;
if (r0) {
object2 = {};
object2.address = a2.address;
object2.port = a2.port;
object2.mode = a2.mode;
object = {};
copyDataProperties(object, a2, r10);
value6 = environment.__proto__;
object['codecs'] = convertCodecs(a2.codecs);
object['rtc_connection_id'] = a1;
object['experiments'] = a3;
r4 = object;
r5 = object2;
} else {
r4 = object2;
r5 = value;
}
} else {
sdp = a2.sdp;
if (sdp !== '') {
sdp = a2.sdp;
object2 = {};
copyDataProperties(object2, a2, r10);
value = environment.__proto__;
value = convertCodecs(a2.codecs);
object2['codecs'] = value;
object2['rtc_connection_id'] = a1;
r4 = object2;
r5 = sdp;
} else {
r0 = 'address' in a2 && value != a2.address;
r0 = r0 && a2.address !== '';
if (r0) {
Boolean = global.Boolean;
r0 = Boolean(a2.port);
r10 = Boolean;
}
r0 = r0 && value != a2.mode;
r0 = r0 && a2.mode !== '';
value = undefined;
if (r0) {
object2 = {};
object2.address = a2.address;
object2.port = a2.port;
object2.mode = a2.mode;
object = {};
copyDataProperties(object, a2, r10);
value6 = environment.__proto__;
object['codecs'] = convertCodecs(a2.codecs);
object['rtc_connection_id'] = a1;
object['experiments'] = a3;
r4 = object;
r5 = object2;
} else {
r4 = object2;
r5 = value;
}
}
}
} else {
r0 = 'address' in a2 && value != a2.address;
r0 = r0 && a2.address !== '';
if (r0) {
Boolean = global.Boolean;
r0 = Boolean(a2.port);
r10 = Boolean;
}
r0 = r0 && value != a2.mode;
r0 = r0 && a2.mode !== '';
value = undefined;
if (r0) {
object2 = {};
object2.address = a2.address;
object2.port = a2.port;
object2.mode = a2.mode;
object = {};
copyDataProperties(object, a2, r10);
value6 = environment.__proto__;
object['codecs'] = convertCodecs(a2.codecs);
object['rtc_connection_id'] = a1;
object['experiments'] = a3;
r4 = object;
r5 = object2;
} else {
r4 = object2;
r5 = value;
}
}
const send = this.send;
value = environment.__proto__;
const SELECT_PROTOCOL = env1_12.SELECT_PROTOCOL;
object2 = {protocol: a0, data: r5};
copyDataProperties(object2, r4, r10);
Reflect.apply(send, this, [SELECT_PROTOCOL, object2]);
}
function value_94485({codecs}) { // fn#94485, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12578:17353, offset: 0x0211a3d2, size: 57 bytes, params: 2, frame: 16
const send = this.send;
const SESSION_UPDATE = env1_12.SESSION_UPDATE;
const object = {};
object.codecs = convertCodecs(codecs);
Reflect.apply(send, this, [SESSION_UPDATE, object]);
}
function value_94486(a0) { // fn#94486, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12578:17450, offset: 0x0211a40b, size: 99 bytes, params: 2, frame: 20
var r7;
let value = a0;
const value2 = a1;
const value3 = a2;
const r6 = value2 !== undefined ? value2 : 0;
const r5 = value3 !== undefined ? value3 : 0;
const send = this.send;
const SPEAKING = env1_12.SPEAKING;
if (this.serverVersion <= 3) {
value = global.Boolean(value);
r7 = value;
} else {
r7 = value;
}
Reflect.apply(send, this, [SPEAKING, {speaking: r7, delay: r6, ssrc: r5}]);
}
function value_94487(a0, a1, a2, a3) { // fn#94487, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12578:17574, offset: 0x0211a46e, size: 75 bytes, params: 5, frame: 16
const send = this.send;
const VIDEO = env1_12.VIDEO;
const object = {audio_ssrc: a0, video_ssrc: a1, rtx_ssrc: a2};
object.streams = convertStreamParametersToWire(a3);
Reflect.apply(send, this, [VIDEO, object]);
}
function value_94488(a0) { // fn#94488, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12578:17721, offset: 0x0211a4b9, size: 48 bytes, params: 2, frame: 13
var send;
var value;
if (this.serverVersion >= 5) {
send = this.send;
value = environment.__proto__;
Reflect.apply(send, this, [env1_12.MEDIA_SINK_WANTS, a0]);
}
}
function value_94489(a0) { // fn#94489, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12578:17834, offset: 0x0211a4e9, size: 42 bytes, params: 2, frame: 14
const send = this.send;
const DAVE_PROTOCOL_READY_FOR_TRANSITION = env1_12.DAVE_PROTOCOL_READY_FOR_TRANSITION;
Reflect.apply(send, this, [DAVE_PROTOCOL_READY_FOR_TRANSITION, {transition_id: a0}]);
}
function value_94490(a0) { // fn#94490, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12578:17945, offset: 0x0211a513, size: 86 bytes, params: 2, frame: 15
this.logger.info('Sending MLS key package');
const sendBinary = this.sendBinary;
const value = environment.__proto__;
const MLS_KEY_PACKAGE = env1_12.MLS_KEY_PACKAGE;
const Uint8Array = global.Uint8Array;
Reflect.apply(sendBinary, this, [MLS_KEY_PACKAGE, new Uint8Array(a0)]);
}
function value_94491(a0) { // fn#94491, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12578:18090, offset: 0x0211a569, size: 86 bytes, params: 2, frame: 15
this.logger.info('Sending MLS commit + welcome message');
const sendBinary = this.sendBinary;
const value = environment.__proto__;
const MLS_COMMIT_WELCOME = env1_12.MLS_COMMIT_WELCOME;
const Uint8Array = global.Uint8Array;
Reflect.apply(sendBinary, this, [MLS_COMMIT_WELCOME, new Uint8Array(a0)]);
}
function value_94492(a0) { // fn#94492, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12578:18258, offset: 0x0211a5bf, size: 42 bytes, params: 2, frame: 14
const send = this.send;
const MLS_INVALID_COMMIT_WELCOME = env1_12.MLS_INVALID_COMMIT_WELCOME;
Reflect.apply(send, this, [MLS_INVALID_COMMIT_WELCOME, {transition_id: a0}]);
}
function value_94493() { // fn#94493, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12578:18351, offset: 0x0211a5e9, size: 34 bytes, params: 1, frame: 13
const send = this.send;
const CLIENT_CANNOT_REACH_RTC_SERVER = env1_12.CLIENT_CANNOT_REACH_RTC_SERVER;
Reflect.apply(send, this, [CLIENT_CANNOT_REACH_RTC_SERVER, {}]);
}
}
}
function _fun94437({name, type, priority, payloadType, rtxPayloadType, encode, decode}) { // fn#94437, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12578:2564, offset: 0x02117e13, size: 94 bytes, params: 2, frame: 4
return {name: name, type: type, priority: 1000 * priority, payload_type: payloadType,
rtx_payload_type: rtxPayloadType, encode: encode, decode: decode};
}
function _fun94439(a0) { // fn#94439, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12578:2785, offset: 0x02117e94, size: 165 bytes, params: 2, frame: 5
var r1;
var object;
const object2 = {};
object2.type = a0.type;
object2.rid = a0.rid;
object2.ssrc = a0.ssrc;
object2.active = a0.active;
object2.quality = a0.quality;
object2.rtx_ssrc = a0.rtxSsrc;
object2.max_bitrate = a0.maxBitrate;
object2.max_framerate = a0.maxFrameRate;
let maxResolution = a0.maxResolution;
if (maxResolution != null) {
object = {};
maxResolution = a0.maxResolution;
object.type = maxResolution.type;
maxResolution = a0.maxResolution;
object.width = maxResolution.width;
maxResolution = a0.maxResolution;
object.height = maxResolution.height;
r1 = object;
} else {
r1 = undefined;
}
object2.max_resolution = r1;
return object2;
}
function value_94453(a0, a1) { // fn#94453, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12578:9690, offset: 0x02119287, size: 148 bytes, params: 3, frame: 18
var Uint8Array;
var value;
var uint8Array;
var send;
var buffer;
var error;
const webSocket = this.webSocket;
if (webSocket != null) {
if (webSocket.readyState === global.WebSocket.OPEN) {
Uint8Array = global.Uint8Array;
value = a1.byteLength + 1;
uint8Array = new Uint8Array();
uint8Array[0] = a0;
uint8Array.set(a1, 1);
try {
send = webSocket.send;
buffer = uint8Array.buffer;
Reflect.apply(send, webSocket, [buffer]);
} catch (error) {
}
}
}
}
function value_94466(a0) { // fn#94466, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12578:13017, offset: 0x02119a67, size: 204 bytes, params: 2, frame: 17
var r1;
var r4;
var uint8Array;
var serverVersion;
var DataView;
var buffer;
var value3;
var dataView;
var object;
const data = a0.data;
const ArrayBuffer = global.ArrayBuffer;
if (data instanceof ArrayBuffer) {
uint8Array = new global.Uint8Array(a0.data);
serverVersion = this.serverVersion;
if (serverVersion >= 8) {
DataView = global.DataView;
buffer = uint8Array.buffer;
value3 = Object.create(DataView.prototype, {constructor: {value: DataView}});
dataView = new DataView();
r1 = (dataView instanceof Object ? dataView : value3).getUint16(0, false);
} else {
r1 = null;
}
serverVersion = this.serverVersion;
r4 = serverVersion >= 8 ? 2 : 0;
object = {op: uint8Array[r4], seq: r1};
object.d = uint8Array.subarray(r4 + 1);
return object;
}
const JSON = global.JSON;
return JSON.parse(a0.data);
}
function _fun94470(a0) { // fn#94470, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12578:13860, offset: 0x02118709, size: 22 bytes, params: 2, frame: 11
return a0.close(4000);
}
global.__d(_fun94431, 12392, [6, 7, 15, 17, 18, 691, 4291, 672, 561, 3, 4303, 477, 44, 4479,
2]) /* metro module 12392, dependencies: [6, 7, 15, 17, 18, 691, 4291, 672, 561, 3, 4303, 477, 44, 4479, 2] */;