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

+6
View File
@@ -0,0 +1,6 @@
// Metro module 9407 (f9408).
import { useContext } from "react";
import { AnalyticsContext } from "../utils/AnalyticsUtils";
export function useAnalyticsContext() {
return useContext(AnalyticsContext);
}
+30
View File
@@ -0,0 +1,30 @@
// Metro module 6234 (f6235).
import { useCallback } from "react";
import { diffAsUnits } from "../utils/DateUtils";
import { useForceUpdate } from "../_bundle/Module6235";
import useInterval from "./useInterval";
export default function useCountdown(a0) {
let r7 = arguments[1];
if (r7 === void 0) {
r7 = 1000;
}
const r11 = arguments[2];
let c15602_1 = r11;
let r8 = arguments[3];
if (r8 === void 0) {
r8 = false;
}
let c15602_2 = r8;
const r18 = diffAsUnits(Date.now(), a0);
const forceUpdate = useForceUpdate();
useInterval(useCallback(() => {
const r15 = diffAsUnits(Date.now(), a0);
if (!(r15.days === 0 && r15.hours === 0 && r15.minutes === 0 && r15.seconds === 0 || c15602_2)) {
forceUpdate();
if (c15602_1 != null) {
c15602_1();
}
}
}, [a0, r8, forceUpdate, r11]), r8 ? null : r7);
return r18;
};
+14
View File
@@ -0,0 +1,14 @@
// Metro module 12476 (f12477).
import { useState, useEffect } from "react";
export default function useDebounce(a0, a1) {
const [state, setState] = useState(a0);
useEffect(() => {
let c27294_0 = setTimeout(() => {
setState(a0);
}, a1);
return () => {
clearTimeout(c27294_0);
};
}, [a0, a1]);
return state;
};
+9
View File
@@ -0,0 +1,9 @@
// Metro module 7981 (f7982).
import { useRef, useEffect, useCallback } from "react";
export default function useGetIsMounted() {
const ref = useRef(true);
useEffect(() => () => {
ref.current = false;
}, []);
return useCallback(() => ref.current, []);
};
+5
View File
@@ -0,0 +1,5 @@
// Metro module 5503 (f5504).
import { useState } from "react";
export default function useInitialValue(a0) {
return useState(a0)[0];
};
+24
View File
@@ -0,0 +1,24 @@
// Metro module 6240 (f6241).
import { useEffect, useRef } from "react";
import Module38 from "../_bundle/Module38";
export default function useInterval(a0, a1) {
const current = a0;
const ref = useRef(a0);
const ref2 = useRef(null);
useEffect(() => {
ref.current = current;
}, [a0]);
useEffect(() => {
if (a1 !== null) {
ref2.current = setInterval(function() {
Module38(ref.current != null, "Missing callback");
ref.current();
}, a1);
return () => clearInterval(ref2.current);
}
if (ref2.current !== null) {
clearInterval(ref2.current);
ref2.current = null;
}
}, [a1]);
};
+68
View File
@@ -0,0 +1,68 @@
// Metro module 10513 (f10514).
import SoundboardStore from "../modules/soundboard/SoundboardStore";
import SelectedChannelStore from "../stores/SelectedChannelStore";
import SpeakingStore from "../stores/SpeakingStore";
import VoiceStateStore from "../stores/VoiceStateStore";
import { useStateFromStores } from "../_bundle/Module589";
export default function useIsSpeaking(a0) {
let selfMute;
const { userId, checkSoundSharing = false } = a0;
let c18097_1 = checkSoundSharing;
let checkSoundboardSounds = a0.checkSoundboardSounds;
if (checkSoundboardSounds === void 0) {
checkSoundboardSounds = true;
}
let c18097_2 = checkSoundboardSounds;
let checkIsMuted = a0.checkIsMuted;
if (checkIsMuted === void 0) {
checkIsMuted = false;
}
const context = a0.context;
selfMute = void 0;
const stateFromStores = useStateFromStores([VoiceStateStore, SelectedChannelStore], () => {
const voiceChannelId = SelectedChannelStore.getVoiceChannelId();
return voiceChannelId != null ? VoiceStateStore.getVoiceStateForChannel(voiceChannelId, userId) : null;
});
if (checkIsMuted) {
checkIsMuted = stateFromStores?.mute || stateFromStores?.selfMute;
}
selfMute = checkIsMuted;
let r30 = useStateFromStores([SpeakingStore], () => SpeakingStore.isSpeaking(userId, context) && !selfMute);
const stateFromStores2 = useStateFromStores([SpeakingStore], () => SpeakingStore.isSoundSharing(userId) && c18097_1);
const stateFromStores3 = useStateFromStores([SoundboardStore], () => SoundboardStore.isUserPlayingSounds(userId) && c18097_2);
if (!r30) {
r30 = stateFromStores3;
}
if (!r30) {
r30 = stateFromStores2;
}
return r30;
};
export function getIsSpeaking(a0) {
const { userId: userId2, checkSoundSharing = false, checkSoundboardSounds = true } = a0;
let checkIsMuted = a0.checkIsMuted;
if (checkIsMuted === void 0) {
checkIsMuted = false;
}
const context2 = a0.context;
let r6 = arguments[1];
if (r6 === void 0) {
r6 = [VoiceStateStore, SelectedChannelStore, SpeakingStore, SoundboardStore];
}
const [r13, r39, r43, r47] = r6;
const voiceChannelId = r39.getVoiceChannelId();
const r55 = voiceChannelId != null ? r13.getVoiceStateForChannel(voiceChannelId, userId2) : null;
if (checkIsMuted) {
checkIsMuted = r55?.mute || r55?.selfMute;
}
let r62 = r43.isSpeaking(userId2, context2) && !checkIsMuted;
const r64 = r43.isSoundSharing(userId2) && checkSoundSharing;
const r66 = r47.isUserPlayingSounds(userId2) && checkSoundboardSounds;
if (!r62) {
r62 = r66;
}
if (!r62) {
r62 = r64;
}
return r62;
}
+20
View File
@@ -0,0 +1,20 @@
// Metro module 10671 (f10672).
import { useRef, useState, useEffect } from "react";
export const useLeadingEdgeDebounce = (a0, a1) => {
const ref = useRef(true);
const [state, setState] = useState(a0);
useEffect(() => {
let c26788_0 = setTimeout(() => {
setState(a0);
ref.current = true;
}, a1);
if (ref.current) {
setState(a0);
}
ref.current = false;
return () => {
clearTimeout(c26788_0);
};
}, [a0, a1]);
return state;
};
+23
View File
@@ -0,0 +1,23 @@
// Metro module 10729 (f10730).
import { useState, useCallback } from "react";
import { Storage } from "../_bundle/Module595";
import useMountEffect from "./useMountEffect";
export function useLocalStorageState(a0, c18234_1) {
let c18234_0 = a0;
const [state, setState] = useState(() => {
let r10 = Storage.get(c18234_0);
if (r10 == null) {
r10 = c18234_1;
}
return r10;
});
useMountEffect(() => {
if (Storage.get(c18234_0) == null) {
Storage.set(c18234_0, c18234_1);
}
});
return [state, useCallback((a0) => {
setState(a0);
Storage.set(c18234_0, a0);
}, [a0])];
}
+6
View File
@@ -0,0 +1,6 @@
// Metro module 4616 (f4617).
import * as _useMountEffect from "../_bundle/useMountEffect";
import useMountEffect from "../_bundle/useMountEffect";
export default useMountEffect;
export const useMountLayoutEffect = _useMountEffect.useMountLayoutEffect;
export const useUnmountEffect = _useMountEffect.useUnmountEffect;
+11
View File
@@ -0,0 +1,11 @@
// Metro module 8332 (f8333).
import { useRef } from "react";
export default function usePrevValue(a0) {
const ref = useRef(null);
const ref2 = useRef(null);
if (!Object.is(a0, ref2.current)) {
ref.current = ref2.current;
ref2.current = a0;
}
return ref.current;
};
+19
View File
@@ -0,0 +1,19 @@
// Metro module 8125 (f8126).
import { useEffect, useRef } from "react";
export default function usePrevious(a0) {
const current = a0;
const ref = useRef(null);
useEffect(() => {
ref.current = current;
}, [a0]);
return ref.current;
};
export function usePreviousWhen({ value, shouldUpdate }) {
const ref2 = useRef(null);
useEffect(() => {
if (shouldUpdate) {
ref2.current = value;
}
}, [value, shouldUpdate]);
return ref2.current;
}
+4
View File
@@ -0,0 +1,4 @@
// Metro module 5178 (f5179).
export default function useRefValue(a0) {
return a0.current;
};
+72
View File
@@ -0,0 +1,72 @@
// Metro module 11377 (f11378).
import { useState, useCallback } from "react";
import { intl, t } from "../intl/index.native";
import APIError from "../errors/APIError";
export default function useRequest(a0) {
const [loading, setState] = useState(false);
const [error, setState2] = useState(null);
return [useCallback(async function(...c27045_0) {
let r71;
let c27045_3;
let c27045_4 = 0;
let c30397_0, c30397_1;
try {
c30397_0 = c27045_0;
await void 0;
c27045_4 = 2;
(0, setState2)(null);
(0, setState)(true);
r71 = await a0.apply(void 0, [...c30397_0]);
c27045_4 = 0;
(0, setState)(false);
} catch ($e) {
const r32 = $e;
let r7 = r32;
c27045_3 = r32;
let r33 = c27045_4;
if (r33 !== 0) {
while (true) {
if (r33 !== 1) {
try {
const r95 = c27045_3;
c27045_4 = 1;
c30397_1 = r95;
if (c30397_1.message !== intl.string(t.N2yb9a)) {
setState2(c30397_1 instanceof APIError ? c30397_1 : new APIError(c30397_1));
}
c27045_4 = 0;
(0, setState)(false);
} catch (r92) {
r7 = r92;
c27045_3 = r92;
r33 = c27045_4;
if (r33 === 0) {
break;
}
continue;
}
return void 0;
}
try {
const r140 = c27045_3;
c27045_4 = 0;
(0, setState)(false);
throw r140;
} catch (r138) {
r7 = r138;
c27045_3 = r138;
r33 = c27045_4;
if (r33 === 0) {
break;
}
}
}
}
throw r7;
}
return r71;
}, [a0]), {
loading,
error
}];
};
+18
View File
@@ -0,0 +1,18 @@
// Metro module 12590 (f12591).
import { useCallback, useEffect, useState } from "react";
import useInitialValue from "./useInitialValue";
import { Timeout } from "../_bundle/Timeout";
export default function useResettingValue(a0, a1) {
let c19914_3;
let c19914_0 = a0;
const [state, setState] = useState(a0);
const initialValue = useInitialValue(() => new Timeout());
c19914_3 = initialValue;
useEffect(() => () => c19914_3.stop(), [initialValue]);
return [state, useCallback((a0) => {
setState(a0);
if (a0 !== c19914_0) {
c19914_3.start(a1, () => setState(c19914_0));
}
}, [a1, a0, initialValue])];
};
+3
View File
@@ -0,0 +1,3 @@
// Metro module 8255 (f8256).
import useStableCallback from "../_bundle/useStableCallback";
export default useStableCallback;
+19
View File
@@ -0,0 +1,19 @@
// Metro module 4125 (f4126).
import { ThemeTypes } from "../Constants";
import { useThemeContext } from "../design/shared";
export function useTheme() {
return useThemeContext().theme;
}
export default useTheme;
export function useThemeIndex() {
const theme = useThemeContext().theme;
return ThemeTypes.DARK !== theme ? ThemeTypes.LIGHT === theme ? 1 : void 0 : 0;
}
export function getThemeIndex(a0) {
if (ThemeTypes.DARK === a0) {
return 0;
}
if (ThemeTypes.LIGHT === a0) {
return 1;
}
}
+78
View File
@@ -0,0 +1,78 @@
// Metro module 10863 (f10864).
import { useRef, useEffect } from "react";
import { throttle } from "../_bundle/Module12";
function $mk85665($env) {
return () => {
const r1 = $env;
const r3 = r1[3];
const r2 = $env.$parent;
r3.current = (0, r2[0])(r2[1][1]).throttle(r1[0], r1[1], r1[2]);
return $mk107494(r1);
};
}
function $mk107494($env) {
return () => {
const current2 = $env[3].current;
if (current2 != null) {
current2.cancel();
}
};
}
let useThrottledFunction;
let env7301 = {};
const throttleStateFn = function throttleStateFn(a0) {
return a0;
};
useThrottledFunction = function useThrottledFunction(a0, a1) {
let env18319;
const r3 = env18319 = {
$parent: env7301
};
env18319[0] = a0;
env18319[1] = a1;
let r7 = arguments[2];
if (r7 === void 0) {
r7 = [];
}
const r8 = arguments[3];
env18319[2] = r8;
env18319[3] = void 0;
const ref2 = useRef(throttle(a0, a1, r8));
env18319[3] = ref2;
const r21 = [a0, a1, r8, ...r7];
useEffect($mk85665(r3), r21);
return ref2.current;
};
export const useThrottledState = function(a0, a1) {
let r2 = a0;
let r10 = arguments[2];
if (r10 === void 0) {
r10 = [];
}
let env18321;
const r6 = env18321 = {
$parent: env7301
};
env18321[0] = throttleStateFn;
env18321[1] = a1;
if (r10 === void 0) {
r10 = [];
}
const r11 = arguments[3];
env18321[2] = r11;
env18321[3] = void 0;
const ref2 = useRef(throttle(throttleStateFn, a1, r11));
env18321[3] = ref2;
const r25 = [throttleStateFn, a1, r11, ...r10];
useEffect($mk85665(r6), r25);
const current = ref2.current;
const ref = useRef(a0);
useEffect(() => {
ref.current = current(a0);
}, [a0, current]);
if (a1 !== 0) {
r2 = ref.current;
}
return r2;
};
export { useThrottledFunction };
+15
View File
@@ -0,0 +1,15 @@
// Metro module 6667 (f6668).
import { useEffect, useRef } from "react";
export default function useTimeout(a0, a1) {
const current = a0;
const ref = useRef(a0);
useEffect(() => {
ref.current = current;
}, [a0]);
useEffect(() => {
if (a1 !== null) {
let c25945_0 = setTimeout(() => ref.current(), a1);
return () => clearTimeout(c25945_0);
}
}, [a1, ref]);
};
+23
View File
@@ -0,0 +1,23 @@
// Metro module 12617 (f12618).
import useInitialValue from "./useInitialValue";
import { useUnmountEffect } from "./useMountEffect";
export default function useUnmountAbortSignal() {
let c19934_0;
const initialValue = useInitialValue(() => new AbortController());
c19934_0 = initialValue;
useUnmountEffect(() => {
c19934_0.abort();
});
return initialValue.signal;
};
export function useUnmountAbortSignalWithDelay(c19935_0) {
let c19935_1;
const initialValue = useInitialValue(() => new AbortController());
c19935_1 = initialValue;
useUnmountEffect(() => {
setTimeout(() => {
c19935_1.abort();
}, c19935_0);
});
return initialValue.signal;
}