139 lines
7.7 KiB
TypeScript
139 lines
7.7 KiB
TypeScript
/* Metro module 6889; source: lib/guild/GuildMemberSubscriptions.tsx; dependencies: [6, 7, 672, 4041, 21, 3, 22, 2] */
|
|
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 SnowflakeUtils from '../../utils/SnowflakeUtils.tsx'; /* Metro dependency 21 */
|
|
import defaultImport22 from '../../by-id/module-00022.js'; /* Metro dependency 22 */
|
|
import Durations from '../../utils/Durations.tsx'; /* Metro dependency 672 */
|
|
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as TimersModule from '../../external/discord_common/js/packages/timers/Timers.tsx'; /* Metro dependency 4041 */
|
|
|
|
function _fun54697(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#54697, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7067:6, offset: 0x0136c22e, size: 168 bytes, params: 8, frame: 19
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const Millis = (Durations).Millis;
|
|
const MINUTE = Millis.MINUTE;
|
|
const env0_5 = 1 * MINUTE;
|
|
const value = _fun54698();
|
|
(FileImportTrackerModule).fileFinishedImporting('lib/guild/GuildMemberSubscriptions.tsx');
|
|
exports.default = value;
|
|
function _fun54698() { // fn#54698, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7067:144, offset: 0x0136c2d6, size: 243 bytes, params: 1, frame: 15
|
|
return CreateClass(GuildMemberSubscriptions, [{key: 'reset', value: function() {
|
|
this._subscriptions = {};
|
|
this._unsubscriptions = {};
|
|
this._unsubscribe.cancel();
|
|
}}, {key: 'get', value: value_54702}, {key: 'clear', value: function(a0) {
|
|
delete this._subscriptions[a0];
|
|
delete this._unsubscriptions[a0];
|
|
}}, {key: 'subscribe', value: function(a0, a1) {
|
|
var r0;
|
|
r0 = this._subscriptions[a0] ?? ({});
|
|
r0[a1] = (r0[a1] ?? 0) + 1;
|
|
this._subscriptions[a0] = r0;
|
|
if (r0[a1] === 1) {
|
|
this._onChange(a0, this.get(a0));
|
|
}
|
|
this.checkForLeaks(a0, a1);
|
|
}}, {key: 'isSubscribed', value: function(a0, a1) {
|
|
return this._subscriptions[a0] != null && this._subscriptions[a0][a1] != null;
|
|
}}, {key: 'isSubscribedToAnyMember', value: function(a0) {
|
|
return this.get(a0).length > 0;
|
|
}}, {key: 'unsubscribe', value: function(a0, a1) {
|
|
var r1;
|
|
var property;
|
|
if (this.isSubscribed(a0, a1)) {
|
|
property = this._unsubscriptions[a0];
|
|
r1 = property ?? ({});
|
|
property = r1[a1];
|
|
r1[a1] = (property ?? 0) + 1;
|
|
this._unsubscriptions[a0] = r1;
|
|
if (r1[a1] === 1) {
|
|
this._unsubscribe.delay(false);
|
|
}
|
|
}
|
|
}}, {key: 'checkForLeaks', value: value_54708}, {key: 'flushUnsubscriptions', value: value_54709}]);
|
|
function GuildMemberSubscriptions(a0) { // fn#54699, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7067:165, offset: 0x0136c3c9, size: 119 bytes, params: 2, frame: 16
|
|
var environment;
|
|
const value = environment.__proto__;
|
|
env1_3(this, GuildMemberSubscriptions);
|
|
this._subscriptions = {};
|
|
this._unsubscriptions = {};
|
|
const DelayedCall = (TimersModule).DelayedCall;
|
|
this._unsubscribe = new DelayedCall(env1_5, _fun54700);
|
|
this._onChange = a0;
|
|
function _fun54700() { // fn#54700, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7067:329, offset: 0x0136c440, size: 21 bytes, params: 1, frame: 9
|
|
return env0_0.flushUnsubscriptions();
|
|
}
|
|
|
|
}
|
|
|
|
function value_54702(a0) { // fn#54702, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7067:507, offset: 0x0136c47c, size: 61 bytes, params: 2, frame: 12
|
|
const r2 = this._subscriptions[a0] ?? ({});
|
|
const value = environment.__proto__;
|
|
return (SnowflakeUtils).keys(r2);
|
|
}
|
|
|
|
function value_54708(a0, a1) { // fn#54708, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7067:1322, offset: 0x0136c602, size: 183 bytes, params: 3, frame: 18
|
|
var value4;
|
|
var defaultImport;
|
|
var value5;
|
|
var defaultImport2;
|
|
let property = this._subscriptions[a0];
|
|
const value = undefined;
|
|
const r7 = property == null ? value : property[a1];
|
|
const value2 = 0;
|
|
const r1 = r7 ?? value2;
|
|
property = this._unsubscriptions[a0];
|
|
const value3 = r1 - ((property == null ? value : property[a1]) ?? value2);
|
|
if (value3 > 5) {
|
|
value4 = environment.__proto__;
|
|
defaultImport = importDefault(3) /* metro dependency 3: Logger */;
|
|
value5 = Object.create(defaultImport.prototype, {constructor: {value: defaultImport}});
|
|
defaultImport2 = new defaultImport('GuildMemberSubscriptions');
|
|
(defaultImport2 instanceof Object ? defaultImport2 : value5).warn('GuildMemberSubscriptions.subscribe(...): Potential reference leak! (' + value3 + ' subscriptions)');
|
|
}
|
|
return value;
|
|
}
|
|
|
|
function value_54709() { // fn#54709, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7067:1652, offset: 0x0136c6b9, size: 103 bytes, params: 1, frame: 17
|
|
var environment;
|
|
let value = environment.__proto__;
|
|
const defaultImport = defaultImport22;
|
|
if (!defaultImport.isEmpty(this._unsubscriptions)) {
|
|
value = defaultImport;
|
|
value.forEach(this._unsubscriptions, _fun54710);
|
|
this._unsubscriptions = {};
|
|
}
|
|
function _fun54710(a0, a1) { // fn#54710, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7067:1743, offset: 0x0136c720, size: 135 bytes, params: 3, frame: 20
|
|
const property = property2._subscriptions[a1];
|
|
var property2 = property;
|
|
(defaultImport22).forEach(a0, _fun54711);
|
|
const defaultImport2 = defaultImport22;
|
|
if (defaultImport2.isEmpty(property)) {
|
|
delete property2._subscriptions[a1];
|
|
}
|
|
const binding = property2;
|
|
const _onChange = binding._onChange;
|
|
const get = binding.get;
|
|
Reflect.apply(_onChange, binding, [a1, Reflect.apply(get, binding, [a1])]);
|
|
function _fun54711(a0, a1) { // fn#54711, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7067:1799, offset: 0x0136c7a7, size: 65 bytes, params: 3, frame: 7
|
|
const binding = env0_0;
|
|
const property = binding[a1];
|
|
const value2 = 0;
|
|
binding[a1] = (property ?? value2) - a0;
|
|
if (env0_0[a1] <= value2) {
|
|
delete env0_0[a1];
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun54697, 6889, [6, 7, 672, 4041, 21, 3, 22,
|
|
2]) /* metro module 6889, dependencies: [6, 7, 672, 4041, 21, 3, 22, 2] */;
|