decord/source/modules/game_profile/hooks/useOpenExternalUrlFromGameProfile.tsx
2026-07-31 08:44:05 +00:00

262 lines
8 KiB
TypeScript

// Module ID: 8493
// Function ID: 8494
// Name: _getDeepLinkUrl
// Dependencies: [32, 5, 19, 8494, 8495, 3884, 2]
// Exports: default
// Module 8493 (_getDeepLinkUrl)
import _slicedToArray from "_slicedToArray";
import _openURL from "_openURL";
import noop from "noop";
const require = arg1;
function _getDeepLinkUrl() {
const self = this;
const tmp = callback2((arg0) => {
let closure_0 = arg0;
let c3 = 0;
let c4 = 0;
return (function*(arg0) {
if (c4 === 2) {
c4 = 3;
HermesBuiltin.throwTypeError();
} else if (tmp4 === 3) {
if (arg0 === 1) {
throw arg1;
} else if (arg0 === 2) {
let obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
return { value: "HermesInternal", done: null };
}
} else {
try {
c4 = 2;
if (0 === c3) {
if (arg0 === 1) {
c4 = 3;
throw arg1;
} else if (arg0 === 2) {
c4 = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
let dependencyMap = tmp5;
let callback = tmp2;
callback = undefined;
dependencyMap = undefined;
if ("store.steampowered.com" === lib.hostname) {
c3 = 1;
c4 = 1;
const obj1 = { value: null, done: false };
obj1[0] = outer1_1(outer1_2[3]).isProtocolRegistered(outer1_6);
return obj1;
}
}
} else {
if (1 === tmp5) {
if (arg0 === 1) {
c4 = 3;
throw arg1;
} else if (arg0 === 2) {
c4 = 3;
const obj2 = { value: null, done: true };
obj2[0] = arg1;
return obj2;
} else if (arg1) {
const match = lib.pathname.match(closure_7);
let tmp21;
if (match != null) {
tmp21 = match[1];
}
callback = tmp21;
if (null != callback) {
const _HermesInternal = HermesInternal;
c4 = 3;
const obj3 = { value: null, done: true };
obj3[0] = "" + closure_6 + "://store/" + callback;
return obj3;
}
const str2 = lib.pathname;
}
} else if (arg0 === 1) {
c4 = 3;
throw arg1;
} else if (arg0 === 2) {
c4 = 3;
let obj4 = { value: null, done: true };
obj4[0] = arg1;
return obj4;
} else if (arg1) {
const match1 = lib.pathname.match(closure_8);
let tmp12;
if (match1 != null) {
tmp12 = match1[1];
}
dependencyMap = tmp12;
if (null != dependencyMap) {
const _decodeURIComponent = decodeURIComponent;
c4 = 3;
obj = { value: null, done: true };
obj[0] = lib(8495).buildXboxGamePassStoreDeepLinkUrl(decodeURIComponent(dependencyMap));
return obj;
}
const str = lib.pathname;
}
c4 = 3;
return { value: null, done: true };
}
if (lib.hostname === lib(8495).XBOX_GAME_PASS_STORE_HOSTNAME) {
obj4 = callback(8494);
c3 = 2;
c4 = 1;
const obj5 = { value: null, done: false };
obj5[0] = obj4.isProtocolRegistered(lib(8495).XBOX_GAME_PASS_PROTOCOL);
return obj5;
}
} catch (tmp37) {
c4 = tmp;
throw tmp37;
}
}
})();
});
const _getDeepLinkUrl = tmp;
const apply = tmp.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
}
const steam = "steam";
const re7 = /^\/app\/(\d+)(?:\/)?/;
const re8 = /^\/games\/store\/title\/([^/]+)/;
let result = require("noop").fileFinishedImporting("modules/game_profile/hooks/useOpenExternalUrlFromGameProfile.tsx");
export default function useOpenExternalUrlFromGameProfile(arg0) {
let closure_0 = arg0;
const tmp = callback(React.useState(false), 2);
const first = tmp[0];
let closure_2 = tmp[1];
closure_0 = undefined;
closure_0 = callback2((arg0) => {
let closure_0 = arg0;
let c4 = 0;
let c5 = 0;
let c3 = 0;
return (function*(arg0) {
if (c5 === 2) {
c5 = 3;
HermesBuiltin.throwTypeError();
} else if (tmp6 === 3) {
if (arg0 === 1) {
throw arg1;
} else if (arg0 === 2) {
let obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
return { value: "HermesInternal", done: null };
}
} else {
try {
c5 = 2;
if (0 === c4) {
if (arg0 === 1) {
c5 = 3;
throw arg1;
} else if (arg0 === 2) {
c5 = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
let c2 = tmp3;
let uRL = tmp7;
uRL = undefined;
c2 = undefined;
if (null != callback) {
let c3 = 1;
const _URL = URL;
uRL = new URL(callback);
c3 = 0;
c4 = 2;
c5 = 1;
const obj1 = { value: null, done: false };
obj1[0] = (function getDeepLinkUrl(uRL) {
const self = this;
const apply = closure_9.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
})(uRL);
return obj1;
}
}
} else if (1 === tmp7) {
c3 = 0;
c5 = 3;
return { value: "HermesInternal", done: null };
} else if (arg0 === 1) {
c5 = 3;
throw arg1;
} else if (arg0 === 2) {
c5 = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
c2 = arg1;
let tmp9 = null != c2;
if (tmp9) {
tmp9 = outer1_1;
}
if (tmp9) {
c2 = null;
}
const searchParams = uRL.searchParams;
const result = searchParams.set("utm_source", "discord");
callback = uRL.toString();
if (null != callback) {
callback(callback);
} else if (null == outer1_2) {
first(table[5])(callback);
}
(function openDeepLink(outer1_2, outer1_22) {
let closure_0 = outer1_22;
const uRL = setTimeout(() => outer1_22(true), 5000);
const listener = window.addEventListener("blur", () => clearTimeout(closure_1), { once: true });
uRL(_null[5])(outer1_2);
})(outer1_2, outer1_2);
}
c5 = 3;
} catch (tmp40) {
if (tmp4 === c3) {
c5 = tmp2;
throw tmp40;
} else {
c4 = tmp;
}
}
}
})();
});
const items = [arg0, first];
return React.useCallback(function() {
const self = this;
const apply = closure_0.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
}, items);
};