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

345 lines
12 KiB
JavaScript

/* Metro module 908; source: unknown; dependencies: [77, 848] */
import * as Module00077Module from './module-00077.js'; /* Metro dependency 77 */
function _fun9774(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#9774, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1035:6, offset: 0x00d717eb, size: 187 bytes, params: 8, frame: 20
const env0_0 = require;
const closure = function(a0) {
return 'isRelative' in a0;
};
const getSanitizedUrlStringFromUrlObject2 = getSanitizedUrlStringFromUrlObject;
const Object = global.Object;
const defineProperty = Object.defineProperty;
const Symbol = global.Symbol;
Reflect.apply(defineProperty, Object, [exports, Symbol.toStringTag, {value: 'Module'}]);
exports.getHttpSpanDetailsFromUrlObject = getHttpSpanDetailsFromUrlObject;
exports.getSanitizedUrlString = getSanitizedUrlString;
exports.getSanitizedUrlStringFromUrlObject = getSanitizedUrlStringFromUrlObject2;
exports.isURLObjectRelative = closure;
exports.parseStringToURLObject = parseStringToURLObject;
exports.parseUrl = parseUrl;
exports.stripDataUrlContent = stripDataUrlContent;
exports.stripUrlQueryAndFragment = function(a0) {
return a0.split(RegExp('[?#]', ''), 1)[0];
};
function getSanitizedUrlStringFromUrlObject(a0) { // fn#9776, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1035:160, offset: 0x00d718b5, size: 166 bytes, params: 2, frame: 14
if (isURLObjectRelative(a0)) {
return a0.pathname;
}
const URL = global.URL;
const uRL = new URL(a0);
uRL.search = '';
uRL.hash = '';
const items2 = ['80', '443'];
if (items2.includes(uRL.port)) {
uRL.port = '';
}
if (uRL.password) {
uRL.password = '%filtered%';
}
if (uRL.username) {
uRL.username = '%filtered%';
}
return uRL.toString();
}
function getHttpSpanNameFromUrlObject(a0, a1, a2, a3) { // fn#9777, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1035:429, offset: 0x00d7195b, size: 142 bytes, params: 5, frame: 17
return '' + ((a2 == null || a2.method == null ? undefined : a2.method.toUpperCase()) ?? 'GET') + ' ' + (a3 || (a0 ? a1 === 'client' ? getSanitizedUrlStringFromUrlObject(a0) : a0.pathname : '/'));
}
function getHttpSpanDetailsFromUrlObject(a0, a1, a2, a3, a4) { // fn#9778, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1035:674, offset: 0x00d719e9, size: 484 bytes, params: 6, frame: 24
var method;
var SEMANTIC_ATTRIBUTE_HTTP_REQUEST_METHOD;
var pathname;
const SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN = (require(848) /* metro dependency 848 */).SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN;
const value2 = Module00077Module({}, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, a2);
const SEMANTIC_ATTRIBUTE_SENTRY_SOURCE = (require(848) /* metro dependency 848 */).SEMANTIC_ATTRIBUTE_SENTRY_SOURCE;
const value3 = Module00077Module(value2, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'url');
if (a4) {
value3[a1 !== 'server' ? 'url.template' : 'http.route'] = a4;
value3[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] = 'route';
}
if (a3 != null && a3.method) {
SEMANTIC_ATTRIBUTE_HTTP_REQUEST_METHOD = (require(848) /* metro dependency 848 */).SEMANTIC_ATTRIBUTE_HTTP_REQUEST_METHOD;
method = a3.method;
value3[SEMANTIC_ATTRIBUTE_HTTP_REQUEST_METHOD] = method.toUpperCase();
}
if (a0) {
if (a0.search) {
value3['url.query'] = a0.search;
}
if (a0.hash) {
value3['url.fragment'] = a0.hash;
}
pathname = a0.pathname;
if (pathname) {
pathname = a0.pathname;
value3['url.path'] = pathname;
pathname = a0.pathname;
if (pathname === '/') {
value3[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] = 'route';
}
}
if (!isURLObjectRelative(a0)) {
value3[(require(848) /* metro dependency 848 */).SEMANTIC_ATTRIBUTE_URL_FULL] = a0.href;
if (a0.port) {
value3['url.port'] = a0.port;
}
if (a0.protocol) {
value3['url.scheme'] = a0.protocol;
}
if (a0.hostname) {
value3[a1 !== 'server' ? 'url.domain' : 'server.address'] = a0.hostname;
}
}
}
return [getHttpSpanNameFromUrlObject(a0, a1, a3, a4), value3];
}
}
function getSanitizedUrlString({protocol, host, path}) { // fn#9779, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1035:1504, offset: 0x00d71bcd, size: 176 bytes, params: 2, frame: 18
const value = '';
const r2 = protocol ? value + protocol + '://' : value;
let r1 = host == null ? undefined : host.replace(RegExp('^.*@', ''),
'[filtered]:[filtered]@').replace(RegExp('(:80)$', ''), value).replace(RegExp('(:443)$', ''), value);
r1 = !r1 ? value : r1;
return value + r2 + r1 + path;
}
function parseStringToURLObject(a0, a1) { // fn#9780, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1035:1852, offset: 0x00d71c7d, size: 240 bytes, params: 3, frame: 20
var r1;
var URL;
var canParse;
var prototype;
var uRL;
var object;
var pathname;
var search;
var hash;
var error;
let value = a1;
const value2 = undefined;
const r6 = a0.indexOf('://') <= 0 && a0.indexOf('//') !== 0;
const r5 = value ?? (r6 ? 'thismessage:/' : value2);
try {
URL = global.URL;
} catch (error) {
return value2;
}
try {
value = 'canParse' in URL;
} catch (error) {
return value2;
}
if (value) {
try {
URL = global.URL;
} catch (error) {
return value2;
}
try {
canParse = URL.canParse;
} catch (error) {
return value2;
}
try {
value = Reflect.apply(canParse, URL, [a0, r5]);
} catch (error) {
return value2;
}
if (value) {
try {
URL = global.URL;
} catch (error) {
return value2;
}
try {
prototype = URL.prototype;
} catch (error) {
return value2;
}
try {
} catch (error) {
return value2;
}
try {
uRL = new URL(a0, r5);
} catch (error) {
return value2;
}
try {
value = uRL instanceof Object ? uRL : value;
} catch (error) {
return value2;
}
if (r6) {
try {
object = {};
} catch (error) {
return value2;
}
try {
object.isRelative = r6;
} catch (error) {
return value2;
}
try {
pathname = value.pathname;
} catch (error) {
return value2;
}
try {
object.pathname = pathname;
} catch (error) {
return value2;
}
try {
search = value.search;
} catch (error) {
return value2;
}
try {
object.search = search;
} catch (error) {
return value2;
}
try {
hash = value.hash;
} catch (error) {
return value2;
}
try {
object.hash = hash;
} catch (error) {
return value2;
}
r1 = object;
} else {
r1 = value;
}
return r1;
}
return value2;
}
try {
URL = global.URL;
} catch (error) {
return value2;
}
try {
prototype = URL.prototype;
} catch (error) {
return value2;
}
try {
} catch (error) {
return value2;
}
try {
uRL = new URL(a0, r5);
} catch (error) {
return value2;
}
try {
value = uRL instanceof Object ? uRL : value;
} catch (error) {
return value2;
}
if (r6) {
try {
object = {};
} catch (error) {
return value2;
}
try {
object.isRelative = r6;
} catch (error) {
return value2;
}
try {
pathname = value.pathname;
} catch (error) {
return value2;
}
try {
object.pathname = pathname;
} catch (error) {
return value2;
}
try {
search = value.search;
} catch (error) {
return value2;
}
try {
object.search = search;
} catch (error) {
return value2;
}
try {
hash = value.hash;
} catch (error) {
return value2;
}
try {
object.hash = hash;
} catch (error) {
return value2;
}
r1 = object;
} else {
r1 = value;
}
return r1;
}
function parseUrl(a0) { // fn#9781, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1035:2140, offset: 0x00d71d6d, size: 136 bytes, params: 2, frame: 14
var r3;
var r2;
var value;
var property;
if (a0) {
value = a0.match(RegExp('^(([^:/?#]+):)?(\\/\\/([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?$', ''));
if (value) {
property = value[6];
r3 = property || '';
property = value[8];
r2 = property || '';
return {host: value[4], path: value[5], protocol: value[2], search: r3, hash: r2,
relative: value[5] + r3 + r2};
}
}
return {};
}
function stripDataUrlContent(a0) { // fn#9782, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1035:2394, offset: 0x00d71df5, size: 280 bytes, params: 2, frame: 21
var r3;
var r5;
var value3;
var value4;
var value5;
let value = arguments.length > 1;
const r1 = value && arguments[1] !== undefined;
if (a0.startsWith('data:')) {
value = a0.match(RegExp('^data:([^;,]+)', ''));
r3 = value ? value[1] : 'text/plain';
value = a0.includes(';base64,');
value3 = a0.indexOf(',');
value4 = '';
if (r1 ? arguments[1] : !r1) {
if (value3 === -1) {
r5 = value4;
} else {
value5 = a0.slice(value3 + 1);
r5 = value5.length > 10 ? value4 + value5.slice(0, 10) + '... [truncated]' : value5;
}
} else {
r5 = value4;
}
return 'data:' + r3 + (value ? ',base64' : value4) + (r5 ? ',' + r5 : value4);
}
return a0;
}
global.__d(_fun9774, 908, [77, 848]) /* metro module 908, dependencies: [77, 848] */;