Files
discord-decomp/sources/by-id/module-00641-DepGraph.js
2026-07-28 01:06:53 +03:00

364 lines
15 KiB
JavaScript

/* Metro module 641; source: unknown; dependencies: [] */
function _fun7308(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#7308, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:691:6, offset: 0x00d14219, size: 263 bytes, params: 8, frame: 17
const createDFS = function(a0, a1, a2, a3) {
var env0_0 = a0;
var env0_1 = a1;
var env0_2 = a2;
var env0_3 = a3;
var env0_4 = [];
var env0_5 = {};
var env0_6 = {};
var env0_7 = {};
var closure = _fun7310;
var env0_8 = closure;
return closure;
};
let closure = function(a0) {
var value = a0;
this.nodes = {};
this.outgoingEdges = {};
this.incomingEdges = {};
this.circular = value && !!value.circular;
};
exports.DepGraph = closure;
closure.prototype = {size: function() {
var Object = global.Object;
return Object.keys(this.nodes).length;
}, addNode: function(a0, a1) {
var property;
var value = a0;
if (!this.hasNode(value)) {
property = this.nodes;
property[value] = arguments.length !== 2 ? value : a1;
property = this.outgoingEdges;
property[value] = [];
property = this.incomingEdges;
property[value] = [];
}
}, removeNode: function(a0) {
var env0_0 = a0;
if (this.hasNode(a0)) {
delete this.nodes[a0];
delete this.outgoingEdges[a0];
delete this.incomingEdges[a0];
[this.incomingEdges, this.outgoingEdges].forEach(_fun7315);
}
}, hasNode: function(a0) {
return this.nodes.hasOwnProperty(a0);
}, getNodeData: function(a0) {
if (this.hasNode(a0)) {
return this.nodes[a0];
}
var Error = global.Error;
var value = 'Node does not exist: ' + a0;
value = new Error(value);
throw value;
}, setNodeData: function(a0, a1) {
if (this.hasNode(a0)) {
this.nodes[a0] = a1;
return undefined;
}
var Error = global.Error;
var value = 'Node does not exist: ' + a0;
value = new Error(value);
throw value;
}, addDependency: addDependency, removeDependency: removeDependency, clone: clone_7322,
dependenciesOf: dependenciesOf, dependantsOf: dependantsOf, overallOrder: overallOrder};
closure = DepGraphCycleError;
exports.DepGraphCycleError = closure;
let Object = global.Object;
const create = Object.create;
let Error = global.Error;
const prototype = Error.prototype;
Error = global.Error;
closure.prototype = Reflect.apply(create, Object, [prototype, {constructor: {'value': null, 'enumerable': false,
'writable': true, 'configurable': true, value: Error}}]);
Object = global.Object;
const setPrototypeOf = Object.setPrototypeOf;
Error = global.Error;
Reflect.apply(setPrototypeOf, Object, [closure, Error]);
function createDFS(a0, a1, a2, a3) { // fn#7309, offset: 0x00d14320, size: 67 bytes, params: 5, frame: 2
const env0_0 = a0;
const env0_1 = a1;
const env0_2 = a2;
const env0_3 = a3;
const env0_4 = [];
const env0_5 = {};
const env0_6 = {};
const env0_7 = {};
return DFS;
function DFS(a0) { // fn#7310, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:691:90, owner: createDFS.DFS, offset: 0x00d14363, size: 267 bytes, params: 2, frame: 17
var r5;
var r4;
var property;
var value3;
var value4;
var value5;
const value = environment;
env0_5[a0] = true;
let binding = env0_4;
let push = binding.push;
Reflect.apply(push, binding, [a0]);
env0_7[a0] = true;
let length = env0_0[a0].length;
const value2 = 0;
if (value2 < length) {
r5 = value2;
reducibleLoop1: while (true) {
property = env0_0[a0][r5];
if (env0_5[property]) {
reducibleJoin6: while (true) {
if (env0_7[property]) {
binding = env0_4;
push = binding.push;
Reflect.apply(push, binding, [property]);
if (!importAll) {
value3 = environment.__proto__;
throw new DepGraphCycleError(env0_4);
}
break reducibleJoin6;
}
break reducibleJoin6;
}
} else {
DFS(property);
}
value4 = typeof r5 === 'bigint' ? r5 + 1n : +r5 + 1;
length = env0_0[a0].length;
if (value4 < length) {
r5 = value4;
continue reducibleLoop1;
}
break reducibleLoop1;
}
}
env0_4.pop();
delete env0_7[a0];
reducibleJoin9: while (true) {
if (require) {
length = env0_0[a0].length;
value5 = value2 !== length;
r4 = value5;
break reducibleJoin9;
}
r4 = require;
break reducibleJoin9;
}
reducibleJoin11: while (true) {
if (r4) {
break reducibleJoin11;
}
property = env0_6[a0];
r4 = property;
break reducibleJoin11;
}
reducibleJoin13: while (true) {
if (r4) {
break reducibleJoin13;
}
push = importDefault.push;
Reflect.apply(push, importDefault, [a0]);
env0_6[a0] = true;
break reducibleJoin13;
}
}
}
function removeNode(a0) { // fn#7314, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:691:654, offset: 0x00d1451a, size: 98 bytes, params: 2, frame: 12
var outgoingEdges;
var incomingEdges;
let env0_0 = a0;
if (this.hasNode(a0)) {
delete this.nodes[a0];
outgoingEdges = this.outgoingEdges;
delete outgoingEdges[a0];
incomingEdges = this.incomingEdges;
delete incomingEdges[a0];
incomingEdges = this.incomingEdges;
outgoingEdges = this.outgoingEdges;
[incomingEdges, outgoingEdges].forEach(function(a0) {
var env0_0 = a0;
var Object = global.Object;
Object.keys(a0).forEach(_fun7316, this);
});
}
function _fun7315(a0) { // fn#7315, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:691:823, offset: 0x00d1457c, size: 49 bytes, params: 2, frame: 13
const env0_0 = a0;
const Object = global.Object;
Object.keys(a0).forEach(_fun7316, this);
function _fun7316(a0) { // fn#7316, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:691:859, offset: 0x00d145ad, size: 65 bytes, params: 2, frame: 14
const value3 = env0_0[a0].indexOf(env1_0);
if (value3 >= 0) {
env0_0[a0].splice(value3, 1);
}
}
}
}
function clone_7322() { // fn#7322, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:691:1793, offset: 0x00d1480f, size: 80 bytes, params: 1, frame: 13
const depGraph = new DepGraph();
const Object = global.Object;
Object.keys(this.nodes).forEach(_fun7323);
return depGraph;
function _fun7323(a0) { // fn#7323, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:691:1866, offset: 0x00d1485f, size: 100 bytes, params: 2, frame: 15
const binding = env0_1;
const nodes = binding.nodes;
const binding2 = env0_0;
nodes[a0] = binding2.nodes[a0];
const outgoingEdges = binding.outgoingEdges;
let property = binding2.outgoingEdges[a0];
outgoingEdges[a0] = property.slice(0);
const incomingEdges = binding.incomingEdges;
property = binding2.incomingEdges[a0];
incomingEdges[a0] = property.slice(0);
}
}
function dependenciesOf(a0, a1) { // fn#7324, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:691:2015, offset: 0x00d148c3, size: 135 bytes, params: 3, frame: 18
var value;
var items2;
if (this.hasNode(a0)) {
items2 = [];
createDFS(this.outgoingEdges, a1, items2, this.circular)(a0);
value = items2.indexOf(a0);
if (value >= 0) {
items2.splice(value, 1);
}
return items2;
}
const Error = global.Error;
value = 'Node does not exist: ' + a0;
const value2 = Object.create(Error.prototype, {constructor: {value: Error}});
const error = new Error();
throw error instanceof Object ? error : value2;
}
function dependantsOf(a0, a1) { // fn#7325, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:691:2229, offset: 0x00d1494a, size: 135 bytes, params: 3, frame: 18
var value;
var items2;
if (this.hasNode(a0)) {
items2 = [];
createDFS(this.incomingEdges, a1, items2, this.circular)(a0);
value = items2.indexOf(a0);
if (value >= 0) {
items2.splice(value, 1);
}
return items2;
}
const Error = global.Error;
value = 'Node does not exist: ' + a0;
const value2 = Object.create(Error.prototype, {constructor: {value: Error}});
const error = new Error();
throw error instanceof Object ? error : value2;
}
function overallOrder(a0) { // fn#7326, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:691:2441, offset: 0x00d149d1, size: 159 bytes, params: 2, frame: 21
const items2 = [];
const Object = global.Object;
let value = Object.keys(this.nodes);
if (value.length !== 0) {
var createDFSBinding = createDFS;
var env0_1 = createDFSBinding(this.outgoingEdges, false, [], this.circular);
value.forEach(_fun7327);
var env0_2 = createDFSBinding(this.outgoingEdges, a0, items2, this.circular);
value = value.filter(_fun7328);
value.forEach(_fun7329);
}
return items2;
function _fun7327(a0) { // fn#7327, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:691:2600, offset: 0x00d14a70, size: 19 bytes, params: 2, frame: 11
env0_1(a0);
}
function _fun7328(a0) { // fn#7328, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:691:2691, offset: 0x00d14a83, size: 33 bytes, params: 2, frame: 2
return env0_0.incomingEdges[a0].length === 0;
}
function _fun7329(a0) { // fn#7329, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:691:2752, offset: 0x00d14aa4, size: 19 bytes, params: 2, frame: 11
env0_2(a0);
}
}
function DepGraphCycleError(a0) { // fn#7330, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:691:2803, offset: 0x00d14ab7, size: 142 bytes, params: 2, frame: 16
let value = a0.join(' -> ');
value = 'Dependency Cycle Found: ' + value;
let Error = global.Error;
const error = new Error(value);
error.cyclePath = a0;
const Object = global.Object;
const setPrototypeOf = Object.setPrototypeOf;
const Object2 = global.Object;
const getPrototypeOf = Object2.getPrototypeOf;
Reflect.apply(setPrototypeOf, Object, [error, Reflect.apply(getPrototypeOf, Object2, [this])]);
Error = global.Error;
if (Error.captureStackTrace) {
global.Error.captureStackTrace(error, DepGraphCycleError);
}
return error;
}
}
function addDependency(a0, a1) { // fn#7320, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:691:1246, offset: 0x00d14699, size: 216 bytes, params: 3, frame: 14
var Error;
var value;
var property;
if (this.hasNode(a0)) {
if (this.hasNode(a1)) {
property = this.outgoingEdges[a0];
if (property.indexOf(a1) === -1) {
this.outgoingEdges[a0].push(a1);
}
property = this.incomingEdges[a1];
if (property.indexOf(a0) === -1) {
this.incomingEdges[a1].push(a0);
}
return true;
}
Error = global.Error;
value = 'Node does not exist: ' + a1;
throw new Error();
}
Error = global.Error;
value = 'Node does not exist: ' + a0;
const value2 = Object.create(Error.prototype, {constructor: {value: Error}});
const error = new Error();
throw error instanceof Object ? error : value2;
}
function removeDependency(a0, a1) { // fn#7321, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:691:1565, offset: 0x00d14771, size: 158 bytes, params: 3, frame: 17
var r3;
var r4;
let value = this.hasNode(a0);
const value2 = undefined;
if (value) {
value = this.outgoingEdges[a0].indexOf(a1);
r3 = value >= 0;
r4 = value;
} else {
r3 = value;
r4 = value2;
}
if (r3) {
this.outgoingEdges[a0].splice(r4, 1);
}
value = this.hasNode(a1);
if (value) {
value = this.incomingEdges[a1].indexOf(a0);
r3 = value >= 0;
r4 = value;
} else {
r3 = value;
}
if (r3) {
this.incomingEdges[a1].splice(r4, 1);
}
return value2;
}
global.__d(_fun7308, 641, []) /* metro module 641 */;