decord/beta/source/modules/frames/FramesActionCreators.shared.tsx

442 lines
16 KiB
TypeScript
Raw Permalink Normal View History

2026-10-12 16:32:48 +00:00
// Module ID: 10806
// Function ID: 10807
2026-10-01 14:13:23 +00:00
// Name: launchFrame
2026-10-12 16:32:48 +00:00
// Dependencies: [5, 10807, 10802, 6067, 10811, 584, 10813, 10810, 10814, 10820, 10821, 2]
// Exports: attachFrameHostWindow, attachFrameIframe, detachFrameHostWindow, detachFrameIframe, launchFrame, refreshProxyTicket, resetFrameLayoutModes, setFramePrefersPictureInPictureOnNavigateAway, updateFramePanelMode
2026-10-12 16:32:48 +00:00
// Module 10806 (launchFrame)
2026-10-07 22:43:51 +00:00
import DispatcherDefault from "Dispatcher" /* 584 */;
2026-10-12 16:32:48 +00:00
import ActivityPanelConstants from "ActivityPanelConstants" /* 6067 */;
import getChannelIdForEmbeddedSurfaceDefault from "getChannelIdForEmbeddedSurface" /* 10810 */;
import leaveCurrentEmbeddedActivity from "leaveCurrentEmbeddedActivity" /* 10811 */;
import createProxyTicket from "createProxyTicket" /* 10813 */;
import leaveFrame from "leaveFrame" /* 10821 */;
2026-10-01 14:13:23 +00:00
import _asyncToGenerator from "_asyncToGenerator" /* 5 */;
2026-10-12 16:32:48 +00:00
import FramesStore from "FramesStore" /* 10807 */;
import FramesConstants from "FramesConstants" /* 10802 */;
2026-10-01 14:13:23 +00:00
import size from "module_2" /* 2 */;
2026-10-12 16:32:48 +00:00
let analyticsContext, dispatchResult1, error, hostWindowKey, intent, launch, launchRequestId, message, proxyTicket, type;
2026-10-01 14:13:23 +00:00
let hasOwnProperty;
let metroImportAll;
let metroImportDefault;
let metroRequire;
let obj = function _launchFrame() {
obj = _asyncToGenerator(async (applicationId) => {
let c6 = 0;
2026-10-12 16:32:48 +00:00
let c7 = 0;
let c5 = 0;
2026-10-01 14:13:23 +00:00
const iter = (async (arg0, value) => {
let c0;
let c1;
let c2;
let c3;
let c4;
let obj11;
let obj6;
2026-10-12 16:32:48 +00:00
let showErrorModal;
let sum;
if (c7 === 2) {
c7 = 3;
2026-10-01 14:13:23 +00:00
throw new TypeError("Generator functions may not be called on executing generators");
} else if (tmp3 === 3) {
if (arg0 === 1) {
throw value;
} else if (arg0 === 2) {
2026-10-01 14:13:23 +00:00
return { value, done: true };
} else {
2026-10-02 13:37:24 +00:00
return { value: "IconComponent", done: null };
}
2026-10-01 14:13:23 +00:00
} else {
try {
2026-10-12 16:32:48 +00:00
let frameId;
c7 = 2;
if (0 === c6) {
2026-10-01 14:13:23 +00:00
if (arg0 === 1) {
2026-10-12 16:32:48 +00:00
c7 = 3;
2026-10-01 14:13:23 +00:00
throw value;
} else if (arg0 === 2) {
2026-10-12 16:32:48 +00:00
c7 = 3;
2026-10-01 14:13:23 +00:00
return { value, done: true };
} else {
2026-10-12 16:32:48 +00:00
let closure_3 = tmp;
let closure_2 = tmp4;
2026-10-01 14:13:23 +00:00
applicationId = undefined;
2026-10-12 16:32:48 +00:00
type = undefined;
launch = undefined;
2026-10-01 14:13:23 +00:00
analyticsContext = undefined;
2026-10-12 16:32:48 +00:00
hostWindowKey = undefined;
showErrorModal = undefined;
({ applicationId: c0, surface: c1, launch: c2, analyticsContext: c3, hostWindowKey: c4, showErrorModal } = closure_0);
if (showErrorModal === undefined) {
showErrorModal = true;
}
frameId = undefined;
2026-10-01 14:13:23 +00:00
intent = undefined;
2026-10-12 16:32:48 +00:00
launchRequestId = undefined;
2026-10-01 14:13:23 +00:00
proxyTicket = undefined;
message = undefined;
c6 = 1;
2026-10-12 16:32:48 +00:00
c7 = 1;
return { value: "Set", done: true };
}
2026-10-12 16:32:48 +00:00
} else if (1 === c6) {
2026-10-01 14:13:23 +00:00
if (arg0 === 1) {
2026-10-12 16:32:48 +00:00
c7 = 3;
2026-10-01 14:13:23 +00:00
throw value;
} else if (arg0 === 2) {
2026-10-12 16:32:48 +00:00
c7 = 3;
2026-10-01 14:13:23 +00:00
return { value, done: true };
} else {
2026-10-12 16:32:48 +00:00
frameId = closure_131_8(applicationId, type);
intent = frame.getFrame(frameId);
2026-10-01 14:13:23 +00:00
if (null != intent) {
2026-10-12 16:32:48 +00:00
if (intent.intent === constants.MAIN) {
closure_131_14(frameId);
const obj7 = { frameId, layoutMode: constants2.FOCUSED };
closure_131_15(obj7);
2026-10-01 14:13:23 +00:00
}
2026-10-12 16:32:48 +00:00
c7 = 3;
return { value: frameId, done: true };
2026-10-01 14:13:23 +00:00
} else {
2026-10-12 16:32:48 +00:00
if (closure_131_7(type) === constants.MAIN) {
const obj8 = closure_131_0(closure_131_2[4]);
2026-10-01 14:13:23 +00:00
const result = obj8.leaveCurrentEmbeddedActivity();
2026-10-12 16:32:48 +00:00
closure_131_12();
2026-10-01 14:13:23 +00:00
}
2026-10-12 16:32:48 +00:00
sum = sum + 1;
launchRequestId = sum;
const obj12 = { type: "FRAME_LAUNCH_START", applicationId, frameId, surface: type, hostWindowKey, launch, launchRequestId };
const obj9 = closure_131_1(closure_131_2[5]);
2026-10-01 14:13:23 +00:00
obj9.dispatch(obj12);
2026-10-12 16:32:48 +00:00
c5 = 1;
c6 = 3;
c7 = 1;
const obj13 = { value: obj11.createProxyTicket(applicationId, closure_131_1(closure_131_2[7])(type), type.type), done: false };
obj11 = closure_131_0(closure_131_2[6]);
2026-10-01 14:13:23 +00:00
return obj13;
}
}
2026-10-12 16:32:48 +00:00
} else {
if (2 === c6) {
c5 = 0;
error = closure_4;
const tmp19 = showErrorModal;
if (tmp19) {
c6 = 4;
c7 = 1;
const obj14 = { value: obj6.getActivityLaunchErrorInfo(error, applicationId), done: false };
obj6 = closure_131_0(closure_131_2[8]);
return obj14;
}
} else if (3 === c6) {
if (arg0 === 1) {
c7 = 3;
throw value;
} else if (arg0 === 2) {
c5 = 0;
c7 = 3;
return { value, done: true };
} else {
proxyTicket = value;
const obj16 = { type: "FRAME_LAUNCH", applicationId, frameId, surface: type, proxyTicket, analyticsContext, launch: type, hostWindowKey, launchRequestId };
type = launch;
const dispatch = closure_131_1(closure_131_2[5]).dispatch;
closure_131_1(closure_131_2[5]);
if (launch == null) {
type = {};
}
dispatch(obj16);
c5 = 0;
c7 = 3;
return { value: frameId, done: true };
}
} else if (arg0 === 1) {
c7 = 3;
2026-10-01 14:13:23 +00:00
throw value;
} else if (arg0 === 2) {
2026-10-12 16:32:48 +00:00
c7 = 3;
2026-10-01 14:13:23 +00:00
return { value, done: true };
} else {
message = value;
2026-10-12 16:32:48 +00:00
closure_131_1(closure_131_2[9])(message.message);
2026-10-01 14:13:23 +00:00
}
2026-10-12 16:32:48 +00:00
const obj18 = { type: "FRAME_LAUNCH_FAIL", applicationId, frameId, launchRequestId, error, analyticsContext };
const obj4 = closure_131_1(closure_131_2[5]);
obj4.dispatch(obj18);
throw error;
2026-10-01 14:13:23 +00:00
}
2026-10-12 16:32:48 +00:00
} catch (tmp78) {
closure_4 = tmp78;
if (0 === c5) {
c7 = 3;
throw tmp78;
2026-10-01 14:13:23 +00:00
} else {
2026-10-12 16:32:48 +00:00
c6 = 2;
}
}
}
2026-10-01 14:13:23 +00:00
})();
iter.next();
return iter;
});
return obj(...arguments);
};
function clearMainFrameSlot() {
const mainFrame = FramesStore.getMainFrame();
if (null != mainFrame) {
2026-10-01 14:13:23 +00:00
if (mainFrame.intent === hasOwnProperty.MAIN) {
2026-10-12 16:32:48 +00:00
obj = leaveFrame;
2026-10-01 14:13:23 +00:00
obj.leaveFrame(mainFrame.id);
} else {
demoteMainFrame(mainFrame.id);
}
}
}
function demoteMainFrame(id) {
const mainFrame = FramesStore.getMainFrame();
id = undefined;
2026-10-01 14:13:23 +00:00
obj = FramesStore;
if (mainFrame != null) {
id = mainFrame.id;
}
if (id === id) {
2026-10-01 14:13:23 +00:00
const FOCUSED = metroRequire.FOCUSED;
const frame = obj.getFrame(id);
if (null != frame) {
2026-10-01 14:13:23 +00:00
const obj3 = { type: "FRAME_UPDATE_LAYOUT_MODE", applicationId: frame.applicationId, frameId: id, layoutMode: FOCUSED };
const obj2 = DispatcherDefault;
obj2.dispatch(obj3);
}
2026-10-01 14:13:23 +00:00
const PANEL = ActivityPanelModes.PANEL;
const obj5 = { type: "FRAME_SET_PANEL_MODE", frameId: id, activityPanelMode: PANEL };
const obj4 = DispatcherDefault;
obj4.dispatch(obj5);
const obj7 = { type: "FRAME_CLEAR_MAIN_SLOT", frameId: id };
2026-10-01 14:13:23 +00:00
const obj6 = DispatcherDefault;
obj6.dispatch(obj7);
}
}
function promoteFrame(frameId) {
let tmp = null != FramesStore.getFrame(frameId);
if (tmp) {
const mainFrame = obj.getMainFrame();
let id;
if (mainFrame != null) {
id = mainFrame.id;
}
tmp = id !== frameId;
}
if (tmp) {
2026-10-01 14:13:23 +00:00
const obj2 = leaveCurrentEmbeddedActivity;
const result = obj2.leaveCurrentEmbeddedActivity();
const mainFrame1 = obj.getMainFrame();
2026-10-12 16:32:48 +00:00
const tmp4 = require;
2026-10-01 14:13:23 +00:00
if (null != mainFrame1) {
if (mainFrame1.intent === hasOwnProperty.MAIN) {
2026-10-12 16:32:48 +00:00
const tmp4Result = tmp4(10821);
tmp4Result.leaveFrame(mainFrame1.id);
2026-10-01 14:13:23 +00:00
} else {
demoteMainFrame(mainFrame1.id);
}
}
2026-10-12 16:32:48 +00:00
const obj3 = { type: "FRAME_PROMOTE", frameId };
2026-10-01 14:13:23 +00:00
const obj4 = DispatcherDefault;
2026-10-12 16:32:48 +00:00
obj4.dispatch(obj3);
}
}
function updateFrameLayoutMode(frameId) {
frameId = frameId.frameId;
2026-10-01 14:13:23 +00:00
const layoutMode = frameId.layoutMode;
const frame = FramesStore.getFrame(frameId);
if (null != frame) {
2026-10-01 14:13:23 +00:00
const obj2 = { type: "FRAME_UPDATE_LAYOUT_MODE", applicationId: frame.applicationId, frameId, layoutMode };
obj = DispatcherDefault;
obj.dispatch(obj2);
}
}
2026-10-01 14:13:23 +00:00
obj = function _refreshProxyTicket() {
obj = _asyncToGenerator(async (frameId) => {
let c5 = 0;
let c6 = 0;
let c4 = 0;
return (async (arg0, value) => {
let obj22;
if (c6 === 2) {
c6 = 3;
throw new TypeError("Generator functions may not be called on executing generators");
} else if (tmp3 === 3) {
if (arg0 === 1) {
throw value;
} else if (arg0 === 2) {
2026-10-01 14:13:23 +00:00
return { value, done: true };
} else {
2026-10-02 13:37:24 +00:00
return { value: "IconComponent", done: null };
2026-10-01 14:13:23 +00:00
}
} else {
try {
let applicationId;
c6 = 2;
if (0 === c5) {
if (arg0 === 1) {
c6 = 3;
throw value;
} else if (arg0 === 2) {
c6 = 3;
return { value, done: true };
} else {
applicationId = undefined;
proxyTicket = undefined;
message = undefined;
frame = frame.getFrame(frameId);
const tmp71 = frameId;
if (null == frame) {
c6 = 3;
return { value: false, done: true };
} else {
applicationId = frame.applicationId;
const surface = frame.surface;
const obj5 = { type: "FRAME_SET_PROXY_TICKET_REFRESHING", applicationId, frameId: tmp71, refreshing: true };
const obj20 = DispatcherDefault;
obj20.dispatch(obj5);
c4 = 2;
c5 = 4;
c6 = 1;
2026-10-12 16:32:48 +00:00
const obj6 = { value: obj22.createProxyTicket(applicationId, getChannelIdForEmbeddedSurfaceDefault(surface), surface.type), done: false };
obj22 = createProxyTicket;
return obj6;
2026-10-01 14:13:23 +00:00
}
}
} else if (1 === c5) {
c4 = 0;
const obj8 = { type: "FRAME_SET_PROXY_TICKET_REFRESHING", applicationId, frameId, refreshing: false };
2026-10-12 16:32:48 +00:00
const obj9 = closure_130_1(closure_130_2[5]);
dispatchResult1 = obj9.dispatch(obj8);
throw message;
2026-10-01 14:13:23 +00:00
} else if (2 === c5) {
c4 = 1;
2026-10-12 16:32:48 +00:00
let closure_4 = message;
const obj7 = closure_130_0(closure_130_2[8]);
dispatchResult1 = obj7.getActivityLaunchErrorInfo(closure_4, applicationId);
2026-10-01 14:13:23 +00:00
c5 = 3;
c6 = 1;
return { value: dispatchResult1, done: false };
} else if (3 === c5) {
if (arg0 === 1) {
c6 = 3;
throw value;
} else if (arg0 === 2) {
c4 = 0;
2026-10-12 16:32:48 +00:00
const obj11 = { type: "FRAME_SET_PROXY_TICKET_REFRESHING", applicationId, frameId, refreshing: false };
const obj4 = closure_130_1(closure_130_2[5]);
obj4.dispatch(obj11);
2026-10-01 14:13:23 +00:00
c6 = 3;
return { value, done: true };
} else {
message = value;
2026-10-12 16:32:48 +00:00
closure_130_1(closure_130_2[9])(message.message);
2026-10-01 14:13:23 +00:00
c4 = 0;
2026-10-12 16:32:48 +00:00
const obj13 = { type: "FRAME_SET_PROXY_TICKET_REFRESHING", applicationId, frameId, refreshing: false };
const obj18 = closure_130_1(closure_130_2[5]);
obj18.dispatch(obj13);
2026-10-01 14:13:23 +00:00
c6 = 3;
return { value: false, done: true };
}
} else if (arg0 === 1) {
c6 = 3;
throw value;
} else if (arg0 === 2) {
c4 = 0;
const obj15 = { type: "FRAME_SET_PROXY_TICKET_REFRESHING", applicationId, frameId, refreshing: false };
obj = closure_130_1(closure_130_2[5]);
obj.dispatch(obj15);
c6 = 3;
2026-10-01 14:13:23 +00:00
return { value, done: true };
} else {
2026-10-01 14:13:23 +00:00
proxyTicket = value;
const obj19 = { type: "FRAME_UPDATE_PROXY_TICKET", applicationId, frameId, proxyTicket };
2026-10-12 16:32:48 +00:00
const obj14 = closure_130_1(closure_130_2[5]);
obj14.dispatch(obj19);
2026-10-01 14:13:23 +00:00
c4 = 0;
const obj21 = { type: "FRAME_SET_PROXY_TICKET_REFRESHING", applicationId, frameId, refreshing: false };
2026-10-12 16:32:48 +00:00
const obj16 = closure_130_1(closure_130_2[5]);
obj16.dispatch(obj21);
2026-10-01 14:13:23 +00:00
c6 = 3;
return { value: true, done: true };
}
2026-10-12 16:32:48 +00:00
} catch (tmp36) {
message = tmp36;
2026-10-01 14:13:23 +00:00
if (0 === c4) {
c6 = 3;
2026-10-12 16:32:48 +00:00
throw tmp36;
} else if (1 === tmp38) {
2026-10-01 14:13:23 +00:00
c5 = 1;
} else {
c5 = 2;
}
}
}
2026-10-01 14:13:23 +00:00
})();
});
return obj(...arguments);
};
2026-10-12 16:32:48 +00:00
({ FrameIntent: hasOwnProperty, FrameLayoutModes: metroRequire, getFrameIntentForSurface: metroImportDefault, makeFrameId: metroImportAll } = FramesConstants);
2026-10-01 14:13:23 +00:00
const ActivityPanelModes = ActivityPanelConstants.ActivityPanelModes;
2026-10-12 16:32:48 +00:00
let c10 = 0;
let result = size.fileFinishedImporting("modules/frames/FramesActionCreators.shared.tsx");
export const launchFrame = function launchFrame() {
2026-10-01 14:13:23 +00:00
return obj(...arguments);
};
export { clearMainFrameSlot };
export { demoteMainFrame };
export { promoteFrame };
export { updateFrameLayoutMode };
export const setFramePrefersPictureInPictureOnNavigateAway = function setFramePrefersPictureInPictureOnNavigateAway(frameId, enabled) {
2026-10-01 14:13:23 +00:00
obj = DispatcherDefault;
const obj2 = { type: "FRAME_SET_PREFERS_PICTURE_IN_PICTURE_ON_NAVIGATE_AWAY", frameId, enabled };
obj.dispatch(obj2);
};
export const updateFramePanelMode = function updateFramePanelMode(id, PIP) {
2026-10-01 14:13:23 +00:00
obj = DispatcherDefault;
const obj2 = { type: "FRAME_SET_PANEL_MODE", frameId: id, activityPanelMode: PIP };
obj.dispatch(obj2);
};
export const resetFrameLayoutModes = function resetFrameLayoutModes(frameId) {
2026-10-01 14:13:23 +00:00
const FOCUSED = metroRequire.FOCUSED;
const frame = FramesStore.getFrame(frameId);
if (null != frame) {
2026-10-01 14:13:23 +00:00
const obj2 = { type: "FRAME_UPDATE_LAYOUT_MODE", applicationId: frame.applicationId, frameId, layoutMode: FOCUSED };
obj = DispatcherDefault;
obj.dispatch(obj2);
}
2026-10-01 14:13:23 +00:00
const PANEL = ActivityPanelModes.PANEL;
const obj3 = DispatcherDefault;
const obj4 = { type: "FRAME_SET_PANEL_MODE", frameId, activityPanelMode: PANEL };
obj3.dispatch(obj4);
};
2026-10-07 22:43:51 +00:00
export const attachFrameIframe = function attachFrameIframe(id, first1) {
2026-10-01 14:13:23 +00:00
obj = DispatcherDefault;
2026-10-07 22:43:51 +00:00
const obj2 = { type: "FRAME_IFRAME_MOUNT", frameId: id, iframeId: first1 };
2026-10-01 14:13:23 +00:00
obj.dispatch(obj2);
};
export const detachFrameIframe = function detachFrameIframe(frameId, iframeId) {
2026-10-01 14:13:23 +00:00
obj = DispatcherDefault;
const obj2 = { type: "FRAME_IFRAME_UNMOUNT", frameId, iframeId };
obj.dispatch(obj2);
};
export const attachFrameHostWindow = function attachFrameHostWindow(frameId, windowKey) {
2026-10-01 14:13:23 +00:00
obj = DispatcherDefault;
const obj2 = { type: "FRAME_HOST_WINDOW_MOUNT", frameId, windowKey };
obj.dispatch(obj2);
};
export const detachFrameHostWindow = function detachFrameHostWindow(frameId, windowKey) {
2026-10-01 14:13:23 +00:00
obj = DispatcherDefault;
const obj2 = { type: "FRAME_HOST_WINDOW_UNMOUNT", frameId, windowKey };
obj.dispatch(obj2);
};
export const refreshProxyTicket = function refreshProxyTicket() {
2026-10-01 14:13:23 +00:00
return obj(...arguments);
};