This commit is contained in:
janisslsm committed 2026-11-01 12:12:55 +02:00
1 parent 1781d25a15
commit 732c0ad767
33051 files changed
+2591613 -3019689

No files matched your search

@@ -0,0 +1,25 @@
// Metro module 9136 (f9137).
import Dispatcher from "../Dispatcher";
export function markAnalyticsFeedItemSeen(a0, a1, a2) {
Dispatcher.dispatch({
type: "ANALYTICS_FEED_ITEM_SEEN",
id: a0,
feedItemId: a1,
timestampMillis: a2
});
}
export function markAnalyticsFeedItemUnseen(a0, a1, a2) {
Dispatcher.dispatch({
type: "ANALYTICS_FEED_ITEM_UNSEEN",
id: a0,
feedItemId: a1,
timestampMillis: a2
});
}
export function flushAnalyticsFeedItems(a0, a1) {
Dispatcher.dispatch({
type: "ANALYTICS_FEED_FLUSH",
id: a0,
force: a1
});
}
+257
View File
@@ -0,0 +1,257 @@
// Metro module 9138 (f9139).
import Module38 from "../_bundle/Module38";
import Dispatcher from "../Dispatcher";
let env5993 = {};
const r15 = {
FORUM_CHANNEL: "forum_channel"
};
const c5993_3 = {
IMMEDIATE: 0,
0: "IMMEDIATE",
IMMEDIATE_WITH_COOLDOWN: 1,
1: "IMMEDIATE_WITH_COOLDOWN",
IMMEDIATE_WITH_DELAY: 2,
2: "IMMEDIATE_WITH_DELAY"
};
export class TrackedFeedItem {
seenIntervals = [];
maybeMarkSeen(a0) {
const r9 = this.seenIntervals[this.seenIntervals.length - 1];
let r1 = r9 == null || r9.endTimeMillis != null;
if (r1) {
this.seenIntervals.push({
startTimeMillis: a0
});
r1 = true;
}
return r1;
}
maybeMarkUnseen(a0) {
const r8 = this.seenIntervals[this.seenIntervals.length - 1];
let r1 = r8 != null && r8.endTimeMillis == null;
if (r1) {
r8.endTimeMillis = a0;
r1 = true;
}
return r1;
}
isVisible() {
const r10 = this.seenIntervals[this.seenIntervals.length - 1];
return r10?.startTimeMillis != null && r10?.endTimeMillis == null;
}
computeSeenTimeDestructive(a0) {
let r0 = 0;
const seenIntervals = [];
for (const seenInterval of this.seenIntervals) {
const r28 = seenInterval;
if (seenInterval.endTimeMillis == null) {
if (a0) {
const startTimeMillis = Date.now();
r0 = r0 + (startTimeMillis - r28.startTimeMillis);
seenIntervals.push({
startTimeMillis
});
} else {
seenIntervals.push(r28);
}
} else {
const r30 = r0;
r0 = r30 + (r28.endTimeMillis - r28.startTimeMillis);
}
}
Module38(seenIntervals.length < 2, "there should only be a single left over data");
this.seenIntervals = seenIntervals;
return Math.round(r0);
}
}
export { r15 as AnalyticsFeedTypes };
export { c5993_3 as ForceFlushType };
export class AnalyticsFeedItemSeenManager {
constructor(a0) {
const { id, windowId } = a0;
let isPaused = a0.isPaused;
this.initialize = () => {
Dispatcher.subscribe("ANALYTICS_FEED_ITEM_SEEN", this.handleFeedItemSeen);
Dispatcher.subscribe("ANALYTICS_FEED_ITEM_UNSEEN", this.handleFeedItemUnseen);
Dispatcher.subscribe("ANALYTICS_FEED_FLUSH", this.handleFeedItemFlush);
Dispatcher.subscribe("APP_STATE_UPDATE", this.handleAppStateUpdate);
Dispatcher.subscribe("WINDOW_FOCUS", this.handleWindowFocus);
const onInitialize = this.onInitialize;
if (onInitialize != null) {
onInitialize.call(this);
}
};
this.terminate = () => {
Dispatcher.unsubscribe("ANALYTICS_FEED_ITEM_SEEN", this.handleFeedItemSeen);
Dispatcher.unsubscribe("ANALYTICS_FEED_ITEM_UNSEEN", this.handleFeedItemUnseen);
Dispatcher.unsubscribe("ANALYTICS_FEED_FLUSH", this.handleFeedItemFlush);
Dispatcher.unsubscribe("APP_STATE_UPDATE", this.handleAppStateUpdate);
Dispatcher.unsubscribe("WINDOW_FOCUS", this.handleWindowFocus);
const onTerminate = this.onTerminate;
if (onTerminate != null) {
onTerminate.call(this);
}
this.maybeFlushSeenItems(c5993_3.IMMEDIATE);
};
this.handleFeedItemFlush = ({ id, force }) => {
if (this._id === id) {
this.maybeFlushSeenItems(force);
}
};
this.handleFeedItemSeen = ({ id, timestampMillis, feedItemId }) => {
if (id === this._id) {
if (this._paused) {
this._pausedFeedItemIds.add(feedItemId);
} else {
const r12 = this.getTrackedFeedItem(feedItemId).maybeMarkSeen(timestampMillis);
const onFeedItemSeen = this.onFeedItemSeen;
if (onFeedItemSeen != null) {
onFeedItemSeen.call(this, feedItemId, r12);
}
}
}
};
this.handleFeedItemUnseen = ({ id, timestampMillis, feedItemId }) => {
if (id === this._id) {
if (this._paused) {
this._pausedFeedItemIds.delete(feedItemId);
}
const r15 = this.getTrackedFeedItem(feedItemId).maybeMarkUnseen(timestampMillis);
const onFeedItemUnseen = this.onFeedItemUnseen;
if (onFeedItemUnseen != null) {
onFeedItemUnseen.call(this, feedItemId, r15);
}
this.maybeFlushSeenItems();
}
};
this.getTrackedFeedItem = (a0) => {
if (this.trackedFeedItems[a0] == null) {
const trackedFeedItems = this.trackedFeedItems;
const r13 = {
__proto__: TrackedFeedItem.prototype
};
r13.seenIntervals = [];
trackedFeedItems[a0] = r13;
}
return this.trackedFeedItems[a0];
};
this.getVisibleFeedItemIds = () => new Set(Object.keys(this.trackedFeedItems).filter((item) => {
const r3 = this.trackedFeedItems[item];
return r3 == null ? void 0 : r3.isVisible();
}));
this.handleAppStateUpdate = ({ state }) => {
if (state === "active" && this._isReactNavigationFocused) {
this.resume();
}
if (state === "background") {
if (this._isReactNavigationFocused) {
this.pause();
}
this.maybeFlushSeenItems(c5993_3.IMMEDIATE);
}
};
this.clearPausedFeedItemIds = () => {
this._pausedFeedItemIds = new Set();
this._paused = false;
};
this.pause = () => {
if (!this._paused) {
const visibleFeedItemIds = this.getVisibleFeedItemIds();
visibleFeedItemIds.forEach((visibleFeedItemId) => {
this.handleFeedItemUnseen({
id: this._id,
feedItemId: visibleFeedItemId,
timestampMillis: Date.now(),
type: "ANALYTICS_FEED_ITEM_UNSEEN"
});
});
this._paused = true;
this._pausedFeedItemIds = visibleFeedItemIds;
}
};
this.resume = () => {
if (this._paused) {
this._paused = false;
this._pausedFeedItemIds.forEach((_pausedFeedItemId) => {
this.handleFeedItemSeen({
id: this._id,
feedItemId: _pausedFeedItemId,
timestampMillis: Date.now(),
type: "ANALYTICS_FEED_ITEM_SEEN"
});
});
this.clearPausedFeedItemIds();
}
};
this.handleReactNavigationFocus = (a0) => {
this._isReactNavigationFocused = a0;
if (this._isReactNavigationFocused) {
this.resume();
} else {
this.pause();
}
};
this.handleWindowFocus = (a0) => {
if (this._windowId === a0.windowId) {
if (a0.focused) {
this.resume();
} else {
this.pause();
}
}
};
this.trackedFeedItems = {};
this._id = id;
this._windowId = windowId;
this._pausedFeedItemIds = new Set();
if (isPaused == null) {
isPaused = false;
}
this._paused = isPaused;
this._isReactNavigationFocused = true;
this._lastFlushTimeMillis = Date.now();
}
maybeFlushSeenItems(a0) {
let r34;
if (a0 == null && Date.now() - this._lastFlushTimeMillis < 60000) {
return Promise.resolve();
}
if (a0 === c5993_3.IMMEDIATE_WITH_COOLDOWN && Date.now() - this._lastFlushTimeMillis < 3000) {
return Promise.resolve();
}
let env17022;
L11: {
env17022 = {
$parent: env5993
};
const flushSeenItemsFunction = this.createFlushSeenItemsFunction(a0);
env17022[0] = flushSeenItemsFunction;
if (flushSeenItemsFunction == null) {
r34 = Promise.resolve();
} else {
this._lastFlushTimeMillis = Date.now();
if (a0 !== c5993_3.IMMEDIATE && a0 !== c5993_3.IMMEDIATE_WITH_COOLDOWN) {
r34 = new Promise((c26367_0) => {
setTimeout(async () => {
let c30034_0;
c30034_0 = void 0;
await (0, env17022[0])();
(0, c26367_0)();
}, 100);
});
break L11;
}
const r35 = Promise;
let c17023_0 = async (c30033_0) => {
let c31487_0 = c30033_0;
await (0, env17022[0])();
(0, c31487_0)();
};
r34 = new r35(function() {
return c17023_0.apply(this, arguments);
});
}
}
return r34;
}
}
+3
View File
@@ -0,0 +1,3 @@
// Metro module 13260 (f13261).
import { AnalyticEvents } from "../Constants";
AnalyticEvents;
+488
View File
@@ -0,0 +1,488 @@
// Metro module 698 (f699).
import _objectWithoutProperties from "../_bundle/_objectWithoutProperties";
import { createContext } from "react";
import { getLocation, setDebugTrackedData } from "../modules/app_analytics/ImpressionStore";
import DeveloperOptionsStore from "../stores/DeveloperOptionsStore";
import { AnalyticsObjectTypes, AnalyticsSections, AnalyticEvents } from "../Constants";
import { AccessibilityFeatureFlags } from "../modules/a11y/AccessibilityConstants";
import { ApplicationTypes } from "../modules/applications/ApplicationConstants";
import { isLibdiscoreInitialized, generateLaunchSignature } from "../_bundle/Module1869";
import { getGlobalObject } from "../_bundle/Module697";
import * as _Module503 from "../_bundle/Module503";
import { extendSuperProperties, ImpressionNames, trackMaker } from "../_bundle/Module503";
import { IGNORE_ANALYTICS_BREADCRUMB_EVENTS } from "../modules/errors/CommonSentryInitUtils";
import SentryUtils_native from "./SentryUtils.native";
import Dispatcher from "../Dispatcher";
import ProcessUtils_native from "./ProcessUtils.native";
import { intl } from "../intl/index.native";
import { report } from "../modules/debug/LogAggregator";
import { v4 } from "../_bundle/Module514";
import * as _AnalyticsSchema from "./AnalyticsSchema";
import { HermesBuiltin } from "../_hermes/prelude";
let _excluded, _excluded2, c590_14, c590_15, throttlePeriod, throttlePeriod2, c590_18, launch_signature, c590_20, getAccessibilityFeatures, c590_22, c590_24, c590_25, c590_26;
const expandEventProperties = function expandEventProperties(a0) {
const r8 = a0 == null ? {} : a0;
let c12461_0 = r8;
const location2 = r8.location;
let r9 = r8;
if (location2 != null) {
const location3 = r8.location;
const r17 = {
..._objectWithoutProperties(r8, _excluded),
...typeof location3 === "string" ? {
location: location3
} : {
location: location3.page,
location_page: location3.page,
location_section: location3.section,
location_object: location3.object,
location_object_type: location3.objectType
}
};
c12461_0 = r17;
r9 = r17;
}
const source = r9.source;
let r30 = r9;
if (source != null) {
const source2 = r9.source;
const r36 = {
..._objectWithoutProperties(r9, _excluded2),
...typeof source2 === "string" ? {
source: source2
} : {
source_page: source2.page,
source_section: source2.section,
source_object: source2.object,
source_object_type: source2.objectType,
source_promotion_id: source2.promotionId
}
};
c12461_0 = r36;
r30 = r36;
}
r30.client_performance_cpu = ProcessUtils_native.getCurrentCPUUsagePercent();
r30.client_performance_memory = ProcessUtils_native.getCurrentMemoryUsageKB();
r30.cpu_core_count = ProcessUtils_native.getCPUCoreCount();
r30.accessibility_features = getAccessibilityFeatures();
r30.rendered_locale = intl.currentLocale;
r30.uptime_app = Math.floor((performance.now() - c590_18) / c590_15);
const processUptime = ProcessUtils_native.getProcessUptime();
if (processUptime != null) {
r30.uptime_process_renderer = Math.floor(processUptime);
}
const { utmSource, utmMedium, utmCampaign, utmContent } = c590_14;
let utm_source = r30.utm_source;
if (utm_source == null) {
utm_source = utmSource;
}
r30.utm_source = utm_source;
let utm_medium = r30.utm_medium;
if (utm_medium == null) {
utm_medium = utmMedium;
}
r30.utm_medium = utm_medium;
let utm_campaign = r30.utm_campaign;
if (utm_campaign == null) {
utm_campaign = utmCampaign;
}
r30.utm_campaign = utm_campaign;
let utm_content = r30.utm_content;
if (utm_content == null) {
utm_content = utmContent;
}
r30.utm_content = utm_content;
r30.launch_signature = launch_signature;
c590_20.forEach((item) => item(c12461_0));
return r30;
};
_excluded = ["location"];
_excluded2 = ["source"];
const context = createContext({
location: {}
});
c590_14 = {};
c590_15 = 1000;
throttlePeriod = 60000;
throttlePeriod2 = 900000;
c590_18 = performance.now();
const r60 = isLibdiscoreInitialized() ? generateLaunchSignature(getGlobalObject()) : null;
export function expandLocation(a0) {
return typeof a0 === "string" ? {
location: a0
} : {
location: a0.page,
location_page: a0.page,
location_section: a0.section,
location_object: a0.object,
location_object_type: a0.objectType
};
}
const addBreadcrumb = function addBreadcrumb(a0) {
if (!IGNORE_ANALYTICS_BREADCRUMB_EVENTS.includes(a0)) {
SentryUtils_native.addBreadcrumb({
category: "analytics",
message: a0
});
}
};
export function debugLogEvent(a0, a1, r2 = false) {
DeveloperOptionsStore.isLoggingAnalyticsEvents;
if (r2) {
report("Analytics", a0, a1);
} else {
report("Analytics", a0);
}
}
launch_signature = r60;
extendSuperProperties({
launch_signature
});
c590_20 = [];
const analyticEventConfigs = {};
analyticEventConfigs[AnalyticEvents.APP_OPENED] = {
throttlePeriod: 300000,
throttleKeys: () => []
};
analyticEventConfigs[AnalyticEvents.APP_BACKGROUND] = {
throttlePeriod: 120000,
throttleKeys: () => []
};
analyticEventConfigs[AnalyticEvents.ACK_MESSAGES] = (a0) => a0.location_object_type !== AnalyticsObjectTypes.ACK_MANUAL ? {
throttlePeriod: throttlePeriod2,
throttleKeys: (a0) => [a0.guild_id, a0.channel_id, a0.location_section]
} : void 0;
analyticEventConfigs[AnalyticEvents.GUILD_VIEWED] = {
throttlePeriod: 900000,
throttleKeys: (a0) => [a0.guild_id, a0.is_pending]
};
analyticEventConfigs[AnalyticEvents.FRIENDS_LIST_VIEWED] = {
throttlePeriod: 900000,
throttleKeys: (a0) => [a0.tab_opened]
};
analyticEventConfigs[AnalyticEvents.NOW_PLAYING_CARD_HOVERED] = {
throttlePeriod: 900000,
throttleKeys: (a0) => [a0.tab_opened]
};
analyticEventConfigs[AnalyticEvents.START_SPEAKING] = {
throttlePeriod: 900000,
throttleKeys: (a0) => [a0.server]
};
analyticEventConfigs[AnalyticEvents.START_LISTENING] = {
throttlePeriod: 900000,
throttleKeys: (a0) => [a0.server]
};
analyticEventConfigs[AnalyticEvents.ACTIVITY_UPDATED] = {
throttlePeriod: 60000,
throttleKeys: (a0) => [a0.application_id],
deduplicate: true
};
analyticEventConfigs[AnalyticEvents.CHANNEL_OPENED] = {
throttlePeriod: 900000,
throttleKeys: (a0) => a0.channel_static_route != null ? [a0.guild_id, a0.channel_static_route, a0.channel_view] : [a0.channel_id, a0.channel_view]
};
analyticEventConfigs[AnalyticEvents.TEXT_IN_VOICE_OPENED] = {
throttlePeriod: 86400000,
throttleKeys: (a0) => [a0.channel_id]
};
analyticEventConfigs[AnalyticEvents.NOTIFICATION_VIEWED] = {
throttlePeriod: 900000,
throttleKeys: (a0) => [a0.notif_type]
};
analyticEventConfigs[AnalyticEvents.MEMBER_LIST_VIEWED] = {
throttlePeriod: 900000,
throttleKeys: (a0) => [a0.channel_id]
};
analyticEventConfigs[AnalyticEvents.DM_LIST_VIEWED] = {
throttlePeriod: 900000,
throttleKeys: (a0) => [a0.channel_id]
};
analyticEventConfigs[AnalyticEvents.NAV_DRAWER_OPENED] = {
throttlePeriod: 900000,
throttleKeys: () => []
};
analyticEventConfigs[AnalyticEvents.KEYBOARD_SHORTCUT_USED] = {
throttlePeriod: 120000,
throttleKeys: (a0) => {
const r2 = [a0.shortcut_name, a0.location_object];
let source_class_list = a0.source_class_list;
if (source_class_list == null) {
source_class_list = [];
}
HermesBuiltin.arraySpread(r2, source_class_list, 2);
return r2;
}
};
analyticEventConfigs[AnalyticEvents.QUICKSWITCHER_OPENED] = {
throttlePeriod: 10000,
throttleKeys: () => []
};
analyticEventConfigs[AnalyticEvents.CHAT_INPUT_COMPONENT_VIEWED] = {
throttlePeriod: 900000,
throttleKeys: (a0) => [a0.type]
};
analyticEventConfigs[AnalyticEvents.ROLE_PAGE_VIEWED] = {
throttlePeriod: 120000,
throttleKeys: (a0) => [a0.role_id, a0.tab_opened]
};
analyticEventConfigs[AnalyticEvents.VIDEO_INPUT_INITIALIZED] = {
throttlePeriod: 300000,
throttleKeys: () => []
};
analyticEventConfigs[AnalyticEvents.AUDIO_INPUT_INITIALIZED] = {
throttlePeriod: 300000,
throttleKeys: () => []
};
analyticEventConfigs[AnalyticEvents.HUB_ONBOARDING_CAROUSEL_SCROLLED] = {
throttlePeriod: 900000,
throttleKeys: () => []
};
analyticEventConfigs[AnalyticEvents.HUB_STUDENT_PROMPT_CLICKED] = {
throttlePeriod: 900000,
throttleKeys: () => []
};
analyticEventConfigs[AnalyticEvents.RPC_SERVER_ERROR_CAUGHT] = {
throttlePeriod: 86400000,
throttleKeys: () => []
};
analyticEventConfigs[AnalyticEvents.RPC_COMMAND_SENT] = {
throttlePeriod: 86400000,
throttleKeys: (a0) => [a0.application_id, a0.command],
throttlePercent: 0.001
};
analyticEventConfigs[AnalyticEvents.RPC_SUBSCRIPTION_REQUESTED] = {
throttlePeriod: 86400000,
throttleKeys: (a0) => [a0.application_id, a0.event],
throttlePercent: 0.001
};
analyticEventConfigs[AnalyticEvents.ACTIVITY_HANDSHAKE] = {
throttlePeriod: 86400000,
throttleKeys: (a0) => [a0.application_id]
};
analyticEventConfigs[AnalyticEvents.CHANNEL_BANNER_VIEWED] = {
throttlePeriod: 86400000,
throttleKeys: (a0) => [a0.banner_type, a0.channel_id]
};
analyticEventConfigs[ImpressionNames.GUILD_HANGOUT_WINDOW] = {
throttlePeriod: 86400000,
throttleKeys: (a0) => [a0.channel_id, a0.banner_hash]
};
analyticEventConfigs[ImpressionNames.GUILD_HANGOUT_WINDOW_ENTRY_POINT] = {
throttlePeriod: 86400000,
throttleKeys: (a0) => [a0.channel_id, a0.media_session_id]
};
analyticEventConfigs[AnalyticEvents.PREMIUM_UPSELL_VIEWED] = {
throttlePeriod: 60000,
throttleKeys: (a0) => [a0.type]
};
analyticEventConfigs[AnalyticEvents.FORUM_CHANNEL_SEARCHED] = {
throttlePeriod: 60000,
throttleKeys: (a0) => [a0.guild_id, a0.channel_id]
};
analyticEventConfigs[AnalyticEvents.FORUM_CHANNEL_SCROLLED] = {
throttlePeriod: 900000,
throttleKeys: (a0) => [a0.guild_id, a0.channel_id]
};
analyticEventConfigs[AnalyticEvents.VOICE_CHANNEL_GAME_ACTIVITY_INDICATOR_VIEWED] = {
throttlePeriod: 60000,
throttleKeys: (a0) => [a0.user_id]
};
analyticEventConfigs[AnalyticEvents.MEDIA_VIEWER_SESSION_COMPLETED] = {
throttlePeriod: 60000,
throttleKeys: () => []
};
analyticEventConfigs[AnalyticEvents.SUMMARIES_UNREAD_BAR_VIEWED] = {
throttlePeriod: 300000,
throttleKeys: (a0) => [a0.channel_id]
};
analyticEventConfigs[AnalyticEvents.ACTIVITY_CARDS_VIEWED] = {
throttlePeriod: 900000,
throttleKeys: (a0) => [a0.context, a0.guild_id]
};
analyticEventConfigs[AnalyticEvents.GUILD_TOOLTIP_SHOWN] = {
throttlePeriod: 900000,
throttleKeys: (a0) => [a0.guild_id]
};
analyticEventConfigs[AnalyticEvents.ACK_COMMUNITY_MESSAGES] = {
throttlePeriod: 900000,
throttleKeys: (a0) => [a0.channel_id]
};
analyticEventConfigs[AnalyticEvents.REDESIGN_NAV_BAR_CLICKED] = {
throttlePeriod: 900000,
throttleKeys: (a0) => [a0.tab]
};
analyticEventConfigs[AnalyticEvents.CHANNEL_LIST_END_REACHED] = {
throttlePeriod: 900000,
throttleKeys: (a0) => [a0.guild_id]
};
analyticEventConfigs[AnalyticEvents.EXPLICIT_MEDIA_REDACTABLE_MESSAGES_LOADED] = {
throttlePeriod: 60000,
throttleKeys: (a0) => [a0.guild_id, a0.channel_id]
};
analyticEventConfigs[AnalyticEvents.LIVE_ACTIVITY_SETTINGS_UPDATED] = {
throttlePeriod: 3600000,
throttleKeys: () => []
};
analyticEventConfigs[AnalyticEvents.MEDIA_INPUT_VOLUME_CHANGED] = {
throttlePeriod: 300000,
throttleKeys: (a0) => [a0.location_stack]
};
analyticEventConfigs[AnalyticEvents.MEDIA_OUTPUT_VOLUME_CHANGED] = {
throttlePeriod: 300000,
throttleKeys: (a0) => [a0.location_stack]
};
analyticEventConfigs[AnalyticEvents.APP_DMS_QUICK_LAUNCHER_IMPRESSION] = {
throttlePeriod: 900000,
throttleKeys: (a0) => [a0.channel_id]
};
analyticEventConfigs[AnalyticEvents.USER_VOICE_ACTIVITY_VIEWED] = {
throttlePeriod: 300000,
throttleKeys: (a0) => [a0.activity_user_id, a0.surface],
deduplicate: true
};
analyticEventConfigs[AnalyticEvents.PARTY_VOICE_ACTIVITY_VIEWED] = {
throttlePeriod: 300000,
throttleKeys: (a0) => [a0.voice_channel_id],
deduplicate: true
};
analyticEventConfigs[AnalyticEvents.MEMBER_LIST_SWIPE_PEEK] = {
throttlePeriod: 1000,
throttleKeys: (a0) => [a0.channel_id]
};
analyticEventConfigs[AnalyticEvents.REDACTABLE_MESSAGE_LOADED] = {
throttlePeriod: 900000,
throttleKeys: (a0) => [a0.channel_id, a0.message_id]
};
analyticEventConfigs[AnalyticEvents.OPEN_MODAL] = (a0) => a0.type === AnalyticsSections.MEDIA_VIEWER ? {
throttlePeriod,
throttleKeys: (a0) => [a0.type]
} : void 0;
analyticEventConfigs[AnalyticEvents.MODERATOR_QUEUE_ACTION] = {
throttlePeriod: 10000,
throttleKeys: (a0) => [a0.guild_id]
};
analyticEventConfigs[AnalyticEvents.NOTIFICATION_PERMISSION_STATUS] = {
throttlePeriod: 43200000,
throttleKeys: (a0) => [a0.os_enabled, a0.notification_authorization_status, a0.foreground_app_enabled, a0.background_app_enabled]
};
analyticEventConfigs[AnalyticEvents.SEARCH_BAR_VIEWED] = {
throttlePeriod: 3600000,
throttleKeys: (a0) => [a0.search_type]
};
analyticEventConfigs[AnalyticEvents.AD_IDENTIFIER_FETCHED] = {
throttlePeriod: 86400000,
throttleKeys: () => []
};
analyticEventConfigs[AnalyticEvents.ACTIVITY_PANEL_SDK_LINK_VIEWED] = {
throttlePeriod: 86400000,
throttleKeys: (a0) => [a0.application_id]
};
analyticEventConfigs[AnalyticEvents.LIBDISCORE_SLOW_TIMERS] = {
throttlePeriod: 3600000,
throttleKeys: () => []
};
analyticEventConfigs[AnalyticEvents.VIDEO_STREAM_ZOOM_CHANGED] = {
throttlePeriod: 1000,
throttleKeys: () => []
};
analyticEventConfigs[AnalyticEvents.CACHE_STATS_RECORDED] = {
throttlePeriod: 900000,
throttleKeys: () => []
};
getAccessibilityFeatures = () => AccessibilityFeatureFlags.NONE;
c590_22 = trackMaker({
addBreadcrumb,
analyticEventConfigs,
dispatcher: Dispatcher,
TRACK_ACTION_NAME: "TRACK"
});
c590_24 = false;
c590_25 = {};
c590_26 = trackMaker({
addBreadcrumb,
analyticEventConfigs,
dispatcher: Dispatcher,
TRACK_ACTION_NAME: "TRACK"
});
const r271 = {
..._Module503,
getCampaignParams: _Module503.getCampaignParams,
setSystemAccessibilityFeatures: function setSystemAccessibilityFeatures(a0) {
getAccessibilityFeatures = a0;
},
expandEventProperties,
track: function track(a0, a1, r7 = {}) {
const r10 = String(a0);
if (!!c590_24 && a1 != null) {
if (Array.isArray(c590_25[a0])) {
c590_25[a0].push(a1);
} else {
c590_25[a0] = [a1];
}
}
if (r7.throttlePercent != null && Math.random() > r7.throttlePercent) {
return Promise.resolve();
}
const r28 = expandEventProperties(a1);
let logEventProperties = r7.logEventProperties;
if (logEventProperties === void 0) {
logEventProperties = false;
}
DeveloperOptionsStore.isLoggingAnalyticsEvents;
if (logEventProperties) {
report("Analytics", r10, r28);
} else {
report("Analytics", r10);
}
return c590_22(a0, r28, {
flush: r7.flush,
fingerprint: r7.fingerprint
});
}
};
export default r271;
export { context as AnalyticsContext };
export { launch_signature as launchSignature };
export function addExtraAnalyticsDecorator(a0) {
c590_20.push(a0);
}
export { analyticEventConfigs as AnalyticEventConfigs };
export function setUTMContext(a0) {
c590_14 = a0;
return a0;
}
export { expandEventProperties };
export function startRecordingAnalyticsEvents() {
c590_24 = true;
}
export function stopRecordingAnalyticsEvents() {
c590_24 = false;
}
export function getAnalyticsEventsRecording() {
return c590_25;
}
export function clearAnalyticsEventsRecording() {
Object.keys(c590_25).forEach((item) => {
delete c590_25[item];
});
}
export function isGameApplicationType(a0) {
return a0 === ApplicationTypes.GAME || a0 === ApplicationTypes.DEPRECATED_GAME;
}
export function trackNetworkAction(a0, a1) {
const r11 = expandEventProperties({
location: getLocation(),
...a1
});
setDebugTrackedData(a0, {
type: "action",
...a1
});
DeveloperOptionsStore.isLoggingAnalyticsEvents;
report("Analytics", a0);
c590_26(a0, r11);
}
export function getNewAnalyticsLoadId() {
return v4();
}
exports.AnalyticsSchema = _AnalyticsSchema;
+426
View File
@@ -0,0 +1,426 @@
// Metro module 7917 (f7918).
import ApplicationAssetsStore from "../modules/applications/ApplicationAssetsStore";
import { Endpoints, PlatformTypes } from "../Constants";
import Module38 from "../_bundle/Module38";
import Logger from "../modules/debug/Logger";
import { HTTP, getAPIBaseURL } from "../_bundle/sendRequest";
import Dispatcher from "../Dispatcher";
import { getBestMediaProxySize } from "../modules/image_upload/ImageLoaderUtils";
function $mk79522() {
return (a0) => (a0 == null ? void 0 : a0.startsWith("http:")) || (a0 == null ? void 0 : a0.startsWith("https:"));
}
function $mk115082($env) {
return function resolveExternalAssets() {
return $env[18].apply(this, arguments);
};
}
function $mk115083($env) {
return () => {
const r5 = $env;
return (0, fetchAssetIds)(r5[0], r5[1], r5[2] - 1);
};
}
let getApplicationAssetsMap, getAssets, updateUrlAssetIds, updateNonUrlAssetIds, fetchAssetIds, c5004_8, c5004_9, c5004_10, c5004_11, c5004_12;
let env5004 = {};
const updateAssets = async function updateAssets(c26061_0) {
let c29863_0 = c26061_0;
let c29863_1 = (await HTTP.get({
url: Endpoints.APPLICATION_ASSETS(c26061_0),
oldFormErrors: true,
rejectWithError: false
})).body;
Dispatcher.dispatch({
type: "APPLICATION_ASSETS_UPDATE",
applicationId: c29863_0,
assets: c29863_1
});
return ApplicationAssetsStore.getApplicationAssets(c29863_0);
};
getApplicationAssetsMap = function getApplicationAssetsMap(a0) {
let r15;
const applicationAssets = ApplicationAssetsStore.getApplicationAssets(a0);
if (applicationAssets != null) {
const lastUpdated = applicationAssets.lastUpdated;
r15 = Date.now() - lastUpdated > 3600000 ? updateAssets(a0) : Promise.resolve(applicationAssets);
} else {
r15 = updateAssets(a0);
}
return r15;
};
getAssets = async function getAssets(c26062_0) {
let c29864_0 = await getApplicationAssetsMap(c26062_0);
return c29864_0?.assets;
};
env5004[18] = function _resolveExternalAssets() {
const r8 = async (c26063_0, c26063_1) => {
let r30;
let c26063_2, c26063_3, c26063_4, c26063_5, c26063_6;
let c26063_7 = 0;
const r9 = env5004;
L15: {
try {
let env29865;
c26063_5 = r9;
const r38 = env29865 = {
$parent: r9
};
c26063_4 = r38;
env29865[0] = void 0;
env29865[1] = void 0;
env29865[2] = void 0;
env29865[3] = void 0;
const urls = c26063_1.filter((item) => item != null && c5004_12.get(item) == null);
if (urls.length !== 0) {
env29865[0] = (await HTTP.post({
url: Endpoints.APPLICATION_EXTERNAL_ASSETS(c26063_0),
body: {
urls
},
oldFormErrors: true,
rejectWithError: false
})).body;
const r69 = env29865[0];
c26063_3 = r69;
const r71 = r69[Symbol.iterator]();
c26063_3 = r71.next;
c26063_2 = r71;
while (true) {
const r73 = c26063_3;
let r74 = c26063_2;
const r75 = r74 === void 0 ? void 0 : (r30 = r73.call(r74)).done ? r74 = void 0 : r30.value;
c26063_2 = r74;
if (r74 === void 0) {
break L15;
}
c26063_7 = 1;
env29865[1] = r75;
env29865[2] = env29865[1].url;
env29865[3] = env29865[1].external_asset_path;
c5004_12.set(env29865[2], env29865[3]);
c26063_7 = 0;
}
}
} catch ($e) {
const r36 = $e;
let r7 = r36;
c26063_6 = r36;
if (c26063_7 !== 0) {
while (true) {
try {
const r93 = c26063_6;
c26063_7 = 0;
const r95 = c26063_2;
if (r95 !== void 0 && typeof r95.return === "function") {
try {
r95.return();
} catch {}
}
throw r93;
} catch (r91) {
r7 = r91;
c26063_6 = r91;
if (c26063_7 === 0) {
break;
}
}
}
}
throw r7;
}
return void 0;
}
};
env5004[18] = r8;
return r8.apply(this, arguments);
};
updateUrlAssetIds = function updateUrlAssetIds(a0, a1) {
let length;
const r21 = a0.filter($mk79522()).length > 0;
let r6 = 0;
if (r21) {
const r8 = 0 < a0.length;
let r1 = 0;
let r2 = 0;
r6 = 0;
if (r8) {
do {
const r18 = a0[r1];
const r25 = r1;
const r3 = r2;
let r0 = r3;
if (r18 != null) {
const r27 = c5004_12.get(r18);
r0 = r3;
if (r27 != null) {
const r31 = c5004_11.mp.serialize(r27);
a1[r25] = r31 ? `mp:${r31.toString()}` : null;
r0 = r3 + 1;
}
}
r1 = r25 + 1;
length = a0.length;
r2 = r0;
r6 = r2;
} while (r1 < length);
}
}
return r6 === a0.length;
};
updateNonUrlAssetIds = function updateNonUrlAssetIds(a0, a1, a2, a3) {
let r1, r6, r20, length;
const r4 = 0 < a0.length;
let r5 = false;
let r0 = 0;
let r8 = false;
if (r4) {
do {
L13: {
const r18 = a0[r0];
r1 = r0;
const r7 = r5;
r20 = r7;
if (r18 != null) {
const r21 = a1[r1];
r20 = r7;
if (r21 == null) {
const r25 = Object.prototype.hasOwnProperty.call(a2, r18) && a2[r18];
L12: {
r6 = r7;
if (!r25) {
if (a3 != null) {
const r10 = a3 <= 0;
r6 = true;
if (!r10) {
break L12;
}
}
a1[r1] = null;
r20 = r7;
break L13;
}
}
a1[r1] = r25.id;
r20 = r6;
}
}
}
r0 = r1 + 1;
length = a0.length;
r5 = r20;
r8 = r5;
} while (r0 < length);
}
return r8;
};
fetchAssetIds = async function fetchAssetIds(c26064_0, c26064_1, c26064_2) {
let r91, r130;
let c26064_3, c26064_4;
L22: {
let env29866;
const r33 = env5004;
c26064_4 = r33;
const r10 = env29866 = {
$parent: r33
};
c26064_3 = r10;
env29866[2] = void 0;
env29866[0] = c26064_0;
env29866[1] = c26064_1;
if (c26064_2 !== void 0) {
env29866[2] = c26064_2;
env29866[3] = void 0;
env29866[4] = void 0;
env29866[5] = void 0;
} else {
env29866[2] = 1;
env29866[3] = void 0;
env29866[4] = void 0;
env29866[5] = void 0;
}
await void 0;
Dispatcher.dispatch({
type: "APPLICATION_ASSETS_FETCH",
applicationId: env29866[0]
});
env29866[3] = [];
env29866[4] = env29866[1].filter((item) => (item == null ? void 0 : item.startsWith("http:")) || (item == null ? void 0 : item.startsWith("https:")));
if (env29866[4].length > 0) {
const r68 = env29866[0];
const r69 = env29866[4];
await $mk115082(env5004)(r68, r69);
}
if ((0, updateUrlAssetIds)(env29866[1], env29866[3])) {
Dispatcher.dispatch({
type: "APPLICATION_ASSETS_FETCH_SUCCESS",
applicationId: env29866[0]
});
r91 = env29866[3];
break L22;
}
env29866[5] = await (0, getAssets)(env29866[0]);
Dispatcher.dispatch({
type: "APPLICATION_ASSETS_UPDATE",
applicationId: env29866[0],
assets: env29866[5]
});
const r122 = (0, updateNonUrlAssetIds)(env29866[1], env29866[3], env29866[5], env29866[2]);
const r123 = c26064_3;
if (r122) {
r130 = (0, updateAssets)(env29866[0]).then($mk115083(r123));
} else {
Dispatcher.dispatch({
type: "APPLICATION_ASSETS_FETCH_SUCCESS",
applicationId: env29866[0]
});
r130 = env29866[3];
}
return r130;
}
return r91;
};
const PlatformTypes2 = PlatformTypes;
c5004_8 = "https://i.scdn.co/image/";
c5004_9 = /https:\/\/static-cdn\.jtvnw\.net\/previews-ttv\/live_user_(.+)-\{width\}x\{height\}.jpg/;
c5004_10 = /https:\/\/i\.ytimg\.com\/vi\/([a-zA-Z0-9_-]+)\/hqdefault_live\.jpg/;
const r39 = {};
r39[PlatformTypes2.SPOTIFY] = {
deserialize: (a0) => `${c5004_8}${encodeURIComponent(a0)}`,
serialize: (a0) => a0.split(c5004_8)[1]
};
r39[PlatformTypes2.TWITCH] = {
deserialize: (a0, a1) => `https://static-cdn.jtvnw.net/previews-ttv/live_user_${encodeURIComponent(a0)}-${a1[0]}x${a1[1]}.jpg`,
serialize: (a0) => {
const r5 = a0.match(c5004_9);
return r5 != null ? r5[1] : null;
}
};
r39[PlatformTypes2.YOUTUBE] = {
deserialize: (a0) => `https://i.ytimg.com/vi/${encodeURIComponent(a0)}/hqdefault_live.jpg`,
serialize: (a0) => {
const r5 = a0.match(c5004_10);
return r5 != null ? r5[1] : null;
}
};
r39.mp = {
deserialize: (a0) => {
let uRL;
Module38(window.GLOBAL_ENV.MEDIA_PROXY_ENDPOINT != null, "MEDIA_PROXY_ENDPOINT not configured");
try {
uRL = new URL(a0, location.protocol + window.GLOBAL_ENV.MEDIA_PROXY_ENDPOINT);
} catch ($e) {
new Logger("ApplicationAssetUtils").warn(`getAssetImage: invalid media proxy asset path: ${a0}`);
return void 0;
}
let r36 = a0.toLowerCase().endsWith(".gif");
const r40 = a0.toLowerCase().endsWith(".webp");
const r44 = a0.toLowerCase().endsWith(".avif");
if (r36 ? r36 : r44) {
uRL.searchParams.set("format", "webp");
}
if (!r36) {
r36 = r40;
}
if (!r36) {
r36 = r44;
}
if (r36) {
uRL.searchParams.set("animated", "true");
}
return uRL.toString();
},
serialize: (a0) => a0
};
c5004_11 = r39;
c5004_12 = new Map();
export function getAssetFromImageURL(a0, a1) {
const r8 = c5004_11[a0].serialize(a1);
return r8 ? `${a0}:${r8.toString()}` : null;
}
export function getAssetImage(a0, a1, a2, r18 = "png") {
let r90, r97;
if (a1 != null && a1.includes(":")) {
const [r79, r80] = a1.split(":");
if (r79 === PlatformTypes.TWITCH) {
if (a2 != null && typeof a2 !== "number") {
r97 = c5004_11[PlatformTypes.TWITCH].deserialize(r80, a2);
} else {
new Logger("ApplicationAssetUtils").warn("getAssetImage: size must === [number, number] for Twitch");
r97 = void 0;
}
r90 = r97;
} else {
const hasOwnProperty = Object.prototype.hasOwnProperty;
r90 = hasOwnProperty.call(c5004_11, r79) ? c5004_11[r79].deserialize(r80) : void 0;
}
return r90;
}
if (a0 != null && a1 != null) {
const isArray = Array.isArray(a2);
let r10 = a2;
if (isArray) {
const r11 = Math;
r10 = r11.max.apply(r11, [...a2]);
}
const r15 = typeof r10 === "number" ? `?size=${getBestMediaProxySize(r10)}` : "";
return window.GLOBAL_ENV.CDN_HOST != null ? `${location.protocol}//${window.GLOBAL_ENV.CDN_HOST}/app-assets/${a0}/${a1}.${r18}${r15}` : `${getAPIBaseURL()}/applications/${a0}/app-assets/${a1}.${r18}${r15}`;
}
}
export { getAssets };
export { fetchAssetIds };
export function getAssetIds(a0, a1) {
let length;
const r10 = [];
const r8 = a1.filter($mk79522()).length > 0;
let r5 = 0;
if (r8) {
const r9 = 0 < a1.length;
let r3 = 0;
let r0 = 0;
r5 = 0;
if (r9) {
do {
const r20 = a1[r3];
const r7 = r3;
const r4 = r0;
let r1 = r4;
if (r20 != null) {
const r27 = c5004_12.get(r20);
r1 = r4;
if (r27 != null) {
const r31 = c5004_11.mp.serialize(r27);
r10[r7] = r31 ? `mp:${r31.toString()}` : null;
r1 = r4 + 1;
}
}
r3 = r7 + 1;
length = a1.length;
r0 = r1;
r5 = r0;
} while (r3 < length);
}
}
if (r5 === a1.length) {
return r10;
}
const assets = ApplicationAssetsStore.getApplicationAssets(a0)?.assets;
if (assets != null) {
const r47 = 0 < a1.length;
let r50 = 0;
if (r47) {
do {
const r51 = a1[r50];
const r52 = r50;
if (r51 != null && r10[r52] == null) {
const r58 = Object.prototype.hasOwnProperty.call(assets, r51) && assets[r51];
if (r58) {
r10[r52] = r58.id;
} else {
r10[r52] = null;
}
}
r50 = r52 + 1;
} while (r50 < a1.length);
}
}
return r10;
}
+104
View File
@@ -0,0 +1,104 @@
// Metro module 4730 (f4731).
import Logger from "../modules/debug/Logger";
import Module38 from "../_bundle/Module38";
import { UploadPlatform } from "../lib/uploader/Upload";
import { getFileInfo, getFileSize, cancelGetFileInfo, getAppDir } from "./native/UploadUtils";
import { getAttachmentPayload } from "./UploadUtils";
let c2888_4 = new Logger("AttachmentFile");
export async function getAttachmentFile(c25269_0, c25269_1) {
let r118;
let filename, c25269_5;
let c25269_6 = 0;
let c29420_0, c29420_1, c29420_2, c29420_3, c29420_4, c29420_5;
L14: {
try {
c29420_0 = c25269_0;
c29420_1 = c25269_1;
c29420_2 = void 0;
c29420_3 = void 0;
c29420_4 = void 0;
Module38(c25269_0.item.platform === UploadPlatform.REACT_NATIVE, "Upload must be in the React Native format");
c25269_6 = 1;
c29420_3 = await getFileInfo(c25269_0, c25269_1);
c29420_4 = getAttachmentPayload(c29420_0, c29420_1, c29420_3.name);
c25269_6 = 2;
c29420_2 = await getFileSize(c29420_3.uri);
c25269_6 = 1;
filename = c29420_4.filename;
if (filename == null) {
filename = "";
}
r118 = {
file: c29420_3,
uri: c29420_3.uri,
name: filename,
fileSize: c29420_2
};
c25269_6 = 0;
} catch ($e) {
const r34 = $e;
let r8 = r34;
c25269_5 = r34;
let r35 = c25269_6;
if (r35 !== 0) {
while (true) {
if (r35 === 1) {
try {
const r147 = c25269_5;
c25269_6 = 0;
c29420_5 = r147;
c2888_4.error("Failed to get attachment file", c29420_5);
} catch (r144) {
r8 = r144;
c25269_5 = r144;
r35 = c25269_6;
if (r35 === 0) {
break;
}
continue;
}
return void 0;
}
try {
c25269_6 = 1;
filename = c29420_4.filename;
if (filename == null) {
filename = "";
}
r118 = {
file: c29420_3,
uri: c29420_3.uri,
name: filename,
fileSize: c29420_2
};
c25269_6 = 0;
break L14;
} catch (r130) {
r8 = r130;
c25269_5 = r130;
r35 = c25269_6;
if (r35 === 0) {
break;
}
}
}
}
throw r8;
}
}
return r118;
}
export async function cancelGetAttachmentFile(c25270_0) {
await cancelGetFileInfo(c25270_0);
}
export function fileIsInAppDir(a0) {
let r13;
const r8 = a0.replace(/^file:\/\//, "");
try {
r13 = getAppDir() !== "" && r8.startsWith(getAppDir());
} catch ($e) {
c2888_4.error("Failed to get app dir", $e);
return false;
}
return r13;
}
+12
View File
@@ -0,0 +1,12 @@
// Metro module 1352 (f1353).
import * as _setSecondaryToken from "../_bundle/setSecondaryToken";
import * as _Module1353 from "../_bundle/Module1353";
export function getToken() {
return _setSecondaryToken.getToken();
}
export function isAuthenticated() {
return _setSecondaryToken.getToken() != null;
}
export function getArtForPath(a0) {
return a0 != null ? /^\/developers/.test(a0) ? _Module1353 : null : null;
}
File diff suppressed because it is too large. Load diff
+806
View File
@@ -0,0 +1,806 @@
// Metro module 1416 (f1417).
import { AVATAR_SIZE, Endpoints } from "../Constants";
import { AVATAR_DECORATION_SIZE } from "../modules/collectibles/avatar_decorations/AvatarDecorationConstants";
import * as _AvatarUtils from "./native/AvatarUtils";
import * as _PlatformUtils from "./PlatformUtils";
import { getBestMediaProxySize, getDevicePixelRatio } from "../modules/image_upload/ImageLoaderUtils";
import Module1464 from "../_bundle/Module1464";
import { getForceSdrEmojisStickersConfig } from "../modules/image_upload/ForceSdrEmojisStickersExperiment";
import { parseInteger } from "./NumberUtils";
import Integer from "../_bundle/Integer";
import { isAvatarDecorationExpired } from "../modules/collectibles/avatar_decorations/AvatarDecorationUtils";
import * as _CollectiblesAssetUtils from "../modules/collectibles/utils/CollectiblesAssetUtils";
import { getCollectiblesItemAssetUrl } from "../modules/collectibles/utils/CollectiblesAssetUtils";
import Module1855 from "../_bundle/Module1855";
import SnowflakeUtils from "./SnowflakeUtils";
import { parse } from "../_bundle/Url_1469";
let c1171_6, DEFAULT_AVATARS, DEFAULT_AVATARS_SMALL, DEFAULT_AVATARS_SMALL_MAX_SIZE, DEFAULT_PROVISIONAL_AVATARS, canUseWebp, isAndroid, getDefaultAvatarURL, getUserAvatarURL, getGuildMemberAvatarURLSimple, getGuildBannerURL, getApplicationIconURL, getChannelIconURL, _getAssetHash;
const getAvatarURL = function getAvatarURL(a0) {
let r45, r46;
const { endpoint: endpoint2, path, id, hash, size, lossless = false, canAnimate = false, keepAspectRatio } = a0;
let format = a0.format;
if (format === void 0) {
format = null;
}
let canWebP = a0.canWebP;
if (canWebP === void 0) {
canWebP = canUseWebp;
}
if (id != null && hash != null) {
if (format == null) {
format = canAnimate ? hash != null && hash.startsWith("a_") ? canWebP ? "webp" : "gif" : "jpg" : "jpg";
}
if (canAnimate ? hash != null && hash.startsWith("v_") : canAnimate) {
format = "mp4";
}
const CDN_HOST = window.GLOBAL_ENV.CDN_HOST;
if (CDN_HOST != null) {
const r48 = format === "jpg" ? canWebP ? "webp" : "png" : format;
r45 = `https://${CDN_HOST}/${path}/${id}/${hash}.${r48}`;
r46 = r48;
} else {
r45 = location.protocol + window.GLOBAL_ENV.API_ENDPOINT + endpoint2(id, hash, format);
r46 = format;
}
if (r46 === "mp4") {
return r45;
}
const r54 = {};
if (size != null) {
r54.size = getBestMediaProxySize(size * getDevicePixelRatio());
}
if (keepAspectRatio != null) {
r54.keep_aspect_ratio = keepAspectRatio;
}
if (lossless) {
r54.quality = "lossless";
}
if (r46 === "webp" && canAnimate && (hash != null && hash.startsWith("a_"))) {
r54.animated = true;
}
return r45 + `?${Module1464.stringify(r54)}`;
}
};
getDefaultAvatarURL = function getDefaultAvatarURL(id, discriminator, r3 = false) {
let r11;
L10: {
if (r3) {
r11 = DEFAULT_PROVISIONAL_AVATARS;
} else {
if (!r3) {
const r4 = arguments[3];
if (r4 != null && r4 <= DEFAULT_AVATARS_SMALL_MAX_SIZE) {
r11 = DEFAULT_AVATARS_SMALL;
break L10;
}
}
r11 = DEFAULT_AVATARS;
}
}
if (id == null && discriminator == null) {
return r11[0];
}
const r16 = parseInteger(discriminator, 0);
return r16 > 0 ? r11[r16 % 5] : id != null ? r11[Integer(id).shiftRight(22).mod(r11.length).toJSNumber()] : r11[0];
};
getUserAvatarURL = function getUserAvatarURL(a0, canAnimate = false, r8 = AVATAR_SIZE, format = null, canWebP = canUseWebp) {
let r26;
const { id, avatar, discriminator, bot } = a0;
if (canAnimate === void 0) {
canAnimate = false;
}
let size = r8;
if (size === void 0) {
size = AVATAR_SIZE;
}
if (format === void 0) {
format = null;
}
if (canWebP === void 0) {
canWebP = canUseWebp;
}
L22: {
if (bot) {
r26 = _AvatarUtils.default.BOT_AVATARS[avatar];
if (r26) {
break L22;
}
r26 = avatar == null && discriminator === "0000" ? DEFAULT_AVATARS[0] : getAvatarURL({
endpoint: Endpoints.AVATAR,
path: "avatars",
id,
hash: avatar,
size,
canAnimate,
format,
canWebP
});
} else {
r26 = getAvatarURL({
endpoint: Endpoints.AVATAR,
path: "avatars",
id,
hash: avatar,
size,
canAnimate,
format,
canWebP
});
}
}
if (r26 == null) {
r26 = getDefaultAvatarURL(a0.id, a0.discriminator, a0.isProvisional, r8);
}
return r26;
};
getGuildMemberAvatarURLSimple = function getGuildMemberAvatarURLSimple({ guildId, userId: userId2, avatar, canAnimate = false, size = AVATAR_SIZE, canWebP = canUseWebp }) {
let r35, r36;
const r4 = canAnimate ? avatar != null && avatar.startsWith("a_") ? canWebP ? "webp" : "gif" : "jpg" : "jpg";
const CDN_HOST = window.GLOBAL_ENV.CDN_HOST;
if (CDN_HOST != null) {
const r37 = r4 === "jpg" ? canWebP ? "webp" : "png" : r4;
r35 = `https://${CDN_HOST}${Endpoints.GUILD_MEMBER_AVATAR(guildId, userId2, avatar, r37)}`;
r36 = r37;
} else {
r35 = location.protocol + window.GLOBAL_ENV.API_ENDPOINT + Endpoints.GUILD_MEMBER_AVATAR(guildId, userId2, avatar, r4);
r36 = r4;
}
const r61 = {
size: getBestMediaProxySize(size * getDevicePixelRatio())
};
if (r36 === "webp" && canAnimate && (avatar != null && avatar.startsWith("a_"))) {
r61.animated = true;
}
return r35 + `?${Module1464.stringify(r61)}`;
};
getGuildBannerURL = function getGuildBannerURL(a0) {
const { id, banner } = a0;
let r10 = arguments[1];
if (r10 === void 0) {
r10 = false;
}
if (banner == null) {
return null;
}
const bestMediaProxySize = getBestMediaProxySize(360 * getDevicePixelRatio());
const r36 = canUseWebp ? "webp" : "jpg";
const r11 = r10 ? banner != null && banner.startsWith("a_") ? canUseWebp ? "webp" : "gif" : r36 : r36;
const CDN_HOST = window.GLOBAL_ENV.CDN_HOST;
const r51 = CDN_HOST != null ? `https://${CDN_HOST}/banners/${id}/${banner}.${r11}` : location.protocol + window.GLOBAL_ENV.API_ENDPOINT + Endpoints.GUILD_BANNER(id, banner, r11);
const r53 = {
size: bestMediaProxySize
};
if (r11 === "jpg") {
r53.quality = "lossless";
}
if (r11 === "webp" && r10 && (banner != null && banner.startsWith("a_"))) {
r53.animated = true;
}
return r51 + `?${Module1464.stringify(r53)}`;
};
getApplicationIconURL = function getApplicationIconURL({ id, icon, size = AVATAR_SIZE, bot, botIconFirst, fallbackAvatar = true, keepAspectRatio, guildMember }) {
let r30, r49;
if (bot?.id != null && guildMember != null && guildMember.avatar != null) {
return getGuildMemberAvatarURLSimple({
userId: bot.id,
guildId: guildMember.guildId,
avatar: guildMember.avatar,
canAnimate: false,
size
});
}
if (bot != null && botIconFirst) {
const { id: id2, avatar, discriminator, bot: bot2 } = bot;
const size2 = size === void 0 ? AVATAR_SIZE : size;
L19: {
if (bot2) {
r30 = _AvatarUtils.default.BOT_AVATARS[avatar];
if (r30) {
break L19;
}
r30 = avatar == null && discriminator === "0000" ? DEFAULT_AVATARS[0] : getAvatarURL({
endpoint: Endpoints.AVATAR,
path: "avatars",
id: id2,
hash: avatar,
size: size2,
canAnimate: false,
format: null,
canWebP: canUseWebp
});
} else {
r30 = getAvatarURL({
endpoint: Endpoints.AVATAR,
path: "avatars",
id: id2,
hash: avatar,
size: size2,
canAnimate: false,
format: null,
canWebP: canUseWebp
});
}
}
if (r30 != null) {
return r30;
}
}
if (icon != null) {
return icon != null && c1171_6.test(icon) ? icon : getAvatarURL({
endpoint: Endpoints.APPLICATION_ICON,
path: "app-icons",
id,
hash: icon,
size,
canAnimate: false,
canWebP: false,
keepAspectRatio
});
}
if (bot != null) {
const { id: id3, avatar: avatar2, discriminator: discriminator2, bot: bot3 } = bot;
let size3 = size;
if (size3 === void 0) {
size3 = AVATAR_SIZE;
}
L30: {
if (bot3) {
r49 = _AvatarUtils.default.BOT_AVATARS[avatar2];
if (r49) {
break L30;
}
r49 = avatar2 == null && discriminator2 === "0000" ? DEFAULT_AVATARS[0] : getAvatarURL({
endpoint: Endpoints.AVATAR,
path: "avatars",
id: id3,
hash: avatar2,
size: size3,
canAnimate: false,
format: null,
canWebP: canUseWebp
});
} else {
r49 = getAvatarURL({
endpoint: Endpoints.AVATAR,
path: "avatars",
id: id3,
hash: avatar2,
size: size3,
canAnimate: false,
format: null,
canWebP: canUseWebp
});
}
}
if (r49 != null) {
return r49;
}
}
return fallbackAvatar ? Module1855 : void 0;
};
getChannelIconURL = function getChannelIconURL({ id, icon, applicationId, size }) {
let r16;
if (applicationId != null) {
let r34 = getApplicationIconURL({
id: applicationId,
icon,
size
});
if (r34 == null) {
r34 = _AvatarUtils.default.DEFAULT_CHANNEL_ICON;
}
r16 = r34;
} else {
r16 = getAvatarURL({
endpoint: Endpoints.CHANNEL_ICON,
path: "channel-icons",
id,
hash: icon,
canAnimate: false,
size,
canWebP: false
});
if (r16 == null) {
r16 = _AvatarUtils.default.DEFAULT_GROUP_DM_AVATARS[SnowflakeUtils.extractTimestamp(id) % _AvatarUtils.default.DEFAULT_GROUP_DM_AVATARS.length];
}
}
return r16;
};
_getAssetHash = function _getAssetHash(a0) {
let r14;
try {
r14 = parse(a0).pathname.split("/").pop();
} catch ($e) {
return null;
}
return r14;
};
c1171_6 = /^data:/;
DEFAULT_AVATARS = _AvatarUtils.default.DEFAULT_AVATARS;
let DEFAULT_AVATARS_SMALL2 = _AvatarUtils.default.DEFAULT_AVATARS_SMALL;
if (DEFAULT_AVATARS_SMALL2 == null) {
DEFAULT_AVATARS_SMALL2 = DEFAULT_AVATARS;
}
DEFAULT_AVATARS_SMALL = DEFAULT_AVATARS_SMALL2;
let DEFAULT_AVATARS_SMALL_MAX_SIZE2 = _AvatarUtils.default.DEFAULT_AVATARS_SMALL_MAX_SIZE;
if (DEFAULT_AVATARS_SMALL_MAX_SIZE2 == null) {
DEFAULT_AVATARS_SMALL_MAX_SIZE2 = 0;
}
export function getEmojiURL({ id, animated, size, forcePNG = false }) {
let enabled;
let r3 = "png";
let r11 = "png";
if (!forcePNG) {
if (animated) {
r3 = canUseWebp ? "webp" : "gif";
} else if (canUseWebp) {
r3 = "webp";
}
r11 = r3;
}
const r9 = canUseWebp ? animated ? "&animated=true" : "" : "";
const r43 = `size=${getBestMediaProxySize(size * getDevicePixelRatio(), isAndroid)}`;
try {
enabled = (0, getForceSdrEmojisStickersConfig)({
location: "getEmojiURL"
}).enabled;
} catch ($e) {}
const r53 = enabled ? "&force_sdr=true" : "";
if (window.GLOBAL_ENV.CDN_HOST != null) {
return `${location.protocol}//${window.GLOBAL_ENV.CDN_HOST}/emojis/${id}.${r11}?${r43}${r9}${r53}`;
}
const r67 = location.protocol + window.GLOBAL_ENV.API_ENDPOINT + Endpoints.EMOJI(id, r11);
return enabled ? `${r67}?force_sdr=true` : r67;
}
export function getGuildMemberAvatarURL(a0) {
const { userId: userId2, avatar, guildId } = a0;
let canAnimate = arguments[1];
if (canAnimate === void 0) {
canAnimate = false;
}
return avatar != null ? getGuildMemberAvatarURLSimple({
userId: userId2,
avatar,
guildId,
canAnimate
}) : null;
}
export function getGuildMemberAvatarSource(a0, a1, r7 = false) {
let r16;
const { userId: userId2, avatar, guildId } = a0;
let canAnimate = r7;
if (canAnimate === void 0) {
canAnimate = false;
}
const r5 = avatar == null ? null : getGuildMemberAvatarURLSimple({
userId: userId2,
avatar,
guildId,
canAnimate
});
if (r5 != null) {
let r17 = r5;
if (typeof r17 !== "number") {
r17 = {
uri: r5 == null ? void 0 : r5
};
}
r16 = r17;
} else {
r16 = a1.getAvatarSource(a0.guildId, r7);
}
return r16;
}
export function getUserBannerURL({ id, banner, canAnimate, size }) {
if (banner != null) {
const CDN_HOST = window.GLOBAL_ENV.CDN_HOST;
const r9 = canAnimate ? banner != null && banner.startsWith("a_") ? canUseWebp ? "webp" : "gif" : "png" : "png";
const r38 = CDN_HOST != null ? `https://${CDN_HOST}/banners/${id}/${banner}.${r9}` : location.protocol + window.GLOBAL_ENV.API_ENDPOINT + Endpoints.USER_BANNER(id, banner, r9);
const r51 = {
size: getBestMediaProxySize(size * getDevicePixelRatio())
};
if (r9 === "webp" && canAnimate && (banner != null && banner.startsWith("a_"))) {
r51.animated = true;
}
return r38 + `?${Module1464.stringify(r51)}`;
}
}
export function getAvatarDecorationURL({ avatarDecoration, size = AVATAR_DECORATION_SIZE, canAnimate = false }) {
let r32;
if (avatarDecoration != null && !isAvatarDecorationExpired(avatarDecoration)) {
L16: {
try {
const CollectiblesItemAssetFormat = _CollectiblesAssetUtils.CollectiblesItemAssetFormat;
const collectiblesItemAssetUrl = getCollectiblesItemAssetUrl({
skuId: avatarDecoration.skuId,
assetFormat: canAnimate ? CollectiblesItemAssetFormat.ANIMATED : CollectiblesItemAssetFormat.STATIC
});
r32 = collectiblesItemAssetUrl;
if (collectiblesItemAssetUrl != null) {
break L16;
}
} catch ($e) {
return null;
}
const asset = avatarDecoration.asset;
if (asset == null) {
return null;
}
const GLOBAL_ENV = window.GLOBAL_ENV;
const { CDN_HOST, API_ENDPOINT } = GLOBAL_ENV;
const r10 = Endpoints.AVATAR_DECORATION_PRESETS(asset);
const r47 = CDN_HOST != null ? new URL(`https://${CDN_HOST}${r10}`) : new URL(`${location.protocol}${API_ENDPOINT}${r10}`);
r47.searchParams.set("size", `${getBestMediaProxySize(size * getDevicePixelRatio(), isAndroid)}`);
r47.searchParams.set("passthrough", `${canAnimate}`);
return r47.toString();
}
return r32;
}
return null;
}
export function getGuildMemberBannerURL({ id, guildId, banner, canAnimate, size }) {
if (banner != null && guildId != null) {
const CDN_HOST = window.GLOBAL_ENV.CDN_HOST;
const r22 = canAnimate ? banner != null && banner.startsWith("a_") ? canUseWebp ? "webp" : "gif" : "png" : "png";
const r27 = Endpoints.GUILD_MEMBER_BANNER(guildId, id, banner, r22);
const r35 = CDN_HOST != null ? `https://${CDN_HOST}${r27}` : location.protocol + window.GLOBAL_ENV.API_ENDPOINT + r27;
const r51 = {
size: getBestMediaProxySize(size * getDevicePixelRatio())
};
if (r22 === "webp" && canAnimate && (banner != null && banner.startsWith("a_"))) {
r51.animated = true;
}
return r35 + `?${Module1464.stringify(r51)}`;
}
}
const getGuildSplashURL = function getGuildSplashURL(a0) {
const { id, splash } = a0;
let size = a0.size;
if (splash == null) {
return null;
}
if (size == null) {
size = window.screen.width * getDevicePixelRatio();
}
const bestMediaProxySize = getBestMediaProxySize(size);
const CDN_HOST = window.GLOBAL_ENV.CDN_HOST;
return (CDN_HOST != null ? `https://${CDN_HOST}/splashes/${id}/${splash}.jpg` : location.protocol + window.GLOBAL_ENV.API_ENDPOINT + Endpoints.GUILD_SPLASH(id, splash)) + `?size=${bestMediaProxySize}`;
};
const getGuildHomeHeaderURL = function getGuildHomeHeaderURL({ id, homeHeader }) {
if (homeHeader == null) {
return null;
}
const bestMediaProxySize = getBestMediaProxySize(1096 * getDevicePixelRatio());
const CDN_HOST = window.GLOBAL_ENV.CDN_HOST;
return (CDN_HOST != null ? `https://${CDN_HOST}/home-headers/${id}/${homeHeader}.png` : location.protocol + window.GLOBAL_ENV.API_ENDPOINT + Endpoints.GUILD_HOME_HEADER(id, homeHeader)) + `?size=${bestMediaProxySize}`;
};
export function getResourceChannelIconURL({ channelId, icon }) {
return icon != null ? getAvatarURL({
endpoint: Endpoints.GUILD_RESOURCE_CHANNELS_ICON,
path: "resource-channels",
id: channelId,
hash: icon,
size: AVATAR_SIZE,
canAnimate: true,
canWebP: false
}) : null;
}
export function getNewMemberActionIconURL({ channelId, icon }) {
return icon != null ? getAvatarURL({
endpoint: Endpoints.GUILD_NEW_MEMBER_ACTIONS_ICON,
path: "new-member-actions",
id: channelId,
hash: icon,
size: AVATAR_SIZE,
canAnimate: true,
canWebP: false
}) : null;
}
const getGuildDiscoverySplashURL = function getGuildDiscoverySplashURL(a0) {
const { id, splash } = a0;
let size = a0.size;
if (splash == null) {
return null;
}
if (size == null) {
size = window.screen.width * getDevicePixelRatio();
}
const bestMediaProxySize = getBestMediaProxySize(size);
const CDN_HOST = window.GLOBAL_ENV.CDN_HOST;
return (CDN_HOST != null ? `https://${CDN_HOST}/discovery-splashes/${id}/${splash}.jpg` : location.protocol + window.GLOBAL_ENV.API_ENDPOINT + Endpoints.GUILD_DISCOVERY_SPLASH(id, splash)) + `?size=${bestMediaProxySize}`;
};
const getGuildIconURL = function getGuildIconURL({ id, icon, size, canAnimate = false, lossless = false }) {
return getAvatarURL({
endpoint: Endpoints.GUILD_ICON,
path: "icons",
id,
hash: icon,
size,
canAnimate,
lossless,
canWebP: canUseWebp
});
};
export function getGuildTemplateIconURL({ id, icon, size = AVATAR_SIZE, canAnimate = false }) {
return getAvatarURL({
endpoint: Endpoints.GUILD_TEMPLATE_ICON,
path: "guild-templates",
id,
hash: icon,
size,
canAnimate,
canWebP: false
});
}
const getGameAssetURL = function getGameAssetURL(a0) {
const { id, hash, size = AVATAR_SIZE, keepAspectRatio = false } = a0;
return getAvatarURL({
endpoint: Endpoints.APPLICATION_ICON,
path: "app-icons",
id,
hash,
size,
canAnimate: false,
keepAspectRatio,
format: a0.format,
canWebP: false
});
};
export function getVideoFilterAssetURL({ userId, assetId, assetHash, size, canAnimate = true }) {
return getAvatarURL({
endpoint: (a0, a1, a2) => Endpoints.VIDEO_FILTER_ASSET_STORAGE(userId, assetId, assetHash, a2),
path: `video-filter-assets/${userId}`,
id: assetId,
hash: assetHash,
size,
canAnimate,
canWebP: false
});
}
export function hasAnimatedGuildIcon(a0) {
const icon = a0?.icon;
return icon != null && icon.startsWith("a_");
}
export function isAnimatedIconHash(a0) {
return a0 != null && a0.startsWith("a_");
}
export function isVideoAssetHash(a0) {
return a0 != null && a0.startsWith("v_");
}
export function makeSource(a0) {
return typeof a0 !== "number" ? {
uri: a0 == null ? void 0 : a0
} : a0;
}
export function isDataUri(a0) {
return a0 != null && c1171_6.test(a0);
}
DEFAULT_AVATARS_SMALL_MAX_SIZE = DEFAULT_AVATARS_SMALL_MAX_SIZE2;
DEFAULT_PROVISIONAL_AVATARS = _AvatarUtils.default.DEFAULT_PROVISIONAL_AVATARS;
export const DEFAULT_GROUP_DM_AVATARS = _AvatarUtils.default.DEFAULT_GROUP_DM_AVATARS;
canUseWebp = _AvatarUtils.default.canUseWebp();
isAndroid = _PlatformUtils.isAndroid();
const r80 = {
getUserAvatarURL,
getDefaultAvatarURL,
getGuildMemberAvatarURL,
getGuildMemberAvatarURLSimple,
getGuildMemberAvatarSource,
getGuildMemberBannerURL,
getUserBannerURL,
getAvatarDecorationURL,
hasAnimatedGuildIcon,
isAnimatedIconHash,
getUserAvatarSource: (a0, a1, a2) => {
const userAvatarURL = getUserAvatarURL(a0, a1, a2);
let r8 = userAvatarURL;
if (typeof r8 !== "number") {
r8 = {
uri: userAvatarURL == null ? void 0 : userAvatarURL
};
}
return r8;
},
getGuildIconURL,
getGuildSplashURL,
getGuildSplashSource: function getGuildSplashSource(a0) {
const { id, splash } = a0;
let size = a0.size;
const r0 = splash == null;
let r3 = null;
if (!r0) {
if (size == null) {
size = window.screen.width * getDevicePixelRatio();
}
const bestMediaProxySize = getBestMediaProxySize(size);
const CDN_HOST = window.GLOBAL_ENV.CDN_HOST;
r3 = (CDN_HOST != null ? `https://${CDN_HOST}/splashes/${id}/${splash}.jpg` : location.protocol + window.GLOBAL_ENV.API_ENDPOINT + Endpoints.GUILD_SPLASH(id, splash)) + `?size=${bestMediaProxySize}`;
}
let r55 = r3;
if (typeof r55 !== "number") {
r55 = {
uri: r3 == null ? void 0 : r3
};
}
return r55;
},
getGuildDiscoverySplashURL,
getGuildDiscoverySplashSource: function getGuildDiscoverySplashSource(a0) {
const { id, splash } = a0;
let size = a0.size;
const r0 = splash == null;
let r3 = null;
if (!r0) {
if (size == null) {
size = window.screen.width * getDevicePixelRatio();
}
const bestMediaProxySize = getBestMediaProxySize(size);
const CDN_HOST = window.GLOBAL_ENV.CDN_HOST;
r3 = (CDN_HOST != null ? `https://${CDN_HOST}/discovery-splashes/${id}/${splash}.jpg` : location.protocol + window.GLOBAL_ENV.API_ENDPOINT + Endpoints.GUILD_DISCOVERY_SPLASH(id, splash)) + `?size=${bestMediaProxySize}`;
}
let r55 = r3;
if (typeof r55 !== "number") {
r55 = {
uri: r3 == null ? void 0 : r3
};
}
return r55;
},
getGuildBannerURL,
getGuildHomeHeaderURL,
getResourceChannelIconURL,
getNewMemberActionIconURL,
getGuildTemplateIconURL,
getChannelIconURL,
getEmojiURL,
getApplicationIconURL,
getGameAssetURL,
getVideoFilterAssetURL,
getGameAssetSource: (a0) => {
const { id, hash, size = AVATAR_SIZE, keepAspectRatio = false } = a0;
const avatarURL = getAvatarURL({
endpoint: Endpoints.APPLICATION_ICON,
path: "app-icons",
id,
hash,
size,
canAnimate: false,
keepAspectRatio,
format: a0.format,
canWebP: false
});
let r15 = avatarURL;
if (typeof r15 !== "number") {
r15 = {
uri: avatarURL == null ? void 0 : avatarURL
};
}
return r15;
},
getGuildIconSource: ({ id, icon, size, canAnimate = false, lossless = false }) => {
const avatarURL = getAvatarURL({
endpoint: Endpoints.GUILD_ICON,
path: "icons",
id,
hash: icon,
size,
canAnimate,
lossless,
canWebP: canUseWebp
});
let r16 = avatarURL;
if (typeof r16 !== "number") {
r16 = {
uri: avatarURL == null ? void 0 : avatarURL
};
}
return r16;
},
getGuildTemplateIconSource: ({ id, icon, size = AVATAR_SIZE, canAnimate = false }) => {
const avatarURL = getAvatarURL({
endpoint: Endpoints.GUILD_TEMPLATE_ICON,
path: "guild-templates",
id,
hash: icon,
size,
canAnimate,
canWebP: false
});
let r14 = avatarURL;
if (typeof r14 !== "number") {
r14 = {
uri: avatarURL == null ? void 0 : avatarURL
};
}
return r14;
},
getGuildBannerSource: function getGuildBannerSource(a0, r4 = false) {
const guildBannerURL = getGuildBannerURL(a0, r4);
let r7 = guildBannerURL;
if (typeof r7 !== "number") {
r7 = {
uri: guildBannerURL == null ? void 0 : guildBannerURL
};
}
return r7;
},
getGuildHomeHeaderSource: ({ id, homeHeader }) => {
const r1 = homeHeader == null;
let r4 = null;
if (!r1) {
const bestMediaProxySize = getBestMediaProxySize(1096 * getDevicePixelRatio());
const CDN_HOST = window.GLOBAL_ENV.CDN_HOST;
r4 = (CDN_HOST != null ? `https://${CDN_HOST}/home-headers/${id}/${homeHeader}.png` : location.protocol + window.GLOBAL_ENV.API_ENDPOINT + Endpoints.GUILD_HOME_HEADER(id, homeHeader)) + `?size=${bestMediaProxySize}`;
}
let r49 = r4;
if (typeof r49 !== "number") {
r49 = {
uri: r4 == null ? void 0 : r4
};
}
return r49;
},
getChannelIconSource: (a0) => {
const channelIconURL = getChannelIconURL(a0);
let r7 = channelIconURL;
if (typeof r7 !== "number") {
r7 = {
uri: channelIconURL == null ? void 0 : channelIconURL
};
}
return r7;
},
getApplicationIconSource: (a0) => {
const applicationIconURL = getApplicationIconURL(a0);
let r7 = applicationIconURL;
if (typeof r7 !== "number") {
r7 = {
uri: applicationIconURL == null ? void 0 : applicationIconURL
};
}
return r7;
},
makeSource,
getAnimatableSourceWithFallback: (a0, a1) => {
const r4 = a1(a0);
if (_PlatformUtils.isAndroid() && a0 && typeof r4 !== "number") {
const r14 = a1(false);
return typeof r14 !== "number" ? r14.uri !== r4.uri ? [r4, {
...r14,
isForceCached: true
}] : r14 : [r4, {
...r14,
isForceCached: true
}];
}
return r4;
}
};
export default r80;
export { c1171_6 as DATA_IMAGE_PREFIX };
export { DEFAULT_AVATARS };
export { DEFAULT_AVATARS_SMALL };
export { DEFAULT_AVATARS_SMALL_MAX_SIZE };
export { DEFAULT_PROVISIONAL_AVATARS };
export { canUseWebp as SUPPORTS_WEBP };
export const LEGACY_DEFAULT_AVATAR_COUNT = 5;
export const DEFAULT_AVATAR_COUNT = 6;
export { getDefaultAvatarURL };
export { getUserAvatarURL };
export { getGuildMemberAvatarURLSimple };
export function isAnimatedImageURL(a0) {
let r2 = a0 != null;
if (r2) {
const r6 = _getAssetHash(a0);
r2 = r6 != null && r6.startsWith("a_");
}
return r2;
}
export function isVideoURL(a0) {
let r2 = a0 != null;
if (r2) {
const r6 = _getAssetHash(a0);
r2 = r6 != null && r6.startsWith("v_");
}
return r2;
}
+23
View File
@@ -0,0 +1,23 @@
// Metro module 3825 (f3826).
import { asUintN, deserialize } from "../_bundle/HighLow";
class BasicPermissionUtils {
static cache = {};
constructor() {
return {
__proto__: new.target.prototype
};
}
static has(a0, a1) {
return !!(a0 & a1);
}
static asBasicFlag(a0) {
return asUintN(20, a0);
}
static asBigFlag(a0) {
if (!Object.hasOwn(this.cache, a0)) {
this.cache[a0] = deserialize(a0);
}
return this.cache[a0];
}
}
export default BasicPermissionUtils;
+84
View File
@@ -0,0 +1,84 @@
// Metro module 3850 (f3851).
import { PaymentGateways } from "../_bundle/Module505";
import { collectDeviceData } from "./BraintreeUtils";
import SentryUtils_native from "./SentryUtils.native";
import { HTTPResponseError } from "../_bundle/sendRequest";
import BillingError from "../errors/BillingError";
export function getLocalizedDisplayMonth(a0, a1) {
const date = new Date();
date.setMonth(a0 - 1);
return date.toLocaleString(a1, {
month: "short"
});
}
export async function createGatewayCheckoutContext(c24739_0) {
let r24, r53;
let c29051_1, c29051_0;
L15: {
L14: {
c29051_1 = void 0;
c29051_0 = null;
if (c24739_0 != null && c24739_0.paymentGateway === PaymentGateways.BRAINTREE) {
c29051_1 = await collectDeviceData();
if (c29051_1 != null) {
c29051_0 = {
braintree_device_data: c29051_1
};
}
r53 = c29051_0;
break L14;
}
r24 = c29051_0;
break L15;
}
return r53;
}
return r24;
}
export function captureBillingException(a0, a1) {
SentryUtils_native.captureException(a0, {
...a1,
tags: {
...a1?.tags,
app_context: "billing"
}
});
}
export function isExpectedHttpClientError(a0) {
return a0 instanceof HTTPResponseError && a0.status >= 400 && a0.status < 500 || a0 instanceof BillingError && a0.status != null && a0.status >= 400 && a0.status < 500;
}
export function captureBillingMessage(a0, a1) {
SentryUtils_native.captureMessage(a0, {
...a1,
tags: {
...a1?.tags,
app_context: "billing"
}
});
}
export function calculateStandardizedUnits(a0, a1) {
let r1 = a0 === "P1M";
if ((r1 ? a1 === "P1Y" : r1) === true) {
return 12;
}
if ((r1 ? a1 === "P6M" : r1) === true) {
return 6;
}
if (r1) {
r1 = a1 === "P3M";
}
if (r1 === true) {
return 3;
}
let r13 = a0 === "P3M";
if ((r13 ? a1 === "P1Y" : r13) === true) {
return 4;
}
if (r13) {
r13 = a1 === "P6M";
}
if (r13 !== true && (a0 === "P6M" && a1 === "P1Y") !== true) {
return 1;
}
return 2;
}
+50
View File
@@ -0,0 +1,50 @@
// Metro module 3851 (f3852).
import BraintreeStore from "../stores/billing/BraintreeStore";
import { PaymentSettings } from "../Constants";
import { importWithRetry } from "../modules/core/CodeSplittingUtils";
function $mk72881() {
return (a0) => a0.default;
}
function $mk72882($env) {
return (a0) => a0.dataCollector.create({
client: $env[0]
}).then((result) => result.deviceData).catch(() => null);
}
let $mk72880 = function() {
return () => import("../_bundle/Module3856");
};
export function getBraintreeSDK() {
return importWithRetry({
createPromise: $mk72880(),
webpackId: dependencyMap[5]
}).then($mk72881());
}
export function collectDeviceData() {
let r21;
const client = BraintreeStore.getClient();
if (client == null) {
r21 = importWithRetry({
createPromise: $mk72880(),
webpackId: dependencyMap[5]
}).then($mk72881()).then((result) => result.client.create({
authorization: PaymentSettings.BRAINTREE.KEY
}).then((result) => {
let env29052;
const r1 = env29052 = {};
env29052[0] = result;
return importWithRetry({
createPromise: $mk72880(),
webpackId: dependencyMap[5]
}).then($mk72881()).then($mk72882(r1));
}).catch(() => null));
} else {
let env13685;
const r9 = env13685 = {};
env13685[0] = client;
r21 = importWithRetry({
createPromise: $mk72880(),
webpackId: dependencyMap[5]
}).then($mk72881()).then($mk72882(r9));
}
return r21;
}
+97
View File
@@ -0,0 +1,97 @@
// Metro module 4507 (f4508).
import Module4508 from "../_bundle/Module4508";
let name = Module4508.name;
if (name == null) {
name = "unknown";
}
const r19 = name.toLowerCase();
const r21 = r19.toLowerCase();
let r13 = -1;
let r23 = -1;
if (r21 === "chrome") {
const r24 = parseInt;
let version = Module4508.version;
if (version == null) {
version = "";
}
r23 = r24(version, 10);
}
let c2718_4;
let c2718_0 = r23;
const r10 = r19.toLowerCase();
let r31 = -1;
if (r10 === "electron") {
const r32 = parseInt;
let version2 = Module4508.version;
if (version2 == null) {
version2 = "";
}
r31 = r32(version2, 10);
}
let c2718_1 = r31;
const r38 = r19.toLowerCase();
let r40 = -1;
if (r38 === "firefox") {
const r41 = parseInt;
let version3 = Module4508.version;
if (version3 == null) {
version3 = "";
}
r40 = r41(version3, 10);
}
let c2718_2 = r40;
const r47 = r19.toLowerCase();
let r49 = -1;
if (r47 === "edge") {
const r50 = parseInt;
let version4 = Module4508.version;
if (version4 == null) {
version4 = "";
}
r49 = r50(version4, 10);
}
let c2718_3 = r49;
if (r19.toLowerCase() === "safari") {
const r58 = parseInt;
let version5 = Module4508.version;
if (version5 == null) {
version5 = "";
}
r13 = r58(version5, 10);
}
export function getChromeVersion() {
return c2718_0;
}
export function getElectronVersion() {
return c2718_1;
}
export function getFirefoxVersion() {
return c2718_2;
}
export function getEdgeVersion() {
return c2718_3;
}
export function getSafariVersion() {
return c2718_4;
}
export function isSafari(r4 = navigator.userAgent) {
const r5 = r4.toLowerCase();
return r5.indexOf("safari") !== -1 && !(r5.indexOf("chrome") !== -1) && r5.indexOf("version/") !== -1;
}
c2718_4 = r13;
export function canUseWebp() {
return c2718_0 !== -1 || c2718_1 !== -1 || c2718_2 !== -1 || c2718_3 !== -1 || c2718_4 >= 14;
}
export function isFirefox(r3 = navigator.userAgent) {
return r3.toLowerCase().indexOf("firefox") !== -1;
}
export function supportsHEVCAlpha() {
const navigator2 = window.navigator;
const r9 = navigator2.mediaCapabilities?.decodingInfo != null;
let userAgent = navigator2.userAgent;
if (userAgent === void 0) {
userAgent = navigator.userAgent;
}
const r13 = userAgent.toLowerCase();
return r13.indexOf("safari") !== -1 && !(r13.indexOf("chrome") !== -1) && r13.indexOf("version/") !== -1 && r9;
}
+140
View File
@@ -0,0 +1,140 @@
// Metro module 7868 (f7869).
import Module3888 from "../_bundle/Module3888";
import { baseRules, customRules } from "./native/ChangeLogUtils";
import MarkupTextRule from "../modules/markup/MarkupTextRule";
import MarkupListRule from "../modules/markup/MarkupListRule";
import MarkupSubtextRule from "../modules/markup/MarkupSubtextRule";
import MarkupUtils from "../modules/markup/MarkupUtils";
import { HermesBuiltin } from "../_hermes/prelude";
function $mk79357($env) {
return (a0, a1, a2) => {
const r4 = $env.$parent;
const r9 = r4[10];
const r10 = r9.exec(a0[1]);
const r12 = a0[1].replace(r9, "");
const r14 = $env[0] ? r12.toUpperCase() : r12;
return {
className: r10 != null ? r10[1] : null,
level: a0[2] === "=" ? 1 : 2,
content: (0, r4[1])(r4[2][0]).parseInline(a1, r14, a2)
};
};
}
let lheading, heading, link, image, list, blockQuote, paragraph, c4969_10, c4969_11;
let env4969 = {};
const defaultRules = function defaultRules(a0) {
const r2 = {
...baseRules,
image: {
...image,
...typeof customRules.image === "function" ? customRules.image(a0) : customRules.image
},
link: {
...link,
...typeof customRules.link === "function" ? customRules.link(a0) : customRules.link
}
};
const list2 = {
...list
};
const r61 = typeof customRules.list === "function" ? customRules.list(a0) : customRules.list;
let env16056;
HermesBuiltin.copyDataProperties(list2, r61);
r2.list = list2;
r2.interpolation = {
order: MarkupTextRule.order,
match: (a0) => c4969_11.exec(a0),
parse: (a0, a1, a2) => {
const renderer = a2.interpolations[a0[1]];
return renderer == null ? {
type: "text",
content: a0[0]
} : {
type: "interpolation",
renderer
};
},
react: (a0) => a0.renderer()
};
const r81 = env16056 = {
$parent: env4969
};
env16056[0] = true;
r2.lheading = {
...lheading,
parse: $mk79357(r81),
...typeof customRules.lheading === "function" ? customRules.lheading(a0) : customRules.lheading
};
r2.heading = {
...heading,
...typeof customRules.heading === "function" ? customRules.heading(a0) : customRules.heading
};
r2.blockQuote = {
...blockQuote,
...typeof customRules.blockQuote === "function" ? customRules.blockQuote(a0) : customRules.blockQuote
};
r2.paragraph = {
...paragraph,
...typeof customRules.paragraph === "function" ? customRules.paragraph(a0) : customRules.paragraph
};
return r2;
};
lheading = Module3888.defaultRules.lheading;
heading = Module3888.defaultRules.heading;
link = Module3888.defaultRules.link;
image = Module3888.defaultRules.image;
list = Module3888.defaultRules.list;
blockQuote = Module3888.defaultRules.blockQuote;
paragraph = Module3888.defaultRules.paragraph;
c4969_10 = /\{(.+?)}/;
c4969_11 = /^\$(\w+?)\$/;
const r44 = {
getDefaultRules: function getDefaultRules(a0) {
return {
...defaultRules(a0)
};
},
getSpecialRules: (a0) => {
let env16057;
const r2 = {
...defaultRules(a0)
};
const r14 = env16057 = {
$parent: env4969
};
env16057[0] = false;
HermesBuiltin.copyDataProperties(r2, {
lheading: {
...lheading,
parse: $mk79357(r14),
...typeof customRules.lheading === "function" ? customRules.lheading(a0) : customRules.lheading
}
});
return r2;
},
getMessageRules: (a0) => {
const r2 = {};
HermesBuiltin.copyDataProperties(r2, {
...defaultRules(a0),
newline: {
...Module3888.defaultRules.newline
},
text: MarkupTextRule,
list: MarkupListRule,
subtext: MarkupSubtextRule
});
return r2;
}
};
export default r44;
export function renderChangelogMessageMarkup(a0, a1, a2) {
return {
hasSpoilerEmbeds: false,
hasBailedAst: false,
content: MarkupUtils.reactParserFor({
...defaultRules(a1)
})(a0.content, false, a2 != null ? {
changeLog: a2
} : {})
};
}
+539
View File
@@ -0,0 +1,539 @@
// Metro module 16438 (f16439).
import { isGuildSelectableChannelType, isGuildVocalChannelType } from "../records/ChannelRecord";
import { ChannelTypes } from "../Constants";
import DragAndDropUtils from "./DragAndDropUtils";
import getFlattedChannelList from "../modules/channel/getFlattedChannelList";
function $mk99631($env) {
return (a0) => {
const r2 = $env;
const type2 = a0.channel.type;
const r3 = r2[0];
let r11 = r3 != null;
if (r11) {
let r12 = r2[1];
if (!r12) {
const type = r3.type;
let r13 = type != null && type2 != null;
if (r13) {
const r6 = $env.$parent;
let r4 = type === type2;
if (!r4) {
const r9 = r6[2];
r4 = r9(type) && r9(type2);
}
if (!r4) {
const r15 = r6[3];
r4 = r15(type) && r15(type2);
}
r13 = r4;
}
r12 = r13;
}
r11 = r12;
}
return r11;
};
}
function $mk99632($env) {
return (a0, a1) => {
const r3 = $env;
const id = a0.channel.id;
const r6 = r3[0];
let r7 = r6 != null && id === r6.id;
if (r7) {
r3[2] = a1;
r7 = true;
}
return r7;
};
}
let env11826 = {};
const getFirstChannelOfType = function getFirstChannelOfType(a0, c23164_0, a2, a3) {
let length;
let c23164_1 = -1;
a3.find((item, index) => {
let r0 = item.channel.id === c23164_0;
if (r0) {
c23164_1 = index;
r0 = true;
}
return r0;
});
if (c23164_1 < 0) {
return null;
}
let r20 = c23164_1;
if (r20 >= 0 && r20 < a3.length) {
do {
const r22 = a3[r20];
const type = r22.channel.type;
let r11 = type != null;
const r24 = r20;
if (r11) {
r11 = a2 != null;
}
if (r11) {
r11 = type === a2 || isGuildSelectableChannelType(type) && isGuildSelectableChannelType(a2) || isGuildVocalChannelType(type) && isGuildVocalChannelType(a2);
}
if (r11) {
return r22;
}
const r27 = r24 + a0;
if (!(r27 >= 0)) {
break;
}
length = a3.length;
r20 = r27;
} while (r20 < length);
}
return null;
};
export function areTypesInSameSection(a0, a1) {
return a0 != null && a1 != null && (a0 === a1 || isGuildSelectableChannelType(a0) && isGuildSelectableChannelType(a1) || isGuildVocalChannelType(a0) && isGuildVocalChannelType(a1));
}
export function getDropData(a0, a1, a2, a3, a4) {
let r49, r60, r97, r153, r158, r190, r228;
if (a0 != null && a2 != null) {
L127: {
const GUILD_CATEGORY = ChannelTypes.GUILD_CATEGORY;
if (a0.type === GUILD_CATEGORY) {
L126: {
L125: {
if (a3 !== a1) {
if (a3 < a1 && a0.type === a2.type) {
break L125;
}
const r227 = a3 > a1;
r228 = null;
if (!r227) {
break L126;
}
let env23169;
const GUILD_CATEGORY2 = ChannelTypes.GUILD_CATEGORY;
const r230 = env23169 = {
$parent: env11826
};
env23169[0] = a2;
env23169[1] = true;
env23169[2] = void 0;
const r233 = a2 == null;
let r234 = 0;
if (!r233) {
env23169[2] = null;
a4.filter($mk99631(r230)).find($mk99632(r230));
r234 = env23169[2];
}
if (r234 == null) {
r234 = 0;
}
const r243 = a4[r234 + 1];
const firstChannelOfType5 = getFirstChannelOfType(-1, a2.id, a0.type, a4);
r228 = firstChannelOfType5 == null ? null : firstChannelOfType5.channel.id !== a0.id ? r243 != null ? r243.channel.type === GUILD_CATEGORY2 ? {
referenceId: firstChannelOfType5.channel.id,
parentId: null
} : null : {
referenceId: firstChannelOfType5.channel.id,
parentId: null
} : null;
break L126;
}
}
r228 = {
referenceId: a2.id,
parentId: a2.parent_id
};
}
r49 = r228;
} else {
const type = a0.type;
const type2 = a2.type;
if (type != null && type2 != null && (type === type2 || isGuildSelectableChannelType(type) && isGuildSelectableChannelType(type2) || isGuildVocalChannelType(type) && isGuildVocalChannelType(type2))) {
r49 = {
referenceId: a2.id,
parentId: a2.parent_id
};
} else if (a3 < a1) {
L105: {
if (a2.type === GUILD_CATEGORY) {
let env23168;
const r169 = env23168 = {
$parent: env11826
};
env23168[0] = a2;
env23168[1] = true;
const r171 = a2 == null;
let r172 = 0;
if (!r171) {
env23168[2] = null;
a4.filter($mk99631(r169)).find($mk99632(r169));
r172 = env23168[2];
}
if (r172 == null) {
r172 = 0;
}
L104: {
const r181 = a4[r172 - 1];
const firstChannelOfType4 = getFirstChannelOfType(1, a2.id, a0.type, a4);
if (r181 == null) {
r190 = {
referenceId: null,
parentId: null
};
} else {
const r189 = firstChannelOfType4 != null;
r190 = null;
if (r189) {
const type5 = r181.channel.type;
const type6 = a0.type;
const r194 = type5 != null && type6 != null && (type5 === type6 || isGuildSelectableChannelType(type5) && isGuildSelectableChannelType(type6) || isGuildVocalChannelType(type5) && isGuildVocalChannelType(type6));
L102: {
if (!r194) {
if (a0.isGuildVocal() && (0, isGuildSelectableChannelType)(r181.channel.type)) {
break L102;
}
const isCategory5 = r181.channel.isCategory();
r190 = null;
if (!isCategory5) {
break L104;
}
r190 = {
referenceId: firstChannelOfType4.channel.id,
parentId: r181.channel.id
};
break L104;
}
}
r190 = {
referenceId: firstChannelOfType4.channel.id,
parentId: r181.channel.parent_id
};
}
}
}
r153 = r190;
} else {
let env23167;
const r129 = env23167 = {
$parent: env11826
};
env23167[0] = a2;
env23167[1] = true;
const r131 = a2 == null;
let r132 = 0;
if (!r131) {
env23167[2] = null;
a4.filter($mk99631(r129)).find($mk99632(r129));
r132 = env23167[2];
}
if (r132 == null) {
r132 = 0;
}
const r140 = a4[r132 - 1];
const firstChannelOfType3 = getFirstChannelOfType(1, a2.id, a0.type, a4);
if (r140 == null && !a0.isGuildVocal()) {
r153 = {
referenceId: firstChannelOfType3 != null ? firstChannelOfType3.channel.id : null,
parentId: null
};
break L105;
}
L77: {
const isGuildSelectableChannelType2 = isGuildSelectableChannelType(a0.type);
r158 = null;
if (isGuildSelectableChannelType2) {
const r5 = firstChannelOfType3 != null;
r158 = null;
if (r5) {
if (!isGuildSelectableChannelType(r140.channel.type)) {
const isCategory4 = r140.channel.isCategory();
r158 = null;
if (!isCategory4) {
break L77;
}
}
r158 = {
referenceId: firstChannelOfType3.channel.id,
parentId: a2.parent_id
};
}
}
}
r153 = r158;
}
}
r49 = r153;
} else if (a2.type === GUILD_CATEGORY) {
let env23166;
const r76 = env23166 = {
$parent: env11826
};
env23166[0] = a2;
env23166[1] = true;
const r78 = a2 == null;
let r79 = 0;
if (!r78) {
env23166[2] = null;
a4.filter($mk99631(r76)).find($mk99632(r76));
r79 = env23166[2];
}
if (r79 == null) {
r79 = 0;
}
L60: {
const r88 = a4[r79 + 1];
const firstChannelOfType2 = getFirstChannelOfType(-1, a2.id, a0.type, a4);
const r96 = firstChannelOfType2 != null;
r97 = null;
if (r96) {
if (r88 == null) {
r97 = {
referenceId: firstChannelOfType2.channel.id,
parentId: a2.id
};
} else {
const type3 = r88.channel.type;
const type4 = a0.type;
const r99 = type3 != null && type4 != null && (type3 === type4 || isGuildSelectableChannelType(type3) && isGuildSelectableChannelType(type4) || isGuildVocalChannelType(type3) && isGuildVocalChannelType(type4));
L58: {
if (!r99) {
if ((0, isGuildSelectableChannelType)(a0.type) && r88.channel.isGuildVocal()) {
break L58;
}
const isCategory3 = r88.channel.isCategory();
r97 = null;
if (!isCategory3) {
break L60;
}
r97 = {
referenceId: firstChannelOfType2.channel.id,
parentId: a2.id
};
break L60;
}
}
r97 = {
referenceId: firstChannelOfType2.channel.id,
parentId: r88.channel.parent_id
};
}
}
}
r49 = r97;
} else {
let env23165;
const r34 = env23165 = {
$parent: env11826
};
env23165[0] = a2;
env23165[1] = true;
const r36 = a2 == null;
let r37 = 0;
if (!r36) {
env23165[2] = null;
a4.filter($mk99631(r34)).find($mk99632(r34));
r37 = env23165[2];
}
if (r37 == null) {
r37 = 0;
}
const r45 = a4[r37 + 1];
const firstChannelOfType = getFirstChannelOfType(-1, a2.id, a0.type, a4);
const r48 = firstChannelOfType == null;
r49 = null;
if (!r48) {
L27: {
if (a0.isGuildVocal()) {
if (r45 != null && !r45.channel.isCategory()) {
if (r45.channel.isGuildVocal()) {
r49 = {
referenceId: firstChannelOfType.channel.id,
parentId: r45.channel.parent_id
};
break L127;
}
break L27;
}
r49 = {
referenceId: firstChannelOfType.channel.id,
parentId: a2.parent_id
};
break L127;
}
}
L31: {
const isCategory = a0.isCategory();
r60 = null;
if (isCategory) {
if (r45 != null) {
const isCategory2 = r45.channel.isCategory();
r60 = null;
if (!isCategory2) {
break L31;
}
}
r60 = {
referenceId: firstChannelOfType.channel.id,
parentId: null
};
}
}
r49 = r60;
}
}
}
}
return r49;
}
return null;
}
export function getDnDUpdates(a0, a1, a2, a3) {
let c23170_2, c23170_3, c23170_4;
let c23170_0 = a0;
const parent_id = a2;
const generateUpdates = function generateUpdates(a0) {
let newOrdering;
L13: {
if (c23170_2 != null) {
if (c23170_3 != null) {
if (c23170_2 != null && c23170_3 != null && a0[c23170_2] != null && a0[c23170_2].channel === c23170_0 && a0[c23170_3] != null) {
newOrdering = DragAndDropUtils.moveItemFromTo(a0, c23170_2, c23170_3);
break L13;
}
}
}
newOrdering = [...a0];
}
c23170_4 = c23170_4.concat(DragAndDropUtils.calculatePositionDeltas({
oldOrdering: a0,
newOrdering,
idGetter: (a0) => a0.channel.id,
existingPositionGetter: (a0) => a0.channel.position
}));
return newOrdering;
};
c23170_4 = [];
let r24 = [];
let _categories = a3._categories;
if (a0.isCategory()) {
let env23171;
const r28 = [..._categories].slice(1);
const r16 = env23171 = {
$parent: env11826
};
env23171[0] = a0;
env23171[1] = false;
env23171[2] = void 0;
const r5 = a0 == null;
let r29 = 0;
if (!r5) {
env23171[2] = null;
r28.filter($mk99631(r16)).find($mk99632(r16));
r29 = env23171[2];
}
let env23172;
c23170_2 = r29;
const r33 = env23172 = {
$parent: env11826
};
env23172[0] = a1;
env23172[1] = false;
env23172[2] = void 0;
const r34 = a1 == null;
let r35 = 0;
if (!r34) {
env23172[2] = null;
r28.filter($mk99631(r33)).find($mk99632(r33));
r35 = env23172[2];
}
c23170_3 = r35;
const r42 = generateUpdates(r28);
r42.unshift(_categories[0]);
r24 = r42;
}
if (!(!(0, isGuildSelectableChannelType)(a0.type) && !a0.isCategory())) {
const r59 = r24.length > 0 ? r24 : _categories;
let env23173;
const flattedChannelList = getFlattedChannelList(r59, a3, (a0) => (0, isGuildSelectableChannelType)(a0.channel.type));
const r62 = env23173 = {
$parent: env11826
};
env23173[0] = a0;
env23173[1] = false;
env23173[2] = void 0;
const r65 = a0 == null;
let r66 = 0;
if (!r65) {
env23173[2] = null;
flattedChannelList.filter($mk99631(r62)).find($mk99632(r62));
r66 = env23173[2];
}
let env23174;
c23170_2 = r66;
const r72 = env23174 = {
$parent: env11826
};
env23174[0] = a1;
env23174[1] = false;
env23174[2] = void 0;
const r73 = a1 == null;
let r74 = 0;
if (!r73) {
env23174[2] = null;
flattedChannelList.filter($mk99631(r72)).find($mk99632(r72));
r74 = env23174[2];
}
c23170_3 = r74;
generateUpdates(flattedChannelList);
}
if (!(!a0.isGuildVocal() && !a0.isCategory())) {
if (r24.length > 0) {
_categories = r24;
}
let env23175;
const flattedChannelList2 = getFlattedChannelList(_categories, a3, (a0) => a0.channel.isGuildVocal());
const r94 = env23175 = {
$parent: env11826
};
env23175[0] = a0;
env23175[1] = false;
env23175[2] = void 0;
const r97 = a0 == null;
let r98 = 0;
if (!r97) {
env23175[2] = null;
flattedChannelList2.filter($mk99631(r94)).find($mk99632(r94));
r98 = env23175[2];
}
let env23176;
c23170_2 = r98;
const r105 = env23176 = {
$parent: env11826
};
env23176[0] = a1;
env23176[1] = false;
env23176[2] = void 0;
const r106 = a1 == null;
let r107 = 0;
if (!r106) {
env23176[2] = null;
flattedChannelList2.filter($mk99631(r105)).find($mk99632(r105));
r107 = env23176[2];
}
c23170_3 = r107;
generateUpdates(flattedChannelList2);
}
if (a0.parent_id !== a2 && c23170_4.find((item) => {
let r0 = item.id === c23170_0.id;
if (r0) {
item.parent_id = parent_id;
r0 = true;
}
return r0;
}) == null) {
c23170_4.push({
id: a0.id,
parent_id: a2
});
}
return c23170_4;
}
+304
View File
@@ -0,0 +1,304 @@
// Metro module 4372 (f4373).
import { isGuildSelectableChannelType, THREAD_CHANNEL_TYPES, TEXT_CHANNEL_TYPES } from "../records/ChannelRecord";
import ChannelStore from "../stores/ChannelStore";
import GuildChannelStore from "../stores/GuildChannelStore";
import PermissionStore from "../stores/PermissionStore";
import SelectedChannelStore from "../stores/SelectedChannelStore";
import SortedVoiceStateStore from "../stores/views/SortedVoiceStateStore";
import { Permissions, ChannelTypes, BITRATE_DEFAULT, BITRATE_MAX, GuildFeatures, BoostedGuildTiers, Routes, AnalyticsPages } from "../Constants";
import { BoostedGuildFeatures } from "../modules/premium/PremiumConstants";
import { NONE } from "./PermissionUtils";
import { add } from "../_bundle/HighLow";
import { PermissionOverwriteType } from "../flow/Server";
import { hasStream } from "../modules/guild_sidebar/ChannelListUtils";
import { getAudienceRequestToSpeakState, RequestToSpeakStates } from "../modules/stage_channels/useAudienceRequestToSpeakState";
import { intl, t } from "../intl/index.native";
import UserUtils from "./UserUtils";
import * as _MediaPostEmbedUtils from "../modules/media_channel/MediaPostEmbedUtils";
import SnowflakeUtils from "./SnowflakeUtils";
import sanitizeGuildTextChannelName from "../modules/channel/sanitizeGuildTextChannelName";
function $mk74367($env) {
return (a0) => {
const r1 = $env;
if (a0.id !== r1[1] && a0.id !== r1[0]) {
const r9 = r1[2][a0.id];
if (r9 != null) {
if (a0.isGuildStageVoice()) {
r9.forEach($mk103750(r1));
} else {
r9.forEach($mk103751(r1));
}
}
}
};
}
function $mk103750($env) {
return (a0) => {
const r1 = $env.$parent;
const r4 = r1[0];
const r7 = r1[3];
if (r4(r7[12]).getAudienceRequestToSpeakState(a0.voiceState) === r4(r7[12]).RequestToSpeakStates.ON_STAGE) {
$env[3].push(a0);
}
};
}
function $mk103751($env) {
return (a0) => $env[3].push(a0);
}
let GUILD_VOICE, GUILD_CATEGORY, GUILD_STAGE_VOICE;
let env2590 = {};
export function allowChannelAccess(a0, a1, a2) {
const r11 = (0, isGuildSelectableChannelType)(a1) || a1 === GUILD_CATEGORY ? add(NONE, Permissions.VIEW_CHANNEL) : NONE;
return {
id: a0,
type: a2,
deny: NONE,
allow: a1 === GUILD_VOICE || a1 === GUILD_CATEGORY || (a1 === GUILD_STAGE_VOICE || a1 === GUILD_CATEGORY) ? add(add(r11, Permissions.VIEW_CHANNEL), Permissions.CONNECT) : r11
};
}
const ChannelTypes2 = ChannelTypes;
GUILD_VOICE = ChannelTypes2.GUILD_VOICE;
GUILD_CATEGORY = ChannelTypes2.GUILD_CATEGORY;
GUILD_STAGE_VOICE = ChannelTypes2.GUILD_STAGE_VOICE;
export function denyChannelAccessForNonPaidUsers(a0, a1) {
if (a1 === ChannelTypes.GUILD_STAGE_VOICE) {
return {
id: a0,
type: PermissionOverwriteType.ROLE,
allow: NONE,
deny: add(NONE, Permissions.CONNECT)
};
}
throw new Error(`Premium channel feature not supported for channel type ${a1}`);
}
export function permissionOverwritesForRoles(a0, a1, a2) {
let r8 = arguments[3];
if (r8 === void 0) {
r8 = false;
}
const r4 = [];
let c14146_1 = r4;
if (a2.length > 0 || r8) {
const ROLE = PermissionOverwriteType.ROLE;
const r16 = (0, isGuildSelectableChannelType)(a1) || a1 === GUILD_CATEGORY ? add(NONE, Permissions.VIEW_CHANNEL) : NONE;
r4.push({
id: a0,
type: ROLE,
allow: NONE,
deny: a1 === GUILD_VOICE || a1 === GUILD_CATEGORY ? add(add(r16, Permissions.VIEW_CHANNEL), Permissions.CONNECT) : r16
});
}
a2.forEach((item) => {
c14146_1.push(allowChannelAccess(item, a1, PermissionOverwriteType.ROLE));
});
return r4;
}
export function permissionOverwriteForUser(a0, a1) {
return allowChannelAccess(a0, a1, PermissionOverwriteType.MEMBER);
}
export function permissionOverwriteForRole(a0, a1) {
return allowChannelAccess(a0, a1, PermissionOverwriteType.ROLE);
}
export function permissionOverwritesForAnnouncement(a0) {
return [{
id: a0,
type: PermissionOverwriteType.ROLE,
deny: Permissions.SEND_MESSAGES,
allow: NONE
}];
}
export function isChannelFull(a0, a1, a2) {
const guildId = a0.getGuildId();
const guild = a2.getGuild(guildId);
let r11 = guild?.maxVideoChannelUsers;
if (r11 == null) {
r11 = -1;
}
let r10 = guild?.maxStageVideoChannelUsers;
if (r10 == null) {
r10 = -1;
}
const r22 = SortedVoiceStateStore.countVoiceStatesForChannel(a0.id);
const voiceStatesForChannel = SortedVoiceStateStore.getVoiceStatesForChannel(a0);
const r26 = PermissionStore.can(Permissions.MOVE_MEMBERS, a0) && PermissionStore.can(Permissions.CONNECT, a0);
let r32 = a0.type === GUILD_STAGE_VOICE ? guildId != null && (a1.hasVideo(a0.id) || hasStream(voiceStatesForChannel)) && r10 > 0 && r22 >= r10 : guildId != null && a1.hasVideo(a0.id) && r11 > 0 && r22 >= r11 + (r26 ? 1 : 0);
let r48 = a0.userLimit > 0 && r22 >= a0.userLimit;
if (!r32) {
if (r48) {
r48 = !r26;
}
r32 = r48;
}
return r32;
}
exports.sanitizeGuildTextChannelName = sanitizeGuildTextChannelName;
export function getBitrateLimit(a0, a1) {
return a1.isGuildStageVoice() ? BITRATE_DEFAULT : a0 == null ? BITRATE_MAX : Math.max(a0.features.has(GuildFeatures.VIP_REGIONS) ? BoostedGuildFeatures[BoostedGuildTiers.TIER_3].limits.bitrate : BITRATE_MAX, BoostedGuildFeatures[a0.premiumTier].limits.bitrate);
}
export function computeSummarizedVoiceStates(a0) {
let env14145;
const r1 = env14145 = {
$parent: env2590
};
const channels = a0.channels;
env14145[0] = a0.selectedChannelId;
env14145[1] = a0.selectedVoiceChannelId;
env14145[2] = a0.voiceStates;
const r6 = [];
env14145[3] = r6;
channels.forEach($mk74367(r1));
return r6;
}
export function computeSummarizedVoiceUsers({ channels, selectedChannelId, selectedVoiceChannelId, voiceStates }) {
let env14147;
const r6 = env14147 = {
$parent: env2590
};
env14147[0] = selectedChannelId;
env14147[1] = selectedVoiceChannelId;
env14147[2] = voiceStates;
const r7 = [];
env14147[3] = r7;
channels.forEach($mk74367(r6));
return r7.map((item) => item.user);
}
export function isAnyVoiceStateStage(a0, a1, a2) {
for (const item2 of a0) {
L10: {
if (item2.id === a1) {
continue;
}
const r34 = a2[item2.id];
if (r34 == null) {
continue;
}
if (!item2.isGuildStageVoice()) {
continue;
}
for (const item of r34) {
if (getAudienceRequestToSpeakState(item.voiceState) !== RequestToSpeakStates.ON_STAGE) {
continue;
}
break L10;
}
continue;
}
return true;
}
return false;
}
export function channelTypeString({ type }) {
if (ChannelTypes.DM === type) {
return intl.string(t.jN2DfZ);
}
if (ChannelTypes.GROUP_DM === type) {
return intl.string(t["e5y+gm"]);
}
if (ChannelTypes.GUILD_TEXT === type) {
return intl.string(t.Pnajj0);
}
if (ChannelTypes.GUILD_FORUM === type) {
return intl.string(t.GbryDd);
}
if (ChannelTypes.GUILD_MEDIA === type) {
return intl.string(t.seKITE);
}
if (ChannelTypes.GUILD_VOICE === type) {
return intl.string(t.BVZqJl);
}
if (ChannelTypes.GUILD_STAGE_VOICE === type) {
return intl.string(t.EErMzA);
}
if (ChannelTypes.GUILD_ANNOUNCEMENT === type) {
return intl.string(t.l1dkSD);
}
if (ChannelTypes.GUILD_STORE === type) {
return intl.string(t["P1/Erq"]);
}
if (ChannelTypes.GUILD_CATEGORY === type) {
return intl.string(t.vHCZwr);
}
return null;
}
export function getPrivateChannelUserTagsString(a0, a1) {
if (a0 == null) {
return null;
}
const id = a1.getCurrentUser()?.id;
if (id == null) {
return null;
}
const r6 = [];
for (const item of a0) {
if (id !== item) {
const user = a1.getUser(item);
if (user != null) {
r6.push(user);
}
}
}
if (r6.length === 0) {
return null;
}
const r46 = r6.slice(0, 2).map((item) => item.isProvisional ? UserUtils.getName(item) : UserUtils.getUserTag(item));
return intl.formatToPlainString(t.BXG0Eh, {
users: r6.length,
user1: r46[0],
user2: r46[1],
extras: r6.length - r46.length
});
}
export function getMentionIconType(a0) {
if (a0 == null) {
return "text";
}
const isNSFW = a0.isNSFW();
const isSpoilerChannel = a0.isSpoilerChannel();
const isMediaChannel = a0.isMediaChannel();
return a0.type === ChannelTypes.GUILD_VOICE ? PermissionStore.can(Permissions.CONNECT, a0) ? isNSFW ? "voice-nsfw" : isSpoilerChannel ? "voice-spoiler" : "voice" : "voice-locked" : a0.type === ChannelTypes.GUILD_STAGE_VOICE ? PermissionStore.can(Permissions.CONNECT, a0) ? "stage" : "stage-locked" : THREAD_CHANNEL_TYPES.has(a0.type) ? a0.isForumPost() ? "post" : "thread" : a0.type === ChannelTypes.GUILD_FORUM ? isMediaChannel ? isNSFW ? "media-nsfw" : "media" : isNSFW ? "forum-nsfw" : isSpoilerChannel ? "forum-spoiler" : "forum" : a0.type === ChannelTypes.GUILD_MEDIA ? isNSFW ? "media-nsfw" : "media" : a0.type === ChannelTypes.GUILD_ANNOUNCEMENT ? isNSFW ? "announcement-nsfw" : isSpoilerChannel ? "announcement-spoiler" : "announcement" : TEXT_CHANNEL_TYPES.has(a0.type) ? isNSFW ? "text-nsfw" : isSpoilerChannel ? "text-spoiler" : "text" : void 0;
}
export function previousTextChannelRouteForGuild(a0) {
let id;
const channel = ChannelStore.getChannel(SelectedChannelStore.getLastSelectedChannelId());
if (channel != null && (channel.getGuildId() === a0 && channel.type === ChannelTypes.GUILD_TEXT)) {
id = channel.id;
} else {
const defaultChannel = GuildChannelStore.getDefaultChannel(a0);
id = defaultChannel != null ? defaultChannel.id : null;
}
return Routes.CHANNEL(a0, id);
}
export function getChannelPermalink(a0, a1, a2, a3) {
const r6 = a3 == null ? "" : `?summaryId=${a3}`;
return `${location.protocol}//${location.host}${Routes.CHANNEL(a0, a1, a2)}${r6}`;
}
export function getChannelThreadPermalink(a0, a1, a2, a3) {
return a0 != null && (a1 != null && a2 != null) ? `${location.protocol}//${location.host}${Routes.CHANNEL_THREAD_VIEW(a0, a1, a2, a3)}` : `${location.protocol}//${location.host}${Routes.CHANNEL(a0, a1, a3)}`;
}
export function getChannelLinkToCopy(a0, a1, a2, a3) {
let r25;
const guildId = a0.getGuildId();
const canUseMediaPostEmbed = _MediaPostEmbedUtils.canUseMediaPostEmbed(guildId, a1);
if (a1 != null && canUseMediaPostEmbed) {
const id = a1.id;
const id2 = a0.id;
const r39 = SnowflakeUtils.castChannelIdAsMessageId(a0.id);
r25 = guildId != null && (id != null && id2 != null) ? `${location.protocol}//${location.host}${Routes.CHANNEL_THREAD_VIEW(guildId, id, id2, r39)}` : `${location.protocol}//${location.host}${Routes.CHANNEL(guildId, id, r39)}`;
} else {
r25 = a3 == null ? `${location.protocol}//${location.host}${Routes.CHANNEL(guildId, a0.id, a2)}` : a3;
}
return r25;
}
export function getChannelAnalyticsPage(a0) {
if (a0 == null) {
return null;
}
const type = a0.type;
if (ChannelTypes.GUILD_ANNOUNCEMENT !== type && ChannelTypes.GUILD_TEXT !== type && ChannelTypes.GUILD_FORUM !== type && ChannelTypes.GUILD_MEDIA !== type) {
if (ChannelTypes.GROUP_DM !== type && ChannelTypes.DM !== type) {
return null;
}
return AnalyticsPages.DM_CHANNEL;
}
return AnalyticsPages.GUILD_CHANNEL;
}
+44
View File
@@ -0,0 +1,44 @@
// Metro module 9573 (f9574).
import { TOKEN_REGEX } from "../Constants";
import MentionGuardUtils from "./MentionGuardUtils";
import { t, intl } from "../intl/index.native";
const r17 = [{
check: (a0, a1, a2) => {
if (a2) {
if (a1.getGuildId() == null) {
return false;
}
const role = MentionGuardUtils.extractEveryoneRole(a0, a1);
if (role == null) {
return false;
}
if (MentionGuardUtils.shouldShowEveryoneGuard(role, a1)) {
const r10 = MentionGuardUtils.everyoneMemberCount(role, a1);
const r34 = Math.pow(10, Math.floor(Math.log10(r10)));
let r39 = t["47E5Rz"];
if (a1.isForumPost()) {
r39 = t.sYW2cy;
} else if (a1.isThread()) {
r39 = t["2YaiQ1"];
}
return {
body: intl.formatToPlainString(r39, {
role,
count: (Math.trunc(r10 / r34) * r34).toLocaleString()
}),
footer: intl.string(t.mVyrtu)
};
}
return false;
}
return false;
},
analyticsType: "@Everyone Warning",
animation: void 0
}, {
check: (a0) => !!TOKEN_REGEX.test(a0) && {
body: intl.string(t.sTwS1a)
},
analyticsType: "API Token Warning"
}];
export { r17 as RESTRICTIONS };
+13
View File
@@ -0,0 +1,13 @@
// Metro module 5543 (f5544).
import Module5544 from "../_bundle/Module5544";
export const SUPPORTS_COPY = true;
export async function copy(c25493_0, c25493_1) {
Module5544.setString(c25493_0);
if (c25493_1 != null) {
c25493_1();
}
await Promise.resolve();
}
export function getString() {
return Module5544.getString();
}
+171
View File
@@ -0,0 +1,171 @@
// Metro module 4034 (f4035).
let c2312_2, c2312_3;
const hslToRgb = function hslToRgb({ hue, saturation, lightness, alpha }) {
const r1 = saturation / 255;
const r5 = lightness / 255;
const r20 = (1 - Math.abs(2 * r5 - 1)) * r1;
const r28 = r20 * (1 - Math.abs(hue / 60 % 2 - 1));
let c13793_0 = r5 - r20 / 2;
const r47 = (hue < 60 ? [r20, r28, 0] : hue < 120 ? [r28, r20, 0] : hue < 180 ? [0, r20, r28] : hue < 240 ? [0, r28, r20] : hue < 300 ? [r28, 0, r20] : [r20, 0, r28]).map((item) => Math.round(255 * (item + c13793_0)));
return {
red: r47[0],
green: r47[1],
blue: r47[2],
alpha
};
};
c2312_2 = /^#[0-9a-f]{3,8}$/i;
c2312_3 = /^((?:rgb|hsl)a?)\s*\(([^)]*)\)/i;
class Color {
constructor(a0, a1, a2, a3) {
this.red = a0;
this.green = a1;
this.blue = a2;
this.alpha = a3;
}
toHexString() {
const r9 = Math.round(this.red).toString(16);
const r14 = Math.round(this.green).toString(16);
const r20 = Math.round(this.blue).toString(16);
return "#" + (this.red > 15.5 ? r9 : "0" + r9) + (this.green > 15.5 ? r14 : "0" + r14) + (this.blue > 15.5 ? r20 : "0" + r20);
}
static parseString(a0) {
return a0.match(c2312_3) != null ? this.parseColorFnString(a0) : a0.match(c2312_2) != null ? this.parseHexString(a0) : void 0;
}
static parseRgbString(a0) {
let r6;
if (a0 === "transparent") {
const r12 = {
__proto__: Color.prototype
};
r12.red = 0;
r12.green = 0;
r12.blue = 0;
r12.alpha = 0;
r6 = r12;
} else {
r6 = this.parseColorFnString(a0);
}
return r6;
}
static parseHexString(a0) {
if (a0.match(c2312_2) != null && ![6, 8].includes(a0.length)) {
const r20 = a0.replace("#", "");
const length = r20.length;
let r22 = r20;
if (length < 6) {
const [r26, r9, r27, r28] = r20;
const r33 = r26 + r26 + r9 + r9 + r27 + r27;
r22 = r28 != null ? r33 + (r28 + r28) : r33;
}
const r37 = r22.match(/.{1,2}/g);
if (r37 != null) {
const red = parseInt(r37[0], 16);
const green = parseInt(r37[1], 16);
const blue = parseInt(r37[2], 16);
const alpha = r37[3] != null ? parseInt(r37[3], 16) / 255 : 1;
const r59 = {
__proto__: Color.prototype
};
r59.red = red;
r59.green = green;
r59.blue = blue;
r59.alpha = alpha;
return r59;
}
}
}
static parseColorFnString(a0) {
let r14 = a0.match(c2312_3);
if (r14 == null) {
r14 = [];
}
const [, r18, r9] = r14;
let c13794_0 = r18;
if (r18 != null && r9 != null) {
const r29 = r9.split(/\s*[,/\s]\s*/).map((item) => item.replace(",", "").trim()).filter((item) => item !== "").map((item, index) => {
let r20;
L11: {
if (/%$/.test(item)) {
r20 = index === 3 ? parseFloat(item) / 100 : 255 * parseFloat(item) / 100;
} else {
if (c13794_0[index] === "h") {
if (/turn$/.test(item)) {
r20 = 360 * parseFloat(item);
break L11;
}
if (/rad$/.test(item)) {
r20 = 57.3 * parseFloat(item);
break L11;
}
}
r20 = parseFloat(item);
}
}
return r20;
});
if (r18.substr(0, 3) === "hsl") {
const r47 = hslToRgb({
hue: r29[0],
saturation: r29[1],
lightness: r29[2],
alpha: r29[3]
});
const { red, green, blue, alpha } = r47;
const r57 = {
__proto__: Color.prototype
};
r57.red = red;
r57.green = green;
r57.blue = blue;
r57.alpha = alpha;
return r57;
}
const red2 = r29[0];
const green2 = r29[1];
const blue2 = r29[2];
const alpha2 = typeof r29[3] === "number" ? r29[3] : 1;
const r40 = {
__proto__: Color.prototype
};
r40.red = red2;
r40.green = green2;
r40.blue = blue2;
r40.alpha = alpha2;
return r40;
}
}
toHSL() {
const red = this.red;
const green = this.green;
const blue = this.blue;
const alpha = this.alpha;
const r3 = red / 255;
const r4 = green / 255;
const r1 = blue / 255;
const r18 = Math.max(r3, r4, r1);
const r20 = Math.min(r3, r4, r1);
const r21 = r18 - r20;
const lightness = (r18 + r20) / 2;
const saturation = r21 > 0 ? r21 / (1 - Math.abs(2 * lightness - 1)) : 0;
return r21 === 0 ? {
hue: 0,
saturation,
lightness,
alpha
} : {
hue: 60 * (r3 === r18 ? (r4 - r1) / r21 % 6 : r4 === r18 ? (r1 - r3) / r21 + 2 : r1 === r18 ? (r4 - r1) / r21 + 4 : 0),
saturation,
lightness,
alpha
};
}
getRelativeLuminance() {
const r2 = this.red / 255;
const r4 = this.green / 255;
const r6 = this.blue / 255;
return 0.2126 * (r2 <= 0.03928 ? r2 / 12.92 : Math.pow((r2 + 0.055) / 1.055, 2.4)) + 0.7152 * (r4 <= 0.03928 ? r4 / 12.92 : Math.pow((r4 + 0.055) / 1.055, 2.4)) + 0.0722 * (r6 <= 0.03928 ? r6 / 12.92 : Math.pow((r6 + 0.055) / 1.055, 2.4));
}
}
export default Color;
export { hslToRgb };
+404
View File
@@ -0,0 +1,404 @@
// Metro module 4033 (f4034).
import _slicedToArray from "../_bundle/_slicedToArray";
import Module689 from "../_bundle/Module689";
import { intl, t } from "../intl/index.native";
import Logger from "../modules/debug/Logger";
import Color from "./Color";
let rgbToHslObject, hslToHex, c2311_6, hex2rgb2hsv, rawRgbToHsl, rawHslToRgb, sortColors;
export function hexToRgba(a0) {
const r12 = _slicedToArray(Module689(a0).rgba(), 4);
return {
r: r12[0],
g: r12[1],
b: r12[2],
a: r12[3]
};
}
rgbToHslObject = function rgbToHslObject(a0, a1, a2) {
const r3 = a0 / 255;
const r5 = a1 / 255;
const r1 = a2 / 255;
const r12 = Math.min(r3, r5, r1);
const r19 = Math.max(r3, r5, r1);
const r20 = r19 - r12;
const r7 = r20 === 0;
const r32 = Math.round(60 * (r7 ? 0 : r19 === r3 ? (r5 - r1) / r20 % 6 : r19 === r5 ? (r1 - r3) / r20 + 2 : (r3 - r5) / r20 + 4));
let r33 = r32;
if (r33 < 0) {
r33 = r32 + 360;
}
const r37 = (r19 + r12) / 2;
return {
h: r33,
s: +(100 * (r7 ? 0 : r20 / (1 - Math.abs(2 * r37 - 1)))).toFixed(1),
l: +(100 * r37).toFixed(1)
};
};
hslToHex = function hslToHex(a0, a1, a2) {
const r6 = a2 / 100;
const r3 = a1 * Math.min(r6, 1 - r6) / 100;
const r28 = (0 + a0 / 30) % 12;
const r47 = Math.round(255 * (r6 - r3 * Math.max(Math.min(r28 - 3, 9 - r28, 1), -1))).toString(16).padStart(2, "0");
const r49 = (8 + a0 / 30) % 12;
const r65 = Math.round(255 * (r6 - r3 * Math.max(Math.min(r49 - 3, 9 - r49, 1), -1))).toString(16).padStart(2, "0");
const r69 = (4 + a0 / 30) % 12;
return `#${r47}${r65}${Math.round(255 * (r6 - r3 * Math.max(Math.min(r69 - 3, 9 - r69, 1), -1))).toString(16).padStart(2, "0")}`;
};
hex2rgb2hsv = function hex2rgb2hsv(a0) {
let r47;
const r18 = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a0);
if (r18 == null) {
return null;
}
const r7 = parseInt(r18[1], 16) / 255;
const r0 = parseInt(r18[2], 16) / 255;
const r4 = parseInt(r18[3], 16) / 255;
const r30 = Math.max(r7, r0, r4);
const r16 = r30 - Math.min(r7, r0, r4);
let r35 = 0;
let r36 = 0;
if (r16 !== 0) {
const r37 = r16 / r30;
const r9 = (r30 - r7) / 6 / r16;
const r8 = (r30 - r0) / 6 / r16 + 0.5;
const r45 = (r30 - r4) / 6 / r16 + 0.5;
if (r7 === r30) {
r47 = r45 - r8;
} else {
const r46 = r9 + 0.5;
r47 = r0 === r30 ? 0.3333333333333333 + r46 - r45 : r4 === r30 ? 0.6666666666666666 + r8 - r46 : 0;
}
if (r47 < 0) {
r36 = r47 + 1;
r35 = r37;
} else {
r35 = r37;
r36 = r47;
if (1 < r36) {
r36 = r47 - 1;
r35 = r37;
}
}
}
return {
h: Math.round(360 * r36),
s: Math.round(100 * (100 * r35)) / 100,
v: Math.round(100 * (100 * r30)) / 100
};
};
rawRgbToHsl = function rawRgbToHsl(red, a1, a2) {
const r0 = red / 255;
const r5 = a1 / 255;
const r6 = a2 / 255;
const r14 = Math.max(r0, r5, r6);
const r15 = Math.min(r0, r5, r6);
const lightness = (r14 + r15) / 2;
let saturation = 0;
let r3 = 0;
if (r14 !== r15) {
const r24 = r14 - r15;
const r26 = 0.5 < lightness ? r24 / (2 - r14 - r15) : r24 / (r14 + r15);
const r9 = r0 === r14 ? (r5 - r6) / r24 + (r5 < r6 ? 6 : 0) : r5 === r14 ? (r6 - r0) / r24 + 2 : r6 === r14 ? (r0 - r5) / r24 + 4 : void 0;
saturation = r26;
r3 = 0;
if (r9 != null) {
r3 = r9 / 6;
saturation = r26;
}
}
return {
hue: 360 * r3,
saturation,
lightness,
alpha: 1
};
};
rawHslToRgb = function rawHslToRgb(hue, saturation, lightness) {
const r6 = hue / 360;
let r18 = lightness;
let r19 = lightness;
let r16 = lightness;
if (saturation !== 0) {
const r27 = lightness < 0.5 ? lightness * (1 + saturation) : lightness + saturation - lightness * saturation;
const r31 = 2 * lightness - r27;
const r0 = r6 + 0.3333333333333333;
let r4 = r0;
if (r4 < 0) {
r4 = r0 + 1;
}
let r5 = r4;
if (1 < r5) {
r5 = r4 - 1;
}
const r34 = r5 < 0.16666666666666666 ? r31 + 6 * (r27 - r31) * r5 : r5 < 0.5 ? r27 : r5 < 0.6666666666666666 ? r31 + (r27 - r31) * (0.6666666666666666 - r5) * 6 : r31;
let r43 = r6;
if (r43 < 0) {
r43 = r6 + 1;
}
let r44 = r43;
if (1 < r44) {
r44 = r43 - 1;
}
const r45 = r44 < 0.16666666666666666 ? r31 + 6 * (r27 - r31) * r44 : r44 < 0.5 ? r27 : r44 < 0.6666666666666666 ? r31 + (r27 - r31) * (0.6666666666666666 - r44) * 6 : r31;
const r57 = r6 - 0.3333333333333333;
let r58 = r57;
if (r58 < 0) {
r58 = r57 + 1;
}
let r59 = r58;
if (1 < r59) {
r59 = r58 - 1;
}
r18 = r59 < 0.16666666666666666 ? r31 + 6 * (r27 - r31) * r59 : r59 < 0.5 ? r27 : r59 < 0.6666666666666666 ? r31 + (r27 - r31) * (0.6666666666666666 - r59) * 6 : r31;
r19 = r45;
r16 = r34;
}
return new Color(Math.round(255 * r16), Math.round(255 * r19), Math.round(255 * r18), 1);
};
sortColors = function sortColors({ hsv }, { hsv: hsv2 }) {
return hsv2.s + hsv2.v - (hsv.s + hsv.v);
};
export function hexWithOpacity(a0, a1) {
if (a0.length === 7) {
return a0 + (255 * a1 | 0).toString(16).padStart(2, "0").toUpperCase();
}
const r11 = a0.charAt(0) === "#" ? a0.slice(1) : a0;
const length = r11.length;
if (length === 3) {
const r98 = r11.charAt(0);
const r101 = r11.charAt(1);
const r104 = r11.charAt(2);
return "#" + (r98 + r98) + (r101 + r101) + (r104 + r104) + (255 * a1 | 0).toString(16).padStart(2, "0").toUpperCase();
}
if (length === 4) {
const r65 = r11.charAt(0);
const r68 = r11.charAt(1);
const r71 = r11.charAt(2);
const r73 = r11.charAt(3);
return "#" + (r65 + r65) + (r68 + r68) + (r71 + r71) + (255 * (parseInt(r73 + r73, 16) / 255 * a1) | 0).toString(16).padStart(2, "0").toUpperCase();
}
if (length === 6) {
return "#" + r11 + (255 * a1 | 0).toString(16).padStart(2, "0").toUpperCase();
}
if (length === 8) {
return "#" + r11.slice(0, 6) + (parseInt(r11.slice(6), 16) / 255 * a1 * 255 | 0).toString(16).padStart(2, "0").toUpperCase();
}
throw new Error("Invalid hex color format");
}
hexWithOpacity.__closure = {};
hexWithOpacity.__workletHash = 1677228068105;
hexWithOpacity.__initData = {
code: "function hexWithOpacity_ColorUtilsTsx1(color,value){if(color.length===7){const alpha=value*255|0;return color+alpha.toString(16).padStart(2,'0').toUpperCase();}const hex=color.charAt(0)==='#'?color.slice(1):color;let r;let g;let b;let a;switch(hex.length){case 3:r=hex.charAt(0);g=hex.charAt(1);b=hex.charAt(2);r+=r;g+=g;b+=b;a=(value*255|0).toString(16).padStart(2,'0').toUpperCase();return'#'+r+g+b+a;case 4:r=hex.charAt(0);g=hex.charAt(1);b=hex.charAt(2);a=hex.charAt(3);r+=r;g+=g;b+=b;a+=a;const alpha4=parseInt(a,16)/255*value;const alpha4Hex=(alpha4*255|0).toString(16).padStart(2,'0').toUpperCase();return'#'+r+g+b+alpha4Hex;case 6:const alpha6=(value*255|0).toString(16).padStart(2,'0').toUpperCase();return'#'+hex+alpha6;case 8:const baseColor='#'+hex.slice(0,6);const existingAlpha=parseInt(hex.slice(6),16)/255;const alpha8=(existingAlpha*value*255|0).toString(16).padStart(2,'0').toUpperCase();return baseColor+alpha8;default:throw new Error('Invalid hex color format');}}"
};
export function hexToRgbaString(a0, a1) {
let r9 = a1;
const [r8, r7, r6, r27] = Module689(a0).rgba();
if (a1 == null) {
r9 = r27;
}
return `rgba(${r8}, ${r7}, ${r6}, ${r9})`;
}
hexToRgbaString.__closure = {
hexToRgba
};
hexToRgbaString.__workletHash = 8956046161224;
hexToRgbaString.__initData = {
code: "function hexToRgbaString_ColorUtilsTsx2(hex,opacity){const{hexToRgba}=this.__closure;const{r:r,g:g,b:b,a:a}=hexToRgba(hex);return\"rgba(\"+r+\", \"+g+\", \"+b+\", \"+(opacity!==null&&opacity!==void 0?opacity:a)+\")\";}"
};
c2311_6 = {
...{
"#1abc9c": () => intl.string(t.fBawRj),
"#2ecc71": () => intl.string(t.hvv3QR),
"#3498db": () => intl.string(t.JwX6Jd),
"#9b59b6": () => intl.string(t.H3xljj),
"#e91e63": () => intl.string(t.X9izyR),
"#11806a": () => intl.string(t.Kw7K2z),
"#1f8b4c": () => intl.string(t.z5AZKW),
"#206694": () => intl.string(t.JqBqKz),
"#71368a": () => intl.string(t.edPgnK),
"#ad1457": () => intl.string(t.ti7gsS),
"#f1c40f": () => intl.string(t["H9jz+S"]),
"#e67e22": () => intl.string(t.UmsfHL),
"#e74c3c": () => intl.string(t.GoDlAC),
"#95a5a6": () => intl.string(t["9GpDYK"]),
"#607d8b": () => intl.string(t.lwrNQG),
"#c27c0e": () => intl.string(t.Lf10GG),
"#a84300": () => intl.string(t["H+AjY7"]),
"#992d22": () => intl.string(t.XTkdex),
"#979c9f": () => intl.string(t.Ve0Lip),
"#546e7a": () => intl.string(t.BwbOAO),
"#99aab5": () => intl.string(t["/po5rJ"])
},
"#5865f2": () => intl.string(t["Cn/LJ4"])
};
export function hexToRgb(a0) {
const r12 = _slicedToArray(Module689(a0).rgb(), 3);
return {
r: r12[0],
g: r12[1],
b: r12[2]
};
}
export function hexToRgbArray(a0) {
const r13 = _slicedToArray(Module689(a0).rgb(), 3);
return [r13[0], r13[1], r13[2]];
}
export function hexOpacityToRgba(a0, a1) {
const r26 = _slicedToArray(Module689(a0).rgb(), 3);
return `rgba(${r26[0]}, ${r26[1]}, ${r26[2]}, ${a1})`;
}
export { rgbToHslObject };
export function hslToString(a0, a1, a2) {
return `hsl(${a0}, ${a1}%, ${a2}%)`;
}
export function rgbToHsl(a0, a1, a2) {
const r17 = rgbToHslObject(a0, a1, a2);
return `hsl(${r17.h}, ${r17.s}%, ${r17.l}%)`;
}
export function rgbToHex(a0, a1, a2) {
return "#" + (16777216 + (a0 << 16) + (a1 << 8) + a2).toString(16).slice(1);
}
export function rgbaToHex(a0, a1, a2, a3) {
return "#" + (256 + a0).toString(16).slice(1) + (256 + a1).toString(16).slice(1) + (256 + a2).toString(16).slice(1) + (256 + a3).toString(16).slice(1);
}
export { hslToHex };
export function hexToColorName(a0, a1) {
let r14, r27;
const r12 = c2311_6[a0];
if (r12 == null) {
if (a1) {
r27 = intl.formatToPlainString(t["7BFCRR"], {
color: a0
});
} else {
new Logger("ColorUtils").warn(`Role color ${a0} has not been localized!`);
r27 = "undefined";
}
r14 = r27;
} else {
r14 = r12();
}
return r14;
}
export function mixColors(a0, a1) {
const alpha = a0.alpha;
return new Color((1 - alpha) * a1.red + alpha * a0.red, (1 - alpha) * a1.green + alpha * a0.green, (1 - alpha) * a1.blue + alpha * a0.blue, a0.alpha + a1.alpha * (1 - a0.alpha));
}
export { hex2rgb2hsv };
export function getComplimentaryPaletteForColor(a0, r13 = 3) {
let length;
const r19 = rgbToHslObject(a0[0], a0[1], a0[2]);
let r11 = r19.h;
const { s: r20, l: r21 } = r19;
let r22 = r20;
if (r22 < 30) {
r22 = r20 + 30;
}
let r24 = r21;
if (r24 > 80) {
r24 = r21 - 40;
}
let r27 = r24;
if (r27 < 20) {
r27 = r24 + 15;
}
const r29 = [];
if (r29.length < r13) {
do {
const r1 = r11 - 360 / (r13 + 1);
let r33 = r1;
if (r33 < 0) {
r33 = r1 + 360;
}
const r42 = _slicedToArray(Module689(hslToHex(r33, r22, r27)).rgb(), 3);
r29.push([r42[0], r42[1], r42[2]]);
length = r29.length;
r11 = r33;
} while (length < r13);
}
return r29;
}
export { rawRgbToHsl };
export function getColorLightnessAdjusted(a0, a1, r5 = false) {
const r11 = rawRgbToHsl(a0.red, a0.green, a0.blue);
const lightness = r11.lightness;
r11.lightness = r5 ? lightness + a1 > 1 ? 0.9 : r11.lightness + a1 : lightness - a1 < 0 ? 0.1 : r11.lightness - a1;
return rawHslToRgb(r11.hue, r11.saturation, r11.lightness);
}
export function getAccessibleForegroundColor({ foreground, background, ratio = 5, saturationFactor = 1 }) {
let r44, r52;
let r11 = background;
let r20 = foreground;
if (saturationFactor < 1) {
r20 = foreground.set("hsl.s", foreground.get("hsl.s") * saturationFactor);
r11 = background.set("hsl.s", background.get("hsl.s") * saturationFactor);
}
const r9 = r11.luminance() <= 0.5;
const r8 = Module689.contrast(r20, r11) < ratio;
const r38 = r11;
let r39 = r20;
let r0 = 0;
let r40 = r39;
if (r8) {
do {
const r42 = r39.get("hsl.l");
const r1 = r0;
const r19 = r39;
if (r9) {
r40 = r19;
if (!(r42 < 0.95)) {
break;
}
r44 = r19.set("hsl.l", r42 + 0.05);
} else {
r40 = r19;
if (!(r42 > 0.05)) {
break;
}
r44 = r19.set("hsl.l", r42 - 0.05);
}
r52 = Module689.contrast(r44, r38);
const r53 = r1 + 1;
r40 = r44;
if (!(r53 < 10)) {
break;
}
r0 = r53;
r39 = r44;
r40 = r39;
} while (r52 < ratio);
}
return r40.alpha(1);
}
export function findColorByHsv(a0) {
return a0.slice(0, 3).map((item) => {
let hsv = hex2rgb2hsv(item);
if (hsv == null) {
hsv = {
h: 0,
s: 0,
v: 0
};
}
return {
hex: item,
hsv
};
}).sort(sortColors)[0].hex;
}
export function getSaturatedColorHex({ colorRGB, saturationFactor = 1 }) {
if (colorRGB == null) {
return colorRGB;
}
const r17 = rawRgbToHsl(colorRGB.get("rgb.r"), colorRGB.get("rgb.g"), colorRGB.get("rgb.b"));
return rawHslToRgb(r17.hue, r17.saturation * saturationFactor, r17.lightness).toHexString();
}
export function interpolateColor(a0, a1, a2) {
const r12 = parseInt(a0.substring(1, 3), 16);
const r15 = parseInt(a0.substring(3, 5), 16);
const r13 = parseInt(a0.substring(5, 7), 16);
const r26 = parseInt(a1.substring(1, 3), 16);
const r30 = parseInt(a1.substring(3, 5), 16);
const r33 = parseInt(a1.substring(5, 7), 16);
return `#${Math.round(r12 + (r26 - r12) * a2).toString(16).padStart(2, "0")}${Math.round(r15 + (r30 - r15) * a2).toString(16).padStart(2, "0")}${Math.round(r13 + (r33 - r13) * a2).toString(16).padStart(2, "0")}`;
}
+32
View File
@@ -0,0 +1,32 @@
// Metro module 1231 (f1232).
import { ComponentActionsKeyed } from "../Constants";
import { reportEvent } from "../_bundle/Module1232";
import Logger from "../modules/debug/Logger";
import * as _Module1233 from "../_bundle/Module1233";
let c1030_3 = new Logger("ComponentDispatchUtils");
const componentDispatcher = new _Module1233.ComponentDispatcher({
maxListeners: 100,
enableDevtools: false,
logger: {
warn: function warn(a0) {
return c1030_3.warn.apply(c1030_3, [a0, ...Array.prototype.slice.call(arguments, 1)]);
}
},
devtoolsReporter: function reportDevtoolsEvent(a0, a1, a2) {
let description = Object.values(ComponentActionsKeyed).find((item) => a0.startsWith(item));
if (description == null) {
description = a0;
}
reportEvent({
type: "ComponentDispatch",
description,
data: {
actionData: a1,
fullActionName: a0
},
durationMs: a2
});
}
});
export const ComponentDispatcher = _Module1233.ComponentDispatcher;
export { componentDispatcher as ComponentDispatch };
+22
View File
@@ -0,0 +1,22 @@
// Metro module 6222 (f6223).
import * as Module19 from "react";
import { createContext } from "react";
export default function createDefinedContext() {
const Context2 = createContext(void 0);
return [Context2, function useContext() {
const context3 = Module19.useContext(Context2);
if (context3 == null) {
throw new Error("Context was used outside of defined provider.");
}
return context3;
}, function() {
const context3 = Module19.useContext(Context2);
if (context3 == null) {
throw new Error("Context was used outside of defined provider.");
}
const context2 = context3;
return function(a0) {
return <Context2.Provider value={context2}>{a0.children}</Context2.Provider>;
};
}];
};
+8
View File
@@ -0,0 +1,8 @@
// Metro module 16634 (f16635).
import GuildChannelStore, { GUILD_SELECTABLE_CHANNELS_KEY, GUILD_VOCAL_CHANNELS_KEY } from "../stores/GuildChannelStore";
import PermissionStore from "../stores/PermissionStore";
import { Permissions } from "../Constants";
export function getInvitableChannelForGuild(a0) {
const channels = GuildChannelStore.getChannels(a0);
return [...channels[GUILD_SELECTABLE_CHANNELS_KEY], ...channels[GUILD_VOCAL_CHANNELS_KEY]].find((item) => PermissionStore.can(Permissions.CREATE_INSTANT_INVITE, item.channel));
}
+16
View File
@@ -0,0 +1,16 @@
// Metro module 4183 (f4184).
const r9 = {
clearNavigationHistory: () => {},
flushDNSCache: () => {},
flushCookies: () => Promise.resolve(),
setApplicationBackgroundColor: () => {},
setZoomFactor: () => false,
focus: () => {},
submitLiveCrashReport: () => Promise.resolve(),
getPidFromDesktopSource: () => {},
getAudioPid: () => {},
generateSessionFromPid: () => "",
getAppHardwareAccelerationEnabled: () => true,
getDiscordIsElevated: () => null
};
export default r9;
+210
View File
@@ -0,0 +1,210 @@
// Metro module 3859 (f3860).
import LocaleStore from "../modules/user_settings/LocaleStore";
import Logger from "../modules/debug/Logger";
import onTimezoneChange_android from "../modules/date/onTimezoneChange.android";
import { TimestampHourCycle } from "../modules/user_settings/UserSettings";
import * as _Module1306 from "../_bundle/Module1306";
import { supportsSystemDateFormatter } from "../modules/system_date_format/SystemDateFormatter.native";
import { intl } from "../intl/index.native";
import Dispatcher from "../Dispatcher";
import makeDateFormatter from "../lib/makeDateFormatter";
import Module3771 from "../_bundle/Module3771";
let c2191_3, c2191_4, c2191_5, differenceInCalendarDays, dateFormat, c2191_8;
const resetCache = function resetCache() {
c2191_5 = Object.create(null);
};
const syncHourCycleToIntlConfig = function syncHourCycleToIntlConfig() {
const setting = TimestampHourCycle.getSetting();
const r8 = setting !== _Module1306.TimestampHourCycle.AUTO && supportsSystemDateFormatter();
for (const item of Object.values(intl.formatConfig.time)) {
if (item != null && "hour" in item) {
if (r8 && setting === _Module1306.TimestampHourCycle.H12) {
item.hourCycle = "h12";
continue;
}
if (r8 && setting === _Module1306.TimestampHourCycle.H23) {
item.hourCycle = "h23";
continue;
}
delete item["hourCycle"];
}
}
};
differenceInCalendarDays = function differenceInCalendarDays(a0, a1) {
const r6 = Math;
const r2 = (typeof a0 !== "string" ? typeof a0 === "number" : typeof a0 === "string") || a0 instanceof Date;
let r11 = a0;
if (!r2) {
c2191_3.error("Invalid date given to startOfDay", {
d: a0
});
r11 = new Date();
}
const date = new Date(r11);
const r39 = Math.floor((date.getTime() - 60000 * date.getTimezoneOffset()) / c2191_4) * c2191_4;
const r3 = (typeof a1 !== "string" ? typeof a1 === "number" : typeof a1 === "string") || a1 instanceof Date;
let r41 = a1;
if (!r3) {
c2191_3.error("Invalid date given to startOfDay", {
d: a1
});
r41 = new Date();
}
const date2 = new Date(r41);
return r6.floor((r39 - Math.floor((date2.getTime() - 60000 * date2.getTimezoneOffset()) / c2191_4) * c2191_4) / c2191_4);
};
dateFormat = function dateFormat(a0, a1, a2) {
const r20 = Module3771.isMoment(a0) ? a0 : Module3771(a0);
let r11 = a2;
const r10 = r20.locale();
if (a2 == null) {
r11 = TimestampHourCycle.getSetting();
}
const r32 = `${r10}:${a1}:${r11}`;
let r34 = c2191_5[r32];
if (r34 == null) {
const r38 = makeDateFormatter(a1);
c2191_5[r32] = r38;
r34 = r38;
}
return r34(Module3771.isMoment(a0) ? a0.toDate() : a0);
};
c2191_3 = new Logger("DateUtils");
c2191_4 = 86400000;
c2191_5 = Object.create(null);
LocaleStore.addChangeListener(resetCache);
onTimezoneChange_android(resetCache);
Dispatcher.subscribe("USER_SETTINGS_PROTO_UPDATE", syncHourCycleToIntlConfig);
Dispatcher.subscribe("CONNECTION_OPEN", syncHourCycleToIntlConfig);
c2191_8 = [{
key: "days",
millisecondsInUnit: 86400000
}, {
key: "hours",
millisecondsInUnit: 3600000
}, {
key: "minutes",
millisecondsInUnit: 60000
}, {
key: "seconds",
millisecondsInUnit: 1000
}];
export { differenceInCalendarDays };
export function differenceInDays(a0, a1) {
return (a0.getTime() - a1.getTime()) / c2191_4;
}
export function isSameHourMoment(a0, a1) {
const r8 = a0.toDate();
const r10 = a1.toDate();
return Math.abs(+r8 - +r10) <= 3600000 && r8.getHours() === r10.getHours();
}
export function isSameDay(a0, a1) {
return Math.abs(+a0 - +a1) <= c2191_4 && a0.getDate() === a1.getDate();
}
export function isWithinInterval(a0, a1, a2) {
return Math.abs(a0.valueOf() - a1.valueOf()) < a2;
}
export { dateFormat };
export function calendarFormat(a0, r4 = false) {
const r11 = Module3771.localeData();
const r10 = Module3771();
const r8 = Module3771.isMoment(a0) ? a0.toDate() : a0;
const r23 = arguments[2];
const r26 = differenceInCalendarDays(r8, r10.toDate());
if (r26 < -1) {
return dateFormat(a0, "L LT", r23);
}
const r2 = r26 < 0;
let r28 = "lastDay";
if (!r2) {
if (r26 < 1) {
r28 = "sameDay";
if (r4) {
return dateFormat(a0, "LT", r23);
}
} else {
r28 = r26 < 2 ? "nextDay" : "sameElse";
}
}
return dateFormat(a0, r11.calendar(r28, Module3771.isMoment(a0) ? a0 : Module3771(a0), r10), r23);
}
export function calendarFormatCompact(a0, a1) {
const r11 = Module3771.localeData();
const r10 = Module3771();
const r25 = differenceInCalendarDays(Module3771.isMoment(a0) ? a0.toDate() : a0, r10.toDate());
return dateFormat(a0, r25 !== 0 ? r25 === -1 ? r11.calendar("lastDay", Module3771.isMoment(a0) ? a0 : Module3771(a0), r10) : r25 > -7 ? "dddd" : "L" : "LT", a1);
}
export function dateStringToMoment(a0) {
if (a0.length >= 200) {
throw new Error("Date string exceeds maximum length");
}
return Module3771(a0);
}
export function accessibilityLabelCalendarFormat(a0) {
const r10 = Module3771.localeData();
const date = new Date();
const r13 = differenceInCalendarDays(a0, date);
const r9 = r13 < -1 ? "sameElse" : r13 < 0 ? "lastDay" : r13 < 1 ? "sameDay" : r13 < 2 ? "nextDay" : "sameElse";
return dateFormat(a0, r9 !== "sameElse" ? r10.calendar(r9, Module3771(a0), Module3771(date)) : "LLL");
}
export function diffAsUnits(a0, a1, r6 = false) {
const r4 = {
days: 0,
hours: 0,
minutes: 0,
seconds: r6 ? 1 : 0
};
let c13692_0 = r4;
if (a0 > a1) {
return r4;
}
if (r6 && Number(a0) + 1200 > Number(a1)) {
return r4;
}
let c13692_1 = Number(a1) - Number(a0);
c2191_8.forEach(({ key, millisecondsInUnit }) => {
c13692_0[key] = Math.floor(c13692_1 / millisecondsInUnit);
c13692_1 = c13692_1 - c13692_0[key] * millisecondsInUnit;
});
return r4;
}
export function unitsAsStrings(a0, a1) {
return a0.days > 0 ? intl.formatToPlainString(a1.days, {
days: a0.days,
hours: a0.hours
}) : a0.hours > 0 ? intl.formatToPlainString(a1.hours, {
hours: a0.hours,
minutes: a0.minutes
}) : intl.formatToPlainString(a1.minutes, {
minutes: Math.max(1, a0.minutes)
});
}
export function getESTDate() {
return new Date(new Date().toLocaleString("en-US", {
timeZone: "America/New_York"
}));
}
export function getMonthlyProgressPercentage() {
const date = new Date(new Date().toLocaleString("en-US", {
timeZone: "America/New_York"
}));
const date2 = new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate();
return date.getDate() / date2 * 100;
}
export function getDaysRemainingInMonth() {
const date = new Date(new Date().toLocaleString("en-US", {
timeZone: "America/New_York"
}));
return new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate() - date.getDate();
}
export function formatDateForDatetimeLocal(a0) {
const r8 = a0 == null;
let r2 = "";
if (!r8) {
if (a0.length >= 200) {
throw new Error("Date string exceeds maximum length");
}
r2 = Module3771(a0).format("YYYY-MM-DDTHH:mm");
}
return r2;
}
+76
View File
@@ -0,0 +1,76 @@
// Metro module 11511 (f11512).
import Logger from "../modules/debug/Logger";
import Module12 from "../_bundle/Module12";
let c7845_2;
const calculatePositionDeltas = function calculatePositionDeltas({ oldOrdering, newOrdering, idGetter, existingPositionGetter, ascending = true }) {
const length = newOrdering.length;
if (oldOrdering.length !== length) {
c7845_2.warn("Arrays are not of the same length!", oldOrdering, newOrdering);
return [];
}
const r15 = oldOrdering.map(idGetter).sort().join(":");
const r32 = newOrdering.map(idGetter).sort().join(":");
if (r15 !== r32) {
c7845_2.warn("Object IDs in the old ordering and the new ordering are not the same.", r15, r32);
return [];
}
const r33 = {};
const r5 = 0 < length;
let r0 = 0;
if (r5) {
do {
r33[idGetter(oldOrdering[r0])] = existingPositionGetter(oldOrdering[r0]);
r0 = r0 + 1;
} while (r0 < length);
}
const r37 = [];
const r38 = 0 < length;
let r39 = 0;
if (r38) {
do {
const id = idGetter(newOrdering[r39]);
const r41 = r39;
const position = ascending ? r41 : length - 1 - r41;
if (!(r33[id] === position && existingPositionGetter(newOrdering[r41]) === position)) {
r37.push({
id,
position
});
}
r39 = r41 + 1;
} while (r39 < length);
}
if (!ascending) {
r37.reverse();
}
return r37;
};
export function moveItemFromTo(a0, a1, a2) {
const r5 = a0[a1];
const r2 = [...a0];
r2.splice(a1, 1);
r2.splice(a2, 0, r5);
return r2;
}
export function getPositionUpdates({ objectArray, fromPosition, toPosition, idGetter, existingPositionGetter, ascending = true }) {
const oldOrdering = Array.isArray(objectArray) ? objectArray : Module12.values(objectArray);
const r27 = oldOrdering[fromPosition];
const newOrdering = [...oldOrdering];
newOrdering.splice(fromPosition, 1);
newOrdering.splice(toPosition, 0, r27);
return calculatePositionDeltas({
oldOrdering,
newOrdering,
idGetter,
existingPositionGetter,
ascending
});
}
c7845_2 = new Logger("DragAndDropUtils");
const r23 = {
moveItemFromTo,
calculatePositionDeltas,
getPositionUpdates
};
export default r23;
export { calculatePositionDeltas };
+28
View File
@@ -0,0 +1,28 @@
// Metro module 687 (f688).
const r12 = {
Millis: Object.freeze({
HALF_SECOND: 500,
SECOND: 1000,
MINUTE: 60000,
HOUR: 3600000,
DAY: 86400000,
WEEK: 604800000,
DAYS_30: 2592000000
}),
Seconds: Object.freeze({
SECOND: 1,
MINUTE: 60,
HOUR: 3600,
DAY: 86400,
WEEK: 604800,
DAYS_30: 2592000
}),
Minutes: Object.freeze({
MINUTE: 1,
HOUR: 60,
DAY: 1440,
WEEK: 10080,
DAYS_30: 43200
})
};
export default r12;
+334
View File
@@ -0,0 +1,334 @@
// Metro module 4522 (f4523).
import { MessageEmbedMediaFlags, MessageEmbedTypes, Permissions } from "../Constants";
import { EMBED_TYPES_WITH_PARSEABLE_FIELDS } from "../modules/messages/EmbedConstants";
import SnowflakeUtils from "./SnowflakeUtils";
import { hasFlag } from "../_bundle/Module1384";
import Module12 from "../_bundle/Module12";
import Module3771 from "../_bundle/Module3771";
import { int2hsl } from "../_bundle/int2hslRaw";
import { transformComponents } from "../modules/interaction_components/InteractionComponentUtils";
let c2730_7 = /sketchfab/i;
let c2730_8 = /^https:\/\/sketchfab\.com/i;
let c2730_9 = /youtube|steam|imgur|vimeo|sketchfab|soundcloud|streamable|twitch|vid\.me|twitter/i;
let c2730_10 = /^https?:\/\/(?:canary\.|ptb\.|www\.)?discord(?:app)?\.com\/channels\/([0-9]+)\/shop$/;
let c2730_11 = /^https?:\/\/(?:canary\.|ptb\.|www\.)?discord(?:app)?\.com\/channels\/([0-9]+)\/shop\/([0-9]+)$/;
let c2730_12 = new RegExp("^https://(?:(?:canary\\.|ptb\\.)?discord(?:app)?.com|staging\\.discord\\.co)/shop");
let c2730_13 = /^https?:\/\/(?:canary\.|ptb\.|www\.)?discord(?:app)?\.com\/channels\/([0-9]+)\/game-shop\/([0-9]+)\/([0-9]+)/;
let c2730_14 = /^https?:\/\/(?:canary\.|ptb\.|www\.)?discord(?:app)?\.com\/game-shop\/([0-9]+)\/([0-9]+)/;
let c2730_15 = /^https?:\/\/(?:canary\.|ptb\.|www\.)?discord(?:app)?\.com\/shop\?(?=.*tab=game-shops)(?=.*applicationId=[0-9]+)(?=.*skuId=[0-9]+)/;
let c2730_16 = /^https?:\/\/(?:canary\.|ptb\.|www\.)?discord(?:app)?\.com\/games\/[0-9]+(?:\/[A-Za-z0-9-]*)?\/?$/;
export function sanitizeEmbed(a0, a1, a2) {
let r190;
const r6 = {
id: Module12.uniqueId("embed_"),
url: a2.url,
type: a2.type,
rawTitle: a2.title,
rawDescription: a2.description,
referenceId: a2.reference_id,
flags: a2.flags,
contentScanVersion: a2.content_scan_version
};
if (a2.footer != null) {
r6.footer = {
text: a2.footer.text,
iconURL: a2.footer.icon_url,
iconProxyURL: a2.footer.proxy_icon_url
};
}
if (a2.author != null && a2.author.name != null) {
r6.author = {
name: a2.author.name,
url: a2.author.url,
iconURL: a2.author.icon_url,
iconProxyURL: a2.author.proxy_icon_url
};
}
if (a2.provider != null && a2.provider.name != null) {
r6.provider = {
name: a2.provider.name,
url: a2.provider.url
};
}
if (a2.timestamp != null) {
r6.timestamp = Module3771(new Date(a2.timestamp));
}
if (a2.color != null) {
r6.color = int2hsl(a2.color, false);
}
L34: {
if (a2.thumbnail != null) {
const thumbnail = a2.thumbnail;
const { width: width2, height: height2 } = thumbnail;
if (width2 > 0 && height2 > 0) {
const type = r6.type;
if (MessageEmbedTypes.ARTICLE !== type && MessageEmbedTypes.IMAGE !== type) {
const thumbnail2 = a2.thumbnail;
const { url, proxy_url, width, height, placeholder, placeholder_version, description } = thumbnail2;
let flags = thumbnail2.flags;
let content_type = thumbnail2.content_type;
const thumbnail4 = {
url,
proxyURL: proxy_url,
width,
height,
placeholder,
placeholderVersion: placeholder_version,
description,
srcIsAnimated: hasFlag(flags == null ? 0 : flags, MessageEmbedMediaFlags.IS_ANIMATED),
flags: null,
contentType: null
};
if (flags == null) {
flags = 0;
}
thumbnail4.flags = flags;
if (content_type == null) {
content_type = void 0;
}
thumbnail4.contentType = content_type;
r6.thumbnail = thumbnail4;
break L34;
}
const thumbnail3 = a2.thumbnail;
const { url: url2, proxy_url: proxy_url2, width: width3, height: height3, placeholder: placeholder2, placeholder_version: placeholder_version2, description: description2 } = thumbnail3;
let flags2 = thumbnail3.flags;
let content_type2 = thumbnail3.content_type;
const image3 = {
url: url2,
proxyURL: proxy_url2,
width: width3,
height: height3,
placeholder: placeholder2,
placeholderVersion: placeholder_version2,
description: description2,
srcIsAnimated: hasFlag(flags2 == null ? 0 : flags2, MessageEmbedMediaFlags.IS_ANIMATED),
flags: null,
contentType: null
};
if (flags2 == null) {
flags2 = 0;
}
image3.flags = flags2;
if (content_type2 == null) {
content_type2 = void 0;
}
image3.contentType = content_type2;
r6.image = image3;
}
}
}
let r120 = a2.image != null;
if (r120) {
const image = a2.image;
const { width: width4, height: height4 } = image;
r120 = width4 > 0 && height4 > 0;
}
if (r120) {
const image2 = a2.image;
const { url: url3, proxy_url: proxy_url3, width: width5, height: height5, placeholder: placeholder3, placeholder_version: placeholder_version3, description: description3 } = image2;
let flags3 = image2.flags;
let content_type3 = image2.content_type;
const image4 = {
url: url3,
proxyURL: proxy_url3,
width: width5,
height: height5,
placeholder: placeholder3,
placeholderVersion: placeholder_version3,
description: description3,
srcIsAnimated: hasFlag(flags3 == null ? 0 : flags3, MessageEmbedMediaFlags.IS_ANIMATED),
flags: null,
contentType: null
};
if (flags3 == null) {
flags3 = 0;
}
image4.flags = flags3;
if (content_type3 == null) {
content_type3 = void 0;
}
image4.contentType = content_type3;
r6.image = image4;
}
if (a2.video != null) {
let r146 = r6.thumbnail == null && a2.video.proxy_url != null;
if (r146) {
const video = a2.video;
const { width: width6, height: height6 } = video;
r146 = width6 > 0 && height6 > 0;
}
if (r146) {
const proxy_url4 = a2.video.proxy_url;
const r161 = {
format: "webp"
};
let c14291_0 = r161;
const uRL = new URL(proxy_url4);
let c14291_1 = uRL;
Object.keys(r161).forEach((item) => {
c14291_1.searchParams.set(item, c14291_0[item]);
});
r6.thumbnail = {
width: a2.video.width,
height: a2.video.height,
url: uRL.toString()
};
}
let r178 = r6.thumbnail != null;
if (r178) {
const video2 = a2.video;
const { width: width7, height: height7 } = video2;
r178 = width7 > 0 && height7 > 0;
}
if (r178) {
L74: {
const { provider, video: video3 } = a2;
if (provider != null) {
const r189 = c2730_7.test(provider.name);
r190 = false;
if (r189) {
break L74;
}
}
const r194 = c2730_8.test(video3.url);
r190 = false;
if (!r194) {
const r196 = video3.proxy_url != null || /^https:/i.test(video3.url);
r190 = a1 != null && SnowflakeUtils.extractTimestamp(a1) < 1492472454139 ? (r196 ? provider != null : r196) && c2730_9.test(provider.name) : r196;
}
}
r178 = r190;
}
if (r178) {
const video4 = a2.video;
const { url: url4, proxy_url: proxy_url5, width: width8, height: height8, placeholder: placeholder4, placeholder_version: placeholder_version4, description: description4 } = video4;
let flags4 = video4.flags;
let content_type4 = video4.content_type;
const video5 = {
url: url4,
proxyURL: proxy_url5,
width: width8,
height: height8,
placeholder: placeholder4,
placeholderVersion: placeholder_version4,
description: description4,
srcIsAnimated: hasFlag(flags4 == null ? 0 : flags4, MessageEmbedMediaFlags.IS_ANIMATED),
flags: null,
contentType: null
};
if (flags4 == null) {
flags4 = 0;
}
video5.flags = flags4;
if (content_type4 == null) {
content_type4 = void 0;
}
video5.contentType = content_type4;
r6.video = video5;
}
}
if (EMBED_TYPES_WITH_PARSEABLE_FIELDS.has(r6.type)) {
let fields = a2.fields;
if (fields == null) {
fields = [];
}
r6.fields = fields.map((field) => ({
rawName: field.name,
rawValue: field.value,
inline: field.inline
}));
} else {
r6.fields = [];
}
if (a2.components != null) {
const r246 = transformComponents(a2.components);
r6.components = r246.length > 0 ? r246 : void 0;
}
return r6;
}
export function mergeEmbedsOnURL(a0) {
let c14292_0 = new Map();
const r9 = [];
let c14292_1 = r9;
a0.forEach((item) => {
if (item.url != null) {
const r12 = c14292_0.get(item.url);
if (r12 == null) {
c14292_1.push(item);
c14292_0.set(item.url, item);
return void 0;
}
if (item.image != null) {
if (r12.images == null) {
r12.images = [];
if (r12.image != null) {
r12.images.push(r12.image);
}
}
r12.images.push(item.image);
}
} else {
c14292_1.push(item);
}
});
return r9;
}
export function getEffectiveVideoProvider(a0, a1) {
if (a0 !== "YouTube" && a0 !== "TikTok") {
L9: {
if (a1 != null) {
L7: {
try {
const hostname = new URL(a1).hostname;
if (hostname === "www.youtube.com") {
break L7;
}
if (hostname !== "www.tiktok.com") {
break L9;
}
} catch ($e) {
break L9;
}
return "TikTok";
}
return "YouTube";
}
}
return a0;
}
return a0;
}
export function isEmbedInline({ image, video, type, author, rawTitle }) {
return (image != null || video != null) && (type === MessageEmbedTypes.GIFV || type !== MessageEmbedTypes.RICH && author == null && rawTitle == null);
}
export function isServerShopArticleEmbed(a0) {
return a0.type === MessageEmbedTypes.ARTICLE && a0.url != null && (c2730_11.test(a0.url) || c2730_10.test(a0.url));
}
export function isCollectiblesShopArticleEmbed(a0) {
return a0.type === MessageEmbedTypes.ARTICLE && a0.url != null && c2730_12.test(a0.url);
}
export function isGameProfileArticleEmbed(a0) {
return a0.type === MessageEmbedTypes.ARTICLE && a0.url != null && c2730_16.test(a0.url);
}
export function isSocialLayerStorefrontArticleEmbed(a0) {
return a0.type === MessageEmbedTypes.ARTICLE && a0.url != null && (c2730_14.test(a0.url) || c2730_13.test(a0.url) || c2730_15.test(a0.url));
}
export function getMaxEmbedMediaSize(a0, a1, a2) {
return a1 != null && a2 != null ? {
maxMediaWidth: a1,
maxMediaHeight: a2
} : a0.provider?.name === "TikTok" ? {
maxMediaWidth: 400,
maxMediaHeight: 450
} : {
maxMediaWidth: 400,
maxMediaHeight: 300
};
}
export function canEmbedLinks(a0, a1) {
return a0.isPrivate() ? !a0.isManaged() : a1.can(Permissions.EMBED_LINKS, a0);
}
export function shouldStripEmbeds(a0) {
return a0.content !== "" || a0.messageSnapshots.some((messageSnapshot) => messageSnapshot.message.content !== "" || messageSnapshot.message.attachments.length > 0);
}
+234
View File
@@ -0,0 +1,234 @@
// Metro module 3834 (f3835).
import { isGuildTextChannelType, isGuildVocalChannelType } from "../records/ChannelRecord";
import PermissionStore from "../stores/PermissionStore";
import UserStore from "../stores/UserStore";
import { Permissions } from "../Constants";
import { EMOJI_MAX_FILESIZE, EMOJI_MAX_LENGTH, EMOJI_RE, EmojiDisabledReasons, EmojiIntention, isExternalEmojiAllowedForIntention } from "../modules/emojis/EmojiConstants";
import { EmojiTypes } from "../modules/emojis/EmojiTypes";
import PremiumUtils from "./PremiumUtils";
import { isUnusableRoleSubscriptionEmoji, isPurchasableRoleSubscriptionEmoji } from "../modules/guild_role_subscriptions/RoleSubscriptionEmojiUtils";
import { shouldHideGuildPurchaseEntryPoints } from "../modules/creator_monetization_review/CreatorMonetizationRestrictionsUtils";
import EmojiUtilsPlatformed_native from "./EmojiUtilsPlatformed.native";
import { dataUriFileSize } from "./ImageUtils";
import AvatarUtils from "./AvatarUtils";
let c2168_15, c2168_16, c2168_17;
const getEmojiUnavailableReason = function getEmojiUnavailableReason(a0) {
const { emoji, channel } = a0;
let guildId = a0.guildId;
if (guildId === void 0) {
guildId = channel == null ? void 0 : channel.getGuildId();
}
const { intention, forceIncludeExternalGuilds } = a0;
if (emoji.type === EmojiTypes.GUILD || emoji.guildId != null) {
if (intention !== EmojiIntention.GUILD_PROFILE && intention !== EmojiIntention.NO_CUSTOM_EMOJI) {
const r15 = channel != null && isGuildTextChannelType(channel.type);
const r34 = channel != null && isGuildVocalChannelType(channel.type);
let r36 = emoji != null && guildId != null;
if (r36) {
const r2 = emoji.type === EmojiTypes.GUILD || emoji.guildId != null;
r36 = r2 ? guildId === emoji.guildId : !r2;
}
const r48 = PermissionStore.can(Permissions.USE_EXTERNAL_EMOJIS, channel);
if (intention === EmojiIntention.COMMUNITY_CONTENT) {
return r36 && emoji.guildId != null ? emoji.available ? null : EmojiDisabledReasons.DISALLOW_EXTERNAL : EmojiDisabledReasons.DISALLOW_EXTERNAL;
}
if (!isExternalEmojiAllowedForIntention(intention)) {
let r52 = emoji != null && guildId != null;
if (r52) {
const r4 = emoji.type === EmojiTypes.GUILD || emoji.guildId != null;
r52 = r4 ? guildId === emoji.guildId : !r4;
}
if (!r52 && !forceIncludeExternalGuilds) {
return EmojiDisabledReasons.DISALLOW_EXTERNAL;
}
}
if (!(!r15 && !r34) && !r36 && !r48) {
return EmojiDisabledReasons.DISALLOW_EXTERNAL;
}
if (emoji.id != null && !emoji.available) {
return EmojiDisabledReasons.GUILD_SUBSCRIPTION_UNAVAILABLE;
}
const currentUser = UserStore.getCurrentUser();
if (!PremiumUtils.canUseEmojisEverywhere(currentUser) && !r36) {
if (intention === EmojiIntention.STATUS) {
return EmojiDisabledReasons.PREMIUM_LOCKED;
}
if (!emoji.managed) {
return EmojiDisabledReasons.PREMIUM_LOCKED;
}
}
if (guildId == null) {
guildId = void 0;
}
return isUnusableRoleSubscriptionEmoji(emoji, guildId) ? shouldHideGuildPurchaseEntryPoints(emoji.guildId) ? EmojiDisabledReasons.ROLE_SUBSCRIPTION_UNAVAILABLE : EmojiDisabledReasons.ROLE_SUBSCRIPTION_LOCKED : emoji.animated ? PremiumUtils.canUseAnimatedEmojis(currentUser) ? null : isPurchasableRoleSubscriptionEmoji(emoji) ? null : EmojiDisabledReasons.PREMIUM_LOCKED : null;
}
return EmojiDisabledReasons.DISALLOW_CUSTOM;
}
return null;
};
c2168_15 = new Set([EmojiDisabledReasons.PREMIUM_LOCKED, EmojiDisabledReasons.ROLE_SUBSCRIPTION_LOCKED]);
c2168_16 = new Set([...c2168_15, EmojiDisabledReasons.GUILD_SUBSCRIPTION_UNAVAILABLE, EmojiDisabledReasons.ROLE_SUBSCRIPTION_UNAVAILABLE]);
c2168_17 = new Set([EmojiDisabledReasons.DISALLOW_CUSTOM, EmojiDisabledReasons.DISALLOW_EXTERNAL, EmojiDisabledReasons.GUILD_SUBSCRIPTION_UNAVAILABLE, EmojiDisabledReasons.ONLY_GUILD_EMOJIS_ALLOWED]);
const r71 = {
sanitizeEmojiName: (a0) => {
let length2;
const r9 = a0.replace(EMOJI_RE, "").slice(0, EMOJI_MAX_LENGTH);
const length = r9.length;
let r13 = r9;
let r14 = r13;
if (length < 2) {
do {
const r15 = r13 + "_";
length2 = r15.length;
r13 = r15;
r14 = r13;
} while (length2 < 2);
}
return r14;
},
filterUnsupportedEmojis: EmojiUtilsPlatformed_native.filterUnsupportedEmojis,
getURL: EmojiUtilsPlatformed_native.getURL,
isInternalEmojiForGuildId: function isInternalEmojiForGuildId(a0, a1) {
let r0 = a0 != null && a1 != null;
if (r0) {
const r13 = a0.type === EmojiTypes.GUILD || a0.guildId != null;
r0 = r13 ? a1 === a0.guildId : !r13;
}
return r0;
},
getEmojiUnavailableReason,
isCustomEmoji: function isCustomEmoji(a0) {
return a0.type === EmojiTypes.GUILD || a0.guildId != null;
},
getEmojiUnavailableReasons: ({ categoryEmojis, channel, guildId, intention }) => {
const set = new Set();
const emojisUnfiltered = [];
let emojisPremiumLockedCount = 0;
let emojiNitroLocked = false;
for (const item of categoryEmojis) {
const emojiUnavailableReason = getEmojiUnavailableReason({
emoji: item,
channel,
guildId,
intention
});
if (emojiUnavailableReason != null) {
if (!c2168_17.has(emojiUnavailableReason)) {
emojisUnfiltered.push(item);
}
if (c2168_16.has(emojiUnavailableReason)) {
if (item.id != null) {
set.add(item.id);
}
if (c2168_15.has(emojiUnavailableReason)) {
if (!(emojiNitroLocked || emojiUnavailableReason !== EmojiDisabledReasons.PREMIUM_LOCKED)) {
emojiNitroLocked = true;
}
emojisPremiumLockedCount = emojisPremiumLockedCount + 1;
}
}
} else {
emojisUnfiltered.push(item);
}
}
return {
emojisDisabled: set,
emojisUnfiltered,
emojisPremiumLockedCount,
emojiNitroLocked
};
},
isEmojiFiltered: (a0) => c2168_17.has(getEmojiUnavailableReason(a0)),
isEmojiPremiumLocked: (a0) => c2168_15.has(getEmojiUnavailableReason(a0)),
isEmojiCategoryNitroLocked: ({ categoryEmojis, channel, guildId, intention }) => {
let r0 = false;
let r2 = 0;
for (const item of categoryEmojis) {
const emojiUnavailableReason = getEmojiUnavailableReason({
emoji: item,
channel,
intention,
guildId
});
if (emojiUnavailableReason === EmojiDisabledReasons.PREMIUM_LOCKED) {
r0 = true;
r2 = r2 + 1;
} else if (emojiUnavailableReason === EmojiDisabledReasons.GUILD_SUBSCRIPTION_UNAVAILABLE) {
r2 = r2 + 1;
}
}
if (r0) {
r0 = r2 === categoryEmojis.length;
}
return r0;
},
isEmojiFilteredOrLocked: function isEmojiFilteredOrLocked(a0) {
return this.isEmojiFiltered(a0) || this.isEmojiPremiumLocked(a0);
},
isEmojiDisabled: (a0) => c2168_16.has(getEmojiUnavailableReason(a0)),
isFileTooBig: (a0) => a0.size > 2097152,
isDataTooBig: (a0) => dataUriFileSize(a0) > EMOJI_MAX_FILESIZE
};
export default r71;
export function countEmoji(a0, c13647_0) {
let unicode = 0;
const custom = 0;
let customExternal = 0;
let managed = 0;
let managedExternal = 0;
const animated = 0;
a0.forEach((item) => {
if (item.id != null) {
if (item.type === EmojiTypes.GUILD) {
if (item.guildId === c13647_0) {
if (item.managed) {
managed = managed + 1;
} else {
custom = custom + 1;
}
} else if (item.managed) {
managedExternal = managedExternal + 1;
} else {
customExternal = customExternal + 1;
}
}
if (item.animated) {
animated = animated + 1;
}
} else {
unicode = unicode + 1;
}
});
return {
unicode,
custom,
customExternal,
managed,
managedExternal,
animated
};
}
export async function getEmojiColors(c24736_0) {
return await EmojiUtilsPlatformed_native.getEmojiColors(c24736_0);
}
export function getEmojiUrl(a0, size = 32) {
let r14;
const { id, name } = a0;
let animated2 = a0.animated;
if (id != null) {
if (animated2 == null) {
animated2 = false;
}
r14 = AvatarUtils.getEmojiURL({
id,
size,
animated: animated2
});
} else {
r14 = EmojiUtilsPlatformed_native.getURL(name);
}
return r14;
}
export function getAllEmojiNamesString(a0) {
return "allNamesString" in a0 ? a0.allNamesString : `:${a0.name}:`;
}
+146
View File
@@ -0,0 +1,146 @@
// Metro module 6094 (f6095).
import _slicedToArray from "../_bundle/_slicedToArray";
import { processColor, NativeModules } from "react-native";
import defaultImageSrcGenerator from "../_bundle/defaultImageSrcGenerator";
import { getSystemVersionMajor, getSystemVersionMinor } from "./native/DeviceUtils";
import * as _PlatformUtils from "./PlatformUtils";
import Module12 from "../_bundle/Module12";
import AvatarUtils from "./AvatarUtils";
import { EMOJI_IN_ANIMATION_SIZE } from "../modules/messages/native/burst_reactions/BurstReactionEffectUtils";
import { getPaletteForAvatar } from "./ImageUtils";
import { rgbToHex } from "./ColorUtils";
import { openBurstReactionFirstSendActionSheet } from "../components_native/reactions/BurstReactionFirstSendActionSheet";
import MemoizerUtils from "./MemoizerUtils";
function $mk114867($env) {
return (a0) => {
const r7 = (0, _slicedToArray)(a0, 3);
return rgbToHex(r7[0], r7[1], r7[2]);
};
}
let env3873 = {};
const getURL = function getURL(a0) {
let r5, r11;
if (a0 != null) {
const isAndroid = _PlatformUtils.isAndroid();
r11 = "";
if (isAndroid) {
r5 = defaultImageSrcGenerator.convert.toCodePoint(a0);
r11 = `asset:/emoji-${r5}.png`;
}
} else {
r5 = defaultImageSrcGenerator.convert.toCodePoint(a0);
r11 = `asset:/emoji-${r5}.png`;
}
return r11;
};
const r28 = {
getURL: MemoizerUtils.makeMemoizer(getURL),
filterUnsupportedEmojis: function filterUnsupportedEmojis(a0) {
return _PlatformUtils.isAndroid() ? a0 : Module12.filter(a0, (a0) => {
let r18;
L62: {
const unicodeVersion = a0.unicodeVersion;
const systemVersionMajor = getSystemVersionMajor();
const systemVersionMinor = getSystemVersionMinor();
const r1 = unicodeVersion > 8;
r18 = true;
if (r1) {
if (unicodeVersion === 9) {
r18 = systemVersionMajor > 10 || systemVersionMajor === 10 && systemVersionMinor >= 2;
} else if (unicodeVersion === 10) {
r18 = systemVersionMajor > 11 || systemVersionMajor === 11 && systemVersionMinor >= 1;
} else if (unicodeVersion === 11) {
r18 = systemVersionMajor > 12 || systemVersionMajor === 12 && systemVersionMinor >= 1;
} else {
if (unicodeVersion !== 12 && unicodeVersion !== 12.1) {
if (unicodeVersion === 13) {
r18 = systemVersionMajor > 14 || systemVersionMajor === 14 && systemVersionMinor >= 2;
break L62;
}
if (unicodeVersion === 13.1) {
r18 = systemVersionMajor > 14 || systemVersionMajor === 14 && systemVersionMinor >= 5;
break L62;
}
if (unicodeVersion === 14) {
r18 = systemVersionMajor > 15 || systemVersionMajor === 15 && systemVersionMinor >= 4;
break L62;
}
if (unicodeVersion === 15) {
r18 = systemVersionMajor > 16 || systemVersionMajor === 16 && systemVersionMinor >= 4;
break L62;
}
if (unicodeVersion === 15.1) {
r18 = systemVersionMajor > 17 || systemVersionMajor === 17 && systemVersionMinor >= 4;
break L62;
}
r18 = false;
if (unicodeVersion !== 16) {
break L62;
}
r18 = systemVersionMajor > 18 || systemVersionMajor === 18 && systemVersionMinor >= 4;
break L62;
}
r18 = systemVersionMajor > 13 || systemVersionMajor === 13 && systemVersionMinor >= 2;
}
}
}
return r18;
});
},
applyPlatformToThemedEmojiColorPalette: function applyPlatformToThemedEmojiColorPalette({ palette, shouldProcessMobileColors = false }) {
if (shouldProcessMobileColors && palette != null) {
const { LIGHT, DARK } = palette;
return {
LIGHT: {
accentColor: processColor(LIGHT?.accentColor),
backgroundColor: processColor(LIGHT?.backgroundColor),
highlightColor: processColor(LIGHT?.highlightColor),
opacity: LIGHT?.opacity
},
DARK: {
accentColor: processColor(DARK?.accentColor),
backgroundColor: processColor(DARK?.backgroundColor),
highlightColor: processColor(DARK?.highlightColor),
opacity: DARK?.opacity
}
};
}
return palette;
},
getEmojiColors: async function getEmojiColors(c25710_0) {
let r67;
let env29667;
const r32 = env3873;
let c25710_2 = r32;
const r11 = env29667 = {
$parent: r32
};
let c25710_1 = r11;
env29667[0] = void 0;
env29667[1] = void 0;
const { id, name } = c25710_0;
const r37 = id != null ? AvatarUtils.getEmojiURL({
id,
size: 32,
animated: false
}) : getURL(name);
env29667[0] = r37;
if (r37 === "") {
env29667[0] = `data:image/png;base64,${await NativeModules.ImageManager.getEmojiBase64(c25710_0.name, EMOJI_IN_ANIMATION_SIZE)}`;
r67 = await getPaletteForAvatar(env29667[0]);
} else {
r67 = await getPaletteForAvatar(env29667[0]);
}
env29667[1] = r67;
const r76 = env29667[1];
return r76 == null ? void 0 : r76.map($mk114867(env3873));
},
triggerFullscreenAnimation: function triggerFullscreenAnimation(a0) {
openBurstReactionFirstSendActionSheet({
channelId: a0.channelId,
messageId: a0.messageId,
emoji: a0.emoji
});
}
};
export default r28;
+17
View File
@@ -0,0 +1,17 @@
// Metro module 13258 (f13259).
import Dispatcher from "../Dispatcher";
import { serialize } from "../_bundle/Module594";
export function getUpdatedOptions(a0) {
return {
...a0,
extra: {
...a0?.extra,
...{
...Dispatcher._currentDispatchActionType != null ? {
currentAction: Dispatcher._currentDispatchActionType
} : {},
lastFewActions: serialize()
}
}
};
}
+31
View File
@@ -0,0 +1,31 @@
// Metro module 6361 (f6362).
import { normalizeToSize } from "../_bundle/Module6362";
const getUnderlyingIOSExceptionRecursively = function getUnderlyingIOSExceptionRecursively(a0) {
if (a0.userInfo.NSUnderlyingError != null) {
const underlyingIOSExceptionRecursively = getUnderlyingIOSExceptionRecursively(a0.userInfo.NSUnderlyingError);
if (underlyingIOSExceptionRecursively != null) {
return underlyingIOSExceptionRecursively;
}
}
return a0.userInfo.NSLocalizedDescription;
};
export function getUnderlyingIOSError(a0) {
let r4;
try {
r4 = getUnderlyingIOSExceptionRecursively(a0);
if (r4 == null) {
r4 = null;
}
} catch ($e) {
return null;
}
return r4;
}
export function serializeError(a0) {
const r3 = Boolean(a0) ? a0 : new Error("unknown error");
let r10 = r3;
if (typeof r10 !== "object") {
r10 = new Error(String(r3));
}
return JSON.stringify(normalizeToSize(r10));
}
+86
View File
@@ -0,0 +1,86 @@
// Metro module 7879 (f7880).
import ExperimentStore from "../modules/experiments/ExperimentStore";
import { ExperimentBuckets, ExperimentTypes } from "../modules/experiments/ExperimentConstants";
import { trackExposureToExperiment } from "../modules/experiments/ExperimentManager";
import Module12 from "../_bundle/Module12";
const getFirstEligibleUserExperiment = function getFirstEligibleUserExperiment(a0) {
for (const item of a0) {
const userExperimentDescriptor = ExperimentStore.getUserExperimentDescriptor(item);
if (userExperimentDescriptor == null) {
continue;
}
return [item, userExperimentDescriptor];
}
return null;
};
const r22 = {
getFirstEligibleUserExperiment,
isInExperimentBucket: function isInExperimentBucket(a0, a1) {
return ExperimentStore.getUserExperimentBucket(a0) === a1;
},
experimentDescriptorEquals: function experimentDescriptorEquals(a0, a1) {
if (a0 == null && a1 == null) {
return true;
}
if (a0 === a1) {
return true;
}
if (a0 == null && a1 != null) {
return false;
}
if (a0 != null && a1 == null) {
return false;
}
if (a0 != null && a1 != null) {
if (a0.type !== a1.type) {
return false;
}
if (a0.bucket !== a1.bucket) {
return false;
}
if (a0.revision !== a1.revision) {
return false;
}
if (a0.type === ExperimentTypes.USER && a1.type === ExperimentTypes.USER) {
return Module12.isEqual(a0.context, a1.context);
}
}
return true;
},
trackExposureToFirstEligibleUserExperiment: function trackExposureToFirstEligibleUserExperiment(a0) {
const firstEligibleUserExperiment = getFirstEligibleUserExperiment(a0);
if (firstEligibleUserExperiment != null) {
const [r6, r10] = firstEligibleUserExperiment;
trackExposureToExperiment(r6, r10);
return r10;
}
},
getExperimentBucketName: function getExperimentBucketName(a0) {
return a0 !== ExperimentBuckets.CONTROL ? a0 !== ExperimentBuckets.NOT_ELIGIBLE ? `Treatment ${a0}` : "Not Eligible" : "Control";
},
getRecentExperimentBuckets: function getRecentExperimentBuckets(a0, c16074_0) {
return Object.entries(a0).reduce((acc, item) => {
const [r24, r25] = item;
if ((function isRecentExperiment(a0, a1) {
let r34;
L4: {
try {
const [r17, r18] = a0.split("-");
if (r18 == null) {
break L4;
}
r34 = new Date(`${r17}-${r18.slice(0, 2)}-01`) > a1;
} catch ($e) {
return false;
}
return r34;
}
return false;
})(r24, c16074_0) && r25 > ExperimentBuckets.CONTROL) {
acc[r24] = r25;
}
return acc;
}, {});
}
};
export default r22;
+96
View File
@@ -0,0 +1,96 @@
// Metro module 8086 (f8087).
import Logger from "../modules/debug/Logger";
import Module1271 from "../_bundle/Module1271";
let env5130 = {};
const c5130_3 = new Logger("FileManagerUtils");
export function writeFile(a0, a1, a2, a3) {
let r17 = Module1271 == null ? void 0 : Module1271.writeFile(a0, a1, a2, a3).then((result) => `file:${result}`);
if (r17 == null) {
r17 = Promise.reject("RTNFileManager doesn't exist?");
}
return r17;
}
export function moveFile(a0, a1, a2) {
let r11 = Module1271 == null ? void 0 : Module1271.moveFile(a0, a1, a2);
if (r11 == null) {
r11 = Promise.reject(false);
}
return r11;
}
export function removeFile(a0, a1) {
let r10 = Module1271 == null ? void 0 : Module1271.removeFile(a0, a1);
if (r10 == null) {
r10 = Promise.reject(false);
}
return r10;
}
export function clearFolder(a0, a1) {
let r10 = Module1271 == null ? void 0 : Module1271.clearFolder(a0, a1);
if (r10 == null) {
r10 = Promise.reject(false);
}
return r10;
}
export async function readFile(c26105_0, c26105_1, c26105_2) {
let r26;
let c26105_3, c26105_4, c26105_5;
let c26105_6 = 0;
const r12 = env5130;
L17: {
L16: {
try {
let env29889;
c26105_4 = r12;
const r17 = env29889 = {
$parent: r12
};
c26105_3 = r17;
env29889[0] = c26105_1;
env29889[1] = c26105_2;
env29889[2] = void 0;
const r34 = (function getBaseDirectory(a0) {
if (Module1271 == null) {
return null;
}
return a0 === "cache" ? Module1271.getConstants().CacheDirPath : Module1271.getConstants().DocumentsDirPath;
})(c26105_0);
env29889[2] = r34;
if (r34 == null) {
break L17;
}
if (await Module1271.fileExists(r34 + "/" + c26105_1)) {
c26105_6 = 1;
r26 = await Module1271.readFile(env29889[2] + "/" + env29889[0], env29889[1]);
c26105_6 = 0;
break L16;
}
} catch ($e) {
const r30 = $e;
let r8 = r30;
c26105_5 = r30;
if (c26105_6 !== 0) {
while (true) {
try {
const r101 = c26105_5;
c26105_6 = 0;
env29889[3] = r101;
c5130_3.error("Failed to read file from disk", env29889[3]);
} catch (r97) {
r8 = r97;
c26105_5 = r97;
if (c26105_6 === 0) {
break;
}
continue;
}
return null;
}
}
throw r8;
}
return null;
}
return r26;
}
return null;
}
+50
View File
@@ -0,0 +1,50 @@
// Metro module 4084 (f4085).
import { intl, t } from "../intl/index.native";
let c2348_2, c2348_3;
const formatSize = function formatSize(a0, r5 = c2348_3) {
const useKibibytes = r5.useKibibytes;
let r0 = 1000;
const r2 = useKibibytes ? c2348_2 : 1000;
if (r5.useKibibytes) {
r0 = 1024;
}
const size2 = Math.ceil(a0 / r2);
if (size2 < r0) {
return r5.useSpace ? intl.formatToPlainString(t.cS889N, {
size: size2
}) : intl.formatToPlainString(t.pIn7Af, {
size: size2
});
}
const r17 = size2 / r0;
const showDecimalForGB = r5.showDecimalForGB;
const r19 = Math;
const size = showDecimalForGB ? r19.round(10 * r17) / 10 : r19.round(r17);
return r5.useSpace ? intl.formatToPlainString(t.yhEXX7, {
size
}) : intl.formatToPlainString(t.TbMX9D, {
size
});
};
c2348_2 = 1024;
c2348_3 = {
useKibibytes: false,
showDecimalForGB: true,
useSpace: true
};
export const BYTE_IN_KB = 1024;
export const KB_IN_MB = 1024;
export { formatSize };
export function formatKbSize(a0, r8 = c2348_3) {
const useKibibytes = r8.useKibibytes;
let r3 = 1000;
const r16 = a0 / (useKibibytes ? 1024 : 1000);
if (r8.useKibibytes) {
r3 = c2348_2;
}
return 1 <= r16 / r3 ? formatSize(r16, r8) : r8.useSpace ? intl.formatToPlainString(t.bTzRR6, {
size: Math.ceil(r16)
}) : intl.formatToPlainString(t.kEk9pr, {
size: Math.ceil(r16)
});
}
+234
View File
@@ -0,0 +1,234 @@
// Metro module 4727 (f4728).
import GuildStore from "../stores/GuildStore";
import UserStore from "../stores/UserStore";
import { GuildFeatures, MAX_ATTACHMENT_SIZE } from "../Constants";
import * as _PremiumConstants from "../modules/premium/PremiumConstants";
import { MAX_PREMIUM_TIER_2_ATTACHMENT_SIZE } from "../modules/premium/PremiumConstants";
import Module12 from "../_bundle/Module12";
import Module4728 from "../_bundle/Module4728";
import { FileUploadPowerupHoldoutExperiment } from "../modules/premium/powerups/experiments/FileUploadPowerupHoldoutExperiment";
import PremiumUtils from "./PremiumUtils";
import { formatSize } from "./FileSizeUtils";
import { intl, t } from "../intl/index.native";
function $mk74895($env) {
return (a0) => {
let r8;
const r3 = $env;
if (a0.reType != null) {
const r4 = r3[1];
r8 = r4 != null ? a0.reType.test(r4) : a0.reName != null && r3[0] !== "" && a0.reName.test(r3[0]);
} else {
r8 = a0.reName != null && r3[0] !== "" && a0.reName.test(r3[0]);
}
return r8;
};
}
function $mk103965($env) {
return (a0, a1) => {
const [r8, r23] = a1;
const r26 = $env;
return r26[1] ? r8 !== $env.$parent[5].MAX_FILE_SIZE_250_MB ? r26[0].features.has(r8) ? r23 > a0 ? r23 : a0 : a0 : a0 : r26[0].features.has(r8) ? r23 > a0 ? r23 : a0 : a0;
};
}
let c2885_8, c2885_9;
let env2885 = {};
export function getUploadFileSizeSum(a0) {
let r0 = 0;
for (const item of a0) {
r0 = r0 + item.size;
}
return r0;
}
const GuildFeatures2 = GuildFeatures;
const { MAX_GUILD_FILE_SIZE_50_MB, MAX_GUILD_FILE_SIZE_100_MB, MAX_GUILD_FILE_SIZE_250_MB } = _PremiumConstants;
c2885_8 = [{
reType: /^image\/vnd.adobe.photoshop/,
klass: "photoshop"
}, {
reType: /^image\/svg\+xml/,
klass: "webcode"
}, {
reType: /^image\//,
klass: "image"
}, {
reType: /^video\//,
klass: "video"
}, {
reName: /\.pdf$/,
klass: "acrobat"
}, {
reName: /\.ae/,
klass: "ae"
}, {
reName: /\.sketch$/,
klass: "sketch"
}, {
reName: /\.ai$/,
klass: "ai"
}, {
reName: /\.(?:rar|zip|7z|tar|tar\.gz)$/,
klass: "archive"
}, {
reName: /\.(?:c\+\+|cpp|cc|c|h|hpp|mm|m|json|js|ts|rb|rake|py|asm|fs|pyc|dtd|cgi|bat|rss|java|graphml|idb|lua|o|gml|prl|sls|conf|cmake|make|sln|vbe|cxx|wbf|vbs|r|wml|php|bash|applescript|fcgi|yaml|ex|exs|sh|ml|actionscript)$/,
klass: "code"
}, {
reName: /\.(?:txt|rtf|doc|docx|md|pages|ppt|pptx|pptm|key|log)$/,
klass: "document"
}, {
reName: /\.(?:xls|xlsx|numbers|csv)$/,
klass: "spreadsheet"
}, {
reName: /\.(?:html|xhtml|htm|xml|xsd|css|styl)$/,
klass: "webcode"
}, {
reName: /\.(?:mp3|ogg|opus|wav|aiff|flac)$/,
klass: "audio"
}];
c2885_9 = [[GuildFeatures2.MAX_FILE_SIZE_250_MB, MAX_GUILD_FILE_SIZE_250_MB], [GuildFeatures2.MAX_FILE_SIZE_100_MB, MAX_GUILD_FILE_SIZE_100_MB], [GuildFeatures2.MAX_FILE_SIZE_50_MB, MAX_GUILD_FILE_SIZE_50_MB]];
export function transformNativeFile(a0, a1) {
const r0 = a0 instanceof File;
let r11 = a0;
if (!r0) {
let type = a1;
const buffer = a0.data.buffer;
const filename = a0.filename;
if (a1 == null) {
type = "text/plain";
}
r11 = new File([buffer], filename, {
type
});
}
return r11;
}
export function makeFile(a0, a1, a2) {
return new File([a0], a1, {
type: a2
});
}
export function classifyFile({ name, type }) {
let env14408;
const r7 = env14408 = {};
env14408[0] = name;
env14408[1] = type;
let r5 = name == null ? void 0 : name.toLowerCase();
if (r5 == null) {
r5 = "";
}
env14408[0] = r5;
const r17 = Module12.find(c2885_8, $mk74895(r7));
return r17 != null ? r17.klass : "unknown";
}
export function classifyFileName(a0, a1) {
let env14406;
const r3 = env14406 = {};
env14406[0] = a0;
env14406[1] = a1;
let r5 = a0 == null ? void 0 : a0.toLowerCase();
if (r5 == null) {
r5 = "";
}
env14406[0] = r5;
const r16 = Module12.find(c2885_8, $mk74895(r3));
return r16 != null ? r16.klass : "unknown";
}
export function sizeString(a0) {
return Module4728.filesize(a0);
}
export function maxFileSize(a0) {
let r17;
const userMaxFileSize = PremiumUtils.getUserMaxFileSize(UserStore.getCurrentUser());
if (a0 == null) {
return userMaxFileSize;
}
const guild = GuildStore.getGuild(a0);
if (guild != null) {
let env14407;
const r18 = env14407 = {
$parent: env2885
};
env14407[0] = guild;
env14407[1] = FileUploadPowerupHoldoutExperiment.getConfig({
location: "getGuildMaxFileSize"
}).enabled;
r17 = c2885_9.reduce($mk103965(r18), MAX_ATTACHMENT_SIZE);
} else {
r17 = MAX_ATTACHMENT_SIZE;
}
return Math.max(r17, userMaxFileSize);
}
export function anyFileTooLarge(a0, a1) {
let r18;
const userMaxFileSize = PremiumUtils.getUserMaxFileSize(UserStore.getCurrentUser());
let r14 = userMaxFileSize;
if (a1 != null) {
const guild = GuildStore.getGuild(a1);
if (guild != null) {
let env14409;
const r19 = env14409 = {
$parent: env2885
};
env14409[0] = guild;
env14409[1] = FileUploadPowerupHoldoutExperiment.getConfig({
location: "getGuildMaxFileSize"
}).enabled;
r18 = c2885_9.reduce($mk103965(r19), MAX_ATTACHMENT_SIZE);
} else {
r18 = MAX_ATTACHMENT_SIZE;
}
r14 = Math.max(r18, userMaxFileSize);
}
let c14410_0 = r14;
return Array.from(a0).some((item) => item.size > c14410_0);
}
export function uploadSumTooLarge(a0) {
const uploadFileSizeSum = getUploadFileSizeSum(a0);
const currentUser = UserStore.getCurrentUser();
if (currentUser != null) {
currentUser.isStaff();
}
return uploadFileSizeSum > 524288000;
}
export function getMaxRequestSize() {
const currentUser = UserStore.getCurrentUser();
if (currentUser != null) {
currentUser.isStaff();
}
return 524288000;
}
export function fileUploadLimitRoadblockDescription(a0) {
let r28;
const { guildId, onClick } = a0;
let maxSize = a0.maxSize;
if (maxSize == null) {
const userMaxFileSize = PremiumUtils.getUserMaxFileSize(UserStore.getCurrentUser());
let r24 = userMaxFileSize;
if (guildId != null) {
const guild = GuildStore.getGuild(guildId);
if (guild != null) {
let env14411;
const r29 = env14411 = {
$parent: env2885
};
env14411[0] = guild;
env14411[1] = FileUploadPowerupHoldoutExperiment.getConfig({
location: "getGuildMaxFileSize"
}).enabled;
r28 = c2885_9.reduce($mk103965(r29), MAX_ATTACHMENT_SIZE);
} else {
r28 = MAX_ATTACHMENT_SIZE;
}
r24 = Math.max(r28, userMaxFileSize);
}
maxSize = r24;
}
return intl.format(t.tRuxk9, {
maxSize: formatSize(maxSize / 1024, {
useKibibytes: true
}),
premiumMaxSize: formatSize(MAX_PREMIUM_TIER_2_ATTACHMENT_SIZE / 1024, {
useKibibytes: true
}),
onClick
});
}
+83
View File
@@ -0,0 +1,83 @@
// Metro module 8922 (f8923).
import { AbortCodes, AnalyticEvents } from "../Constants";
import { intl, t } from "../intl/index.native";
import Module38 from "../_bundle/Module38";
import AnalyticsUtils from "./AnalyticsUtils";
import ValidationUtils from "./ValidationUtils";
let c5833_6, c5833_7, c5833_8, humanizeAbortCode;
const validateDiscordTag = function validateDiscordTag(a0) {
let r15;
L6: {
const r14 = c5833_8.test(a0);
r15 = null;
if (!r14) {
if (a0.includes("#")) {
const r19 = c5833_7.test(a0);
r15 = null;
if (r19) {
break L6;
}
}
let [r10, r13] = a0.split("#");
const FRIEND_REQUEST_FAILED = AnalyticEvents.FRIEND_REQUEST_FAILED;
if (r13 == null) {
r13 = "";
}
AnalyticsUtils.track(FRIEND_REQUEST_FAILED, {
reason: "Invalid Username",
query: a0,
discrim_len: r13.length,
username_len: r10.length,
is_email_like: ValidationUtils.isEmail(a0),
is_invite_like: ValidationUtils.isInvite(a0),
is_num_only: c5833_6.test(a0)
});
r15 = intl.string(t.paDJBM);
}
}
return r15;
};
humanizeAbortCode = function humanizeAbortCode(a0, a1) {
if (AbortCodes.RELATIONSHIP_INCOMING_DISABLED === a0) {
return intl.format(t.Oxe6Ur, {
discordTag: a1
});
}
if (AbortCodes.TOO_MANY_FRIENDS === a0) {
return intl.string(t.tnBalD);
}
if (AbortCodes.RELATIONSHIP_ALREADY_FRIENDS === a0) {
return intl.string(t.VNLneq);
}
if (AbortCodes.USER_QUARANTINED !== a0 && AbortCodes.USER_FRIEND_REQUEST_LIMITED_ACCESS !== a0) {
if (AbortCodes.TOO_MANY_BLOCKED_USERS === a0) {
return intl.string(t.sIGo1i);
}
if (AbortCodes.TOO_MANY_PENDING_OUTGOING === a0) {
return intl.string(t.k1K15p);
}
if (AbortCodes.RELATIONSHIP_INCOMING_BLOCKED !== a0 && AbortCodes.RELATIONSHIP_INVALID_SELF !== a0 && AbortCodes.RELATIONSHIP_INVALUD_USER_BOT !== a0) {
AbortCodes.RELATIONSHIP_INVALID_DISCORD_TAG;
}
return intl.string(t.paDJBM);
}
return intl.string(t.EouHwv);
};
c5833_6 = /^\d+$/;
c5833_7 = /^(.+?@.+?\..+?|.+?#\d{4})$/;
c5833_8 = /^[a-zA-Z0-9_\\.]+$/;
export { validateDiscordTag };
export function isValidDiscordTag(a0) {
return validateDiscordTag(a0) == null;
}
export { humanizeAbortCode };
export function humanizeAbortCodeForA11y(a0, a1) {
let r9 = humanizeAbortCode(a0, a1);
if (a0 === AbortCodes.RELATIONSHIP_INCOMING_DISABLED) {
r9 = intl.formatToPlainString(t["ihb+UW"], {
discordTag: a1
});
}
Module38(typeof r9 === "string", "abortCode should be a string for a11y");
return r9;
}
+89
View File
@@ -0,0 +1,89 @@
// Metro module 1941 (f1942).
import { $forInKeys } from "../_hermes/prelude";
export function areArraysShallowlyEqual(a0, a1) {
if (a0 === a1) {
return true;
}
if (a0 != null && a1 != null && a0.length === a1.length) {
const length = a0.length;
let r0 = 0;
while (r0 < length) {
const r8 = a0[r0];
const r11 = a1[r0];
const r1 = r0;
if (r8 !== r11) {
return false;
}
r0 = r1 + 1;
}
return true;
}
return false;
}
export function cachedFunction(c13357_0) {
let c13357_1 = null;
let c13357_2 = null;
return function(...args) {
let r23;
const r12 = c13357_1;
let r4 = true;
if (r12 !== args) {
const r8 = r12 == null;
r4 = false;
if (!r8) {
const r18 = args == null;
r4 = false;
if (!r18) {
const length2 = r12.length;
const length = args.length;
r4 = false;
if (length2 === length) {
const length3 = r12.length;
const r20 = 0 < length3;
let r0 = 0;
r4 = true;
if (r20) {
do {
const r14 = r12[r0];
const r21 = args[r0];
const r1 = r0;
r4 = false;
if (r14 !== r21) {
break;
}
const r22 = r1 + 1;
r23 = r22 < length3;
r0 = r22;
r4 = true;
} while (r23);
}
}
}
}
}
if (!r4) {
c13357_2 = c13357_0.apply(void 0, [...args]);
}
c13357_1 = args;
return c13357_2;
};
}
export function clearObject(a0) {
for (const key in a0) {
if (a0.hasOwnProperty(key)) {
delete a0[key];
}
}
}
export function isPlainObjectEmpty(a0) {
const r5 = $forInKeys(a0);
let r0 = 0;
const length = r5.length;
if (r5 !== void 0) {
const r3 = r0 < length ? r5[r0++] : void 0;
if (r3 !== void 0) {
return false;
}
}
return true;
}
+46
View File
@@ -0,0 +1,46 @@
// Metro module 9598 (f9599).
import { SearchTypes } from "../Constants";
export function isKlipyProvider(a0) {
return a0 === "Klipy";
}
export function shouldUseAnimatedWebPThumbnail(a0) {
return a0 === "Klipy";
}
export function getGIFThumbnailForFavorite(a0) {
if (a0.providerName === "Klipy") {
const thumbnail = a0.thumbnail;
if (thumbnail != null) {
let proxyURL = thumbnail.proxyURL;
if (proxyURL == null) {
proxyURL = thumbnail.url;
}
if (proxyURL == null) {
proxyURL = thumbnail.uri;
}
return proxyURL;
}
}
}
export function calculateAnalyticsMetadata(a0, a1, a2) {
let modifiers;
if (a1 != null) {
const r2 = {};
r2[a1] = 1;
modifiers = r2;
} else {
modifiers = {};
}
const r12 = a2 == null ? {} : a2;
const { offset, limit, results, totalResults } = r12;
return {
search_type: SearchTypes.GIF,
load_id: a0,
limit,
offset,
page: limit != null ? offset != null ? Math.floor(offset / limit) + 1 : 1 : 1,
total_results: totalResults,
page_results: results ?? null,
num_modifiers: Object.keys(modifiers).length,
modifiers
};
}
+18
View File
@@ -0,0 +1,18 @@
// Metro module 8484 (f8485).
let c5434_0 = "not supported";
const r11 = {
waitSubscribed: () => Promise.resolve(),
waitParentSubscribed: () => Promise.resolve(),
waitConnected: () => Promise.resolve(),
waitParentConnected: () => Promise.resolve(),
isLaunchable: () => Promise.resolve(false),
isGameLaunchable: () => Promise.resolve(false),
launch: () => Promise.reject(new Error(c5434_0)),
launchDispatchApplication: () => Promise.reject(new Error(c5434_0)),
removeShortcuts: () => Promise.resolve(false),
createShortcuts: () => Promise.resolve(false),
launchGame: () => Promise.reject(new Error(c5434_0)),
isProtocolRegistered: () => Promise.resolve(false),
setRecentGames: () => {}
};
export default r11;
+521
View File
@@ -0,0 +1,521 @@
// Metro module 4424 (f4425).
import PremiumPaymentModalStore from "../stores/PremiumPaymentModalStore";
import UserStore from "../stores/UserStore";
import { AbortCodes, MessageTypes, MessageEmbedTypes, Endpoints, AnalyticEvents, GiftCodeModalStates } from "../Constants";
import { PremiumTypes, SubscriptionIntervalTypes } from "../modules/premium/PremiumConstants";
import RegexUtils from "./RegexUtils";
import { isMobile, isTablet } from "../_bundle/Module4426";
import { httpGetWithCountryCodeQuery } from "./StoreUtils";
import AnalyticsUtils from "./AnalyticsUtils";
import V6OrEarlierAPIError from "../errors/V6OrEarlierAPIError";
import getAnalyticsDataForSKU from "../modules/game_store/getAnalyticsDataForSKU";
import { intl, t } from "../intl/index.native";
import { match } from "../_bundle/Module4389";
import { isNotNullish } from "./GlobalUtils";
import { useStateFromStores } from "../_bundle/Module589";
import { isPremiumExactly } from "./PremiumUtils";
function $mk74593($env) {
return () => `[abcdefghjkmnpqrstuvwxyzABCDEFGHJKMNPQRSTUVWXYZ23456789]{${$env[0]}}`;
}
function $mk74595($env) {
return () => {
const r1 = $env.$parent;
const r2 = r1[0];
const r6 = r1[2];
return r2(r6[12]).intl.formatToPlainString(r2(r6[12]).t.O2bEOt, {
intervalCount: $env[0].intervalCount
});
};
}
function $mk74596($env) {
return () => {
const r1 = $env.$parent;
const r2 = r1[0];
const r6 = r1[2];
return r2(r6[12]).intl.formatToPlainString(r2(r6[12]).t["ZEvHF+"], {
intervalCount: $env[0].intervalCount
});
};
}
function $mk74597($env) {
return () => {
const r1 = $env.$parent;
const r2 = r1[0];
const r6 = r1[2];
return r2(r6[12]).intl.formatToPlainString(r2(r6[12]).t.gjKbF4, {
intervalCount: $env[0].intervalCount
});
};
}
function $mk74598($env) {
return () => {
const r1 = $env.$parent;
const r2 = r1[0];
const r6 = r1[2];
return r2(r6[12]).intl.formatToPlainString(r2(r6[12]).t.GIe7Bw, {
intervalCount: $env[0].intervalCount
});
};
}
let c2648_15, c2649_0, c2650_0, c2651_0, c2648_16, c2648_17;
let $mk74599 = function() {
return () => intl.string(t["5ayf7w"]);
};
let env2649;
let env2650;
let env2651;
let env2648 = {};
export function getGiftCodeRedeemError({ code }, a1) {
if (AbortCodes.INVALID_GIFT_SELF_REDEMPTION === code) {
return intl.string(t.wa9h7F);
}
if (AbortCodes.INVALID_GIFT_REDEMPTION_EXHAUSTED === code) {
return intl.string(t.Iw2TUW);
}
if (AbortCodes.INVALID_GIFT_REDEMPTION_OWNED === code) {
return intl.string(t.mdLtb5);
}
if (AbortCodes.UNKNOWN_GIFT_CODE === code) {
return intl.string(t.roztIr);
}
if (AbortCodes.INVALID_GIFT_REDEMPTION_SUBSCRIPTION_INCOMPATIBLE === code) {
return intl.formatToPlainString(t["4YTHKw"], {
planName: isPremiumExactly(a1, PremiumTypes.TIER_2) ? intl.string(t.lG6a5x) : intl.string(t.FSOz78)
});
}
if (AbortCodes.INVALID_GIFT_REDEMPTION_SUBSCRIPTION_MANAGED === code) {
return intl.string(t["9i1J30"]);
}
if (AbortCodes.INVALID_GIFT_REDEMPTION_INVOICE_OPEN === code) {
return intl.string(t["U26WX+"]);
}
if (AbortCodes.INVALID_GIFT_REDEMPTION_FRAUD_REJECTED === code) {
return intl.string(t.ypuSd8);
}
if (AbortCodes.BILLING_NON_REFUNDABLE_PAYMENT_SOURCE === code) {
return intl.string(t.mXMmWE);
}
return intl.string(t["s9+XlB"]);
}
c2648_15 = new RegExp(`(?: |^|https?://)(?:${[RegexUtils.escape(window.GLOBAL_ENV.GIFT_CODE_HOST), ...["discordapp.com/gifts", "discord.com/gifts"].map((item) => RegexUtils.escape(item))].join("|")})/([a-z0-9-]+)`, "gi");
new RegExp(`(?: |^|https?://)(?:${[...["discord.com/billing/promotions", "promos.discord.gg"].map((item) => RegexUtils.escape(item))].join("|")})(/|(/)?\\?code=)([a-z0-9-]+)`, "gi");
const r84 = env2649 = {};
c2649_0 = 4;
const r96 = [Array(4).fill(void 0).map($mk74593(r84)).join("-?"), , , ,];
const r97 = env2650 = {};
c2650_0 = 4;
r96[1] = Array(6).fill(void 0).map($mk74593(r97)).join("-?");
const r108 = env2651 = {};
c2651_0 = 5;
r96[2] = Array(3).fill(void 0).map($mk74593(r108)).join("-?");
r96[3] = "[a-zA-Z]{4}-?[0-9a-zA-Z]{4}-?[a-zA-Z]{4}";
c2648_16 = new RegExp(`^(WUMP-?)?(${r96.join("|")})\$`);
c2648_17 = {
DEFAULT: 0,
0: "DEFAULT",
CUSTOM_STYLE: 1,
1: "CUSTOM_STYLE",
CUSTOM_MESSAGE_EMOJI_SOUNDBOARD: 2,
2: "CUSTOM_MESSAGE_EMOJI_SOUNDBOARD"
};
export { c2648_17 as GiftExperience };
export function getGiftExperience(a0, a1) {
let CUSTOM_STYLE;
L8: {
if (!isMobile && !isTablet) {
if (a0 == null && !a1) {
CUSTOM_STYLE = c2648_17.CUSTOM_STYLE;
break L8;
}
CUSTOM_STYLE = c2648_17.CUSTOM_MESSAGE_EMOJI_SOUNDBOARD;
} else {
CUSTOM_STYLE = c2648_17.DEFAULT;
}
}
return CUSTOM_STYLE;
}
export function shouldShowCustomGiftExperience(a0) {
let r13, CUSTOM_MESSAGE_EMOJI_SOUNDBOARD;
L7: {
if (!isMobile && !isTablet) {
if (a0 != null) {
CUSTOM_MESSAGE_EMOJI_SOUNDBOARD = c2648_17.CUSTOM_MESSAGE_EMOJI_SOUNDBOARD;
r13 = c2648_17;
break L7;
}
r13 = c2648_17;
CUSTOM_MESSAGE_EMOJI_SOUNDBOARD = r13.CUSTOM_STYLE;
} else {
CUSTOM_MESSAGE_EMOJI_SOUNDBOARD = c2648_17.DEFAULT;
r13 = c2648_17;
}
}
return CUSTOM_MESSAGE_EMOJI_SOUNDBOARD !== r13.DEFAULT;
}
export function makeComboId(a0, r6 = null) {
if (r6 == null) {
r6 = "";
}
let r5 = arguments[2];
if (r5 == null) {
r5 = "";
}
return `${a0}:${r6}:${r5}`;
}
export function parseComboId(a0) {
const [skuId, r6, r7] = a0.split(":");
return {
skuId,
subscriptionPlanId: r6 !== "" ? r6 : null,
giftStyle: r7 !== "" ? r7 != null ? Number.parseInt(r7) : void 0 : void 0
};
}
export function cleanCode(a0) {
return a0.replace(/[^A-Za-z0-9]/g, "");
}
export function isGiftCodeEmbed(a0) {
return a0?.type === MessageTypes.CUSTOM_GIFT && (a0 == null ? void 0 : a0.embeds?.length) === 1 && (a0 == null ? void 0 : a0.embeds[0].type) === MessageEmbedTypes.GIFT;
}
export function findGiftCodes(a0) {
let size;
if (a0 == null) {
return [];
}
const set = new Set();
let r18 = c2648_15.exec(a0);
if (r18 != null && set.size < 3) {
do {
set.add(r18[1].replace(/[^A-Za-z0-9]/g, ""));
const r25 = c2648_15.exec(a0);
if (r25 == null) {
break;
}
size = set.size;
r18 = r25;
} while (size < 3);
}
return Array.from(set);
}
export function getGiftCodeURL(r7 = "") {
let r5, r6;
const GIFT_CODE_HOST = window.GLOBAL_ENV.GIFT_CODE_HOST;
if (GIFT_CODE_HOST != null) {
r5 = `/${r7}`;
r6 = GIFT_CODE_HOST;
} else {
r6 = location.host;
r5 = `/gifts/${r7}`;
}
return `${location.protocol}//${r6}${r5}`;
}
export async function resolveGiftCode(c25172_0, c25172_1, c25172_2) {
let r36, r114;
let c25172_5;
let c25172_6 = 0;
let c29337_1, c29337_2, c29337_0, c29337_3, c29337_4;
try {
L13: {
L10: {
c29337_1 = void 0;
c29337_2 = void 0;
c29337_0 = c25172_0;
if (c25172_1 !== void 0) {
c29337_1 = c25172_1;
r36 = c25172_2;
if (r36 !== void 0) {
break L10;
}
} else {
c29337_1 = false;
r36 = c25172_2;
if (r36 !== void 0) {
break L10;
}
}
c29337_2 = false;
c29337_3 = void 0;
break L13;
}
c29337_2 = r36;
c29337_3 = void 0;
}
await void 0;
c25172_6 = 1;
c29337_3 = (await httpGetWithCountryCodeQuery({
url: Endpoints.GIFT_CODE_RESOLVE(c29337_0),
query: {
with_application: c29337_1,
with_subscription_plan: c29337_2
},
oldFormErrors: true,
rejectWithError: false
})).body;
AnalyticsUtils.track(AnalyticEvents.GIFT_CODE_RESOLVED, {
resolved: true,
gift_code: c29337_3.code,
gift_code_max_uses: c29337_3.max_uses,
sku_id: c29337_3.store_listing.sku.id,
sku_type: c29337_3.store_listing.sku.type,
application_id: c29337_3.store_listing.sku.application_id,
store_title: c29337_3.store_listing.sku.name
}, {
flush: true
});
r114 = c29337_3;
c25172_6 = 0;
} catch ($e) {
const r32 = $e;
let r8 = r32;
c25172_5 = r32;
if (c25172_6 !== 0) {
while (true) {
try {
const r123 = c25172_5;
c25172_6 = 0;
c29337_4 = r123;
AnalyticsUtils.track(AnalyticEvents.GIFT_CODE_RESOLVED, {
resolved: false,
gift_code: c29337_0
});
throw new V6OrEarlierAPIError(c29337_4);
} catch (r119) {
r8 = r119;
c25172_5 = r119;
if (c25172_6 === 0) {
break;
}
}
}
}
throw r8;
}
return r114;
}
export function trackGiftCodeCopy(a0, a1) {
AnalyticsUtils.track(AnalyticEvents.GIFT_CODE_COPIED, {
...getAnalyticsDataForSKU(a1, false, false),
...a0.analyticsData
});
}
export function getStep(a0, a1, a2) {
let OPEN, SUCCESS;
L17: {
L16: {
const { error, accepted, accepting, opened, isCustomGift } = a2;
if (error == null) {
if (!accepted && !accepting && a0 != null) {
break L16;
}
if (isCustomGift && !opened && !accepted && !accepting) {
OPEN = GiftCodeModalStates.OPEN;
break L17;
}
L14: {
L12: {
if (accepted) {
if (!a1.isSubscription && a0 == null) {
break L12;
}
SUCCESS = GiftCodeModalStates.SUCCESS;
break L14;
}
}
SUCCESS = GiftCodeModalStates.CONFIRM;
}
OPEN = SUCCESS;
break L17;
}
}
OPEN = GiftCodeModalStates.ERROR;
}
return OPEN;
}
export function getHeaderText(a0, a1, a2) {
if (GiftCodeModalStates.ERROR === a0) {
return intl.formatToMarkdownString(t.JUvC0s, {});
}
if (GiftCodeModalStates.SUCCESS === a0) {
return a1.isSubscription ? intl.formatToPlainString(t["1C2BG/"], {
skuName: a2.name
}) : intl.string(t["+BNMcF"]);
}
GiftCodeModalStates.CONFIRM;
return a1.isSubscription ? intl.formatToPlainString(t["2VN4N9"], {
skuName: a2.name
}) : intl.string(t.RmamAI);
}
export function getButtonText(a0, a1, { isCustomGift }) {
if (GiftCodeModalStates.ERROR === a0) {
return intl.string(t.w19zb6);
}
if (GiftCodeModalStates.SUCCESS === a0) {
return intl.string(t.zW87EM);
}
if (GiftCodeModalStates.OPEN === a0) {
return intl.string(t.F8ktci);
}
GiftCodeModalStates.CONFIRM;
return isCustomGift != null && isCustomGift ? intl.string(t.n6I6k4) : a1.giftStyle != null ? a1.isClaimed ? intl.string(t.OgpR0c) : intl.string(t["2BWscv"]) : a1.isSubscription ? intl.string(t.wQ1FHy) : intl.string(t.OgpR0c);
}
export function getSubscriptionGiftSuccessText(a0) {
let env14269;
const r2 = env14269 = {
$parent: env2648
};
env14269[0] = a0;
return match(a0).with({
interval: SubscriptionIntervalTypes.MONTH,
premiumSubscriptionType: PremiumTypes.TIER_2
}, $mk74595(r2)).with({
interval: SubscriptionIntervalTypes.YEAR,
premiumSubscriptionType: PremiumTypes.TIER_2
}, $mk74596(r2)).with({
interval: SubscriptionIntervalTypes.MONTH,
premiumSubscriptionType: PremiumTypes.TIER_1
}, $mk74597(r2)).with({
interval: SubscriptionIntervalTypes.YEAR,
premiumSubscriptionType: PremiumTypes.TIER_1
}, $mk74598(r2)).otherwise($mk74599());
}
export function getSubscriptionGiftStartHeaderText(a0, a1, a2) {
const username = a1;
const skuName = a2;
if (a2 == null) {
return a1 != null ? intl.formatToPlainString(t.td2m3W, {
sender: a1
}) : intl.string(t.hrnGng);
}
const intervalCount = a0.intervalCount;
return a1 != null ? match(a0).with({
interval: SubscriptionIntervalTypes.MONTH
}, () => intl.formatToPlainString(t["/RDIEA"], {
username,
skuName,
intervalCount
})).with({
interval: SubscriptionIntervalTypes.YEAR
}, () => intl.formatToPlainString(t["3CX6Ev"], {
username,
skuName,
intervalCount
})).otherwise(() => intl.formatToPlainString(t.td2m3W, {
sender: username
})) : match(a0).with({
interval: SubscriptionIntervalTypes.MONTH
}, () => intl.formatToPlainString(t["2O4lo5"], {
skuName,
intervalCount
})).with({
interval: SubscriptionIntervalTypes.YEAR
}, () => intl.formatToPlainString(t["+XjmsR"], {
skuName,
intervalCount
})).otherwise(() => intl.string(t.hrnGng));
}
export function getBodyText({ step, sku, libraryApplication, error, accepted, accepting, onGoToLibrary, subscriptionPlan = null }) {
let r33, r34, r64, P9eTKt;
if (GiftCodeModalStates.ERROR === step) {
const r100 = accepted ? void 0 : accepting ? void 0 : libraryApplication;
let r112 = intl.format(t["5zyz9y"], {
onGoToLibrary
});
if (r100 == null) {
r112 = error == null ? null : getGiftCodeRedeemError(error, UserStore.getCurrentUser());
}
return r112;
}
if (GiftCodeModalStates.SUCCESS === step) {
if (subscriptionPlan != null) {
let env14271;
const r65 = env14271 = {
$parent: env2648
};
env14271[0] = subscriptionPlan;
r64 = match(subscriptionPlan).with({
interval: SubscriptionIntervalTypes.MONTH,
premiumSubscriptionType: PremiumTypes.TIER_2
}, $mk74595(r65)).with({
interval: SubscriptionIntervalTypes.YEAR,
premiumSubscriptionType: PremiumTypes.TIER_2
}, $mk74596(r65)).with({
interval: SubscriptionIntervalTypes.MONTH,
premiumSubscriptionType: PremiumTypes.TIER_1
}, $mk74597(r65)).with({
interval: SubscriptionIntervalTypes.YEAR,
premiumSubscriptionType: PremiumTypes.TIER_1
}, $mk74598(r65)).otherwise($mk74599());
} else {
r64 = intl.formatToPlainString(t["3CPsbo"], {
skuName: sku.name
});
}
return r64;
}
GiftCodeModalStates.CONFIRM;
if (subscriptionPlan != null) {
if (subscriptionPlan.interval === SubscriptionIntervalTypes.MONTH) {
P9eTKt = t.P9eTKt;
r34 = dependencyMap;
r33 = require;
} else {
r33 = require;
r34 = dependencyMap;
P9eTKt = r33(r34[12]).t.d8rUdy;
}
return r33(r34[12]).intl.format(P9eTKt, {
skuName: sku.name,
intervalCount: subscriptionPlan.intervalCount
});
}
return intl.formatToPlainString(t.l6Ea4Z, {
skuName: sku.name
});
}
export function getErrorMessage(a0, a1, a2, a3, a4) {
const r5 = a2 ? void 0 : a3 ? void 0 : a0;
let r18 = intl.format(t["5zyz9y"], {
onGoToLibrary: a4
});
if (r5 == null) {
r18 = a1 == null ? null : getGiftCodeRedeemError(a1, UserStore.getCurrentUser());
}
return r18;
}
export function firstLibraryApplicationForGiftCode(a0, a1, c14272_0) {
let r2 = a0;
const applicationId = a1.applicationId;
if (!(a0.length > 0)) {
r2 = [applicationId];
}
const r19 = r2.map((item) => c14272_0.getLibraryApplication(applicationId, item, true)).filter(isNotNullish);
return r19.length === r2.length ? r19[0] : null;
}
export function processGiftCodeInput(a0) {
const r20 = a0.trim().split("/").pop().match(c2648_16);
if (r20 == null) {
return null;
}
const [, , r7] = r20;
return r7 == null ? null : r7.replace(new RegExp("-", "g"), "");
}
export function useGetGiftCode(c14273_0, c14273_1) {
return useStateFromStores([PremiumPaymentModalStore], () => {
if (c14273_0 != null && c14273_1) {
const giftCode = PremiumPaymentModalStore.getGiftCode(c14273_0);
return giftCode == null ? null : giftCode !== "" ? giftCode : null;
}
return null;
});
}
export function trackStep({ step, giftCode, customMessage, emojiName, soundId, productLine }) {
AnalyticsUtils.track(AnalyticEvents.GIFT_ACCEPT_STEP, {
to_step: step,
has_custom_message: giftCode.giftStyle != null,
is_custom_message_edited: giftCode.giftStyle != null && customMessage !== intl.string(t.ZkOo1U),
gift_style: giftCode.giftStyle,
gift_code: giftCode.code,
emoji_name: emojiName,
sound_id: soundId,
product_line: productLine
});
}
+23
View File
@@ -0,0 +1,23 @@
// Metro module 1351 (f1352).
let c1123_0 = window.GLOBAL_ENV.PROJECT_ENV === "development";
export function isDiscordFrontendDevelopment() {
return false;
}
export function isDiscordBackendDevelopment() {
return c1123_0;
}
export function assertNever(a0) {
throw new Error(`Unhandled value: ${a0}`);
}
export function isNotNullish(a0) {
return a0 != null;
}
export function isIn(a0, a1) {
return a1.includes(a0);
}
export function isInSet(a0, a1) {
return a1.has(a0);
}
export function isObjectEntryNotNullish(a0) {
return a0[1] != null;
}
+669
View File
@@ -0,0 +1,669 @@
// Metro module 4081 (f4082).
import GuildStore from "../stores/GuildStore";
import UserStore from "../stores/UserStore";
import GuildBoostSlotStore from "../stores/billing/GuildBoostSlotStore";
import SubscriptionStore from "../stores/billing/SubscriptionStore";
import * as _Constants from "../Constants";
import { GuildFeatures, MAX_STAGE_VIDEO_USER_LIMIT_TIER2, HelpdeskArticles, MAX_STAGE_VIDEO_USER_LIMIT_TIER3, AnalyticsObjectTypes, SubscriptionStatusTypes } from "../Constants";
import { DEFAULT_EMOJI_SLOTS, EMOJI_MAX_SLOTS_MORE } from "../modules/emojis/EmojiConstants";
import { BoostedGuildFeatures, TotalStickerCountsByTier, IncrementalStickerCountsByTier, MORE_SOUNDBOARD_SOUNDS, TotalSoundboardSoundCountsByTier, FractionalPremiumStates, DEFAULT_SOUND_SLOTS } from "../modules/premium/PremiumConstants";
import { getPremiumGroupProductName } from "../modules/premium/premium_group/PremiumGroupConstants";
import { PremiumGuildOverrides } from "../_bundle/Module4083";
import * as _index_native from "../intl/index.native";
import { intl } from "../intl/index.native";
import { isNotNullish } from "./GlobalUtils";
import { formatSize } from "./FileSizeUtils";
import HelpdeskUtils from "./HelpdeskUtils";
import Module12 from "../_bundle/Module12";
import Module3771 from "../_bundle/Module3771";
import { fetchGuildBoostSlots } from "../actions/BoostingActionCreators";
import PremiumGroup_messages from "../modules/premium/premium_group/PremiumGroup.messages";
import { getNumPremiumGuildSubscriptions } from "./PremiumUtils";
import SentryUtils_native from "./SentryUtils.native";
import { getGuildPowerupsBoostCount } from "../modules/premium/powerups/hooks/useGuildPowerupsBoostCount";
import { getGuildPowerupBoostLevelProgress } from "../modules/premium/powerups/hooks/useGuildPowerupsBoostLevelProgress";
function $mk73565() {
return (a0) => a0.isAvailable();
}
function $mk73566() {
return (a0) => a0.endsAt != null;
}
function $mk73567($env) {
return (a0) => $env[0] >= $env.$parent[9][a0];
}
function $mk73568($env) {
return (a0) => $env[0] < $env.$parent[9][a0];
}
let c2346_26, c2346_27, c2346_28, c2346_29, c2346_31, c2346_32;
let env2346 = {};
export function getGuildTierFromGuild(a0) {
let r7 = GuildStore.getGuild(a0)?.premiumTier;
if (r7 == null) {
r7 = _Constants.BoostedGuildTiers.NONE;
}
return r7;
}
const { AppliedGuildBoostsRequiredForBoostedGuildTier: AppliedGuildBoostsRequiredForBoostedGuildTier2, BoostedGuildTiers: BoostedGuildTiers2 } = _Constants;
const r59 = {
LEVEL_1: 1,
1: "LEVEL_1",
LEVEL_2: 2,
2: "LEVEL_2",
LEVEL_3: 3,
3: "LEVEL_3",
LEVEL_4: 4,
4: "LEVEL_4",
LEVEL_5: 5,
5: "LEVEL_5",
LEVEL_6: 6,
6: "LEVEL_6",
LEVEL_7: 7,
7: "LEVEL_7",
LEVEL_8: 8,
8: "LEVEL_8",
LEVEL_9: 9,
9: "LEVEL_9"
};
const r69 = Object;
const r71 = {};
r71[r59.LEVEL_1] = 1;
r71[r59.LEVEL_2] = 2;
r71[r59.LEVEL_3] = 3;
r71[r59.LEVEL_4] = 6;
r71[r59.LEVEL_5] = 9;
r71[r59.LEVEL_6] = 12;
r71[r59.LEVEL_7] = 15;
r71[r59.LEVEL_8] = 18;
r71[r59.LEVEL_9] = 24;
c2346_26 = r69.freeze(r71);
c2346_27 = {
EMOJI: 1,
1: "EMOJI",
AUDIO: 2,
2: "AUDIO",
ANIMATED: 3,
3: "ANIMATED",
CUSTOMIZATION: 4,
4: "CUSTOMIZATION",
UPLOAD: 5,
5: "UPLOAD",
VANITY: 6,
6: "VANITY",
STREAM: 7,
7: "STREAM",
STICKER: 8,
8: "STICKER",
CUSTOM_ROLE_ICON: 11,
11: "CUSTOM_ROLE_ICON",
STAGE_VIDEO: 12,
12: "STAGE_VIDEO",
SOUNDBOARD: 13,
13: "SOUNDBOARD"
};
c2346_28 = [BoostedGuildTiers2.NONE, BoostedGuildTiers2.TIER_1, BoostedGuildTiers2.TIER_2, BoostedGuildTiers2.TIER_3];
c2346_29 = c2346_28.slice().reverse();
const r112 = Module12.memoize((a0) => BoostedGuildFeatures[_Constants.BoostedGuildTiers.TIER_1].features.includes(a0) ? _Constants.BoostedGuildTiers.TIER_1 : BoostedGuildFeatures[_Constants.BoostedGuildTiers.TIER_2].features.includes(a0) ? _Constants.BoostedGuildTiers.TIER_2 : BoostedGuildFeatures[_Constants.BoostedGuildTiers.TIER_3].features.includes(a0) ? _Constants.BoostedGuildTiers.TIER_3 : null);
c2346_31 = [{
tier: BoostedGuildTiers2.TIER_3,
amount: AppliedGuildBoostsRequiredForBoostedGuildTier2[BoostedGuildTiers2.TIER_3],
nextTier: null
}, {
tier: BoostedGuildTiers2.TIER_2,
amount: AppliedGuildBoostsRequiredForBoostedGuildTier2[BoostedGuildTiers2.TIER_2],
nextTier: BoostedGuildTiers2.TIER_3
}, {
tier: BoostedGuildTiers2.TIER_1,
amount: AppliedGuildBoostsRequiredForBoostedGuildTier2[BoostedGuildTiers2.TIER_1],
nextTier: BoostedGuildTiers2.TIER_2
}];
const r127 = {};
r127[BoostedGuildTiers2.NONE] = 0;
r127[BoostedGuildTiers2.TIER_1] = 0.3333333333333333;
r127[BoostedGuildTiers2.TIER_2] = 0.6666666666666666;
r127[BoostedGuildTiers2.TIER_3] = 1;
c2346_32 = r127;
export { c2346_27 as PerkIcons };
export { c2346_28 as OrderedTiers };
export { c2346_29 as ReverseOrderedTiers };
export function getNextTier(a0) {
return a0 === _Constants.BoostedGuildTiers.NONE ? _Constants.BoostedGuildTiers.TIER_1 : c2346_31.find((item) => item.tier === a0)?.nextTier;
}
export function getTotalStickerCountForTier(a0, a1) {
return a1 != null && (a1.features.has(GuildFeatures.MORE_STICKERS) && a0 === _Constants.BoostedGuildTiers.TIER_3) ? PremiumGuildOverrides.MAX_STICKER_SLOTS : TotalStickerCountsByTier[a0];
}
export function getIncrementalStickerCountForTier(a0) {
return IncrementalStickerCountsByTier[a0];
}
export function getTotalSoundboardSoundCountForTier(a0, a1) {
return a1 != null && a1.features.has(GuildFeatures.MORE_SOUNDBOARD) ? MORE_SOUNDBOARD_SOUNDS : TotalSoundboardSoundCountsByTier[a0];
}
export function getIncrementalSoundboardSoundCountForTier(a0) {
if (a0 === _Constants.BoostedGuildTiers.NONE) {
return TotalSoundboardSoundCountsByTier[a0];
}
return TotalSoundboardSoundCountsByTier[a0] - TotalSoundboardSoundCountsByTier[c2346_28[c2346_28.indexOf(a0) - 1]];
}
export const getTiers = (a0) => {
let TotalSoundboardSoundCountsByTier2, soundCount, soundCount2, soundCount3;
const r5 = {
tier: _Constants.BoostedGuildTiers.TIER_1,
title: intl.string(_index_native.t["lK+WOT"]),
perks: null
};
const dnLAwl = _index_native.t.dnLAwl;
const r45 = {
adding: BoostedGuildFeatures[_Constants.BoostedGuildTiers.TIER_1].limits.emoji - BoostedGuildFeatures[_Constants.BoostedGuildTiers.NONE].limits.emoji,
total: BoostedGuildFeatures[_Constants.BoostedGuildTiers.TIER_1].limits.emoji
};
const r63 = [{
title: intl.formatToPlainString(dnLAwl, r45),
description: intl.string(_index_native.t["/Guvxs"]),
icon: c2346_27.EMOJI
}, {
title: intl.formatToPlainString(_index_native.t["/9p2/g"], {
adding: IncrementalStickerCountsByTier[_Constants.BoostedGuildTiers.TIER_1],
total: TotalStickerCountsByTier[_Constants.BoostedGuildTiers.TIER_1]
}),
description: intl.string(_index_native.t.JfsnDQ),
icon: c2346_27.STICKER
}, , , , , ,];
const NRuk5m = _index_native.t.NRuk5m;
const TIER_1 = _Constants.BoostedGuildTiers.TIER_1;
if (TIER_1 === _Constants.BoostedGuildTiers.NONE) {
soundCount2 = TotalSoundboardSoundCountsByTier[TIER_1];
TotalSoundboardSoundCountsByTier2 = TotalSoundboardSoundCountsByTier;
} else {
const r102 = c2346_28[c2346_28.indexOf(TIER_1) - 1];
TotalSoundboardSoundCountsByTier2 = TotalSoundboardSoundCountsByTier;
soundCount2 = TotalSoundboardSoundCountsByTier2[TIER_1] - TotalSoundboardSoundCountsByTier2[r102];
}
r63[2] = {
title: intl.formatToPlainString(NRuk5m, {
soundCount: soundCount2,
totalSoundCount: TotalSoundboardSoundCountsByTier2[_Constants.BoostedGuildTiers.TIER_1]
}),
description: intl.string(_index_native.t.Oq7OVl),
icon: c2346_27.SOUNDBOARD
};
r63[3] = {
title: intl.formatToPlainString(_index_native.t.zoT1ZE, {
bitrate: BoostedGuildFeatures[_Constants.BoostedGuildTiers.TIER_1].limits.bitrate / 1000
}),
description: intl.string(_index_native.t["8a03jk"]),
icon: c2346_27.AUDIO
};
r63[4] = {
title: intl.string(_index_native.t.h0s84V),
description: intl.format(_index_native.t["t+0cbk"], {}),
icon: c2346_27.ANIMATED
};
r63[5] = {
title: intl.string(_index_native.t.vjPGPp),
description: intl.string(_index_native.t.tG4MMU),
icon: c2346_27.CUSTOMIZATION
};
r63[6] = {
title: intl.string(_index_native.t.cObMZD),
description: intl.string(_index_native.t["puH/9R"]),
icon: c2346_27.STREAM
};
r5.perks = r63.filter(isNotNullish);
const r214 = [r5, , ,];
const r216 = {
tier: _Constants.BoostedGuildTiers.TIER_2,
title: intl.string(_index_native.t["34GpBc"]),
perks: null
};
const r259 = [{
title: intl.formatToPlainString(_index_native.t.dnLAwl, {
adding: BoostedGuildFeatures[_Constants.BoostedGuildTiers.TIER_2].limits.emoji - BoostedGuildFeatures[_Constants.BoostedGuildTiers.TIER_1].limits.emoji,
total: BoostedGuildFeatures[_Constants.BoostedGuildTiers.TIER_2].limits.emoji
}),
description: intl.string(_index_native.t.fRiNhw),
icon: c2346_27.EMOJI
}, {
title: intl.formatToPlainString(_index_native.t["/9p2/g"], {
adding: IncrementalStickerCountsByTier[_Constants.BoostedGuildTiers.TIER_2],
total: TotalStickerCountsByTier[_Constants.BoostedGuildTiers.TIER_2]
}),
description: intl.string(_index_native.t.t4TM28),
icon: c2346_27.STICKER
}, , , , , , , ,];
const NRuk5m2 = _index_native.t.NRuk5m;
const TIER_2 = _Constants.BoostedGuildTiers.TIER_2;
if (TIER_2 === _Constants.BoostedGuildTiers.NONE) {
soundCount = TotalSoundboardSoundCountsByTier2[TIER_2];
} else {
soundCount = TotalSoundboardSoundCountsByTier2[TIER_2] - TotalSoundboardSoundCountsByTier2[c2346_28[c2346_28.indexOf(TIER_2) - 1]];
}
r259[2] = {
title: intl.formatToPlainString(NRuk5m2, {
soundCount,
totalSoundCount: TotalSoundboardSoundCountsByTier2[_Constants.BoostedGuildTiers.TIER_2]
}),
description: intl.string(_index_native.t.pEYlPZ),
icon: c2346_27.SOUNDBOARD
};
r259[3] = {
title: intl.formatToPlainString(_index_native.t.zoT1ZE, {
bitrate: BoostedGuildFeatures[_Constants.BoostedGuildTiers.TIER_2].limits.bitrate / 1000
}),
description: intl.string(_index_native.t["nzRo/I"]),
icon: c2346_27.AUDIO
};
r259[4] = {
title: intl.string(_index_native.t["+KhQKM"]),
description: intl.string(_index_native.t.ZWf10P),
icon: c2346_27.CUSTOMIZATION
};
r259[5] = {
title: intl.formatToPlainString(_index_native.t.t95LnM, {
fileSize: formatSize(BoostedGuildFeatures[_Constants.BoostedGuildTiers.TIER_2].limits.fileSize / 1024, {
useKibibytes: true
})
}),
description: intl.format(_index_native.t.yvht65, {}),
icon: c2346_27.UPLOAD
};
r259[6] = {
title: intl.string(_index_native.t.bmaoNI),
description: intl.string(_index_native.t.WZW2Bj),
icon: c2346_27.STREAM
};
r259[7] = {
title: intl.string(_index_native.t.BHtqcV),
description: intl.string(_index_native.t.ukVcEe),
icon: c2346_27.CUSTOM_ROLE_ICON
};
r259[8] = a0 ? {
title: intl.formatToPlainString(_index_native.t.T8P3TH, {
limit: MAX_STAGE_VIDEO_USER_LIMIT_TIER2
}),
description: intl.formatToPlainString(_index_native.t.T8P3TH, {
limit: MAX_STAGE_VIDEO_USER_LIMIT_TIER2
}),
icon: c2346_27.STAGE_VIDEO
} : null;
r216.perks = r259.filter(isNotNullish);
r214[1] = r216;
const r465 = {
tier: _Constants.BoostedGuildTiers.TIER_3,
title: intl.string(_index_native.t.P7LdcQ),
perks: null
};
const r509 = [{
title: intl.formatToPlainString(_index_native.t.dnLAwl, {
adding: BoostedGuildFeatures[_Constants.BoostedGuildTiers.TIER_3].limits.emoji - BoostedGuildFeatures[_Constants.BoostedGuildTiers.TIER_2].limits.emoji,
total: BoostedGuildFeatures[_Constants.BoostedGuildTiers.TIER_3].limits.emoji
}),
description: intl.string(_index_native.t.AfJxnV),
icon: c2346_27.EMOJI
}, {
title: intl.formatToPlainString(_index_native.t["/9p2/g"], {
adding: IncrementalStickerCountsByTier[_Constants.BoostedGuildTiers.TIER_3],
total: TotalStickerCountsByTier[_Constants.BoostedGuildTiers.TIER_3]
}),
description: intl.string(_index_native.t["+ZI4QZ"]),
icon: c2346_27.STICKER
}, , , , , , ,];
const NRuk5m3 = _index_native.t.NRuk5m;
const TIER_3 = _Constants.BoostedGuildTiers.TIER_3;
if (TIER_3 === _Constants.BoostedGuildTiers.NONE) {
soundCount3 = TotalSoundboardSoundCountsByTier2[TIER_3];
} else {
soundCount3 = TotalSoundboardSoundCountsByTier2[TIER_3] - TotalSoundboardSoundCountsByTier2[c2346_28[c2346_28.indexOf(TIER_3) - 1]];
}
r509[2] = {
title: intl.formatToPlainString(NRuk5m3, {
soundCount: soundCount3,
totalSoundCount: TotalSoundboardSoundCountsByTier2[_Constants.BoostedGuildTiers.TIER_3]
}),
description: intl.string(_index_native.t["8omJSY"]),
icon: c2346_27.SOUNDBOARD
};
r509[3] = {
title: intl.formatToPlainString(_index_native.t.zoT1ZE, {
bitrate: BoostedGuildFeatures[_Constants.BoostedGuildTiers.TIER_3].limits.bitrate / 1000
}),
description: intl.string(_index_native.t["cOkbp/"]),
icon: c2346_27.AUDIO
};
r509[4] = {
title: intl.string(_index_native.t.C2w2cM),
description: intl.format(_index_native.t["3Reosx"], {
helpdeskArticle: HelpdeskUtils.getArticleURL(HelpdeskArticles.GUILD_VANITY_URL)
}),
icon: c2346_27.VANITY
};
r509[5] = {
title: intl.formatToPlainString(_index_native.t.t95LnM, {
fileSize: formatSize(BoostedGuildFeatures[_Constants.BoostedGuildTiers.TIER_3].limits.fileSize / 1024, {
useKibibytes: true
})
}),
description: intl.format(_index_native.t.IwDqSL, {}),
icon: c2346_27.UPLOAD
};
r509[6] = {
title: intl.string(_index_native.t.z0GtBG),
description: intl.string(_index_native.t.v92GNV),
icon: c2346_27.ANIMATED
};
r509[7] = a0 ? {
title: intl.formatToPlainString(_index_native.t.T8P3TH, {
limit: MAX_STAGE_VIDEO_USER_LIMIT_TIER3
}),
description: intl.formatToPlainString(_index_native.t.T8P3TH, {
limit: MAX_STAGE_VIDEO_USER_LIMIT_TIER3
}),
icon: c2346_27.STAGE_VIDEO
} : null;
r465.perks = r509.filter(isNotNullish);
r214[2] = r465;
return r214;
};
export function getTierName(a0, r1 = {}) {
const useLevels = r1.useLevels;
const r9 = useLevels === void 0 || useLevels;
if (_Constants.BoostedGuildTiers.NONE === a0) {
return r9 ? intl.string(_index_native.t.LcKgJd) : intl.string(_index_native.t.mx8j2m);
}
if (_Constants.BoostedGuildTiers.TIER_1 === a0) {
return intl.string(_index_native.t.nzXtaS);
}
if (_Constants.BoostedGuildTiers.TIER_2 === a0) {
return intl.string(_index_native.t["h33/uW"]);
}
if (_Constants.BoostedGuildTiers.TIER_3 === a0) {
return intl.string(_index_native.t.BfF6ED);
}
throw new Error("Not a valid tier type");
}
export function getShortenedTierName(a0) {
if (_Constants.BoostedGuildTiers.NONE === a0) {
return intl.string(_index_native.t.LcKgJd);
}
if (_Constants.BoostedGuildTiers.TIER_1 === a0) {
return intl.string(_index_native.t.xRjU1V);
}
if (_Constants.BoostedGuildTiers.TIER_2 === a0) {
return intl.string(_index_native.t.C7e2Bo);
}
if (_Constants.BoostedGuildTiers.TIER_3 === a0) {
return intl.string(_index_native.t.avGxmk);
}
throw new Error("Not a valid tier type");
}
export { r112 as minimumRequiredTierForGuildFeature };
export function boostedGuildTierToAnalyticsObjectType(a0) {
if (_Constants.BoostedGuildTiers.NONE === a0) {
return AnalyticsObjectTypes.NONE;
}
if (_Constants.BoostedGuildTiers.TIER_1 === a0) {
return AnalyticsObjectTypes.TIER_1;
}
if (_Constants.BoostedGuildTiers.TIER_2 === a0) {
return AnalyticsObjectTypes.TIER_2;
}
if (_Constants.BoostedGuildTiers.TIER_3 === a0) {
return AnalyticsObjectTypes.TIER_3;
}
return null;
}
export function getNextGuildTierFromGuild(a0) {
const guildTierFromGuild = getGuildTierFromGuild(a0);
for (const item of c2346_31) {
if (guildTierFromGuild !== item.tier) {
continue;
}
return item.nextTier;
}
return _Constants.BoostedGuildTiers.TIER_1;
}
export function getAppliedGuildBoostMonths(a0) {
let r14 = Module3771().diff(Module3771(a0), "months");
if (r14 == null) {
r14 = 1;
}
return r14;
}
export function getUserLevel(a0) {
const r25 = Module3771().diff(a0, "months");
let r26 = 1;
for (const item of Object.keys(c2346_26)) {
if (!(r25 < c2346_26[item])) {
r26 = +item;
}
}
return r26;
}
export function isGuildBoostedAtLeast(a0, a1) {
return a1 == null || a0 != null && a0 >= a1;
}
export function isTierUnlocked({ premiumTier }, a1) {
return a1 == null || premiumTier != null && premiumTier >= a1;
}
export function getAvailableGuildBoostSlots(a0) {
return Module12.values(a0).filter($mk73565());
}
export function generateBlockGuildSubscriptionPurchasesNode({ fractionalState }) {
const premiumTypeSubscription = SubscriptionStore.getPremiumTypeSubscription();
const currentUser = UserStore.getCurrentUser();
if (!(GuildBoostSlotStore.hasFetched || GuildBoostSlotStore.isFetching)) {
fetchGuildBoostSlots();
}
const r31 = Module12.values(GuildBoostSlotStore.boostSlots).filter($mk73565());
const isPausedOrPausePending = premiumTypeSubscription?.isPausedOrPausePending;
const r34 = r31.length > 0;
if (isPausedOrPausePending && fractionalState === FractionalPremiumStates.NONE && !r34) {
return intl.string(_index_native.t.mOWsF1);
}
if (currentUser == null ? void 0 : currentUser.isPremiumGroupMember()) {
return intl.formatToPlainString(PremiumGroup_messages["5xN/C1"], {
premiumGroupProductName: (0, getPremiumGroupProductName)()
});
}
const r58 = Object.values(GuildBoostSlotStore.boostSlots).reduce((acc, item) => {
if (item.subscription?.status === SubscriptionStatusTypes.CANCELED || item.canceled) {
acc.numCanceledGuildBoostSlots = acc.numCanceledGuildBoostSlots + 1;
}
if (item.isAvailable()) {
acc.numAvailableGuildBoostSlots = acc.numAvailableGuildBoostSlots + 1;
}
return acc;
}, {
numAvailableGuildBoostSlots: 0,
numCanceledGuildBoostSlots: 0
});
const { numAvailableGuildBoostSlots, numCanceledGuildBoostSlots } = r58;
if (premiumTypeSubscription != null && !(numAvailableGuildBoostSlots > 0)) {
if (premiumTypeSubscription.status === SubscriptionStatusTypes.PAST_DUE) {
return intl.string(_index_native.t.De4Vm6);
}
if (premiumTypeSubscription.status === SubscriptionStatusTypes.ACCOUNT_HOLD) {
return intl.string(_index_native.t.JakNQ8);
}
if (numCanceledGuildBoostSlots > 0) {
return intl.string(_index_native.t.x25mZR);
}
if (premiumTypeSubscription.renewalMutations == null) {
return null;
}
const numPremiumGuildSubscriptions = getNumPremiumGuildSubscriptions(premiumTypeSubscription.renewalMutations.additionalPlans);
return getNumPremiumGuildSubscriptions(premiumTypeSubscription.additionalPlans) > numPremiumGuildSubscriptions ? intl.string(_index_native.t.x25mZR) : intl.string(_index_native.t["W/bb8f"]);
}
return null;
}
export function isAppliedGuildBoostActive(a0) {
const ended = a0.ended;
return ended ? !ended : a0.endsAt == null || a0.endsAt.getTime() > Date.now();
}
export function isInGracePeriod(a0, a1) {
const guild = GuildStore.getGuild(a1);
const r6 = guild == null ? void 0 : guild.features.has(GuildFeatures.PREMIUM_TIER_3_OVERRIDE);
let r15 = 0;
if (r6 !== true) {
let r19 = GuildStore.getGuild(a1)?.premiumTier;
if (r19 == null) {
r19 = _Constants.BoostedGuildTiers.NONE;
}
r15 = _Constants.AppliedGuildBoostsRequiredForBoostedGuildTier[r19] - (a0.length - a0.filter($mk73566()).length);
}
return r15 > 0;
}
export function appliedGuildBoostsRequiredForPerks(a0, a1) {
const guild = GuildStore.getGuild(a1);
if ((guild == null ? void 0 : guild.features.has(GuildFeatures.PREMIUM_TIER_3_OVERRIDE)) === true) {
return 0;
}
let r18 = GuildStore.getGuild(a1)?.premiumTier;
if (r18 == null) {
r18 = _Constants.BoostedGuildTiers.NONE;
}
return _Constants.AppliedGuildBoostsRequiredForBoostedGuildTier[r18] - (a0.length - a0.filter($mk73566()).length);
}
export { c2346_31 as GuildTierSubscriptionsOrdered };
export function getGracePeriodEndingDate(a0, a1) {
const guild = GuildStore.getGuild(a1);
const r14 = guild == null ? void 0 : guild.features.has(GuildFeatures.PREMIUM_TIER_3_OVERRIDE);
let r18 = 0;
if (r14 !== true) {
let r22 = GuildStore.getGuild(a1)?.premiumTier;
if (r22 == null) {
r22 = _Constants.BoostedGuildTiers.NONE;
}
r18 = _Constants.AppliedGuildBoostsRequiredForBoostedGuildTier[r22] - (a0.length - a0.filter($mk73566()).length);
}
if (r18 > 0) {
const r37 = a0.sort((a, b) => a.endsAt != null ? b.endsAt != null ? a.endsAt.getTime() - b.endsAt.getTime() : -1 : -1).filter((item) => item.endsAt != null);
const r39 = r37.length - r18;
if (r39 < 0) {
let r49 = GuildStore.getGuild(a1)?.premiumTier;
if (r49 == null) {
r49 = _Constants.BoostedGuildTiers.NONE;
}
SentryUtils_native.addBreadcrumb({
category: "premium",
message: "Negative index while checking grace period ending date.",
data: {
subscriptionLength: a0.length,
subscriptionsNeededForPremiumTier: _Constants.AppliedGuildBoostsRequiredForBoostedGuildTier[r49],
endingSubscriptionLength: r37.length
}
});
}
return r37[Math.max(r39, 0)]?.endsAt;
}
return null;
}
export function getAvailableStickerSlotCount(a0, a1) {
const r5 = IncrementalStickerCountsByTier[a1];
const r10 = c2346_28.indexOf(a1);
if (r10 === -1) {
return 0;
}
const r13 = c2346_28[r10 - 1];
return Math.max(0, r5 - a0.slice(r13 != null ? TotalStickerCountsByTier[r13] : 0, TotalStickerCountsByTier[a1]).length);
}
export function getAvailableSoundboardSoundCount(a0, a1, a2) {
if (c2346_28.indexOf(a2) === -1) {
return 0;
}
let DEFAULT_SOUND_SLOTS2 = DEFAULT_SOUND_SLOTS;
let r14 = a0.premiumFeatures?.additionalSoundSlots;
if (r14 == null) {
r14 = 0;
}
const r7 = DEFAULT_SOUND_SLOTS2 + r14;
const r16 = Math;
if (a0.features.has(GuildFeatures.MORE_SOUNDBOARD)) {
DEFAULT_SOUND_SLOTS2 = MORE_SOUNDBOARD_SOUNDS;
}
return Math.max(0, r16.max(DEFAULT_SOUND_SLOTS2, r7) - a1.length);
}
export function getMaxSoundboardSlots(a0) {
let DEFAULT_SOUND_SLOTS2 = DEFAULT_SOUND_SLOTS;
let r3 = a0.premiumFeatures?.additionalSoundSlots;
if (r3 == null) {
r3 = 0;
}
const r5 = DEFAULT_SOUND_SLOTS2 + r3;
const r12 = Math;
if (a0.features.has(GuildFeatures.MORE_SOUNDBOARD)) {
DEFAULT_SOUND_SLOTS2 = MORE_SOUNDBOARD_SOUNDS;
}
return r12.max(DEFAULT_SOUND_SLOTS2, r5);
}
export function getMaxEmojiSlots(a0) {
let DEFAULT_EMOJI_SLOTS2 = DEFAULT_EMOJI_SLOTS;
let r3 = a0.premiumFeatures?.additionalEmojiSlots;
if (r3 == null) {
r3 = 0;
}
const r5 = DEFAULT_EMOJI_SLOTS2 + r3;
const r12 = Math;
if (a0.features.has(GuildFeatures.MORE_EMOJI)) {
DEFAULT_EMOJI_SLOTS2 = EMOJI_MAX_SLOTS_MORE;
}
return r12.max(DEFAULT_EMOJI_SLOTS2, r5);
}
export function getNumberOfAppliedBoostsNeededForTier(a0, a1) {
return Math.max(0, _Constants.AppliedGuildBoostsRequiredForBoostedGuildTier[a1] - getGuildPowerupsBoostCount(a0.id).available);
}
export function isGuildBoostSlotCanceled(a0) {
return a0.subscription?.status === SubscriptionStatusTypes.CANCELED || a0.canceled;
}
export function getTheoreticalPremiumTierForSubscriberCount(a0) {
let env13841;
const r1 = env13841 = {
$parent: env2346
};
env13841[0] = a0;
let r7 = c2346_29.find($mk73567(r1));
if (r7 == null) {
r7 = _Constants.BoostedGuildTiers.NONE;
}
return r7;
}
export function getNextPremiumTierForSubscriberCount(a0) {
let env13842;
const r1 = env13842 = {
$parent: env2346
};
env13842[0] = a0;
let r7 = c2346_28.find($mk73568(r1));
if (r7 == null) {
r7 = _Constants.BoostedGuildTiers.TIER_3;
}
return r7;
}
export { r127 as TierMarkerPositions };
export function getGuildBoostingProgressBarFillFactor(a0) {
let env13844;
const guildPowerupBoostLevelProgress = getGuildPowerupBoostLevelProgress(a0.id);
const r14 = env13844 = {
$parent: env2346
};
env13844[0] = guildPowerupBoostLevelProgress;
let r8 = c2346_29.find($mk73567(r14));
if (r8 == null) {
r8 = _Constants.BoostedGuildTiers.NONE;
}
let env13845;
const r19 = env13845 = {
$parent: env2346
};
env13845[0] = guildPowerupBoostLevelProgress;
let r6 = c2346_28.find($mk73568(r19));
if (r6 == null) {
r6 = _Constants.BoostedGuildTiers.TIER_3;
}
const r7 = _Constants.AppliedGuildBoostsRequiredForBoostedGuildTier[r8];
const r25 = _Constants.AppliedGuildBoostsRequiredForBoostedGuildTier[r6];
const r27 = c2346_32[r8];
const r28 = c2346_32[r6];
return {
fillFactor: r8 !== _Constants.BoostedGuildTiers.TIER_3 ? (guildPowerupBoostLevelProgress - r7) / (r25 - r7) * (r28 - r27) + r27 : 1,
totalAvailableBoostsCount: guildPowerupBoostLevelProgress
};
}
+284
View File
@@ -0,0 +1,284 @@
// Metro module 6689 (f6690).
import LurkingStore from "../modules/lurker_mode/LurkingStore";
import GuildMemberCountStore from "../stores/GuildMemberCountStore";
import GuildStore from "../stores/GuildStore";
import { AnalyticEvents, Endpoints, Routes, SearchTypes } from "../Constants";
import { getHistory } from "../modules/routing/router_utils";
import { transitionToGuild } from "../modules/routing/transitionToGuild.native";
import safeTransitionTo_native from "../modules/links/safeTransitionTo.native";
import GuildActionCreators from "../actions/GuildActionCreators";
import { getMobileLurkerServerPreview } from "../modules/lurker_mode/experiments/MobileLurkerServerPreviewExperiment";
import { trackLurkStarted } from "../modules/lurker_mode/LurkerPreviewAnalytics";
import AnalyticsUtils from "./AnalyticsUtils";
import { HTTP } from "../_bundle/sendRequest";
import Module1464 from "../_bundle/Module1464";
const makeDiscoverableGuild = function makeDiscoverableGuild(a0) {
return {
id: a0.id,
name: a0.name,
description: a0.description,
splash: a0.splash,
banner: a0.banner,
icon: a0.icon,
features: new Set(a0.features),
presenceCount: a0.approximate_presence_count,
memberCount: a0.approximate_member_count,
premiumSubscriptionCount: a0.premium_subscription_count,
preferredLocale: a0.preferred_locale,
discoverySplash: a0.discovery_splash,
emojis: a0.emojis,
emojiCount: a0.emoji_count,
stickers: a0.stickers,
stickerCount: a0.sticker_count,
keywords: a0.keywords
};
};
const r30 = {
SEARCH: "Search",
RECOMMENDED: "Recommended",
POPULAR: "Popular",
RECOMMENDED_E3: "Recommended - E3",
HEADER: "Header",
GLOBAL_DISCOVERY: "Global Discovery",
FORWARD_BREADCRUMB: "Forward Breadcrumb"
};
export { r30 as AnalyticsContexts };
export const IOS_MINIMUM_MEMBER_COUNT = ">1000";
export const MINIMUM_MEMBER_COUNT = ">200";
export async function startLurking(c25956_0, c25956_1, c25956_2, c25956_3) {
let page, c25956_6;
let c29820_9, c29820_10, c29820_11, c29820_12, c29820_13;
c25956_6 = void 0;
let c29820_0 = c25956_0;
let c29820_1 = c25956_1;
let r39 = c25956_2;
if (r39 === void 0) {
r39 = {};
}
let c29820_2 = r39;
let c29820_3 = c25956_3;
c29820_9 = void 0;
c29820_10 = void 0;
c29820_11 = void 0;
c29820_12 = void 0;
c29820_13 = void 0;
await void 0;
let c29820_4 = c29820_2.channelId;
let c29820_5 = c29820_2.onSuccess;
let c29820_6 = c29820_2.joinSource;
let c29820_7 = c29820_2.loadId;
let c29820_8 = c29820_2.shouldNavigate;
const r12 = c29820_8 === void 0 || c29820_8;
L16: {
c29820_9 = r12;
c29820_10 = getHistory();
c29820_11 = GuildStore.getGuild(c29820_0);
c29820_12 = {
sourceLocationStack: c29820_3,
state: {
analyticsSource: c29820_1
}
};
if (c29820_11 != null && c29820_11.joinedAt != null) {
if (!c29820_9) {
break L16;
}
if (c29820_4 == null) {
transitionToGuild(c29820_0, c29820_12);
break L16;
}
safeTransitionTo_native(Routes.CHANNEL(c29820_0, c29820_4, c29820_2.messageId), {
...c29820_12,
navigationReplace: true,
openChannel: true
});
} else {
if (c29820_11 != null && LurkingStore.isLurking(c29820_0)) {
if (!c29820_9) {
break L16;
}
await GuildActionCreators.transitionToGuildSync(c29820_0, {
...c29820_12,
welcomeModalChannelId: c29820_4,
navigationReplace: c29820_4 != null,
openChannel: c29820_4 != null,
search: c29820_10.location.search
}, c29820_4, c29820_2.messageId);
break L16;
}
page = c29820_3 == null ? void 0 : c29820_3[c29820_3.length - 1];
if (page == null) {
page = c29820_1?.page;
}
c29820_13 = page;
if (getMobileLurkerServerPreview("startLurking").enabled) {
trackLurkStarted(c29820_0, c29820_6, c29820_13);
}
await GuildActionCreators.joinGuild(c29820_0, {
lurker: true,
source: c29820_6,
loadId: c29820_7,
lurkLocation: c29820_13
});
if (c29820_9) {
await GuildActionCreators.transitionToGuildSync(c29820_0, {
...c29820_12,
welcomeModalChannelId: c29820_4,
navigationReplace: c29820_4 != null,
openChannel: c29820_4 != null,
search: c29820_10.location.search
}, c29820_4, c29820_2.messageId);
}
}
}
if (c29820_5 != null) {
c29820_5();
}
}
export { makeDiscoverableGuild };
export function trackDiscoveryExited(a0, a1, recommendations_source = null) {
AnalyticsUtils.track(AnalyticEvents.GUILD_DISCOVERY_EXITED, {
load_id: a0,
guild_ids_viewed: a1,
recommendations_source
});
}
export function trackSearchClosed(a0) {
AnalyticsUtils.track(AnalyticEvents.SEARCH_CLOSED, {
load_id: a0
});
}
export function trackSearchStarted(a0, a1, r6 = {}) {
AnalyticsUtils.track(AnalyticEvents.SEARCH_STARTED, {
search_type: SearchTypes.GUILD_DISCOVERY,
load_id: a0,
location: r6.location,
category_id: a1
});
}
export function trackGuildDiscoverySearchStart(a0) {
AnalyticsUtils.track(AnalyticEvents.GUILD_DISCOVERY_SEARCH_START, {
with_counts: a0.withCounts,
offset: a0.offset
});
}
export function trackSearchFailed(a0) {
const { categoryId, error } = a0;
AnalyticsUtils.track(AnalyticEvents.GUILD_DISCOVERY_SEARCH_FAILED, {
category_id: categoryId,
request_status: error.status,
request_error_code: error.code,
will_request_retry: a0.willRequestRetry,
is_request_retry: a0.isRequestRetry
});
}
export function trackGuildDiscoveryGetFeaturedGuildsFailed(a0) {
AnalyticsUtils.track(AnalyticEvents.GUILD_DISCOVERY_GET_FEATURED_GUILDS_FAILED, {
category_id: a0.categoryId
});
}
export function trackSearchResultsViewed({ loadId, searchId, query, guildResults, analyticsContext, categoryId, isTagSearch }) {
const SEARCH_RESULT_VIEWED = AnalyticEvents.SEARCH_RESULT_VIEWED;
const search_type = isTagSearch ? SearchTypes.GUILD_DISCOVERY_TAG : SearchTypes.GUILD_DISCOVERY;
const r1 = guildResults !== void 0;
AnalyticsUtils.track(SEARCH_RESULT_VIEWED, {
search_type,
load_id: loadId,
search_id: searchId,
total_results: r1 ? guildResults.length : null,
guild_ids: r1 ? guildResults.map((guildResult) => guildResult.id) : null,
query,
location: analyticsContext.location,
category_id: categoryId
});
}
export function trackGuildJoinClicked(a0) {
AnalyticsUtils.track(AnalyticEvents.GUILD_DISCOVERY_GUILD_JOIN_CLICKED, {
guild_id: a0,
load_id: LurkingStore.getLoadId(a0),
guild_size: GuildMemberCountStore.getMemberCount(a0)
});
}
export async function getDiscoverableGuild(guild_ids) {
let r67;
let c25957_4 = 0;
let c29821_0, c29821_1;
try {
c29821_0 = void 0;
c29821_1 = void 0;
c25957_4 = 1;
c29821_0 = await HTTP.get({
url: Endpoints.GUILD_DISCOVERY,
query: Module1464.stringify({
guild_ids
}),
oldFormErrors: true,
rejectWithError: true
});
const body = c29821_0.body;
const r60 = body == null;
let r61 = void 0;
if (!r60) {
const guilds = body.guilds;
r61 = guilds == null ? void 0 : guilds[0];
}
c29821_1 = r61;
r67 = c29821_1 == null ? c29821_1 : (0, makeDiscoverableGuild)(c29821_1);
c25957_4 = 0;
} catch ($e) {
let r8 = $e;
if (c25957_4 !== 0) {
while (true) {
try {
c25957_4 = 0;
} catch ($e) {
r8 = $e;
if (c25957_4 === 0) {
break;
}
continue;
}
return null;
}
}
throw r8;
}
return r67;
}
export async function fetchPublicDiscoveryGuild(c25958_0) {
let r61;
let c25958_3 = 0;
let c29822_0;
try {
c29822_0 = void 0;
c25958_3 = 1;
c29822_0 = (await HTTP.get({
url: Endpoints.GUILD_DISCOVERY_SLUG(String(c25958_0)),
oldFormErrors: true,
rejectWithError: true
})).body;
r61 = c29822_0?.guild == null ? null : c29822_0?.slug == null ? null : {
guild: c29822_0.guild,
slug: c29822_0.slug
};
c25958_3 = 0;
} catch ($e) {
let r27 = $e;
if (c25958_3 !== 0) {
while (true) {
try {
c25958_3 = 0;
} catch ($e) {
r27 = $e;
if (c25958_3 === 0) {
break;
}
continue;
}
return null;
}
}
throw r27;
}
return r61;
}
+784
View File
@@ -0,0 +1,784 @@
// Metro module 1411 (f1412).
import { constructInPlace, merge, objectIsPlainRecordOfType, tryReuseExistingInPlacePlainRecord } from "../lib/PlainRecord";
import { GUILD_DEFAULT_PROPERTY_VALUES, GuildRecordTypeTag } from "../records/GuildRecord";
import { GuildNSFWContentLevel } from "../Constants";
import { toSetInplace } from "../_bundle/Module1414";
import Module38 from "../_bundle/Module38";
import { fromServerGuildTheme, toServerGuildThemeSettings } from "../modules/guild_themes/guildThemeSerialization";
const fromGuildPropertiesWithAdditionalFields = function fromGuildPropertiesWithAdditionalFields(properties, a1, a2) {
let guildTheme;
let description = properties.description;
if (description == null) {
description = null;
}
let icon = properties.icon;
if (icon == null) {
icon = null;
}
let splash = properties.splash;
if (splash == null) {
splash = null;
}
let banner = properties.banner;
if (banner == null) {
banner = null;
}
let home_header = properties.home_header;
if (home_header == null) {
home_header = null;
}
const r4 = {
id: properties.id,
joinedAt: a1.joinedAt,
premiumSubscriberCount: a1.premiumSubscriberCount,
name: properties.name,
description,
icon,
splash,
banner,
homeHeader: home_header,
features: toSetInplace(properties.features),
preferredLocale: null,
ownerId: null,
application_id: null,
afkChannelId: null,
afkTimeout: null,
systemChannelId: null,
verificationLevel: null,
explicitContentFilter: null,
defaultMessageNotifications: null,
mfaLevel: null,
vanityURLCode: null,
premiumTier: null,
premiumProgressBarEnabled: null,
premiumProgressBarEnabledUserUpdatedAt: null,
systemChannelFlags: null,
discoverySplash: null,
rulesChannelId: null,
safetyAlertsChannelId: null,
publicUpdatesChannelId: null,
maxStageVideoChannelUsers: null,
maxVideoChannelUsers: null,
maxMembers: null,
nsfwLevel: null,
ownerConfiguredContentLevel: null,
hubType: null,
latestOnboardingQuestionId: null,
profile: null,
guildTheme: null,
premiumFeatures: null,
moderatorReporting: null,
verificationRoleId: null,
gameApplicationIds: null,
officialMessageColor: null
};
let preferred_locale = properties.preferred_locale;
if (preferred_locale == null) {
preferred_locale = GUILD_DEFAULT_PROPERTY_VALUES.preferredLocale;
}
r4.preferredLocale = preferred_locale;
r4.ownerId = properties.owner_id;
let application_id = properties.application_id;
if (application_id == null) {
application_id = null;
}
r4.application_id = application_id;
let afk_channel_id = properties.afk_channel_id;
if (afk_channel_id == null) {
afk_channel_id = null;
}
r4.afkChannelId = afk_channel_id;
let afk_timeout = properties.afk_timeout;
if (afk_timeout == null) {
afk_timeout = GUILD_DEFAULT_PROPERTY_VALUES.afkTimeout;
}
r4.afkTimeout = afk_timeout;
let system_channel_id = properties.system_channel_id;
if (system_channel_id == null) {
system_channel_id = null;
}
r4.systemChannelId = system_channel_id;
let verification_level = properties.verification_level;
if (verification_level == null) {
verification_level = GUILD_DEFAULT_PROPERTY_VALUES.verificationLevel;
}
r4.verificationLevel = verification_level;
let explicit_content_filter = properties.explicit_content_filter;
if (explicit_content_filter == null) {
explicit_content_filter = GUILD_DEFAULT_PROPERTY_VALUES.explicitContentFilter;
}
r4.explicitContentFilter = explicit_content_filter;
r4.defaultMessageNotifications = properties.default_message_notifications;
let mfa_level = properties.mfa_level;
if (mfa_level == null) {
mfa_level = GUILD_DEFAULT_PROPERTY_VALUES.mfaLevel;
}
r4.mfaLevel = mfa_level;
let vanity_url_code = properties.vanity_url_code;
if (vanity_url_code == null) {
vanity_url_code = null;
}
r4.vanityURLCode = vanity_url_code;
let premium_tier = properties.premium_tier;
if (premium_tier == null) {
premium_tier = GUILD_DEFAULT_PROPERTY_VALUES.premiumTier;
}
r4.premiumTier = premium_tier;
r4.premiumProgressBarEnabled = properties.premium_progress_bar_enabled || GUILD_DEFAULT_PROPERTY_VALUES.premiumProgressBarEnabled;
r4.premiumProgressBarEnabledUserUpdatedAt = properties.premium_progress_bar_enabled_user_updated_at != null ? new Date(properties.premium_progress_bar_enabled_user_updated_at) : null;
r4.systemChannelFlags = properties.system_channel_flags;
let discovery_splash = properties.discovery_splash;
if (discovery_splash == null) {
discovery_splash = null;
}
r4.discoverySplash = discovery_splash;
let rules_channel_id = properties.rules_channel_id;
if (rules_channel_id == null) {
rules_channel_id = null;
}
r4.rulesChannelId = rules_channel_id;
let safety_alerts_channel_id = properties.safety_alerts_channel_id;
if (safety_alerts_channel_id == null) {
safety_alerts_channel_id = null;
}
r4.safetyAlertsChannelId = safety_alerts_channel_id;
let public_updates_channel_id = properties.public_updates_channel_id;
if (public_updates_channel_id == null) {
public_updates_channel_id = null;
}
r4.publicUpdatesChannelId = public_updates_channel_id;
let max_stage_video_channel_users = properties.max_stage_video_channel_users;
if (max_stage_video_channel_users == null) {
max_stage_video_channel_users = GUILD_DEFAULT_PROPERTY_VALUES.maxStageVideoChannelUsers;
}
r4.maxStageVideoChannelUsers = max_stage_video_channel_users;
let max_video_channel_users = properties.max_video_channel_users;
if (max_video_channel_users == null) {
max_video_channel_users = GUILD_DEFAULT_PROPERTY_VALUES.maxVideoChannelUsers;
}
r4.maxVideoChannelUsers = max_video_channel_users;
let max_members = properties.max_members;
if (max_members == null) {
max_members = GUILD_DEFAULT_PROPERTY_VALUES.maxMembers;
}
r4.maxMembers = max_members;
let nsfw_level = properties.nsfw_level;
if (nsfw_level == null) {
nsfw_level = GUILD_DEFAULT_PROPERTY_VALUES.nsfwLevel;
}
r4.nsfwLevel = nsfw_level;
let owner_configured_content_level = properties.owner_configured_content_level;
if (owner_configured_content_level == null) {
owner_configured_content_level = null;
}
r4.ownerConfiguredContentLevel = owner_configured_content_level;
let hub_type = properties.hub_type;
if (hub_type == null) {
hub_type = null;
}
r4.hubType = hub_type;
let latest_onboarding_question_id = properties.latest_onboarding_question_id;
if (latest_onboarding_question_id == null) {
latest_onboarding_question_id = null;
}
r4.latestOnboardingQuestionId = latest_onboarding_question_id;
let profile = properties.profile;
if (profile == null) {
profile = null;
}
r4.profile = profile;
const theme = properties.theme;
if (theme === void 0) {
let r81 = a2?.guildTheme;
if (r81 == null) {
r81 = null;
}
guildTheme = r81;
} else {
const r74 = theme != null;
guildTheme = null;
if (r74) {
let r79 = fromServerGuildTheme(theme);
if (r79 == null) {
r79 = {
enabled: false,
themeSettings: null
};
}
guildTheme = r79;
}
}
r4.guildTheme = guildTheme;
const r83 = properties.premium_features != null;
let premiumFeatures = null;
if (r83) {
const premium_features = properties.premium_features;
premiumFeatures = {
features: premium_features.features,
additionalEmojiSlots: premium_features.additional_emoji_slots,
additionalStickerSlots: premium_features.additional_sticker_slots,
additionalSoundSlots: premium_features.additional_sound_slots
};
}
r4.premiumFeatures = premiumFeatures;
const r92 = properties.moderator_reporting != null;
let moderatorReporting = null;
if (r92) {
const moderator_reporting = properties.moderator_reporting;
moderatorReporting = {
moderatorReportingEnabled: moderator_reporting.moderator_reporting_enabled,
moderatorReportChannelId: moderator_reporting.moderator_report_channel_id
};
}
r4.moderatorReporting = moderatorReporting;
let verification_role_id = properties.verification_role_id;
if (verification_role_id == null) {
verification_role_id = null;
}
r4.verificationRoleId = verification_role_id;
let game_application_ids = properties.game_application_ids;
if (game_application_ids == null) {
game_application_ids = null;
}
r4.gameApplicationIds = game_application_ids;
let official_message_color = properties.official_message_color;
if (official_message_color == null) {
official_message_color = null;
}
r4.officialMessageColor = official_message_color;
return tryReuseExistingInPlacePlainRecord(GuildRecordTypeTag, a2, r4);
};
export function isGuildRecord(a0) {
return objectIsPlainRecordOfType(GuildRecordTypeTag, a0);
}
export { fromGuildPropertiesWithAdditionalFields };
export function fromServer(a0, a1) {
let r22, joinedAt;
if (a0.joined_at != null) {
joinedAt = new Date(a0.joined_at);
} else {
joinedAt = a1?.joinedAt;
if (joinedAt == null) {
joinedAt = null;
}
}
let premium_subscription_count = a0.premium_subscription_count;
if (premium_subscription_count == null) {
premium_subscription_count = 0;
}
if (a0.properties == null) {
Module38(a1 != null, "If guild.properties is null, existingGuild must be passed in");
r22 = merge(a1, {
joinedAt,
premiumSubscriberCount: premium_subscription_count
});
} else {
r22 = fromGuildPropertiesWithAdditionalFields(a0.properties, {
joinedAt,
premiumSubscriberCount: premium_subscription_count
}, a1);
}
return r22;
}
export function attachSerializedData(a0, a1, a2) {
return {
...a0,
joinedAt: a0.joinedAt != null ? a0.joinedAt.toISOString() : null,
premiumProgressBarEnabledUserUpdatedAt: a0.premiumProgressBarEnabledUserUpdatedAt != null ? a0.premiumProgressBarEnabledUserUpdatedAt.toISOString() : null,
features: Array.from(a0.features),
roles: a1,
member: a2 != null ? {
userId: a2.userId,
roles: a2.roles
} : null
};
}
export function fromBackgroundSync(a0, a1) {
return a0.properties != null ? fromGuildPropertiesWithAdditionalFields(a0.properties, {
joinedAt: a1.joinedAt,
premiumSubscriberCount: a1.premiumSubscriberCount
}, a1) : a1;
}
export function fromGuild(a0, a1) {
let joinedAt;
if (a0.joined_at != null) {
joinedAt = new Date(a0.joined_at);
} else {
joinedAt = a1?.joinedAt;
if (joinedAt == null) {
joinedAt = null;
}
}
return fromGuildPropertiesWithAdditionalFields(a0, {
joinedAt,
premiumSubscriberCount: a0.premium_subscription_count
}, a1);
}
export function fromInviteGuild(a0) {
return constructInPlace(GuildRecordTypeTag, {
...GUILD_DEFAULT_PROPERTY_VALUES,
...{
id: a0.id,
name: a0.name,
description: a0.description,
icon: a0.icon,
splash: a0.splash,
banner: a0.banner,
features: toSetInplace(a0.features),
verificationLevel: a0.verification_level,
vanityURLCode: a0.vanity_url_code,
premiumSubscriberCount: a0.premium_subscription_count,
nsfwLevel: a0.nsfw_level,
premiumTier: a0.premium_tier,
homeHeader: a0.home_header
}
});
}
export function fromGuildProfile(a0) {
let premiumSubscriberCount = a0.premiumSubscriberCount;
if (premiumSubscriberCount == null) {
premiumSubscriberCount = GUILD_DEFAULT_PROPERTY_VALUES.premiumSubscriberCount;
}
let premiumTier = a0.premiumTier;
if (premiumTier == null) {
premiumTier = GUILD_DEFAULT_PROPERTY_VALUES.premiumTier;
}
return constructInPlace(GuildRecordTypeTag, {
...GUILD_DEFAULT_PROPERTY_VALUES,
...{
id: a0.id,
name: a0.name,
description: a0.description,
icon: a0.icon,
premiumSubscriberCount,
premiumTier,
features: toSetInplace(a0.features)
}
});
}
export function fromStoreListingGuild(a0) {
let icon = a0.icon;
if (icon == null) {
icon = null;
}
return constructInPlace(GuildRecordTypeTag, {
...GUILD_DEFAULT_PROPERTY_VALUES,
...{
id: a0.id,
name: a0.name,
icon
}
});
}
export function fromDirectoryGuild(a0) {
let icon = a0.icon;
if (icon == null) {
icon = null;
}
let description = a0.description;
if (description == null) {
description = null;
}
let splash = a0.splash;
if (splash == null) {
splash = null;
}
return constructInPlace(GuildRecordTypeTag, {
...GUILD_DEFAULT_PROPERTY_VALUES,
...{
id: a0.id,
name: a0.name,
icon,
description,
splash,
features: toSetInplace(a0.features)
}
});
}
export function fromGuildDirectoryEntry(a0) {
let name = a0.name;
if (name == null) {
name = "";
}
let icon = a0.icon;
if (icon == null) {
icon = null;
}
let description = a0.description;
if (description == null) {
description = null;
}
let splash = a0.splash;
if (splash == null) {
splash = null;
}
return constructInPlace(GuildRecordTypeTag, {
...GUILD_DEFAULT_PROPERTY_VALUES,
...{
id: a0.guildId,
name,
icon,
description,
splash,
features: toSetInplace(a0.features)
}
});
}
export function fromVerificationGateGuild(a0) {
let icon = a0.icon;
if (icon == null) {
icon = null;
}
let description = a0.description;
if (description == null) {
description = null;
}
let splash = a0.splash;
if (splash == null) {
splash = null;
}
const r3 = {
id: a0.id,
name: a0.name,
icon,
description,
splash,
features: toSetInplace(a0.features),
verificationLevel: null
};
let verification_level = a0.verification_level;
if (verification_level == null) {
verification_level = GUILD_DEFAULT_PROPERTY_VALUES.verificationLevel;
}
r3.verificationLevel = verification_level;
return constructInPlace(GuildRecordTypeTag, {
...GUILD_DEFAULT_PROPERTY_VALUES,
...r3
});
}
export function fromClientDiscoverableGuild(a0) {
let description = a0.description;
if (description == null) {
description = null;
}
let splash = a0.splash;
if (splash == null) {
splash = null;
}
let banner = a0.banner;
if (banner == null) {
banner = null;
}
let preferredLocale = a0.preferredLocale;
if (preferredLocale == null) {
preferredLocale = GUILD_DEFAULT_PROPERTY_VALUES.preferredLocale;
}
let icon = a0.icon;
if (icon == null) {
icon = null;
}
const r3 = {
id: a0.id,
name: a0.name,
description,
splash,
banner,
preferredLocale,
icon,
features: toSetInplace(a0.features),
premiumSubscriberCount: null,
discoverySplash: null
};
let premiumSubscriptionCount = a0.premiumSubscriptionCount;
if (premiumSubscriptionCount == null) {
premiumSubscriptionCount = GUILD_DEFAULT_PROPERTY_VALUES.premiumSubscriberCount;
}
r3.premiumSubscriberCount = premiumSubscriptionCount;
let discoverySplash = a0.discoverySplash;
if (discoverySplash == null) {
discoverySplash = null;
}
r3.discoverySplash = discoverySplash;
return constructInPlace(GuildRecordTypeTag, {
...GUILD_DEFAULT_PROPERTY_VALUES,
...r3
});
}
export function fromGuildBasic(a0) {
let icon = a0.icon;
if (icon == null) {
icon = null;
}
let description = a0.description;
if (description == null) {
description = null;
}
let splash = a0.splash;
if (splash == null) {
splash = null;
}
let discovery_splash = a0.discovery_splash;
if (discovery_splash == null) {
discovery_splash = null;
}
return constructInPlace(GuildRecordTypeTag, {
...GUILD_DEFAULT_PROPERTY_VALUES,
...{
id: a0.id,
name: a0.name,
icon,
description,
splash,
discoverySplash: discovery_splash,
features: toSetInplace(a0.features)
}
});
}
export function dangerouslyConstructGuildRecordFromUntypedObject(a0) {
const r4 = {
id: a0.id,
name: a0.name || "",
description: a0.description || null,
ownerId: a0.ownerId || null,
icon: a0.icon || null,
splash: a0.splash || null,
banner: a0.banner || null,
homeHeader: a0.homeHeader || null,
features: toSetInplace(a0.features),
preferredLocale: a0.preferredLocale || GUILD_DEFAULT_PROPERTY_VALUES.preferredLocale,
afkChannelId: a0.afkChannelId || null,
afkTimeout: a0.afkTimeout,
systemChannelId: a0.systemChannelId || null,
verificationLevel: a0.verificationLevel || GUILD_DEFAULT_PROPERTY_VALUES.verificationLevel,
joinedAt: null,
defaultMessageNotifications: null,
mfaLevel: null,
application_id: null,
explicitContentFilter: null,
vanityURLCode: null,
premiumTier: null,
premiumSubscriberCount: null,
premiumProgressBarEnabled: null,
premiumProgressBarEnabledUserUpdatedAt: null,
systemChannelFlags: null,
discoverySplash: null,
rulesChannelId: null,
safetyAlertsChannelId: null,
publicUpdatesChannelId: null,
maxStageVideoChannelUsers: null,
maxVideoChannelUsers: null,
maxMembers: null,
nsfwLevel: null,
ownerConfiguredContentLevel: null,
hubType: null,
latestOnboardingQuestionId: null,
profile: null,
guildTheme: null,
premiumFeatures: null,
moderatorReporting: null,
gameApplicationIds: null,
officialMessageColor: null,
verificationRoleId: null
};
const r0 = a0.joinedAt instanceof Date;
const joinedAt = a0.joinedAt;
r4.joinedAt = r0 ? joinedAt : joinedAt != null ? new Date(a0.joinedAt) : a0.joinedAt;
r4.defaultMessageNotifications = a0.defaultMessageNotifications || GUILD_DEFAULT_PROPERTY_VALUES.defaultMessageNotifications;
r4.mfaLevel = a0.mfaLevel || GUILD_DEFAULT_PROPERTY_VALUES.mfaLevel;
r4.application_id = a0.application_id || null;
r4.explicitContentFilter = a0.explicitContentFilter || GUILD_DEFAULT_PROPERTY_VALUES.explicitContentFilter;
r4.vanityURLCode = a0.vanityURLCode || null;
r4.premiumTier = a0.premiumTier || GUILD_DEFAULT_PROPERTY_VALUES.premiumTier;
r4.premiumSubscriberCount = a0.premiumSubscriberCount || GUILD_DEFAULT_PROPERTY_VALUES.premiumSubscriberCount;
r4.premiumProgressBarEnabled = a0.premiumProgressBarEnabled || GUILD_DEFAULT_PROPERTY_VALUES.premiumProgressBarEnabled;
const r55 = a0.premiumProgressBarEnabledUserUpdatedAt instanceof Date;
const premiumProgressBarEnabledUserUpdatedAt = a0.premiumProgressBarEnabledUserUpdatedAt;
r4.premiumProgressBarEnabledUserUpdatedAt = r55 ? premiumProgressBarEnabledUserUpdatedAt : premiumProgressBarEnabledUserUpdatedAt != null ? new Date(a0.premiumProgressBarEnabledUserUpdatedAt) : null;
r4.systemChannelFlags = a0.systemChannelFlags;
r4.discoverySplash = a0.discoverySplash || null;
r4.rulesChannelId = a0.rulesChannelId || null;
r4.safetyAlertsChannelId = a0.safetyAlertsChannelId || null;
r4.publicUpdatesChannelId = a0.publicUpdatesChannelId || null;
r4.maxStageVideoChannelUsers = a0.maxStageVideoChannelUsers || GUILD_DEFAULT_PROPERTY_VALUES.maxStageVideoChannelUsers;
r4.maxVideoChannelUsers = a0.maxVideoChannelUsers || GUILD_DEFAULT_PROPERTY_VALUES.maxVideoChannelUsers;
r4.maxMembers = a0.maxMembers || GUILD_DEFAULT_PROPERTY_VALUES.maxMembers;
let nsfwLevel = a0.nsfwLevel;
if (nsfwLevel == null) {
nsfwLevel = GUILD_DEFAULT_PROPERTY_VALUES.nsfwLevel;
}
r4.nsfwLevel = nsfwLevel;
let ownerConfiguredContentLevel = a0.ownerConfiguredContentLevel;
if (ownerConfiguredContentLevel == null) {
ownerConfiguredContentLevel = null;
}
r4.ownerConfiguredContentLevel = ownerConfiguredContentLevel;
r4.hubType = a0.hubType;
let latestOnboardingQuestionId = a0.latestOnboardingQuestionId;
if (latestOnboardingQuestionId == null) {
latestOnboardingQuestionId = null;
}
r4.latestOnboardingQuestionId = latestOnboardingQuestionId;
let profile = a0.profile;
if (profile == null) {
profile = null;
}
r4.profile = profile;
let guildTheme = a0.guildTheme;
if (guildTheme == null) {
guildTheme = null;
}
r4.guildTheme = guildTheme;
let premiumFeatures = a0.premiumFeatures;
if (premiumFeatures == null) {
premiumFeatures = null;
}
r4.premiumFeatures = premiumFeatures;
let moderatorReporting = a0.moderatorReporting;
if (moderatorReporting == null) {
moderatorReporting = null;
}
r4.moderatorReporting = moderatorReporting;
let gameApplicationIds = a0.gameApplicationIds;
if (gameApplicationIds == null) {
gameApplicationIds = null;
}
r4.gameApplicationIds = gameApplicationIds;
let officialMessageColor = a0.officialMessageColor;
if (officialMessageColor == null) {
officialMessageColor = null;
}
r4.officialMessageColor = officialMessageColor;
let verificationRoleId = a0.verificationRoleId;
if (verificationRoleId == null) {
verificationRoleId = null;
}
r4.verificationRoleId = verificationRoleId;
return constructInPlace(GuildRecordTypeTag, r4);
}
export function toGuildProperties(a0) {
const r2 = {
id: a0.id,
name: a0.name,
description: a0.description,
icon: a0.icon,
splash: a0.splash,
banner: a0.banner,
home_header: a0.homeHeader,
features: Array.from(a0.features),
preferred_locale: a0.preferredLocale,
owner_id: a0.ownerId,
application_id: a0.application_id,
afk_channel_id: a0.afkChannelId,
afk_timeout: a0.afkTimeout,
system_channel_id: a0.systemChannelId,
verification_level: a0.verificationLevel,
explicit_content_filter: a0.explicitContentFilter,
default_message_notifications: a0.defaultMessageNotifications,
mfa_level: a0.mfaLevel,
vanity_url_code: null,
premium_tier: null,
premium_progress_bar_enabled: null,
premium_progress_bar_enabled_user_updated_at: null,
premium_features: null,
system_channel_flags: null,
discovery_splash: null,
rules_channel_id: null,
safety_alerts_channel_id: null,
public_updates_channel_id: null,
max_stage_video_channel_users: null,
max_video_channel_users: null,
max_members: null,
nsfw_level: null,
nsfw: null,
owner_configured_content_level: null,
hub_type: null,
latest_onboarding_question_id: null,
profile: null,
theme: null,
moderator_reporting: null,
official_message_color: null,
incidents_data: null,
game_application_ids: null,
verification_role_id: null
};
let vanityURLCode = a0.vanityURLCode;
if (vanityURLCode == null) {
vanityURLCode = null;
}
r2.vanity_url_code = vanityURLCode;
r2.premium_tier = a0.premiumTier;
r2.premium_progress_bar_enabled = a0.premiumProgressBarEnabled;
const premiumProgressBarEnabledUserUpdatedAt = a0.premiumProgressBarEnabledUserUpdatedAt;
let premium_progress_bar_enabled_user_updated_at = premiumProgressBarEnabledUserUpdatedAt == null ? void 0 : premiumProgressBarEnabledUserUpdatedAt.toISOString();
if (premium_progress_bar_enabled_user_updated_at == null) {
premium_progress_bar_enabled_user_updated_at = null;
}
r2.premium_progress_bar_enabled_user_updated_at = premium_progress_bar_enabled_user_updated_at;
const r38 = a0.premiumFeatures != null;
let premium_features = null;
if (r38) {
const premiumFeatures = a0.premiumFeatures;
premium_features = {
features: premiumFeatures.features,
additional_emoji_slots: premiumFeatures.additionalEmojiSlots,
additional_sticker_slots: premiumFeatures.additionalStickerSlots,
additional_sound_slots: premiumFeatures.additionalSoundSlots
};
}
r2.premium_features = premium_features;
r2.system_channel_flags = a0.systemChannelFlags;
r2.discovery_splash = a0.discoverySplash;
r2.rules_channel_id = a0.rulesChannelId;
r2.safety_alerts_channel_id = a0.safetyAlertsChannelId;
r2.public_updates_channel_id = a0.publicUpdatesChannelId;
r2.max_stage_video_channel_users = a0.maxStageVideoChannelUsers;
r2.max_video_channel_users = a0.maxVideoChannelUsers;
r2.max_members = a0.maxMembers;
r2.nsfw_level = a0.nsfwLevel;
r2.nsfw = [GuildNSFWContentLevel.AGE_RESTRICTED, GuildNSFWContentLevel.EXPLICIT].includes(a0.nsfwLevel);
r2.owner_configured_content_level = a0.ownerConfiguredContentLevel;
r2.hub_type = a0.hubType;
r2.latest_onboarding_question_id = a0.latestOnboardingQuestionId;
r2.profile = a0.profile;
const r67 = a0.guildTheme != null;
let theme = null;
if (r67) {
const guildTheme = a0.guildTheme;
theme = {
enabled: guildTheme.enabled,
...toServerGuildThemeSettings(guildTheme.themeSettings)
};
}
r2.theme = theme;
const r79 = a0.moderatorReporting != null;
let moderator_reporting = null;
if (r79) {
const moderatorReporting = a0.moderatorReporting;
moderator_reporting = {
moderator_reporting_enabled: moderatorReporting.moderatorReportingEnabled,
moderator_report_channel_id: moderatorReporting.moderatorReportChannelId
};
}
r2.moderator_reporting = moderator_reporting;
r2.official_message_color = a0.officialMessageColor;
r2.game_application_ids = a0.gameApplicationIds;
r2.verification_role_id = a0.verificationRoleId;
return r2;
}
export function fromSerializedGuildRecord(a0) {
const r4 = {
...a0,
features: toSetInplace(a0.features),
joinedAt: a0.joinedAt != null ? new Date(a0.joinedAt) : null,
premiumProgressBarEnabledUserUpdatedAt: a0.premiumProgressBarEnabledUserUpdatedAt != null ? new Date(a0.premiumProgressBarEnabledUserUpdatedAt) : null
};
delete r4["roles"];
delete r4["member"];
return constructInPlace(GuildRecordTypeTag, r4);
}
export function constructFromPartialGuildRecord(a0) {
return constructInPlace(GuildRecordTypeTag, {
...GUILD_DEFAULT_PROPERTY_VALUES,
...a0
});
}
+162
View File
@@ -0,0 +1,162 @@
// Metro module 1937 (f1938).
import { constructInPlace, objectIsPlainRecordOfType } from "../lib/PlainRecord";
import { GuildRoleRecordTypeTag } from "../records/GuildRoleRecord";
import { deserialize } from "../_bundle/HighLow";
import { int2hex } from "../_bundle/int2hslRaw";
import { extractColorStringsFromServerColors } from "../modules/premium/enhanced_role_colors/EnhancedRoleColorUtils";
let fromServer, fromSerialized;
const fromServerArray = function fromServerArray(id, a1) {
const r0 = {};
for (const item of a1) {
r0[item.id] = fromServer(id, item);
}
return r0;
};
fromServer = function fromServer(a0, a1) {
const r6 = {
id: a1.id,
name: a1.name,
guildId: a0,
permissions: deserialize(a1.permissions),
mentionable: a1.mentionable,
position: a1.position,
color: a1.color,
colorString: a1.color !== 0 ? int2hex(a1.color) : null,
colors: null,
colorStrings: null,
hoist: null,
managed: null,
tags: null,
icon: null,
unicodeEmoji: null,
flags: null,
description: null,
version: null
};
let colors = a1.colors;
if (colors == null) {
colors = null;
}
r6.colors = colors;
r6.colorStrings = a1.colors != null ? extractColorStringsFromServerColors(a1.colors) : null;
r6.hoist = a1.hoist;
let managed = a1.managed;
if (managed == null) {
managed = false;
}
r6.managed = managed;
let tags = a1.tags;
if (tags == null) {
tags = {};
}
r6.tags = tags;
r6.icon = a1.icon;
r6.unicodeEmoji = a1.unicode_emoji;
let flags = a1.flags;
if (flags == null) {
flags = 0;
}
r6.flags = flags;
let description = a1.description;
if (description == null) {
description = null;
}
r6.description = description;
r6.version = a1.version;
return constructInPlace(GuildRoleRecordTypeTag, r6);
};
fromSerialized = function fromSerialized(a0, a1) {
const r6 = {
id: a1.id,
name: a1.name,
guildId: a0,
permissions: deserialize(a1.permissions),
mentionable: a1.mentionable,
position: a1.position,
color: a1.color,
colorString: a1.color != null ? a1.color !== 0 ? int2hex(a1.color) : null : null,
colors: null,
colorStrings: null,
hoist: null,
managed: null,
tags: null,
icon: null,
unicodeEmoji: null,
flags: null,
description: null,
version: null
};
let colors = a1.colors;
if (colors == null) {
colors = null;
}
r6.colors = colors;
r6.colorStrings = a1.colors != null ? extractColorStringsFromServerColors(a1.colors) : null;
r6.hoist = a1.hoist;
let managed = a1.managed;
if (managed == null) {
managed = false;
}
r6.managed = managed;
let tags = a1.tags;
if (tags == null) {
tags = {};
}
r6.tags = tags;
r6.icon = a1.icon;
r6.unicodeEmoji = a1.unicodeEmoji;
let flags = a1.flags;
if (flags == null) {
flags = 0;
}
r6.flags = flags;
let description = a1.description;
if (description == null) {
description = null;
}
r6.description = description;
r6.version = a1.version;
return constructInPlace(GuildRoleRecordTypeTag, r6);
};
export function isGuildRoleRecord(a0) {
return objectIsPlainRecordOfType(GuildRoleRecordTypeTag, a0);
}
export { fromServerArray };
export { fromServer };
export function constructGuildRoleInPlace(a0) {
return constructInPlace(GuildRoleRecordTypeTag, a0);
}
export { fromSerialized };
export function fromSyncOperation(a0, a1, a2) {
if (a1.op === "full_sync") {
return fromServerArray(a0, a1.items);
}
const r23 = {
...a2
};
for (const delete2 of a1.deletes) {
delete r23[delete2];
}
for (const write of a1.writes) {
r23[write.id] = fromServer(a0, write);
}
return r23;
}
export function fromSerializedPartition(a0, a1) {
const r3 = {};
for (const key in a1) {
r3[key] = fromSerialized(a0, a1[key]);
}
return r3;
}
export function toSerializedPartition(a0) {
const r2 = {};
for (const key in a0) {
const r9 = a0[key];
r2[key] = {
...r9,
permissions: r9.permissions.toString()
};
}
return r2;
}
+59
View File
@@ -0,0 +1,59 @@
// Metro module 1939 (f1940).
import SnowflakeUtils from "./SnowflakeUtils";
import { int2hex } from "../_bundle/int2hslRaw";
import { extractColorStringsFromServerColors } from "../modules/premium/enhanced_role_colors/EnhancedRoleColorUtils";
import { fromServer } from "./GuildRoleRecordUtils";
const compareGuildRoles = function compareGuildRoles(a0, a1) {
const guildId = a0.guildId;
return a0.id === guildId ? a1.id === guildId ? SnowflakeUtils.compare(a0.id, a1.id) : 1 : a1.id !== guildId ? a0.position !== a1.position ? a1.position - a0.position : SnowflakeUtils.compare(a0.id, a1.id) : -1;
};
export function sortGuildRoleRecords(a0) {
a0.sort(compareGuildRoles);
return a0;
}
export { compareGuildRoles };
export function doesRoleSortHigher(a0, a1) {
const guildId = a0.guildId;
return (a0.id === guildId ? a1.id === guildId ? SnowflakeUtils.compare(a0.id, a1.id) : 1 : a1.id !== guildId ? a0.position !== a1.position ? a1.position - a0.position : SnowflakeUtils.compare(a0.id, a1.id) : -1) < 0;
}
export function sortInviteRoles(a0, a1) {
return a0.position !== a1.position ? a1.position - a0.position : SnowflakeUtils.compare(a0.id, a1.id);
}
export function inviteRoleToDisplayData(a0, a1) {
const colorString = a1.color !== 0 ? int2hex(a1.color) : null;
const colorStrings = a1.colors != null ? extractColorStringsFromServerColors(a1.colors) : null;
let icon = a1.icon;
if (icon == null) {
icon = null;
}
let unicode_emoji = a1.unicode_emoji;
if (unicode_emoji == null) {
unicode_emoji = null;
}
return {
id: a1.id,
name: a1.name,
guildId: a0,
colorString,
colorStrings,
icon,
unicodeEmoji: unicode_emoji
};
}
export function filterRoleDeletes(a0, a1, r7 = [], r8 = []) {
if (r8.length + r7.length === 0) {
return a1;
}
const r26 = {
...a1
};
if (r8 != null) {
for (const item2 of r8) {
delete r26[item2];
}
}
for (const item of r7) {
r26[item.id] = fromServer(a0, item);
}
return r26;
}
+109
View File
@@ -0,0 +1,109 @@
// Metro module 5104 (f5105).
import "../stores/GuildStore";
import UserStore from "../stores/UserStore";
import LRUCache from "../_bundle/LRUCache";
import Durations from "./Durations";
import { getName } from "./UserUtils";
import { intl, t } from "../intl/index.native";
function $mk75408($env) {
return () => {
const r2 = $env;
const r3 = $env.$parent;
let env25331 = {
$parent: r3
};
const r6 = [];
env25331[0] = r6;
const r7 = r2[0];
if (r7 == null) {
r6.push.apply(r6, [...r3[5].getGuildIds()]);
} else if (Array.isArray(r7)) {
r7.forEach((item) => {
const guild = env25331.$parent[5].getGuild(item);
if (guild != null) {
env25331[0].push(guild.id);
}
});
} else {
const guild = r3[5].getGuild(r7);
if (guild != null) {
r6.push(guild.id);
}
}
if (r6.length > 0) {
(0, r3[1])(r3[3][4]).requestMembers(r6, r2[1].toLocaleLowerCase(), r2[2]);
}
};
}
let c3069_7;
let env3069 = {};
export function getGuildNameSuggestion(a0) {
const name = getName(UserStore.getCurrentUser());
return name == null ? "" : name.length !== 0 ? intl.formatToPlainString(t.Y6Qfju, {
username: a0?.truncateUsername ? name.slice(0, 20) : name
}) : "";
}
c3069_7 = new LRUCache({
maxAge: 1 * Durations.Millis.MINUTE
});
const r35 = {
getGuildNameSuggestion,
requestMembers: function requestMembers(a0, a1) {
let r26;
let r7 = arguments[2];
if (r7 === void 0) {
r7 = 10;
}
const isArray = Array.isArray(a0);
const r17 = [];
let c14619_1 = r17;
if (isArray) {
a0.forEach((item) => {
const r12 = `${item == null ? "" : item}:${a1}`;
let r15 = c3069_7.get(r12);
if (r15 == null) {
c3069_7.set(r12, true);
r15 = void 0;
}
if (r15 == null) {
c14619_1.push(item);
}
});
r26 = false;
} else {
const r19 = `${a0 == null ? "" : a0}:${a1}`;
let r22 = c3069_7.get(r19);
if (r22 == null) {
c3069_7.set(r19, true);
r22 = void 0;
}
r26 = r22 == null ? true : false;
}
if (r17.length > 0 && isArray) {
let env14621;
const r41 = env14621 = {
$parent: env3069
};
env14621[0] = r17;
env14621[1] = a1;
env14621[2] = r7;
if (env3069[4] != null) {
clearTimeout(env3069[4]);
}
env3069[4] = setTimeout($mk75408(r41), 200);
} else if (r26) {
let env14620;
const r31 = env14620 = {
$parent: env3069
};
env14620[0] = a0;
env14620[1] = a1;
env14620[2] = r7;
if (env3069[4] != null) {
clearTimeout(env3069[4]);
}
env3069[4] = setTimeout($mk75408(r31), 200);
}
}
};
export default r35;
+35
View File
@@ -0,0 +1,35 @@
// Metro module 1945 (f1946).
import LocaleStore from "../modules/user_settings/LocaleStore";
import * as _Constants from "../Constants";
import { LocalizedLinks } from "../Constants";
import getLocalizedLink from "../modules/links/getLocalizedLink";
import { getPlatformName } from "./PlatformUtils";
const { SUPPORT_DOMAIN, SUPPORT_DEV_DOMAIN } = _Constants;
let c1629_5 = `https://${SUPPORT_DOMAIN}`;
let c1629_6 = `https://${SUPPORT_DEV_DOMAIN}`;
const r27 = {
getArticleURL: (a0) => c1629_5 + `/hc/${LocaleStore.locale.toLowerCase()}/articles/${a0}`,
getDevArticleURL: (a0) => {
const r12 = `/hc/${LocaleStore.locale.toLowerCase()}/articles/${a0}`;
let r13 = c1629_6;
if (c1629_6 === void 0) {
r13 = c1629_5;
}
return r13 + r12;
},
getCreatorSupportArticleURL: (a0) => "https://creator-support.discord.com" + `/hc/${LocaleStore.locale.toLowerCase()}/articles/${a0}`,
getTwitterURL: () => getLocalizedLink(LocalizedLinks.TWITTER),
getCommunityURL: () => c1629_5 + `/hc/${LocaleStore.locale.toLowerCase()}`,
getSubmitRequestURL: (a0) => {
const r23 = c1629_5 + `/hc/${LocaleStore.locale.toLowerCase()}/requests/new?platform=${encodeURIComponent(getPlatformName())}`;
return a0 != null ? r23 + `&device_info=${encodeURIComponent(a0)}` : r23;
},
getSearchURL: (a0) => {
const r9 = encodeURIComponent(a0);
return c1629_5 + `/hc/${LocaleStore.locale.toLowerCase()}/search?utf8=%E2%9C%93&query=${r9}&commit=Search`;
},
getFeaturedArticlesJsonURL: () => c1629_5 + "/api/v2/help_center/en-us/articles.json?label_names=featured",
getAppsSupportURL: (a0) => "https://support-apps.discord.com" + `/hc/${LocaleStore.locale.toLowerCase()}/articles/${a0}`
};
export default r27;
export { c1629_5 as SUPPORT_LOCATION };
+120
View File
@@ -0,0 +1,120 @@
// Metro module 4184 (f4185).
import { HermesBuiltin } from "../_hermes/prelude";
function $mk73713($env) {
return (a0) => {
const [r26, r9] = a0;
const r29 = $env;
const r8 = r29[0];
const r30 = r29[1];
let c24950_0 = r26;
let c24950_1 = r30;
return {
className: `ansi-${r8}-${r9}`,
endsParent: true,
begin: $env.$parent[4],
"on:begin": (a0, a1) => {
const r23 = a0[1].split(";");
if (a1.data.isOn === void 0) {
a1.data.isOn = false;
}
for (const item of r23) {
if (item === c24950_0) {
a1.data.isOn = true;
} else if (c24950_1.includes(item)) {
a1.data.isOn = false;
}
}
if (!a1.data.isOn) {
a1.ignoreMatch();
}
}
};
};
}
let env2409 = {};
const c2409_0 = {
1: "bold",
4: "underline"
};
const c2409_1 = {
30: "black",
31: "red",
32: "green",
33: "yellow",
34: "blue",
35: "magenta",
36: "cyan",
37: "white"
};
const c2409_2 = {
40: "black",
41: "red",
42: "green",
43: "yellow",
44: "blue",
45: "magenta",
46: "cyan",
47: "white"
};
const c2409_3 = /\x1B\[(\d+(?:[:;]\d+)*)m/;
const c2409_4 = new RegExp(`(?=${c2409_3.source})`);
export default function highlightJsAnsiLanguage() {
let length;
let env13891;
let env13892;
let env13893;
const r5 = env13891 = {
$parent: env2409
};
env13891[0] = "foreground";
const r11 = ["0", ...["38", "39"]];
env13891[1] = r11;
const push = r11.push;
const r18 = Object.keys(c2409_1);
let r20 = 0;
push.apply(r11, [...r18]);
const r32 = Object.entries(c2409_1).map($mk73713(r5));
const contains = [,];
const r36 = HermesBuiltin.arraySpread(contains, r32, 0);
const r38 = env13892 = {
$parent: env2409
};
env13892[0] = "background";
env13892[1] = void 0;
const r40 = ["0", ...["48", "49"]];
env13892[1] = r40;
r40.push.apply(r40, [...Object.keys(c2409_2)]);
const r63 = HermesBuiltin.arraySpread(contains, Object.entries(c2409_2).map($mk73713(r38)), r36);
const r65 = env13893 = {
$parent: env2409
};
env13893[0] = "style";
env13893[1] = void 0;
env13893[1] = ["0", ...[]];
const r80 = HermesBuiltin.arraySpread(contains, Object.entries(c2409_0).map($mk73713(r65)), r63);
const end = c2409_4;
contains[r80] = {
className: "ansi-control-sequence",
begin: c2409_3,
starts: {
end,
endsParent: true
}
};
if (0 < contains.length) {
do {
const r87 = contains[r20];
const r89 = r20 + 1;
r87.contains = contains.slice(r89);
length = contains.length;
r20 = r89;
} while (r20 < length);
}
return {
contains: [{
begin: end,
contains
}]
};
};
export { c2409_3 as ANSI_CONTROL_SEQUENCE_RE };
+206
View File
@@ -0,0 +1,206 @@
// Metro module 1471 (f1472).
import quantize from "../_bundle/quantize";
import * as _ImageUtils from "./native/ImageUtils";
import Module12 from "../_bundle/Module12";
import Module38 from "../_bundle/Module38";
let c1186_5, c1186_6, c1186_7, getPalette, dataUrlToBlob;
const fit = function fit({ width, height, maxWidth, maxHeight, minWidth = 0, minHeight = 0 }) {
let height2, width2;
L11: {
if (width === maxWidth) {
width2 = width;
height2 = height;
if (height2 === maxHeight) {
break L11;
}
}
const r17 = width > maxWidth;
let r11 = 1;
const r5 = r17 ? maxWidth / width : 1;
const r21 = Math.max(Math.round(width * r5), minWidth);
const r28 = Math.max(Math.round(height * r5), minHeight);
if (r28 > maxHeight) {
r11 = maxHeight / r28;
}
width2 = Math.max(Math.round(r21 * r11), minWidth);
height2 = Math.max(Math.round(r28 * r11), minHeight);
}
return {
width: width2,
height: height2
};
};
getPalette = function getPalette(a0, a1, a2) {
const element = document.createElement("canvas");
const context = element.getContext("2d");
if (context == null) {
return c1186_7;
}
const width = a0.width;
let height = 128;
const width2 = width !== 0 ? a0.width : 128;
element.width = width2;
if (a0.height !== 0) {
height = a0.height;
}
element.height = height;
context.drawImage(a0, 0, 0, width2, height);
const data = context.getImageData(0, 0, width2, height).data;
const r46 = width2 * height;
const r47 = [];
let r49 = 0;
while (r49 < r46) {
const r0 = 4 * r49;
const r23 = data[0 + r0];
const r22 = data[r0 + 1];
const r21 = data[r0 + 2];
const r53 = data[r0 + 3];
let r9 = r53 === void 0;
const r54 = r49;
if (!r9) {
r9 = r53 >= 125;
}
if (r9 && !(r23 > 250 && r22 > 250 && r21 > 250)) {
r47.push([r23, r22, r21]);
}
r49 = r54 + a2;
}
const r63 = quantize(r47, a1);
return typeof r63 === "boolean" ? c1186_7 : r63.palette();
};
dataUrlToBlob = function dataUrlToBlob(a0) {
const r21 = a0.split(",")[0].indexOf("base64") >= 0 ? atob(a0.split(",")[1]) : btoa(a0.split(",")[1]);
const type = a0.split(",")[0].split(":")[1].split(";")[0];
const uint8Array = new Uint8Array(r21.length);
const r44 = 0 < r21.length;
let r45 = 0;
if (r44) {
do {
uint8Array[r45] = r21.charCodeAt(r45);
r45 = r45 + 1;
} while (r45 < r21.length);
}
return new Blob([uint8Array], {
type
});
};
c1186_5 = 2000;
c1186_6 = 1.6;
c1186_7 = [[0, 0, 0]];
Module12.memoize((src) => new Promise((c24416_0, c24416_1) => {
const image = new Image();
let c24416_2 = image;
image.crossOrigin = "Anonymous";
c24416_2.onerror = (a0) => {
c24416_1(a0);
const r6 = c24416_2;
r6.onload = null;
r6.onerror = null;
c24416_2 = null;
};
c24416_2.onload = () => {
c24416_0(getPalette(c24416_2, 5, 10));
const r11 = c24416_2;
r11.onload = null;
r11.onerror = null;
c24416_2 = null;
};
c24416_2.src = src;
}));
export { fit };
export const IMAGE_MAX_ZOOM = 2000;
export function zoomFit(a0, a1) {
const r18 = Math.min(Math.round(0.65 * window.innerHeight), Math.round(window.innerHeight));
const r32 = Math.min(Math.round(0.75 * window.innerWidth), Math.round(window.innerWidth));
const maxHeight = Math.min(r18, c1186_5);
return fit({
width: a0,
height: a1,
maxWidth: Math.min(r32, c1186_5),
maxHeight
});
}
export function zoomScale(a0, a1, a2, a3) {
const r17 = Math.max(2, a0 != null ? a0 !== 0 ? a1 != null ? a1 !== 0 ? a0 / a2 : 0 : 0 : 0 : 0);
return parseFloat(Math.min(r17, a2 != null && a2 * r17 > window.innerWidth * c1186_6 ? window.innerWidth * c1186_6 / a2 : 2, a3 != null && a3 * r17 > window.innerHeight * c1186_6 ? window.innerHeight * c1186_6 / a3 : 2).toFixed(2));
}
export function getRatio({ width, height, maxWidth, maxHeight }) {
const r9 = width > maxWidth ? maxWidth / width : 1;
Math.round(width * r9);
const r16 = Math.round(height * r9);
return Math.min(r9 * (r16 > maxHeight ? maxHeight / r16 : 1), 1);
}
export function getCoverRatio({ width, height, maxWidth, maxHeight }) {
if (width === height) {
return 1;
}
return Math.min(Math.max(maxWidth / width, maxHeight / height), 1);
}
export function hasDimensions({ width, height }) {
return width != null && width !== 0 && height != null && height !== 0;
}
export function makeCssUrlString(a0) {
return a0 == null ? "none" : a0 !== "" ? `url(${a0})` : "none";
}
export { getPalette };
export function getPaletteForAvatar(a0) {
return _ImageUtils.default.getPaletteForAvatarMobile(a0);
}
export function readFileAsBase64(c13046_0) {
return new Promise((c24417_0, c24417_1) => {
const fileReader = new FileReader();
let c24417_2 = fileReader;
fileReader.readAsDataURL(c13046_0);
fileReader.onload = () => {
Module38(typeof c24417_2.result === "string", "Result must be a string");
c24417_0(c24417_2.result);
};
fileReader.onerror = (a0) => c24417_1(a0);
});
}
export function dataUriFileSize(a0) {
const r7 = a0.split(";base64,");
Module38(r7.length === 2, "Input data is not a valid image.");
return atob(r7[1]).length;
}
export async function dataUrlToFile(c24414_0, c24414_1, c24414_2) {
let c28888_0 = c24414_1;
let c28888_1 = c24414_2;
let c28888_2 = await dataUrlToBlob(c24414_0).arrayBuffer();
return new File([c28888_2], c28888_0, {
type: c28888_1
});
}
export { dataUrlToBlob };
export async function isPNGAnimated(c24415_0) {
let r57;
let c28889_0, c28889_1;
L17: {
let r11 = void 0;
c28889_0 = void 0;
c28889_1 = void 0;
const type = c24415_0.type;
if (type != null) {
r11 = type.split(";")[0];
}
if (r11 !== "image/png") {
throw new Error("File is not a PNG");
}
c28889_0 = await c24415_0.text();
c28889_1 = c28889_0.indexOf("IDAT");
r57 = c28889_1 > 0;
if (!r57) {
break L17;
}
return c28889_0.substring(0, c28889_1).indexOf("acTL") !== -1;
}
return r57;
}
export function preloadImage(src2) {
return new Promise((resolve, reject) => {
const image = new Image();
image.addEventListener("load", resolve);
image.addEventListener("error", reject);
image.src = src2;
});
}
+567
View File
@@ -0,0 +1,567 @@
// Metro module 8350 (f8351).
import EmbeddedActivitiesStore from "../modules/activities/EmbeddedActivitiesStore";
import ChannelStore from "../stores/ChannelStore";
import GuildMemberStore from "../stores/GuildMemberStore";
import ReadStateStore from "../stores/ReadStateStore";
import RelationshipStore from "../stores/RelationshipStore";
import UserStore from "../stores/UserStore";
import PrivateChannelSortStore from "../stores/views/PrivateChannelSortStore";
import { ChannelTypes } from "../Constants";
import { InviteTargetTypes } from "../modules/instant_invite/Constants";
import AutocompleteUtils from "./AutocompleteUtils";
import * as _InstantInviteUtils from "./native/InstantInviteUtils";
import { MAX_AGE_OPTIONS, MAX_USES_OPTIONS } from "./native/InstantInviteUtils";
import { intl, t } from "../intl/index.native";
let c5332_12, addDmUsers, c5332_15, c5332_16, c5332_17, c5332_18, c5332_19, c5332_20;
const isGuildMember = function isGuildMember(omitGuildId, id) {
return omitGuildId != null && GuildMemberStore.isMember(omitGuildId, id);
};
addDmUsers = function addDmUsers({ omitUserIds: omitUserIds3, maxRowsWithoutQuery, omitGuildId, shownUserIds: shownUserIds4, rows: rows6, counts: counts6, includeGroupDms, limit }) {
let r18 = 0;
for (const item of PrivateChannelSortStore.getPrivateChannelIds()) {
if (!(maxRowsWithoutQuery != null && maxRowsWithoutQuery > 0 && rows6.length >= maxRowsWithoutQuery)) {
if (limit != null && r18 >= limit) {
break;
}
const channel = ChannelStore.getChannel(item);
const item2 = channel;
if (channel == null) {
continue;
}
if (!item2.isPrivate()) {
continue;
}
if (includeGroupDms && item2.type === ChannelTypes.GROUP_DM) {
rows6.push({
type: c5332_12.GROUP_DM,
item: item2,
isSuggested: false
});
counts6.numGroupDms = counts6.numGroupDms + 1;
r18 = r18 + 1;
continue;
}
if (ReadStateStore.lastMessageId(item2.id) == null) {
continue;
}
const recipientId = item2.getRecipientId();
if (recipientId == null) {
continue;
}
if (omitUserIds3.has(recipientId)) {
continue;
}
if (shownUserIds4.has(recipientId)) {
continue;
}
const user = UserStore.getUser(recipientId);
if (user == null) {
continue;
}
if (user.bot) {
continue;
}
if (isGuildMember(omitGuildId, user.id)) {
continue;
}
const item3 = user;
shownUserIds4.add(item3.id);
rows6.push({
type: c5332_12.DM,
item: item3,
isSuggested: false
});
counts6.numDms = counts6.numDms + 1;
r18 = r18 + 1;
continue;
}
break;
}
};
c5332_12 = {
GROUP_DM: "GROUP_DM",
DM: "DM",
FRIEND: "FRIEND",
CHANNEL: "CHANNEL"
};
c5332_15 = "minutes";
c5332_16 = "hours";
c5332_17 = "days";
c5332_18 = "never";
const r43 = {};
r43[_InstantInviteUtils.INVITE_OPTIONS_30_MINUTES.value] = {
value: 30,
type: "minutes"
};
r43[_InstantInviteUtils.INVITE_OPTIONS_1_HOUR.value] = {
value: 1,
type: "hours"
};
r43[_InstantInviteUtils.INVITE_OPTIONS_6_HOURS.value] = {
value: 6,
type: "hours"
};
r43[_InstantInviteUtils.INVITE_OPTIONS_12_HOURS.value] = {
value: 12,
type: "hours"
};
r43[_InstantInviteUtils.INVITE_OPTIONS_1_DAY.value] = {
value: 1,
type: "days"
};
r43[_InstantInviteUtils.INVITE_OPTIONS_7_DAYS.value] = {
value: 7,
type: "days"
};
r43[_InstantInviteUtils.INVITE_OPTIONS_14_DAYS.value] = {
value: 14,
type: "days"
};
r43[_InstantInviteUtils.INVITE_OPTIONS_30_DAYS.value] = {
value: 30,
type: "days"
};
r43[_InstantInviteUtils.INVITE_OPTIONS_60_DAYS.value] = {
value: 60,
type: "days"
};
r43[_InstantInviteUtils.INVITE_OPTIONS_FOREVER.value] = {
value: 0,
type: "never"
};
c5332_19 = r43;
c5332_20 = [_InstantInviteUtils.INVITE_OPTIONS_14_DAYS, _InstantInviteUtils.INVITE_OPTIONS_30_DAYS, _InstantInviteUtils.INVITE_OPTIONS_60_DAYS];
const r105 = {
getMaxAgeOptionByValue: function getMaxAgeOptionByValue(c16521_0) {
return [...MAX_AGE_OPTIONS, ...c5332_20].find((item) => item.value === c16521_0) || null;
},
getMaxAgeOptions: function getMaxAgeOptions(c16522_0) {
return MAX_AGE_OPTIONS.filter((item) => {
const r9 = c5332_20.includes(item);
let r10 = !r9;
if (r9) {
const r2 = c16522_0 == null;
let r12 = void 0;
if (!r2) {
const includeExperimentalValues = c16522_0.includeExperimentalValues;
const r13 = includeExperimentalValues == null;
r12 = void 0;
if (!r13) {
const includes = includeExperimentalValues.includes;
r12 = includes == null ? void 0 : includes.call(includeExperimentalValues, item.value);
}
}
r10 = r12;
}
return r10;
});
},
getMaxUsesOptions: MAX_USES_OPTIONS,
INVITE_OPTIONS_FOREVER: _InstantInviteUtils.INVITE_OPTIONS_FOREVER,
INVITE_OPTIONS_1_DAY: _InstantInviteUtils.INVITE_OPTIONS_1_DAY,
INVITE_OPTIONS_7_DAYS: _InstantInviteUtils.INVITE_OPTIONS_7_DAYS,
INVITE_OPTIONS_14_DAYS: _InstantInviteUtils.INVITE_OPTIONS_14_DAYS,
INVITE_OPTIONS_30_DAYS: _InstantInviteUtils.INVITE_OPTIONS_30_DAYS,
INVITE_OPTIONS_60_DAYS: _InstantInviteUtils.INVITE_OPTIONS_60_DAYS,
INVITE_OPTIONS_12_HOURS: _InstantInviteUtils.INVITE_OPTIONS_12_HOURS,
INVITE_OPTIONS_6_HOURS: _InstantInviteUtils.INVITE_OPTIONS_6_HOURS,
INVITE_OPTIONS_8_HOURS: _InstantInviteUtils.INVITE_OPTIONS_8_HOURS,
INVITE_OPTIONS_1_HOUR: _InstantInviteUtils.INVITE_OPTIONS_1_HOUR,
INVITE_OPTIONS_30_MINUTES: _InstantInviteUtils.INVITE_OPTIONS_30_MINUTES,
INVITE_OPTIONS_UNLIMITED: _InstantInviteUtils.INVITE_OPTIONS_UNLIMITED,
INVITE_OPTIONS_ONCE: _InstantInviteUtils.INVITE_OPTIONS_ONCE,
INVITE_OPTIONS_5_TIMES: _InstantInviteUtils.INVITE_OPTIONS_5_TIMES,
INVITE_OPTIONS_10_TIMES: _InstantInviteUtils.INVITE_OPTIONS_10_TIMES,
INVITE_OPTIONS_25_TIMES: _InstantInviteUtils.INVITE_OPTIONS_25_TIMES,
INVITE_OPTIONS_50_TIMES: _InstantInviteUtils.INVITE_OPTIONS_50_TIMES,
INVITE_OPTIONS_100_TIMES: _InstantInviteUtils.INVITE_OPTIONS_100_TIMES
};
export default r105;
export { c5332_12 as RowTypes };
export function generateRowsForQuery({ query, inviteTargetType, omitUserIds: omitUserIds3, suggestedUserIds, suggestedChannelIds, maxRowsWithoutQuery, omitGuildId }) {
const set = new Set();
const rows6 = [];
const counts6 = {
numFriends: 0,
numDms: 0,
numGroupDms: 0,
numGuildMembers: 0,
numChannels: 0
};
if (query === "") {
const r100 = {
omitUserIds: omitUserIds3,
maxRowsWithoutQuery,
omitGuildId,
shownUserIds: set,
rows: rows6,
counts: counts6
};
if (inviteTargetType === InviteTargetTypes.EMBEDDED_APPLICATION) {
addDmUsers({
...r100,
includeGroupDms: false,
limit: 1
});
(function addChannels({ suggestedChannelIds, maxRowsWithoutQuery, rows: rows6, counts: counts6 }) {
if (suggestedChannelIds != null) {
for (const item of suggestedChannelIds) {
if (!(maxRowsWithoutQuery != null && maxRowsWithoutQuery > 0 && rows6.length >= maxRowsWithoutQuery)) {
const channel = ChannelStore.getChannel(item);
const item2 = channel;
if (channel == null) {
continue;
}
rows6.push({
type: c5332_12.CHANNEL,
item: item2,
isSuggested: true
});
counts6.numChannels = counts6.numChannels + 1;
continue;
}
break;
}
}
})({
...r100,
suggestedChannelIds
});
}
(function addSuggestedUsers({ omitUserIds: omitUserIds3, suggestedUserIds, maxRowsWithoutQuery, omitGuildId, shownUserIds: shownUserIds4, rows: rows6, counts: counts6 }) {
if (suggestedUserIds != null) {
for (const item of suggestedUserIds) {
if (!(maxRowsWithoutQuery != null && maxRowsWithoutQuery > 0 && rows6.length >= maxRowsWithoutQuery)) {
if (omitUserIds3.has(item)) {
continue;
}
if (shownUserIds4.has(item)) {
continue;
}
const user = UserStore.getUser(item);
if (user == null || isGuildMember(omitGuildId, user.id)) {
continue;
}
const item2 = user;
shownUserIds4.add(item2.id);
rows6.push({
type: c5332_12.FRIEND,
item: item2,
isSuggested: true
});
counts6.numFriends = counts6.numFriends + 1;
continue;
}
break;
}
}
})({
...r100,
suggestedUserIds
});
addDmUsers({
...r100,
includeGroupDms: true
});
(function addFriends({ omitUserIds: omitUserIds3, maxRowsWithoutQuery, omitGuildId, shownUserIds: shownUserIds4, rows: rows6, counts: counts6 }) {
for (const item of RelationshipStore.getFriendIDs()) {
if (!(maxRowsWithoutQuery != null && maxRowsWithoutQuery > 0 && rows6.length >= maxRowsWithoutQuery)) {
if (omitUserIds3.has(item)) {
continue;
}
if (shownUserIds4.has(item)) {
continue;
}
const user = UserStore.getUser(item);
const item2 = user;
if (user == null || isGuildMember(omitGuildId, item2.id)) {
continue;
}
rows6.push({
type: c5332_12.FRIEND,
item: item2,
isSuggested: false
});
counts6.numFriends = counts6.numFriends + 1;
continue;
}
break;
}
})(r100);
} else {
const r28 = {
query,
rows: rows6,
counts: counts6
};
if (inviteTargetType === InviteTargetTypes.EMBEDDED_APPLICATION) {
const r15 = {
...r28,
inviteTargetType
};
const { query: query2, rows, counts } = r15;
if (r15.inviteTargetType === InviteTargetTypes.EMBEDDED_APPLICATION) {
AutocompleteUtils.queryChannels({
query: query2,
limit: 3,
guildId: void 0
}).forEach((a0) => {
rows.push({
type: c5332_12.CHANNEL,
item: a0.record,
isSuggested: false,
score: a0.score
});
counts.numChannels = counts.numChannels + 1;
});
}
}
let omitUserIds, shownUserIds, rows2, counts2;
let rows3, counts3;
let rows4, counts4, omitUserIds2, shownUserIds2;
(function addQueriedSuggestedUsers({ query, rows: rows5, counts: counts5, omitUserIds: omitUserIds3, shownUserIds: shownUserIds3, suggestedUserIds }) {
if (suggestedUserIds != null) {
const members = [];
for (const item of suggestedUserIds) {
if (!omitUserIds3.has(item) && !shownUserIds3.has(item)) {
const user = UserStore.getUser(item);
if (user != null) {
members.push(user);
}
}
}
AutocompleteUtils.queryMemberList({
query,
members,
limit: 10
}).forEach(({ record, score }) => {
shownUserIds3.add(record.id);
rows5.push({
type: c5332_12.FRIEND,
item: record,
isSuggested: true,
score
});
counts5.numFriends = counts5.numFriends + 1;
});
}
})({
...r28,
omitUserIds: omitUserIds3,
shownUserIds: set,
suggestedUserIds
});
const r51 = {
...r28,
omitUserIds: omitUserIds3,
shownUserIds: set
};
omitUserIds = void 0;
shownUserIds = void 0;
rows2 = void 0;
counts2 = void 0;
const query3 = r51.query;
omitUserIds = r51.omitUserIds;
shownUserIds = r51.shownUserIds;
rows2 = r51.rows;
counts2 = r51.counts;
AutocompleteUtils.queryDMUsers({
query: query3,
limit: 50
}).forEach(({ record, score }) => {
if (!omitUserIds.has(record.id) && !shownUserIds.has(record.id)) {
const dMFromUserId = ChannelStore.getDMFromUserId(record.id);
if (dMFromUserId != null && ReadStateStore.lastMessageId(dMFromUserId) != null) {
shownUserIds.add(record.id);
rows2.push({
type: c5332_12.DM,
item: record,
isSuggested: false,
score
});
counts2.numDms = counts2.numDms + 1;
}
}
});
rows3 = void 0;
counts3 = void 0;
const query4 = r28.query;
rows3 = r28.rows;
counts3 = r28.counts;
AutocompleteUtils.queryGroupDMs({
query: query4,
limit: 50,
fuzzy: false
}).forEach((a0) => {
rows3.push({
type: c5332_12.GROUP_DM,
item: a0.record,
isSuggested: false,
score: a0.score
});
counts3.numGroupDms = counts3.numGroupDms + 1;
});
const r82 = {
...r28,
omitUserIds: omitUserIds3,
shownUserIds: set
};
rows4 = void 0;
counts4 = void 0;
omitUserIds2 = void 0;
shownUserIds2 = void 0;
const query5 = r82.query;
rows4 = r82.rows;
counts4 = r82.counts;
omitUserIds2 = r82.omitUserIds;
shownUserIds2 = r82.shownUserIds;
AutocompleteUtils.queryFriends({
query: query5,
limit: 500,
_fuzzy: false
}).forEach(({ record, score }) => {
if (!(omitUserIds2.has(record.id) || shownUserIds2.has(record.id))) {
shownUserIds2.add(record.id);
rows4.push({
type: c5332_12.FRIEND,
item: record,
isSuggested: false,
score
});
counts4.numFriends = counts4.numFriends + 1;
}
});
}
return {
rows: rows6,
counts: counts6
};
}
export function groupInviteSuggestions(a0, a1) {
const r2 = [];
const r1 = [];
for (const item of a0) {
const type = item.type;
if (c5332_12.FRIEND !== type && c5332_12.DM !== type) {
if (c5332_12.CHANNEL !== type && c5332_12.GROUP_DM !== type) {
continue;
}
r1.push(item);
continue;
}
if (isGuildMember(a1, item.item.id)) {
r2.push(item);
} else {
r1.push(item);
}
}
return [r2, r1];
}
export function getMostRecentDMedUser(a0, a1) {
for (const item of PrivateChannelSortStore.getPrivateChannelIds()) {
const channel = ChannelStore.getChannel(item);
if (channel == null) {
continue;
}
if (!channel.isDM()) {
continue;
}
if (ReadStateStore.lastMessageId(channel.id) == null) {
continue;
}
const recipientId = channel.getRecipientId();
if (recipientId == null) {
continue;
}
if (a0.has(recipientId)) {
continue;
}
const user = UserStore.getUser(recipientId);
if (user == null) {
continue;
}
if (user.bot) {
continue;
}
if (isGuildMember(a1, user.id)) {
continue;
}
return user;
}
return null;
}
export function getUsersAlreadyJoined({ channel, inviteTargetType, applicationId }) {
if (inviteTargetType === InviteTargetTypes.EMBEDDED_APPLICATION && channel != null) {
for (const item of EmbeddedActivitiesStore.getEmbeddedActivitiesForChannel(channel.id)) {
if (item.applicationId !== applicationId) {
continue;
}
return new Set(item.userIds);
}
}
return new Set();
}
export function maxAgeString(a0, a1) {
const numUses = parseInt(a1, 10);
const r2 = numUses === 0;
const value = c5332_19[a0].value;
const type = c5332_19[a0].type;
if (c5332_15 === type) {
return r2 ? intl.string(t["/WbTXD"]) : intl.formatToPlainString(t.eDRWJK, {
numUses
});
}
if (c5332_16 === type) {
return r2 ? intl.formatToPlainString(t.ZVdJMy, {
numHours: value
}) : intl.formatToPlainString(t.NgZgAB, {
numHours: value,
numUses
});
}
if (c5332_17 === type) {
return r2 ? intl.formatToPlainString(t.T96qss, {
numDays: value
}) : intl.formatToPlainString(t.TfuB9B, {
numDays: value,
numUses
});
}
if (c5332_18 === type) {
return r2 ? intl.string(t.QrHBnC) : intl.formatToPlainString(t.yJnTxI, {
numUses
});
}
return "";
}
export function urgentShareMessageString(a0, a1) {
if (a0 == null) {
return intl.formatToPlainString(t.RHbY6K, {
link: a1
});
}
const value = c5332_19[a0].value;
const type = c5332_19[a0].type;
if (c5332_15 === type) {
return intl.formatToPlainString(t.N3VHkw, {
numMinutes: value,
link: a1
});
}
if (c5332_16 === type) {
return intl.formatToPlainString(t["3d9BlG"], {
numHours: value,
link: a1
});
}
if (c5332_17 === type) {
return intl.formatToPlainString(t.gLIlkb, {
numDays: value,
link: a1
});
}
return intl.formatToPlainString(t.RHbY6K, {
link: a1
});
}
export { c5332_20 as EXPERIMENTAL_MAX_AGE_OPTIONS };
+56
View File
@@ -0,0 +1,56 @@
// Metro module 11826 (f11827).
import UserStore from "../stores/UserStore";
import { AbortCodes, HelpdeskArticles, MAX_USER_GUILDS, MAX_USER_GUILDS_PREMIUM } from "../Constants";
import PremiumUtils from "./PremiumUtils";
import { intl, t } from "../intl/index.native";
import HelpdeskUtils from "./HelpdeskUtils";
export function getDescriptiveInviteError(a0) {
if (AbortCodes.TOO_MANY_USER_GUILDS === a0) {
const currentUser = UserStore.getCurrentUser();
return {
title: intl.formatToPlainString(t["ttJ/hj"], {
quantity: PremiumUtils.canUseIncreasedGuildCap(currentUser) ? MAX_USER_GUILDS_PREMIUM : (currentUser == null ? void 0 : currentUser.isStaff()) ? MAX_USER_GUILDS_PREMIUM : MAX_USER_GUILDS
}),
description: intl.string(t.iLyuDO)
};
}
if (AbortCodes.GUILD_AT_CAPACITY === a0) {
return {
title: intl.string(t.ZZlox4),
description: intl.string(t.ZUEGFn)
};
}
if (AbortCodes.GUILD_JOIN_INVITE_LIMITED_ACCESS === a0) {
return {
title: intl.string(t.kJwpBW),
description: intl.string(t.ZUEGFn)
};
}
if (AbortCodes.USER_GUILD_JOIN_LARGE_GUILD_UNDERAGE_DISALLOWED === a0) {
return {
title: intl.string(t["u/xsK9"]),
description: intl.string(t.SxY4IW)
};
}
return null;
}
export function getInviteError(a0) {
if (AbortCodes.TOO_MANY_USER_GUILDS === a0) {
return intl.string(t.iLyuDO);
}
if (AbortCodes.GUILD_AT_CAPACITY === a0) {
return intl.string(t.M6unNJ);
}
if (AbortCodes.INVALID_COUNTRY_CODE === a0) {
return intl.string(t.sRJGR1);
}
if (AbortCodes.INVALID_CANNOT_FRIEND_SELF === a0) {
return intl.string(t["mY2R+F"]);
}
if (AbortCodes.INVITES_DISABLED === a0) {
return intl.format(t.RXSeLl, {
articleLink: HelpdeskUtils.getArticleURL(HelpdeskArticles.INVITE_DISABLED)
});
}
return intl.string(t.dDZRdy);
}
+64
View File
@@ -0,0 +1,64 @@
// Metro module 8223 (f8224).
import { useState } from "react";
import { APIError } from "../errors/index";
export default function useLazyAPIPromise(c16380_0, c16380_1) {
let _execFn2 = function _execFn() {
const r9 = async () => {
let r58;
let c29925_2;
let c29925_3 = 0;
let c31461_0, c31461_1, c31461_2;
try {
c31461_0 = void 0;
c31461_1 = void 0;
setState(true);
setState2(null);
c29925_3 = 1;
c31461_0 = await c16380_0();
(0, setState)(false);
(0, setState2)(null);
r58 = c31461_0;
c29925_3 = 0;
} catch ($e) {
const r27 = $e;
let r7 = r27;
c29925_2 = r27;
if (c29925_3 !== 0) {
while (true) {
try {
const r67 = c29925_2;
c29925_3 = 0;
c31461_2 = r67;
c31461_1 = new APIError(c31461_2);
if (c16380_1 != null) {
c16380_1(c31461_1);
}
(0, setState2)(c31461_1);
(0, setState)(false);
} catch (r63) {
r7 = r63;
c29925_2 = r63;
if (c29925_3 === 0) {
break;
}
continue;
}
return null;
}
}
throw r7;
}
return r58;
};
_execFn2 = r9;
return r9.apply(this, arguments);
};
const [loading, setState] = useState(false);
const [error, setState2] = useState(null);
return [function execFn() {
return _execFn2.apply(this, arguments);
}, {
loading,
error
}];
};
+52
View File
@@ -0,0 +1,52 @@
// Metro module 4233 (f4234).
import _slicedToArray from "../_bundle/_slicedToArray";
import UserStore from "../stores/UserStore";
import SKUStore from "../stores/game_store/SKUStore";
import { LibraryApplicationFlags, LocalDispatchApplicationStates, StatusTypes } from "../Constants";
import { ShowCurrentGame, StatusSetting } from "../modules/user_settings/UserSettings";
export function getComboId(a0, a1) {
return `${a0}:${a1}`;
}
export function convertComboId(a0) {
const r8 = _slicedToArray(a0.split(":"), 2);
return {
applicationId: r8[0],
branchId: r8[1]
};
}
export function shouldShareApplicationActivity(a0, a1) {
if (ShowCurrentGame.getSetting() && StatusSetting.getSetting() !== StatusTypes.INVISIBLE) {
const activeLibraryApplication = a1.getActiveLibraryApplication(a0);
return activeLibraryApplication == null || !activeLibraryApplication.hasFlag(LibraryApplicationFlags.PRIVATE);
}
return false;
}
export function calculateProgressPercentage(a0, a1) {
return a1 !== 0 ? a0 / a1 * 100 : 100;
}
export function shouldShowGameInLibrary(a0, a1, a2) {
let r6 = a1 != null;
if (r6) {
const enabled = a2.enabled;
r6 = (enabled ? !a1.hasFlag(LibraryApplicationFlags.PRIVATE) : !enabled) && !a1.isHidden();
}
return r6;
}
export function convertToTransitionState(a0) {
return a0 == null ? null : a0.type !== LocalDispatchApplicationStates.INSTALLING && a0.type !== LocalDispatchApplicationStates.UPDATING ? a0.type === LocalDispatchApplicationStates.UNINSTALLING ? a0 : null : a0;
}
export function getCombinedProgress(a0) {
return a0.reduce((acc, item) => {
const r4 = item == null ? null : item.type !== LocalDispatchApplicationStates.INSTALLING && item.type !== LocalDispatchApplicationStates.UPDATING ? item.type === LocalDispatchApplicationStates.UNINSTALLING ? item : null : item;
return r4 != null ? item.type !== LocalDispatchApplicationStates.UP_TO_DATE ? {
total: acc.total + Number(r4.total),
progress: acc.progress + Number(r4.progress)
} : acc : acc;
}, {
total: 0,
progress: 0
});
}
export function isUserEntitledToLibraryApplication(a0) {
return !!a0.isDiscordApplication() && a0.isEntitled(UserStore.getCurrentUser(), SKUStore);
}
+20
View File
@@ -0,0 +1,20 @@
// Metro module 11712 (f11713).
import { intl, t } from "../intl/index.native";
export function getListSummaryLabel(a0, a1) {
const r9 = a1 == null ? a0.length : a1;
return r9 !== 0 ? r9 === 1 ? intl.formatToPlainString(t["8s9z8P"], {
first: a0[0]
}) : r9 === 2 ? intl.formatToPlainString(t["i0K/dw"], {
first: a0[0],
second: a0[1]
}) : r9 === 3 ? intl.formatToPlainString(t["/KSOKY"], {
first: a0[0],
second: a0[1],
third: a0[2]
}) : intl.formatToPlainString(t.xpU76u, {
first: a0[0],
second: a0[1],
third: a0[2],
count: r9 - 3
}) : "";
}
+33
View File
@@ -0,0 +1,33 @@
// Metro module 9199 (f9200).
import { NativeModules } from "react-native";
import { isMetaQuest } from "../modules/device/MetaQuestUtils.android";
import Module9200 from "../_bundle/Module9200";
import SentryUtils_native from "./SentryUtils.native";
let r16 = window?.crypto;
if (r16 == null) {
r16 = window?.msCrypto;
}
const msCrypto = r16;
const r3 = "Uint8Array" in window;
const r22 = msCrypto != null && "getRandomValues" in msCrypto && r3;
const r29 = NativeModules.DCDSecurityKeyManager != null && !isMetaQuest();
export function encodeTotpSecret(a0) {
return a0.replace(/[\s._-]+/g, "").toUpperCase();
}
export { r22 as hasCrypto };
export { r29 as hasWebAuthn };
export function generateTotpSecret() {
return Module9200.encode(msCrypto.getRandomValues(new Uint8Array(20))).toString("utf8").replace(/=/g, "").toLowerCase().replace(/(\w{4})/g, "$1 ").trim();
}
export function encodeTotpSecretAsUrl(a0, a1, r3 = "Discord") {
return `otpauth://totp/${encodeURI(r3)}:${encodeURI(a0)}?secret=${a1.replace(/[\s._-]+/g, "").toUpperCase()}&issuer=${encodeURIComponent(r3)}`;
}
export function captureWebAuthnException(a0, a1) {
SentryUtils_native.captureException(a0, {
...a1,
tags: {
...a1?.tags,
app_context: "webauthn"
}
});
}
+256
View File
@@ -0,0 +1,256 @@
// Metro module 8200 (f8201).
import BlockedDomainStore from "../modules/blocked_domains/BlockedDomainStore";
import ChannelStore from "../stores/ChannelStore";
import GuildStore from "../stores/GuildStore";
import MaskedLinkStore from "../stores/MaskedLinkStore";
import MessageStore from "../stores/MessageStore";
import RelationshipStore from "../stores/RelationshipStore";
import SelectedChannelStore from "../stores/SelectedChannelStore";
import { AnalyticEvents, ChannelTypes, GuildFeatures, MessageFlags } from "../Constants";
import Module3888 from "../_bundle/Module3888";
import AlertActionCreators from "../actions/AlertActionCreators";
import { intl, t } from "../intl/index.native";
import AnalyticsUtils from "./AnalyticsUtils";
import { getHostname, getProtocol } from "../stores/MaskedLinkStoreMethodsAdditional.native";
import isChangelogChannel from "../modules/changelog/utils/isChangelogChannel";
import LinkAnalyticsUtils from "../modules/links/LinkAnalyticsUtils";
import * as _getOnClick from "../lib/getOnClick";
import openURL from "../lib/openURL";
import BlockedDomainModalActionCreators_native from "../modules/blocked_domains/BlockedDomainModalActionCreators.native";
import { TRUSTED_URLS } from "../modules/masked_link/constants/TrustedURLs";
import { punycodeLink } from "../modules/markup/MarkupLinkRule";
import MaskedLinkModalActionCreators_native from "../modules/masked_link/MaskedLinkModalActionCreators.native";
import { trustProtocol, trustDomain } from "../actions/MaskedLinkActionCreators";
export function isLinkTrusted(a0, a1) {
const channel = ChannelStore.getChannel(SelectedChannelStore.getChannelId());
let r0 = channel != null && channel.type === ChannelTypes.DM;
if (r0) {
let r16 = channel.getRecipientId();
if (r16 == null) {
r16 = "";
}
r0 = !RelationshipStore.isFriend(r16);
}
return r0 ? !r0 : a0 === a1;
}
export function handleClick(a0, a1, analyticsLocations = [], contextKey) {
let r68, r69, r70, handleConfirm, target;
const { trusted, onClick, onConfirm } = a0;
let onCancel = a0.onCancel;
const { shouldConfirm, messageId: messageId2, channelId } = a0;
const r13 = Module3888.sanitizeUrl(a0.href);
if (r13 == null) {
if (a1 != null) {
a1.preventDefault();
}
AlertActionCreators.show({
title: intl.string(t.x87gan),
body: intl.format(t["9rqRwl"], {
url: a0.href
}),
isDismissable: true,
contextKey
});
return void 0;
}
let c16346_2 = r13;
try {
decodeURI(r13);
target = r13;
} catch ($e) {
const r43 = encodeURI(r13);
c16346_2 = r43;
target = r43;
}
let guildId = null;
let c16346_4 = false;
let messageId = messageId2;
let channelId2 = channelId;
let guild_id = null;
const r19 = messageId2 != null;
let sourceGuildId = null;
let sourceChannelId = channelId;
let messageId3 = messageId2;
let r45 = false;
let guildId2 = null;
if (r19) {
const r46 = channelId != null;
sourceGuildId = null;
sourceChannelId = channelId;
messageId3 = messageId2;
r45 = false;
guildId2 = null;
if (r46) {
const message = MessageStore.getMessage(channelId, messageId2);
const basicChannel = ChannelStore.getBasicChannel(channelId);
let r52 = basicChannel?.guild_id;
if (r52 == null) {
r52 = null;
}
guildId = r52;
const guild = GuildStore.getGuild(r52);
let r27 = (message == null ? void 0 : message.messageReference?.guild_id) != null && message?.webhookId != null && (message == null ? void 0 : message.hasFlag(MessageFlags.IS_CROSSPOST)) && r52 != null;
L32: {
if (r27) {
if ((message == null ? void 0 : message.messageReference?.guild_id) != null) {
const message_id = message.messageReference.message_id;
messageId = message_id;
const channel_id = message.messageReference.channel_id;
channelId2 = channel_id;
const guild_id2 = message.messageReference.guild_id;
guild_id = guild_id2;
r68 = guild_id2;
r69 = channel_id;
r70 = message_id;
break L32;
}
}
guild_id = r52;
r68 = r52;
r69 = channelId;
r70 = messageId2;
}
const r78 = basicChannel?.type === ChannelTypes.GUILD_ANNOUNCEMENT && (guild == null ? void 0 : guild.features.has(GuildFeatures.COMMUNITY)) === true;
const r87 = message == null ? void 0 : message.hasFlag(MessageFlags.EPHEMERAL);
let r91 = message != null && !(r87 === true);
if (r91) {
if (!r27) {
r27 = r78;
}
r91 = r27;
}
c16346_4 = r91;
r45 = r91;
sourceGuildId = r68;
sourceChannelId = r69;
messageId3 = r70;
guildId2 = r52;
}
}
if (channelId != null) {
const channel = ChannelStore.getChannel(channelId);
const guild2 = GuildStore.getGuild(channel == null ? void 0 : channel.getGuildId());
if (channel != null && guild2 != null && guild2.features.has(GuildFeatures.DISCOVERABLE)) {
AnalyticsUtils.track(AnalyticEvents.URL_CLICKED, {
url_domain: getHostname(target),
guild_id: guild2.id,
channel_id: channel.id
});
}
if (isChangelogChannel(channelId)) {
AnalyticsUtils.track(AnalyticEvents.CHANGE_LOG_CTA_CLICKED, {
cta_type: "inline_link",
target
});
}
}
LinkAnalyticsUtils.trackLinkClicked(target);
if (onClick != null) {
if (onClick(a1)) {
return void 0;
}
} else {
const r141 = (0, _getOnClick.default)(target, {
skipExtensionCheck: void 0,
analyticsLocations,
messageId: messageId2,
channelId
});
if (r141 != null && r141(a1)) {
return void 0;
}
}
if (onCancel == null) {
onCancel = () => {};
}
if (BlockedDomainStore.isBlockedDomain(target) !== null) {
if (a1 != null) {
a1.preventDefault();
}
BlockedDomainModalActionCreators_native.show(target);
return void 0;
}
let r147 = trusted;
if (typeof r147 === "function") {
r147 = trusted();
}
if (!r147) {
r147 = TRUSTED_URLS.has(target);
}
const protocol = getProtocol(target);
const r159 = protocol === "http:" || protocol === "https:";
L90: {
L84: {
handleConfirm = function handleConfirm() {
if (c16346_4) {
LinkAnalyticsUtils.trackAnnouncementMessageLinkClicked({
messageId,
channelId,
guildId,
sourceChannelId: channelId2,
sourceGuildId: guild_id
});
}
if (onConfirm == null) {
openURL(c16346_2);
} else {
onConfirm();
}
};
const r162 = !r159;
if (!r162) {
if (r147) {
break L84;
}
if (MaskedLinkStore.isTrustedDomain(target)) {
break L84;
}
}
if (!(r162 && MaskedLinkStore.isTrustedProtocol(target))) {
if (a1 != null) {
a1.preventDefault();
}
if (r162) {
MaskedLinkModalActionCreators_native.show({
url: target,
trustUrl: trustProtocol,
onConfirm: handleConfirm,
onCancel,
isProtocol: true,
contextKey
});
break L90;
}
const r174 = punycodeLink(target);
MaskedLinkModalActionCreators_native.show({
url: r174 != null ? r174.displayTarget : target,
trustUrl: trustDomain,
onConfirm: handleConfirm,
onCancel,
isProtocol: false,
contextKey
});
break L90;
}
}
L89: {
if (a1 != null) {
if (shouldConfirm != null && shouldConfirm) {
break L89;
}
if (!r45) {
break L90;
}
LinkAnalyticsUtils.trackAnnouncementMessageLinkClicked({
messageId: messageId3,
channelId,
guildId: guildId2,
sourceChannelId,
sourceGuildId
});
break L90;
}
}
handleConfirm();
}
}
+16
View File
@@ -0,0 +1,16 @@
// Metro module 6139 (f6140).
const r9 = {
makeMemoizer: function makeMemoizer(c15496_0) {
let c15496_1 = new Map();
return (a0) => {
let r6 = c15496_1.get(a0);
if (r6 === void 0) {
const r8 = c15496_0(a0);
c15496_1.set(a0, r8);
r6 = r8;
}
return r6;
};
}
};
export default r9;
+98
View File
@@ -0,0 +1,98 @@
// Metro module 9574 (f9575).
import _slicedToArray from "../_bundle/_slicedToArray";
import ChannelMemberStore from "../stores/ChannelMemberStore";
import PermissionStore from "../stores/PermissionStore";
import { Permissions } from "../Constants";
import Module38 from "../_bundle/Module38";
import MessageParser from "../modules/messages/MessageParser";
function $mk82798($env) {
return (a0) => {
const r3 = $env;
if (!(r3[0] !== "@everyone" && a0.id === $env.$parent[6].OFFLINE)) {
r3[1] = r3[1] + a0.count;
}
};
}
let c6318_7;
let env6318 = {};
const parsedItemUsesEveryoneRole = function parsedItemUsesEveryoneRole(a0) {
L14: {
if (typeof a0.content === "string") {
if (a0.type !== "inlineCode" && a0.type !== "codeBlock") {
const content = a0.content;
const r43 = content == null ? void 0 : content.match(c6318_7);
if (r43 != null) {
return _slicedToArray(r43, 1)[0];
}
break L14;
}
return null;
}
if (Array.isArray(a0.content)) {
for (const item of a0.content) {
const r32 = parsedItemUsesEveryoneRole(item);
if (r32 == null) {
continue;
}
return r32;
}
return null;
}
}
return null;
};
c6318_7 = new RegExp(/@(:?everyone|here)/);
const r32 = {
shouldShowEveryoneGuard: function shouldShowEveryoneGuard(a0, a1) {
let r28;
let env17312;
Module38(a1.getGuildId() != null, "isGuildChannel with null guildId");
const r16 = env17312 = {
$parent: env6318
};
env17312[0] = a0;
env17312[1] = 0;
if (a1.isThread()) {
let memberCount = a1.memberCount;
if (memberCount == null) {
memberCount = 0;
}
r28 = memberCount;
} else {
ChannelMemberStore.getProps(a1.getGuildId(), a1.id).groups.forEach($mk82798(r16));
r28 = env17312[1];
}
return r28 > 30 && PermissionStore.can(Permissions.MENTION_EVERYONE, a1);
},
everyoneMemberCount: function everyoneMemberCount(a0, a1) {
let r18;
let env17311;
const r2 = env17311 = {
$parent: env6318
};
env17311[0] = a0;
env17311[1] = 0;
if (a1.isThread()) {
let memberCount = a1.memberCount;
if (memberCount == null) {
memberCount = 0;
}
r18 = memberCount;
} else {
ChannelMemberStore.getProps(a1.getGuildId(), a1.id).groups.forEach($mk82798(r2));
r18 = env17311[1];
}
return r18;
},
extractEveryoneRole: function extractEveryoneRole(a0, a1) {
for (const item of MessageParser.parsePreprocessor(a1, a0)) {
const r32 = parsedItemUsesEveryoneRole(item);
if (r32 == null) {
continue;
}
return r32;
}
return null;
}
};
export default r32;
+137
View File
@@ -0,0 +1,137 @@
// Metro module 13868 (f13869).
import { GuildExplicitContentFilterTypes, VerificationCriteria, VerificationLevels } from "../Constants";
import { ExplicitContentFilterTypes } from "../modules/user_settings/privacy_and_safety/DMSafetyConstants";
import { unsafe_getRawColor } from "../_bundle/Module711";
import { HighlightColors } from "../modules/guild_settings/safety/HighlightedSettingsTypes";
import { intl, t } from "../intl/index.native";
import { DmSpamFilterV2 } from "../_bundle/Module1306";
const mapColorToHighlightColor = function mapColorToHighlightColor(color) {
if (unsafe_getRawColor("PRIMARY_400") === color) {
return HighlightColors.ACCENT;
}
if (unsafe_getRawColor("GREEN_360") === color) {
return HighlightColors.GREEN;
}
if (unsafe_getRawColor("YELLOW_360") === color) {
return HighlightColors.YELLOW;
}
if (unsafe_getRawColor("ORANGE_345") === color) {
return HighlightColors.ORANGE;
}
if (unsafe_getRawColor("RED_400") === color) {
return HighlightColors.RED;
}
return HighlightColors.NONE;
};
export { mapColorToHighlightColor };
export function mapOptionToHighlightedRowOptions(a0) {
return a0.map((item) => ({
title: item.name,
description: item.desc,
highlightColor: mapColorToHighlightColor(item.color),
value: item.value,
disabled: item.disabled
}));
}
export function generateVerificationLevelOptions(disabled = false, r7 = false) {
return [{
name: intl.string(t.PEzffq),
desc: disabled ? intl.string(t.j9WtHx) : intl.string(t.nDQy0p),
value: VerificationLevels.NONE,
disabled
}, {
name: intl.string(t.SsCK8I),
desc: intl.string(t["8GCOX6"]),
value: VerificationLevels.LOW,
color: r7 ? void 0 : unsafe_getRawColor("GREEN_360")
}, {
name: intl.string(t.WwNoR4),
desc: intl.formatToPlainString(t.VS14ga, {
min: VerificationCriteria.ACCOUNT_AGE
}),
value: VerificationLevels.MEDIUM,
color: r7 ? void 0 : unsafe_getRawColor("YELLOW_360")
}, {
name: intl.string(t.I2jMUF),
desc: intl.formatToPlainString(t["r+b3I4"], {
min: VerificationCriteria.MEMBER_AGE
}),
value: VerificationLevels.HIGH,
color: r7 ? void 0 : unsafe_getRawColor("ORANGE_345")
}, {
name: intl.string(t.cJY8w9),
desc: intl.string(t.PWaKme),
value: VerificationLevels.VERY_HIGH,
color: r7 ? void 0 : unsafe_getRawColor("RED_400")
}];
}
export function generateContentFilterHighlightedOptions(disabled = false) {
return [{
name: intl.string(t.iHuPE6),
desc: intl.string(t["Z+yUWF"]),
value: GuildExplicitContentFilterTypes.ALL_MEMBERS,
color: unsafe_getRawColor("RED_400")
}, {
name: intl.string(t.ynfFaI),
desc: disabled ? intl.string(t.j9WtHx) : intl.string(t["3fRIN4"]),
value: GuildExplicitContentFilterTypes.MEMBERS_WITHOUT_ROLES,
disabled,
color: unsafe_getRawColor("YELLOW_360")
}, {
name: intl.string(t.VbSyAx),
desc: disabled ? intl.string(t.j9WtHx) : intl.string(t.M6GNsJ),
value: GuildExplicitContentFilterTypes.DISABLED,
disabled,
color: unsafe_getRawColor("PRIMARY_400")
}];
}
export function generateContentFilterOptions(disabled = false) {
return [{
name: intl.string(t.iHuPE6),
desc: intl.string(t["Z+yUWF"]),
value: GuildExplicitContentFilterTypes.ALL_MEMBERS
}, {
name: intl.string(t.ynfFaI),
desc: disabled ? intl.string(t.j9WtHx) : intl.string(t["3fRIN4"]),
value: GuildExplicitContentFilterTypes.MEMBERS_WITHOUT_ROLES,
disabled
}, {
name: intl.string(t.VbSyAx),
desc: disabled ? intl.string(t.j9WtHx) : intl.string(t.M6GNsJ),
value: GuildExplicitContentFilterTypes.DISABLED,
disabled
}];
}
export function generateDmSpamOptions() {
return [{
name: intl.string(t["4IaoCI"]),
desc: intl.string(t.TgipjE),
value: DmSpamFilterV2.FRIENDS_AND_NON_FRIENDS
}, {
name: intl.string(t["6NnX6F"]),
desc: intl.string(t["+dw1qu"]),
value: DmSpamFilterV2.NON_FRIENDS
}, {
name: intl.string(t["1tiAFz"]),
desc: intl.string(t.LKTyeA),
value: DmSpamFilterV2.DISABLED
}];
}
export function generateExplicitImageOptions() {
return [{
name: intl.string(t.PhNlhz),
desc: intl.string(t["Fw+Lvp"]),
value: ExplicitContentFilterTypes.FRIENDS_AND_NON_FRIENDS,
color: unsafe_getRawColor("GREEN_360")
}, {
name: intl.string(t["8ioJ4S"]),
desc: intl.string(t.z4l4Cr),
value: ExplicitContentFilterTypes.NON_FRIENDS,
color: unsafe_getRawColor("YELLOW_360")
}, {
name: intl.string(t.FLfuhL),
desc: intl.string(t.MoZlaD),
value: ExplicitContentFilterTypes.DISABLED,
color: unsafe_getRawColor("RED_400")
}];
}
+25
View File
@@ -0,0 +1,25 @@
// Metro module 1454 (f1455).
import * as _NetworkUtils from "./native/NetworkUtils";
let c1176_2 = [];
let c1176_3 = false;
const r15 = {
..._NetworkUtils.default,
awaitOnline: () => new Promise((resolve) => {
if (_NetworkUtils.default.isOnline()) {
return resolve();
}
const whenOnline2 = function whenOnline() {
c1176_2.forEach((item) => item());
c1176_2.length = 0;
c1176_3 = false;
_NetworkUtils.default.removeOnlineCallback(whenOnline2);
};
c1176_2.push(resolve);
if (c1176_3) {
return void 0;
}
c1176_3 = true;
_NetworkUtils.default.addOnlineCallback(whenOnline2);
})
};
export default r15;
+58
View File
@@ -0,0 +1,58 @@
// Metro module 4379 (f4380).
import ChannelStore from "../stores/ChannelStore";
import GuildMemberStore from "../stores/GuildMemberStore";
import RelationshipStore from "../stores/RelationshipStore";
import { intl, t } from "../intl/index.native";
import UserUtils from "./UserUtils";
import { useStateFromStores } from "../_bundle/Module589";
let getName;
export function getNickname(a0, a1, a2) {
if (a2 == null) {
return null;
}
if (a0 != null) {
return GuildMemberStore.getNick(a0, a2.id);
}
if (a1 != null) {
const channel = ChannelStore.getChannel(a1);
if (channel == null ? void 0 : channel.isPrivate()) {
return RelationshipStore.getNickname(a2.id);
}
}
return null;
}
getName = function getName(a0, id, a2) {
let r2;
if (a2 == null) {
r2 = intl.string(t.sKdZ6U);
} else {
const r1 = a2 == null;
r2 = null;
if (!r1) {
if (a0 != null) {
r2 = GuildMemberStore.getNick(a0, a2.id);
} else {
const r9 = id != null;
r2 = null;
if (r9) {
const channel = ChannelStore.getChannel(id);
r2 = (channel == null ? void 0 : channel.isPrivate()) ? RelationshipStore.getNickname(a2.id) : null;
}
}
}
if (r2 == null) {
r2 = UserUtils.getName(a2);
}
}
return r2;
};
export function useName(c14149_0, c14149_1, c14149_2) {
return useStateFromStores([GuildMemberStore, ChannelStore, RelationshipStore], () => getName(c14149_0, c14149_1, c14149_2));
}
const r21 = {
getNickname,
getName,
useName
};
export default r21;
export { getName };
+296
View File
@@ -0,0 +1,296 @@
// Metro module 5130 (f5131).
import LastMentionTimestampStore from "../modules/notifications/LastMentionTimestampStore";
import ChannelStore from "../stores/ChannelStore";
import MessageStore from "../stores/MessageStore";
import UserGuildSettingsStore from "../stores/UserGuildSettingsStore";
import { AnalyticEvents, UserNotificationSettings } from "../Constants";
import { NotificationSettingsUpdateType } from "../modules/notifications/NotificationConstants";
import { UnreadSetting } from "../modules/read_states/ReadStateConstants";
import { ChannelNotificationSettingsFlags, GuildNotificationSettingsFlags } from "../modules/user_settings/UserSettingsConstants";
import { removeFlags } from "../_bundle/Module1384";
import AppAnalyticsUtils from "../modules/app_analytics/AppAnalyticsUtils";
import AnalyticsUtils from "./AnalyticsUtils";
let c3092_14;
let c3092_13 = {
ForumThreadsCreatedOn: "enabled forum thread created notifs",
ForumThreadsCreatedOff: "disabled forum thread created notifs",
SuppressEveryoneOn: "enabled suppress everyone",
SuppressEveryoneOff: "disabled suppress everyone",
SuppressRolesOn: "enabled suppress roles",
SuppressRolesOff: "disabled suppress roles",
HighlightsOn: "enabled highlights",
HighlightsOff: "disabled highlights",
MobilePushOn: "enabled mobile push notifications",
MobilePushOff: "disabled mobile push notifications",
UnreadsAll: "unreads set to all messages",
UnreadsMentions: "unreads set to mentions",
UnreadsDefault: "unreads set to the default",
NotificationsAll: "notifications set to all messages",
NotificationsMentions: "notifications set to mentions",
NotificationsNothing: "notifications set to nothing",
NotificationsDefault: "notifications set to the default",
PresetAll: "notification preset set to all messages",
PresetMentions: "notification preset set to mentions",
PresetNothing: "notification preset set to nothing",
PresetDefault: "notification preset set to the default",
OptedIn: "opted in to entity",
OptedOut: "opted out from entity",
Favorited: "favorited",
UnFavorited: "unfavorited",
Muted: "muted",
Unmuted: "unmuted",
MutedScheduledEvents: "muted scheduled events",
UnmutedScheduledEvents: "unmuted scheduled events",
OverrideCreated: "channel override created",
OverrideDeleted: "channel override deleted",
AnnouncementAutoEnable: "announcement channels auto set to all messages"
};
const r71 = {
forumThreadsCreated: (a0) => a0 ? c3092_13.ForumThreadsCreatedOn : c3092_13.ForumThreadsCreatedOff,
suppressEveryone: (a0) => a0 ? c3092_13.SuppressEveryoneOn : c3092_13.SuppressEveryoneOff,
suppressRoles: (a0) => a0 ? c3092_13.SuppressRolesOn : c3092_13.SuppressRolesOff,
highlights: (a0) => a0 ? c3092_13.HighlightsOn : c3092_13.HighlightsOff,
mobilePush: (a0) => a0 ? c3092_13.MobilePushOn : c3092_13.MobilePushOff,
optedIn: (a0) => a0 ? c3092_13.OptedIn : c3092_13.OptedOut,
favorited: (a0) => a0 ? c3092_13.Favorited : c3092_13.UnFavorited,
muted: (a0) => a0 ? c3092_13.Muted : c3092_13.Unmuted,
mutedEvents: (a0) => a0 ? c3092_13.MutedScheduledEvents : c3092_13.UnmutedScheduledEvents,
unreads: (a0) => a0 === UnreadSetting.ALL_MESSAGES ? c3092_13.UnreadsAll : a0 === UnreadSetting.ONLY_MENTIONS ? c3092_13.UnreadsMentions : c3092_13.UnreadsDefault,
notifications: (a0) => a0 === UserNotificationSettings.ALL_MESSAGES ? c3092_13.NotificationsAll : a0 === UserNotificationSettings.ONLY_MENTIONS ? c3092_13.NotificationsMentions : a0 === UserNotificationSettings.NO_MESSAGES ? c3092_13.NotificationsNothing : c3092_13.NotificationsDefault
};
const r82 = Object;
const r84 = {};
r84[UserNotificationSettings.ALL_MESSAGES] = "All";
r84[UserNotificationSettings.ONLY_MENTIONS] = "Mentions";
r84[UserNotificationSettings.NO_MESSAGES] = "Nothing";
r84[UserNotificationSettings.NULL] = null;
c3092_14 = r82.freeze(r84);
export { c3092_13 as NotificationLabels };
export { r71 as NotificationLabel };
export { c3092_14 as MessageNotificationSettings };
export function trackGuildNotificationSettingsUpdate(a0, a1, a2, a3, a4) {
const compute2 = function compute(a0, r2 = {}) {
const guild_muted_until = r2.mute_config != null && r2.mute_config.end_time != null ? new Date(r2.mute_config.end_time).getTime() : a0.guild_muted_until;
const guild_message_notification_settings = r2.message_notifications != null ? c3092_14[r2.message_notifications] : a0.guild_message_notification_settings;
let flags = r2.flags;
if (flags == null) {
flags = a0.guild_flags;
}
let muted2 = r2.muted;
if (muted2 == null) {
muted2 = a0.guild_is_muted;
}
let suppress_roles = r2.suppress_roles;
if (suppress_roles == null) {
suppress_roles = a0.guild_suppress_roles;
}
let mobile_push = r2.mobile_push;
if (mobile_push == null) {
mobile_push = a0.guild_receive_mobile_push;
}
let notify_highlights = r2.notify_highlights;
if (notify_highlights == null) {
notify_highlights = a0.guild_notify_highlights;
}
let suppress_everyone = r2.suppress_everyone;
if (suppress_everyone == null) {
suppress_everyone = a0.guild_suppress_everyone;
}
let mute_scheduled_events = r2.mute_scheduled_events;
if (mute_scheduled_events == null) {
mute_scheduled_events = a0.guild_scheduled_events_muted;
}
return {
guild_muted_until,
guild_flags: flags,
guild_is_muted: muted2,
guild_message_notification_settings,
guild_suppress_roles: suppress_roles,
guild_receive_mobile_push: mobile_push,
guild_notify_highlights: notify_highlights,
guild_suppress_everyone: suppress_everyone,
guild_scheduled_events_muted: mute_scheduled_events
};
};
const r9 = compute2(a2);
const isMuted = UserGuildSettingsStore.isMuted(a0);
const muteConfig = UserGuildSettingsStore.getMuteConfig(a0);
const r47 = compute2({
guild_suppress_everyone: UserGuildSettingsStore.isSuppressEveryoneEnabled(a0),
guild_suppress_roles: UserGuildSettingsStore.isSuppressRolesEnabled(a0),
guild_scheduled_events_muted: UserGuildSettingsStore.isMuteScheduledEventsEnabled(a0),
guild_is_muted: isMuted,
guild_muted_until: muteConfig != null ? muteConfig.end_time != null ? new Date(muteConfig.end_time).getTime() : null : null,
guild_receive_mobile_push: UserGuildSettingsStore.isMobilePushEnabled(a0),
guild_message_notification_settings: c3092_14[UserGuildSettingsStore.getMessageNotifications(a0)],
guild_notify_highlights: UserGuildSettingsStore.getNotifyHighlights(a0),
guild_flags: UserGuildSettingsStore.getGuildFlags(a0)
}, a1);
let r51 = r9.guild_flags !== r47.guild_flags ? r9.guild_flags : void 0;
if (r51 == null) {
r51 = 0;
}
let guild_flags = r47.guild_flags;
if (guild_flags == null) {
guild_flags = 0;
}
const r62 = removeFlags(guild_flags ^ r51, GuildNotificationSettingsFlags.OPT_IN_CHANNELS_OFF, GuildNotificationSettingsFlags.OPT_IN_CHANNELS_ON);
const NOTIFICATION_SETTINGS_UPDATED = AnalyticEvents.NOTIFICATION_SETTINGS_UPDATED;
const r69 = {
...r47,
...LastMentionTimestampStore.getStats(a0),
location: a4,
guild_id: a0,
update_type: NotificationSettingsUpdateType.GUILD,
label: a3,
guild_flags_old: r9.guild_flags !== r47.guild_flags ? r9.guild_flags : void 0,
guild_is_muted_old: r9.guild_is_muted !== r47.guild_is_muted ? r9.guild_is_muted : void 0,
guild_suppress_roles_old: r9.guild_suppress_roles !== r47.guild_suppress_roles ? r9.guild_suppress_roles : void 0,
guild_notify_highlights_old: r9.guild_notify_highlights !== r47.guild_notify_highlights ? r9.guild_notify_highlights : void 0,
guild_suppress_everyone_old: r9.guild_suppress_everyone !== r47.guild_suppress_everyone ? r9.guild_suppress_everyone : void 0,
guild_receive_mobile_push_old: r9.guild_receive_mobile_push !== r47.guild_receive_mobile_push ? r9.guild_receive_mobile_push : void 0,
guild_scheduled_events_muted_old: r9.guild_scheduled_events_muted !== r47.guild_scheduled_events_muted ? r9.guild_scheduled_events_muted : void 0
};
const guild_message_notification_settings_old = r9.guild_message_notification_settings !== r47.guild_message_notification_settings ? r9.guild_message_notification_settings : void 0;
const is_opt_in_only_change = r62 === 0;
r69.guild_message_notification_settings_old = guild_message_notification_settings_old;
r69.is_opt_in_only_change = is_opt_in_only_change;
AppAnalyticsUtils.trackWithMetadata(NOTIFICATION_SETTINGS_UPDATED, r69);
}
export function muteConfigToTimestamp(a0) {
return a0 != null ? a0.end_time != null ? new Date(a0.end_time).getTime() : null : null;
}
export function trackChannelNotificationSettingsUpdate({ updateType = NotificationSettingsUpdateType.CHANNEL, guildId, channelId, applicationId, change, previous, label, location: location2 }) {
const compute2 = function compute(a0, r5 = {}) {
let muted2 = r5.muted;
if (muted2 == null) {
muted2 = a0?.channel_is_muted;
}
const channel_message_notification_settings = r5.message_notifications != null ? c3092_14[r5.message_notifications] : a0?.channel_message_notification_settings;
const channel_is_overridden = guildId == null ? null : muted2 === true || channel_message_notification_settings != null;
let flags = r5.flags;
if (flags == null) {
flags = a0?.channel_flags;
}
const mute_config = r5.mute_config;
return {
channel_is_muted: muted2,
channel_is_overridden,
channel_flags: flags,
channel_message_notification_settings,
channel_muted_until: mute_config != null ? mute_config.end_time != null ? new Date(mute_config.end_time).getTime() : null : null
};
};
const r11 = compute2(previous);
const isChannelMuted = UserGuildSettingsStore.isChannelMuted(guildId, channelId);
const channelMuteConfig = UserGuildSettingsStore.getChannelMuteConfig(guildId, channelId);
const r44 = compute2({
channel_is_muted: isChannelMuted,
channel_muted_until: channelMuteConfig != null ? channelMuteConfig.end_time != null ? new Date(channelMuteConfig.end_time).getTime() : null : null,
channel_message_notification_settings: c3092_14[UserGuildSettingsStore.getChannelMessageNotifications(guildId, channelId)],
channel_flags: UserGuildSettingsStore.getChannelIdFlags(guildId, channelId)
}, change);
const channel = ChannelStore.getChannel(channelId);
let r50 = r11.channel_flags !== r44.channel_flags ? r11.channel_flags : void 0;
if (r50 == null) {
r50 = 0;
}
let channel_flags = r44.channel_flags;
if (channel_flags == null) {
channel_flags = 0;
}
const r61 = removeFlags(channel_flags ^ r50, ChannelNotificationSettingsFlags.FAVORITED, ChannelNotificationSettingsFlags.OPT_IN_ENABLED);
let last_message_type = MessageStore.getLastMessage(channelId)?.type;
if (last_message_type == null) {
last_message_type = null;
}
const NOTIFICATION_SETTINGS_UPDATED = AnalyticEvents.NOTIFICATION_SETTINGS_UPDATED;
const r73 = {
...r44,
...LastMentionTimestampStore.getStats(guildId),
location: location2,
guild_id: guildId,
channel_id: channelId,
update_type: updateType,
label,
parent_id: channel != null ? channel.parent_id : null,
channel_flags_old: r11.channel_flags !== r44.channel_flags ? r11.channel_flags : void 0,
channel_is_muted_old: r11.channel_is_muted !== r44.channel_is_muted ? r11.channel_is_muted : void 0,
channel_muted_until_old: r11.channel_muted_until !== r44.channel_muted_until ? r11.channel_muted_until : void 0,
channel_is_overridden_old: r11.channel_is_overridden !== r44.channel_is_overridden ? r11.channel_is_overridden : void 0
};
const channel_message_notification_settings_old = r11.channel_message_notification_settings !== r44.channel_message_notification_settings ? r11.channel_message_notification_settings : void 0;
const is_opt_in_only_change = r61 === 0;
r73.channel_message_notification_settings_old = channel_message_notification_settings_old;
r73.is_opt_in_only_change = is_opt_in_only_change;
r73.last_message_type = last_message_type;
r73.application_id = applicationId;
AppAnalyticsUtils.trackWithMetadata(NOTIFICATION_SETTINGS_UPDATED, r73);
}
export function getCurrentGuildSettings(a0) {
const isMuted = UserGuildSettingsStore.isMuted(a0);
const muteConfig = UserGuildSettingsStore.getMuteConfig(a0);
return {
guild_suppress_everyone: UserGuildSettingsStore.isSuppressEveryoneEnabled(a0),
guild_suppress_roles: UserGuildSettingsStore.isSuppressRolesEnabled(a0),
guild_scheduled_events_muted: UserGuildSettingsStore.isMuteScheduledEventsEnabled(a0),
guild_is_muted: isMuted,
guild_muted_until: muteConfig != null ? muteConfig.end_time != null ? new Date(muteConfig.end_time).getTime() : null : null,
guild_receive_mobile_push: UserGuildSettingsStore.isMobilePushEnabled(a0),
guild_message_notification_settings: c3092_14[UserGuildSettingsStore.getMessageNotifications(a0)],
guild_notify_highlights: UserGuildSettingsStore.getNotifyHighlights(a0),
guild_flags: UserGuildSettingsStore.getGuildFlags(a0)
};
}
export function getManyCurrentGuildSettings(a0) {
const map = new Map();
let c14691_0 = map;
a0.forEach((item) => {
const isMuted = UserGuildSettingsStore.isMuted(item);
const muteConfig = UserGuildSettingsStore.getMuteConfig(item);
return c14691_0.set(item, {
guild_suppress_everyone: UserGuildSettingsStore.isSuppressEveryoneEnabled(item),
guild_suppress_roles: UserGuildSettingsStore.isSuppressRolesEnabled(item),
guild_scheduled_events_muted: UserGuildSettingsStore.isMuteScheduledEventsEnabled(item),
guild_is_muted: isMuted,
guild_muted_until: muteConfig != null ? muteConfig.end_time != null ? new Date(muteConfig.end_time).getTime() : null : null,
guild_receive_mobile_push: UserGuildSettingsStore.isMobilePushEnabled(item),
guild_message_notification_settings: c3092_14[UserGuildSettingsStore.getMessageNotifications(item)],
guild_notify_highlights: UserGuildSettingsStore.getNotifyHighlights(item),
guild_flags: UserGuildSettingsStore.getGuildFlags(item)
});
});
return map;
}
export function getCurrentChannelSettings(a0, a1) {
const isChannelMuted = UserGuildSettingsStore.isChannelMuted(a0, a1);
const channelMuteConfig = UserGuildSettingsStore.getChannelMuteConfig(a0, a1);
return {
channel_is_muted: isChannelMuted,
channel_muted_until: channelMuteConfig != null ? channelMuteConfig.end_time != null ? new Date(channelMuteConfig.end_time).getTime() : null : null,
channel_message_notification_settings: c3092_14[UserGuildSettingsStore.getChannelMessageNotifications(a0, a1)],
channel_flags: UserGuildSettingsStore.getChannelIdFlags(a0, a1)
};
}
export function getManyCurrentChannelSettings(c14692_0, a1) {
const map = new Map();
let c14692_1 = map;
a1.forEach((item) => {
const isChannelMuted = UserGuildSettingsStore.isChannelMuted(c14692_0, item);
const channelMuteConfig = UserGuildSettingsStore.getChannelMuteConfig(c14692_0, item);
return c14692_1.set(item, {
channel_is_muted: isChannelMuted,
channel_muted_until: channelMuteConfig != null ? channelMuteConfig.end_time != null ? new Date(channelMuteConfig.end_time).getTime() : null : null,
channel_message_notification_settings: c3092_14[UserGuildSettingsStore.getChannelMessageNotifications(c14692_0, item)],
channel_flags: UserGuildSettingsStore.getChannelIdFlags(c14692_0, item)
});
});
return map;
}
export function trackAccountNotificationSettingUpdated(a0, a1) {
AnalyticsUtils.track(AnalyticEvents.NOTIFICATION_SETTINGS_UPDATED, {
update_type: NotificationSettingsUpdateType.ACCOUNT,
quiet_mode_enabled: a0.quietMode,
quiet_mode_enabled_old: a1.quietMode
});
}
+48
View File
@@ -0,0 +1,48 @@
// Metro module 1851 (f1852).
import { intl, t } from "../intl/index.native";
let c1562_2 = 1000000;
export function shortenAndLocalizeNumber(a0) {
if (a0 < c1562_2) {
return intl.formatToPlainString(t.OiHat3, {
value: a0
});
}
return intl.formatToPlainString(t.Iku48I, {
value: (a0 / c1562_2).toFixed(1)
});
}
export function humanizeValue(a0, a1) {
if (a0 < 1000) {
return intl.formatToPlainString(t.OiHat3, {
value: Math.floor(a0)
});
}
if (a0 < c1562_2) {
return intl.formatToPlainString(t["84R4Tc"], {
value: Math.floor(a0 / 1000)
});
}
const r17 = Math.floor(10 * a0 / c1562_2) / 10;
return intl.formatToPlainString(t.Iku48I, {
value: new Intl.NumberFormat(a1, {
maximumFractionDigits: 1
}).format(r17)
});
}
export function parseInteger(a0, r3 = NaN) {
if (a0 == null) {
return r3;
}
let r7 = parseInt(a0);
if (Number.isNaN(r7)) {
r7 = r3;
}
return r7;
}
export function formatPercent(a0, a1, r6 = {}) {
return Intl.NumberFormat(a0, {
style: "percent",
minimumFractionDigits: 0,
...r6
}).format(a1);
}
+23
View File
@@ -0,0 +1,23 @@
// Metro module 4245 (f4246).
import { isWindows } from "./PlatformUtils";
export function pathJoin(...args) {
const r4 = isWindows() ? "\\" : "/";
return args.filter((arg) => arg.length > 0).join(r4);
}
export function pathBasename(a0, a1) {
let r6 = a0;
const r7 = a0.split(/[/\\]/);
if (r7[r7.length - 1] !== "") {
r6 = r7[r7.length - 1];
}
return a1 != null && r6.endsWith(a1) ? r6.slice(0, -a1.length) : r6;
}
export function pathFilenameWithoutExt(a0) {
let r5 = a0;
const r6 = a0.split(/[/\\]/);
if (r6[r6.length - 1] !== "") {
r5 = r6[r6.length - 1];
}
const r13 = r5.lastIndexOf(".");
return r13 <= 0 ? r5 : r5.slice(0, r13);
}
+4
View File
@@ -0,0 +1,4 @@
// Metro module 4637 (f4638).
import * as _PerceptualVolumeUtils from "../modules/perceptual_volume/PerceptualVolumeUtils";
export const perceptualToAmplitude = _PerceptualVolumeUtils.perceptualToAmplitude;
export const amplitudeToPerceptual = _PerceptualVolumeUtils.amplitudeToPerceptual;
+164
View File
@@ -0,0 +1,164 @@
// Metro module 15657 (f15658).
import { VOICE_THREAD_PARENT_CHANNEL_TYPES } from "../records/ChannelRecord";
import GuildStore from "../stores/GuildStore";
import { ChannelTypes, GuildFeatures, GuildSettingsSections, HelpdeskArticles, Permissions } from "../Constants";
import { getChannelPermissionSpecMap } from "../modules/channel_permissions/ChannelPermissionsConstants";
import * as _useGuildEligibleForStageChannels from "../modules/stage_channels/useGuildEligibleForStageChannels";
import { isCreatorMonetizationEnabledGuild } from "../modules/creator_monetization_eligibility/useIsCreatorMonetizationEnabledGuild";
import { getSoundmojiRenderingExperiment } from "../modules/premium/sounds/soundmoji/SoundmojiRenderingExperiment";
import { getHangoutWindowExperiment } from "../modules/hangout_window/HangoutWindowExperiment";
import { intl, t } from "../intl/index.native";
import HelpdeskUtils from "./HelpdeskUtils";
import { VoiceInThreadsExperiment } from "../modules/threads/ThreadHooks";
import * as _StageMediaHooks from "../modules/stage_channels/StageMediaHooks";
import * as _PermissionUtils from "../modules/guild_automod/PermissionUtils";
import GuildOfficialMessagesExperiment from "../modules/messages/GuildOfficialMessagesExperiment";
import * as _PermissionUtils2 from "../modules/permissions/PermissionUtils";
import { generateChannelGeneralSection, generateChannelMembershipSection, generateChannelTextSection, generateChannelVoiceSection, generateChannelAppsSection, generateChannelStageSection, generateChannelEventsSection, generateChannelVoiceChatSection, generateChannelStageVoiceSection, getGuildPermissionSpec } from "../modules/permissions/PermissionUtils";
import GuildSettingsActionCreators from "../modules/guild_settings/GuildSettingsActionCreators";
import { trackForumEnableAutomodClicked } from "../modules/forums/tracking/Tracking";
function $mk97378($env) {
return (a0) => ({
...a0,
permissions: a0.permissions.filter($mk112017($env))
});
}
function $mk112017($env) {
return (a0) => !$env[0].has(a0.flag.toString());
}
const getPermissionOptions = function getPermissionOptions(id) {
const isGuildEligibleForStageChannels = _useGuildEligibleForStageChannels.isGuildEligibleForStageChannels(id);
const guild = GuildStore.getGuild(id);
const showCreatorMonetizationAnalyticsPermission = guild != null && isCreatorMonetizationEnabledGuild(guild);
const soundmojiRenderingExperiment = getSoundmojiRenderingExperiment({
location: "getPermissionOptions"
});
const enableHangoutWindow = getHangoutWindowExperiment({
guildId: id,
location: "getPermissionOptions"
}).enableHangoutWindow;
return {
PRIORITY_SPEAKER_DESCRIPTION: intl.format(t.ZuzwPz, {
keybind: intl.string(t.DkSwJ2)
}),
SOUNDBOARD_DESCRIPTION: intl.format(t.fVE8y8, {
helpCenterArticle: HelpdeskUtils.getArticleURL(HelpdeskArticles.SOUNDBOARD)
}),
showStageChannelPermissions: isGuildEligibleForStageChannels,
showExperimental: true,
showMembershipManualApprovalPermissions: true,
showCreatorMonetizationAnalyticsPermission,
inSoundmojiExperiment: soundmojiRenderingExperiment,
enableHangoutWindow
};
};
const r30 = {
generateChannelPermissionSpec: function generateChannelPermissionSpec(a0, a1, a2, a3) {
let r93;
const permissionOptions = getPermissionOptions(a0);
const channelPermissionSpecMap = getChannelPermissionSpecMap(a1, a2, {
...a3,
enableHangoutWindow: permissionOptions.enableHangoutWindow
});
const r12 = VoiceInThreadsExperiment.getCurrentConfig({
guildId: a0,
location: "3ad37d_1"
}).enabled && VOICE_THREAD_PARENT_CHANNEL_TYPES.has(a1.type);
const isStageVideoEnabled = _StageMediaHooks.isStageVideoEnabled(a0);
const canCurrentUserManageMessageFilters = _PermissionUtils.canCurrentUserManageMessageFilters(a0);
const isMediaChannel = a1.isMediaChannel();
const set = new Set();
const guild = GuildStore.getGuild(a0);
const r57 = (guild == null ? void 0 : guild.features.has(GuildFeatures.VERIFIED)) && GuildOfficialMessagesExperiment.getCurrentConfig({
guildId: a0,
location: "generateChannelPermissionSpec"
}).enabled;
if (!r57) {
set.add(Permissions.MANAGE_OFFICIAL_MESSAGES.toString());
}
L39: {
const inSoundmojiExperiment = permissionOptions.inSoundmojiExperiment;
const type = a1.type;
if (ChannelTypes.GUILD_CATEGORY === type) {
r93 = [generateChannelGeneralSection(channelPermissionSpecMap, intl.string(t["AkPxc+"])), generateChannelMembershipSection(channelPermissionSpecMap, intl.string(t.Ny49TN)), generateChannelTextSection(channelPermissionSpecMap, intl.string(t.cKobO5), {
showPrivateThreads: true,
showCreateThreads: true,
inSoundmojiExperiment
}), generateChannelVoiceSection(channelPermissionSpecMap, intl.string(t["46Ra1b"])), generateChannelAppsSection(channelPermissionSpecMap, intl.string(t["rrh/W6"])), ...permissionOptions.showStageChannelPermissions ? [generateChannelStageSection(channelPermissionSpecMap, intl.string(t.yniauk))] : [], generateChannelEventsSection(channelPermissionSpecMap, intl.string(t.b8lplT))];
} else if (ChannelTypes.GUILD_VOICE === type) {
r93 = [generateChannelGeneralSection(channelPermissionSpecMap, intl.string(t.ouHggI), {
showManageWebhooks: true
}), generateChannelMembershipSection(channelPermissionSpecMap, intl.string(t.Ny49TN)), generateChannelVoiceSection(channelPermissionSpecMap, intl.string(t["46Ra1b"])), generateChannelVoiceChatSection(channelPermissionSpecMap, intl.string(t.iqlsnD), {
sectionDescription: canCurrentUserManageMessageFilters ? intl.format(t["4Z9Fbb"], {
setUpAutomod: () => {
GuildSettingsActionCreators.open(a0, GuildSettingsSections.GUILD_AUTOMOD);
}
}) : void 0,
inSoundmojiExperiment
}), generateChannelEventsSection(channelPermissionSpecMap, intl.string(t.b8lplT)), generateChannelAppsSection(channelPermissionSpecMap, intl.string(t["rrh/W6"]))];
} else if (ChannelTypes.GUILD_STAGE_VOICE === type) {
r93 = [generateChannelGeneralSection(channelPermissionSpecMap, intl.string(t.ouHggI), {
showManageWebhooks: false
}), generateChannelMembershipSection(channelPermissionSpecMap, intl.string(t.Ny49TN)), generateChannelStageVoiceSection(channelPermissionSpecMap, intl.string(t["46Ra1b"]), isStageVideoEnabled), generateChannelStageSection(channelPermissionSpecMap, intl.string(t.yniauk)), generateChannelEventsSection(channelPermissionSpecMap, intl.string(t.b8lplT)), generateChannelVoiceChatSection(channelPermissionSpecMap, intl.string(t.iqlsnD), {
sectionDescription: canCurrentUserManageMessageFilters ? intl.format(t["4Z9Fbb"], {
setUpAutomod: () => {
GuildSettingsActionCreators.open(a0, GuildSettingsSections.GUILD_AUTOMOD);
}
}) : void 0,
inSoundmojiExperiment
}), generateChannelAppsSection(channelPermissionSpecMap, intl.string(t["rrh/W6"]), {
showActivities: false
})];
} else {
if (ChannelTypes.GUILD_FORUM !== type && ChannelTypes.GUILD_MEDIA !== type) {
r93 = [generateChannelGeneralSection(channelPermissionSpecMap, intl.string(t.ouHggI)), generateChannelMembershipSection(channelPermissionSpecMap, intl.string(t.Ny49TN)), generateChannelTextSection(channelPermissionSpecMap, intl.string(t.cKobO5), {
showPrivateThreads: a1.type !== ChannelTypes.GUILD_ANNOUNCEMENT,
showCreateThreads: true,
inSoundmojiExperiment
}), generateChannelAppsSection(channelPermissionSpecMap, intl.string(t["rrh/W6"])), ...r12 ? [generateChannelVoiceSection(channelPermissionSpecMap, intl.string(t["46Ra1b"]))] : []];
break L39;
}
const r161 = isMediaChannel ? intl.string(t.aSjPgw) : intl.string(t.TS7Cnb);
const r25 = isMediaChannel ? t.YjJTtH : t["1MTnqY"];
r93 = [generateChannelGeneralSection(channelPermissionSpecMap, intl.string(t.ouHggI)), generateChannelMembershipSection(channelPermissionSpecMap, intl.string(t.Ny49TN)), generateChannelTextSection(channelPermissionSpecMap, r161, {
showPrivateThreads: false,
showCreateThreads: false,
sectionDescription: canCurrentUserManageMessageFilters ? intl.format(r25, {
setUpAutomod: () => {
if (!isMediaChannel) {
trackForumEnableAutomodClicked();
}
GuildSettingsActionCreators.open(a0, GuildSettingsSections.GUILD_AUTOMOD);
}
}) : void 0,
inSoundmojiExperiment
}), generateChannelAppsSection(channelPermissionSpecMap, intl.string(t["rrh/W6"])), ...r12 ? [generateChannelVoiceSection(channelPermissionSpecMap, intl.string(t["46Ra1b"]))] : []];
}
}
let env22303;
const r538 = env22303 = {};
env22303[0] = set;
return set.size !== 0 ? r93.map($mk97378(r538)) : r93;
},
generateGuildPermissionSpec: function generateGuildPermissionSpec(a0) {
const set = new Set();
if (!a0.features.has(GuildFeatures.COMMUNITY)) {
set.add(Permissions.VIEW_GUILD_ANALYTICS.toString());
}
if (!(a0.features.has(GuildFeatures.VERIFIED) && GuildOfficialMessagesExperiment.getCurrentConfig({
guildId: a0.id,
location: "generateGuildPermissionSpec"
}).enabled)) {
set.add(Permissions.MANAGE_OFFICIAL_MESSAGES.toString());
}
let env22304;
const r49 = _PermissionUtils2.generateGuildPermissionSpec(getPermissionOptions(a0.id));
const r50 = env22304 = {};
env22304[0] = set;
return set.size !== 0 ? r49.map($mk97378(r50)) : r49;
},
getGuildPermissionSpecMap: function getGuildPermissionSpecMap(a0) {
return getGuildPermissionSpec(getPermissionOptions(a0.id));
}
};
export default r30;
+471
View File
@@ -0,0 +1,471 @@
// Metro module 3822 (f3823).
import ImpersonateStore from "../modules/impersonate/ImpersonateStore";
import LurkingStore from "../modules/lurker_mode/LurkingStore";
import JoinedThreadsStore from "../modules/threads/JoinedThreadsStore";
import { ChannelRecordBase, THREAD_CHANNEL_TYPES } from "../records/ChannelRecord";
import { getGuildEveryoneRoleId, isGuildOwner } from "../records/GuildRecord";
import { hasPermission } from "../records/GuildRoleRecord";
import AuthenticationStore from "../stores/AuthenticationStore";
import ChannelStore from "../stores/ChannelStore";
import GuildMemberStore from "../stores/GuildMemberStore";
import GuildRoleStore from "../stores/GuildRoleStore";
import GuildStore from "../stores/GuildStore";
import UserStore from "../stores/UserStore";
import { ChannelTypes, EMPTY_STRING_SNOWFLAKE_ID, ElevatedPermissions, MFALevels, Permissions } from "../Constants";
import * as _HighLow from "../_bundle/HighLow";
import { add, remove, has, filter, combine, deserialize, equals } from "../_bundle/HighLow";
import Module12 from "../_bundle/Module12";
import * as _AutomodPermissionUtils from "../modules/guild_automod/AutomodPermissionUtils";
import { isMemberCommunicationDisabled } from "../modules/guild_communication_disabled/CommunicationDisabledUtils";
import SnowflakeUtils from "./SnowflakeUtils";
import { doesRoleSortHigher } from "./GuildRoleUtils";
import { PermissionOverwriteType } from "../flow/Server";
let allow, c2159_24, c2159_25, lurkerPermissionsMask, c2159_27, c2159_28, c2159_29, computePermissionsForMember, computePermissions, applyThreadPermissions, computePermissionsForRoles;
const applyOverwrites = function applyOverwrites(id, member2, a2, overwrites) {
let length2;
const r25 = overwrites[id];
const r16 = r25 != null ? add(remove(a2, r25.deny), r25.allow) : a2;
let r33 = r16;
if (member2 != null) {
let r34 = allow;
const length = member2.roles.length;
let r0 = 0;
const r4 = 0 < length;
let r38 = allow;
let r39 = allow;
let r15 = allow;
if (r4) {
do {
const r18 = overwrites[member2.roles[r0]];
const r1 = r0;
const r21 = r34;
const r24 = r38;
let r17 = r21;
let r42 = r24;
if (r18 != null) {
r42 = add(r24, r18.allow);
r17 = add(r21, r18.deny);
}
r0 = r1 + 1;
length2 = member2.roles.length;
r34 = r17;
r38 = r42;
r39 = r34;
r15 = r38;
} while (r0 < length2);
}
const r60 = add(remove(r16, r39), r15);
const r62 = overwrites[member2.userId];
const r63 = r62 != null ? add(remove(r60, r62.deny), r62.allow) : r60;
const r78 = has(r63, Permissions.ADMINISTRATOR);
const hasAutomodQuarantinedProfile = _AutomodPermissionUtils.hasAutomodQuarantinedProfile(member2);
const r86 = hasAutomodQuarantinedProfile && !r78 ? filter(r63, c2159_29) : r63;
r33 = isMemberCommunicationDisabled(member2) && !r78 ? filter(r86, c2159_28) : r86;
}
return r33;
};
computePermissionsForMember = function computePermissionsForMember(a0) {
let length2;
const { userId, member: member2, guild, overwrites, roles } = a0;
let checkElevated = a0.checkElevated;
if (checkElevated === void 0) {
checkElevated = true;
}
const { excludeGuildPermissions = false, lurkerPermissionsMask: lurkerPermissionsMask2 = lurkerPermissionsMask } = a0;
if (excludeGuildPermissions) {
return applyOverwrites(guild.id, member2, allow, overwrites);
}
const r28 = roles != null ? {
...GuildRoleStore.getUnsafeMutableRoles(guild.id),
...roles
} : GuildRoleStore.getUnsafeMutableRoles(guild.id);
const r37 = r28[getGuildEveryoneRoleId(guild)];
const r38 = r37 != null ? r37.permissions : c2159_25;
let r39 = r38;
if (member2 != null) {
const length = member2.roles.length;
let r0 = 0;
const r5 = 0 < length;
let r42 = r38;
r39 = r42;
if (r5) {
do {
const r45 = r28[member2.roles[r0]];
const r1 = r0;
const r20 = r42;
const r46 = r45 !== void 0 ? add(r20, r45.permissions) : r20;
r0 = r1 + 1;
length2 = member2.roles.length;
r42 = r46;
r39 = r42;
} while (r0 < length2);
}
}
const r66 = has(r39, Permissions.ADMINISTRATOR) ? c2159_24 : applyOverwrites(guild.id, member2, r39, overwrites);
const r73 = LurkingStore.isLurking(guild.id) || member2?.isPending ? filter(r66, lurkerPermissionsMask2) : r66;
const r81 = GuildMemberStore.isCurrentUserGuest(guild.id) ? filter(r73, c2159_27) : r73;
if (checkElevated === void 0) {
checkElevated = true;
}
if (checkElevated) {
checkElevated = guild.mfaLevel === MFALevels.ELEVATED;
}
if (checkElevated) {
checkElevated = userId === AuthenticationStore.getId();
}
return checkElevated ? UserStore.getCurrentUser()?.mfaEnabled ? r81 : remove(r81, ElevatedPermissions) : r81;
};
computePermissions = function computePermissions({ user: user2, context, overwrites, roles, checkElevated = true, excludeGuildPermissions = false }) {
let r62, guild, lurkerPermissionsMask2, overwrites2;
if (user2 == null) {
return allow;
}
let userId = user2;
if (typeof userId !== "string") {
userId = user2.id;
}
if (context instanceof ChannelRecordBase) {
if (context.isScheduledForDeletion()) {
return allow;
}
if (THREAD_CHANNEL_TYPES.has(context.type)) {
const channel = ChannelStore.getChannel(context.parent_id);
if (channel != null && !channel.isScheduledForDeletion()) {
const r91 = userId === UserStore.getCurrentUser()?.id && JoinedThreadsStore.hasJoined(context.id);
return applyThreadPermissions(context, computePermissions({
user: user2,
context: channel,
overwrites,
roles,
checkElevated,
excludeGuildPermissions
}), r91, GuildMemberStore.isCurrentUserGuest(context.guild_id));
}
return allow;
}
let r32 = context.computeLurkerPermissionsAllowList();
if (r32 == null) {
r32 = lurkerPermissionsMask;
}
const r33 = overwrites != null ? {
...context.permissionOverwrites,
...overwrites
} : context.permissionOverwrites;
const guildId = context.getGuildId();
guild = guildId != null ? GuildStore.getGuild(guildId) : null;
lurkerPermissionsMask2 = r32;
overwrites2 = r33;
} else {
overwrites2 = overwrites;
if (overwrites2 == null) {
overwrites2 = {};
}
lurkerPermissionsMask2 = lurkerPermissionsMask;
guild = context;
}
L43: {
if (guild == null) {
r62 = allow;
} else {
if (!(userId === UserStore.getCurrentUser()?.id && ImpersonateStore.isViewingRoles(guild.id)) && isGuildOwner(guild, userId)) {
let r55 = checkElevated;
if (r55 === void 0) {
r55 = true;
}
if (r55) {
r55 = guild.mfaLevel === MFALevels.ELEVATED;
}
if (r55) {
r55 = userId === AuthenticationStore.getId();
}
r62 = c2159_24;
if (!r55) {
break L43;
}
r62 = UserStore.getCurrentUser()?.mfaEnabled ? c2159_24 : remove(c2159_24, ElevatedPermissions);
break L43;
}
r62 = computePermissionsForMember({
userId,
member: GuildMemberStore.getMember(guild.id, userId),
guild,
overwrites: overwrites2,
roles,
checkElevated,
excludeGuildPermissions,
lurkerPermissionsMask: lurkerPermissionsMask2
});
}
}
return r62;
};
applyThreadPermissions = function applyThreadPermissions(context, a1, a2, a3) {
let r23;
L16: {
if (context.type === ChannelTypes.MEDIA_THREAD) {
r23 = combine(Permissions.READ_MESSAGE_HISTORY, Permissions.VIEW_CHANNEL);
} else {
if (context.type === ChannelTypes.PRIVATE_THREAD && !a2 && !a3 && !has(a1, Permissions.MANAGE_THREADS)) {
r23 = allow;
break L16;
}
r23 = has(a1, Permissions.SEND_MESSAGES_IN_THREADS) ? context.isLockedThread() && !has(a1, Permissions.MANAGE_THREADS) ? remove(a1, Permissions.SEND_MESSAGES) : combine(a1, Permissions.SEND_MESSAGES) : remove(a1, Permissions.SEND_MESSAGES);
}
}
return r23;
};
allow = deserialize(0);
c2159_24 = combine.apply(_HighLow, [...Module12.values(Permissions)]);
c2159_25 = combine(Permissions.CREATE_INSTANT_INVITE, Permissions.CHANGE_NICKNAME, Permissions.VIEW_CHANNEL, Permissions.SEND_MESSAGES, Permissions.EMBED_LINKS, Permissions.ATTACH_FILES, Permissions.READ_MESSAGE_HISTORY, Permissions.MENTION_EVERYONE, Permissions.USE_EXTERNAL_EMOJIS, Permissions.USE_EXTERNAL_STICKERS, Permissions.ADD_REACTIONS, Permissions.CREATE_PUBLIC_THREADS, Permissions.CREATE_PRIVATE_THREADS, Permissions.SEND_MESSAGES_IN_THREADS, Permissions.SEND_POLLS, Permissions.CONNECT, Permissions.SPEAK, Permissions.USE_VAD, Permissions.STREAM, Permissions.USE_EMBEDDED_ACTIVITIES, Permissions.USE_SOUNDBOARD, Permissions.REQUEST_TO_SPEAK, Permissions.USE_APPLICATION_COMMANDS, Permissions.CREATE_GUILD_EXPRESSIONS, Permissions.CREATE_EVENTS, Permissions.USE_EXTERNAL_APPS);
lurkerPermissionsMask = combine(Permissions.VIEW_CHANNEL, Permissions.READ_MESSAGE_HISTORY);
c2159_27 = combine(Permissions.VIEW_CHANNEL, Permissions.SEND_MESSAGES, Permissions.CONNECT, Permissions.SPEAK, Permissions.STREAM, Permissions.USE_EMBEDDED_ACTIVITIES, Permissions.USE_EXTERNAL_APPS, Permissions.USE_EXTERNAL_EMOJIS, Permissions.USE_EXTERNAL_SOUNDS, Permissions.USE_EXTERNAL_STICKERS, Permissions.USE_SOUNDBOARD, Permissions.USE_VAD, Permissions.SEND_MESSAGES_IN_THREADS, Permissions.EMBED_LINKS, Permissions.ATTACH_FILES, Permissions.ADD_REACTIONS);
c2159_28 = combine(Permissions.VIEW_CHANNEL, Permissions.READ_MESSAGE_HISTORY);
c2159_29 = combine(Permissions.VIEW_CHANNEL, Permissions.READ_MESSAGE_HISTORY, Permissions.CHANGE_NICKNAME);
const r174 = combine(Permissions.MANAGE_GUILD, Permissions.MANAGE_ROLES, Permissions.ADMINISTRATOR, Permissions.BAN_MEMBERS, Permissions.MANAGE_NICKNAMES, Permissions.CREATE_GUILD_EXPRESSIONS, Permissions.MANAGE_GUILD_EXPRESSIONS, Permissions.MANAGE_WEBHOOKS, Permissions.VIEW_AUDIT_LOG, Permissions.VIEW_GUILD_ANALYTICS);
export { allow as NONE };
export { c2159_24 as ALL };
export { c2159_25 as DEFAULT };
export { r174 as VIEW_GUILD_SETTINGS };
computePermissionsForRoles = function computePermissionsForRoles({ forceRoles, context, overwrites, roles, checkElevated = true, excludeGuildPermissions }) {
let guild, lurkerPermissionsMask2, overwrites2;
if (context instanceof ChannelRecordBase) {
if (context.isScheduledForDeletion()) {
return allow;
}
if (THREAD_CHANNEL_TYPES.has(context.type)) {
const channel = ChannelStore.getChannel(context.parent_id);
return channel == null ? allow : applyThreadPermissions(context, computePermissionsForRoles({
forceRoles,
context: channel,
overwrites,
roles,
checkElevated,
excludeGuildPermissions
}), false, false);
}
let r31 = context.computeLurkerPermissionsAllowList();
if (r31 == null) {
r31 = lurkerPermissionsMask;
}
const r33 = overwrites != null ? {
...context.permissionOverwrites,
...overwrites
} : context.permissionOverwrites;
const guildId = context.getGuildId();
guild = guildId != null ? GuildStore.getGuild(guildId) : null;
lurkerPermissionsMask2 = r31;
overwrites2 = r33;
} else {
overwrites2 = overwrites;
if (overwrites2 == null) {
overwrites2 = {};
}
lurkerPermissionsMask2 = lurkerPermissionsMask;
guild = context;
}
if (guild == null) {
return allow;
}
return computePermissionsForMember({
userId: EMPTY_STRING_SNOWFLAKE_ID,
member: {
userId: EMPTY_STRING_SNOWFLAKE_ID,
nick: "",
guildId: guild.id,
guildMemberAvatar: null,
roles: SnowflakeUtils.keys(forceRoles),
colorString: null,
colorStrings: null,
hoistRoleId: null,
premiumSince: null,
isPending: false,
joinedAt: new Date().toISOString(),
communicationDisabledUntil: null
},
guild,
overwrites: overwrites2,
roles,
checkElevated,
excludeGuildPermissions,
lurkerPermissionsMask: lurkerPermissionsMask2
});
};
export { computePermissionsForRoles };
export { computePermissions };
export { applyThreadPermissions };
export function areChannelsLocked(a0, a1) {
if (THREAD_CHANNEL_TYPES.has(a0.type)) {
return true;
}
const guild_id = a0.guild_id;
if (a1 != null && guild_id != null && guild_id === a1.guild_id) {
const r5 = {
...a0.permissionOverwrites
};
let c13631_0 = r5;
const r8 = {
...a1.permissionOverwrites
};
let c13631_1 = r8;
if (r5[guild_id] == null) {
r5[guild_id] = {
id: guild_id,
type: PermissionOverwriteType.ROLE,
allow,
deny: allow
};
}
if (r8[guild_id] == null) {
r8[guild_id] = {
id: guild_id,
type: PermissionOverwriteType.ROLE,
allow,
deny: allow
};
}
return Object.keys(r5).length === Object.keys(r8).length && !Object.keys(r5).some((item) => {
const r8 = c13631_0[item];
const r10 = c13631_1[item];
return r10 == null || !equals(r10.deny, r8.deny) || !equals(r10.allow, r8.allow);
});
}
return false;
}
export function getGuildVisualOwnerId(a0) {
const r14 = Module12.some(GuildRoleStore.getUnsafeMutableRoles(a0.id), (a0) => a0.hoist && hasPermission(a0, Permissions.ADMINISTRATOR));
let r15 = void 0;
if (!r14) {
let ownerId = a0.ownerId;
if (ownerId == null) {
ownerId = void 0;
}
r15 = ownerId;
}
return r15;
}
export function isRoleHigher(a0, a1, a2, a3) {
const r0 = a1 == null || !isGuildOwner(a0, a1);
return r0 ? a2 != null && (a3 == null || doesRoleSortHigher(a2, a3)) : !r0;
}
export function getHighestRole(a0, a1) {
const member = GuildMemberStore.getMember(a0.id, a1);
if (member != null) {
return GuildRoleStore.getSortedRoles(a0.id).find((item) => member.roles.includes(item.id));
}
}
export function getHighestHoistedRole(a0, a1) {
return a1.hoistRoleId != null ? GuildRoleStore.getRole(a0.id, a1.hoistRoleId) : null;
}
export function makeEveryoneOverwrite(a0) {
return {
id: a0,
type: PermissionOverwriteType.ROLE,
allow,
deny: allow
};
}
export function canManageACategory(a0, a1, a2) {
const user = a0;
const r3 = {
permission: Permissions.MANAGE_CHANNELS,
user: a0,
context: a1
};
const { permission, user: user2 } = r3;
return !!has(computePermissions({
user: user2,
context: r3.context,
overwrites: r3.overwrites,
roles: r3.roles,
checkElevated: true,
excludeGuildPermissions: r3.excludeGuildPermissions
}), permission) || a2.some(({ channel }) => {
let r13 = channel.id !== "null";
if (r13) {
const r3 = {
permission: Permissions.MANAGE_CHANNELS,
user,
context: channel
};
const { permission, user: user2 } = r3;
r13 = has(computePermissions({
user: user2,
context: r3.context,
overwrites: r3.overwrites,
roles: r3.roles,
checkElevated: true,
excludeGuildPermissions: r3.excludeGuildPermissions
}), permission);
}
return r13;
});
}
export function can(a0) {
const { permission, user: user2 } = a0;
return has(computePermissions({
user: user2,
context: a0.context,
overwrites: a0.overwrites,
roles: a0.roles,
checkElevated: true,
excludeGuildPermissions: a0.excludeGuildPermissions
}), permission);
}
export const ALLOW = "ALLOW";
export const DENY = "DENY";
export const PASSTHROUGH = "PASSTHROUGH";
export function canEveryoneRole(a0, a1) {
let r3 = {};
const r0 = a1 instanceof ChannelRecordBase;
let r10 = a1;
if (r0) {
if (a1.type === ChannelTypes.PRIVATE_THREAD) {
return false;
}
const r14 = THREAD_CHANNEL_TYPES.has(a1.type);
let r15 = a1;
if (r14) {
r15 = ChannelStore.getChannel(a1.parent_id);
if (r15 == null) {
return false;
}
}
const permissionOverwrites = r15.permissionOverwrites;
const guildId = r15.getGuildId();
r10 = guildId != null ? GuildStore.getGuild(guildId) : null;
r3 = permissionOverwrites;
}
if (r10 == null) {
return false;
}
const permissions = GuildRoleStore.getEveryoneRole(r10).permissions;
const r31 = r3[r10.id];
return has(r31 != null ? add(remove(permissions, r31.deny), r31.allow) : permissions, a0);
}
export function canEveryone(a0, a1) {
let c13634_0 = a0;
let r5 = {};
const r0 = a1 instanceof ChannelRecordBase;
let r8 = a1;
if (r0) {
if (a1.type === ChannelTypes.PRIVATE_THREAD) {
return false;
}
const r16 = THREAD_CHANNEL_TYPES.has(a1.type);
let r17 = a1;
if (r16) {
r17 = ChannelStore.getChannel(a1.parent_id);
if (r17 == null) {
return false;
}
}
const permissionOverwrites = r17.permissionOverwrites;
const guildId = r17.getGuildId();
r8 = guildId != null ? GuildStore.getGuild(guildId) : null;
r5 = permissionOverwrites;
}
if (r8 == null) {
return false;
}
return !!hasPermission(GuildRoleStore.getEveryoneRole(r8), a0) && !Module12.some(r5, (a0) => has(a0.deny, c13634_0));
}
+5
View File
@@ -0,0 +1,5 @@
// Metro module 500 (f501).
import * as _Module501 from "../_bundle/Module501";
for (const key in _Module501) {
exports[key] = _Module501[key];
}
+16
View File
@@ -0,0 +1,16 @@
// Metro module 9376 (f9377).
import OverridePremiumTypeStore from "../modules/premium/OverridePremiumTypeStore";
import { MAX_ATTACHMENT_SIZE, MAX_STAFF_ATTACHMENT_SIZE } from "../Constants";
import { PremiumUserLimits, UNSELECTED_PREMIUM_TYPE_OVERRIDE } from "../modules/premium/PremiumConstants";
import { isPremium } from "./PremiumTypeUtils";
export function getUserMaxFileSize(a0) {
if (a0 == null) {
return MAX_ATTACHMENT_SIZE;
}
const premiumTypeOverride = OverridePremiumTypeStore.getPremiumTypeOverride();
return a0.isStaff() && premiumTypeOverride === UNSELECTED_PREMIUM_TYPE_OVERRIDE ? MAX_STAFF_ATTACHMENT_SIZE : a0.premiumType != null && isPremium(a0) ? PremiumUserLimits[a0.premiumType].fileSize : MAX_ATTACHMENT_SIZE;
}
const r23 = {
getUserMaxFileSize
};
export default r23;
+25
View File
@@ -0,0 +1,25 @@
// Metro module 1897 (f1898).
import { PremiumTypeOrder } from "../modules/premium/PremiumConstants";
export function isPremiumAtLeast(a0, a1) {
return a1 == null || a0 != null && PremiumTypeOrder[a0] >= PremiumTypeOrder[a1];
}
export function isPremium(a0, a1) {
let r0 = a0 != null && a0.premiumType != null;
if (r0) {
const premiumType = a0.premiumType;
r0 = a1 == null || premiumType != null && PremiumTypeOrder[premiumType] >= PremiumTypeOrder[a1];
}
return r0;
}
export function isPremiumExactly(a0, a1) {
return a0 != null && a0.premiumType === a1;
}
const r17 = {
isPremiumAtLeast,
isPremium,
isPremiumExactly
};
export default r17;
export function isPremiumAtMost(a0, a1) {
return a0 == null || PremiumTypeOrder[a0] <= PremiumTypeOrder[a1];
}
File diff suppressed because it is too large. Load diff
+92
View File
@@ -0,0 +1,92 @@
// Metro module 5669 (f5670).
import LocaleStore from "../modules/user_settings/LocaleStore";
import BillingInfoStore from "../stores/billing/BillingInfoStore";
import { SubscriptionIntervalTypes } from "../modules/premium/PremiumConstants";
import { CurrencyCodes } from "../_bundle/Module505";
import { isWindows, getPlatformName } from "./PlatformUtils";
import * as _convertToMajorCurrencyUnits from "../_bundle/convertToMajorCurrencyUnits";
import * as _IAPStore_android from "../stores/native/IAPStore.android";
import * as _GenericIAPStore from "../modules/billing/native/GenericIAPStore";
import { intl, t } from "../intl/index.native";
import { getPrice } from "./PremiumUtils";
let c3506_6, formatPrice, formatRate;
const formatSingleCurrencyPrice = function formatSingleCurrencyPrice(a0, currencyCode, a2) {
const r9 = {
...a2 == null ? {} : a2
};
let r8 = a2?.localeOverride;
if (r8 == null) {
r8 = LocaleStore.locale;
}
let r21 = r8 === "en-US";
if (r21 ? c3506_6.includes(LocaleStore.systemLocale) : r21) {
r9.currencyDisplay = "code";
}
if (r21) {
r21 = isWindows();
}
if (r21) {
r21 = LocaleStore.systemLocale === "en-GB";
}
if (r21) {
r9.currencyDisplay = "code";
}
const { maximumFractionDigits, minimumFractionDigits } = r9;
if (maximumFractionDigits === 0 && minimumFractionDigits == null) {
r9.minimumFractionDigits = 0;
}
return _convertToMajorCurrencyUnits.formatPrice(a0, currencyCode, r8, r9);
};
formatPrice = function formatPrice(a0, a1, a2) {
const r1 = Date.now() >= new Date("2026-08-05T22:00:00Z").getTime();
let r2 = false;
if (!r1) {
const platformName = getPlatformName();
r2 = (platformName === "android" ? _IAPStore_android.default.getUserCountry() : platformName === "ios" ? _GenericIAPStore.default.getStoreFront()?.country : BillingInfoStore.ipCountryCode) === "BG" && (a1 == null ? void 0 : a1.toLowerCase()) === CurrencyCodes.EUR;
}
return r2 ? `${formatSingleCurrencyPrice(a0, CurrencyCodes.EUR, a2)} (${formatSingleCurrencyPrice(1.95583 * a0, CurrencyCodes.BGN, a2)})` : formatSingleCurrencyPrice(a0, a1, a2);
};
formatRate = function formatRate(a0, interval, a2) {
if (interval === SubscriptionIntervalTypes.YEAR) {
return intl.formatToPlainString(t["rS8FA+"], {
price: a0
});
}
if (interval === SubscriptionIntervalTypes.MONTH && a2 === 1) {
return intl.formatToPlainString(t.AbOLNu, {
price: a0
});
}
if (interval === SubscriptionIntervalTypes.MONTH && a2 > 1) {
return intl.formatToPlainString(t["Qc+9ww"], {
price: a0,
intervalCount: a2
});
}
throw new Error(`Unsupported interval type: ${interval}, and interval count: ${a2}`);
};
c3506_6 = Object.freeze(["en-CA", "en-AU", "en-NZ"]);
export { formatSingleCurrencyPrice };
export function formatDualPriceForBG(a0, a1) {
return `${formatSingleCurrencyPrice(a0, CurrencyCodes.EUR, a1)} (${formatSingleCurrencyPrice(1.95583 * a0, CurrencyCodes.BGN, a1)})`;
}
export { formatPrice };
export { formatRate };
export function formatPercent(a0, a1) {
return Intl.NumberFormat(a0, {
style: "percent",
minimumFractionDigits: 0
}).format(a1);
}
export function formatSubscriptionPlanRate(a0) {
const r4 = "interval_count" in a0 ? a0.interval_count : a0.intervalCount;
const price = getPrice(a0.id);
return formatRate(formatPrice(price.amount, price.currency), a0.interval, r4);
}
export function maybeShortenPrice(a0) {
return a0.length > 5 ? a0.replace(/\.00(?=[\s)]|$)/g, "") : a0;
}
export function shortenAndFormatPrice(a0, a1, a2) {
const r6 = formatPrice(a0, a1, a2);
return r6.length > 5 ? r6.replace(/\.00(?=[\s)]|$)/g, "") : r6;
}
+66
View File
@@ -0,0 +1,66 @@
// Metro module 4734 (f4735).
import DiscordNative from "../lib/DiscordNative";
class ProcessArgs {
constructor() {
return {
__proto__: new.target.prototype
};
}
static get() {
if (ProcessArgs.cached == null) {
const r1 = DiscordNative == null;
let cached = void 0;
if (!r1) {
const processUtils = DiscordNative.processUtils;
const r13 = processUtils == null;
cached = void 0;
if (!r13) {
const getMainArgvSync = processUtils.getMainArgvSync;
cached = getMainArgvSync == null ? void 0 : getMainArgvSync.call(processUtils);
}
}
if (cached != null && cached.length > 1) {
cached.shift();
}
if (cached == null) {
cached = [];
}
ProcessArgs.cached = cached;
}
return ProcessArgs.cached;
}
static contains(a0) {
return ProcessArgs.get().includes(a0);
}
static isEnvVariableTrue(a0) {
if (DiscordNative === void 0) {
return false;
}
const r2 = DiscordNative == null;
let r10 = void 0;
if (!r2) {
const process = DiscordNative.process;
const r12 = process == null;
r10 = void 0;
if (!r12) {
const env = process.env;
r10 = env == null ? void 0 : env[a0];
}
}
if (r10 !== "1" && r10 !== "true") {
return false;
}
return true;
}
static isDisallowPopupsSet() {
const r6 = ProcessArgs.contains("--disallow-popups");
return !(r6 ? !r6 : !ProcessArgs.isEnvVariableTrue("DISCORD_DISALLOW_POPUPS"));
}
static isDiscordTestSet() {
return ProcessArgs.isEnvVariableTrue("DISCORD_TEST");
}
static isDiscordGatewayPlaintextSet() {
return false;
}
}
export { ProcessArgs };
+217
View File
@@ -0,0 +1,217 @@
// Metro module 5960 (f5961).
import { NativeModules } from "react-native";
import { ProcessUtils } from "./ProcessUtilsBase";
import { $callWithNewTarget } from "../_hermes/prelude";
function $mk77520($env) {
return (a0) => {
$env[1].cpuCoreCount = a0;
};
}
function $mk77521($env) {
return () => {
const r2 = $env;
const r5 = r2[0];
if (r5 != null) {
const getCurrentCpuUsagePercent = r5.getCurrentCpuUsagePercent;
if (getCurrentCpuUsagePercent != null) {
getCurrentCpuUsagePercent.call(r5, $mk104818(r2));
}
}
if (r5 != null) {
const getCumulativeCpuUsage = r5.getCumulativeCpuUsage;
if (getCumulativeCpuUsage != null) {
getCumulativeCpuUsage.call(r5, $mk104819(r2));
}
}
if (r5 != null) {
const getCurrentMemoryUsageKb = r5.getCurrentMemoryUsageKb;
if (getCurrentMemoryUsageKb != null) {
getCurrentMemoryUsageKb.call(r5, $mk104820(r2));
}
}
const r13 = r2[1];
r13.hermesInstrumentedStatsSummary = r13.shouldCollectHermesInstrumentedStats ? (0, $env.$parent[1])() : void 0;
};
}
function $mk104818($env) {
return (a0) => {
$env[1].cpuPercentage = a0 >= 0 ? a0 : void 0;
};
}
function $mk104819($env) {
return (a0) => {
if (a0 >= 0) {
$env[1].cumulativeCpuUsage = {
usage: a0,
sampleTime: performance.now()
};
}
};
}
function $mk104820($env) {
return (a0) => {
$env[1].memory = a0 >= 0 ? a0 : void 0;
};
}
let c3750_2, c3751_0, c3751_1;
let env3750;
let env3751;
const r4 = env3750 = {};
const getHermesInstrumentedStatsSummary = function getHermesInstrumentedStatsSummary() {
let r27;
const HermesInternal2 = globalThis.globalThis.HermesInternal;
if (HermesInternal2 != null && typeof HermesInternal2 === "object") {
const getInstrumentedStats = HermesInternal2.getInstrumentedStats;
if (typeof getInstrumentedStats === "function") {
L9: {
try {
const r8 = getInstrumentedStats();
if (r8 == null) {
break L9;
}
if (typeof r8 !== "object") {
break L9;
}
const r23 = Object.entries(r8).filter((item) => {
const [, r4] = item;
return typeof r4 === "number" ? Number.isFinite(r4) : typeof r4 === "number";
}).slice(0, 6).map((item) => {
const [r7, r24] = item;
return `${r7}=${r24}`;
});
r27 = r23.length > 0 ? r23.join(", ") : void 0;
} catch ($e) {
return void 0;
}
return r27;
}
return void 0;
}
}
};
class ProcessUtilsIOS extends ProcessUtils {
constructor() {
let env15322;
const r5 = env15322 = {
$parent: env3750
};
env15322[1] = void 0;
super();
env15322[1] = this;
this.shouldCollectHermesInstrumentedStats = false;
const SystemResourceManager = NativeModules?.SystemResourceManager;
env15322[0] = SystemResourceManager;
if (SystemResourceManager != null) {
const getCpuCoreCount = SystemResourceManager.getCpuCoreCount;
if (getCpuCoreCount != null) {
getCpuCoreCount.call(SystemResourceManager, $mk77520(r5));
}
}
setInterval($mk77521(r5), 1000);
}
getProcessUptime() {
return null;
}
getCumulativeCPUUsage() {
return this.cumulativeCpuUsage;
}
getCurrentCPUUsagePercent() {
return this.cpuPercentage;
}
getCurrentMemoryUsageKB() {
return this.memory;
}
setShouldCollectHermesInstrumentedStats(a0) {
this.shouldCollectHermesInstrumentedStats = a0;
this.hermesInstrumentedStatsSummary = a0 ? getHermesInstrumentedStatsSummary() : void 0;
}
getCurrentHermesInstrumentedStatsSummary() {
if (this.shouldCollectHermesInstrumentedStats) {
return this.hermesInstrumentedStatsSummary;
}
}
enablePerfMemoryHooks() {
return null;
}
disablePerfMemoryHooks() {
return null;
}
getPerfAttributedMemory() {
return null;
}
getPerfAttributedMemoryCallstacks() {
return null;
}
getPerfAttributedMemoryStats() {
return null;
}
startCPUProfiling() {
return null;
}
stopCPUProfiling() {
return Promise.resolve(null);
}
enablePAMemoryProfiler() {
return null;
}
disablePAMemoryProfiler() {
return null;
}
getPerfAttributedPAMemory() {
return null;
}
getPerfAttributedPAMemoryCallstacks() {
return null;
}
getPartitionAllocatorStats() {
return null;
}
enableProfilingV8Heap() {}
disableProfilingV8Heap() {}
getProfilerV8MemoryCallstacks() {
return null;
}
getMemoryUsageDetails() {
return {
0: this.memory
};
}
getMemoryUsageElectronRenderer() {
return null;
}
getMemoryPrivateUsageElectronRenderer() {
return null;
}
getMemoryUsageElectronRendererUsedHeapSize() {
return null;
}
getMemoryHeapStats() {
return null;
}
getBlinkMemoryInfo() {
return null;
}
getMemoryUsageElectronProcessTypeDetails() {
return null;
}
}
c3750_2 = ProcessUtilsIOS;
const r84 = env3751 = {
$parent: r4
};
c3751_0 = void 0;
c3751_1 = void 0;
const prototypeOf = Object.getPrototypeOf(ProcessUtilsIOS);
const r87 = Object.create(ProcessUtilsIOS.prototype);
const r88 = $callWithNewTarget(prototypeOf, r87, ProcessUtilsIOS);
c3751_1 = r88 instanceof Object ? r88 : r87;
c3751_1.shouldCollectHermesInstrumentedStats = false;
c3751_0 = NativeModules?.SystemResourceManager;
if (c3751_0 != null) {
const getCpuCoreCount = c3751_0.getCpuCoreCount;
if (getCpuCoreCount != null) {
getCpuCoreCount.call(c3751_0, $mk77520(r84));
}
}
setInterval($mk77521(r84), 1000);
export default c3751_1;
+26
View File
@@ -0,0 +1,26 @@
// Metro module 5961 (f5962).
const r8 = {
Unknown: "unknown",
Main: "main",
Renderer: "renderer",
GPU: "gpu",
Utility: "utility",
Crashpad: "crashpad",
Clips: "clips"
};
export { r8 as ElectronProcessType };
export class ProcessUtils {
constructor() {
return {
__proto__: new.target.prototype
};
}
getSystemMetrics() {
return Promise.resolve(null);
}
setShouldCollectHermesInstrumentedStats() {}
getCurrentHermesInstrumentedStatsSummary() {}
getCPUCoreCount() {
return this.cpuCoreCount;
}
}
+39
View File
@@ -0,0 +1,39 @@
// Metro module 4518 (f4519).
import Durations from "./Durations";
import { Storage } from "../_bundle/Module595";
import { v4 } from "../_bundle/Module514";
import { HermesBuiltin } from "../_hermes/prelude";
let c2726_3, c2726_4;
const getPurchaseToken = function getPurchaseToken() {
const r13 = Storage.get(c2726_3);
if (r13 != null && r13.expires >= Date.now()) {
return r13.purchaseToken;
}
const purchaseToken = v4();
Storage.set(c2726_3, {
purchaseToken,
expires: Date.now() + c2726_4
});
return purchaseToken;
};
c2726_3 = "purchase_token";
c2726_4 = 60 * Durations.Millis.DAY;
export { getPurchaseToken };
export async function getPurchaseTokenHash() {
let c25234_0;
let env29402;
const r10 = env29402 = {};
let c25234_1 = r10;
env29402[0] = void 0;
env29402[0] = await window.crypto.subtle.digest({
name: "SHA-256"
}, new Uint8Array(getPurchaseToken().split("").map((item) => item.charCodeAt(0))));
const r58 = btoa;
const r59 = String;
const fromCharCode = r59.fromCharCode;
c25234_0 = 0;
const uint8Array = new Uint8Array(env29402[0]);
const r66 = [];
c25234_0 = HermesBuiltin.arraySpread(r66, uint8Array, c25234_0);
return r58(fromCharCode.apply(r59, r66));
}
+4
View File
@@ -0,0 +1,4 @@
// Metro module 4176 (f4177).
export function getFirstQueryStringValue(a0) {
return Array.isArray(a0) ? a0[0] : a0;
}
+70
View File
@@ -0,0 +1,70 @@
// Metro module 6146 (f6147).
import Logger from "../modules/debug/Logger";
import Deque from "../_bundle/Deque";
const logger = new Logger("Queue");
class Queue {
constructor(logger2 = logger, defaultRetryAfter = 100) {
const r16 = {
__proto__: new.target.prototype,
queue: new Deque(),
timeout: null,
draining: false
};
r16.logger = logger2;
r16.defaultRetryAfter = defaultRetryAfter;
return r16;
}
enqueue(a0, a1, a2) {
this.queue.push({
message: a0,
success: a1,
logId: a2
});
this._drainIfNecessary();
}
get length() {
return this.queue.length;
}
_drainIfNecessary() {
let logId, c15509_1, success;
if (this.timeout === null && this.queue.length !== 0 && this.draining !== true) {
this.draining = true;
const r17 = this.queue.shift();
c15509_1 = r17;
const message = r17.message;
success = r17.success;
logId = r17.logId;
this.logger.log(`Draining message from queue LogId:${logId} QueueLength: ${this.queue.length}`);
this.drain(message, (a0, a1) => {
this.logger.log(`Finished draining message from queue LogId:${logId} QueueLength: ${this.queue.length}`);
this.draining = false;
if (a0 == null) {
setImmediate(() => this._drainIfNecessary());
try {
success(a1);
} catch ($e) {
this.logger.error("", $e);
}
} else {
let retryAfter = a0.retryAfter;
if (retryAfter == null) {
retryAfter = this.defaultRetryAfter;
}
this.logger.info(`Rate limited. Delaying draining of queue for ${retryAfter} ms. LogId:${logId} QueueLength: ${this.queue.length}`);
this.timeout = setTimeout(() => {
this.queue.unshift(c15509_1);
this.timeout = null;
this._drainIfNecessary();
}, retryAfter);
}
});
}
}
clear() {
this.queue.clear();
clearTimeout(this.timeout);
this.timeout = null;
this.draining = false;
}
}
export default Queue;
+49
View File
@@ -0,0 +1,49 @@
// Metro module 10832 (f10833).
import { ConnectionStatus, RTCConnectionStates } from "../Constants";
import { intl, t } from "../intl/index.native";
const r16 = {
getStatus: function getStatus(a0, r6 = false) {
let CONNECTING, connectionStatusText;
if (RTCConnectionStates.CONNECTING === a0) {
CONNECTING = ConnectionStatus.CONNECTING;
connectionStatusText = intl.string(t.MzW9sN);
} else if (RTCConnectionStates.AUTHENTICATING === a0) {
CONNECTING = ConnectionStatus.CONNECTING;
connectionStatusText = intl.string(t.GxXwE2);
} else if (RTCConnectionStates.AWAITING_ENDPOINT === a0) {
CONNECTING = ConnectionStatus.CONNECTING;
connectionStatusText = intl.string(t.uQle7a);
} else if (RTCConnectionStates.RTC_CONNECTED === a0) {
const CONNECTED = ConnectionStatus.CONNECTED;
connectionStatusText = r6 ? intl.string(t.HtVOdd) : intl.string(t.daXg45);
CONNECTING = CONNECTED;
} else if (RTCConnectionStates.RTC_CONNECTING === a0) {
CONNECTING = ConnectionStatus.CONNECTING;
connectionStatusText = intl.string(t.Gp51dl);
} else if (RTCConnectionStates.ICE_CHECKING === a0) {
CONNECTING = ConnectionStatus.CONNECTING;
connectionStatusText = intl.string(t["rdCyA/"]);
} else if (RTCConnectionStates.DTLS_CONNECTING === a0) {
CONNECTING = ConnectionStatus.CONNECTING;
connectionStatusText = intl.string(t.UvB3gV);
} else if (RTCConnectionStates.NO_ROUTE === a0) {
CONNECTING = ConnectionStatus.ERROR;
connectionStatusText = intl.string(t.mGhOIi);
} else if (RTCConnectionStates.RTC_DISCONNECTED === a0) {
CONNECTING = ConnectionStatus.ERROR;
connectionStatusText = intl.string(t.M7LDmE);
} else {
RTCConnectionStates.DISCONNECTED;
CONNECTING = ConnectionStatus.ERROR;
connectionStatusText = intl.string(t.NLKQbx);
}
return {
connectionStatus: CONNECTING,
connectionStatusText
};
},
getShortHostname: function getShortHostname(a0) {
return a0 == null ? "" : a0.split(".")[0];
}
};
export default r16;
+498
View File
@@ -0,0 +1,498 @@
// Metro module 12736 (f12737).
import { createChannelRecordFromServer } from "../records/ChannelRecord";
import DatabaseDaos from "../modules/app_database/DatabaseDaos";
import { isCacheEnabled } from "../modules/cache/isCacheEnabled.native";
import GuildVersions from "../modules/app_database/modules/GuildVersions";
import ChannelReader from "../modules/app_database/modules/channels/ChannelReader";
import KvCacheVersion from "../modules/app_database/modules/KvCacheVersion";
import DatabaseManager from "../modules/app_database/system/DatabaseManager";
import Module12 from "../_bundle/Module12";
import Module38 from "../_bundle/Module38";
function $mk90317($env) {
return (a0) => {
if (a0 != null) {
const r2 = $env;
const user_id = a0.user_id;
if (user_id != null) {
const r3 = $env.$parent;
const r7 = (0, r3[1])(r3[2][8]);
const r12 = r2[0];
r7(r12[user_id] != null, `Missing user[${user_id}] in compressed ready payload`);
a0.user = r12[user_id];
}
delete a0["user_id"];
r2[1].push(a0);
}
};
}
let hydratePreviouslyUnavailableGuild, collectThreadMessages;
let $mk90316 = function() {
return (a0) => a0.id === env8775[4].guild.id;
};
let env8775 = {};
const hydrateGuild = function hydrateGuild(a0) {
let r13;
if (a0.data_mode !== "partial") {
const threads2 = a0.threads;
let threads4 = threads2 == null ? void 0 : threads2.map((item) => (0, createChannelRecordFromServer)(item, a0.id));
if (threads4 == null) {
threads4 = [];
}
r13 = {
id: a0.id,
dataMode: a0.data_mode,
emojis: {
op: "full_sync",
items: a0.emojis
},
guild_scheduled_events: a0.guild_scheduled_events,
experiments: a0.experiments,
joined_at: a0.joined_at,
lastMessages: a0.last_messages,
member_count: a0.member_count,
members: a0.members,
premium_subscription_count: a0.premium_subscription_count,
properties: a0.properties,
roles: {
op: "full_sync",
items: a0.roles
},
stage_instances: a0.stage_instances,
stickers: {
op: "full_sync",
items: a0.stickers
},
threads: threads4,
threadMessages: collectThreadMessages(a0.threads),
channels: {
op: "full_sync",
items: a0.channels.map((channel) => {
channel.guild_id = a0.id;
return (0, createChannelRecordFromServer)(channel, a0.id);
})
},
version: a0.version,
hasThreadsSubscription: a0.has_threads_subscription
};
} else {
const channels = a0.partial_updates.channels;
let writes = channels == null ? void 0 : channels.map((channel) => (0, createChannelRecordFromServer)(channel, a0.id));
if (writes == null) {
writes = [];
}
let deleted_channel_ids = a0.partial_updates.deleted_channel_ids;
if (deleted_channel_ids == null) {
deleted_channel_ids = [];
}
const channels2 = {
op: "update",
writes,
deletes: deleted_channel_ids
};
let emojis = a0.partial_updates.emojis;
if (emojis == null) {
emojis = [];
}
let deleted_emoji_ids = a0.partial_updates.deleted_emoji_ids;
if (deleted_emoji_ids == null) {
deleted_emoji_ids = [];
}
const emojis2 = {
op: "update",
writes: emojis,
deletes: deleted_emoji_ids
};
let properties = a0.properties;
if (properties == null) {
properties = null;
}
let roles = a0.partial_updates.roles;
if (roles == null) {
roles = [];
}
let deleted_role_ids = a0.partial_updates.deleted_role_ids;
if (deleted_role_ids == null) {
deleted_role_ids = [];
}
const roles2 = {
op: "update",
writes: roles,
deletes: deleted_role_ids
};
let stickers = a0.partial_updates.stickers;
if (stickers == null) {
stickers = [];
}
let deleted_sticker_ids = a0.partial_updates.deleted_sticker_ids;
if (deleted_sticker_ids == null) {
deleted_sticker_ids = [];
}
const stickers2 = {
op: "update",
writes: stickers,
deletes: deleted_sticker_ids
};
const threads = a0.threads;
let threads3 = threads == null ? void 0 : threads.map((thread) => (0, createChannelRecordFromServer)(thread, a0.id));
if (threads3 == null) {
threads3 = [];
}
r13 = {
id: a0.id,
dataMode: a0.data_mode,
channels: channels2,
channelTimestampUpdates: a0.channel_updates,
emojis: emojis2,
guild_scheduled_events: a0.guild_scheduled_events,
experiments: a0.experiments,
joined_at: a0.joined_at,
lastMessages: a0.last_messages,
member_count: a0.member_count,
members: a0.members,
premium_subscription_count: a0.premium_subscription_count,
properties,
roles: roles2,
stage_instances: a0.stage_instances,
stickers: stickers2,
unableToSyncDeletes: a0.unable_to_sync_deletes,
threads: threads3,
threadMessages: collectThreadMessages(a0.threads),
version: a0.version,
hasThreadsSubscription: a0.has_threads_subscription
};
}
return r13;
};
hydratePreviouslyUnavailableGuild = function hydratePreviouslyUnavailableGuild(a0) {
let r13;
if (a0.data_mode !== "partial") {
const threads2 = a0.threads;
let threads4 = threads2 == null ? void 0 : threads2.map((item) => (0, createChannelRecordFromServer)(item, a0.id));
if (threads4 == null) {
threads4 = [];
}
r13 = {
id: a0.id,
guild_scheduled_events: a0.guild_scheduled_events,
experiments: a0.experiments,
joined_at: a0.joined_at,
lastMessages: a0.last_messages,
member_count: a0.member_count,
members: a0.members,
premium_subscription_count: a0.premium_subscription_count,
properties: a0.properties,
roles: {
op: "full_sync",
items: a0.roles
},
stage_instances: a0.stage_instances,
threads: threads4,
threadMessages: collectThreadMessages(a0.threads),
presences: a0.presences,
activity_instances: a0.activity_instances,
voice_states: a0.voice_states,
version: a0.version,
hasThreadsSubscription: a0.has_threads_subscription,
emojis: {
op: "full_sync",
items: a0.emojis
},
stickers: {
op: "full_sync",
items: a0.stickers
},
channels: {
op: "full_sync",
items: a0.channels.map((channel) => {
channel.guild_id = a0.id;
return (0, createChannelRecordFromServer)(channel, a0.id);
})
}
};
} else {
const channels = a0.partial_updates.channels;
let writes = channels == null ? void 0 : channels.map((channel) => (0, createChannelRecordFromServer)(channel, a0.id));
if (writes == null) {
writes = [];
}
let deleted_channel_ids = a0.partial_updates.deleted_channel_ids;
if (deleted_channel_ids == null) {
deleted_channel_ids = [];
}
const channels2 = {
op: "update",
writes,
deletes: deleted_channel_ids
};
let emojis = a0.partial_updates.emojis;
if (emojis == null) {
emojis = [];
}
let deleted_emoji_ids = a0.partial_updates.deleted_emoji_ids;
if (deleted_emoji_ids == null) {
deleted_emoji_ids = [];
}
const emojis2 = {
op: "update",
writes: emojis,
deletes: deleted_emoji_ids
};
let properties = a0.properties;
if (properties == null) {
properties = null;
}
let roles = a0.partial_updates.roles;
if (roles == null) {
roles = [];
}
let deleted_role_ids = a0.partial_updates.deleted_role_ids;
if (deleted_role_ids == null) {
deleted_role_ids = [];
}
const roles2 = {
op: "update",
writes: roles,
deletes: deleted_role_ids
};
let stickers = a0.partial_updates.stickers;
if (stickers == null) {
stickers = [];
}
let deleted_sticker_ids = a0.partial_updates.deleted_sticker_ids;
if (deleted_sticker_ids == null) {
deleted_sticker_ids = [];
}
const stickers2 = {
op: "update",
writes: stickers,
deletes: deleted_sticker_ids
};
const threads = a0.threads;
let threads3 = threads == null ? void 0 : threads.map((thread) => (0, createChannelRecordFromServer)(thread, a0.id));
if (threads3 == null) {
threads3 = [];
}
r13 = {
id: a0.id,
channels: channels2,
channelTimestampUpdates: a0.channel_updates,
activity_instances: a0.activity_instances,
emojis: emojis2,
guild_scheduled_events: a0.guild_scheduled_events,
experiments: a0.experiments,
joined_at: a0.joined_at,
lastMessages: a0.last_messages,
member_count: a0.member_count,
members: a0.members,
premium_subscription_count: a0.premium_subscription_count,
presences: a0.presences,
properties,
roles: roles2,
stage_instances: a0.stage_instances,
stickers: stickers2,
unableToSyncDeletes: a0.unable_to_sync_deletes,
threads: threads3,
threadMessages: collectThreadMessages(a0.threads),
voice_states: a0.voice_states,
version: a0.version,
hasThreadsSubscription: a0.has_threads_subscription
};
}
return r13;
};
collectThreadMessages = function collectThreadMessages(a0) {
const r0 = [];
if (a0 != null) {
for (const item of a0) {
if (item.most_recent_message != null) {
r0.push(item.most_recent_message);
}
}
}
return r0;
};
env8775[4] = null;
env8775[5] = {};
export function hydrateReadySupplementalPayload({ guilds, merged_members, merged_presences, ...rest }, a1) {
let r25;
const r4 = env8775[5];
const friends = merged_presences?.friends;
let env20183;
const r15 = env20183 = {
$parent: env8775
};
env20183[0] = r4;
const presences = [];
env20183[1] = presences;
if (friends != null) {
friends.forEach($mk90317(r15));
}
let guilds2 = guilds == null ? void 0 : guilds.map((guild, index) => {
const r3 = env8775;
const r5 = env8775[5];
const r9 = merged_presences == null ? void 0 : merged_presences.guilds[index];
let env27362;
const r13 = env27362 = {
$parent: r3
};
env27362[0] = r5;
const presences = [];
env27362[1] = presences;
if (r9 != null) {
r9.forEach($mk90317(r13));
}
const r17 = env8775[5];
const r20 = merged_members == null ? void 0 : merged_members[index];
let env27363;
const r21 = env27363 = {
$parent: r3
};
env27363[0] = r17;
const members = [];
env27363[1] = members;
if (r20 != null) {
r20.forEach($mk90317(r21));
}
return {
...guild,
unavailable: guild.voice_states === void 0,
presences,
members
};
});
if (guilds2 == null) {
guilds2 = [];
}
L13: {
const r24 = env8775[4] == null;
r25 = null;
if (!r24) {
const identifyTime = env8775[4].identifyTime;
r25 = null;
if (identifyTime === a1) {
if (guilds != null) {
const r31 = guilds.some($mk90316());
r25 = null;
if (r31) {
break L13;
}
}
const guild = env8775[4].guild;
r25 = {
id: guild.id,
members: guild.members,
presences: guild.presences,
activity_instances: guild.activity_instances,
voice_states: guild.voice_states,
unavailable: false
};
}
}
}
if (r25 != null) {
guilds2.push(r25);
}
env8775[5] = {};
return {
...rest,
presences,
guilds: guilds2
};
}
export function preloadReadyPayloadData() {
const r13 = DatabaseDaos.database();
return Promise.all([isCacheEnabled() ? GuildVersions.getCommittedVersions() : Promise.resolve({}), isCacheEnabled() ? ChannelReader.getGuildIds() : Promise.resolve(new Set()), r13 != null ? KvCacheVersion.okAsync(r13) : Promise.resolve(false)]).then((result) => {
const [guildVersions, guildChannels, databaseOk] = result;
return {
guildVersions,
guildChannels,
databaseOk
};
});
}
export function hydrateReadyPayloadPrioritized(a0, a1, a2) {
let r43;
const { users, private_channels: _private_channels, merged_members: merged_members2, guilds, ...rest } = a0;
let private_channels = a0.private_channels;
if (DatabaseDaos.database() != null && a2.databaseOk === false) {
DatabaseManager.replaceDisableAllDatabases("ReadyPayloadUtils: database was not ok");
}
env8775[5] = Module12.keyBy(users, (a0) => a0.id);
if (private_channels != null) {
private_channels.forEach((private_channel) => {
const recipient_ids = private_channel.recipient_ids;
if (recipient_ids != null) {
private_channel.recipients = recipient_ids.map((recipient_id) => {
Module38(env8775[5][recipient_id] != null, "Missing user in compressed ready payload");
return env8775[5][recipient_id];
});
}
delete private_channel["recipient_ids"];
});
}
let guilds2 = guilds == null ? void 0 : guilds.map((guild, index) => {
const unavailable = guild.unavailable;
let r3 = guild;
if (unavailable !== true) {
const r10 = env8775;
const r6 = env8775[5];
const r9 = merged_members2 == null ? void 0 : merged_members2[index];
let env27364;
const r13 = env27364 = {
$parent: r10
};
env27364[0] = r6;
const members = [];
env27364[1] = members;
if (r9 != null) {
r9.forEach($mk90317(r13));
}
guild.members = members;
r3 = hydrateGuild(guild);
}
return r3;
});
if (guilds2 == null) {
guilds2 = [];
}
L15: {
const r42 = env8775[4] == null;
r43 = null;
if (!r42) {
const identifyTime = env8775[4].identifyTime;
r43 = null;
if (identifyTime === a1) {
if (guilds != null) {
const r49 = guilds.some($mk90316());
r43 = null;
if (r49) {
break L15;
}
}
r43 = hydrateGuild(env8775[4].guild);
}
}
}
if (r43 != null) {
guilds2.push(r43);
}
if (private_channels == null) {
private_channels = [];
}
return {
...rest,
users,
presences: [],
guilds: guilds2,
private_channels
};
}
export function hydrateInitialGuild(a0, a1) {
const r5 = hydratePreviouslyUnavailableGuild(a0);
env8775[4] = {
guild: a0,
identifyTime: a1
};
return r5;
}
export { hydratePreviouslyUnavailableGuild };
+5
View File
@@ -0,0 +1,5 @@
// Metro module 4177 (f4178).
const r9 = {
escape: (a0) => a0.replace(/[-[\]/{}()*+?.\\^$|]/g, "\\$&")
};
export default r9;
+35
View File
@@ -0,0 +1,35 @@
// Metro module 16307 (f16308).
import { FriendsSections } from "../Constants";
import NotificationActionCreators from "../actions/NotificationActionCreators";
import AvatarUtils from "./AvatarUtils";
import { intl, t } from "../intl/index.native";
import FriendsActionCreators from "../actions/FriendsActionCreators";
import ChannelActionCreators from "../actions/ChannelActionCreators";
export function showPendingNotification(a0) {
const r11 = intl.string(t["t3+Af3"]);
NotificationActionCreators.showNotification(AvatarUtils.getUserAvatarURL(a0), a0.username, r11, {}, {
omitViewTracking: true,
omitClickTracking: true,
tag: a0.id,
onClick: () => {
FriendsActionCreators.transitionToSection(FriendsSections.PENDING, {
explicit: true
});
},
isUserAvatar: true
});
}
export function showAcceptedNotification(a0) {
const r11 = intl.string(t.MYr3Ka);
NotificationActionCreators.showNotification(AvatarUtils.getUserAvatarURL(a0), a0.username, r11, {}, {
omitViewTracking: true,
omitClickTracking: true,
tag: a0.id,
onClick: () => {
ChannelActionCreators.openPrivateChannel({
recipientIds: a0.id
});
},
isUserAvatar: true
});
}
+9
View File
@@ -0,0 +1,9 @@
// Metro module 5868 (f5869).
import { getConstants } from "./native/ClientInfoUtils";
import { isAndroid } from "./PlatformUtils";
const ReleaseChannel = getConstants().ReleaseChannel;
const r22 = isAndroid() && ReleaseChannel.indexOf("canary") === -1 && ReleaseChannel.indexOf("beta") === -1;
const r1 = ReleaseChannel.indexOf("debug") !== -1 || ReleaseChannel.indexOf("developer") !== -1;
const r37 = r1 ? !r1 : ReleaseChannel === "stable" || r22;
export { r37 as isStable };
export { ReleaseChannel as CurrentReleaseChannel };
+91
View File
@@ -0,0 +1,91 @@
// Metro module 6061 (f6062).
import ChannelStore from "../stores/ChannelStore";
import GuildMemberCountStore from "../stores/GuildMemberCountStore";
import PermissionStore from "../stores/PermissionStore";
import UserStore from "../stores/UserStore";
import { ChannelTypes, Permissions } from "../Constants";
export function canReportUser(a0) {
if (a0 == null) {
return false;
}
const id = a0.id;
const currentUser = UserStore.getCurrentUser();
return currentUser != null && (currentUser.id !== id && a0.system !== true);
}
export function canReportMessage(a0) {
let r2 = a0 != null;
if (r2) {
const author = a0.author;
const r1 = author == null;
let r3 = false;
if (!r1) {
const id = author.id;
const currentUser = UserStore.getCurrentUser();
r3 = currentUser != null && (currentUser.id !== id && author.system !== true);
}
r2 = r3;
}
return r2;
}
export function canReportAndDeleteInChannel(a0) {
const channel = ChannelStore.getChannel(a0);
if (channel == null) {
return false;
}
if (channel.type !== ChannelTypes.DM && channel.type !== ChannelTypes.GROUP_DM) {
if (PermissionStore.canWithPartialContext(Permissions.MANAGE_MESSAGES, {
channelId: a0
})) {
const memberCount = GuildMemberCountStore.getMemberCount(channel.getGuildId());
return memberCount != null && memberCount >= 50;
}
return false;
}
return true;
}
export function canDeleteAndReportMessage(a0) {
let r2 = a0 != null;
if (r2) {
let r1 = a0 != null;
if (r1) {
const author = a0.author;
const r4 = author == null;
let r5 = false;
if (!r4) {
const id = author.id;
const currentUser = UserStore.getCurrentUser();
r5 = currentUser != null && (currentUser.id !== id && author.system !== true);
}
r1 = r5;
}
r2 = r1;
}
if (r2) {
const channelId = a0.getChannelId();
const channel = ChannelStore.getChannel(channelId);
const r23 = channel == null;
let r24 = false;
if (!r23) {
const type = channel.type;
const DM = ChannelTypes.DM;
r24 = true;
if (type !== DM) {
const type2 = channel.type;
const GROUP_DM = ChannelTypes.GROUP_DM;
r24 = true;
if (type2 !== GROUP_DM) {
const canWithPartialContext = PermissionStore.canWithPartialContext(Permissions.MANAGE_MESSAGES, {
channelId
});
r24 = false;
if (canWithPartialContext) {
const memberCount = GuildMemberCountStore.getMemberCount(channel.getGuildId());
r24 = memberCount != null && memberCount >= 50;
}
}
}
}
r2 = r24;
}
return r2;
}
+273
View File
@@ -0,0 +1,273 @@
// Metro module 8517 (f8518).
import { GameGenres, Routes, SKUProductLines, SKUTypes } from "../Constants";
import { matchPath } from "../modules/routing/matchPathCompat";
import { intl, t } from "../intl/index.native";
import { nativePlatformTypeToSKUOperatingSystem } from "./StoreUtils";
import { getPlatform } from "./PlatformUtils";
import Module3771 from "../_bundle/Module3771";
let c5455_11;
let c5455_8 = {};
let c5455_9 = {};
let c5455_10 = Object.freeze({
ALL: -1,
...GameGenres
});
Object.keys(c5455_10).forEach((item) => {
const r8 = item.toLowerCase().replace(/_/g, "-");
const r10 = c5455_10[item];
c5455_8[r8] = r10;
c5455_9[r10] = r8;
});
c5455_11 = [["YYYY-MM-DD", "MMMM DD, Y"], ["YYYY-MM", "MMMM Y"], ["MM-DD", "MMMM DD"], ["MM", "MMMM"], ["YYYY", "Y"]];
export function getSKUIdFromURL(a0) {
const r14 = matchPath(a0, {
path: Routes.APPLICATION_STORE_LISTING_SKU(":skuId", ":slug")
});
return r14 != null ? r14.params.skuId : null;
}
export function getGenreURLSlugFromId(a0) {
return c5455_9[a0];
}
export function getGenreIdFromURLSlug(a0) {
return c5455_8[a0];
}
export function getGenreText(a0) {
if (GameGenres.ACTION === a0) {
return intl.string(t["1o2/IM"]);
}
if (GameGenres.ACTION_RPG === a0) {
return intl.string(t.e9Yo4H);
}
if (GameGenres.BRAWLER === a0) {
return intl.string(t.WCkEjT);
}
if (GameGenres.HACK_AND_SLASH === a0) {
return intl.string(t.xQ4VmK);
}
if (GameGenres.PLATFORMER === a0) {
return intl.string(t.WA3189);
}
if (GameGenres.STEALTH === a0) {
return intl.string(t["6UPFdw"]);
}
if (GameGenres.SURVIVAL === a0) {
return intl.string(t.SVPCt9);
}
if (GameGenres.ADVENTURE === a0) {
return intl.string(t["15p8on"]);
}
if (GameGenres.ACTION_ADVENTURE === a0) {
return intl.string(t.AxkUBp);
}
if (GameGenres.METROIDVANIA === a0) {
return intl.string(t.Iwr38m);
}
if (GameGenres.OPEN_WORLD === a0) {
return intl.string(t["2HRHJO"]);
}
if (GameGenres.PSYCHOLOGICAL_HORROR === a0) {
return intl.string(t["/IwK3s"]);
}
if (GameGenres.SANDBOX === a0) {
return intl.string(t["2+Vu4Q"]);
}
if (GameGenres.SURVIVAL_HORROR === a0) {
return intl.string(t.CCzRiK);
}
if (GameGenres.VISUAL_NOVEL === a0) {
return intl.string(t.FE7rnk);
}
if (GameGenres.DRIVING_RACING === a0) {
return intl.string(t.Erzgca);
}
if (GameGenres.VEHICULAR_COMBAT === a0) {
return intl.string(t.YQHhog);
}
if (GameGenres.MASSIVELY_MULTIPLAYER === a0) {
return intl.string(t["5CNg1o"]);
}
if (GameGenres.MMORPG === a0) {
return intl.string(t["c4NuO/"]);
}
if (GameGenres.ROLE_PLAYING === a0) {
return intl.string(t.yayVgs);
}
if (GameGenres.DUNGEON_CRAWLER === a0) {
return intl.string(t.qicemc);
}
if (GameGenres.ROGUELIKE === a0) {
return intl.string(t.zWzaCv);
}
if (GameGenres.SHOOTER === a0) {
return intl.string(t["+pk6sd"]);
}
if (GameGenres.LIGHT_GUN === a0) {
return intl.string(t.TDS96y);
}
if (GameGenres.SHOOT_EM_UP === a0) {
return intl.string(t.wltDUE);
}
if (GameGenres.FPS === a0) {
return intl.string(t.olTaq4);
}
if (GameGenres.DUAL_JOYSTICK_SHOOTER === a0) {
return intl.string(t["SN+NS3"]);
}
if (GameGenres.SIMULATION === a0) {
return intl.string(t.sxMPdm);
}
if (GameGenres.FLIGHT_SIMULATOR === a0) {
return intl.string(t["Q7msr+"]);
}
if (GameGenres.TRAIN_SIMULATOR === a0) {
return intl.string(t.ZtECf3);
}
if (GameGenres.LIFE_SIMULATOR === a0) {
return intl.string(t.byt5Fo);
}
if (GameGenres.FISHING === a0) {
return intl.string(t.BKwiwY);
}
if (GameGenres.SPORTS === a0) {
return intl.string(t.O0B7XM);
}
if (GameGenres.BASEBALL === a0) {
return intl.string(t["jPYb/z"]);
}
if (GameGenres.BASKETBALL === a0) {
return intl.string(t["o+D1Bm"]);
}
if (GameGenres.BILLIARDS === a0) {
return intl.string(t.PJ5o4E);
}
if (GameGenres.BOWLING === a0) {
return intl.string(t["82afJw"]);
}
if (GameGenres.BOXING === a0) {
return intl.string(t.DQvfei);
}
if (GameGenres.FOOTBALL === a0) {
return intl.string(t.slOYkj);
}
if (GameGenres.GOLF === a0) {
return intl.string(t.aeQPlG);
}
if (GameGenres.HOCKEY === a0) {
return intl.string(t.g7oe5X);
}
if (GameGenres.SKATEBOARDING_SKATING === a0) {
return intl.string(t.yBDEP0);
}
if (GameGenres.SNOWBOARDING_SKIING === a0) {
return intl.string(t.GVaAci);
}
if (GameGenres.SOCCER === a0) {
return intl.string(t.KPznxl);
}
if (GameGenres.TRACK_FIELD === a0) {
return intl.string(t["hJ62Q/"]);
}
if (GameGenres.SURFING_WAKEBOARDING === a0) {
return intl.string(t.PSh0CV);
}
if (GameGenres.WRESTLING === a0) {
return intl.string(t["3y9hAT"]);
}
if (GameGenres.STRATEGY === a0) {
return intl.string(t.KovTD8);
}
if (GameGenres.FOUR_X === a0) {
return intl.string(t["19h4dX"]);
}
if (GameGenres.ARTILLERY === a0) {
return intl.string(t.sBqLsP);
}
if (GameGenres.RTS === a0) {
return intl.string(t.yS4ddj);
}
if (GameGenres.TOWER_DEFENSE === a0) {
return intl.string(t.SULyIO);
}
if (GameGenres.TURN_BASED_STRATEGY === a0) {
return intl.string(t.VDsbru);
}
if (GameGenres.WARGAME === a0) {
return intl.string(t.YDCIrO);
}
if (GameGenres.MOBA === a0) {
return intl.string(t.i1m1t8);
}
if (GameGenres.FIGHTING === a0) {
return intl.string(t.KepcSI);
}
if (GameGenres.PUZZLE === a0) {
return intl.string(t.rm7Ggs);
}
if (GameGenres.CARD_GAME === a0) {
return intl.string(t.kX85vy);
}
if (GameGenres.EDUCATION === a0) {
return intl.string(t.klIi67);
}
if (GameGenres.FITNESS === a0) {
return intl.string(t.GOaaFb);
}
if (GameGenres.GAMBLING === a0) {
return intl.string(t["X8/Ee9"]);
}
if (GameGenres.MUSIC_RHYTHM === a0) {
return intl.string(t.qPgrgw);
}
if (GameGenres.PARTY_MINI_GAME === a0) {
return intl.string(t.diBclF);
}
if (GameGenres.PINBALL === a0) {
return intl.string(t["1+ottx"]);
}
if (GameGenres.TRIVIA_BOARD_GAME === a0) {
return intl.string(t.aLlxjC);
}
if (GameGenres.TACTICAL === a0) {
return intl.string(t.LRPgbt);
}
if (GameGenres.INDIE === a0) {
return intl.string(t.hz9Xvj);
}
if (GameGenres.ARCADE === a0) {
return intl.string(t.Sbxowr);
}
if (GameGenres.POINT_AND_CLICK === a0) {
return intl.string(t.vcerEn);
}
return intl.string(t["9b4eUr"]);
}
export function canUserInstall(a0) {
const r12 = nativePlatformTypeToSKUOperatingSystem(getPlatform());
return a0.type === SKUTypes.DURABLE_PRIMARY && r12 != null && a0.supportedOperatingSystems.includes(r12);
}
export function getReadablePreorderReleaseDate({ preorderReleaseAt, preorderApproximateReleaseDate }) {
if (preorderReleaseAt != null) {
return preorderReleaseAt.format("MMMM DD");
}
if (preorderApproximateReleaseDate == null) {
return null;
}
const length = c5455_11.length;
let r0 = 0;
if (0 < length) {
do {
const [r14, r20] = c5455_11[r0];
const r24 = Module3771(preorderApproximateReleaseDate, r14, true);
const isValid = r24.isValid();
const r1 = r0;
if (isValid) {
return r24.format(r20);
}
r0 = r1 + 1;
} while (r0 < c5455_11.length);
}
return preorderApproximateReleaseDate;
}
export function isThirdPartySKU(a0) {
return a0 === SKUProductLines.SOCIAL_LAYER_GAME_ITEM;
}
+7
View File
@@ -0,0 +1,7 @@
// Metro module 5021 (f5022).
import isUndefinedOrNull from "../_bundle/isUndefinedOrNull";
export function isVersionEqual(a0, a1) {
const [r27, r28] = a0;
const [r36, r37] = a1;
return r28 === r37 && isUndefinedOrNull(r27, r36);
}
+26
View File
@@ -0,0 +1,26 @@
// Metro module 15643 (f15644).
import { intl, t } from "../intl/index.native";
import Module3771 from "../_bundle/Module3771";
export function getSecondsSliderLabel(a0, r5 = true, r3 = intl.string(t.Yl1D84)) {
const r25 = Module3771.duration(a0, "seconds");
if (r25.days() > 0) {
r3 = intl.formatToPlainString(r5 ? t.GBLpQ8 : t["k2UNz+"], {
days: r25.days()
});
} else if (r25.hours() > 0) {
r3 = intl.formatToPlainString(r5 ? t.rhY1Rs : t.xCjYxK, {
hours: r25.hours()
});
} else if (r25.minutes() > 0) {
r3 = intl.formatToPlainString(r5 ? t["XIGt+W"] : t.iXLF9W, {
minutes: r25.minutes()
});
} else if (a0 > 0) {
r3 = intl.formatToPlainString(r5 ? t.pyvjRp : t.geSp4K, {
seconds: r25.seconds()
});
} else if (r5) {
r3 = intl.string(t.Yl1D84);
}
return r3;
}
+218
View File
@@ -0,0 +1,218 @@
// Metro module 1208 (f1209).
import { NativeModules } from "react-native";
import Logger from "../modules/debug/Logger";
import { initSentry } from "../modules/errors/native/SentryInitUtils";
import * as _Module810 from "../_bundle/Module810";
import { getCurrentScope, withScope, withProfiler } from "../_bundle/Module810";
import { getUpdatedOptions } from "./ErrorCommonUtils";
import addSentryBreadcrumb_native from "../modules/sentry/addSentryBreadcrumb.native";
import { getConstants } from "./native/ClientInfoUtils";
let c1017_5 = new Logger("Sentry");
initSentry();
const r30 = {
setUser: (a0, a1, a2, a3) => {
const r3 = {
id: a0,
username: a1,
email: a2,
staff: a3
};
getCurrentScope().setUser(r3);
NativeModules.CrashReportingManager.setUser(r3);
},
clearUser: () => {
getCurrentScope().setUser(null);
NativeModules.CrashReportingManager.setUser({
staff: false
});
},
setTags: (a0) => {
getCurrentScope().setTags(a0);
},
setExtra: (a0) => {
getCurrentScope().setExtras(a0);
},
captureException: (c12914_0, a1) => {
let c12914_1;
const updatedOptions = getUpdatedOptions(a1);
withScope((a0) => {
if (updatedOptions != null) {
if (updatedOptions.tags != null) {
a0.setTags(updatedOptions.tags);
}
if (updatedOptions.extra != null) {
a0.setExtras(updatedOptions.extra);
}
}
c12914_1 = _Module810.captureException(c12914_0);
});
return c12914_1;
},
captureCrash: (c12915_0, a1) => {
let c12915_1;
const updatedOptions2 = getUpdatedOptions(a1);
let c12915_3 = {
crash: "true",
...updatedOptions2?.tags != null ? updatedOptions2?.tags : {}
};
withScope((a0) => {
if (updatedOptions2 != null && updatedOptions2.extra != null) {
a0.setExtras(updatedOptions2.extra);
}
a0.setTags(c12915_3);
a0.setLevel("fatal");
a0.addEventProcessor((a0) => {
const exception = a0.exception;
const r2 = exception == null;
let r5 = void 0;
if (!r2) {
const values = exception.values;
r5 = values == null ? void 0 : values[0];
}
if (r5 != null) {
r5.mechanism = {
...r5.mechanism,
handled: false
};
}
return a0;
});
c12915_1 = _Module810.captureException(c12915_0);
});
return c12915_1;
},
captureMessage: (c12916_0, a1) => {
const updatedOptions3 = getUpdatedOptions(a1);
withScope((a0) => {
if (updatedOptions3 != null && updatedOptions3.extra != null) {
a0.setExtras(updatedOptions3.extra);
}
if (updatedOptions3 != null && updatedOptions3.tags != null) {
a0.setTags(updatedOptions3.tags);
}
_Module810.captureMessage(c12916_0);
});
},
addFeatureFlag: (a0, a1) => {
const getClient = _Module810.getClient;
const r5 = getClient == null ? void 0 : getClient.call(_Module810);
const r11 = r5 == null;
let r6 = void 0;
if (!r11) {
const getIntegrationByName = r5.getIntegrationByName;
r6 = getIntegrationByName == null ? void 0 : getIntegrationByName.call(r5, "FeatureFlags");
}
if (r6 != null) {
const addFeatureFlag2 = r6.addFeatureFlag;
if (addFeatureFlag2 != null) {
addFeatureFlag2.call(r6, a0, a1);
}
}
},
addBreadcrumb: (a0) => {
c1017_5.verbose("Breadcrumb", a0);
addSentryBreadcrumb_native(a0);
},
profiledRootComponent: (a0) => getConstants().ReleaseChannel === "canaryRelease" ? withProfiler(a0, {
includeRender: true,
includeUpdates: true
}) : a0,
crash: () => {
NativeModules.CrashReportingManager.crash();
},
triggerMemoryWarning: () => {
NativeModules.CrashReportingManager.triggerMemoryWarning();
},
markCrashHandled: (a0) => {
if (a0.length !== 0) {
try {
const CrashReportingManager = NativeModules.CrashReportingManager;
const markCrashHandled2 = CrashReportingManager.markCrashHandled;
if (markCrashHandled2 != null) {
markCrashHandled2.call(CrashReportingManager, a0);
}
} catch ($e) {
c1017_5.warn("Failed to mark crash as handled", $e);
}
}
},
getLastCrashReport: () => new Promise((resolve, c24320_1) => {
const CrashReportingManager = NativeModules.CrashReportingManager;
if (CrashReportingManager?.getLastCrashReport != null) {
CrashReportingManager.getLastCrashReport((a0) => {
try {
resolve(a0 != null ? (function parseNativeCrashReport(a0) {
const timestamp = typeof a0.timestamp === "number" ? Number.isNaN(a0.timestamp) ? void 0 : a0.timestamp / 1000 : void 0;
let level = a0.level;
if (level == null) {
level = a0.is_native ? "fatal" : "error";
}
const level2 = level == null ? void 0 : level.toLowerCase();
const origin = a0.origin;
const r20 = {
type: void 0,
event_id: a0.event_id,
timestamp,
level: level2,
tags: (typeof origin === "string" ? origin.length > 0 : typeof origin === "string") ? {
"event.origin": a0.origin
} : void 0
};
const error_message = a0.error_message;
const r28 = typeof error_message === "string" ? error_message.length > 0 : typeof error_message === "string";
const r8 = {};
if (r28) {
r20.message = a0.error_message;
r8.persisted_error_message = a0.error_message;
}
const error_stack = a0.error_stack;
if (typeof error_stack === "string" ? error_stack.length > 0 : typeof error_stack === "string") {
r8.persisted_error_stack = a0.error_stack;
}
if (a0.is_native) {
const exit_reason = a0.exit_reason;
if (typeof exit_reason === "string" ? exit_reason.length > 0 : typeof exit_reason === "string") {
r8.native_exit_reason = a0.exit_reason;
}
const exit_description = a0.exit_description;
if (typeof exit_description === "string" ? exit_description.length > 0 : typeof exit_description === "string") {
r8.native_exit_description = a0.exit_description;
}
const tombstone = a0.tombstone;
if (typeof tombstone === "string" ? tombstone.length > 0 : typeof tombstone === "string") {
r8.native_tombstone = a0.tombstone;
}
const tombstone_cause = a0.tombstone_cause;
if (typeof tombstone_cause === "string" ? tombstone_cause.length > 0 : typeof tombstone_cause === "string") {
r8.native_tombstone_cause = a0.tombstone_cause;
}
const tombstone_hash = a0.tombstone_hash;
if (typeof tombstone_hash === "string" ? tombstone_hash.length > 0 : typeof tombstone_hash === "string") {
r8.native_tombstone_hash = a0.tombstone_hash;
}
const tombstone_group_by = a0.tombstone_group_by;
if (typeof tombstone_group_by === "string" ? tombstone_group_by.length > 0 : typeof tombstone_group_by === "string") {
r8.native_tombstone_group_by = a0.tombstone_group_by;
}
const tombstone_origin = a0.tombstone_origin;
if (typeof tombstone_origin === "string" ? tombstone_origin.length > 0 : typeof tombstone_origin === "string") {
r8.native_tombstone_origin = a0.tombstone_origin;
}
}
r8.native_is_native = a0.is_native ? "true" : "false";
r20.extra = {
...r20.extra,
...r8
};
return r20;
})(a0) : null);
} catch ($e) {
c24320_1($e);
}
});
} else {
resolve(null);
}
})
};
export default r30;
+58
View File
@@ -0,0 +1,58 @@
// Metro module 11 (f12).
import Module12 from "../_bundle/Module12";
import * as _extractTimestamp from "../_bundle/extractTimestamp";
const r14 = {
age: function age(a0) {
return _extractTimestamp.age(a0);
},
extractTimestamp: function extractTimestamp(a0) {
return _extractTimestamp.extractTimestamp(a0);
},
compare: function compare(a0, a1) {
return _extractTimestamp.compare(a0, a1);
},
atPreviousMillisecond: function atPreviousMillisecond(a0) {
return _extractTimestamp.atPreviousMillisecond(a0);
},
atNextMillisecond: function atNextMillisecond(a0) {
return _extractTimestamp.atNextMillisecond(a0);
},
fromTimestamp: function fromTimestamp(a0) {
return _extractTimestamp.fromTimestamp(a0);
},
fromTimestampWithSequence: function fromTimestampWithSequence(a0, a1) {
return _extractTimestamp.fromTimestampWithSequence(a0, a1);
},
keys: function keys(a0) {
return Object.keys(a0);
},
forEach: function forEach(a0, c12102_0) {
Module12.forEach(a0, (a0, a1) => c12102_0(a0, a1));
},
forEachKey: function forEachKey(a0, a1) {
for (const key in a0) {
a1(key);
}
},
entries: function entries(a0) {
return Object.entries(a0);
},
isProbablyAValidSnowflake: function isProbablyAValidSnowflake(a0) {
return _extractTimestamp.isProbablyAValidSnowflake(a0);
},
castChannelIdAsMessageId: function castChannelIdAsMessageId(a0) {
return a0;
},
castMessageIdAsChannelId: function castMessageIdAsChannelId(a0) {
return a0;
},
castGuildIdAsEveryoneGuildRoleId: function castGuildIdAsEveryoneGuildRoleId(a0) {
return a0;
},
cast: function cast(a0) {
return a0;
}
};
export default r14;
export const DISCORD_EPOCH = _extractTimestamp.DISCORD_EPOCH;
export const SnowflakeSequence = _extractTimestamp.SnowflakeSequence;
+45
View File
@@ -0,0 +1,45 @@
// Metro module 4862 (f4863).
export function insertionIndex(a0, a1, a2) {
let length = a0.length;
const r7 = 0 < length;
let r1 = 0;
let r4 = 0;
if (r7) {
do {
const r2 = r1 + length >>> 1;
const r14 = a2(a0[r2], a1);
let r0 = r1;
let r16 = r2;
if (r14 < 0) {
r0 = r2 + 1;
r16 = length;
}
length = r16;
r1 = r0;
r4 = r1;
} while (r4 < length);
}
return r4;
}
export function insert(a0, a1, a2) {
let length = a0.length;
const r7 = 0 < length;
let r1 = 0;
let r4 = 0;
if (r7) {
do {
const r2 = r1 + length >>> 1;
const r14 = a2(a0[r2], a1);
let r0 = r1;
let r16 = r2;
if (r14 < 0) {
r0 = r2 + 1;
r16 = length;
}
length = r16;
r1 = r0;
r4 = r1;
} while (r4 < length);
}
a0.splice(r4, 0, a1);
}
+135
View File
@@ -0,0 +1,135 @@
// Metro module 5192 (f5193).
import DiscordNative from "../lib/DiscordNative";
import { isDesktop } from "./PlatformUtils";
import { install } from "../lib/spellcheck/Spellchecker";
let value;
const r30 = isDesktop() && DiscordNative?.spellCheck != null ? install() : null;
export function isSupported() {
return isDesktop() && DiscordNative?.spellCheck != null;
}
value = r30;
export async function setEnabled(c25372_0) {
let c29474_0 = c25372_0;
let c29474_1 = await value;
if (c29474_1 != null) {
c29474_1.enabled = c29474_0;
}
}
export async function setLearnedWords(c25373_0) {
let c29475_0 = c25373_0;
let c29475_1 = await value;
if (c29475_1 != null) {
c29475_1.setLearnedWords(c29475_0);
}
}
export async function isMisspelled(c25374_0, c25374_1) {
let c25374_3;
let c29476_1, c29476_2;
c25374_3 = void 0;
c29476_1 = void 0;
let c29476_0 = c25374_0;
if (c25374_1 !== void 0) {
c29476_1 = c25374_1;
c29476_2 = void 0;
} else {
c29476_1 = false;
c29476_2 = void 0;
}
await void 0;
c29476_2 = await value;
return c29476_2 != null && c29476_2.isMisspelled(c29476_0, c29476_1);
}
export async function getCorrections(c25375_0, c25375_1, c25375_2) {
let r29;
let c25375_4;
let c29477_1, c29477_2, c29477_0, c29477_3;
L13: {
L10: {
c25375_4 = void 0;
c29477_1 = void 0;
c29477_2 = void 0;
c29477_0 = c25375_0;
if (c25375_1 !== void 0) {
c29477_1 = c25375_1;
r29 = c25375_2;
if (r29 !== void 0) {
break L10;
}
} else {
c29477_1 = false;
r29 = c25375_2;
if (r29 !== void 0) {
break L10;
}
}
c29477_2 = 5;
c29477_3 = void 0;
break L13;
}
c29477_2 = r29;
c29477_3 = void 0;
}
await void 0;
c29477_3 = await value;
return c29477_3 == null ? [] : c29477_3.getCorrectionsForMisspelling(c29477_0, c29477_1).slice(0, c29477_2);
}
export async function getCachedMisspelling(c25376_0) {
let r61;
let c25376_2;
let c29478_0, c29478_1, c29478_2;
L17: {
c25376_2 = void 0;
c29478_0 = void 0;
if (c25376_0 !== void 0) {
c29478_0 = c25376_0;
c29478_1 = void 0;
c29478_2 = void 0;
} else {
c29478_0 = 5;
c29478_1 = void 0;
c29478_2 = void 0;
}
await void 0;
c29478_1 = await value;
if (c29478_1 == null) {
r61 = {
misspelledWord: "",
corrections: []
};
break L17;
}
c29478_2 = c29478_1.getCachedMisspelling();
return {
misspelledWord: c29478_2.misspelledWord,
corrections: c29478_2.corrections.slice(0, c29478_0)
};
}
return r61;
}
export async function replaceWithCorrection(c25377_0) {
let c29479_0 = c25377_0;
let c29479_1 = await value;
if (c29479_1 != null) {
c29479_1.replaceMisspelling(c29479_0);
}
}
export async function setAppLocale(c25378_0) {
let c29480_0 = c25378_0;
let c29480_1 = await value;
if (c29480_1 != null) {
c29480_1.setAppLocale(c29480_0);
}
}
export function addResultListener(a0) {
let r10;
if (DiscordNative?.spellCheck != null) {
let r16 = DiscordNative.spellCheck.on("spellcheck-result", a0);
if (r16 == null) {
r16 = () => {};
}
r10 = r16;
} else {
r10 = () => {};
}
return r10;
}
+197
View File
@@ -0,0 +1,197 @@
// Metro module 4427 (f4428).
import _asyncToGenerator from "../_bundle/_asyncToGenerator";
import AuthenticationStore from "../stores/AuthenticationStore";
import BillingInfoStore from "../stores/billing/BillingInfoStore";
import PaymentSourceStore from "../stores/billing/PaymentSourceStore";
import SubscriptionStore from "../stores/billing/SubscriptionStore";
import { Endpoints, OperatingSystems } from "../Constants";
import allSettled from "../_bundle/allSettled";
import { isMobile, isTablet } from "../_bundle/Module4426";
import { getChromeVersion } from "./BrowserUtils";
import { getBestMediaProxySize, getDevicePixelRatio } from "../modules/image_upload/ImageLoaderUtils";
import { fetchPaymentSources, fetchIpCountryCode } from "../modules/billing/actions/BillingActionCreators";
import { HTTP } from "../_bundle/sendRequest";
import { PlatformTypes } from "./PlatformUtils";
import { intl, t } from "../intl/index.native";
function $mk114543($env) {
return function waitForSubscriptionsToBeFetched() {
const r3 = Promise;
let env31345 = {
$parent: $env
};
env31345[0] = void 0;
env31345[0] = (0, _asyncToGenerator)(function*(c32116_0) {
let c32116_1;
L16: {
let env32162;
const r10 = env31345.$parent;
const r22 = env32162 = {
$parent: r10
};
c32116_1 = r22;
env32162[0] = c32116_0;
if (r10[6].hasFetchedSubscriptions()) {
c32116_0();
break L16;
}
if (r10[4].isSubscriptionFetching) {
const wait = function wait() {
if (env32162.$parent[4].isSubscriptionFetching) {
setTimeout(env32162[1], 50);
} else {
(0, env32162[0])();
}
};
env32162[1] = wait;
wait();
break L16;
}
yield (0, r10[0])(r10[1][10]).fetchSubscriptions();
(0, env32162[0])();
return void 0;
}
});
return new r3(function() {
return env31345[0].apply(this, arguments);
});
};
}
let env2653 = {};
allSettled.shim();
const c2653_9 = (isMobile ? !isMobile : !isTablet) && getChromeVersion() !== -1;
export { c2653_9 as SUPPORTS_WEBP };
export function getAssetURL(a0, a1, a2, a3) {
let r16 = a3;
const CDN_HOST = window.GLOBAL_ENV.CDN_HOST;
if (a3 == null) {
const r6 = a1.mimeType || a1.mime_type;
r16 = r6 !== "video/quicktime" ? r6 !== "video/mp4" ? r6 === "image/gif" ? "gif" : "webp" : "mp4" : "mp4";
}
if (!(r16 !== "webp" || c2653_9)) {
r16 = "png";
}
const r14 = typeof a1 !== "string" ? a1.id : a1;
const r41 = CDN_HOST != null ? `https://${CDN_HOST}/app-assets/${a0}/store/${r14}.${r16}` : `https:${window.GLOBAL_ENV.API_ENDPOINT}${Endpoints.STORE_ASSET(a0, r14, r16)}`;
return a2 != null ? r41 + `?size=${getBestMediaProxySize(a2 * getDevicePixelRatio())}` : r41;
}
export async function httpGetWithCountryCodeQuery(c25173_0, c25173_1) {
let id, paymentSourcesFetchRequest, ipCountryCode;
let env29338;
const r28 = env2653;
let c25173_6 = r28;
const r10 = env29338 = {
$parent: r28
};
let c25173_5 = r10;
env29338[1] = void 0;
env29338[0] = c25173_0;
if (c25173_1 !== void 0) {
env29338[1] = c25173_1;
env29338[2] = void 0;
env29338[3] = void 0;
env29338[4] = void 0;
env29338[5] = void 0;
env29338[6] = void 0;
env29338[7] = void 0;
} else {
env29338[1] = true;
env29338[2] = void 0;
env29338[3] = void 0;
env29338[4] = void 0;
env29338[5] = void 0;
env29338[6] = void 0;
env29338[7] = void 0;
}
await void 0;
env29338[2] = AuthenticationStore.isAuthenticated();
if (env29338[1]) {
if (env29338[2]) {
env29338[3] = [];
if (!PaymentSourceStore.hasFetchedPaymentSources) {
const r71 = env29338[3];
paymentSourcesFetchRequest = BillingInfoStore.paymentSourcesFetchRequest;
if (BillingInfoStore.paymentSourcesFetchRequest == null) {
paymentSourcesFetchRequest = fetchPaymentSources();
}
r71.push(paymentSourcesFetchRequest);
}
if (!BillingInfoStore.ipCountryCodeLoaded) {
env29338[3].push(fetchIpCountryCode());
}
env29338[3].push($mk114543(env2653)());
await Promise.race([Promise.allSettled(env29338[3]), new Promise((resolve) => setTimeout(resolve, 10000))]);
}
}
env29338[4] = PaymentSourceStore.getDefaultBillingCountryCode();
const id2 = PaymentSourceStore.defaultPaymentSource?.id;
id = id2;
if (id2 == null) {
id = null;
}
env29338[5] = id;
env29338[6] = SubscriptionStore.getPremiumTypeSubscription();
if (env29338[6] != null && env29338[6].paymentSourceId != null) {
env29338[5] = env29338[6].paymentSourceId;
}
let r143 = c25173_5;
if (env29338[4] === null) {
ipCountryCode = BillingInfoStore.ipCountryCode;
if (BillingInfoStore.ipCountryCode == null) {
ipCountryCode = null;
}
env29338[4] = ipCountryCode;
r143 = c25173_5;
}
env29338[7] = {};
if (env29338[4] != null) {
env29338[7].country_code = env29338[4];
}
if (env29338[5] != null) {
env29338[7].payment_source_id = env29338[5];
}
if (!(env29338[4] == null && env29338[5] == null)) {
if (typeof env29338[0] === "string") {
env29338[0] = {
url: env29338[0],
oldFormErrors: true,
rejectWithError: false
};
}
if (typeof env29338[0].query === "string") {
throw new Error("string query not supported");
}
env29338[0].query = {
...env29338[7],
...env29338[0].query
};
}
return HTTP.get(env29338[0]);
}
export function nativePlatformTypeToSKUOperatingSystem(a0) {
if (PlatformTypes.WINDOWS === a0) {
return OperatingSystems.WINDOWS;
}
if (PlatformTypes.OSX === a0) {
return OperatingSystems.MACOS;
}
if (PlatformTypes.LINUX === a0) {
return OperatingSystems.LINUX;
}
return null;
}
export function skuOperatingSystemToText(a0) {
if (OperatingSystems.WINDOWS === a0) {
return intl.string(t["0/xHFO"]);
}
if (OperatingSystems.MACOS === a0) {
return intl.string(t.E4u4n5);
}
if (OperatingSystems.LINUX === a0) {
return intl.string(t.tcawo3);
}
throw new Error(`Unknown operating system value: ${a0}`);
}
export function getPrimarySKUForApplication(a0, a1, a2) {
const application = a1.getApplication(a0);
return application == null ? null : application.primarySkuId == null ? null : a2.get(application.primarySkuId);
}
+96
View File
@@ -0,0 +1,96 @@
// Metro module 8851 (f8852).
import { useMemo } from "react";
import ApplicationStreamingSettingsStore from "../stores/ApplicationStreamingSettingsStore";
import AuthenticationStore from "../stores/AuthenticationStore";
import GuildStore from "../stores/GuildStore";
import RTCConnectionStore from "../stores/RTCConnectionStore";
import UserStore from "../stores/UserStore";
import { AnalyticEvents } from "../Constants";
import { ApplicationStreamFPS, ApplicationStreamResolutions, ApplicationStreamSettingRequirements, getApplicationFramerate, getApplicationResolution } from "../modules/go_live/StreamSettingsConstants";
import { StreamQualitiesToPremiumType } from "../modules/premium/PremiumConstants";
import { ResolutionTypes } from "../_bundle/Module4250";
import { intl, t } from "../intl/index.native";
import { useStateFromStoresObject, useStateFromStores } from "../_bundle/Module589";
import AnalyticsUtils from "./AnalyticsUtils";
function $mk81482($env) {
return (a0) => {
const r2 = $env;
return (a0.preset == null || a0.preset === r2[0]) && a0.resolution === r2[1] && a0.fps === r2[2];
};
}
export function isPremiumResolution(a0) {
if (a0 != null) {
const r6 = a0.maxResolution.type === ResolutionTypes.SOURCE ? ApplicationStreamResolutions.RESOLUTION_SOURCE : a0.maxResolution.height;
const applicationResolution = getApplicationResolution(r6);
return getApplicationFramerate(a0.maxFrameRate) !== ApplicationStreamFPS.FPS_5 && ApplicationStreamSettingRequirements.find((applicationStreamSettingRequirement) => applicationStreamSettingRequirement.resolution === applicationResolution && applicationStreamSettingRequirement.fps !== ApplicationStreamFPS.FPS_5 && !(applicationStreamSettingRequirement.quality != null || applicationStreamSettingRequirement.guildPremiumTier != null)) == null;
}
}
export function isPremiumFPS(a0) {
if (a0 != null) {
const applicationFramerate = getApplicationFramerate(a0.maxFrameRate);
return ApplicationStreamSettingRequirements.find((applicationStreamSettingRequirement) => applicationStreamSettingRequirement.fps === applicationFramerate && !(applicationStreamSettingRequirement.quality != null || applicationStreamSettingRequirement.guildPremiumTier != null)) == null;
}
}
export function isPremiumRequirement(a0) {
return a0.quality != null || a0.guildPremiumTier != null;
}
export function getPremiumRequirement(a0, a1, a2) {
let env16826;
const r0 = env16826 = {};
env16826[0] = a0;
env16826[1] = a1;
env16826[2] = a2;
return ApplicationStreamSettingRequirements.find($mk81482(r0));
}
export function getResolutionText(a0) {
return a0.type === ResolutionTypes.SOURCE ? intl.string(t.XjXqzh) : intl.formatToPlainString(t.TEOC0I, {
resolution: a0.height
});
}
export function getFPSText(a0) {
return intl.formatToPlainString(t.Qb44XH, {
fps: a0
});
}
export function getMaxQuality(a0) {
return a0.maxResolution == null ? null : a0.maxFrameRate == null ? null : {
maxFrameRate: a0.maxFrameRate,
maxResolution: a0.maxResolution
};
}
export function useMaxQuality(a0) {
let stateFromStores;
const stateFromStoresObject = useStateFromStoresObject([ApplicationStreamingSettingsStore], () => ApplicationStreamingSettingsStore.getState());
stateFromStores = useStateFromStores([AuthenticationStore], () => AuthenticationStore.getId());
return useMemo(() => stateFromStores === a0.user.id ? {
maxFrameRate: stateFromStoresObject.fps,
maxResolution: {
height: stateFromStoresObject.resolution,
width: 0,
type: stateFromStoresObject.resolution === 0 ? ResolutionTypes.SOURCE : ResolutionTypes.FIXED
}
} : a0.maxResolution == null ? null : a0.maxFrameRate == null ? null : {
maxFrameRate: a0.maxFrameRate,
maxResolution: a0.maxResolution
}, [stateFromStores, a0, stateFromStoresObject]);
}
export function trackStreamSettingsUpdate(a0, a1, a2, a3) {
let env16830;
const r3 = env16830 = {};
env16830[0] = a0;
env16830[1] = a1;
env16830[2] = a2;
const r7 = ApplicationStreamSettingRequirements.find($mk81482(r3));
const currentUser = UserStore.getCurrentUser();
const guildId = RTCConnectionStore.getGuildId();
AnalyticsUtils.track(AnalyticEvents.STREAM_SETTINGS_UPDATE, {
user_premium_tier: currentUser?.premiumType,
guild_premium_tier: (guildId != null ? GuildStore.getGuild(guildId) : null)?.premiumTier,
stream_quality_user_premium_tier: r7?.quality != null ? StreamQualitiesToPremiumType[r7.quality] : null,
stream_quality_guild_premium_tier: r7?.guildPremiumTier,
stream_quality_preset: a0,
stream_quality_resolution: a1,
stream_quality_frame_rate: a2,
soundshare_enabled: a3
});
}
+11
View File
@@ -0,0 +1,11 @@
// Metro module 1856 (f1857).
import * as _Module1857 from "../_bundle/Module1857";
export function isNullOrEmpty(a0) {
return a0 == null || a0.length === 0;
}
export const upperCaseFirstChar = _Module1857.upperCaseFirstChar;
export const getAcronym = _Module1857.getAcronym;
export const cssValueToNumber = _Module1857.cssValueToNumber;
export const stripDiacritics = _Module1857.stripDiacritics;
export const truncateText = _Module1857.truncateText;
export const normalize = _Module1857.normalize;
+285
View File
@@ -0,0 +1,285 @@
// Metro module 4515 (f4516).
import LocaleStore from "../modules/user_settings/LocaleStore";
import { Endpoints, PaymentSettings } from "../Constants";
import Logger from "../modules/debug/Logger";
import { loadStripe } from "../_bundle/Module4516";
import { HTTP } from "../_bundle/sendRequest";
import { useStateFromStores } from "../_bundle/Module589";
let c2724_2, c2724_8, c2724_9, c2724_12;
const getStripe = function getStripe() {
return c2724_2 != null ? Promise.resolve(c2724_2) : loadStripe(PaymentSettings.STRIPE.KEY).then((result) => {
c2724_2 = result;
return result;
});
};
c2724_8 = new Logger("StripeUtils");
c2724_9 = {
REQUIRES_PAYMENT_METHOD: "requires_payment_method",
REQUIRES_CONFIRMATION: "requires_confirmation",
REQUIRES_ACTION: "requires_action",
PROCESSING: "processing",
CANCELED: "canceled",
SUCCEEDED: "succeeded"
};
c2724_12 = {
"en-US": "en",
"zh-CN": "zh",
"sv-SE": "sv"
};
export function validateExpiry(a0) {
let r14, r15;
try {
[r14, r15] = (function parseExpString(a0) {
const r10 = a0.split(/[.\-/\s]+/g);
let c25233_1 = r10;
if (r10.length !== 2) {
`You passed an invalid expiration date ${a0}Please pass a string containing a numeric month and year such as \`01-17\` or \`2015 / 05\``;
}
const r18 = r10.map((item) => {
const r10 = parseInt(item);
if (isNaN(r10)) {
let r15 = `${c25233_1} is not a number.`;
if (r15 == null) {
r15 = "";
}
`You passed an invalid expiration date ${a0}${r15}Please pass a string containing a numeric month and year such as \`01-17\` or \`2015 / 05\``;
}
if (r10 < 1) {
const r26 = `${r10} is less than one.`;
let r29 = r26;
if (r29 == null) {
r29 = "";
}
`You passed an invalid expiration date ${a0}${r29}Please pass a string containing a numeric month and year such as \`01-17\` or \`2015 / 05\``;
}
return r10;
});
const [r29, r30] = r18[0] > 12 ? [r18[1], r18[0]] : [r18[0], r18[1]];
if (r29 > 12) {
let r36 = `Month must be a number 1-12, not ${r29}.`;
if (r36 == null) {
r36 = "";
}
`You passed an invalid expiration date ${a0}${r36}Please pass a string containing a numeric month and year such as \`01-17\` or \`2015 / 05\``;
}
let r44 = r30;
if (r44 < 100) {
r44 = r30 + 2000;
}
return [r29, r44];
})(a0);
} catch ($e) {
return false;
}
const date = new Date(r15, r14);
const date2 = new Date();
date.setMonth(date.getMonth() - 1);
date.setMonth(date.getMonth() + 1, 1);
return date > date2;
}
export { getStripe };
export function getStripeClientMode() {
let r13;
if (PaymentSettings.STRIPE.KEY == null) {
c2724_8.warn("getStripeClientMode() called before PaymentSettings.STRIPE.KEY initialized: ", PaymentSettings.STRIPE.KEY);
r13 = "unknown";
} else {
const r12 = PaymentSettings.STRIPE.KEY.startsWith("pk_live");
r13 = "live";
if (!r12) {
const r17 = PaymentSettings.STRIPE.KEY.startsWith("pk_test");
let r18 = "test";
if (!r17) {
c2724_8.warn("Unexpected value for Stripe public key: ", PaymentSettings.STRIPE.KEY);
r18 = "unknown";
}
r13 = r18;
}
}
return r13;
}
export function parseStripePaymentMethod(a0) {
const billing_details = a0.billing_details;
let address = billing_details.address;
if (address == null) {
address = {};
}
let name = billing_details.name;
if (name == null) {
name = "";
}
let line1 = address.line1;
if (line1 == null) {
line1 = "";
}
let line2 = address.line2;
if (line2 == null) {
line2 = "";
}
let city = address.city;
if (city == null) {
city = "";
}
let state = address.state;
if (state == null) {
state = "";
}
let country = address.country;
if (country == null) {
country = "";
}
let postal_code = address.postal_code;
if (postal_code == null) {
postal_code = "";
}
return {
token: a0.id,
billingAddressInfo: {
name,
line1,
line2,
city,
state,
country,
postalCode: postal_code
}
};
}
export function parseBillingAddressInfoToStripeBillingDetails(a0) {
return {
name: a0.name,
address: {
line1: a0.line1,
line2: a0.line2,
city: a0.city,
state: a0.state,
postal_code: a0.postalCode,
country: a0.country
}
};
}
export async function authenticatePaymentIntentForPaymentId(c25232_0) {
let r130, r191, r220, r232;
let c25232_3;
let c25232_4 = 0;
let c29399_0, c29399_1, c29399_2, c29399_3, c29399_4, c29399_5, c29399_6;
L42: {
L41: {
L40: {
L39: {
L33: {
L32: {
try {
c29399_0 = void 0;
c29399_1 = void 0;
c29399_2 = void 0;
c29399_3 = void 0;
c29399_4 = void 0;
c29399_5 = void 0;
c29399_6 = void 0;
c25232_4 = 1;
c29399_0 = (await HTTP.get({
url: Endpoints.BILLING_STRIPE_PAYMENT_INTENTS(c25232_0),
oldFormErrors: true,
rejectWithError: false
})).body.stripe_payment_intent_client_secret;
c29399_1 = await (0, getStripe)();
if (c29399_1 == null) {
c25232_4 = 0;
break L42;
}
c29399_2 = await c29399_1.retrievePaymentIntent(c29399_0);
c29399_3 = c29399_2.error;
c29399_4 = c29399_2.paymentIntent;
if (c29399_3 != null) {
r130 = {
error: c29399_3.message
};
c25232_4 = 0;
break L41;
}
if (c29399_4 == null) {
c25232_4 = 0;
break L40;
}
c29399_5 = {};
if (c29399_4.status === c2724_9.REQUIRES_PAYMENT_METHOD && c29399_4.last_payment_error != null && c29399_4.last_payment_error.payment_method != null) {
c29399_5.payment_method = c29399_4.last_payment_error.payment_method.id;
}
const status = c29399_4.status;
if (c2724_9.REQUIRES_PAYMENT_METHOD !== status && c2724_9.REQUIRES_CONFIRMATION !== status && c2724_9.REQUIRES_ACTION !== status) {
if (c2724_9.SUCCEEDED !== status && c2724_9.PROCESSING !== status) {
c2724_9.CANCELED;
r191 = {
error: `Invalid Payment Intent status: ${c29399_4.status}`
};
c25232_4 = 0;
break L32;
}
c25232_4 = 0;
break L33;
}
c29399_6 = (await c29399_1.confirmCardPayment(c29399_0, c29399_5)).error;
r220 = c29399_6 != null ? {
error: c29399_6.message
} : {};
c25232_4 = 0;
break L39;
} catch ($e) {
const r37 = $e;
let r8 = r37;
c25232_3 = r37;
if (c25232_4 !== 0) {
while (true) {
try {
const r229 = c25232_3;
c25232_4 = 0;
r232 = {
error: r229.message
};
} catch (r227) {
r8 = r227;
c25232_3 = r227;
if (c25232_4 === 0) {
break;
}
continue;
}
return r232;
}
}
throw r8;
}
}
return r191;
}
return {};
}
return r220;
}
return {
error: "payment intent does not exist"
};
}
return r130;
}
return {
error: "unable to load stripe"
};
}
export function getStripeElementLocale(a0) {
let r4 = c2724_12[a0];
if (r4 == null) {
r4 = a0;
}
return r4;
}
export function useStripeLocale() {
return useStateFromStores([LocaleStore], () => {
let r5 = c2724_12[LocaleStore.locale];
if (r5 == null) {
r5 = LocaleStore.locale;
}
return r5;
});
}
+8
View File
@@ -0,0 +1,8 @@
// Metro module 11754 (f11755).
import { upperCaseFirstChar } from "./StringUtils";
export function getClass(a0, a1) {
const r16 = a0[`${a1}${Array.prototype.slice.call(arguments, 2).reduce((acc, item) => acc + upperCaseFirstChar(item), "")}`];
if (r16 != null) {
return r16;
}
}
+140
View File
@@ -0,0 +1,140 @@
// Metro module 8041 (f8042).
import { useEffect } from "react";
import SubscriptionPlanStore from "../stores/billing/SubscriptionPlanStore";
import { SubscriptionStatusTypes, SubscriptionTypes } from "../Constants";
import { SubscriptionPlanInfo, SubscriptionPlans } from "../modules/premium/PremiumConstants";
import Module38 from "../_bundle/Module38";
import { CheckoutError } from "../modules/checkout/CheckoutError";
import { castPremiumSubscriptionAsSkuId } from "./PremiumUtils";
import { fetchSubscriptionPlansForSKU } from "../actions/SubscriptionPlanActionCreators";
import { useStateFromStoresArray } from "../_bundle/Module589";
import { PauseDuration } from "../_bundle/Module8044";
import Module3771 from "../_bundle/Module3771";
let $mk79741 = function() {
return (a0) => {
const r7 = SubscriptionPlanStore.get(a0.planId);
Module38(r7 != null, "Unable to fetch plan");
return r7;
};
};
export function getSubscriptionPlans(a0) {
return a0.items.map($mk79741());
}
export function getSubscriptionSKUs(a0) {
return a0.items.map($mk79741()).map((item) => item.skuId);
}
export function subscriptionCanSwitchImmediately(a0, a1, a2) {
const currentSubscriptionPlanIdForGroup = a0.getCurrentSubscriptionPlanIdForGroup(a2);
if (a0.type === SubscriptionTypes.PREMIUM && currentSubscriptionPlanIdForGroup == null) {
return true;
}
const extraSentryInformation = {
oldPlanId: currentSubscriptionPlanIdForGroup,
newPlanId: a1
};
if (currentSubscriptionPlanIdForGroup == null) {
throw new CheckoutError({
message: "Current subscription has no plan in group",
extraSentryInformation
});
}
if (currentSubscriptionPlanIdForGroup === SubscriptionPlans.PREMIUM_YEAR_TIER_1 && a1 === SubscriptionPlans.PREMIUM_MONTH_TIER_2) {
throw new CheckoutError({
message: "Unexpected plan switch",
extraSentryInformation
});
}
return a2.indexOf(currentSubscriptionPlanIdForGroup) < a2.indexOf(a1);
}
export function subscriptionCanDowngrade(a0, a1, a2) {
let r14;
L8: {
const currentSubscriptionPlanIdForGroup = a0.getCurrentSubscriptionPlanIdForGroup(a2);
if (a0.type === SubscriptionTypes.PREMIUM) {
const r1 = currentSubscriptionPlanIdForGroup == null;
r14 = true;
if (r1) {
break L8;
}
}
const extraSentryInformation = {
oldPlanId: currentSubscriptionPlanIdForGroup,
newPlanId: a1
};
if (currentSubscriptionPlanIdForGroup == null) {
throw new CheckoutError({
message: "Current subscription has no plan in group",
extraSentryInformation
});
}
if (currentSubscriptionPlanIdForGroup === SubscriptionPlans.PREMIUM_YEAR_TIER_1 && a1 === SubscriptionPlans.PREMIUM_MONTH_TIER_2) {
throw new CheckoutError({
message: "Unexpected plan switch",
extraSentryInformation
});
}
r14 = a2.indexOf(currentSubscriptionPlanIdForGroup) < a2.indexOf(a1);
}
return !r14;
}
export function getOrFetchSubscriptionPlan(a0, a1) {
const r11 = SubscriptionPlanStore.get(a0);
if (r11 == null) {
const r5 = SubscriptionPlanInfo[a0];
Module38(r5 != null, `Missing hardcoded subscriptionPlan: ${a0}`);
const r25 = castPremiumSubscriptionAsSkuId(r5.skuId);
if (!SubscriptionPlanStore.isFetchingForSKU(r25)) {
fetchSubscriptionPlansForSKU(r25, a1);
}
}
return r11;
}
export function useGetOrFetchSubscriptionPlan(a0, a1) {
let c16210_2, c16210_3;
const [r17, r18] = useStateFromStoresArray([SubscriptionPlanStore], () => {
const r4 = a0 != null ? SubscriptionPlanStore.get(a0) : null;
return [r4, r4 != null && SubscriptionPlanStore.isFetchingForSKU(r4.skuId)];
});
c16210_2 = r17;
c16210_3 = r18;
useEffect(() => {
if (c16210_2 == null) {
if (a0 != null && !c16210_3) {
const r12 = SubscriptionPlanInfo[a0];
Module38(r12 != null, `Missing hardcoded subscriptionPlan: ${a0}`);
fetchSubscriptionPlansForSKU(castPremiumSubscriptionAsSkuId(r12.skuId), a1);
}
}
}, [r17, a0, a1, r18]);
return r17;
}
export function getSubscriptionPauseDurations(a0) {
const durations = Object.keys(PauseDuration).filter((item) => isNaN(Number(item)));
if (a0.status !== SubscriptionStatusTypes.PAUSED) {
return {
durations,
currentDaysPaused: 0
};
}
if (a0.pauseEndsAt == null) {
return {
durations: [],
currentDaysPaused: 0
};
}
const r11 = Module3771(a0.currentPeriodStart);
const currentDaysPaused = Math.round(Module3771(a0.pauseEndsAt).diff(r11, "days", true));
const durations2 = [];
for (const item of durations) {
if (PauseDuration[item] > currentDaysPaused) {
durations2.push(item);
}
}
return {
durations: durations2,
currentDaysPaused
};
}
export function didBeginPurchaseFlowOnFractionalPremium(a0) {
return a0 != null && Module3771.isMoment(a0) && a0.isSameOrAfter(Module3771());
}
+261
View File
@@ -0,0 +1,261 @@
// Metro module 7767 (f7768).
import MessageRecord from "../records/MessageRecord";
import AuthenticationStore from "../stores/AuthenticationStore";
import ChannelStore from "../stores/ChannelStore";
import GuildStore from "../stores/GuildStore";
import RelationshipStore from "../stores/RelationshipStore";
import UserStore from "../stores/UserStore";
import { MessageEmbedTypes, MessageTypes, NOOP } from "../Constants";
import { t, intl } from "../intl/index.native";
import SnowflakeUtils from "./SnowflakeUtils";
import { astToString } from "../_bundle/Module7768";
import { AutomodNotificationEmbedTypeKeys } from "../_bundle/Module7772";
import NicknameUtils from "./NicknameUtils";
import { computeChannelName } from "../modules/channel/useChannelName";
import { getRoleSubscriptionPurchaseSystemMessageContentMobile } from "../modules/guild_role_subscriptions/GuildRoleSubscriptionSystemMessageUtils";
import { getGuildProductPurchaseSystemMessageContentMobile } from "../modules/guild_products/GuildProductSystemMessageUtils";
import { getMessageAuthor } from "../modules/messages/useMessageAuthor";
import { createMessageRecord } from "../modules/messages/MessageRecordUtils";
import { getApplicationSubscriptionSystemMessageASTContent } from "../modules/premium_apps/ApplicationSubscriptionSystemMessageUtils";
import { getPrivateChannelIntegrationAddedSystemMessageASTContent, getPrivateChannelIntegrationRemovedSystemMessageASTContent } from "../modules/private_channel_integrations/PrivateChannelIntegrationSystemMessageUtils";
import { AutomodNotificationEmbedKeys } from "../_bundle/Module5772";
let c4891_13;
const getSystemMessageUserJoinMobile = function getSystemMessageUserJoinMobile(id) {
const r8 = [t.Jm6e0x, t.MGRnRT, t.EXOEGh, t["5uCTFN"], t.rl45Qo, t.Bh9zpQ, t.RdEy1J, t.qcdp00, t.F7w2Ru, t.gSyOgK, t.uYgqv7, t["b/1SBX"], t.LhebZF];
return r8[SnowflakeUtils.extractTimestamp(id) % r8.length];
};
c4891_13 = {
"234395307759108106": "https://groovy.bot/commands",
"365975655608745985": "https://www.pokecord.com/getting-started",
"512412940897484800": "http://jameslantz.net/smilebot"
};
const r34 = {
stringify: function stringify(a0, a1) {
let r31;
let mentions = a0.mentions;
if (mentions == null) {
mentions = [];
}
const [r30] = mentions;
const r3 = r30 == null;
let r14 = null;
if (!r3) {
if (typeof r30 === "object") {
let r36 = UserStore.getUser(r30.id);
if (r36 == null) {
r36 = null;
}
r31 = r36;
} else {
r31 = null;
if (typeof r30 === "string") {
let r32 = UserStore.getUser(r30);
if (r32 == null) {
r32 = null;
}
r31 = r32;
}
}
r14 = r31;
}
const channel_id = a0.channel_id;
const name = NicknameUtils.getName(null, channel_id, a0.author);
const type = a0.type;
if (MessageTypes.RECIPIENT_ADD === type) {
if (r14 == null) {
return void 0;
}
return astToString(intl.formatToParts(t["7/Xl0S"], {
username: name,
usernameOnClick: NOOP,
otherUsername: NicknameUtils.getName(null, channel_id, r14),
otherUsernameOnClick: NOOP
}));
}
if (MessageTypes.RECIPIENT_REMOVE === type) {
if (r14 == null) {
return void 0;
}
const author = a0.author;
return author != null && author.id !== r14.id ? astToString(intl.formatToParts(t.QtZ0RD, {
username: name,
usernameOnClick: NOOP,
otherUsername: NicknameUtils.getName(null, channel_id, r14),
otherUsernameOnClick: NOOP
})) : astToString(intl.formatToParts(t["Qn5+Lf"], {
username: name,
usernameOnClick: NOOP
}));
}
if (MessageTypes.CALL === type) {
const call = a0.call;
return call != null ? call.participants.indexOf(AuthenticationStore.getId()) === -1 ? astToString(intl.formatToParts(t.DbgSA0, {
username: name,
usernameOnClick: NOOP
})) : void 0 : void 0;
}
if (MessageTypes.CHANNEL_NAME_CHANGE === type) {
return astToString(intl.formatToParts(a1.isForumPost() ? t["qa0e/n"] : t.XCPMEG, {
username: name,
usernameOnClick: NOOP,
channelName: a0.content
}));
}
if (MessageTypes.CHANNEL_ICON_CHANGE === type) {
return astToString(intl.formatToParts(t.wypJZ0, {
username: name,
usernameOnClick: NOOP
}));
}
if (MessageTypes.CHANNEL_PINNED_MESSAGE === type) {
return astToString(intl.formatToParts(t["/M60j0"], {
username: name,
usernameOnClick: NOOP
}));
}
if (MessageTypes.USER_JOIN === type) {
return astToString(intl.formatToParts(getSystemMessageUserJoinMobile(a0.id), {
username: name,
usernameOnClick: NOOP
}));
}
if (MessageTypes.GUILD_BOOST === type) {
return astToString(intl.formatToParts(t.ihxM9x, {
username: name,
usernameOnClick: NOOP
}));
}
if (MessageTypes.GUILD_BOOST_TIER_1 !== type && MessageTypes.GUILD_BOOST_TIER_2 !== type && MessageTypes.GUILD_BOOST_TIER_3 !== type) {
if (MessageTypes.GUILD_INVITE_REMINDER === type) {
return intl.string(t.gxyKvr);
}
if (MessageTypes.THREAD_STARTER_MESSAGE === type) {
return intl.formatToPlainString(t["B8H+Cl"], {
username: name,
threadName: computeChannelName(a1, UserStore, RelationshipStore)
});
}
if (MessageTypes.ROLE_SUBSCRIPTION_PURCHASE === type) {
return a0 instanceof MessageRecord ? null : astToString(getRoleSubscriptionPurchaseSystemMessageContentMobile({
username: name,
guildId: a1.guild_id,
roleSubscriptionData: a0.role_subscription_data
}));
}
if (MessageTypes.PURCHASE_NOTIFICATION === type) {
const r272 = a0 instanceof MessageRecord;
let r273 = null;
if (!r272) {
const purchase_notification = a0.purchase_notification;
r273 = (purchase_notification == null ? void 0 : purchase_notification.guild_product_purchase?.product_name) == null ? null : astToString(getGuildProductPurchaseSystemMessageContentMobile({
username: name,
productName: a0.purchase_notification.guild_product_purchase.product_name
}));
}
return r273;
}
if (MessageTypes.GUILD_APPLICATION_PREMIUM_SUBSCRIPTION === type) {
if (a0 instanceof MessageRecord) {
return null;
}
return astToString(getApplicationSubscriptionSystemMessageASTContent({
application: a0.application,
username: getMessageAuthor(createMessageRecord(a0)).nick
}));
}
if (MessageTypes.PRIVATE_CHANNEL_INTEGRATION_ADDED === type) {
return a0 instanceof MessageRecord ? null : astToString(getPrivateChannelIntegrationAddedSystemMessageASTContent({
application: a0.application,
username: getMessageAuthor(createMessageRecord(a0)).nick
}));
}
if (MessageTypes.PRIVATE_CHANNEL_INTEGRATION_REMOVED === type) {
return a0 instanceof MessageRecord ? null : astToString(getPrivateChannelIntegrationRemovedSystemMessageASTContent({
application: a0.application,
username: getMessageAuthor(createMessageRecord(a0)).nick
}));
}
if (MessageTypes.AUTO_MODERATION_ACTION === type) {
const embeds = a0.embeds;
if (embeds == null ? void 0 : embeds.some((embed) => embed.type === MessageEmbedTypes.AUTO_MODERATION_NOTIFICATION)) {
const r132 = a0.embeds.find((embed) => embed.type === MessageEmbedTypes.AUTO_MODERATION_NOTIFICATION);
const r133 = r132 == null;
let r134 = void 0;
if (!r133) {
const fields = r132.fields;
r134 = fields == null ? void 0 : fields.find((field) => "name" in field && field.name === AutomodNotificationEmbedKeys.NOTIFICATION_TYPE);
}
const r140 = r134 != null ? "value" in r134 ? r134.value : void 0 : void 0;
const channel3 = ChannelStore.getChannel(channel_id);
const r146 = channel3 == null;
let r147 = null;
if (!r146) {
const guild3 = GuildStore.getGuild(channel3.getGuildId());
r147 = guild3 == null ? null : AutomodNotificationEmbedTypeKeys.ACTIVITY_ALERTS_ENABLED === r140 ? astToString(intl.formatToParts(t.wt3ZUM, {
guildName: guild3.name
})) : AutomodNotificationEmbedTypeKeys.INTERACTION_BLOCKED === r140 ? astToString(intl.formatToParts(t.AkqI0g, {
guildName: guild3.name
})) : astToString(intl.formatToParts(t["a+lJKl"], {
guildName: guild3.name
}));
}
return r147;
}
return a0.content;
}
if (MessageTypes.GUILD_INCIDENT_ALERT_MODE_ENABLED === type) {
const content = a0.content;
const channel2 = ChannelStore.getChannel(channel_id);
const r90 = channel2 == null;
let r91 = null;
if (!r90) {
const guild2 = GuildStore.getGuild(channel2.getGuildId());
r91 = guild2 == null ? null : astToString(intl.formatToParts(t.iOuWPk, {
username: name,
guildName: guild2.name,
time: content !== "" ? new Date(content).toLocaleString(intl.currentLocale, {
hour: "numeric",
minute: "2-digit"
}) : ""
}));
}
return r91;
}
if (MessageTypes.GUILD_INCIDENT_ALERT_MODE_DISABLED === type) {
const channel = ChannelStore.getChannel(channel_id);
const r68 = channel == null;
let r69 = null;
if (!r68) {
const guild = GuildStore.getGuild(channel.getGuildId());
r69 = guild == null ? null : astToString(intl.formatToParts(t.axmbpm, {
username: name,
guildName: guild.name
}));
}
return r69;
}
return a0.content;
}
const channel4 = ChannelStore.getChannel(channel_id);
return channel4 != null && GuildStore.getGuild(channel4.getGuildId()) != null ? astToString(intl.formatToParts(t.ihxM9x, {
username: name,
usernameOnClick: NOOP
})) : astToString(intl.formatToParts(t.ihxM9x, {
username: name,
usernameOnClick: NOOP
}));
},
getSystemMessageUserJoin: function getSystemMessageUserJoin(a0) {
const r8 = [t["0cuj7l"], t["MuW+CN"], t.osqpHX, t["5ToSh2"], t.JEB8ps, t.pkOV5T, t["kRb1J+"], t["EmKLY+"], t.rPtBnb, t["5B/ekS"], t.ESNC3Y, t.Iw6d8w, t["WecSZ/"]];
return r8[SnowflakeUtils.extractTimestamp(a0) % r8.length];
},
getSystemMessageUserJoinMobile,
getSystemMessageBotJoin: function getSystemMessageBotJoin(a0) {
return c4891_13[a0] != null ? intl.format(t.xw1Ij0, {
learnOnClick: {
onClick: () => window.open(c4891_13[a0])
}
}) : null;
}
};
export default r34;
Loaded 100 of 33051 files, more files were not shown because too many files have changed in this diff. Show more