331 lines
14 KiB
React
331 lines
14 KiB
React
/* Metro module 7469; source: unknown; dependencies: [57, 6, 7, 7466, 7383, 7470, 7471, 7374, 7472] */
|
|
function _fun60232(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#60232, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7647:6, offset: 0x016fec2f, size: 117 bytes, params: 8, frame: 17
|
|
const env0_0 = require;
|
|
const env0_2 = require(57) /* metro dependency 57 */;
|
|
const env0_3 = require(6) /* metro dependency 6 */;
|
|
const env0_4 = require(7) /* metro dependency 7 */;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
exports.MetricsAggregator = _fun60233();
|
|
}
|
|
|
|
function _fun60233() { // fn#60233, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7647:119, offset: 0x016feca4, size: 147 bytes, params: 1, frame: 15
|
|
return env0_4(MetricsAggregator, [{key: 'add', value: value_60236}, {key: 'flush', value: function() {
|
|
this._forceFlush = true;
|
|
this._flush();
|
|
}}, {key: 'close', value: function() {
|
|
this._forceFlush = true;
|
|
global.clearInterval(this._interval);
|
|
this._flush();
|
|
}}, {key: '_flush', value: value_60239}, {key: '_captureMetrics', value: value_60240}]);
|
|
}
|
|
|
|
function MetricsAggregator(a0) { // fn#60234, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7647:153, offset: 0x016fed37, size: 248 bytes, params: 2, frame: 18
|
|
env1_3(this, MetricsAggregator);
|
|
this._client = a0;
|
|
const Map = global.Map;
|
|
const value3 = Object.create(Map.prototype, {constructor: {value: Map}});
|
|
const map = new Map();
|
|
this._buckets = map instanceof Object ? map : value3;
|
|
this._bucketsTotalWeight = 0;
|
|
const setInterval = global.setInterval;
|
|
const DEFAULT_FLUSH_INTERVAL = (require(7466) /* metro dependency 7466 */).DEFAULT_FLUSH_INTERVAL;
|
|
this._interval = setInterval(_fun60235, DEFAULT_FLUSH_INTERVAL);
|
|
if (this._interval.unref) {
|
|
this._interval.unref();
|
|
}
|
|
const Math = global.Math;
|
|
const floor = Math.floor;
|
|
const Math2 = global.Math;
|
|
this._flushShift = Reflect.apply(floor, Math, [Math2.random() * DEFAULT_FLUSH_INTERVAL / 1000]);
|
|
this._forceFlush = false;
|
|
}
|
|
|
|
function value_60236(a0, a1, a2) { // fn#60236, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7647:538, offset: 0x016fee2f, size: 604 bytes, params: 4, frame: 31
|
|
var r3;
|
|
var object2;
|
|
var property;
|
|
var value16;
|
|
var property2;
|
|
const value = a2;
|
|
const value2 = 'none';
|
|
const r15 = arguments.length > 3 ? arguments[3] === undefined ? value2 : arguments[3] : value2;
|
|
const r12 = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
|
|
const r4 = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : (require(7383) /* metro dependency 7383 */).timestampInSeconds();
|
|
const Math = global.Math;
|
|
const value8 = Math.floor(r4);
|
|
const value10 = (require(7470) /* metro dependency 7470 */).sanitizeMetricKey(a1);
|
|
const value11 = (require(7470) /* metro dependency 7470 */).sanitizeTags(r12);
|
|
const value12 = (require(7470) /* metro dependency 7470 */).sanitizeUnit(r15);
|
|
const bucketKey = (require(7470) /* metro dependency 7470 */).getBucketKey(a0, value10, value12, value11);
|
|
const value14 = this._buckets.get(bucketKey);
|
|
const value15 = 0;
|
|
const weight = value14 ? a0 !== (require(7466) /* metro dependency 7466 */).SET_METRIC_TYPE ? value15 : value14.metric.weight : value15;
|
|
if (value14) {
|
|
value14.metric.add(value);
|
|
if (value14.timestamp < value8) {
|
|
value14.timestamp = value8;
|
|
r3 = value14;
|
|
} else {
|
|
r3 = value14;
|
|
}
|
|
} else {
|
|
object2 = {};
|
|
property = (require(7471) /* metro dependency 7471 */).METRIC_MAP[a0];
|
|
value16 = Object.create(property.prototype, {constructor: {value: property}});
|
|
property2 = new property(value);
|
|
object2.metric = property2 instanceof Object ? property2 : value16;
|
|
object2.timestamp = value8;
|
|
object2.metricType = a0;
|
|
object2.name = value10;
|
|
object2.unit = value12;
|
|
object2.tags = value11;
|
|
this._buckets.set(bucketKey, object2);
|
|
r3 = object2;
|
|
}
|
|
(require(7374) /* metro dependency 7374 */).updateMetricSummaryOnActiveSpan(a0, value10,
|
|
typeof value !== 'string' ? value : r3.metric.weight - weight, value12, r12, bucketKey);
|
|
let _bucketsTotalWeight = this._bucketsTotalWeight;
|
|
this._bucketsTotalWeight = _bucketsTotalWeight + r3.metric.weight;
|
|
_bucketsTotalWeight = this._bucketsTotalWeight;
|
|
const MAX_WEIGHT = (require(7466) /* metro dependency 7466 */).MAX_WEIGHT;
|
|
if (_bucketsTotalWeight >= MAX_WEIGHT) {
|
|
this.flush();
|
|
}
|
|
}
|
|
|
|
function value_60239() { // fn#60239, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7647:1535, offset: 0x016ff0d0, size: 392 bytes, params: 1, frame: 25
|
|
var r4;
|
|
var _forceFlush;
|
|
var Math;
|
|
var floor;
|
|
var value;
|
|
var moduleValue;
|
|
var timestampInSeconds;
|
|
var value2;
|
|
var DEFAULT_FLUSH_INTERVAL;
|
|
var value3;
|
|
var _flushShift;
|
|
var value4;
|
|
var Map;
|
|
var prototype;
|
|
var value5;
|
|
var map;
|
|
var value6;
|
|
var _buckets;
|
|
var iterator;
|
|
var iterator2;
|
|
var item;
|
|
var item2;
|
|
var binding;
|
|
var value7;
|
|
var property;
|
|
var property2;
|
|
var timestamp;
|
|
var value8;
|
|
var set;
|
|
var _bucketsTotalWeight;
|
|
var metric;
|
|
var weight;
|
|
var value9;
|
|
var error;
|
|
var iterator3;
|
|
var item3;
|
|
var value10;
|
|
var property3;
|
|
var _captureMetrics;
|
|
exceptionSkip29: while (true) {
|
|
exceptionLanding29: while (true) {
|
|
exceptionSkip20: while (true) {
|
|
exceptionLanding20: while (true) {
|
|
_forceFlush = this._forceFlush;
|
|
if (_forceFlush) {
|
|
this._forceFlush = false;
|
|
this._bucketsTotalWeight = 0;
|
|
_captureMetrics = this._captureMetrics;
|
|
_buckets = this._buckets;
|
|
Reflect.apply(_captureMetrics, this, [_buckets]);
|
|
_buckets = this._buckets;
|
|
_buckets.clear();
|
|
return undefined;
|
|
}
|
|
Math = global.Math;
|
|
floor = Math.floor;
|
|
value = environment.__proto__;
|
|
moduleValue = require(7383) /* metro dependency 7383 */;
|
|
timestampInSeconds = moduleValue.timestampInSeconds;
|
|
value2 = Reflect.apply(floor, Math, [Reflect.apply(timestampInSeconds, moduleValue, [])]);
|
|
DEFAULT_FLUSH_INTERVAL = (require(7466) /* metro dependency 7466 */).DEFAULT_FLUSH_INTERVAL;
|
|
value3 = value2 - DEFAULT_FLUSH_INTERVAL / 1000;
|
|
_flushShift = this._flushShift;
|
|
value4 = value3 - _flushShift;
|
|
Map = global.Map;
|
|
prototype = Map.prototype;
|
|
value5 = Object.create(prototype, {constructor: {value: Map}});
|
|
map = new Map();
|
|
value6 = map instanceof Object ? map : value5;
|
|
_buckets = this._buckets;
|
|
iterator = _buckets[Symbol.iterator]();
|
|
iterator2 = iterator.next;
|
|
r4 = iterator;
|
|
while (true) {
|
|
item2 = Reflect.apply(iterator2, r4, []);
|
|
item = item2.value;
|
|
item2 = item2.done ? undefined : r4;
|
|
if (item2 === undefined) {
|
|
break;
|
|
}
|
|
try {
|
|
binding = env1_2;
|
|
} catch (error) {
|
|
break exceptionLanding20;
|
|
}
|
|
try {
|
|
value7 = binding(item, 2);
|
|
} catch (error) {
|
|
break exceptionLanding20;
|
|
}
|
|
try {
|
|
property = value7[0];
|
|
} catch (error) {
|
|
break exceptionLanding20;
|
|
}
|
|
try {
|
|
property2 = value7[1];
|
|
} catch (error) {
|
|
break exceptionLanding20;
|
|
}
|
|
try {
|
|
timestamp = property2.timestamp;
|
|
} catch (error) {
|
|
break exceptionLanding20;
|
|
}
|
|
try {
|
|
value8 = timestamp <= value4;
|
|
} catch (error) {
|
|
break exceptionLanding20;
|
|
}
|
|
if (!value8) {
|
|
r4 = item2;
|
|
continue;
|
|
}
|
|
try {
|
|
set = value6.set;
|
|
} catch (error) {
|
|
break exceptionLanding20;
|
|
}
|
|
try {
|
|
Reflect.apply(set, value6, [property, property2]);
|
|
} catch (error) {
|
|
break exceptionLanding20;
|
|
}
|
|
try {
|
|
_bucketsTotalWeight = this._bucketsTotalWeight;
|
|
} catch (error) {
|
|
break exceptionLanding20;
|
|
}
|
|
try {
|
|
metric = property2.metric;
|
|
} catch (error) {
|
|
break exceptionLanding20;
|
|
}
|
|
try {
|
|
weight = metric.weight;
|
|
} catch (error) {
|
|
break exceptionLanding20;
|
|
}
|
|
try {
|
|
value9 = _bucketsTotalWeight - weight;
|
|
} catch (error) {
|
|
break exceptionLanding20;
|
|
}
|
|
try {
|
|
this._bucketsTotalWeight = value9;
|
|
} catch (error) {
|
|
break exceptionLanding20;
|
|
}
|
|
r4 = item2;
|
|
}
|
|
iterator = value6[Symbol.iterator]();
|
|
iterator3 = iterator.next;
|
|
for (r4 = iterator; true; r4 = item3) {
|
|
item3 = Reflect.apply(iterator3, r4, []);
|
|
item = item3.value;
|
|
item3 = item3.done ? undefined : r4;
|
|
if (item3 === undefined) {
|
|
break;
|
|
}
|
|
try {
|
|
binding = env1_2;
|
|
} catch (error) {
|
|
break exceptionLanding29;
|
|
}
|
|
try {
|
|
value10 = binding(item, 1);
|
|
} catch (error) {
|
|
break exceptionLanding29;
|
|
}
|
|
try {
|
|
property = value10[0];
|
|
} catch (error) {
|
|
break exceptionLanding29;
|
|
}
|
|
try {
|
|
_buckets = this._buckets;
|
|
} catch (error) {
|
|
break exceptionLanding29;
|
|
}
|
|
try {
|
|
property3 = _buckets.delete;
|
|
} catch (error) {
|
|
break exceptionLanding29;
|
|
}
|
|
try {
|
|
Reflect.apply(property3, _buckets, [property]);
|
|
} catch (error) {
|
|
break exceptionLanding29;
|
|
}
|
|
}
|
|
_captureMetrics = this._captureMetrics;
|
|
Reflect.apply(_captureMetrics, this, [value6]);
|
|
return undefined;
|
|
break exceptionSkip20;
|
|
}
|
|
try {
|
|
item2.return();
|
|
} catch {
|
|
}
|
|
throw error;
|
|
break exceptionSkip20;
|
|
}
|
|
break exceptionSkip29;
|
|
}
|
|
try {
|
|
item3.return();
|
|
} catch {
|
|
}
|
|
throw error;
|
|
break exceptionSkip29;
|
|
}
|
|
}
|
|
|
|
function value_60240(a0) { // fn#60240, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7647:2036, offset: 0x016ff258, size: 99 bytes, params: 2, frame: 13
|
|
var environment;
|
|
var value;
|
|
var value2;
|
|
var moduleValue;
|
|
if (a0.size > 0) {
|
|
value = global.Array.from(a0);
|
|
value = value.map(_fun60241);
|
|
value2 = environment.__proto__;
|
|
moduleValue = require(7472) /* metro dependency 7472 */;
|
|
moduleValue.captureAggregateMetrics(this._client, value);
|
|
}
|
|
}
|
|
|
|
function _fun60241(a0) { // fn#60241, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7647:2102, offset: 0x016ff2bb, size: 30 bytes, params: 2, frame: 13
|
|
const value = environment.__proto__.__proto__;
|
|
return env2_2(a0, 2)[1];
|
|
}
|
|
|