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

377 lines
18 KiB
JavaScript

/* Metro module 3914; source: unknown; dependencies: [57, 5, 27, 3888] */
import Module00005 from './module-00005.js'; /* Metro dependency 5 */
import Module00057 from './module-00057.js'; /* Metro dependency 57 */
import * as ReactNativeModule from './module-00027-ReactNative.js'; /* Metro dependency 27 */
import * as Module03888Module from './module-03888.js'; /* Metro dependency 3888 */
function _fun32167(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#32167, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4063:6, offset: 0x0100dd31, size: 178 bytes, params: 8, frame: 19
const resolveWeight = function(a0) {
return a0 === 'default' ? 0 : (0, global.Number)(a0);
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let env0_0 = Module00057;
let env0_1 = Module00005;
let env0_2 = (ReactNativeModule).Image;
const NitroModules = (Module03888Module).NitroModules;
const env0_3 = NitroModules.createHybridObject('RiveFontConfig');
object = {};
((a0) => {
var env0_0 = _fun32171;
var env0_1 = _fun32174;
var env0_2 = _fun32177;
a0.loadFont = _fun32180;
a0.systemFallback = _fun32181;
a0.setFallbackFonts = _fun32182;
a0.clearFallbackFonts = _fun32183;
})(object);
exports.RiveFonts = object;
function loadFontByURI(a0) { // fn#32169, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4063:252, offset: 0x0100de01, size: 97 bytes, params: 2, frame: 12
var r0;
let regexp = RegExp('^https?:\\/\\/', '');
if (regexp.test(a0)) {
r0 = env0_3.loadFontFromURL(a0);
} else {
regexp = RegExp('^file:\\/\\/', '');
r0 = regexp.test(a0) ? env0_3.loadFontFromURL(a0) : env0_3.loadFontFromResource(a0);
}
return r0;
}
function _fun32170(a0) { // fn#32170, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4063:377, offset: 0x0100de62, size: 86 bytes, params: 2, frame: 3
a0.loadFont = function(a0) {
return _loadFont.apply(this, arguments);
};
a0.systemFallback = systemFallback;
a0.setFallbackFonts = function(a0) {
return _setFallbackFonts.apply(this, arguments);
};
a0.clearFallbackFonts = function() {
return _clearFallbackFonts.apply(this, arguments);
};
function _loadFont() { // fn#32171, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4063:389, offset: 0x0100deb8, size: 51 bytes, params: 1, frame: 13
var environment;
const value = environment.__proto__;
return env1_1(_fun32173).apply(this, arguments);
function* _fun32173(a0) { // fn#32173, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4063:430, offset: 0x0100def4, size: 437 bytes, params: 2, frame: 16
var r2;
var Error;
var regexp;
var binding;
var assetSource;
if (false) {
return undefined;
}
const ArrayBuffer = global.ArrayBuffer;
if (a0 instanceof ArrayBuffer) {
value = environment.__proto__.__proto__.__proto__;
return env3_3.loadFontFromBytes(a0);
}
value = typeof a0;
if (value === 'number') {
value = environment.__proto__.__proto__.__proto__;
assetSource = env3_2.resolveAssetSource(a0);
if (assetSource == null) {
throw new global.Error('Invalid font asset: could not resolve require() ID ' + a0 + ". Ensure 'ttf' is in metro.config.js assetExts.");
}
if (assetSource.uri) {
return env3_5(assetSource.uri);
}
Error = global.Error;
value = 'Invalid font asset: could not resolve require() ID ' + a0 + ". Ensure 'ttf' is in metro.config.js assetExts.";
throw new Error(value);
}
const value3 = value === 'object';
if (value3) {
if ('name' in a0) {
value = environment.__proto__.__proto__.__proto__;
binding = env3_3;
return binding.loadFontByName(a0.name);
}
if (value3) {
if ('uri' in a0) {
value = environment.__proto__.__proto__.__proto__;
return env3_5(a0.uri);
}
if (value === 'string') {
regexp = RegExp('^https?:\\/\\/', '');
if (regexp.test(a0)) {
value = environment.__proto__.__proto__.__proto__;
value = env3_3.loadFontFromURL(a0);
r2 = value;
} else {
regexp = RegExp('^file:\\/\\/', '');
if (regexp.test(a0)) {
value = environment.__proto__.__proto__.__proto__;
value = env3_3.loadFontFromURL(a0);
r2 = value;
} else {
value = environment.__proto__.__proto__.__proto__;
value = env3_3.loadFontFromResource(a0);
r2 = value;
}
}
return r2;
}
Error = global.Error;
value = global.String(a0);
value = 'Invalid font source: ' + value;
throw new Error(value);
}
if (value === 'string') {
regexp = RegExp('^https?:\\/\\/', '');
if (regexp.test(a0)) {
value = environment.__proto__.__proto__.__proto__;
value = env3_3.loadFontFromURL(a0);
r2 = value;
} else {
regexp = RegExp('^file:\\/\\/', '');
if (regexp.test(a0)) {
value = environment.__proto__.__proto__.__proto__;
value = env3_3.loadFontFromURL(a0);
r2 = value;
} else {
value = environment.__proto__.__proto__.__proto__;
value = env3_3.loadFontFromResource(a0);
r2 = value;
}
}
return r2;
}
Error = global.Error;
value = global.String(a0);
value = 'Invalid font source: ' + value;
throw new Error(value);
}
if (value3) {
if ('uri' in a0) {
value = environment.__proto__.__proto__.__proto__;
return env3_5(a0.uri);
}
if (value === 'string') {
regexp = RegExp('^https?:\\/\\/', '');
if (regexp.test(a0)) {
value = environment.__proto__.__proto__.__proto__;
value = env3_3.loadFontFromURL(a0);
r2 = value;
} else {
regexp = RegExp('^file:\\/\\/', '');
if (regexp.test(a0)) {
value = environment.__proto__.__proto__.__proto__;
value = env3_3.loadFontFromURL(a0);
r2 = value;
} else {
value = environment.__proto__.__proto__.__proto__;
value = env3_3.loadFontFromResource(a0);
r2 = value;
}
}
return r2;
}
Error = global.Error;
value = global.String(a0);
value = 'Invalid font source: ' + value;
throw new Error(value);
}
if (value === 'string') {
regexp = RegExp('^https?:\\/\\/', '');
if (regexp.test(a0)) {
value = environment.__proto__.__proto__.__proto__;
value = env3_3.loadFontFromURL(a0);
r2 = value;
} else {
regexp = RegExp('^file:\\/\\/', '');
if (regexp.test(a0)) {
value = environment.__proto__.__proto__.__proto__;
value = env3_3.loadFontFromURL(a0);
r2 = value;
} else {
value = environment.__proto__.__proto__.__proto__;
value = env3_3.loadFontFromResource(a0);
r2 = value;
}
}
return r2;
}
Error = global.Error;
const String = global.String;
value = String(a0);
value = 'Invalid font source: ' + value;
const value4 = Object.create(Error.prototype, {constructor: {value: Error}});
const error = new Error(value);
throw error instanceof Object ? error : value4;
}
}
function _setFallbackFonts() { // fn#32174, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4063:1049, offset: 0x0100e0a9, size: 51 bytes, params: 1, frame: 13
var environment;
const value = environment.__proto__;
return env1_1(_fun32176).apply(this, arguments);
function* _fun32176(a0) { // fn#32176, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4063:1106, offset: 0x0100e0e5, size: 167 bytes, params: 2, frame: 23
var binding;
var value3;
var property;
var property2;
var setFontsForWeight;
var binding2;
var value4;
var error;
if (true) {
var Object = global.Object;
var iterator = Object.entries(a0)[Symbol.iterator]();
var iterator2 = iterator.next;
value = environment.__proto__.__proto__.__proto__;
var r4 = iterator;
var item2 = Reflect.apply(iterator2, r4, []);
var item = item2.value;
item2 = item2.done ? undefined : r4;
reducibleJoin3: while (true) {
if (item2 === undefined) {
binding = env3_3;
yield binding.applyFallbackFonts();
return undefined;
}
break reducibleJoin3;
}
reducibleLoop3: while (true) {
try {
binding = env3_0;
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
value3 = binding(item, 2);
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
property = value3[0];
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
property2 = value3[1];
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
reducibleJoin2: while (true) {
if (property2) {
try {
binding = env3_3;
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
setFontsForWeight = binding.setFontsForWeight;
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
binding2 = env3_4;
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
value4 = binding2(property);
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
Reflect.apply(setFontsForWeight, binding, [value4, property2]);
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
r4 = item2;
break reducibleJoin2;
}
r4 = item2;
break reducibleJoin2;
}
item2 = Reflect.apply(iterator2, r4, []);
item = item2.value;
item2 = item2.done ? undefined : r4;
if (item2 === undefined) {
break reducibleLoop3;
}
continue reducibleLoop3;
}
binding = env3_3;
yield binding.applyFallbackFonts();
}
}
}
function _clearFallbackFonts() { // fn#32177, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4063:1276, offset: 0x0100e18c, size: 51 bytes, params: 1, frame: 13
var environment;
const value = environment.__proto__;
return env1_1(_fun32179).apply(this, arguments);
function* _fun32179() { // fn#32179, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4063:1337, offset: 0x0100e1c8, size: 30 bytes, params: 1, frame: 10
if (false) {
return undefined;
}
value = environment.__proto__.__proto__.__proto__;
return env3_3.clearFallbackFonts();
}
}
function loadFont(a0) { // fn#32180, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4063:1416, offset: 0x00c3945f, size: 30 bytes, params: 2, frame: 13
return _loadFont.apply(this, arguments);
}
function systemFallback() { // fn#32181, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4063:1494, offset: 0x0100e1e6, size: 21 bytes, params: 1, frame: 9
return env1_3.getSystemDefaultFont();
}
function setFallbackFonts(a0) { // fn#32182, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4063:1572, offset: 0x00c3b2ba, size: 30 bytes, params: 2, frame: 13
return _setFallbackFonts.apply(this, arguments);
}
function clearFallbackFonts() { // fn#32183, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4063:1670, offset: 0x00d6b059, size: 30 bytes, params: 1, frame: 13
return _clearFallbackFonts.apply(this, arguments);
}
}
}
global.__d(_fun32167, 3914, [57, 5, 27, 3888]) /* metro module 3914, dependencies: [57, 5, 27, 3888] */;