Files
discord-decomp/sources/modules/masked_link/SharedStateUtils.tsx
T
2026-07-27 16:20:00 +03:00

71 lines
3.6 KiB
TypeScript

/* Metro module 10198; source: modules/masked_link/SharedStateUtils.tsx; dependencies: [57, 31, 8875, 2] */
function _fun79316(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#79316, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10384:6, offset: 0x01e4d678, size: 150 bytes, params: 8, frame: 19
const env0_0 = require;
const closure = useUrlParts;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_2 = importDefault(57) /* metro dependency 57 */;
const env0_3 = importAll(31) /* metro dependency 31 */;
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/masked_link/SharedStateUtils.tsx');
exports.useUrlParts = closure;
exports.useModalState = useModalState;
}
function useUrlParts(a0) { // fn#79317, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10384:116, offset: 0x01e4d70e, size: 149 bytes, params: 2, frame: 18
var object2;
const env0_0 = a0;
let value = env0_3.useMemo(_fun79318, [a0]);
const protocol = value.protocol;
const hostname = value.hostname;
value = a0.substr(protocol.length, 2);
const value2 = '';
const value3 = '//';
const r5 = value3 !== value ? value2 : value3;
object2 = {protocol: protocol, authorityPrefix: r5, hostname: hostname};
object2.theRestOfTheUrl = a0.replace(value2 + protocol + r5 + hostname, value2);
return object2;
}
function useModalState({url, trustUrl, onConfirm, onCancel, onClose}) { // fn#79319, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10384:508, offset: 0x01e4d7f0, size: 262 bytes, params: 2, frame: 25
const env0_2 = onConfirm;
const env0_3 = onCancel;
let binding = env0_3;
const [property, property2] = env0_2(binding.useState(false), 2);
const {protocol, authorityPrefix, hostname, theRestOfTheUrl} = useUrlParts(url);
binding = env0_3;
let useCallback = binding.useCallback;
const value5 = Reflect.apply(useCallback, binding, [_fun79320, [url, property, trustUrl, onConfirm, onClose]]);
binding = env0_3;
useCallback = binding.useCallback;
return {protocol: protocol, authorityPrefix: authorityPrefix, hostname: hostname, theRestOfTheUrl: theRestOfTheUrl,
shouldTrustUrl: property, setShouldTrustUrl: property2, handleConfirm: value5,
handleCancel: Reflect.apply(useCallback, binding, [function() {
if (onClose != null) {
onClose();
}
onCancel();
}, [onCancel, onClose]])};
}
function _fun79318() { // fn#79318, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10384:157, offset: 0x01e4d7a3, size: 77 bytes, params: 1, frame: 16
const object2 = {};
let value = environment.__proto__;
value = require(8875) /* metro dependency 8875: MaskedLinkStoreMethodsAdditionalNative */;
const getProtocol = value.getProtocol;
const binding = env0_0;
object2.protocol = Reflect.apply(getProtocol, value, [binding]);
object2.hostname = (require(8875) /* metro dependency 8875: MaskedLinkStoreMethodsAdditionalNative */).getHostname(binding);
return object2;
}
function _fun79320() { // fn#79320, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10384:728, offset: 0x01e4d8f6, size: 57 bytes, params: 1, frame: 12
if (env0_5) {
trustUrl(url);
}
if (onClose != null) {
onClose();
}
onConfirm();
}