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,110 @@
// Metro module 5189 (f5190).
import { createContext, useState, useMemo, useEffect, useContext } from "react";
import { AppContext } from "../../../Constants";
import { ComponentDispatcher } from "../../../utils/ComponentDispatchUtils";
import { getMainWindowId, getWindowId } from "../../../utils/web/WindowIdUtils";
import * as _Module1859 from "../../../_bundle/Module1859";
import { getCurrentlyInteractingWindowId } from "../../../utils/web/WindowInteractingUtils";
const componentDispatcher = new ComponentDispatcher();
const context = createContext({
appContext: AppContext.APP,
renderWindow: window,
windowDispatch: componentDispatcher,
windowId: getMainWindowId()
});
let c3133_6 = new Map();
export default context;
export { componentDispatcher as MainWindowDispatch };
export function getWindowDispatchForElement(a0) {
const defaultView = a0.ownerDocument.defaultView;
if (defaultView != null) {
return c3133_6.get(getWindowId(defaultView))?.windowDispatch;
}
}
export function getWindowDispatchForEvent(a0) {
const isElement = _Module1859.isElement(a0?.target);
let r12 = null;
if (isElement) {
const defaultView = a0.target.ownerDocument.defaultView;
let r17 = defaultView != null ? c3133_6.get(getWindowId(defaultView))?.windowDispatch : void 0;
if (r17 == null) {
r17 = null;
}
r12 = r17;
}
return r12;
}
export function getCurrentlyInteractingAppWindowContext() {
const currentlyInteractingWindowId = getCurrentlyInteractingWindowId();
const r1 = currentlyInteractingWindowId == null;
let r10 = null;
if (!r1) {
let r13 = c3133_6.get(currentlyInteractingWindowId);
if (r13 == null) {
r13 = null;
}
r10 = r13;
}
return r10;
}
export function getAppWindowContextValue(a0) {
return c3133_6.get(a0);
}
export function getCurrentlyInteractingAppContext() {
const currentlyInteractingWindowId = getCurrentlyInteractingWindowId();
const r10 = currentlyInteractingWindowId == null;
let r11 = null;
if (!r10) {
let r13 = c3133_6.get(currentlyInteractingWindowId);
if (r13 == null) {
r13 = null;
}
r11 = r13;
}
return r11 != null ? r11.appContext : null;
}
export function AppWindowContextProvider(props) {
let memo2;
const { appContext: appContext2, renderWindow: renderWindow2, children } = props;
const appContext = appContext2;
const renderWindow = renderWindow2;
memo2 = void 0;
const [state, setState] = useState(getWindowId(renderWindow));
const memo = useMemo(() => new ComponentDispatcher(), []);
memo2 = useMemo(() => ({
appContext,
renderWindow,
windowDispatch: memo,
windowId: state
}), [appContext, renderWindow, memo, state]);
useEffect(() => {
if (state == null) {
let c29472_0 = setInterval(() => {
const windowId = getWindowId(renderWindow);
if (windowId != null) {
setState(windowId);
clearInterval(c29472_0);
}
}, 10);
return () => clearInterval(c29472_0);
}
}, [renderWindow, state]);
useEffect(() => {
const handleUnload2 = function handleUnload() {
c3133_6.delete(state);
};
c3133_6.set(state, memo2);
renderWindow.addEventListener("unload", handleUnload2);
return () => renderWindow.removeEventListener("unload", handleUnload2);
}, [memo2, renderWindow, state]);
return <context.Provider value={memo2}>{children}</context.Provider>;
}
export function useAppContext() {
return useContext(context).appContext;
}
export function useWindowDispatch() {
return useContext(context).windowDispatch;
}
export function useRenderWindow() {
return useContext(context).renderWindow;
}