decord/stable/source/modules/age_gate/AgeGateUtils.tsx
github-actions 57c2214117 chore: update source for stable 347.12
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4973.js (118.4 MB)
2026-09-29 21:26:22 +00:00

677 lines
26 KiB
TypeScript

// Module ID: 4998
// Function ID: 4999
// Name: AgeGateUtils
// Dependencies: [2059, 2041, 4999, 2063, 1372, 1099, 1074, 1115, 11, 5000, 5672, 5673, 14062, 504, 8716, 2108, 7488, 7603, 2]
// Exports: guildNeedsAgeGate, isChannelAgeVerificationGated, isChannelOrGuildNSFW, isCurrentUserMissingDateOfBirth, maybeOpenAgeGateForVoiceChannel, maybeShowAgeGate, shouldAgeVerifyForAgeGate, shouldAgeVerifyForSettingsToggles, shouldShowAgeGateForChannelId, shouldShowAgeGateForCurrentUser, shouldShowAgeGateForGuildContentLevel, useAgeGateVerifyContent, useAgeGateVerifyContentForGuild, useShouldAgeVerifyForAgeGate, useShouldAgeVerifyForSettingsToggles, useShouldHideChannelContent, userCannotSeeNSFWContent, userNeedsAgeGate
// Module 4998 (AgeGateUtils)
import SnowflakeUtilsDefault from "SnowflakeUtils" /* 11 */;
import initialize from "initialize" /* 504 */;
import AgeGateConstants from "AgeGateConstants" /* 1099 */;
import GuildRecord from "GuildRecord" /* 2059 */;
import HelpdeskUtilsDefault from "HelpdeskUtils" /* 2108 */;
import AgeVerificationUtils from "AgeVerificationUtils" /* 5000 */;
import RegionalFeatureConfigUtils from "RegionalFeatureConfigUtils" /* 5672 */;
import AgeGatedFeature from "AgeGatedFeature" /* 5673 */;
import AgeGateModalActionCreators from "AgeGateModalActionCreators" /* 7488 */;
import ChannelStore from "ChannelStore" /* 2041 */;
import GuildNSFWAgreeStore from "GuildNSFWAgreeStore" /* 4999 */;
import GuildStore from "GuildStore" /* 2063 */;
import UserStore from "UserStore" /* 1372 */;
import Constants from "Constants" /* 1074 */;
import size from "module_2" /* 2 */;
const require = globalThis.__r;
function shouldShowAgeGateForVoiceChannel(channelId) {
const result = AgeVerificationUtils.shouldShowTiggerPawtect();
let tmp4 = RegionalFeatureConfigUtils.isFeatureAgeGated(AgeGatedFeature.AgeGatedFeature.AGE_GATED_SPACES) && result;
if (tmp4) {
const currentUser = UserStore.getCurrentUser();
let flag = false;
if (null != currentUser) {
const result1 = tmp(5000).shouldShowTiggerPawtect();
const tmpResult = tmp(5000);
const tmpResult2 = tmp(5672);
const tmp9 = tmp(5672).isFeatureAgeGated(tmp(5673).AgeGatedFeature.AGE_GATED_SPACES) && result1;
flag = true !== currentUser.nsfwAllowed || tmp(5672).isFeatureAgeGated(tmp(5673).AgeGatedFeature.AGE_GATED_SPACES) && result1;
const tmp10 = true !== currentUser.nsfwAllowed || tmp(5672).isFeatureAgeGated(tmp(5673).AgeGatedFeature.AGE_GATED_SPACES) && result1;
}
let tmp12 = !flag;
if (flag) {
tmp12 = null == channelId;
}
let tmp13 = !tmp12;
if (!tmp12) {
tmp13 = isChannelContentGated(ChannelStore.getChannel(channelId));
}
tmp4 = tmp13;
}
return tmp4;
}
function isChannelContentGated(channel) {
if (null == channel) {
return false;
} else {
let didAgreeResult = GuildNSFWAgreeStore.didAgree(channel.guild_id);
const currentUser = UserStore.getCurrentUser();
if (currentUser != null) {
const nsfwAllowed = currentUser.nsfwAllowed;
}
const isFeatureAgeGatedResult = RegionalFeatureConfigUtils.isFeatureAgeGated(AgeGatedFeature.AgeGatedFeature.AGE_GATED_SPACES);
let result = AgeVerificationUtils.shouldShowTiggerPawtect();
if (didAgreeResult) {
didAgreeResult = false !== nsfwAllowed;
}
let tmp6 = !didAgreeResult;
if (didAgreeResult) {
if (result) {
result = isFeatureAgeGatedResult;
}
tmp6 = result;
}
if (channel.isNSFW()) {
if (tmp6) {
return true;
}
}
const guild = GuildStore.getGuild(channel.guild_id);
let tmp9 = null != guild;
if (tmp9) {
tmp9 = isGuildNSFW(guild) && tmp6;
const tmp11 = isGuildNSFW(guild) && tmp6;
}
return tmp9;
}
}
function useIsChannelContentGated(channel) {
_require = channel;
const shouldShowTiggerPawtect = require("AgeVerificationUtils").useShouldShowTiggerPawtect();
const obj = require("AgeVerificationUtils");
items = [GuildNSFWAgreeStore];
let stateFromStores = require("initialize").useStateFromStores(items, () => {
let guild_id;
if (channel != null) {
guild_id = channel.guild_id;
}
return GuildNSFWAgreeStore.didAgree(guild_id);
});
const obj2 = require("initialize");
const items1 = [UserStore];
const stateFromStores1 = require("initialize").useStateFromStores(items1, () => {
currentUser = currentUser.getCurrentUser();
let nsfwAllowed;
if (currentUser != null) {
nsfwAllowed = currentUser.nsfwAllowed;
}
return false === nsfwAllowed;
});
const obj3 = require("initialize");
let isFeatureAgeGated = require("RegionalFeatureConfigUtils").useIsFeatureAgeGated(require("AgeGatedFeature").AgeGatedFeature.AGE_GATED_SPACES);
const obj4 = require("RegionalFeatureConfigUtils");
const items2 = [GuildStore];
const stateFromStores2 = require("initialize").useStateFromStores(items2, () => {
let guild_id;
if (channel != null) {
guild_id = channel.guild_id;
}
return GuildStore.getGuild(guild_id);
});
if (stateFromStores) {
stateFromStores = !stateFromStores1;
}
let tmp6 = !stateFromStores;
if (stateFromStores) {
if (isFeatureAgeGated) {
isFeatureAgeGated = shouldShowTiggerPawtect;
}
tmp6 = isFeatureAgeGated;
}
let tmp7 = null != channel;
if (tmp7) {
const isNSFWResult = channel.isNSFW();
let tmp9 = !isNSFWResult;
if (isNSFWResult) {
tmp9 = !tmp6;
}
let tmp10 = !tmp9;
if (tmp9) {
let tmp11 = null != stateFromStores2;
if (tmp11) {
const tmp13 = isGuildNSFW(stateFromStores2);
let tmp14 = !tmp13;
if (tmp13) {
tmp14 = !tmp6;
}
tmp11 = !tmp14;
}
tmp10 = tmp11;
}
tmp7 = tmp10;
}
return tmp7;
}
const isGuildNSFW = GuildRecord.isGuildNSFW;
const AgeGateSource = AgeGateConstants.AgeGateSource;
({ GuildNSFWContentLevel, HelpdeskArticles: closure_9 } = Constants);
const date = new Date("06/16/2020");
let items = [, ];
({ AGE_RESTRICTED: arr[0], EXPLICIT: arr[1] } = GuildNSFWContentLevel);
let items1 = [, , ];
({ NSFW_SERVER: arr2[0], NSFW_SERVER_INVITE: arr2[1], NSFW_SERVER_INVITE_EMBED: arr2[2] } = AgeGateSource);
const set = new Set(items1);
let result = size.fileFinishedImporting("modules/age_gate/AgeGateUtils.tsx");
export const SERVER_AGE_GATE_SOURCES = set;
export const userNeedsAgeGate = function userNeedsAgeGate() {
const currentUser = UserStore.getCurrentUser();
let tmp2 = null != currentUser;
if (tmp2) {
tmp2 = SnowflakeUtilsDefault.extractTimestamp(currentUser.id) > date.getTime();
const extractTimestampResult = SnowflakeUtilsDefault.extractTimestamp(currentUser.id);
}
if (tmp2) {
tmp2 = null == currentUser.nsfwAllowed;
}
return tmp2;
};
export const guildNeedsAgeGate = function guildNeedsAgeGate(nsfwLevel) {
return items.includes(nsfwLevel.nsfwLevel);
};
export const shouldAgeVerifyForAgeGate = function shouldAgeVerifyForAgeGate() {
const result = AgeVerificationUtils.shouldShowTiggerPawtect();
return RegionalFeatureConfigUtils.isFeatureAgeGated(AgeGatedFeature.AgeGatedFeature.AGE_GATED_SPACES) && result;
};
export const useShouldAgeVerifyForAgeGate = function useShouldAgeVerifyForAgeGate() {
let isFeatureAgeGated = RegionalFeatureConfigUtils.useIsFeatureAgeGated(AgeGatedFeature.AgeGatedFeature.AGE_GATED_SPACES);
if (isFeatureAgeGated) {
isFeatureAgeGated = obj2.useShouldShowTiggerPawtect();
}
return isFeatureAgeGated;
};
export const useAgeGateVerifyContentForGuild = function useAgeGateVerifyContentForGuild(stateFromStores) {
let NSFW_CHANNEL_AGE_VERIFY = dependencyMap;
const isAgeVerified = AgeVerificationUtils.useIsAgeVerified();
const tmp4 = isGuildNSFW(stateFromStores);
const tmp3 = isGuildNSFW;
items = [UserStore];
stateFromStores = initialize.useStateFromStores(items, () => {
currentUser = currentUser.getCurrentUser();
let nsfwAllowed;
if (currentUser != null) {
nsfwAllowed = currentUser.nsfwAllowed;
}
return false === nsfwAllowed;
});
let isFeatureAgeGated = RegionalFeatureConfigUtils.useIsFeatureAgeGated(AgeGatedFeature.AgeGatedFeature.AGE_GATED_SPACES);
if (isFeatureAgeGated) {
isFeatureAgeGated = obj4.useShouldShowTiggerPawtect();
}
obj4 = AgeVerificationUtils;
let tmp7 = null;
let tmp8 = null;
if (tmpResult.useIsFeatureAgeGated(AgeGatedFeature.AgeGatedFeature.AGE_GATED_SPACES)) {
const tmp3Result = tmp3(stateFromStores);
let str;
if (stateFromStores != tmp7) {
str = stateFromStores.name;
}
if (str == tmp7) {
str = "";
}
if (tmp3Result) {
let tinyBroncoWarningDescriptions = tmp(14062).getTinyBroncoWarningDescriptions(tmp3Result, str);
const tmpResult2 = tmp(14062);
} else {
tinyBroncoWarningDescriptions = null;
}
tmp8 = tinyBroncoWarningDescriptions;
}
const intl = tmp(1115).intl;
const t = tmp(1115).t;
tmpResult = RegionalFeatureConfigUtils;
const intl2 = tmp(1115).intl;
const format = intl2.format;
const t2 = tmp(1115).t;
if (tmp4) {
let formatResult = format(t2["8tk6bB"], {});
} else {
formatResult = format(t2.XQZvwn, {});
}
const intl3 = tmp(1115).intl;
const string = intl3.string;
const t3 = tmp(1115).t;
if (tmp4) {
let stringResult1 = string(t3.V6Gmu9);
} else {
stringResult1 = string(t3["5rygLk"]);
}
const intl4 = tmp(1115).intl;
const t4 = tmp(1115).t;
const stringResult2 = intl4.string(tmp4 ? t4.xi46lg : t4.ZmwvDc);
if (isFeatureAgeGated) {
if (!isAgeVerified) {
const obj5 = { title: stringResult2, description: null, agreement: null, modalType: null };
let unverified;
if (tmp8 != tmp7) {
unverified = tmp8.unverified;
}
if (unverified == tmp7) {
unverified = stringResult1;
}
obj5.description = unverified;
const intl8 = tmp(1115).intl;
obj5.agreement = intl8.string(tmp(1115).t.FDSSia);
obj5.modalType = tmp(8716).NsfwSpaceWarningModalType.NSFW_CHANNEL_AGE_VERIFY;
}
const obj6 = { title: stringResult2, description: null, agreement: null, modalType: null, emphasiseDisagree: null };
let teen;
if (tmp8 != tmp7) {
teen = tmp8.teen;
}
if (teen == tmp7) {
teen = formatResult;
}
obj6.description = teen;
const intl9 = tmp(1115).intl;
if (tmp7 != tmp8) {
let Zt4Mf4 = tmp(1115).t.FDSSia;
} else {
Zt4Mf4 = tmp(1115).t.Zt4Mf4;
}
obj6.agreement = intl9.string(Zt4Mf4);
NSFW_CHANNEL_AGE_VERIFY = tmp(8716).NsfwSpaceWarningModalType.NSFW_CHANNEL_AGE_VERIFY;
obj6.modalType = NSFW_CHANNEL_AGE_VERIFY;
tmp7 = tmp7 != tmp8;
obj6.emphasiseDisagree = tmp7;
} else {
const obj7 = { title: null, description: null, agreement: null, modalType: null };
if (stateFromStores) {
const intl6 = tmp(1115).intl;
const t5 = tmp(1115).t;
obj7.title = intl6.string(tmp4 ? t5["H0SG/g"] : t5.NEabBa);
const intl7 = tmp(1115).intl;
let NSFW_CHANNEL_UNDERAGE = tmp(1115).t;
const obj8 = { helpURL: HelpdeskUtilsDefault.getArticleURL(constants.NSFW_AGE_GATING) };
obj7.description = intl7.format(tmp4 ? NSFW_CHANNEL_UNDERAGE["6++3cX"] : NSFW_CHANNEL_UNDERAGE["2kHZes"], obj8);
NSFW_CHANNEL_UNDERAGE = tmp(8716).NsfwSpaceWarningModalType.NSFW_CHANNEL_UNDERAGE;
obj7.modalType = NSFW_CHANNEL_UNDERAGE;
const tmp17 = tmp4 ? NSFW_CHANNEL_UNDERAGE["6++3cX"] : NSFW_CHANNEL_UNDERAGE["2kHZes"];
} else {
obj7.title = stringResult2;
let adult;
if (tmp8 != tmp7) {
adult = tmp8.adult;
}
if (adult == tmp7) {
adult = stringResult;
}
obj7.description = adult;
const intl5 = tmp(1115).intl;
obj7.agreement = intl5.string(tmp(1115).t.wVq7uo);
obj7.modalType = tmp(8716).NsfwSpaceWarningModalType.NSFW_CHANNEL_VERIFIED;
return obj7;
}
}
};
export const useAgeGateVerifyContent = function useAgeGateVerifyContent(source) {
const isAgeVerified = AgeVerificationUtils.useIsAgeVerified();
const isFeatureAgeGated = RegionalFeatureConfigUtils.useIsFeatureAgeGated(AgeGatedFeature.AgeGatedFeature.AGE_GATED_SPACES);
let shouldShowTiggerPawtect = isFeatureAgeGated;
if (isFeatureAgeGated) {
shouldShowTiggerPawtect = obj3.useShouldShowTiggerPawtect();
}
obj3 = AgeVerificationUtils;
items = [UserStore];
const stateFromStores = initialize.useStateFromStores(items, () => {
currentUser = currentUser.getCurrentUser();
let nsfwAllowed;
if (currentUser != null) {
nsfwAllowed = currentUser.nsfwAllowed;
}
return false === nsfwAllowed;
});
const tmpResult = initialize;
let tmp9 = null;
let tinyBroncoWarningDescriptions = null;
if (tmpResult3.useIsFeatureAgeGated(AgeGatedFeature.AgeGatedFeature.AGE_GATED_SPACES)) {
tinyBroncoWarningDescriptions = null;
if (tmp7) {
tinyBroncoWarningDescriptions = tmp(14062).getTinyBroncoWarningDescriptions(true, "");
const tmpResult4 = tmp(14062);
}
}
if (source !== AgeGateSource.JOIN_LARGE_GUILD_UNDERAGE) {
if (source !== tmp6.ACCESS_LARGE_GUILD_UNDERAGE) {
if (isAgeVerified) {
const intl10 = tmp(1115).intl;
if (tmp9 != tinyBroncoWarningDescriptions) {
let Zt4Mf4 = tmp(1115).t.FDSSia;
} else {
Zt4Mf4 = tmp(1115).t.Zt4Mf4;
}
const obj4 = { verifyAgreementButtonText: intl10.string(Zt4Mf4), verifyGateDescription: null, verifyTitle: null, verifyDisagreementButtonText: null, verifyEmphasiseDisagree: null };
let teen;
if (tinyBroncoWarningDescriptions != tmp9) {
teen = tinyBroncoWarningDescriptions.teen;
}
if (teen != tmp9) {
obj4.verifyGateDescription = teen;
const intl12 = tmp(1115).intl;
const string3 = intl12.string;
const t2 = tmp(1115).t;
if (tmp7) {
let string3Result = string3(t2.xi46lg);
} else {
string3Result = string3(t2.ZmwvDc);
}
obj4.verifyTitle = string3Result;
const intl13 = tmp(1115).intl;
if (tmp9 != tinyBroncoWarningDescriptions) {
let f3Pet92 = tmp(1115).t["/g10LC"];
} else {
f3Pet92 = tmp(1115).t.f3Pet9;
}
obj4.verifyDisagreementButtonText = intl13.string(f3Pet92);
tmp9 = tmp9 != tinyBroncoWarningDescriptions;
obj4.verifyEmphasiseDisagree = tmp9;
} else {
const intl11 = tmp(1115).intl;
const format = intl11.format;
let t1 = tmp(1115).t;
if (tmp7) {
t1 = {};
let formatResult = format(t1["8tk6bB"], t1);
} else {
formatResult = format(t1.XQZvwn, {});
}
}
} else {
if (source === tmp6.LARGE_GUILD) {
const obj5 = { verifyTitle: null, verifyGateDescription: null, verifyAgreementButtonText: null };
const intl7 = tmp(1115).intl;
obj5.verifyTitle = intl7.string(tmp(1115).t["7ymzsL"]);
const intl8 = tmp(1115).intl;
obj5.verifyGateDescription = intl8.string(tmp(1115).t.SxY4IW);
const intl9 = tmp(1115).intl;
obj5.verifyAgreementButtonText = intl9.string(tmp(1115).t.FDSSia);
let obj6 = obj5;
} else {
if (stateFromStores) {
if (tmp7) {
if (!shouldShowTiggerPawtect) {
obj6 = { verifyTitle: null, verifyGateDescription: null, verifyAgreementButtonText: null };
const intl = tmp(1115).intl;
obj6.verifyTitle = intl.string(tmp(1115).t["H0SG/g"]);
const intl2 = tmp(1115).intl;
const obj7 = { helpURL: HelpdeskUtilsDefault.getArticleURL(constants.AGE_GATE) };
obj6.verifyGateDescription = intl2.format(tmp(1115).t["6++3cX"], obj7);
}
}
}
const obj8 = { verifyAgreementButtonText: null, verifyGateDescription: null, verifyTitle: null, verifyDisagreementButtonText: null };
const intl3 = tmp(1115).intl;
obj8.verifyAgreementButtonText = intl3.string(tmp(1115).t.FDSSia);
let unverified;
if (tinyBroncoWarningDescriptions != tmp9) {
unverified = tinyBroncoWarningDescriptions.unverified;
}
if (unverified != tmp9) {
obj8.verifyGateDescription = unverified;
const intl5 = tmp(1115).intl;
const string2 = intl5.string;
const t = tmp(1115).t;
if (tmp7) {
let string2Result = string2(t.xi46lg);
} else {
string2Result = string2(t.ZmwvDc);
}
obj8.verifyTitle = string2Result;
const intl6 = tmp(1115).intl;
if (tmp9 != tinyBroncoWarningDescriptions) {
let f3Pet9 = tmp(1115).t["/g10LC"];
} else {
f3Pet9 = tmp(1115).t.f3Pet9;
}
obj8.verifyDisagreementButtonText = intl6.string(f3Pet9);
} else {
const intl4 = tmp(1115).intl;
const string = intl4.string;
let V6Gmu9 = tmp(1115).t;
if (tmp7) {
V6Gmu9 = V6Gmu9.V6Gmu9;
let stringResult = string(V6Gmu9);
} else {
stringResult = string(V6Gmu9["5rygLk"]);
}
}
}
return obj6;
}
}
}
if (source === AgeGateSource.JOIN_LARGE_GUILD_UNDERAGE) {
let MjQbfi = tmp(1115).t["u/xsK9"];
} else {
MjQbfi = tmp(1115).t.MjQbfi;
}
const intl14 = tmp(1115).intl;
const string4 = intl14.string;
const t3 = tmp(1115).t;
if (isAgeVerified) {
let string4Result = string4(t3.SAoMVJ);
} else {
string4Result = string4(t3.SxY4IW);
}
const intl15 = tmp(1115).intl;
const string5 = intl15.string;
const t4 = tmp(1115).t;
if (isAgeVerified) {
let string5Result = string5(t4.Zt4Mf4);
} else {
string5Result = string5(t4.FDSSia);
}
const obj10 = { verifyTitle: null, verifyGateDescription: null, verifyAgreementButtonText: null };
const intl16 = tmp(1115).intl;
obj10.verifyTitle = intl16.string(MjQbfi);
obj10.verifyGateDescription = string4Result;
obj10.verifyAgreementButtonText = string5Result;
return obj10;
};
export const shouldShowAgeGateForCurrentUser = function shouldShowAgeGateForCurrentUser() {
const currentUser = UserStore.getCurrentUser();
if (null == currentUser) {
return false;
} else {
const result = AgeVerificationUtils.shouldShowTiggerPawtect();
const tmp5 = RegionalFeatureConfigUtils.isFeatureAgeGated(AgeGatedFeature.AgeGatedFeature.AGE_GATED_SPACES) && result;
return true !== currentUser.nsfwAllowed || RegionalFeatureConfigUtils.isFeatureAgeGated(AgeGatedFeature.AgeGatedFeature.AGE_GATED_SPACES) && result;
}
};
export const shouldShowAgeGateForGuildContentLevel = function shouldShowAgeGateForGuildContentLevel(arg0) {
const currentUser = UserStore.getCurrentUser();
let flag = false;
if (null != currentUser) {
const result = AgeVerificationUtils.shouldShowTiggerPawtect();
const tmp5 = RegionalFeatureConfigUtils.isFeatureAgeGated(AgeGatedFeature.AgeGatedFeature.AGE_GATED_SPACES) && result;
flag = true !== currentUser.nsfwAllowed || RegionalFeatureConfigUtils.isFeatureAgeGated(AgeGatedFeature.AgeGatedFeature.AGE_GATED_SPACES) && result;
const tmp6 = true !== currentUser.nsfwAllowed || RegionalFeatureConfigUtils.isFeatureAgeGated(AgeGatedFeature.AgeGatedFeature.AGE_GATED_SPACES) && result;
}
if (flag) {
if (null != arg0) {
const guild = GuildStore.getGuild(arg0);
let tmp10 = null != guild;
if (tmp10) {
tmp10 = isGuildNSFW(guild);
}
return tmp10;
}
}
return false;
};
export const shouldShowAgeGateForChannelId = function shouldShowAgeGateForChannelId(id) {
const currentUser = UserStore.getCurrentUser();
let flag = false;
if (null != currentUser) {
const result = AgeVerificationUtils.shouldShowTiggerPawtect();
const tmp5 = RegionalFeatureConfigUtils.isFeatureAgeGated(AgeGatedFeature.AgeGatedFeature.AGE_GATED_SPACES) && result;
flag = true !== currentUser.nsfwAllowed || RegionalFeatureConfigUtils.isFeatureAgeGated(AgeGatedFeature.AgeGatedFeature.AGE_GATED_SPACES) && result;
const tmp6 = true !== currentUser.nsfwAllowed || RegionalFeatureConfigUtils.isFeatureAgeGated(AgeGatedFeature.AgeGatedFeature.AGE_GATED_SPACES) && result;
}
let tmp7 = !flag;
if (flag) {
tmp7 = null == id;
}
let tmp8 = !tmp7;
if (!tmp7) {
tmp8 = isChannelContentGated(ChannelStore.getChannel(id));
}
return tmp8;
};
export { shouldShowAgeGateForVoiceChannel };
export const maybeOpenAgeGateForVoiceChannel = function maybeOpenAgeGateForVoiceChannel(id) {
let flag = shouldShowAgeGateForVoiceChannel(id);
if (flag) {
AgeGateModalActionCreators.openAgeGateModal(AgeGateSource.NSFW_VOICE_CHANNEL);
flag = true;
}
return flag;
};
export const maybeShowAgeGate = function maybeShowAgeGate(guildId, channelId, JOIN_LARGE_GUILD_UNDERAGE) {
const currentUser = UserStore.getCurrentUser();
let flag = false;
if (null != currentUser) {
const result = AgeVerificationUtils.shouldShowTiggerPawtect();
const tmp5 = RegionalFeatureConfigUtils.isFeatureAgeGated(AgeGatedFeature.AgeGatedFeature.AGE_GATED_SPACES) && result;
flag = true !== currentUser.nsfwAllowed || RegionalFeatureConfigUtils.isFeatureAgeGated(AgeGatedFeature.AgeGatedFeature.AGE_GATED_SPACES) && result;
const tmp6 = true !== currentUser.nsfwAllowed || RegionalFeatureConfigUtils.isFeatureAgeGated(AgeGatedFeature.AgeGatedFeature.AGE_GATED_SPACES) && result;
}
let flag3 = false;
if (flag) {
flag3 = false;
if (null != guildId) {
const guild = GuildStore.getGuild(guildId);
let tmp10 = null != guild;
if (tmp10) {
tmp10 = isGuildNSFW(guild);
}
flag3 = tmp10;
}
}
let NSFW_SERVER = JOIN_LARGE_GUILD_UNDERAGE;
if (flag3) {
if (null == NSFW_SERVER) {
NSFW_SERVER = AgeGateSource.NSFW_SERVER;
}
AgeGateModalActionCreators.openAgeGateModal(NSFW_SERVER);
} else {
const currentUser1 = obj.getCurrentUser();
let tmp13 = null != currentUser1 && null == currentUser1.nsfwAllowed;
if (tmp13) {
const currentUser2 = obj.getCurrentUser();
let flag4 = false;
if (null != currentUser2) {
const result1 = AgeVerificationUtils.shouldShowTiggerPawtect();
const tmp18 = RegionalFeatureConfigUtils.isFeatureAgeGated(AgeGatedFeature.AgeGatedFeature.AGE_GATED_SPACES) && result1;
flag4 = true !== currentUser2.nsfwAllowed || RegionalFeatureConfigUtils.isFeatureAgeGated(AgeGatedFeature.AgeGatedFeature.AGE_GATED_SPACES) && result1;
const tmp19 = true !== currentUser2.nsfwAllowed || RegionalFeatureConfigUtils.isFeatureAgeGated(AgeGatedFeature.AgeGatedFeature.AGE_GATED_SPACES) && result1;
}
let tmp21 = !flag4;
if (flag4) {
tmp21 = null == channelId;
}
let tmp22 = !tmp21;
if (!tmp21) {
tmp22 = isChannelContentGated(ChannelStore.getChannel(channelId));
}
tmp13 = tmp22;
}
if (tmp13) {
let NSFW_CHANNEL = NSFW_SERVER;
if (NSFW_SERVER == null) {
NSFW_CHANNEL = AgeGateSource.NSFW_CHANNEL;
}
AgeGateModalActionCreators.openAgeGateModal(NSFW_CHANNEL);
}
}
};
export const isChannelOrGuildNSFW = function isChannelOrGuildNSFW(channel) {
let tmp = null != channel;
if (tmp) {
let isNSFWResult = channel.isNSFW();
if (!isNSFWResult) {
isNSFWResult = isGuildNSFW(GuildStore.getGuild(channel.guild_id));
}
tmp = isNSFWResult;
}
return tmp;
};
export const isChannelAgeVerificationGated = function isChannelAgeVerificationGated(isNSFW) {
if (null == isNSFW) {
return false;
} else {
let tmp4 = null != isNSFW;
const result = AgeVerificationUtils.shouldShowTiggerPawtect();
if (tmp4) {
let isNSFWResult = isNSFW.isNSFW();
if (!isNSFWResult) {
isNSFWResult = isGuildNSFW(GuildStore.getGuild(isNSFW.guild_id));
}
tmp4 = isNSFWResult;
}
if (tmp4) {
tmp4 = result;
}
return tmp4;
}
};
export const userCannotSeeNSFWContent = function userCannotSeeNSFWContent(channel) {
if (null == channel) {
return false;
} else {
const currentUser = UserStore.getCurrentUser();
if (currentUser != null) {
const nsfwAllowed = currentUser.nsfwAllowed;
}
let tmp3 = null != channel;
if (tmp3) {
let isNSFWResult = channel.isNSFW();
if (!isNSFWResult) {
isNSFWResult = isGuildNSFW(GuildStore.getGuild(channel.guild_id));
}
tmp3 = isNSFWResult;
}
if (tmp3) {
tmp3 = true !== nsfwAllowed;
}
return tmp3;
}
};
export { isChannelContentGated };
export { useIsChannelContentGated };
export const useShouldHideChannelContent = function useShouldHideChannelContent(stateFromStores) {
const tmp = useIsChannelContentGated(stateFromStores);
let isChannelSpoilerGated = tmp;
if (!tmp) {
isChannelSpoilerGated = obj.useIsChannelSpoilerGated(stateFromStores);
}
return isChannelSpoilerGated;
};
export const isCurrentUserMissingDateOfBirth = function isCurrentUserMissingDateOfBirth() {
const currentUser = UserStore.getCurrentUser();
return null != currentUser && null == currentUser.nsfwAllowed;
};
export const shouldAgeVerifyForSettingsToggles = function shouldAgeVerifyForSettingsToggles() {
let isFeatureAgeGatedResult = RegionalFeatureConfigUtils.isFeatureAgeGated(AgeGatedFeature.AgeGatedFeature.COMMANDS_TOGGLE);
if (isFeatureAgeGatedResult) {
isFeatureAgeGatedResult = obj2.shouldShowTiggerPawtect();
}
return isFeatureAgeGatedResult;
};
export const useShouldAgeVerifyForSettingsToggles = function useShouldAgeVerifyForSettingsToggles() {
let isFeatureAgeGated = RegionalFeatureConfigUtils.useIsFeatureAgeGated(AgeGatedFeature.AgeGatedFeature.COMMANDS_TOGGLE);
if (isFeatureAgeGated) {
isFeatureAgeGated = obj2.useShouldShowTiggerPawtect();
}
return isFeatureAgeGated;
};