// Metro module 1490 (f1491). import TabRouter, { TabActions } from "./TabRouter"; import { nanoid } from "./Module1489"; import { HermesBuiltin } from "../_hermes/prelude"; function $mk102223() { return (a0) => a0.type === "drawer"; } function $mk102224() { return (a0) => a0.type !== "drawer"; } const actionCreators = { ...TabActions, openDrawer: () => ({ type: "OPEN_DRAWER" }), closeDrawer: () => ({ type: "CLOSE_DRAWER" }), toggleDrawer: () => ({ type: "TOGGLE_DRAWER" }) }; export default function DrawerRouter({ defaultStatus = "closed", ...rest }) { let addDrawerToHistory2, removeDrawerFromHistory2, closeDrawer2; const default2 = defaultStatus; addDrawerToHistory2 = void 0; removeDrawerFromHistory2 = void 0; closeDrawer2 = void 0; const r14 = TabRouter(rest); let c13062_1 = r14; const isDrawerInHistory2 = (a0) => {}; addDrawerToHistory2 = (a0) => {}; removeDrawerFromHistory2 = (a0) => {}; closeDrawer2 = (a0) => { let r24; let status = "open"; const r3 = default2 === "open"; if (r3) { const r39 = Boolean; const history3 = a0.history; const r47 = r39(history3 == null ? void 0 : history3.some($mk102223())); let r48 = a0; if (!r47) { const history4 = a0.history; const history5 = [,]; const r0 = HermesBuiltin.arraySpread(history5, history4, 0); if (r3) { status = "closed"; } history5[r0] = { type: "drawer", status }; r48 = { ...a0, history: history5 }; } r24 = r48; } else { const r6 = Boolean; const history2 = a0.history; r24 = r6(history2 == null ? void 0 : history2.some($mk102223())) ? { ...a0, history: a0.history.filter($mk102224()) } : a0; } return r24; }; return { ...r14, type: "drawer", getInitialState: (a0) => ({ ...c13062_1.getInitialState({ routeNames: a0.routeNames, routeParamList: a0.routeParamList, routeGetIdList: a0.routeGetIdList }), default: default2, stale: false, type: "drawer", key: `drawer-${nanoid()}` }), getRehydratedState: (a0, { routeNames, routeParamList, routeGetIdList }) => { if (a0.stale === false) { return a0; } const rehydratedState = c13062_1.getRehydratedState(a0, { routeNames, routeParamList, routeGetIdList }); const r24 = Boolean; const history2 = a0.history; const r28 = r24(history2 == null ? void 0 : history2.some($mk102223())); let r29 = rehydratedState; if (r28) { const r35 = Boolean; const history3 = rehydratedState.history; const r41 = r35(history3 == null ? void 0 : history3.some($mk102223())) ? { ...rehydratedState, history: rehydratedState.history.filter($mk102224()) } : rehydratedState; const r54 = Boolean; const history4 = r41.history; r29 = r54(history4 == null ? void 0 : history4.some($mk102223())) ? r41 : { ...r41, history: [...r41.history, { type: "drawer", status: default2 === "open" ? "closed" : "open" }] }; } return { ...r29, default: default2, type: "drawer", key: `drawer-${nanoid()}` }; }, getStateForRouteFocus: (a0, a1) => closeDrawer2(c13062_1.getStateForRouteFocus(a0, a1)), getStateForAction: (a0, a1, a2) => { let r32, r86, r141; const type = a1.type; if (type === "OPEN_DRAWER") { let status = "open"; const r124 = default2 === "open"; if (r124) { const r159 = Boolean; const history9 = a0.history; r141 = r159(history9 == null ? void 0 : history9.some($mk102223())) ? { ...a0, history: a0.history.filter($mk102224()) } : a0; } else { const r132 = Boolean; const history7 = a0.history; const r140 = r132(history7 == null ? void 0 : history7.some($mk102223())); r141 = a0; if (!r140) { const history8 = a0.history; const history10 = [,]; const r150 = HermesBuiltin.arraySpread(history10, history8, 0); if (r124) { status = "closed"; } history10[r150] = { type: "drawer", status }; r141 = { ...a0, history: history10 }; } } return r141; } if (type === "CLOSE_DRAWER") { return closeDrawer2(a0); } if (type === "TOGGLE_DRAWER") { const r65 = Boolean; const history4 = a0.history; if (r65(history4 == null ? void 0 : history4.some($mk102223()))) { const r103 = Boolean; const history6 = a0.history; r86 = r103(history6 == null ? void 0 : history6.some($mk102223())) ? { ...a0, history: a0.history.filter($mk102224()) } : a0; } else { const r79 = Boolean; const history5 = a0.history; r86 = r79(history5 == null ? void 0 : history5.some($mk102223())) ? a0 : { ...a0, history: [...a0.history, { type: "drawer", status: default2 === "open" ? "closed" : "open" }] }; } return r86; } if (type !== "JUMP_TO" && type !== "NAVIGATE") { if (type === "GO_BACK") { const r11 = Boolean; const history2 = a0.history; if (r11(history2 == null ? void 0 : history2.some($mk102223()))) { const r38 = Boolean; const history3 = a0.history; r32 = r38(history3 == null ? void 0 : history3.some($mk102223())) ? { ...a0, history: a0.history.filter($mk102224()) } : a0; } else { r32 = c13062_1.getStateForAction(a0, a1, a2); } return r32; } return c13062_1.getStateForAction(a0, a1, a2); } const stateForAction = c13062_1.getStateForAction(a0, a1, a2); return stateForAction != null ? stateForAction.index !== a0.index ? closeDrawer2(stateForAction) : stateForAction : stateForAction; }, actionCreators }; }; export { actionCreators as DrawerActions };