decord/alpha/source/modules/spoiler_channels/SpoilerChannelUtils.tsx
github-actions 72019a2d0c chore: update source for alpha 348.4
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/05xxx/module_5014.js (118.4 MB)
2026-09-25 08:38:05 +00:00

115 lines
3.7 KiB
TypeScript

// Module ID: 6742
// Function ID: 6743
// Name: SpoilerChannelUtils
// Dependencies: [2044, 6743, 504, 2]
// Exports: shouldShowSpoilerGateForChannelId, useGetSpoilerGatingChannelId, useIsChannelSpoilerGated, useShouldShowSpoilerGateForChannelId
// Module 6742 (SpoilerChannelUtils)
import ChannelStore from "ChannelStore" /* 2044 */;
import ChannelSpoilerAgreeStore from "ChannelSpoilerAgreeStore" /* 6743 */;
const require = globalThis.__r;
const require = fn;
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;
}
const size = fn(2);
const result = size.fileFinishedImporting("modules/spoiler_channels/SpoilerChannelUtils.tsx");
export const useGetSpoilerGatingChannelId = function useGetSpoilerGatingChannelId(stateFromStores) {
_require = stateFromStores;
const items = [ChannelSpoilerAgreeStore, ChannelStore];
const items1 = [stateFromStores];
return require("initialize").useStateFromStores(items, () => {
if (ChannelSpoilerAgreeStore !== undefined) {
if (obj3 !== undefined) {
let id1 = null;
if (null != obj) {
if (obj.isSpoilerChannel()) {
let id = null;
if (!obj2.didAgree(obj.id)) {
id = obj.id;
}
id1 = id;
} else {
id1 = null;
if (null != obj.parent_id) {
const channel = obj3.getChannel(obj.parent_id);
id1 = null;
if (null != channel) {
id1 = null;
if (channel.isSpoilerChannel()) {
id1 = null;
if (!obj2.didAgree(channel.id)) {
id1 = channel.id;
}
}
}
}
}
}
return id1;
}
}
}, items1);
};
export { isChannelSpoilerGated };
export const useIsChannelSpoilerGated = function useIsChannelSpoilerGated(channel) {
_require = channel;
const items = [ChannelSpoilerAgreeStore, ChannelStore];
const items1 = [channel];
return require("initialize").useStateFromStores(items, () => isChannelSpoilerGated(closure_0, ChannelSpoilerAgreeStore, ChannelStore), items1);
};
export const useShouldShowSpoilerGateForChannelId = function useShouldShowSpoilerGateForChannelId(arg0) {
_require = arg0;
const items = [ChannelStore, ChannelSpoilerAgreeStore];
const items1 = [arg0];
return require("initialize").useStateFromStores(items, () => isChannelSpoilerGated(ChannelStore.getChannel(closure_0), ChannelSpoilerAgreeStore, ChannelStore), items1);
};
export const shouldShowSpoilerGateForChannelId = function shouldShowSpoilerGateForChannelId(channelId) {
let tmp = null != channelId;
if (tmp) {
tmp = isChannelSpoilerGated(ChannelStore.getChannel(channelId));
}
return tmp;
};