decord/beta/source/modules/spoiler_channels/SpoilerChannelUtils.tsx
2026-10-12 16:32:48 +00:00

250 lines
7.6 KiB
TypeScript

// Module ID: 5944
// Function ID: 5945
// Name: SpoilerChannelUtils
// Dependencies: [2065, 5945, 558, 576, 504, 2]
// Exports: shouldShowSpoilerGateForChannelId
// Module 5944 (SpoilerChannelUtils)
import ChannelStore from "ChannelStore" /* 2065 */;
import ChannelSpoilerAgreeStore from "ChannelSpoilerAgreeStore" /* 5945 */;
import ReactCompilerGating_mod from "ReactCompilerGating" /* 558 */;
import size from "module_2" /* 2 */;
const require = globalThis.__r;
let _require;
function isChannelSpoilerGated(channel, ChannelSpoilerAgreeStore, ChannelStore) {
let obj = ChannelSpoilerAgreeStore;
if (ChannelSpoilerAgreeStore === undefined) {
obj = ChannelSpoilerAgreeStore;
}
let obj2 = ChannelStore;
if (ChannelStore === undefined) {
obj2 = ChannelStore;
}
if (obj === undefined) {
obj = ChannelSpoilerAgreeStore;
}
if (obj2 === undefined) {
obj2 = ChannelStore;
}
let id1 = null;
if (null != channel) {
if (channel.isSpoilerChannel()) {
let id = null;
if (!obj.didAgree(channel.id)) {
id = channel.id;
}
id1 = id;
} else {
id1 = null;
if (null != channel.parent_id) {
channel = obj2.getChannel(channel.parent_id);
id1 = null;
if (null != channel) {
id1 = null;
if (channel.isSpoilerChannel()) {
id1 = null;
if (!obj.didAgree(channel.id)) {
id1 = channel.id;
}
}
}
}
}
}
return null != id1;
}
let ReactCompilerGating = ReactCompilerGating_mod;
const tmp2 = ReactCompilerGating.isReactCompilerEnabled() ? (function useGetSpoilerGatingChannelId(arg0) {
let first;
let spoilerChannel;
let tmp7;
let tmp8;
_require = arg0;
const obj = require("react");
const cResult = obj.c(4);
const tmp = _require;
if (cResult[0] === Symbol.for("react.memo_cache_sentinel")) {
const items = [ChannelSpoilerAgreeStore, ChannelStore];
cResult[0] = items;
first = items;
} else {
first = cResult[0];
}
if (cResult[1] !== arg0) {
const fn = function u() {
if (ChannelSpoilerAgreeStore !== undefined) {
if (ChannelStore !== undefined) {
let id1 = null;
if (null != spoilerChannel) {
if (spoilerChannel.isSpoilerChannel()) {
let id = null;
if (!ChannelSpoilerAgreeStore.didAgree(spoilerChannel.id)) {
id = obj.id;
}
id1 = id;
} else {
id1 = null;
if (null != spoilerChannel.parent_id) {
const channel = obj3.getChannel(obj.parent_id);
id1 = null;
if (null != channel) {
id1 = null;
if (channel.isSpoilerChannel()) {
id1 = null;
if (!ChannelSpoilerAgreeStore.didAgree(channel.id)) {
id1 = channel.id;
}
}
}
}
}
}
return id1;
}
}
};
const items1 = [arg0];
cResult[1] = arg0;
cResult[2] = fn;
cResult[3] = items1;
tmp8 = items1;
tmp7 = fn;
} else {
tmp7 = cResult[2];
tmp8 = cResult[3];
}
const tmpResult = tmp(504);
return tmpResult.useStateFromStores(first, tmp7, tmp8);
}) : (function useGetSpoilerGatingChannelId(arg0) {
let spoilerChannel;
_require = arg0;
const obj = require("get initialized");
const items = [ChannelSpoilerAgreeStore, ChannelStore];
const items1 = [arg0];
return obj.useStateFromStores(items, () => {
if (ChannelSpoilerAgreeStore !== undefined) {
if (ChannelStore !== undefined) {
let id1 = null;
if (null != spoilerChannel) {
if (spoilerChannel.isSpoilerChannel()) {
let id = null;
if (!ChannelSpoilerAgreeStore.didAgree(spoilerChannel.id)) {
id = obj.id;
}
id1 = id;
} else {
id1 = null;
if (null != spoilerChannel.parent_id) {
const channel = obj3.getChannel(obj.parent_id);
id1 = null;
if (null != channel) {
id1 = null;
if (channel.isSpoilerChannel()) {
id1 = null;
if (!ChannelSpoilerAgreeStore.didAgree(channel.id)) {
id1 = channel.id;
}
}
}
}
}
}
return id1;
}
}
}, items1);
});
ReactCompilerGating = ReactCompilerGating_mod;
const tmp3 = ReactCompilerGating.isReactCompilerEnabled() ? (function useIsChannelSpoilerGated(arg0) {
let closure_0;
let first;
let tmp7;
let tmp8;
_require = arg0;
const obj = require("react");
const cResult = obj.c(4);
const tmp = _require;
if (cResult[0] === Symbol.for("react.memo_cache_sentinel")) {
const items = [ChannelSpoilerAgreeStore, ChannelStore];
cResult[0] = items;
first = items;
} else {
first = cResult[0];
}
if (cResult[1] !== arg0) {
const fn = function u() {
return isChannelSpoilerGated(closure_0, ChannelSpoilerAgreeStore, ChannelStore);
};
const items1 = [arg0];
cResult[1] = arg0;
cResult[2] = fn;
cResult[3] = items1;
tmp8 = items1;
tmp7 = fn;
} else {
tmp7 = cResult[2];
tmp8 = cResult[3];
}
const tmpResult = tmp(504);
return tmpResult.useStateFromStores(first, tmp7, tmp8);
}) : (function useIsChannelSpoilerGated(arg0) {
let closure_0;
_require = arg0;
const items = [ChannelSpoilerAgreeStore, ChannelStore];
const items1 = [arg0];
const obj = require("get initialized");
return obj.useStateFromStores(items, () => isChannelSpoilerGated(closure_0, ChannelSpoilerAgreeStore, ChannelStore), items1);
});
ReactCompilerGating = ReactCompilerGating_mod;
const tmp4 = ReactCompilerGating.isReactCompilerEnabled() ? (function useShouldShowSpoilerGateForChannelId(arg0) {
let closure_0;
let first;
let tmp7;
let tmp8;
_require = arg0;
const obj = require("react");
const cResult = obj.c(4);
const tmp = _require;
if (cResult[0] === Symbol.for("react.memo_cache_sentinel")) {
const items = [ChannelStore, ChannelSpoilerAgreeStore];
cResult[0] = items;
first = items;
} else {
first = cResult[0];
}
if (cResult[1] !== arg0) {
const fn = function u() {
return isChannelSpoilerGated(ChannelStore.getChannel(closure_0), ChannelSpoilerAgreeStore, ChannelStore);
};
const items1 = [arg0];
cResult[1] = arg0;
cResult[2] = fn;
cResult[3] = items1;
tmp8 = items1;
tmp7 = fn;
} else {
tmp7 = cResult[2];
tmp8 = cResult[3];
}
const tmpResult = tmp(504);
return tmpResult.useStateFromStores(first, tmp7, tmp8);
}) : (function useShouldShowSpoilerGateForChannelId(arg0) {
let closure_0;
_require = arg0;
const items = [ChannelStore, ChannelSpoilerAgreeStore];
const items1 = [arg0];
const obj = require("get initialized");
return obj.useStateFromStores(items, () => isChannelSpoilerGated(ChannelStore.getChannel(closure_0), ChannelSpoilerAgreeStore, ChannelStore), items1);
});
const result = size.fileFinishedImporting("modules/spoiler_channels/SpoilerChannelUtils.tsx");
export const useGetSpoilerGatingChannelId = tmp2;
export { isChannelSpoilerGated };
export const useIsChannelSpoilerGated = tmp3;
export const useShouldShowSpoilerGateForChannelId = tmp4;
export const shouldShowSpoilerGateForChannelId = function shouldShowSpoilerGateForChannelId(channelId) {
const tmp = null != channelId && isChannelSpoilerGated(ChannelStore.getChannel(channelId));
return tmp;
};