// Metro module 8115 (f8116). import _slicedToArray from "../../../../_bundle/_slicedToArray"; import ActionSheetStore from "../../../action_sheet/native/ActionSheetStore"; import { MEDIA_MODAL_KEY } from "../../../../Constants"; import * as _asyncRequire from "../../../../_bundle/asyncRequire"; import Module38 from "../../../../_bundle/Module38"; import ActionSheetActionCreators from "../../../action_sheet/native/ActionSheetActionCreators"; import ModalActionCreators from "../../../../actions/ModalActionCreators"; function $mk115104($env) { return function getMeasureInWindowFunction(a0) { let env31443 = { $parent: $env }; env31443[0] = a0; return a0 != null && "measureInWindow" in a0 ? a0.measureInWindow.bind(a0) : (a0) => { let r13 = env31443[0]; if (r13 == null) { const r3 = env31443.$parent; const r4 = r3[0]; const r14 = r3[2]; r13 = { x: 0, y: 0, width: r4(r14[4]).getWindowDimensions().width, height: r4(r14[4]).getWindowDimensions().height }; } a0(r13.x, r13.y, r13.width, r13.height, r13.resizeMode); }; }; } function $mk115105($env) { return (a0, a1, a2, a3, a4) => { let initialIndex; const r1 = $env; if (r1[6] === "action-sheet") { Module38(ActionSheetStore.isOpen(), "An action sheet must be open to open the media modal as an action sheet"); const r61 = _asyncRequire(dependencyMap[11], dependencyMap.paths); const initialIndex2 = r1[1]; ActionSheetActionCreators.openLazy(r61, MEDIA_MODAL_KEY, { ...r1[7], initialIndex: initialIndex2, originLayout: { x: a0, y: a1, width: a2, height: a3, resizeMode: a4 }, onCloseCallback: r1[5], disableHapticOnOpen: true }, "stack"); initialIndex = initialIndex2; } else { const r6 = _asyncRequire(dependencyMap[13], dependencyMap.paths); initialIndex = r1[1]; ModalActionCreators.pushLazy(r6, { ...r1[7], initialIndex, originLayout: { x: a0, y: a1, width: a2, height: a3, resizeMode: a4 }, onCloseCallback: r1[5] }, MEDIA_MODAL_KEY, { animation: "none" }); } const r77 = r1[10]; const sources = r1[2]; r77({ sources, initialIndex }); r1[11].markSessionStarted({ channelId: r1[4], numMediaItems: sources.length, source: r1[3] }); (0, r1[12])(); }; } let env5151 = {}; export async function openMediaModal(c26108_0) { let r13, openAs; let c26108_1, c26108_2; let env29892; L10: { const r31 = env5151; c26108_2 = r31; const r10 = env29892 = { $parent: r31 }; c26108_1 = r10; env29892[0] = void 0; env29892[1] = void 0; env29892[2] = void 0; env29892[3] = void 0; env29892[4] = void 0; env29892[5] = void 0; env29892[6] = void 0; env29892[7] = void 0; r13 = c26108_0; env29892[0] = r13.originViewOrOriginLayout; const initialIndex = r13.initialIndex; if (initialIndex !== void 0) { env29892[1] = initialIndex; env29892[2] = r13.initialSources; env29892[3] = r13.analyticsSource; env29892[4] = r13.channelId; env29892[5] = r13.onClose; openAs = r13.openAs; if (openAs !== void 0) { break L10; } } else { env29892[1] = 0; env29892[2] = r13.initialSources; env29892[3] = r13.analyticsSource; env29892[4] = r13.channelId; env29892[5] = r13.onClose; openAs = r13.openAs; if (openAs !== void 0) { break L10; } } openAs = "modal"; } env29892[6] = openAs; const { originViewOrOriginLayout, initialIndex: _initialIndex, initialSources, analyticsSource, channelId, onClose, openAs: _openAs, ...rest } = r13; env29892[7] = rest; env29892[8] = void 0; env29892[9] = void 0; env29892[10] = void 0; env29892[11] = void 0; env29892[12] = void 0; await void 0; const r83 = await Promise.all([import("../useMediaViewerSources"), import("../../MediaViewerAnalyticsManager"), import("../useVideoControls")]); const r91 = c26108_1; env29892[8] = r83; env29892[9] = (0, _slicedToArray)(env29892[8], 3); env29892[10] = env29892[9][0].setMediaViewerSources; env29892[11] = env29892[9][1].MediaViewerAnalytics; env29892[12] = env29892[9][2].initVideoStateStore; const r106 = env29892[0]; $mk115104(env5151)(r106)($mk115105(r91)); }