// Module ID: 8744 // Function ID: 8745 // Name: _launchFrame // Dependencies: [5, 8745, 8746, 8740, 8748, 709, 8738, 8749, 8762, 8802, 2] // Exports: attachFrameIframe, detachFrameIframe, launchFrame, refreshProxyTicket, resetFrameLayoutModes, setFramePrefersPictureInPictureOnNavigateAway, updateFramePanelMode // Module 8744 (_launchFrame) import dispatcherDefault from "dispatcher" /* 709 */; import leaveCurrentEmbeddedActivity from "leaveCurrentEmbeddedActivity" /* 8748 */; import getFramesManagerDefault from "getFramesManager" /* 8802 */; import closure_3 from "asyncGeneratorStep" /* 5 */; import closure_4 from "map" /* 8745 */; import FrameLayoutModes from "FrameLayoutModes" /* 8746 */; import { ActivityPanelModes } from "ActivityPanelModes" /* 8740 */; require = arg1; function _launchFrame() { const self = this; const tmp = callback((arg0) => { closure_0 = arg0; c5 = 0; c6 = 0; c4 = 0; const iter = (function*(arg0) { if (c6 === 2) { c6 = 3; HermesBuiltin.throwTypeError(); } else if (tmp6 === 3) { if (arg0 === 1) { throw arg1; } else if (arg0 === 2) { let obj = { value: null, done: true }; obj[0] = arg1; return obj; } else { return { value: "HermesInternal", done: null }; } } else { try { c6 = 2; if (0 === c5) { if (arg0 === 1) { c6 = 3; throw arg1; } else if (arg0 === 2) { c6 = 3; obj = { value: null, done: true }; obj[0] = arg1; return obj; } else { dependencyMap = tmp3; let callback2 = tmp7; let callback; callback2 = undefined; ({ applicationId: c0, surface: c1 } = callback); dependencyMap = undefined; let intent; let frame; c5 = undefined; c6 = undefined; c5 = 1; c6 = 1; return { value: "ct", done: true }; } } else if (1 === tmp7) { if (arg0 === 1) { c6 = 3; throw arg1; } else if (arg0 === 2) { c6 = 3; obj1 = { value: null, done: true }; obj1[0] = arg1; return obj1; } else { dependencyMap = callback5(callback, callback2); intent = frame.getFrame(dependencyMap); if (null != intent) { if (intent.intent === c5.MAIN) { callback7(dependencyMap); const obj2 = { frameId: null, layoutMode: null }; obj2[0] = dependencyMap; obj2[1] = c6.FOCUSED; callback8(obj2); } c6 = 3; const obj3 = { value: null, done: true }; obj3[0] = dependencyMap; return obj3; } else { if (callback4(callback2) === c5.MAIN) { let obj9 = callback(8748); const result = obj9.leaveCurrentEmbeddedActivity(); callback6(); } let obj10 = callback2(709); let obj4 = { type: "FRAME_LAUNCH_START", applicationId: null, frameId: null, surface: null }; obj4[1] = callback; obj4[2] = dependencyMap; obj4[3] = callback2; obj10.dispatch(obj4); frame = 1; c5 = 4; c6 = 1; const obj5 = { value: null, done: false }; obj5[0] = callback(8738).createProxyTicket(callback, callback3(callback2)); return obj5; } } } else if (2 === tmp7) { frame = 0; callback3 = intent; c5 = callback2(8749)(); let obj7 = callback(8762); c5 = 3; c6 = 1; const obj6 = { value: null, done: false }; obj6[0] = obj7.getActivityLaunchErrorInfo(callback3, callback); return obj6; } else if (3 === tmp7) { if (arg0 === 1) { c6 = 3; throw arg1; } else if (arg0 === 2) { c6 = 3; obj7 = { value: null, done: true }; obj7[0] = arg1; return obj7; } else { c6 = arg1; c5.showLaunchErrorModal(c6.message); obj4 = callback2(709); const obj8 = { type: "FRAME_LAUNCH_FAIL", applicationId: null, frameId: null, error: null }; obj8[1] = callback; obj8[2] = dependencyMap; obj8[3] = callback3; obj4.dispatch(obj8); throw callback3; } } else if (arg0 === 1) { c6 = 3; throw arg1; } else if (arg0 === 2) { frame = 0; c6 = 3; obj9 = { value: null, done: true }; obj9[0] = arg1; return obj9; } else { frame = arg1; obj = callback2(709); obj10 = { type: "FRAME_LAUNCH", applicationId: null, frameId: null, surface: null, proxyTicket: null }; obj10[1] = callback; obj10[2] = dependencyMap; obj10[3] = callback2; obj10[4] = frame; obj.dispatch(obj10); frame = 0; c6 = 3; const obj11 = { value: null, done: true }; obj11[0] = dependencyMap; return obj11; } } catch (tmp75) { intent = tmp75; if (tmp4 === frame) { c6 = tmp2; throw tmp75; } else { c5 = tmp; } } } })(); iter.next(); return iter; }); closure_11 = tmp; const apply = tmp.apply; if (typeof apply === "unknown") { let applyArgumentsResult = HermesBuiltin.applyArguments(self); } else { applyArgumentsResult = apply(self, arguments); } return applyArgumentsResult; } function clearMainFrameSlot() { const mainFrame = store.getMainFrame(); if (null != mainFrame) { if (mainFrame.intent === constants.MAIN) { getFramesManagerDefault().leaveFrame(mainFrame.id); const obj = getFramesManagerDefault(); } else { demoteMainFrame(mainFrame.id); } } } function demoteMainFrame(id) { let obj = store; const mainFrame = store.getMainFrame(); id = undefined; if (mainFrame != null) { id = mainFrame.id; } if (id === id) { const frame = obj.getFrame(id); if (null != frame) { obj1 = dispatcherDefault; obj = { type: "FRAME_UPDATE_LAYOUT_MODE", applicationId: null, frameId: null, layoutMode: null }; obj[1] = frame.applicationId; obj[2] = id; obj[3] = constants2.FOCUSED; obj1.dispatch(obj); } obj = { type: "FRAME_SET_PANEL_MODE", frameId: null, activityPanelMode: null }; obj[1] = id; obj[2] = ActivityPanelModes.PANEL; dispatcherDefault.dispatch(obj); const obj4 = dispatcherDefault; obj1 = { type: "FRAME_CLEAR_MAIN_SLOT", frameId: null }; obj1[1] = id; dispatcherDefault.dispatch(obj1); const obj6 = dispatcherDefault; } } function promoteFrame(frameId) { let obj = store; let tmp = null != store.getFrame(frameId); if (tmp) { const mainFrame = obj.getMainFrame(); let id; if (mainFrame != null) { id = mainFrame.id; } tmp = id !== frameId; } if (tmp) { const result = leaveCurrentEmbeddedActivity.leaveCurrentEmbeddedActivity(); let mainFrame1 = obj.getMainFrame(); if (null == mainFrame1) { mainFrame1 = dispatcherDefault; obj = { type: "FRAME_PROMOTE", frameId: null }; obj[1] = frameId; mainFrame1.dispatch(obj); } else if (mainFrame1.intent !== constants.MAIN) { demoteMainFrame(mainFrame1.id); } const obj2 = leaveCurrentEmbeddedActivity; getFramesManagerDefault().leaveFrame(mainFrame1.id); const obj4 = getFramesManagerDefault(); } } function updateFrameLayoutMode(frameId) { frameId = frameId.frameId; const frame = store.getFrame(frameId); if (null != frame) { let obj = dispatcherDefault; obj = { type: "FRAME_UPDATE_LAYOUT_MODE", applicationId: null, frameId: null, layoutMode: null }; obj[1] = frame.applicationId; obj[2] = frameId; obj[3] = frameId.layoutMode; obj.dispatch(obj); } } function _refreshProxyTicket() { const self = this; const tmp = callback((arg0) => { closure_0 = arg0; c5 = 0; c6 = 0; c4 = 0; return (function*(arg0) { if (c6 === 2) { c6 = 3; HermesBuiltin.throwTypeError(); } else if (tmp8 === 3) { if (arg0 === 1) { throw arg1; } else if (arg0 === 2) { let obj = { value: null, done: true }; obj[0] = arg1; return obj; } else { return { value: "HermesInternal", done: null }; } } else { try { c6 = 2; if (0 === c5) { if (arg0 === 1) { c6 = 3; throw arg1; } else if (arg0 === 2) { c6 = 3; obj = { value: null, done: true }; obj[0] = arg1; return obj; } else { dependencyMap = tmp4; let applicationId = tmp6; applicationId = undefined; dependencyMap = undefined; closure_3 = undefined; let frame; frame = frame.getFrame(callback); if (null == frame) { c6 = 3; return { value: false, done: true }; } else { applicationId = frame.applicationId; obj1 = { type: "FRAME_SET_PROXY_TICKET_REFRESHING", applicationId: null, frameId: null, refreshing: true }; obj1[1] = applicationId; obj1[2] = tmp78; closure_1_1(closure_1_2[5]).dispatch(obj1); frame = 2; const obj20 = closure_1_1(closure_1_2[5]); c5 = 4; c6 = 1; const obj2 = { value: null, done: false }; obj2[0] = callback(closure_1_2[6]).createProxyTicket(applicationId, closure_1_7(frame.surface)); return obj2; } tmp78 = callback; } } else if (1 === tmp9) { frame = 0; let obj10 = applicationId(709); let obj3 = { type: "FRAME_SET_PROXY_TICKET_REFRESHING", applicationId: null, frameId: null, refreshing: false }; obj3[1] = applicationId; obj3[2] = callback; obj10.dispatch(obj3); throw closure_3; } else if (2 === tmp9) { frame = 1; c5 = closure_3; closure_3 = applicationId(8749)(); let obj8 = callback(8762); c5 = 3; c6 = 1; const obj4 = { value: null, done: false }; obj4[0] = obj8.getActivityLaunchErrorInfo(c5, applicationId); return obj4; } else if (3 === tmp9) { if (arg0 === 1) { c6 = 3; throw arg1; } else if (arg0 === 2) { frame = 0; let obj5 = applicationId(709); obj5 = { type: "FRAME_SET_PROXY_TICKET_REFRESHING", applicationId: null, frameId: null, refreshing: false }; obj5[1] = applicationId; obj5[2] = callback; obj5.dispatch(obj5); c6 = 3; const obj6 = { value: null, done: true }; obj6[0] = arg1; return obj6; } else { frame = arg1; closure_3.showLaunchErrorModal(frame.message); frame = 0; obj3 = applicationId(709); const obj7 = { type: "FRAME_SET_PROXY_TICKET_REFRESHING", applicationId: null, frameId: null, refreshing: false }; obj7[1] = applicationId; obj7[2] = callback; obj3.dispatch(obj7); c6 = 3; return { value: false, done: true }; } } else if (arg0 === 1) { c6 = 3; throw arg1; } else if (arg0 === 2) { frame = 0; obj = applicationId(709); obj8 = { type: "FRAME_SET_PROXY_TICKET_REFRESHING", applicationId: null, frameId: null, refreshing: false }; obj8[1] = applicationId; obj8[2] = callback; obj.dispatch(obj8); c6 = 3; const obj9 = { value: null, done: true }; obj9[0] = arg1; return obj9; } else { dependencyMap = arg1; obj10 = { type: "FRAME_UPDATE_PROXY_TICKET", applicationId: null, frameId: null, proxyTicket: null }; obj10[1] = applicationId; obj10[2] = callback; obj10[3] = dependencyMap; applicationId(709).dispatch(obj10); frame = 0; const obj16 = applicationId(709); const obj11 = { type: "FRAME_SET_PROXY_TICKET_REFRESHING", applicationId: null, frameId: null, refreshing: false }; obj11[1] = applicationId; obj11[2] = callback; applicationId(709).dispatch(obj11); c6 = 3; return { value: true, done: true }; } } catch (tmp54) { closure_3 = tmp54; if (tmp5 === frame) { c6 = tmp3; throw tmp54; } else if (tmp2 === tmp56) { c5 = tmp2; } else { c5 = tmp; } } } })(); }); closure_16 = tmp; const apply = tmp.apply; if (typeof apply === "unknown") { let applyArgumentsResult = HermesBuiltin.applyArguments(self); } else { applyArgumentsResult = apply(self, arguments); } return applyArgumentsResult; } ({ FrameIntent: c5, FrameLayoutModes: closure_6, getChannelIdForSurface: error, getFrameIntentForSurface: closure_8, makeFrameId: c9 } = FrameLayoutModes); let result = require("set").fileFinishedImporting("modules/frames/FramesActionCreators.shared.tsx"); export const launchFrame = function launchFrame(closure_0) { const self = this; const apply = _launchFrame.apply; if (typeof apply === "unknown") { let applyArgumentsResult = HermesBuiltin.applyArguments(self); } else { applyArgumentsResult = apply(self, arguments); } return applyArgumentsResult; }; export { clearMainFrameSlot }; export { demoteMainFrame }; export { promoteFrame }; export { updateFrameLayoutMode }; export const setFramePrefersPictureInPictureOnNavigateAway = function setFramePrefersPictureInPictureOnNavigateAway(frameId, enabled) { let obj = dispatcherDefault; obj = { type: "FRAME_SET_PREFERS_PICTURE_IN_PICTURE_ON_NAVIGATE_AWAY", frameId, enabled }; obj.dispatch(obj); }; export const updateFramePanelMode = function updateFramePanelMode(id, PIP) { let obj = dispatcherDefault; obj = { type: "FRAME_SET_PANEL_MODE", frameId: id, activityPanelMode: PIP }; obj.dispatch(obj); }; export const resetFrameLayoutModes = function resetFrameLayoutModes(frameId) { const frame = store.getFrame(frameId); if (null != frame) { let obj = dispatcherDefault; obj = { type: "FRAME_UPDATE_LAYOUT_MODE", applicationId: null, frameId: null, layoutMode: null }; obj[1] = frame.applicationId; obj[2] = frameId; obj[3] = constants2.FOCUSED; obj.dispatch(obj); } obj = { type: "FRAME_SET_PANEL_MODE", frameId, activityPanelMode: ActivityPanelModes.PANEL }; dispatcherDefault.dispatch(obj); }; export const attachFrameIframe = function attachFrameIframe(frameId, iframeId) { let obj = dispatcherDefault; obj = { type: "FRAME_IFRAME_MOUNT", frameId, iframeId }; obj.dispatch(obj); }; export const detachFrameIframe = function detachFrameIframe(frameId, iframeId) { let obj = dispatcherDefault; obj = { type: "FRAME_IFRAME_UNMOUNT", frameId, iframeId }; obj.dispatch(obj); }; export const refreshProxyTicket = function refreshProxyTicket() { const self = this; const apply = _refreshProxyTicket.apply; if (typeof apply === "unknown") { let applyArgumentsResult = HermesBuiltin.applyArguments(self); } else { applyArgumentsResult = apply(self, arguments); } return applyArgumentsResult; };