import { i as require_react, n as require_compiler_runtime, r as require_jsx_runtime, t as theme, u as __toESM } from "./theme.mnyG70gE.chunk.js";
import { E as markAccountRead, F as sync, G as replaceModal, Gr as listen, Gt as useDispatch, In as tsToRelativeTime, It as useUpdateAccountMutation, Kr as send, Kt as useSelector, Mt as useMoveAccountMutation, Nt as useReopenAccountMutation, Pt as useSyncAndDownloadMutation, S as cx, U as pushModal, V as openAccountCloseModal, Xr as getUndoState, an as useAccounts, en as addNotification, ii as useTranslation, oi as Trans, qr as sendCatch, tt as closeBudget, v as styles, wn as groupById, x as css, z as collapseModals } from "./extends.CfN_tLZB.chunk.js";
import { $l as useDeleteCategoryGroupMutation, $n as envelopeBudget, $s as $7252cd45fc48c07c$export$72cb63bdda528276, At as useNotes, Bl as config, Bs as $ad0e3f3d9c50e4ba$export$905ab40ac2179daa, Bt as makeAmountGrey, Cs as $eed445e0843c11d0$export$a11e76429ed99b4, Ei as useSyncedPref, Fn as useTransactions, Gn as accountBalance, Gs as $67560de7c78cb232$export$403bc76cbf68cf60, Hl as useSpring, Hn as CellValue, Hs as $224594fe3e57ff1e$export$62447ad3d2ec7da6, Ht as prewarmMonth, Io as useLocalPref, Jn as allAccountBalance, Jo as AutoTextSize, Js as $67560de7c78cb232$export$c28d9fb4a54e471a, Kn as accountBalanceCleared, Kr as subMonths, Ks as $67560de7c78cb232$export$418e185dd3f1b968, Ll as AnimatedLoading, M as StatusBadge, Mn as useAccount, Nc as $507fabe10e71c6fb$export$8397ddfc504fdb9a, Ni as SvgViewShow, Nt as BalanceWithCarryover, O as DisplayPayeeProvider, Ol as $bdb11010cef70236$export$f680877a34711e37, On as MOBILE_NAV_HEIGHT, Oo as require_debounce, Os as $612b8eb6cb90e02d$export$62ed72bc21f6b8a6, Pn as calculateRunningBalancesTopDown, Pr as isCurrentMonth, Ql as useCreateCategoryMutation, Qn as closedAccountBalance, Qs as $7252cd45fc48c07c$export$70936501603e6c57, Rc as $fca6afa0e843324b$export$f12b703ca79dfbb1, Rn as InputField, Ti as useFormat, Tr as getMonth, Un as CellValueText, Us as $8253ed7ece74b463$export$7941f8aafa4b6021, V as usePayees, Vc as $18f2051aff69b9bf$export$43bb16f9c6d9e3f7, Vs as $5c06e4929e123553$export$ccdee5eaf73cf661, Wl as useNavigate, Wn as FinancialText, Wr as sheetForMonth, Ws as $865c2eb7c00a83f1$exports, Xl as useBudgetActions, Xn as categoryBalanceCleared, Xs as $7252cd45fc48c07c$export$49bac5d6d4b352ea, Xu as q, Yn as categoryBalance, Yo as TextOneLine, Ys as $7252cd45fc48c07c$export$3093291712f09a77, Zl as useCreateCategoryGroupMutation, Zn as categoryBalanceUncleared, Zs as $7252cd45fc48c07c$export$6ca6700462636d0b, Zt as getNormalisedString, _ as useDateFormat, _c as $c5a24bc478652b5f$export$1005530eda016c13, _i as useSheetValue, _s as Button, _t as useCategoryScheduleGoalTemplates, _u as useSearchParams, a as RuleEditor, ac as $7252cd45fc48c07c$export$e1d41611756c6326, ar as transactions, as as SvgExpandArrow, au as useSaveCategoryGroupMutation, bl as $3ef42575df84b30b$export$9d1611c77c2fe928, bo as SvgAdd, bt as getSchedulesQuery, cl as $62d8ded9296f3872$export$cfa2225e87938781, cn as isPreviewId, cs as SvgLogo, ct as useCategories, cu as View, da as SvgArrowButtonDown1, dt as useUndo, ec as $7252cd45fc48c07c$export$78bf638634500fa5, ei as aqlQuery, er as offBudgetAccountBalance, eu as useDeleteCategoryMutation, fo as SvgBookmark, fr as currentDay, gl as $c87311424ea30a05$export$78551043582a6a98, go as SvgArrowThickRight, gs as Text, gt as useLocale, gu as useParams, h as DisplayId, ht as useCategoryScheduleGoalTemplateIndicator, hu as useLocation, ia as SvgArrowsSynchronize, ic as $7252cd45fc48c07c$export$dfdf5deeaf27473f, io as SvgCheveronDown, jn as useDrag, kl as $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c, ll as $cc38e7bd3fc7b213$export$2bb74740c4e19def, lr as addMonths, ls as useResponsive, lt as useCategoriesById, mi as PrivacyFilter, mo as SvgArrowThinLeft, ms as SpaceBetween, na as SvgCalendar, nc as $7252cd45fc48c07c$export$990fced5dfac2637, nn as getScheduledAmount, no as SvgCheveronRight, nr as trackingBudget, nu as useMoveCategoryMutation, oc as $7252cd45fc48c07c$export$f2be18a910c0caa6, or as transactionsSearch, ou as useSaveCategoryMutation, po as SvgArrowThinRight, pr as currentMonth, ql as useSpreadsheet, qn as accountBalanceUncleared, qs as $67560de7c78cb232$export$aef80212ac99c003, ra as SvgCalendar3, rc as $7252cd45fc48c07c$export$dac8db29d42db9a1, rr as uncategorizedBalance, s as useCategory, sl as $ef06256079686ba0$export$f8aeda7b10753fa1, sr as uncategorizedTransactions, tc as $7252cd45fc48c07c$export$7e397efd01d3db27, tr as onBudgetAccountBalance, tu as useMoveCategoryGroupMutation, vi as SheetNameProvider, vl as $c87311424ea30a05$export$fedb369cb70207f1, vt as SchedulesProvider, wo as Page, xi as useSelected, xo as MobilePageHeader, xr as format, xs as $eed445e0843c11d0$export$41f133550aa26f48, xt as useSchedules, yi as SelectedProvider, zl as animated, zt as makeAmountFullStyle } from "./merge.C77XY6IK.chunk.js";
import { a as useOnBudgetAccounts, c as MobileBankSyncAccountEditPage, d as useUrlParam, f as $72e60046c03fbe42$export$a7bfbda1311ca015, i as updateScheduleConditions, o as useOffBudgetAccounts, p as $72e60046c03fbe42$export$e96fc9a8407faa6b, r as useScheduleEdit, s as Label, t as ScheduleEditForm } from "./ScheduleEditForm.DVZwyX6V.chunk.js";
import { n as $ce3a951440fc273f$export$89be5a243e59c4b2, r as $61ef60fc9b1041f4$export$cacbb3924155d68e, t as TransactionList } from "./TransactionList.CNDU7K2A.chunk.js";
import { a as PayeeRuleCountLabel, c as ruleToString, d as groupActionsBySplitIndex, f as useFailedAccounts, h as Search, i as groupBankSyncAccounts, l as ConditionExpression, m as usePreviewTransactions, n as getGroupedBankSyncEntries, o as usePayeeRuleCounts, p as useAccountPreviewTransactions, r as getSyncSourceReadable, u as ActionExpression } from "./bankSyncUtils.Dn5uvBJt.chunk.js";
import { o as MobileBackButton } from "./TransactionEdit.D3b8cFIw.chunk.js";
//#region ../../node_modules/@react-aria/dnd/dist/DropTargetKeyboardNavigation.mjs
function $e154566cef11553b$export$ff7962acd6052c28(keyboardDelegate, collection, target, direction, rtl = false, wrap = false) {
	switch (direction) {
		case "left": return rtl ? $e154566cef11553b$var$nextDropTarget(keyboardDelegate, collection, target, wrap, "left") : $e154566cef11553b$var$previousDropTarget(keyboardDelegate, collection, target, wrap, "left");
		case "right": return rtl ? $e154566cef11553b$var$previousDropTarget(keyboardDelegate, collection, target, wrap, "right") : $e154566cef11553b$var$nextDropTarget(keyboardDelegate, collection, target, wrap, "right");
		case "up": return $e154566cef11553b$var$previousDropTarget(keyboardDelegate, collection, target, wrap);
		case "down": return $e154566cef11553b$var$nextDropTarget(keyboardDelegate, collection, target, wrap);
	}
}
function $e154566cef11553b$var$nextDropTarget(keyboardDelegate, collection, target, wrap = false, horizontal = null) {
	if (!target) return { type: "root" };
	if (target.type === "root") {
		var _keyboardDelegate_getFirstKey;
		var _keyboardDelegate_getFirstKey1;
		let nextKey = (_keyboardDelegate_getFirstKey1 = (_keyboardDelegate_getFirstKey = keyboardDelegate.getFirstKey) === null || _keyboardDelegate_getFirstKey === void 0 ? void 0 : _keyboardDelegate_getFirstKey.call(keyboardDelegate)) !== null && _keyboardDelegate_getFirstKey1 !== void 0 ? _keyboardDelegate_getFirstKey1 : null;
		if (nextKey != null) return {
			type: "item",
			key: nextKey,
			dropPosition: "before"
		};
		return null;
	}
	if (target.type === "item") {
		var _keyboardDelegate_getKeyRightOf, _keyboardDelegate_getKeyLeftOf, _keyboardDelegate_getKeyBelow;
		let nextKey = null;
		if (horizontal) nextKey = horizontal === "right" ? (_keyboardDelegate_getKeyRightOf = keyboardDelegate.getKeyRightOf) === null || _keyboardDelegate_getKeyRightOf === void 0 ? void 0 : _keyboardDelegate_getKeyRightOf.call(keyboardDelegate, target.key) : (_keyboardDelegate_getKeyLeftOf = keyboardDelegate.getKeyLeftOf) === null || _keyboardDelegate_getKeyLeftOf === void 0 ? void 0 : _keyboardDelegate_getKeyLeftOf.call(keyboardDelegate, target.key);
		else nextKey = (_keyboardDelegate_getKeyBelow = keyboardDelegate.getKeyBelow) === null || _keyboardDelegate_getKeyBelow === void 0 ? void 0 : _keyboardDelegate_getKeyBelow.call(keyboardDelegate, target.key);
		let nextCollectionKey = $e154566cef11553b$var$getNextItem(collection, target.key, (key) => collection.getKeyAfter(key));
		if (nextKey != null && nextKey !== nextCollectionKey) return {
			type: "item",
			key: nextKey,
			dropPosition: target.dropPosition
		};
		switch (target.dropPosition) {
			case "before": return {
				type: "item",
				key: target.key,
				dropPosition: "on"
			};
			case "on": {
				let targetNode = collection.getItem(target.key);
				let nextNode = nextKey != null ? collection.getItem(nextKey) : null;
				if (targetNode && nextNode && nextNode.level >= targetNode.level) return {
					type: "item",
					key: nextNode.key,
					dropPosition: "before"
				};
				return {
					type: "item",
					key: target.key,
					dropPosition: "after"
				};
			}
			case "after": {
				let targetNode = collection.getItem(target.key);
				let nextItemInSameLevel = (targetNode === null || targetNode === void 0 ? void 0 : targetNode.nextKey) != null ? collection.getItem(targetNode.nextKey) : null;
				while (nextItemInSameLevel != null && nextItemInSameLevel.type !== "item") nextItemInSameLevel = nextItemInSameLevel.nextKey != null ? collection.getItem(nextItemInSameLevel.nextKey) : null;
				if (targetNode && nextItemInSameLevel == null && targetNode.parentKey != null) {
					let parentNode = collection.getItem(targetNode.parentKey);
					const nextNode = (parentNode === null || parentNode === void 0 ? void 0 : parentNode.nextKey) != null ? collection.getItem(parentNode.nextKey) : null;
					if ((nextNode === null || nextNode === void 0 ? void 0 : nextNode.type) === "item") return {
						type: "item",
						key: nextNode.key,
						dropPosition: "before"
					};
					if ((parentNode === null || parentNode === void 0 ? void 0 : parentNode.type) === "item") return {
						type: "item",
						key: parentNode.key,
						dropPosition: "after"
					};
				}
				if (nextItemInSameLevel) return {
					type: "item",
					key: nextItemInSameLevel.key,
					dropPosition: "on"
				};
			}
		}
	}
	if (wrap) return { type: "root" };
	return null;
}
function $e154566cef11553b$var$previousDropTarget(keyboardDelegate, collection, target, wrap = false, horizontal = null) {
	if (!target || wrap && target.type === "root") {
		var _keyboardDelegate_getLastKey;
		let prevKey = null;
		let lastKey = (_keyboardDelegate_getLastKey = keyboardDelegate.getLastKey) === null || _keyboardDelegate_getLastKey === void 0 ? void 0 : _keyboardDelegate_getLastKey.call(keyboardDelegate);
		while (lastKey != null) {
			let node = collection.getItem(lastKey);
			if ((node === null || node === void 0 ? void 0 : node.type) !== "item") break;
			prevKey = lastKey;
			lastKey = node === null || node === void 0 ? void 0 : node.parentKey;
		}
		if (prevKey != null) return {
			type: "item",
			key: prevKey,
			dropPosition: "after"
		};
		return null;
	}
	if (target.type === "item") {
		var _keyboardDelegate_getKeyLeftOf, _keyboardDelegate_getKeyRightOf, _keyboardDelegate_getKeyAbove;
		let prevKey = null;
		if (horizontal) prevKey = horizontal === "left" ? (_keyboardDelegate_getKeyLeftOf = keyboardDelegate.getKeyLeftOf) === null || _keyboardDelegate_getKeyLeftOf === void 0 ? void 0 : _keyboardDelegate_getKeyLeftOf.call(keyboardDelegate, target.key) : (_keyboardDelegate_getKeyRightOf = keyboardDelegate.getKeyRightOf) === null || _keyboardDelegate_getKeyRightOf === void 0 ? void 0 : _keyboardDelegate_getKeyRightOf.call(keyboardDelegate, target.key);
		else prevKey = (_keyboardDelegate_getKeyAbove = keyboardDelegate.getKeyAbove) === null || _keyboardDelegate_getKeyAbove === void 0 ? void 0 : _keyboardDelegate_getKeyAbove.call(keyboardDelegate, target.key);
		let prevCollectionKey = $e154566cef11553b$var$getNextItem(collection, target.key, (key) => collection.getKeyBefore(key));
		if (prevKey != null && prevKey !== prevCollectionKey) return {
			type: "item",
			key: prevKey,
			dropPosition: target.dropPosition
		};
		switch (target.dropPosition) {
			case "before": {
				let targetNode = collection.getItem(target.key);
				if (targetNode && targetNode.prevKey != null) {
					let lastChild = $e154566cef11553b$var$getLastChild(collection, targetNode.prevKey);
					if (lastChild) return lastChild;
				}
				if (prevKey != null) return {
					type: "item",
					key: prevKey,
					dropPosition: "on"
				};
				return { type: "root" };
			}
			case "on": return {
				type: "item",
				key: target.key,
				dropPosition: "before"
			};
			case "after": {
				let lastChild = $e154566cef11553b$var$getLastChild(collection, target.key);
				if (lastChild) return lastChild;
				return {
					type: "item",
					key: target.key,
					dropPosition: "on"
				};
			}
		}
	}
	if (target.type !== "root") return { type: "root" };
	return null;
}
function $e154566cef11553b$var$getLastChild(collection, key) {
	let targetNode = collection.getItem(key);
	let nextKey = $e154566cef11553b$var$getNextItem(collection, key, (key) => collection.getKeyAfter(key));
	let nextNode = nextKey != null ? collection.getItem(nextKey) : null;
	if (targetNode && nextNode && nextNode.level > targetNode.level) {
		let children = $c5a24bc478652b5f$export$1005530eda016c13(targetNode, collection);
		let lastChild = null;
		for (let child of children) if (child.type === "item") lastChild = child;
		if (lastChild) return {
			type: "item",
			key: lastChild.key,
			dropPosition: "after"
		};
	}
	return null;
}
function $e154566cef11553b$var$getNextItem(collection, key, getNextKey) {
	let nextCollectionKey = getNextKey(key);
	let nextCollectionNode = nextCollectionKey != null ? collection.getItem(nextCollectionKey) : null;
	while (nextCollectionNode && nextCollectionNode.type !== "item") {
		nextCollectionKey = getNextKey(nextCollectionNode.key);
		nextCollectionNode = nextCollectionKey != null ? collection.getItem(nextCollectionKey) : null;
	}
	return nextCollectionKey;
}
//#endregion
//#region ../../node_modules/@react-aria/dnd/dist/useAutoScroll.mjs
var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
var $80d9daea3067eff3$var$AUTOSCROLL_AREA_SIZE = 20;
function $80d9daea3067eff3$export$6323452ca4533ed8(ref) {
	let scrollableRef = (0, import_react.useRef)(null);
	let scrollableX = (0, import_react.useRef)(true);
	let scrollableY = (0, import_react.useRef)(true);
	(0, import_react.useEffect)(() => {
		if (ref.current) {
			scrollableRef.current = $cc38e7bd3fc7b213$export$2bb74740c4e19def(ref.current) ? ref.current : $62d8ded9296f3872$export$cfa2225e87938781(ref.current);
			let style = window.getComputedStyle(scrollableRef.current);
			scrollableX.current = /(auto|scroll)/.test(style.overflowX);
			scrollableY.current = /(auto|scroll)/.test(style.overflowY);
		}
	}, [ref]);
	let state = (0, import_react.useRef)({
		timer: void 0,
		dx: 0,
		dy: 0
	}).current;
	(0, import_react.useEffect)(() => {
		return () => {
			if (state.timer) {
				cancelAnimationFrame(state.timer);
				state.timer = void 0;
			}
		};
	}, [state]);
	let scroll = (0, import_react.useCallback)(() => {
		if (scrollableX.current && scrollableRef.current) scrollableRef.current.scrollLeft += state.dx;
		if (scrollableY.current && scrollableRef.current) scrollableRef.current.scrollTop += state.dy;
		if (state.timer) state.timer = requestAnimationFrame(scroll);
	}, [scrollableRef, state]);
	return {
		move(x, y) {
			if (!$c87311424ea30a05$export$78551043582a6a98() || $c87311424ea30a05$export$fedb369cb70207f1() || !scrollableRef.current) return;
			let box = scrollableRef.current.getBoundingClientRect();
			let left = $80d9daea3067eff3$var$AUTOSCROLL_AREA_SIZE;
			let top = $80d9daea3067eff3$var$AUTOSCROLL_AREA_SIZE;
			let bottom = box.height - $80d9daea3067eff3$var$AUTOSCROLL_AREA_SIZE;
			let right = box.width - $80d9daea3067eff3$var$AUTOSCROLL_AREA_SIZE;
			if (x < left || x > right || y < top || y > bottom) {
				if (x < left) state.dx = x - left;
				else if (x > right) state.dx = x - right;
				if (y < top) state.dy = y - top;
				else if (y > bottom) state.dy = y - bottom;
				if (!state.timer) state.timer = requestAnimationFrame(scroll);
			} else this.stop();
		},
		stop() {
			if (state.timer) {
				cancelAnimationFrame(state.timer);
				state.timer = void 0;
			}
		}
	};
}
//#endregion
//#region ../../node_modules/@react-aria/dnd/dist/useDroppableCollection.mjs
function $4b52e4eff84e5217$export$f4e2f423c21f7b04(props, state, ref) {
	let localState = (0, import_react.useRef)({
		props,
		state,
		nextTarget: null,
		dropOperation: null
	}).current;
	localState.props = props;
	localState.state = state;
	let defaultOnDrop = (0, import_react.useCallback)(async (e) => {
		let { onInsert, onRootDrop, onItemDrop, onReorder, onMove, acceptedDragTypes = "all", shouldAcceptItemDrop } = localState.props;
		let { draggingKeys } = $7252cd45fc48c07c$export$6ca6700462636d0b;
		let isInternal = $7252cd45fc48c07c$export$78bf638634500fa5(ref);
		let { target, dropOperation, items } = e;
		let filteredItems = items;
		if (acceptedDragTypes !== "all" || shouldAcceptItemDrop) filteredItems = items.filter((item) => {
			let itemTypes;
			if (item.kind === "directory") itemTypes = new Set([$7252cd45fc48c07c$export$990fced5dfac2637]);
			else itemTypes = item.kind === "file" ? new Set([item.type]) : item.types;
			if (acceptedDragTypes === "all" || acceptedDragTypes.some((type) => itemTypes.has(type))) {
				if (target.type === "item" && target.dropPosition === "on" && shouldAcceptItemDrop) return shouldAcceptItemDrop(target, itemTypes);
				return true;
			}
			return false;
		});
		if (filteredItems.length > 0) {
			if (target.type === "root" && onRootDrop) await onRootDrop({
				items: filteredItems,
				dropOperation
			});
			if (target.type === "item") {
				if (target.dropPosition === "on" && onItemDrop) await onItemDrop({
					items: filteredItems,
					dropOperation,
					isInternal,
					target
				});
				if (onMove && isInternal) await onMove({
					keys: draggingKeys,
					dropOperation,
					target
				});
				if (target.dropPosition !== "on") {
					if (!isInternal && onInsert) await onInsert({
						items: filteredItems,
						dropOperation,
						target
					});
					if (isInternal && onReorder) await onReorder({
						keys: draggingKeys,
						dropOperation,
						target
					});
				}
			}
		}
	}, [localState, ref]);
	let autoScroll = $80d9daea3067eff3$export$6323452ca4533ed8(ref);
	let { dropProps } = $5c06e4929e123553$export$ccdee5eaf73cf661({
		ref,
		onDropEnter() {
			if (localState.nextTarget != null) state.setTarget(localState.nextTarget);
		},
		onDropMove(e) {
			if (localState.nextTarget != null) state.setTarget(localState.nextTarget);
			autoScroll.move(e.x, e.y);
		},
		getDropOperationForPoint(types, allowedOperations, x, y) {
			let { draggingKeys, dropCollectionRef } = $7252cd45fc48c07c$export$6ca6700462636d0b;
			let isInternal = $7252cd45fc48c07c$export$78bf638634500fa5(ref);
			let isValidDropTarget = (target) => state.getDropOperation({
				target,
				types,
				allowedOperations,
				isInternal,
				draggingKeys
			}) !== "cancel";
			let target = props.dropTargetDelegate.getDropTargetFromPoint(x, y, isValidDropTarget);
			if (!target) {
				localState.dropOperation = "cancel";
				localState.nextTarget = null;
				return "cancel";
			}
			localState.dropOperation = state.getDropOperation({
				target,
				types,
				allowedOperations,
				isInternal,
				draggingKeys
			});
			if (localState.dropOperation === "cancel") {
				let rootTarget = { type: "root" };
				let dropOperation = state.getDropOperation({
					target: rootTarget,
					types,
					allowedOperations,
					isInternal,
					draggingKeys
				});
				if (dropOperation !== "cancel") {
					target = rootTarget;
					localState.dropOperation = dropOperation;
				}
			}
			if (target && localState.dropOperation !== "cancel" && (ref === null || ref === void 0 ? void 0 : ref.current) !== (dropCollectionRef === null || dropCollectionRef === void 0 ? void 0 : dropCollectionRef.current)) $7252cd45fc48c07c$export$dac8db29d42db9a1(ref);
			localState.nextTarget = localState.dropOperation === "cancel" ? null : target;
			return localState.dropOperation;
		},
		onDropExit() {
			$7252cd45fc48c07c$export$dac8db29d42db9a1(void 0);
			state.setTarget(null);
			autoScroll.stop();
		},
		onDropActivate(e) {
			var _state_target;
			if (((_state_target = state.target) === null || _state_target === void 0 ? void 0 : _state_target.type) === "item" && typeof props.onDropActivate === "function") props.onDropActivate({
				type: "dropactivate",
				x: e.x,
				y: e.y,
				target: state.target
			});
		},
		onDrop(e) {
			$7252cd45fc48c07c$export$dac8db29d42db9a1(ref);
			if (state.target) onDrop(e, state.target);
			let { draggingCollectionRef } = $7252cd45fc48c07c$export$6ca6700462636d0b;
			if (draggingCollectionRef == null) $7252cd45fc48c07c$export$70936501603e6c57();
		}
	});
	let droppingState = (0, import_react.useRef)(null);
	let updateFocusAfterDrop = (0, import_react.useCallback)(() => {
		let { state } = localState;
		if (droppingState.current) {
			var _state_collection_getItem;
			let { target, collection: prevCollection, selectedKeys: prevSelectedKeys, focusedKey: prevFocusedKey, isInternal, draggingKeys } = droppingState.current;
			if (state.collection.size > prevCollection.size && state.selectionManager.isSelectionEqual(prevSelectedKeys)) {
				let newKeys = /* @__PURE__ */ new Set();
				for (let key of state.collection.getKeys()) if (!prevCollection.getItem(key)) newKeys.add(key);
				state.selectionManager.setSelectedKeys(newKeys);
				if (state.selectionManager.focusedKey === prevFocusedKey) {
					let first = newKeys.keys().next().value;
					if (first != null) {
						let item = state.collection.getItem(first);
						if ((item === null || item === void 0 ? void 0 : item.type) === "cell") first = item.parentKey;
						if (first != null) state.selectionManager.setFocusedKey(first);
						if (state.selectionManager.selectionMode === "none") $507fabe10e71c6fb$export$8397ddfc504fdb9a("keyboard");
					}
				}
			} else if (prevFocusedKey != null && state.selectionManager.focusedKey === prevFocusedKey && isInternal && target.type === "item" && target.dropPosition !== "on" && draggingKeys.has((_state_collection_getItem = state.collection.getItem(prevFocusedKey)) === null || _state_collection_getItem === void 0 ? void 0 : _state_collection_getItem.parentKey)) {
				var _state_collection_getItem1;
				var _state_collection_getItem_parentKey;
				state.selectionManager.setFocusedKey((_state_collection_getItem_parentKey = (_state_collection_getItem1 = state.collection.getItem(prevFocusedKey)) === null || _state_collection_getItem1 === void 0 ? void 0 : _state_collection_getItem1.parentKey) !== null && _state_collection_getItem_parentKey !== void 0 ? _state_collection_getItem_parentKey : null);
				$507fabe10e71c6fb$export$8397ddfc504fdb9a("keyboard");
			} else if (state.selectionManager.focusedKey === prevFocusedKey && target.type === "item" && target.dropPosition === "on" && state.collection.getItem(target.key) != null) {
				state.selectionManager.setFocusedKey(target.key);
				$507fabe10e71c6fb$export$8397ddfc504fdb9a("keyboard");
			} else if (state.selectionManager.focusedKey != null && !state.selectionManager.isSelected(state.selectionManager.focusedKey)) $507fabe10e71c6fb$export$8397ddfc504fdb9a("keyboard");
			state.selectionManager.setFocused(true);
		}
	}, [localState]);
	let onDrop = (0, import_react.useCallback)((e, target) => {
		let { state } = localState;
		droppingState.current = {
			timeout: void 0,
			focusedKey: state.selectionManager.focusedKey,
			collection: state.collection,
			selectedKeys: state.selectionManager.selectedKeys,
			draggingKeys: $7252cd45fc48c07c$export$6ca6700462636d0b.draggingKeys,
			isInternal: $7252cd45fc48c07c$export$78bf638634500fa5(ref),
			target
		};
		(localState.props.onDrop || defaultOnDrop)({
			type: "drop",
			x: e.x,
			y: e.y,
			target,
			items: e.items,
			dropOperation: e.dropOperation
		});
		droppingState.current.timeout = setTimeout(() => {
			updateFocusAfterDrop();
			droppingState.current = null;
		}, 50);
	}, [
		localState,
		defaultOnDrop,
		ref,
		updateFocusAfterDrop
	]);
	(0, import_react.useEffect)(() => {
		return () => {
			if (droppingState.current) clearTimeout(droppingState.current.timeout);
		};
	}, []);
	$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
		if (droppingState.current && state.collection !== droppingState.current.collection) updateFocusAfterDrop();
	});
	let { direction } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7();
	(0, import_react.useEffect)(() => {
		if (!ref.current) return;
		let getNextTarget = (target, wrap = true, key = "down") => {
			return $e154566cef11553b$export$ff7962acd6052c28(localState.props.keyboardDelegate, localState.state.collection, target, key, direction === "rtl", wrap);
		};
		let getPreviousTarget = (target, wrap = true) => {
			return getNextTarget(target, wrap, "up");
		};
		let nextValidTarget = (target, types, allowedDropOperations, getNextTarget, wrap = true) => {
			let seenRoot = 0;
			let operation;
			let { draggingKeys } = $7252cd45fc48c07c$export$6ca6700462636d0b;
			let isInternal = $7252cd45fc48c07c$export$78bf638634500fa5(ref);
			do {
				let nextTarget = getNextTarget(target, wrap);
				if (!nextTarget) return null;
				target = nextTarget;
				operation = localState.state.getDropOperation({
					target: nextTarget,
					types,
					allowedOperations: allowedDropOperations,
					isInternal,
					draggingKeys
				});
				if (target.type === "root") seenRoot++;
			} while (operation === "cancel" && !localState.state.isDropTarget(target) && seenRoot < 2);
			if (operation === "cancel") return null;
			return target;
		};
		return $67560de7c78cb232$export$c28d9fb4a54e471a({
			element: ref.current,
			preventFocusOnDrop: true,
			getDropOperation(types, allowedOperations) {
				if (localState.state.target) {
					let { draggingKeys } = $7252cd45fc48c07c$export$6ca6700462636d0b;
					let isInternal = $7252cd45fc48c07c$export$78bf638634500fa5(ref);
					return localState.state.getDropOperation({
						target: localState.state.target,
						types,
						allowedOperations,
						isInternal,
						draggingKeys
					});
				}
				return nextValidTarget(null, types, allowedOperations, getNextTarget) ? "move" : "cancel";
			},
			onDropEnter(e, drag) {
				let types = $7252cd45fc48c07c$export$e1d41611756c6326(drag.items);
				let selectionManager = localState.state.selectionManager;
				let target = null;
				$7252cd45fc48c07c$export$dac8db29d42db9a1(ref);
				let key = selectionManager.focusedKey;
				let dropPosition = "after";
				let item = key != null ? localState.state.collection.getItem(key) : null;
				if ((item === null || item === void 0 ? void 0 : item.type) === "cell") key = item.parentKey;
				if (key != null && selectionManager.isSelected(key)) if (selectionManager.selectedKeys.size > 1 && selectionManager.firstSelectedKey === key) dropPosition = "before";
				else key = selectionManager.lastSelectedKey;
				if (key != null) {
					target = {
						type: "item",
						key,
						dropPosition
					};
					let { draggingKeys } = $7252cd45fc48c07c$export$6ca6700462636d0b;
					let isInternal = $7252cd45fc48c07c$export$78bf638634500fa5(ref);
					var _nextValidTarget;
					if (localState.state.getDropOperation({
						target,
						types,
						allowedOperations: drag.allowedDropOperations,
						isInternal,
						draggingKeys
					}) === "cancel") target = (_nextValidTarget = nextValidTarget(target, types, drag.allowedDropOperations, getNextTarget, false)) !== null && _nextValidTarget !== void 0 ? _nextValidTarget : nextValidTarget(target, types, drag.allowedDropOperations, getPreviousTarget, false);
				}
				if (!target) target = nextValidTarget(null, types, drag.allowedDropOperations, getNextTarget);
				localState.state.setTarget(target);
			},
			onDropExit() {
				$7252cd45fc48c07c$export$dac8db29d42db9a1(void 0);
				localState.state.setTarget(null);
			},
			onDropTargetEnter(target) {
				localState.state.setTarget(target);
			},
			onDropActivate(e, target) {
				if ((target === null || target === void 0 ? void 0 : target.type) === "item" && (target === null || target === void 0 ? void 0 : target.dropPosition) === "on" && typeof localState.props.onDropActivate === "function") localState.props.onDropActivate({
					type: "dropactivate",
					x: e.x,
					y: e.y,
					target
				});
			},
			onDrop(e, target) {
				$7252cd45fc48c07c$export$dac8db29d42db9a1(ref);
				if (localState.state.target) onDrop(e, target || localState.state.target);
			},
			onKeyDown(e, drag) {
				var _localState_props_onKeyDown, _localState_props;
				let { keyboardDelegate } = localState.props;
				let types = $7252cd45fc48c07c$export$e1d41611756c6326(drag.items);
				switch (e.key) {
					case "ArrowDown":
						if (keyboardDelegate.getKeyBelow) {
							let target = nextValidTarget(localState.state.target, types, drag.allowedDropOperations, (target, wrap) => getNextTarget(target, wrap, "down"));
							localState.state.setTarget(target);
						}
						break;
					case "ArrowUp":
						if (keyboardDelegate.getKeyAbove) {
							let target = nextValidTarget(localState.state.target, types, drag.allowedDropOperations, (target, wrap) => getNextTarget(target, wrap, "up"));
							localState.state.setTarget(target);
						}
						break;
					case "ArrowLeft":
						if (keyboardDelegate.getKeyLeftOf) {
							let target = nextValidTarget(localState.state.target, types, drag.allowedDropOperations, (target, wrap) => getNextTarget(target, wrap, "left"));
							localState.state.setTarget(target);
						}
						break;
					case "ArrowRight":
						if (keyboardDelegate.getKeyRightOf) {
							let target = nextValidTarget(localState.state.target, types, drag.allowedDropOperations, (target, wrap) => getNextTarget(target, wrap, "right"));
							localState.state.setTarget(target);
						}
						break;
					case "Home":
						if (keyboardDelegate.getFirstKey) {
							let target = nextValidTarget(null, types, drag.allowedDropOperations, getNextTarget);
							localState.state.setTarget(target);
						}
						break;
					case "End":
						if (keyboardDelegate.getLastKey) {
							let target = nextValidTarget(null, types, drag.allowedDropOperations, getPreviousTarget);
							localState.state.setTarget(target);
						}
						break;
					case "PageDown":
						if (keyboardDelegate.getKeyPageBelow) {
							let target = localState.state.target;
							if (!target) target = nextValidTarget(null, types, drag.allowedDropOperations, getNextTarget);
							else {
								var _keyboardDelegate_getFirstKey, _keyboardDelegate_getLastKey;
								let targetKey = (_keyboardDelegate_getFirstKey = keyboardDelegate.getFirstKey) === null || _keyboardDelegate_getFirstKey === void 0 ? void 0 : _keyboardDelegate_getFirstKey.call(keyboardDelegate);
								if (target.type === "item") targetKey = target.key;
								let nextKey = null;
								if (targetKey != null) nextKey = keyboardDelegate.getKeyPageBelow(targetKey);
								let dropPosition = target.type === "item" ? target.dropPosition : "after";
								if (nextKey == null || target.type === "item" && target.key === ((_keyboardDelegate_getLastKey = keyboardDelegate.getLastKey) === null || _keyboardDelegate_getLastKey === void 0 ? void 0 : _keyboardDelegate_getLastKey.call(keyboardDelegate))) {
									var _keyboardDelegate_getLastKey1;
									var _keyboardDelegate_getLastKey2;
									nextKey = (_keyboardDelegate_getLastKey2 = (_keyboardDelegate_getLastKey1 = keyboardDelegate.getLastKey) === null || _keyboardDelegate_getLastKey1 === void 0 ? void 0 : _keyboardDelegate_getLastKey1.call(keyboardDelegate)) !== null && _keyboardDelegate_getLastKey2 !== void 0 ? _keyboardDelegate_getLastKey2 : null;
									dropPosition = "after";
								}
								if (nextKey == null) break;
								target = {
									type: "item",
									key: nextKey,
									dropPosition
								};
								let { draggingCollectionRef, draggingKeys } = $7252cd45fc48c07c$export$6ca6700462636d0b;
								let isInternal = (draggingCollectionRef === null || draggingCollectionRef === void 0 ? void 0 : draggingCollectionRef.current) === (ref === null || ref === void 0 ? void 0 : ref.current);
								let operation = localState.state.getDropOperation({
									target,
									types,
									allowedOperations: drag.allowedDropOperations,
									isInternal,
									draggingKeys
								});
								var _nextValidTarget;
								if (operation === "cancel") target = (_nextValidTarget = nextValidTarget(target, types, drag.allowedDropOperations, getNextTarget, false)) !== null && _nextValidTarget !== void 0 ? _nextValidTarget : nextValidTarget(target, types, drag.allowedDropOperations, getPreviousTarget, false);
							}
							localState.state.setTarget(target !== null && target !== void 0 ? target : localState.state.target);
						}
						break;
					case "PageUp": {
						if (!keyboardDelegate.getKeyPageAbove) break;
						let target = localState.state.target;
						if (!target) target = nextValidTarget(null, types, drag.allowedDropOperations, getPreviousTarget);
						else if (target.type === "item") {
							var _keyboardDelegate_getFirstKey1;
							if (target.key === ((_keyboardDelegate_getFirstKey1 = keyboardDelegate.getFirstKey) === null || _keyboardDelegate_getFirstKey1 === void 0 ? void 0 : _keyboardDelegate_getFirstKey1.call(keyboardDelegate))) target = { type: "root" };
							else {
								let nextKey = keyboardDelegate.getKeyPageAbove(target.key);
								let dropPosition = target.dropPosition;
								if (nextKey == null) {
									var _keyboardDelegate_getFirstKey2;
									nextKey = (_keyboardDelegate_getFirstKey2 = keyboardDelegate.getFirstKey) === null || _keyboardDelegate_getFirstKey2 === void 0 ? void 0 : _keyboardDelegate_getFirstKey2.call(keyboardDelegate);
									dropPosition = "before";
								}
								if (nextKey == null) break;
								target = {
									type: "item",
									key: nextKey,
									dropPosition
								};
							}
							let { draggingKeys } = $7252cd45fc48c07c$export$6ca6700462636d0b;
							let isInternal = $7252cd45fc48c07c$export$78bf638634500fa5(ref);
							let operation = localState.state.getDropOperation({
								target,
								types,
								allowedOperations: drag.allowedDropOperations,
								isInternal,
								draggingKeys
							});
							var _nextValidTarget1;
							if (operation === "cancel") target = (_nextValidTarget1 = nextValidTarget(target, types, drag.allowedDropOperations, getPreviousTarget, false)) !== null && _nextValidTarget1 !== void 0 ? _nextValidTarget1 : nextValidTarget(target, types, drag.allowedDropOperations, getNextTarget, false);
						}
						localState.state.setTarget(target !== null && target !== void 0 ? target : localState.state.target);
						break;
					}
				}
				(_localState_props_onKeyDown = (_localState_props = localState.props).onKeyDown) === null || _localState_props_onKeyDown === void 0 || _localState_props_onKeyDown.call(_localState_props, e);
			}
		});
	}, [
		localState,
		ref,
		onDrop,
		direction
	]);
	let id = $bdb11010cef70236$export$f680877a34711e37();
	$7252cd45fc48c07c$export$dfdf5deeaf27473f.set(state, {
		id,
		ref
	});
	return { collectionProps: $3ef42575df84b30b$export$9d1611c77c2fe928(dropProps, {
		id,
		"aria-describedby": null
	}) };
}
//#endregion
//#region ../../node_modules/@react-aria/dnd/dist/useDroppableItem.mjs
function $bfaab576ce1c580e$export$f7b0c5d28b66b6a5(options, state, ref) {
	let { dropProps } = $224594fe3e57ff1e$export$62447ad3d2ec7da6();
	let droppableCollectionRef = $7252cd45fc48c07c$export$7e397efd01d3db27(state);
	(0, import_react.useEffect)(() => {
		if (ref.current) return $67560de7c78cb232$export$aef80212ac99c003({
			element: ref.current,
			target: options.target,
			getDropOperation(types, allowedOperations) {
				let { draggingKeys } = $7252cd45fc48c07c$export$6ca6700462636d0b;
				let isInternal = $7252cd45fc48c07c$export$78bf638634500fa5(droppableCollectionRef);
				return state.getDropOperation({
					target: options.target,
					types,
					allowedOperations,
					isInternal,
					draggingKeys
				});
			},
			activateButtonRef: options.activateButtonRef
		});
	}, [
		ref,
		options.target,
		state,
		droppableCollectionRef,
		options.activateButtonRef
	]);
	let dragSession = $67560de7c78cb232$export$418e185dd3f1b968();
	let { draggingKeys } = $7252cd45fc48c07c$export$6ca6700462636d0b;
	let isInternal = $7252cd45fc48c07c$export$78bf638634500fa5(droppableCollectionRef);
	let isValidDropTarget = dragSession && state.getDropOperation({
		target: options.target,
		types: $7252cd45fc48c07c$export$e1d41611756c6326(dragSession.dragTarget.items),
		allowedOperations: dragSession.dragTarget.allowedDropOperations,
		isInternal,
		draggingKeys
	}) !== "cancel";
	let isDropTarget = state.isDropTarget(options.target);
	(0, import_react.useEffect)(() => {
		if (dragSession && isDropTarget && ref.current) ref.current.focus();
	}, [
		isDropTarget,
		dragSession,
		ref
	]);
	return {
		dropProps: {
			...dropProps,
			"aria-hidden": !dragSession || isValidDropTarget ? void 0 : "true"
		},
		isDropTarget
	};
}
//#endregion
//#region ../../node_modules/@react-aria/dnd/dist/useDropIndicator.mjs
function $parcel$interopDefault$1(a) {
	return a && a.__esModule ? a.default : a;
}
function $ddf25448c71fc93a$export$8d0e41d2815afac5(props, state, ref) {
	let { target } = props;
	let { collection } = state;
	let stringFormatter = $fca6afa0e843324b$export$f12b703ca79dfbb1($parcel$interopDefault$1($865c2eb7c00a83f1$exports), "@react-aria/dnd");
	let dragSession = $67560de7c78cb232$export$418e185dd3f1b968();
	let { dropProps } = $bfaab576ce1c580e$export$f7b0c5d28b66b6a5(props, state, ref);
	let id = $bdb11010cef70236$export$f680877a34711e37();
	let getText = (key) => {
		var _collection_getTextValue, _collection_getItem;
		var _collection_getTextValue1, _ref;
		if (key == null) return "";
		else return (_ref = (_collection_getTextValue1 = (_collection_getTextValue = collection.getTextValue) === null || _collection_getTextValue === void 0 ? void 0 : _collection_getTextValue.call(collection, key)) !== null && _collection_getTextValue1 !== void 0 ? _collection_getTextValue1 : (_collection_getItem = collection.getItem(key)) === null || _collection_getItem === void 0 ? void 0 : _collection_getItem.textValue) !== null && _ref !== void 0 ? _ref : "";
	};
	let label = "";
	let labelledBy;
	if (target.type === "root") {
		label = stringFormatter.format("dropOnRoot");
		labelledBy = `${id} ${$7252cd45fc48c07c$export$3093291712f09a77(state)}`;
	} else if (target.dropPosition === "on") label = stringFormatter.format("dropOnItem", { itemText: getText(target.key) });
	else {
		let before;
		let after;
		if (target.dropPosition === "before") {
			var _collection_getItem;
			let prevKey = (_collection_getItem = collection.getItem(target.key)) === null || _collection_getItem === void 0 ? void 0 : _collection_getItem.prevKey;
			let prevNode = prevKey != null ? collection.getItem(prevKey) : null;
			before = (prevNode === null || prevNode === void 0 ? void 0 : prevNode.type) === "item" ? prevNode.key : null;
		} else before = target.key;
		if (target.dropPosition === "after") {
			var _collection_getItem1;
			let nextKey = (_collection_getItem1 = collection.getItem(target.key)) === null || _collection_getItem1 === void 0 ? void 0 : _collection_getItem1.nextKey;
			let nextNode = nextKey != null ? collection.getItem(nextKey) : null;
			after = (nextNode === null || nextNode === void 0 ? void 0 : nextNode.type) === "item" ? nextNode.key : null;
		} else after = target.key;
		if (before != null && after != null) label = stringFormatter.format("insertBetween", {
			beforeItemText: getText(before),
			afterItemText: getText(after)
		});
		else if (before != null) label = stringFormatter.format("insertAfter", { itemText: getText(before) });
		else if (after != null) label = stringFormatter.format("insertBefore", { itemText: getText(after) });
	}
	let isDropTarget = state.isDropTarget(target);
	let ariaHidden = !dragSession ? "true" : dropProps["aria-hidden"];
	return {
		dropIndicatorProps: {
			...dropProps,
			id,
			"aria-roledescription": stringFormatter.format("dropIndicator"),
			"aria-label": label,
			"aria-labelledby": labelledBy,
			"aria-hidden": ariaHidden,
			tabIndex: -1
		},
		isDropTarget,
		isHidden: !isDropTarget && !!ariaHidden
	};
}
//#endregion
//#region ../../node_modules/@react-aria/dnd/dist/useDraggableItem.mjs
function $parcel$interopDefault(a) {
	return a && a.__esModule ? a.default : a;
}
var $fd98cf7cbf233429$var$MESSAGES = {
	keyboard: {
		selected: "dragSelectedKeyboard",
		notSelected: "dragDescriptionKeyboard"
	},
	touch: {
		selected: "dragSelectedLongPress",
		notSelected: "dragDescriptionLongPress"
	},
	virtual: {
		selected: "dragDescriptionVirtual",
		notSelected: "dragDescriptionVirtual"
	}
};
function $fd98cf7cbf233429$export$b35afafff42da2d9(props, state) {
	let stringFormatter = $fca6afa0e843324b$export$f12b703ca79dfbb1($parcel$interopDefault($865c2eb7c00a83f1$exports), "@react-aria/dnd");
	let isDisabled = state.isDisabled || state.selectionManager.isDisabled(props.key);
	let { dragProps, dragButtonProps } = $8253ed7ece74b463$export$7941f8aafa4b6021({
		getItems() {
			return state.getItems(props.key);
		},
		preview: state.preview,
		getAllowedDropOperations: state.getAllowedDropOperations,
		hasDragButton: props.hasDragButton,
		onDragStart(e) {
			state.startDrag(props.key, e);
			$7252cd45fc48c07c$export$72cb63bdda528276(state.draggingKeys);
		},
		onDragMove(e) {
			state.moveDrag(e);
		},
		onDragEnd(e) {
			let { dropOperation } = e;
			let isInternal = dropOperation === "cancel" ? false : $7252cd45fc48c07c$export$78bf638634500fa5();
			state.endDrag({
				...e,
				keys: state.draggingKeys,
				isInternal
			});
			$7252cd45fc48c07c$export$70936501603e6c57();
		}
	});
	let item = state.collection.getItem(props.key);
	let numKeysForDrag = state.getKeysForDrag(props.key).size;
	let isSelected = numKeysForDrag > 1 && state.selectionManager.isSelected(props.key);
	let dragButtonLabel;
	let description;
	let modality = $7252cd45fc48c07c$export$49bac5d6d4b352ea();
	if (!props.hasDragButton && state.selectionManager.selectionMode !== "none") {
		let msg = $fd98cf7cbf233429$var$MESSAGES[modality][isSelected ? "selected" : "notSelected"];
		if (props.hasAction && modality === "keyboard") msg += "Alt";
		if (isSelected) description = stringFormatter.format(msg, { count: numKeysForDrag });
		else description = stringFormatter.format(msg);
		delete dragProps.onClick;
	} else if (isSelected) dragButtonLabel = stringFormatter.format("dragSelectedItems", { count: numKeysForDrag });
	else {
		var _state_collection_getTextValue, _state_collection;
		var _state_collection_getTextValue1, _ref;
		let itemText = (_ref = (_state_collection_getTextValue1 = (_state_collection_getTextValue = (_state_collection = state.collection).getTextValue) === null || _state_collection_getTextValue === void 0 ? void 0 : _state_collection_getTextValue.call(_state_collection, props.key)) !== null && _state_collection_getTextValue1 !== void 0 ? _state_collection_getTextValue1 : item === null || item === void 0 ? void 0 : item.textValue) !== null && _ref !== void 0 ? _ref : "";
		dragButtonLabel = stringFormatter.format("dragItem", { itemText });
	}
	let descriptionProps = $ef06256079686ba0$export$f8aeda7b10753fa1(description);
	if (description) Object.assign(dragProps, descriptionProps);
	if (!props.hasDragButton && props.hasAction) {
		let { onKeyDownCapture, onKeyUpCapture } = dragProps;
		if (modality === "touch") delete dragProps["aria-describedby"];
		dragProps.onKeyDownCapture = (e) => {
			if (e.altKey) onKeyDownCapture === null || onKeyDownCapture === void 0 || onKeyDownCapture(e);
		};
		dragProps.onKeyUpCapture = (e) => {
			if (e.altKey) onKeyUpCapture === null || onKeyUpCapture === void 0 || onKeyUpCapture(e);
		};
	}
	return {
		dragProps: isDisabled ? {} : dragProps,
		dragButtonProps: {
			...dragButtonProps,
			isDisabled,
			"aria-label": dragButtonLabel
		}
	};
}
//#endregion
//#region ../../node_modules/@react-aria/dnd/dist/useDraggableCollection.mjs
function $4ac1fdc3a0fcd564$export$2962a7984b2f0a80(props, state, ref) {
	let { draggingCollectionRef } = $7252cd45fc48c07c$export$6ca6700462636d0b;
	if (state.draggingKeys.size > 0 && (draggingCollectionRef === null || draggingCollectionRef === void 0 ? void 0 : draggingCollectionRef.current) !== ref.current) $7252cd45fc48c07c$export$f2be18a910c0caa6(ref);
}
//#endregion
//#region ../../node_modules/@react-aria/dnd/dist/ListDropTargetDelegate.mjs
var $3ca85212bf8898e4$export$fbd65d14c79e28cc = class {
	getPrimaryStart(rect) {
		return this.orientation === "horizontal" ? rect.left : rect.top;
	}
	getPrimaryEnd(rect) {
		return this.orientation === "horizontal" ? rect.right : rect.bottom;
	}
	getSecondaryStart(rect) {
		return this.orientation === "horizontal" ? rect.top : rect.left;
	}
	getSecondaryEnd(rect) {
		return this.orientation === "horizontal" ? rect.bottom : rect.right;
	}
	getFlowStart(rect) {
		return this.layout === "stack" ? this.getPrimaryStart(rect) : this.getSecondaryStart(rect);
	}
	getFlowEnd(rect) {
		return this.layout === "stack" ? this.getPrimaryEnd(rect) : this.getSecondaryEnd(rect);
	}
	getFlowSize(rect) {
		return this.getFlowEnd(rect) - this.getFlowStart(rect);
	}
	getDropTargetFromPoint(x, y, isValidDropTarget) {
		var _this_ref_current;
		if (this.collection[Symbol.iterator]().next().done || !this.ref.current) return { type: "root" };
		let rect = this.ref.current.getBoundingClientRect();
		let primary = this.orientation === "horizontal" ? x : y;
		let secondary = this.orientation === "horizontal" ? y : x;
		primary += this.getPrimaryStart(rect);
		secondary += this.getSecondaryStart(rect);
		let flow = this.layout === "stack" ? primary : secondary;
		let isPrimaryRTL = this.orientation === "horizontal" && this.direction === "rtl";
		let isSecondaryRTL = this.layout === "grid" && this.orientation === "vertical" && this.direction === "rtl";
		let isFlowRTL = this.layout === "stack" ? isPrimaryRTL : isSecondaryRTL;
		let collection = (_this_ref_current = this.ref.current) === null || _this_ref_current === void 0 ? void 0 : _this_ref_current.dataset.collection;
		let elements = this.ref.current.querySelectorAll(collection ? `[data-collection="${CSS.escape(collection)}"]` : "[data-key]");
		let elementMap = /* @__PURE__ */ new Map();
		for (let item of elements) if (item instanceof HTMLElement && item.dataset.key != null) elementMap.set(item.dataset.key, item);
		let items = [...this.collection].filter((item) => item.type === "item");
		if (items.length < 1) return { type: "root" };
		let low = 0;
		let high = items.length;
		while (low < high) {
			let mid = Math.floor((low + high) / 2);
			let item = items[mid];
			let element = elementMap.get(String(item.key));
			if (!element) break;
			let rect = element.getBoundingClientRect();
			let update = (isGreater) => {
				if (isGreater) low = mid + 1;
				else high = mid;
			};
			if (primary < this.getPrimaryStart(rect)) update(isPrimaryRTL);
			else if (primary > this.getPrimaryEnd(rect)) update(!isPrimaryRTL);
			else if (secondary < this.getSecondaryStart(rect)) update(isSecondaryRTL);
			else if (secondary > this.getSecondaryEnd(rect)) update(!isSecondaryRTL);
			else {
				let target = {
					type: "item",
					key: item.key,
					dropPosition: "on"
				};
				if (isValidDropTarget(target)) {
					if (flow <= this.getFlowStart(rect) + 5 && isValidDropTarget({
						...target,
						dropPosition: "before"
					})) target.dropPosition = isFlowRTL ? "after" : "before";
					else if (flow >= this.getFlowEnd(rect) - 5 && isValidDropTarget({
						...target,
						dropPosition: "after"
					})) target.dropPosition = isFlowRTL ? "before" : "after";
				} else {
					let mid = this.getFlowStart(rect) + this.getFlowSize(rect) / 2;
					if (flow <= mid && isValidDropTarget({
						...target,
						dropPosition: "before"
					})) target.dropPosition = isFlowRTL ? "after" : "before";
					else if (flow >= mid && isValidDropTarget({
						...target,
						dropPosition: "after"
					})) target.dropPosition = isFlowRTL ? "before" : "after";
				}
				return target;
			}
		}
		let item = items[Math.min(low, items.length - 1)];
		let element = elementMap.get(String(item.key));
		rect = element === null || element === void 0 ? void 0 : element.getBoundingClientRect();
		if (rect && (primary < this.getPrimaryStart(rect) || Math.abs(flow - this.getFlowStart(rect)) < Math.abs(flow - this.getFlowEnd(rect)))) return {
			type: "item",
			key: item.key,
			dropPosition: isFlowRTL ? "after" : "before"
		};
		return {
			type: "item",
			key: item.key,
			dropPosition: isFlowRTL ? "before" : "after"
		};
	}
	constructor(collection, ref, options) {
		this.collection = collection;
		this.ref = ref;
		this.layout = (options === null || options === void 0 ? void 0 : options.layout) || "stack";
		this.orientation = (options === null || options === void 0 ? void 0 : options.orientation) || "vertical";
		this.direction = (options === null || options === void 0 ? void 0 : options.direction) || "ltr";
	}
};
//#endregion
//#region ../../node_modules/@react-stately/dnd/dist/useDraggableCollectionState.mjs
function $b45bbbaf0c3785df$export$29efd034f1d79f81(props) {
	let { getItems, isDisabled, collection, selectionManager, onDragStart, onDragMove, onDragEnd, preview, getAllowedDropOperations } = props;
	let [, setDragging] = (0, import_react.useState)(false);
	let draggingKeys = (0, import_react.useRef)(/* @__PURE__ */ new Set());
	let draggedKey = (0, import_react.useRef)(null);
	let getKeys = (key) => {
		let keys = /* @__PURE__ */ new Set();
		if (selectionManager.isSelected(key)) for (let currentKey of selectionManager.selectedKeys) {
			let node = collection.getItem(currentKey);
			if (node) {
				let isChild = false;
				let parentKey = node.parentKey;
				while (parentKey != null) {
					if (selectionManager.selectedKeys.has(parentKey)) {
						isChild = true;
						break;
					}
					let parentNode = collection.getItem(parentKey);
					parentKey = parentNode ? parentNode.parentKey : null;
				}
				if (!isChild) keys.add(currentKey);
			}
		}
		else keys.add(key);
		return keys;
	};
	return {
		collection,
		selectionManager,
		get draggedKey() {
			return draggedKey.current;
		},
		get draggingKeys() {
			return draggingKeys.current;
		},
		isDragging(key) {
			return draggingKeys.current.has(key);
		},
		getKeysForDrag: getKeys,
		getItems(key) {
			let keys = getKeys(key);
			let items = [];
			for (let key of keys) {
				var _collection_getItem;
				let value = (_collection_getItem = collection.getItem(key)) === null || _collection_getItem === void 0 ? void 0 : _collection_getItem.value;
				if (value != null) items.push(value);
			}
			return getItems(getKeys(key), items);
		},
		isDisabled,
		preview,
		getAllowedDropOperations,
		startDrag(key, event) {
			let keys = getKeys(key);
			draggingKeys.current = keys;
			draggedKey.current = key;
			selectionManager.setFocused(false);
			setDragging(true);
			if (typeof onDragStart === "function") onDragStart({
				...event,
				keys
			});
		},
		moveDrag(event) {
			if (typeof onDragMove === "function") onDragMove({
				...event,
				keys: draggingKeys.current
			});
		},
		endDrag(event) {
			let { isInternal } = event;
			if (typeof onDragEnd === "function") onDragEnd({
				...event,
				keys: draggingKeys.current,
				isInternal
			});
			draggingKeys.current = /* @__PURE__ */ new Set();
			draggedKey.current = null;
			setDragging(false);
		}
	};
}
//#endregion
//#region ../../node_modules/@react-stately/dnd/dist/useDroppableCollectionState.mjs
function $e672e8bc247525d1$export$926850f6ecef79d0(props) {
	let { acceptedDragTypes = "all", isDisabled, onInsert, onRootDrop, onItemDrop, onReorder, onMove, shouldAcceptItemDrop, collection, selectionManager, onDropEnter, getDropOperation, onDrop } = props;
	let [target, setTarget] = (0, import_react.useState)(null);
	let targetRef = (0, import_react.useRef)(null);
	let getOppositeTarget = (target) => {
		if (target.dropPosition === "before") {
			let node = collection.getItem(target.key);
			return node && node.prevKey != null ? {
				type: "item",
				key: node.prevKey,
				dropPosition: "after"
			} : null;
		} else if (target.dropPosition === "after") {
			let node = collection.getItem(target.key);
			return node && node.nextKey != null ? {
				type: "item",
				key: node.nextKey,
				dropPosition: "before"
			} : null;
		}
		return null;
	};
	let defaultGetDropOperation = (0, import_react.useCallback)((e) => {
		let { target, types, allowedOperations, isInternal, draggingKeys } = e;
		if (isDisabled || !target) return "cancel";
		if (acceptedDragTypes === "all" || acceptedDragTypes.some((type) => types.has(type))) {
			let isValidInsert = onInsert && target.type === "item" && !isInternal && (target.dropPosition === "before" || target.dropPosition === "after");
			let isValidReorder = onReorder && target.type === "item" && isInternal && (target.dropPosition === "before" || target.dropPosition === "after") && $e672e8bc247525d1$var$isDraggingWithinParent(collection, target, draggingKeys);
			let isItemDropAllowed = target.type !== "item" || target.dropPosition !== "on" || !shouldAcceptItemDrop || shouldAcceptItemDrop(target, types);
			let isValidMove = onMove && target.type === "item" && isInternal && isItemDropAllowed;
			let isValidRootDrop = onRootDrop && target.type === "root" && !isInternal;
			let isValidOnItemDrop = onItemDrop && target.type === "item" && target.dropPosition === "on" && !(isInternal && target.key != null && draggingKeys.has(target.key)) && isItemDropAllowed;
			if (onDrop || isValidInsert || isValidReorder || isValidMove || isValidRootDrop || isValidOnItemDrop) if (getDropOperation) return getDropOperation(target, types, allowedOperations);
			else return allowedOperations[0];
		}
		return "cancel";
	}, [
		isDisabled,
		collection,
		acceptedDragTypes,
		getDropOperation,
		onInsert,
		onRootDrop,
		onItemDrop,
		shouldAcceptItemDrop,
		onReorder,
		onMove,
		onDrop
	]);
	return {
		collection,
		selectionManager,
		isDisabled,
		target,
		setTarget(newTarget) {
			if (this.isDropTarget(newTarget)) return;
			let target = targetRef.current;
			if (target && typeof props.onDropExit === "function") props.onDropExit({
				type: "dropexit",
				x: 0,
				y: 0,
				target
			});
			if (newTarget && typeof onDropEnter === "function") onDropEnter({
				type: "dropenter",
				x: 0,
				y: 0,
				target: newTarget
			});
			targetRef.current = newTarget !== null && newTarget !== void 0 ? newTarget : null;
			setTarget(newTarget !== null && newTarget !== void 0 ? newTarget : null);
		},
		isDropTarget(dropTarget) {
			let target = targetRef.current;
			if (!target || !dropTarget) return false;
			if ($e672e8bc247525d1$var$isEqualDropTarget(dropTarget, target)) return true;
			if ((dropTarget === null || dropTarget === void 0 ? void 0 : dropTarget.type) === "item" && (target === null || target === void 0 ? void 0 : target.type) === "item" && dropTarget.key !== target.key && dropTarget.dropPosition !== target.dropPosition && dropTarget.dropPosition !== "on" && target.dropPosition !== "on") return $e672e8bc247525d1$var$isEqualDropTarget(getOppositeTarget(dropTarget), target) || $e672e8bc247525d1$var$isEqualDropTarget(dropTarget, getOppositeTarget(target));
			return false;
		},
		getDropOperation(e) {
			return defaultGetDropOperation(e);
		}
	};
}
function $e672e8bc247525d1$var$isEqualDropTarget(a, b) {
	if (!a) return !b;
	switch (a.type) {
		case "root": return (b === null || b === void 0 ? void 0 : b.type) === "root";
		case "item": return (b === null || b === void 0 ? void 0 : b.type) === "item" && (b === null || b === void 0 ? void 0 : b.key) === a.key && (b === null || b === void 0 ? void 0 : b.dropPosition) === a.dropPosition;
	}
}
function $e672e8bc247525d1$var$isDraggingWithinParent(collection, target, draggingKeys) {
	let targetNode = collection.getItem(target.key);
	for (let key of draggingKeys) {
		let node = collection.getItem(key);
		if ((node === null || node === void 0 ? void 0 : node.parentKey) !== (targetNode === null || targetNode === void 0 ? void 0 : targetNode.parentKey)) return false;
	}
	return true;
}
//#endregion
//#region ../../node_modules/react-aria-components/dist/useDragAndDrop.mjs
function $d8f176866e6dc039$export$2cfc5be7a55829f6(options) {
	return { dragAndDropHooks: (0, import_react.useMemo)(() => {
		let { onDrop, onInsert, onItemDrop, onReorder, onMove, onRootDrop, getItems, renderDragPreview, renderDropIndicator, dropTargetDelegate } = options;
		let isDraggable = !!getItems;
		let isDroppable = !!(onDrop || onInsert || onItemDrop || onReorder || onMove || onRootDrop);
		let hooks = {};
		if (isDraggable) {
			hooks.useDraggableCollectionState = function useDraggableCollectionStateOverride(props) {
				return $b45bbbaf0c3785df$export$29efd034f1d79f81({
					...props,
					...options
				});
			};
			hooks.useDraggableCollection = $4ac1fdc3a0fcd564$export$2962a7984b2f0a80;
			hooks.useDraggableItem = $fd98cf7cbf233429$export$b35afafff42da2d9;
			hooks.DragPreview = $ad0e3f3d9c50e4ba$export$905ab40ac2179daa;
			hooks.renderDragPreview = renderDragPreview;
			hooks.isVirtualDragging = $67560de7c78cb232$export$403bc76cbf68cf60;
		}
		if (isDroppable) {
			hooks.useDroppableCollectionState = function useDroppableCollectionStateOverride(props) {
				return $e672e8bc247525d1$export$926850f6ecef79d0({
					...props,
					...options
				});
			};
			hooks.useDroppableItem = $bfaab576ce1c580e$export$f7b0c5d28b66b6a5;
			hooks.useDroppableCollection = function useDroppableCollectionOverride(props, state, ref) {
				return $4b52e4eff84e5217$export$f4e2f423c21f7b04({
					...props,
					...options
				}, state, ref);
			};
			hooks.useDropIndicator = $ddf25448c71fc93a$export$8d0e41d2815afac5;
			hooks.renderDropIndicator = renderDropIndicator;
			hooks.dropTargetDelegate = dropTargetDelegate;
			hooks.ListDropTargetDelegate = $3ca85212bf8898e4$export$fbd65d14c79e28cc;
		}
		return hooks;
	}, [options]) };
}
//#endregion
//#region ../component-library/src/Card.tsx
var import_compiler_runtime = require_compiler_runtime();
var import_jsx_runtime = require_jsx_runtime();
var Card = (0, import_react.forwardRef)(({ children, ...props }, ref) => {
	return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, {
		...props,
		ref,
		style: {
			marginTop: 15,
			marginLeft: 5,
			marginRight: 5,
			borderRadius: 6,
			backgroundColor: theme.cardBackground,
			borderColor: theme.cardBorder,
			boxShadow: "0 1px 2px #9594A8",
			...props.style
		},
		children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, {
			style: {
				borderRadius: 6,
				overflow: "hidden"
			},
			children
		})
	});
});
Card.displayName = "Card";
//#endregion
//#region src/components/SyncRefresh.tsx
function SyncRefresh(t0) {
	const $ = (0, import_compiler_runtime.c)(8);
	const { onSync, children } = t0;
	const [syncing, setSyncing] = (0, import_react.useState)(false);
	let t1;
	if ($[0] !== onSync) {
		t1 = async function onSync_() {
			setSyncing(true);
			await onSync();
			setSyncing(false);
		};
		$[0] = onSync;
		$[1] = t1;
	} else t1 = $[1];
	const onSync_ = t1;
	let t2;
	if ($[2] !== children || $[3] !== onSync_ || $[4] !== syncing) {
		t2 = children({
			refreshing: syncing,
			onRefresh: onSync_
		});
		$[2] = children;
		$[3] = onSync_;
		$[4] = syncing;
		$[5] = t2;
	} else t2 = $[5];
	let t3;
	if ($[6] !== t2) {
		t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: t2 });
		$[6] = t2;
		$[7] = t3;
	} else t3 = $[7];
	return t3;
}
//#endregion
//#region src/hooks/useOverspentCategories.ts
function useOverspentCategories({ month }) {
	const spreadsheet = useSpreadsheet();
	const [budgetType = "envelope"] = useSyncedPref("budgetType");
	const { data: { list: categories, grouped: categoryGroups } = {
		list: [],
		grouped: []
	} } = useCategories();
	const categoryGroupsById = (0, import_react.useMemo)(() => groupById(categoryGroups), [categoryGroups]);
	const categoryBalanceBindings = (0, import_react.useMemo)(() => categories.map((category) => [category.id, budgetType === "tracking" ? trackingBudget.catBalance(category.id) : envelopeBudget.catBalance(category.id)]), [budgetType, categories]);
	const categoryCarryoverBindings = (0, import_react.useMemo)(() => categories.map((category) => [category.id, budgetType === "tracking" ? trackingBudget.catCarryover(category.id) : envelopeBudget.catCarryover(category.id)]), [budgetType, categories]);
	const [overspendingByCategory, setOverspendingByCategory] = (0, import_react.useState)({});
	const [carryoverFlagByCategory, setCarryoverFlagByCategory] = (0, import_react.useState)({});
	(0, import_react.useEffect)(() => {
		setOverspendingByCategory({});
		setCarryoverFlagByCategory({});
	}, [month]);
	const sheetName = sheetForMonth(month);
	(0, import_react.useEffect)(() => {
		const unbindList = [];
		for (const [categoryId, carryoverBinding] of categoryCarryoverBindings) {
			const unbind = spreadsheet.bind(sheetName, carryoverBinding, (result) => {
				const isRolloverEnabled = Boolean(result.value);
				if (isRolloverEnabled) setCarryoverFlagByCategory((prev) => ({
					...prev,
					[categoryId]: isRolloverEnabled
				}));
				else setCarryoverFlagByCategory((prev) => {
					const { [categoryId]: _, ...rest } = prev;
					return rest;
				});
			});
			unbindList.push(unbind);
		}
		return () => {
			unbindList.forEach((unbind) => unbind());
		};
	}, [
		categoryCarryoverBindings,
		sheetName,
		spreadsheet
	]);
	(0, import_react.useEffect)(() => {
		const unbindList = [];
		for (const [categoryId, balanceBinding] of categoryBalanceBindings) {
			const unbind = spreadsheet.bind(sheetName, balanceBinding, (result) => {
				const balance = result.value;
				if (balance < 0) setOverspendingByCategory((prev) => ({
					...prev,
					[categoryId]: balance
				}));
				else if (balance >= 0) setOverspendingByCategory((prev) => {
					const { [categoryId]: _, ...rest } = prev;
					return rest;
				});
			});
			unbindList.push(unbind);
		}
		return () => {
			unbindList.forEach((unbind) => unbind());
		};
	}, [
		categoryBalanceBindings,
		sheetName,
		spreadsheet
	]);
	return (0, import_react.useMemo)(() => {
		const categoryIdsToReturn = Object.keys(overspendingByCategory).filter((id) => !carryoverFlagByCategory[id]);
		const categoriesToReturn = categories.filter((category) => categoryIdsToReturn.includes(category.id) && !category.is_income).filter((category) => budgetType === "tracking" ? !category.hidden && !categoryGroupsById[category.group]?.hidden : true);
		const amountsByCategory = new Map(categoriesToReturn.map((category) => [category.id, overspendingByCategory[category.id]]));
		return {
			categories: categoriesToReturn,
			amountsByCategory,
			totalAmount: Array.from(amountsByCategory.values()).reduce((sum, value) => sum + value, 0)
		};
	}, [
		budgetType,
		carryoverFlagByCategory,
		categories,
		categoryGroupsById,
		overspendingByCategory
	]);
}
//#endregion
//#region ../../node_modules/react-simple-pull-to-refresh/build/index.esm.js
var DIRECTION;
(function(DIRECTION) {
	DIRECTION[DIRECTION["UP"] = -1] = "UP";
	DIRECTION[DIRECTION["DOWN"] = 1] = "DOWN";
})(DIRECTION || (DIRECTION = {}));
function isOverflowScrollable(element) {
	var overflowType = getComputedStyle(element).overflowY;
	if (element === document.scrollingElement && overflowType === "visible") return true;
	if (overflowType !== "scroll" && overflowType !== "auto") return false;
	return true;
}
function isScrollable(element, direction) {
	if (!isOverflowScrollable(element)) return false;
	if (direction === DIRECTION.DOWN) return element.scrollTop + element.clientHeight < element.scrollHeight;
	if (direction === DIRECTION.UP) return element.scrollTop > 0;
	throw new Error("unsupported direction");
}
/**
* Returns whether a given element or any of its ancestors (up to rootElement) is scrollable in a given direction.
*/
function isTreeScrollable(element, direction) {
	if (isScrollable(element, direction)) return true;
	if (element.parentElement == null) return false;
	return isTreeScrollable(element.parentElement, direction);
}
function styleInject(css, ref) {
	if (ref === void 0) ref = {};
	var insertAt = ref.insertAt;
	if (!css || typeof document === "undefined") return;
	var head = document.head || document.getElementsByTagName("head")[0];
	var style = document.createElement("style");
	style.type = "text/css";
	if (insertAt === "top") if (head.firstChild) head.insertBefore(style, head.firstChild);
	else head.appendChild(style);
	else head.appendChild(style);
	if (style.styleSheet) style.styleSheet.cssText = css;
	else style.appendChild(document.createTextNode(css));
}
styleInject(".lds-ellipsis {\n  display: inline-block;\n  position: relative;\n  width: 64px;\n  height: 64px;\n}\n\n.lds-ellipsis div {\n  position: absolute;\n  top: 27px;\n  width: 11px;\n  height: 11px;\n  border-radius: 50%;\n  background: rgb(54, 54, 54);\n  animation-timing-function: cubic-bezier(0, 1, 1, 0);\n}\n\n.lds-ellipsis div:nth-child(1) {\n  left: 6px;\n  animation: lds-ellipsis1 0.6s infinite;\n}\n\n.lds-ellipsis div:nth-child(2) {\n  left: 6px;\n  animation: lds-ellipsis2 0.6s infinite;\n}\n\n.lds-ellipsis div:nth-child(3) {\n  left: 26px;\n  animation: lds-ellipsis2 0.6s infinite;\n}\n\n.lds-ellipsis div:nth-child(4) {\n  left: 45px;\n  animation: lds-ellipsis3 0.6s infinite;\n}\n\n@keyframes lds-ellipsis1 {\n  0% {\n    transform: scale(0);\n  }\n  100% {\n    transform: scale(1);\n  }\n}\n@keyframes lds-ellipsis3 {\n  0% {\n    transform: scale(1);\n  }\n  100% {\n    transform: scale(0);\n  }\n}\n@keyframes lds-ellipsis2 {\n  0% {\n    transform: translate(0, 0);\n  }\n  100% {\n    transform: translate(19px, 0);\n  }\n}");
var RefreshingContent = function() {
	return import_react.createElement("div", { className: "lds-ellipsis" }, import_react.createElement("div", null), import_react.createElement("div", null), import_react.createElement("div", null), import_react.createElement("div", null));
};
var PullingContent = function() {
	return import_react.createElement("div", null, import_react.createElement("p", null, "↧\xA0\xA0pull to refresh\xA0\xA0↧"));
};
styleInject(".ptr,\n.ptr__children {\n  height: 100%;\n  width: 100%;\n  overflow: hidden;\n  -webkit-overflow-scrolling: touch;\n  position: relative;\n}\n\n.ptr.ptr--fetch-more-treshold-breached .ptr__fetch-more {\n  display: block;\n}\n\n.ptr__fetch-more {\n  display: none;\n}\n\n/**\n  * Pull down transition \n  */\n.ptr__children,\n.ptr__pull-down {\n  transition: transform 0.2s cubic-bezier(0, 0, 0.31, 1);\n}\n\n.ptr__pull-down {\n  position: absolute;\n  overflow: hidden;\n  left: 0;\n  right: 0;\n  top: 0;\n  visibility: hidden;\n}\n.ptr__pull-down > div {\n  display: none;\n}\n\n.ptr--dragging {\n  /**\n    * Hide PullMore content is treshold breached\n    */\n}\n.ptr--dragging.ptr--pull-down-treshold-breached .ptr__pull-down--pull-more {\n  display: none;\n}\n.ptr--dragging {\n  /**\n    * Otherwize, display content\n    */\n}\n.ptr--dragging .ptr__pull-down--pull-more {\n  display: block;\n}\n\n.ptr--pull-down-treshold-breached {\n  /**\n    * Force opacity to 1 is pull down trashold breached\n    */\n}\n.ptr--pull-down-treshold-breached .ptr__pull-down {\n  opacity: 1 !important;\n}\n.ptr--pull-down-treshold-breached {\n  /**\n    * And display loader\n    */\n}\n.ptr--pull-down-treshold-breached .ptr__pull-down--loading {\n  display: block;\n}\n\n.ptr__loader {\n  margin: 0 auto;\n  text-align: center;\n}");
var PullToRefresh$1 = function(_a) {
	var _b = _a.isPullable, isPullable = _b === void 0 ? true : _b, _c = _a.canFetchMore, canFetchMore = _c === void 0 ? false : _c, onRefresh = _a.onRefresh, onFetchMore = _a.onFetchMore, _d = _a.refreshingContent, refreshingContent = _d === void 0 ? import_react.createElement(RefreshingContent, null) : _d, _e = _a.pullingContent, pullingContent = _e === void 0 ? import_react.createElement(PullingContent, null) : _e, children = _a.children, _f = _a.pullDownThreshold, pullDownThreshold = _f === void 0 ? 67 : _f, _g = _a.fetchMoreThreshold, fetchMoreThreshold = _g === void 0 ? 100 : _g, _h = _a.maxPullDownDistance, maxPullDownDistance = _h === void 0 ? 95 : _h, _j = _a.resistance, resistance = _j === void 0 ? 1 : _j, backgroundColor = _a.backgroundColor, _k = _a.className, className = _k === void 0 ? "" : _k;
	var containerRef = (0, import_react.useRef)(null);
	var childrenRef = (0, import_react.useRef)(null);
	var pullDownRef = (0, import_react.useRef)(null);
	var fetchMoreRef = (0, import_react.useRef)(null);
	var pullToRefreshThresholdBreached = false;
	var fetchMoreTresholdBreached = false;
	var isDragging = false;
	var startY = 0;
	var currentY = 0;
	(0, import_react.useEffect)(function() {
		if (!isPullable || !childrenRef || !childrenRef.current) return;
		var childrenEl = childrenRef.current;
		childrenEl.addEventListener("touchstart", onTouchStart, { passive: true });
		childrenEl.addEventListener("mousedown", onTouchStart);
		childrenEl.addEventListener("touchmove", onTouchMove, { passive: false });
		childrenEl.addEventListener("mousemove", onTouchMove);
		window.addEventListener("scroll", onScroll);
		childrenEl.addEventListener("touchend", onEnd);
		childrenEl.addEventListener("mouseup", onEnd);
		document.body.addEventListener("mouseleave", onEnd);
		return function() {
			childrenEl.removeEventListener("touchstart", onTouchStart);
			childrenEl.removeEventListener("mousedown", onTouchStart);
			childrenEl.removeEventListener("touchmove", onTouchMove);
			childrenEl.removeEventListener("mousemove", onTouchMove);
			window.removeEventListener("scroll", onScroll);
			childrenEl.removeEventListener("touchend", onEnd);
			childrenEl.removeEventListener("mouseup", onEnd);
			document.body.removeEventListener("mouseleave", onEnd);
		};
	}, [
		children,
		isPullable,
		onRefresh,
		pullDownThreshold,
		maxPullDownDistance,
		canFetchMore,
		fetchMoreThreshold
	]);
	/**
	* Check onMount / canFetchMore becomes true
	*  if fetchMoreThreshold is already breached
	*/
	(0, import_react.useEffect)(function() {
		var _a;
		/**
		* Check if it is already in fetching more state
		*/
		if (!((_a = containerRef) === null || _a === void 0 ? void 0 : _a.current)) return;
		if (containerRef.current.classList.contains("ptr--fetch-more-treshold-breached")) return;
		/**
		* Proceed
		*/
		if (canFetchMore && getScrollToBottomValue() < fetchMoreThreshold && onFetchMore) {
			containerRef.current.classList.add("ptr--fetch-more-treshold-breached");
			fetchMoreTresholdBreached = true;
			onFetchMore().then(initContainer).catch(initContainer);
		}
	}, [canFetchMore, children]);
	/**
	* Returns distance to bottom of the container
	*/
	var getScrollToBottomValue = function() {
		if (!childrenRef || !childrenRef.current) return -1;
		var scrollTop = window.scrollY;
		return childrenRef.current.scrollHeight - scrollTop - window.innerHeight;
	};
	var initContainer = function() {
		requestAnimationFrame(function() {
			/**
			* Reset Styles
			*/
			if (childrenRef.current) {
				childrenRef.current.style.overflowX = "hidden";
				childrenRef.current.style.overflowY = "auto";
				childrenRef.current.style.transform = "unset";
			}
			if (pullDownRef.current) pullDownRef.current.style.opacity = "0";
			if (containerRef.current) {
				containerRef.current.classList.remove("ptr--pull-down-treshold-breached");
				containerRef.current.classList.remove("ptr--dragging");
				containerRef.current.classList.remove("ptr--fetch-more-treshold-breached");
			}
			if (pullToRefreshThresholdBreached) pullToRefreshThresholdBreached = false;
			if (fetchMoreTresholdBreached) fetchMoreTresholdBreached = false;
		});
	};
	var onTouchStart = function(e) {
		isDragging = false;
		if (e instanceof MouseEvent) startY = e.pageY;
		if (window.TouchEvent && e instanceof TouchEvent) startY = e.touches[0].pageY;
		currentY = startY;
		if (e.type === "touchstart" && isTreeScrollable(e.target, DIRECTION.UP)) return;
		if (childrenRef.current.getBoundingClientRect().top < 0) return;
		isDragging = true;
	};
	var onTouchMove = function(e) {
		if (!isDragging) return;
		if (window.TouchEvent && e instanceof TouchEvent) currentY = e.touches[0].pageY;
		else currentY = e.pageY;
		containerRef.current.classList.add("ptr--dragging");
		if (currentY < startY) {
			isDragging = false;
			return;
		}
		if (e.cancelable) e.preventDefault();
		var yDistanceMoved = Math.min((currentY - startY) / resistance, maxPullDownDistance);
		if (yDistanceMoved >= pullDownThreshold) {
			isDragging = true;
			pullToRefreshThresholdBreached = true;
			containerRef.current.classList.remove("ptr--dragging");
			containerRef.current.classList.add("ptr--pull-down-treshold-breached");
		}
		if (yDistanceMoved >= maxPullDownDistance) return;
		pullDownRef.current.style.opacity = (yDistanceMoved / 65).toString();
		childrenRef.current.style.overflow = "visible";
		childrenRef.current.style.transform = "translate(0px, " + yDistanceMoved + "px)";
		pullDownRef.current.style.visibility = "visible";
	};
	var onScroll = function(e) {
		/**
		* Check if component has already called onFetchMore
		*/
		if (fetchMoreTresholdBreached) return;
		/**
		* Check if user breached fetchMoreThreshold
		*/
		if (canFetchMore && getScrollToBottomValue() < fetchMoreThreshold && onFetchMore) {
			fetchMoreTresholdBreached = true;
			containerRef.current.classList.add("ptr--fetch-more-treshold-breached");
			onFetchMore().then(initContainer).catch(initContainer);
		}
	};
	var onEnd = function() {
		isDragging = false;
		startY = 0;
		currentY = 0;
		if (!pullToRefreshThresholdBreached) {
			if (pullDownRef.current) pullDownRef.current.style.visibility = "hidden";
			initContainer();
			return;
		}
		if (childrenRef.current) {
			childrenRef.current.style.overflow = "visible";
			childrenRef.current.style.transform = "translate(0px, " + pullDownThreshold + "px)";
		}
		onRefresh().then(initContainer).catch(initContainer);
	};
	return import_react.createElement("div", {
		className: "ptr " + className,
		style: { backgroundColor },
		ref: containerRef
	}, import_react.createElement("div", {
		className: "ptr__pull-down",
		ref: pullDownRef
	}, import_react.createElement("div", { className: "ptr__loader ptr__pull-down--loading" }, refreshingContent), import_react.createElement("div", { className: "ptr__pull-down--pull-more" }, pullingContent)), import_react.createElement("div", {
		className: "ptr__children",
		ref: childrenRef
	}, children, import_react.createElement("div", {
		className: "ptr__fetch-more",
		ref: fetchMoreRef
	}, import_react.createElement("div", { className: "ptr__loader ptr__fetch-more--loading" }, refreshingContent))));
};
//#endregion
//#region src/components/mobile/PullToRefresh.tsx
function PullToRefresh(props) {
	const $ = (0, import_compiler_runtime.c)(9);
	let t0;
	if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
		t0 = {
			overflow: "auto",
			flex: 1
		};
		$[0] = t0;
	} else t0 = $[0];
	let t1;
	if ($[1] !== props.style) {
		t1 = css({
			"& .ptr__pull-down": { textAlign: "center" },
			"& .ptr__children": { overflow: "hidden auto" },
			...props.style || {}
		});
		$[1] = props.style;
		$[2] = t1;
	} else t1 = $[2];
	let t2;
	if ($[3] !== props) {
		t2 = async () => {
			await props.onRefresh?.();
		};
		$[3] = props;
		$[4] = t2;
	} else t2 = $[4];
	let t3;
	if ($[5] !== props || $[6] !== t1 || $[7] !== t2) {
		t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
			style: t0,
			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PullToRefresh$1, {
				pullDownThreshold: 80,
				resistance: 2,
				className: t1,
				...props,
				onRefresh: t2
			})
		});
		$[5] = props;
		$[6] = t1;
		$[7] = t2;
		$[8] = t3;
	} else t3 = $[8];
	return t3;
}
//#endregion
//#region src/components/mobile/budget/BalanceCell.tsx
function BalanceCell(t0) {
	const $ = (0, import_compiler_runtime.c)(30);
	const { binding, category, show3Columns, onPress, "aria-label": ariaLabel } = t0;
	const { t } = useTranslation();
	const [t1] = useSyncedPref("budgetType");
	const budgetType = t1 === void 0 ? "envelope" : t1;
	let t2;
	if ($[0] !== show3Columns) {
		t2 = getColumnWidth({ show3Columns });
		$[0] = show3Columns;
		$[1] = t2;
	} else t2 = $[1];
	const columnWidth = t2;
	let t3;
	if ($[2] !== budgetType || $[3] !== category.id) {
		t3 = budgetType === "tracking" ? trackingBudget.catGoal(category.id) : envelopeBudget.catGoal(category.id);
		$[2] = budgetType;
		$[3] = category.id;
		$[4] = t3;
	} else t3 = $[4];
	const goal = t3;
	let t4;
	if ($[5] !== budgetType || $[6] !== category.id) {
		t4 = budgetType === "tracking" ? trackingBudget.catLongGoal(category.id) : envelopeBudget.catLongGoal(category.id);
		$[5] = budgetType;
		$[6] = category.id;
		$[7] = t4;
	} else t4 = $[7];
	const longGoal = t4;
	let t5;
	if ($[8] !== budgetType || $[9] !== category.id) {
		t5 = budgetType === "tracking" ? trackingBudget.catBudgeted(category.id) : envelopeBudget.catBudgeted(category.id);
		$[8] = budgetType;
		$[9] = category.id;
		$[10] = t5;
	} else t5 = $[10];
	const budgeted = t5;
	let t6;
	if ($[11] !== budgetType || $[12] !== category.id) {
		t6 = budgetType === "tracking" ? trackingBudget.catCarryover(category.id) : envelopeBudget.catCarryover(category.id);
		$[11] = budgetType;
		$[12] = category.id;
		$[13] = t6;
	} else t6 = $[13];
	const carryover = t6;
	const format = useFormat();
	let t7;
	if ($[14] !== category.name || $[15] !== t) {
		t7 = t("Balance for {{categoryName}} category", { categoryName: category.name });
		$[14] = category.name;
		$[15] = t;
		$[16] = t7;
	} else t7 = $[16];
	let t8;
	if ($[17] !== ariaLabel || $[18] !== columnWidth || $[19] !== format || $[20] !== onPress) {
		t8 = (t9) => {
			const { type, value, className: defaultClassName } = t9;
			return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
				variant: "bare",
				style: {
					...PILL_STYLE,
					maxWidth: columnWidth
				},
				onPress,
				"aria-label": ariaLabel,
				children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PrivacyFilter, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AutoTextSize, {
					as: Text,
					minFontSizePx: 6,
					maxFontSizePx: 12,
					mode: "oneline",
					className: cx(defaultClassName, css({
						...styles.tnum,
						maxWidth: columnWidth,
						textAlign: "right",
						fontSize: 12
					})),
					children: format(value, type)
				}, value) })
			});
		};
		$[17] = ariaLabel;
		$[18] = columnWidth;
		$[19] = format;
		$[20] = onPress;
		$[21] = t8;
	} else t8 = $[21];
	let t9;
	if ($[22] !== binding || $[23] !== budgeted || $[24] !== carryover || $[25] !== goal || $[26] !== longGoal || $[27] !== t7 || $[28] !== t8) {
		t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BalanceWithCarryover, {
			"aria-label": t7,
			type: "financial",
			carryover,
			balance: binding,
			goal,
			budgeted,
			longGoal,
			CarryoverIndicator: MobileCarryoverIndicator,
			children: t8
		});
		$[22] = binding;
		$[23] = budgeted;
		$[24] = carryover;
		$[25] = goal;
		$[26] = longGoal;
		$[27] = t7;
		$[28] = t8;
		$[29] = t9;
	} else t9 = $[29];
	return t9;
}
function MobileCarryoverIndicator(t0) {
	const $ = (0, import_compiler_runtime.c)(5);
	const { style } = t0;
	const t1 = style?.color ?? theme.pillText;
	let t2;
	if ($[0] !== t1) {
		t2 = {
			position: "absolute",
			right: "-3px",
			top: "-5px",
			borderRadius: "50%",
			backgroundColor: t1
		};
		$[0] = t1;
		$[1] = t2;
	} else t2 = $[1];
	let t3;
	if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
		t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SvgArrowThickRight, {
			width: 11,
			height: 11,
			style: { color: theme.pillBackgroundLight }
		});
		$[2] = t3;
	} else t3 = $[2];
	let t4;
	if ($[3] !== t2) {
		t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, {
			style: t2,
			children: t3
		});
		$[3] = t2;
		$[4] = t4;
	} else t4 = $[4];
	return t4;
}
//#endregion
//#region src/components/mobile/budget/BudgetCell.tsx
function BudgetCell(t0) {
	const $ = (0, import_compiler_runtime.c)(38);
	let binding;
	let category;
	let children;
	let month;
	let onBudgetAction;
	let props;
	if ($[0] !== t0) {
		({binding, category, month, onBudgetAction, children, ...props} = t0);
		$[0] = t0;
		$[1] = binding;
		$[2] = category;
		$[3] = children;
		$[4] = month;
		$[5] = onBudgetAction;
		$[6] = props;
	} else {
		binding = $[1];
		category = $[2];
		children = $[3];
		month = $[4];
		onBudgetAction = $[5];
		props = $[6];
	}
	const { t } = useTranslation();
	const locale = useLocale();
	let t1;
	if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
		t1 = getColumnWidth();
		$[7] = t1;
	} else t1 = $[7];
	const columnWidth = t1;
	const dispatch = useDispatch();
	const format$3 = useFormat();
	const { showUndoNotification } = useUndo();
	const [t2] = useSyncedPref("budgetType");
	const budgetType = t2 === void 0 ? "envelope" : t2;
	const categoryNotes = useNotes(category.id);
	const onSaveNotes = _temp$18;
	let t3;
	if ($[8] !== category.name || $[9] !== dispatch || $[10] !== locale) {
		t3 = (id_0, month_0) => {
			dispatch(pushModal({ modal: {
				name: "notes",
				options: {
					id: id_0,
					name: category.name + " - " + format(month_0, "MMMM ''yy", locale),
					onSave: onSaveNotes
				}
			} }));
		};
		$[8] = category.name;
		$[9] = dispatch;
		$[10] = locale;
		$[11] = t3;
	} else t3 = $[11];
	const onEditNotes = t3;
	let t4;
	if ($[12] !== budgetType || $[13] !== category.id || $[14] !== category.name || $[15] !== categoryNotes || $[16] !== dispatch || $[17] !== format$3 || $[18] !== month || $[19] !== onBudgetAction || $[20] !== onEditNotes || $[21] !== showUndoNotification || $[22] !== t) {
		t4 = () => {
			const sharedOptions = {
				categoryId: category.id,
				month,
				onEditNotes,
				onUpdateBudget: (amount) => {
					onBudgetAction(month, "budget-amount", {
						category: category.id,
						amount
					});
					showUndoNotification({ message: `${category.name} budget has been updated to ${format$3(amount, "financial")}.` });
				},
				onCopyLastMonthAverage: () => {
					onBudgetAction(month, "copy-single-last", { category: category.id });
					showUndoNotification({ message: `${category.name} budget has been set to last month's budgeted amount.` });
				},
				onSetMonthsAverage: (numberOfMonths) => {
					if (numberOfMonths !== 3 && numberOfMonths !== 6 && numberOfMonths !== 12) return;
					onBudgetAction(month, `set-single-${numberOfMonths}-avg`, { category: category.id });
					showUndoNotification({ message: `${category.name} budget has been set to ${numberOfMonths === 12 ? "yearly" : `${numberOfMonths} month`} average.` });
				},
				onApplyBudgetTemplate: () => {
					onBudgetAction(month, "apply-single-category-template", { category: category.id });
					showUndoNotification({
						message: `${category.name} budget templates have been applied.`,
						pre: categoryNotes ?? void 0
					});
				}
			};
			if (budgetType === "envelope") dispatch(pushModal({ modal: {
				name: "envelope-budget-menu",
				options: sharedOptions
			} }));
			else dispatch(pushModal({ modal: {
				name: "tracking-budget-menu",
				options: {
					...sharedOptions,
					onCopyUntilYearEnd: () => {
						onBudgetAction(month, "copy-until-year-end", { category: category.id });
						showUndoNotification({ message: t("{{categoryName}} budget copied until year end.", { categoryName: category.name }) });
					}
				}
			} }));
		};
		$[12] = budgetType;
		$[13] = category.id;
		$[14] = category.name;
		$[15] = categoryNotes;
		$[16] = dispatch;
		$[17] = format$3;
		$[18] = month;
		$[19] = onBudgetAction;
		$[20] = onEditNotes;
		$[21] = showUndoNotification;
		$[22] = t;
		$[23] = t4;
	} else t4 = $[23];
	const onOpenCategoryBudgetMenu = t4;
	let t5;
	if ($[24] !== category.name || $[25] !== t) {
		t5 = t("Budgeted amount for {{categoryName}} category", { categoryName: category.name });
		$[24] = category.name;
		$[25] = t;
		$[26] = t5;
	} else t5 = $[26];
	let t6;
	if ($[27] !== category.name || $[28] !== children || $[29] !== format$3 || $[30] !== onOpenCategoryBudgetMenu || $[31] !== t) {
		t6 = (t7) => {
			const { type, name, value } = t7;
			return children?.({
				type,
				name,
				value
			}) || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
				variant: "bare",
				style: {
					...PILL_STYLE,
					maxWidth: columnWidth,
					...makeAmountGrey(value)
				},
				onPress: onOpenCategoryBudgetMenu,
				"aria-label": t("Open budget menu for {{categoryName}} category", { categoryName: category.name }),
				children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PrivacyFilter, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AutoTextSize, {
					as: Text,
					minFontSizePx: 6,
					maxFontSizePx: 12,
					mode: "oneline",
					style: {
						...styles.tnum,
						maxWidth: columnWidth,
						textAlign: "right",
						fontSize: 12
					},
					children: format$3(value, type)
				}, value) })
			});
		};
		$[27] = category.name;
		$[28] = children;
		$[29] = format$3;
		$[30] = onOpenCategoryBudgetMenu;
		$[31] = t;
		$[32] = t6;
	} else t6 = $[32];
	let t7;
	if ($[33] !== binding || $[34] !== props || $[35] !== t5 || $[36] !== t6) {
		t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CellValue, {
			binding,
			type: "financial",
			"aria-label": t5,
			...props,
			children: t6
		});
		$[33] = binding;
		$[34] = props;
		$[35] = t5;
		$[36] = t6;
		$[37] = t7;
	} else t7 = $[37];
	return t7;
}
async function _temp$18(id, notes) {
	await send("notes-save", {
		id,
		note: notes
	});
}
//#endregion
//#region src/components/mobile/budget/SpentCell.tsx
function SpentCell(t0) {
	const $ = (0, import_compiler_runtime.c)(21);
	const { binding, category, month, show3Columns, onPress } = t0;
	const { t } = useTranslation();
	const format = useFormat();
	let t1;
	if ($[0] !== show3Columns) {
		t1 = getColumnWidth({ show3Columns });
		$[0] = show3Columns;
		$[1] = t1;
	} else t1 = $[1];
	const columnWidth = t1;
	let t2;
	if ($[2] !== category || $[3] !== month) {
		t2 = {
			category,
			month
		};
		$[2] = category;
		$[3] = month;
		$[4] = t2;
	} else t2 = $[4];
	const { schedule, scheduleStatus, isScheduleRecurring } = useCategoryScheduleGoalTemplateIndicator(t2);
	let t3;
	if ($[5] !== category.name || $[6] !== t) {
		t3 = t("Spent amount for {{categoryName}} category", { categoryName: category.name });
		$[5] = category.name;
		$[6] = t;
		$[7] = t3;
	} else t3 = $[7];
	let t4;
	if ($[8] !== category.name || $[9] !== columnWidth || $[10] !== format || $[11] !== isScheduleRecurring || $[12] !== onPress || $[13] !== schedule || $[14] !== scheduleStatus || $[15] !== t) {
		t4 = (t5) => {
			const { type, value } = t5;
			return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
				variant: "bare",
				style: { ...PILL_STYLE },
				onPress,
				"aria-label": t("Show transactions for {{categoryName}} category", { categoryName: category.name }),
				children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PrivacyFilter, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AutoTextSize, {
					as: Text,
					minFontSizePx: 6,
					maxFontSizePx: 12,
					mode: "oneline",
					style: {
						...styles.tnum,
						...makeAmountGrey(value),
						maxWidth: columnWidth,
						textAlign: "right",
						fontSize: 12
					},
					children: format(value, type)
				}, value) })
			}), schedule && scheduleStatus && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, {
				style: {
					position: "absolute",
					right: "-3px",
					top: "-5px",
					borderRadius: "50%",
					color: scheduleStatus === "missed" ? theme.errorText : scheduleStatus === "due" ? theme.warningText : theme.upcomingText
				},
				children: isScheduleRecurring ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SvgArrowsSynchronize, {
					width: 11,
					height: 11
				}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SvgCalendar3, {
					width: 10,
					height: 10
				})
			})] });
		};
		$[8] = category.name;
		$[9] = columnWidth;
		$[10] = format;
		$[11] = isScheduleRecurring;
		$[12] = onPress;
		$[13] = schedule;
		$[14] = scheduleStatus;
		$[15] = t;
		$[16] = t4;
	} else t4 = $[16];
	let t5;
	if ($[17] !== binding || $[18] !== t3 || $[19] !== t4) {
		t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CellValue, {
			binding,
			type: "financial",
			"aria-label": t3,
			children: t4
		});
		$[17] = binding;
		$[18] = t3;
		$[19] = t4;
		$[20] = t5;
	} else t5 = $[20];
	return t5;
}
//#endregion
//#region src/components/mobile/budget/ExpenseCategoryListItem.tsx
function ExpenseCategoryName(t0) {
	const $ = (0, import_compiler_runtime.c)(23);
	const { category, onEditCategory, show3Columns } = t0;
	let t1;
	if ($[0] !== show3Columns) {
		t1 = getColumnWidth({
			show3Columns,
			isSidebar: true
		});
		$[0] = show3Columns;
		$[1] = t1;
	} else t1 = $[1];
	const sidebarColumnWidth = t1;
	let t2;
	if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
		t2 = {
			flex: 1,
			justifyContent: "center",
			alignItems: "flex-start"
		};
		$[2] = t2;
	} else t2 = $[2];
	let t3;
	if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
		t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
			slot: "drag",
			style: {
				opacity: 0,
				width: 1,
				height: 1,
				position: "absolute",
				overflow: "hidden"
			}
		});
		$[3] = t3;
	} else t3 = $[3];
	let t4;
	if ($[4] !== sidebarColumnWidth) {
		t4 = { maxWidth: sidebarColumnWidth };
		$[4] = sidebarColumnWidth;
		$[5] = t4;
	} else t4 = $[5];
	let t5;
	if ($[6] !== category.id || $[7] !== onEditCategory) {
		t5 = () => onEditCategory?.(category.id);
		$[6] = category.id;
		$[7] = onEditCategory;
		$[8] = t5;
	} else t5 = $[8];
	let t6;
	if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
		t6 = {
			flexDirection: "row",
			alignItems: "center",
			justifyContent: "flex-start"
		};
		$[9] = t6;
	} else t6 = $[9];
	let t7;
	if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
		t7 = styles.lineClamp(2);
		$[10] = t7;
	} else t7 = $[10];
	let t8;
	if ($[11] !== sidebarColumnWidth) {
		t8 = {
			...t7,
			width: sidebarColumnWidth,
			textAlign: "left",
			...styles.smallText
		};
		$[11] = sidebarColumnWidth;
		$[12] = t8;
	} else t8 = $[12];
	let t9;
	if ($[13] !== category.name || $[14] !== t8) {
		t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
			style: t8,
			"data-testid": "category-name",
			children: category.name
		});
		$[13] = category.name;
		$[14] = t8;
		$[15] = t9;
	} else t9 = $[15];
	let t10;
	if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
		t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SvgCheveronRight, {
			style: {
				flexShrink: 0,
				color: theme.tableTextSubdued
			},
			width: 14,
			height: 14
		});
		$[16] = t10;
	} else t10 = $[16];
	let t11;
	if ($[17] !== t9) {
		t11 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(View, {
			style: t6,
			children: [t9, t10]
		});
		$[17] = t9;
		$[18] = t11;
	} else t11 = $[18];
	let t12;
	if ($[19] !== t11 || $[20] !== t4 || $[21] !== t5) {
		t12 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(View, {
			style: t2,
			children: [t3, /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
				variant: "bare",
				style: t4,
				onPress: t5,
				children: t11
			})]
		});
		$[19] = t11;
		$[20] = t4;
		$[21] = t5;
		$[22] = t12;
	} else t12 = $[22];
	return t12;
}
function ExpenseCategoryCells(t0) {
	const $ = (0, import_compiler_runtime.c)(59);
	const { category, month, onBudgetAction, show3Columns, showBudgetedColumn, onOpenBalanceMenu, onShowActivity } = t0;
	const { t } = useTranslation();
	let t1;
	if ($[0] !== show3Columns) {
		t1 = getColumnWidth({
			show3Columns,
			isSidebar: false
		});
		$[0] = show3Columns;
		$[1] = t1;
	} else t1 = $[1];
	const columnWidth = t1;
	const [t2] = useSyncedPref("budgetType");
	const budgetType = t2 === void 0 ? "envelope" : t2;
	let t3;
	if ($[2] !== budgetType || $[3] !== category.id) {
		t3 = budgetType === "tracking" ? trackingBudget.catBudgeted(category.id) : envelopeBudget.catBudgeted(category.id);
		$[2] = budgetType;
		$[3] = category.id;
		$[4] = t3;
	} else t3 = $[4];
	const budgeted = t3;
	let t4;
	if ($[5] !== budgetType || $[6] !== category.id) {
		t4 = budgetType === "tracking" ? trackingBudget.catSumAmount(category.id) : envelopeBudget.catSumAmount(category.id);
		$[5] = budgetType;
		$[6] = category.id;
		$[7] = t4;
	} else t4 = $[7];
	const spent = t4;
	let t5;
	if ($[8] !== budgetType || $[9] !== category.id) {
		t5 = budgetType === "tracking" ? trackingBudget.catBalance(category.id) : envelopeBudget.catBalance(category.id);
		$[8] = budgetType;
		$[9] = category.id;
		$[10] = t5;
	} else t5 = $[10];
	const balance = t5;
	let t6;
	if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
		t6 = {
			justifyContent: "flex-end",
			alignItems: "center",
			flexDirection: "row"
		};
		$[11] = t6;
	} else t6 = $[11];
	let t7;
	if ($[12] !== show3Columns || $[13] !== showBudgetedColumn) {
		t7 = !show3Columns && !showBudgetedColumn && { display: "none" };
		$[12] = show3Columns;
		$[13] = showBudgetedColumn;
		$[14] = t7;
	} else t7 = $[14];
	let t8;
	if ($[15] !== columnWidth || $[16] !== t7) {
		t8 = {
			...t7,
			width: columnWidth,
			justifyContent: "center",
			alignItems: "flex-end"
		};
		$[15] = columnWidth;
		$[16] = t7;
		$[17] = t8;
	} else t8 = $[17];
	let t9;
	if ($[18] !== budgeted || $[19] !== category || $[20] !== month || $[21] !== onBudgetAction) {
		t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BudgetCell, {
			binding: budgeted,
			type: "financial",
			category,
			month,
			onBudgetAction
		});
		$[18] = budgeted;
		$[19] = category;
		$[20] = month;
		$[21] = onBudgetAction;
		$[22] = t9;
	} else t9 = $[22];
	let t10;
	if ($[23] !== t8 || $[24] !== t9) {
		t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, {
			style: t8,
			children: t9
		});
		$[23] = t8;
		$[24] = t9;
		$[25] = t10;
	} else t10 = $[25];
	let t11;
	if ($[26] !== show3Columns || $[27] !== showBudgetedColumn) {
		t11 = !show3Columns && showBudgetedColumn && { display: "none" };
		$[26] = show3Columns;
		$[27] = showBudgetedColumn;
		$[28] = t11;
	} else t11 = $[28];
	let t12;
	if ($[29] !== columnWidth || $[30] !== t11) {
		t12 = {
			...t11,
			width: columnWidth,
			justifyContent: "center",
			alignItems: "flex-end"
		};
		$[29] = columnWidth;
		$[30] = t11;
		$[31] = t12;
	} else t12 = $[31];
	let t13;
	if ($[32] !== category || $[33] !== month || $[34] !== onShowActivity || $[35] !== show3Columns || $[36] !== spent) {
		t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SpentCell, {
			binding: spent,
			category,
			month,
			show3Columns,
			onPress: onShowActivity
		});
		$[32] = category;
		$[33] = month;
		$[34] = onShowActivity;
		$[35] = show3Columns;
		$[36] = spent;
		$[37] = t13;
	} else t13 = $[37];
	let t14;
	if ($[38] !== t12 || $[39] !== t13) {
		t14 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, {
			style: t12,
			children: t13
		});
		$[38] = t12;
		$[39] = t13;
		$[40] = t14;
	} else t14 = $[40];
	let t15;
	if ($[41] !== columnWidth) {
		t15 = {
			width: columnWidth,
			justifyContent: "center",
			alignItems: "flex-end"
		};
		$[41] = columnWidth;
		$[42] = t15;
	} else t15 = $[42];
	let t16;
	if ($[43] !== category.name || $[44] !== t) {
		t16 = t("Open balance menu for {{categoryName}} category", { categoryName: category.name });
		$[43] = category.name;
		$[44] = t;
		$[45] = t16;
	} else t16 = $[45];
	let t17;
	if ($[46] !== balance || $[47] !== category || $[48] !== onOpenBalanceMenu || $[49] !== show3Columns || $[50] !== t16) {
		t17 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BalanceCell, {
			binding: balance,
			category,
			show3Columns,
			onPress: onOpenBalanceMenu,
			"aria-label": t16
		});
		$[46] = balance;
		$[47] = category;
		$[48] = onOpenBalanceMenu;
		$[49] = show3Columns;
		$[50] = t16;
		$[51] = t17;
	} else t17 = $[51];
	let t18;
	if ($[52] !== t15 || $[53] !== t17) {
		t18 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, {
			style: t15,
			children: t17
		});
		$[52] = t15;
		$[53] = t17;
		$[54] = t18;
	} else t18 = $[54];
	let t19;
	if ($[55] !== t10 || $[56] !== t14 || $[57] !== t18) {
		t19 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(View, {
			style: t6,
			children: [
				t10,
				t14,
				t18
			]
		});
		$[55] = t10;
		$[56] = t14;
		$[57] = t18;
		$[58] = t19;
	} else t19 = $[58];
	return t19;
}
function ExpenseCategoryListItem(t0) {
	const $ = (0, import_compiler_runtime.c)(77);
	let isHidden;
	let month;
	let onBudgetAction;
	let onEditCategory;
	let props;
	let show3Columns;
	let showBudgetedColumn;
	if ($[0] !== t0) {
		({month, isHidden, onEditCategory, onBudgetAction, show3Columns, showBudgetedColumn, ...props} = t0);
		$[0] = t0;
		$[1] = isHidden;
		$[2] = month;
		$[3] = onBudgetAction;
		$[4] = onEditCategory;
		$[5] = props;
		$[6] = show3Columns;
		$[7] = showBudgetedColumn;
	} else {
		isHidden = $[1];
		month = $[2];
		onBudgetAction = $[3];
		onEditCategory = $[4];
		props = $[5];
		show3Columns = $[6];
		showBudgetedColumn = $[7];
	}
	const { value: category } = props;
	const { t } = useTranslation();
	const [t1] = useSyncedPref("budgetType");
	const budgetType = t1 === void 0 ? "envelope" : t1;
	const format = useFormat();
	const balanceMenuModalName = `${budgetType}-balance-menu`;
	const dispatch = useDispatch();
	const { showUndoNotification } = useUndo();
	const { data: t2 } = useCategoriesById();
	let t3;
	if ($[8] !== t2) {
		t3 = t2 === void 0 ? { list: {} } : t2;
		$[8] = t2;
		$[9] = t3;
	} else t3 = $[9];
	const { list: categoriesById } = t3;
	let t4;
	if ($[10] !== balanceMenuModalName || $[11] !== category || $[12] !== dispatch || $[13] !== month || $[14] !== onBudgetAction) {
		t4 = (carryover) => {
			if (!category) return;
			onBudgetAction(month, "carryover", {
				category: category.id,
				flag: carryover
			});
			dispatch(collapseModals({ rootModalName: balanceMenuModalName }));
		};
		$[10] = balanceMenuModalName;
		$[11] = category;
		$[12] = dispatch;
		$[13] = month;
		$[14] = onBudgetAction;
		$[15] = t4;
	} else t4 = $[15];
	const onCarryover = t4;
	let t5;
	if ($[16] !== budgetType || $[17] !== category?.id) {
		t5 = budgetType === "envelope" ? envelopeBudget.catBalance(category?.id) : trackingBudget.catBalance(category?.id);
		$[16] = budgetType;
		$[17] = category?.id;
		$[18] = t5;
	} else t5 = $[18];
	const catBalance = useSheetValue(t5);
	let t6;
	if ($[19] !== balanceMenuModalName || $[20] !== catBalance || $[21] !== categoriesById || $[22] !== category || $[23] !== dispatch || $[24] !== format || $[25] !== month || $[26] !== onBudgetAction || $[27] !== showUndoNotification || $[28] !== t) {
		t6 = () => {
			if (!category) return;
			dispatch(pushModal({ modal: {
				name: "transfer",
				options: {
					title: category.name,
					categoryId: category.id,
					month,
					amount: catBalance || 0,
					onSubmit: (amount, toCategoryId) => {
						onBudgetAction(month, "transfer-category", {
							amount,
							from: category.id,
							to: toCategoryId,
							currencyCode: format.currency.code
						});
						dispatch(collapseModals({ rootModalName: balanceMenuModalName }));
						showUndoNotification({ message: t("Transferred {{amount}} from {{fromCategoryName}} to {{toCategoryName}}.", {
							amount: format(amount, "financial"),
							fromCategoryName: category.name,
							toCategoryName: categoriesById[toCategoryId].name
						}) });
					},
					showToBeBudgeted: true
				}
			} }));
		};
		$[19] = balanceMenuModalName;
		$[20] = catBalance;
		$[21] = categoriesById;
		$[22] = category;
		$[23] = dispatch;
		$[24] = format;
		$[25] = month;
		$[26] = onBudgetAction;
		$[27] = showUndoNotification;
		$[28] = t;
		$[29] = t6;
	} else t6 = $[29];
	const onTransfer = t6;
	let t7;
	if ($[30] !== balanceMenuModalName || $[31] !== catBalance || $[32] !== categoriesById || $[33] !== category || $[34] !== dispatch || $[35] !== format || $[36] !== month || $[37] !== onBudgetAction || $[38] !== showUndoNotification || $[39] !== t) {
		t7 = () => {
			if (!category) return;
			dispatch(pushModal({ modal: {
				name: "cover",
				options: {
					title: category.name,
					month,
					amount: catBalance,
					categoryId: category.id,
					onSubmit: (amount_0, fromCategoryId) => {
						onBudgetAction(month, "cover-overspending", {
							to: category.id,
							from: fromCategoryId,
							amount: amount_0,
							currencyCode: format.currency.code
						});
						dispatch(collapseModals({ rootModalName: balanceMenuModalName }));
						showUndoNotification({ message: t("Covered {{amount}} {{toCategoryName}} overspending from {{fromCategoryName}}.", {
							amount: format(amount_0, "financial"),
							toCategoryName: category.name,
							fromCategoryName: categoriesById[fromCategoryId].name
						}) });
					}
				}
			} }));
		};
		$[30] = balanceMenuModalName;
		$[31] = catBalance;
		$[32] = categoriesById;
		$[33] = category;
		$[34] = dispatch;
		$[35] = format;
		$[36] = month;
		$[37] = onBudgetAction;
		$[38] = showUndoNotification;
		$[39] = t;
		$[40] = t7;
	} else t7 = $[40];
	const onCover = t7;
	let t8;
	if ($[41] !== balanceMenuModalName || $[42] !== category || $[43] !== dispatch || $[44] !== month || $[45] !== onCarryover || $[46] !== onCover || $[47] !== onTransfer) {
		t8 = () => {
			if (!category) return;
			if (balanceMenuModalName === "envelope-balance-menu") dispatch(pushModal({ modal: {
				name: balanceMenuModalName,
				options: {
					month,
					categoryId: category.id,
					onCarryover,
					onTransfer,
					onCover
				}
			} }));
			else dispatch(pushModal({ modal: {
				name: balanceMenuModalName,
				options: {
					month,
					categoryId: category.id,
					onCarryover
				}
			} }));
		};
		$[41] = balanceMenuModalName;
		$[42] = category;
		$[43] = dispatch;
		$[44] = month;
		$[45] = onCarryover;
		$[46] = onCover;
		$[47] = onTransfer;
		$[48] = t8;
	} else t8 = $[48];
	const onOpenBalanceMenu = t8;
	const navigate = useNavigate();
	let t9;
	if ($[49] !== category || $[50] !== month || $[51] !== navigate) {
		t9 = () => {
			if (!category) return;
			navigate(`/categories/${category.id}?month=${month}`);
		};
		$[49] = category;
		$[50] = month;
		$[51] = navigate;
		$[52] = t9;
	} else t9 = $[52];
	const onShowActivity = t9;
	if (!category) return null;
	const t10 = isHidden ? .5 : void 0;
	const t11 = isCurrentMonth(month) ? theme.budgetCurrentMonth : theme.budgetOtherMonth;
	let t12;
	if ($[53] !== t10 || $[54] !== t11) {
		t12 = {
			height: 50,
			borderColor: theme.tableBorder,
			flexDirection: "row",
			alignItems: "center",
			justifyContent: "space-between",
			paddingLeft: 5,
			paddingRight: 5,
			borderBottomWidth: 1,
			opacity: t10,
			backgroundColor: t11
		};
		$[53] = t10;
		$[54] = t11;
		$[55] = t12;
	} else t12 = $[55];
	let t13;
	if ($[56] !== category || $[57] !== onEditCategory || $[58] !== show3Columns) {
		t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ExpenseCategoryName, {
			category,
			onEditCategory,
			show3Columns
		});
		$[56] = category;
		$[57] = onEditCategory;
		$[58] = show3Columns;
		$[59] = t13;
	} else t13 = $[59];
	const t14 = `${category.id}-${show3Columns}-${showBudgetedColumn}`;
	let t15;
	if ($[60] !== category || $[61] !== month || $[62] !== onBudgetAction || $[63] !== onOpenBalanceMenu || $[64] !== onShowActivity || $[65] !== show3Columns || $[66] !== showBudgetedColumn || $[67] !== t14) {
		t15 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ExpenseCategoryCells, {
			category,
			month,
			onBudgetAction,
			show3Columns,
			showBudgetedColumn,
			onOpenBalanceMenu,
			onShowActivity
		}, t14);
		$[60] = category;
		$[61] = month;
		$[62] = onBudgetAction;
		$[63] = onOpenBalanceMenu;
		$[64] = onShowActivity;
		$[65] = show3Columns;
		$[66] = showBudgetedColumn;
		$[67] = t14;
		$[68] = t15;
	} else t15 = $[68];
	let t16;
	if ($[69] !== t12 || $[70] !== t13 || $[71] !== t15) {
		t16 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(View, {
			style: t12,
			children: [t13, t15]
		});
		$[69] = t12;
		$[70] = t13;
		$[71] = t15;
		$[72] = t16;
	} else t16 = $[72];
	let t17;
	if ($[73] !== category.name || $[74] !== props || $[75] !== t16) {
		t17 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)($72e60046c03fbe42$export$e96fc9a8407faa6b, {
			textValue: category.name,
			"data-testid": "category-row",
			...props,
			children: t16
		});
		$[73] = category.name;
		$[74] = props;
		$[75] = t16;
		$[76] = t17;
	} else t17 = $[76];
	return t17;
}
//#endregion
//#region src/components/mobile/budget/ExpenseCategoryList.tsx
function ExpenseCategoryList(t0) {
	const $ = (0, import_compiler_runtime.c)(20);
	const { categoryGroup, categories, month, onEditCategory, onBudgetAction, show3Columns, showBudgetedColumn, shouldHideCategory } = t0;
	const { t } = useTranslation();
	const moveCategory = useMoveCategoryMutation();
	let t1;
	if ($[0] !== categories || $[1] !== moveCategory) {
		t1 = {
			getItems: _temp2$13,
			renderDropIndicator: _temp3$5,
			onReorder: (e) => {
				const [key_0] = e.keys;
				const categoryIdToMove = key_0;
				const categoryToMove = categories.find((c) => c.id === categoryIdToMove);
				if (!categoryToMove) throw new Error(`Internal error: category with ID ${categoryIdToMove} not found.`);
				if (!categoryToMove.group) throw new Error(`Internal error: category ${categoryIdToMove} is not in a group and cannot be moved.`);
				const targetCategoryId = e.target.key;
				if (e.target.dropPosition === "before") moveCategory.mutate({
					id: categoryToMove.id,
					groupId: categoryToMove.group,
					targetId: targetCategoryId
				});
				else if (e.target.dropPosition === "after") {
					const targetCategoryIndex = categories.findIndex((c_0) => c_0.id === targetCategoryId);
					if (targetCategoryIndex === -1) throw new Error(`Internal error: category with ID ${targetCategoryId} not found.`);
					const nextToTargetCategory = categories[targetCategoryIndex + 1];
					moveCategory.mutate({
						id: categoryToMove.id,
						groupId: categoryToMove.group,
						targetId: nextToTargetCategory?.id || null
					});
				}
			}
		};
		$[0] = categories;
		$[1] = moveCategory;
		$[2] = t1;
	} else t1 = $[2];
	const { dragAndDropHooks } = $d8f176866e6dc039$export$2cfc5be7a55829f6(t1);
	let t2;
	if ($[3] !== categoryGroup.name || $[4] !== t) {
		t2 = t("{{categoryGroupName}} expense group categories", { categoryGroupName: categoryGroup.name });
		$[3] = categoryGroup.name;
		$[4] = t;
		$[5] = t2;
	} else t2 = $[5];
	let t3;
	let t4;
	if ($[6] !== month || $[7] !== onBudgetAction || $[8] !== onEditCategory || $[9] !== shouldHideCategory || $[10] !== show3Columns || $[11] !== showBudgetedColumn) {
		t3 = [
			month,
			onEditCategory,
			onBudgetAction,
			shouldHideCategory,
			show3Columns,
			showBudgetedColumn
		];
		t4 = (category) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ExpenseCategoryListItem, {
			value: category,
			month,
			onEditCategory,
			onBudgetAction,
			isHidden: shouldHideCategory(category),
			show3Columns,
			showBudgetedColumn
		}, category.id);
		$[6] = month;
		$[7] = onBudgetAction;
		$[8] = onEditCategory;
		$[9] = shouldHideCategory;
		$[10] = show3Columns;
		$[11] = showBudgetedColumn;
		$[12] = t3;
		$[13] = t4;
	} else {
		t3 = $[12];
		t4 = $[13];
	}
	let t5;
	if ($[14] !== categories || $[15] !== dragAndDropHooks || $[16] !== t2 || $[17] !== t3 || $[18] !== t4) {
		t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)($72e60046c03fbe42$export$a7bfbda1311ca015, {
			"aria-label": t2,
			items: categories,
			dragAndDropHooks,
			dependencies: t3,
			children: t4
		});
		$[14] = categories;
		$[15] = dragAndDropHooks;
		$[16] = t2;
		$[17] = t3;
		$[18] = t4;
		$[19] = t5;
	} else t5 = $[19];
	return t5;
}
function _temp3$5(target) {
	return /* @__PURE__ */ (0, import_jsx_runtime.jsx)($612b8eb6cb90e02d$export$62ed72bc21f6b8a6, {
		target,
		className: css({ "&[data-drop-target]": {
			height: 4,
			backgroundColor: theme.tableBorderSeparator,
			opacity: 1,
			borderRadius: 4
		} })
	});
}
function _temp2$13(keys) {
	return [...keys].map(_temp$17);
}
function _temp$17(key) {
	return { "text/plain": key };
}
//#endregion
//#region src/components/mobile/budget/ExpenseGroupListItem.tsx
function ExpenseGroupListItem(t0) {
	const $ = (0, import_compiler_runtime.c)(44);
	let isCollapsed;
	let isHidden;
	let month;
	let onBudgetAction;
	let onEditCategory;
	let onEditCategoryGroup;
	let onToggleCollapse;
	let props;
	let show3Columns;
	let showBudgetedColumn;
	let showHiddenCategories;
	if ($[0] !== t0) {
		({onEditCategoryGroup, onEditCategory, month, onBudgetAction, showBudgetedColumn, show3Columns, showHiddenCategories, isCollapsed, onToggleCollapse, isHidden, ...props} = t0);
		$[0] = t0;
		$[1] = isCollapsed;
		$[2] = isHidden;
		$[3] = month;
		$[4] = onBudgetAction;
		$[5] = onEditCategory;
		$[6] = onEditCategoryGroup;
		$[7] = onToggleCollapse;
		$[8] = props;
		$[9] = show3Columns;
		$[10] = showBudgetedColumn;
		$[11] = showHiddenCategories;
	} else {
		isCollapsed = $[1];
		isHidden = $[2];
		month = $[3];
		onBudgetAction = $[4];
		onEditCategory = $[5];
		onEditCategoryGroup = $[6];
		onToggleCollapse = $[7];
		props = $[8];
		show3Columns = $[9];
		showBudgetedColumn = $[10];
		showHiddenCategories = $[11];
	}
	const { value: categoryGroup } = props;
	let t1;
	if ($[12] !== categoryGroup || $[13] !== isCollapsed || $[14] !== showHiddenCategories) {
		t1 = !categoryGroup || isCollapsed(categoryGroup.id) ? [] : categoryGroup.categories?.filter((category) => !category.hidden || showHiddenCategories) ?? [];
		$[12] = categoryGroup;
		$[13] = isCollapsed;
		$[14] = showHiddenCategories;
		$[15] = t1;
	} else t1 = $[15];
	const categories = t1;
	let t2;
	if ($[16] !== categoryGroup?.hidden) {
		t2 = (category_0) => !!(category_0.hidden || categoryGroup?.hidden);
		$[16] = categoryGroup?.hidden;
		$[17] = t2;
	} else t2 = $[17];
	categoryGroup?.hidden;
	const shouldHideCategory = t2;
	if (!categoryGroup) return null;
	let t3;
	if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
		t3 = {
			marginTop: 4,
			marginBottom: 4
		};
		$[18] = t3;
	} else t3 = $[18];
	let t4;
	if ($[19] !== categoryGroup || $[20] !== isCollapsed || $[21] !== isHidden || $[22] !== month || $[23] !== onEditCategoryGroup || $[24] !== onToggleCollapse || $[25] !== show3Columns || $[26] !== showBudgetedColumn) {
		t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ExpenseGroupHeader, {
			categoryGroup,
			month,
			showBudgetedColumn,
			show3Columns,
			onEditCategoryGroup,
			isCollapsed,
			onToggleCollapse,
			isHidden
		});
		$[19] = categoryGroup;
		$[20] = isCollapsed;
		$[21] = isHidden;
		$[22] = month;
		$[23] = onEditCategoryGroup;
		$[24] = onToggleCollapse;
		$[25] = show3Columns;
		$[26] = showBudgetedColumn;
		$[27] = t4;
	} else t4 = $[27];
	let t5;
	if ($[28] !== categories || $[29] !== categoryGroup || $[30] !== month || $[31] !== onBudgetAction || $[32] !== onEditCategory || $[33] !== shouldHideCategory || $[34] !== show3Columns || $[35] !== showBudgetedColumn) {
		t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ExpenseCategoryList, {
			categoryGroup,
			categories,
			month,
			onEditCategory,
			onBudgetAction,
			shouldHideCategory,
			show3Columns,
			showBudgetedColumn
		});
		$[28] = categories;
		$[29] = categoryGroup;
		$[30] = month;
		$[31] = onBudgetAction;
		$[32] = onEditCategory;
		$[33] = shouldHideCategory;
		$[34] = show3Columns;
		$[35] = showBudgetedColumn;
		$[36] = t5;
	} else t5 = $[36];
	let t6;
	if ($[37] !== t4 || $[38] !== t5) {
		t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Card, {
			style: t3,
			children: [t4, t5]
		});
		$[37] = t4;
		$[38] = t5;
		$[39] = t6;
	} else t6 = $[39];
	let t7;
	if ($[40] !== categoryGroup.name || $[41] !== props || $[42] !== t6) {
		t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)($72e60046c03fbe42$export$e96fc9a8407faa6b, {
			textValue: categoryGroup.name,
			...props,
			children: t6
		});
		$[40] = categoryGroup.name;
		$[41] = props;
		$[42] = t6;
		$[43] = t7;
	} else t7 = $[43];
	return t7;
}
function ExpenseGroupHeader(t0) {
	const $ = (0, import_compiler_runtime.c)(21);
	const { categoryGroup, month, onEditCategoryGroup, show3Columns, showBudgetedColumn, isCollapsed, onToggleCollapse, isHidden } = t0;
	let t1;
	if ($[0] !== categoryGroup.id || $[1] !== onToggleCollapse) {
		t1 = () => onToggleCollapse(categoryGroup.id);
		$[0] = categoryGroup.id;
		$[1] = onToggleCollapse;
		$[2] = t1;
	} else t1 = $[2];
	const t2 = isHidden ? .5 : void 0;
	const t3 = isCurrentMonth(month) ? theme.budgetHeaderCurrentMonth : theme.budgetHeaderOtherMonth;
	let t4;
	if ($[3] !== t2 || $[4] !== t3) {
		t4 = {
			cursor: "pointer",
			height: 50,
			borderBottomWidth: 1,
			borderColor: theme.tableBorder,
			flexDirection: "row",
			alignItems: "center",
			paddingLeft: 5,
			paddingRight: 5,
			opacity: t2,
			backgroundColor: t3
		};
		$[3] = t2;
		$[4] = t3;
		$[5] = t4;
	} else t4 = $[5];
	let t5;
	if ($[6] !== categoryGroup || $[7] !== isCollapsed || $[8] !== onEditCategoryGroup || $[9] !== onToggleCollapse || $[10] !== show3Columns) {
		t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ExpenseGroupName, {
			group: categoryGroup,
			onEditCategoryGroup,
			isCollapsed,
			onToggleCollapse,
			show3Columns
		});
		$[6] = categoryGroup;
		$[7] = isCollapsed;
		$[8] = onEditCategoryGroup;
		$[9] = onToggleCollapse;
		$[10] = show3Columns;
		$[11] = t5;
	} else t5 = $[11];
	let t6;
	if ($[12] !== categoryGroup || $[13] !== show3Columns || $[14] !== showBudgetedColumn) {
		t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ExpenseGroupCells, {
			group: categoryGroup,
			show3Columns,
			showBudgetedColumn
		});
		$[12] = categoryGroup;
		$[13] = show3Columns;
		$[14] = showBudgetedColumn;
		$[15] = t6;
	} else t6 = $[15];
	let t7;
	if ($[16] !== t1 || $[17] !== t4 || $[18] !== t5 || $[19] !== t6) {
		t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(View, {
			"data-testid": "category-group-row",
			onClick: t1,
			style: t4,
			children: [t5, t6]
		});
		$[16] = t1;
		$[17] = t4;
		$[18] = t5;
		$[19] = t6;
		$[20] = t7;
	} else t7 = $[20];
	return t7;
}
function ExpenseGroupName(t0) {
	const $ = (0, import_compiler_runtime.c)(37);
	const { group, onEditCategoryGroup, isCollapsed, onToggleCollapse, show3Columns } = t0;
	let t1;
	if ($[0] !== show3Columns) {
		t1 = getColumnWidth({
			show3Columns,
			isSidebar: true,
			offset: -3.5
		});
		$[0] = show3Columns;
		$[1] = t1;
	} else t1 = $[1];
	const sidebarColumnWidth = t1;
	let t2;
	if ($[2] !== sidebarColumnWidth) {
		t2 = {
			flex: 1,
			flexDirection: "row",
			justifyContent: "flex-start",
			width: sidebarColumnWidth
		};
		$[2] = sidebarColumnWidth;
		$[3] = t2;
	} else t2 = $[3];
	let t3;
	if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
		t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
			slot: "drag",
			style: {
				opacity: 0,
				width: 1,
				height: 1,
				position: "absolute",
				overflow: "hidden"
			}
		});
		$[4] = t3;
	} else t3 = $[4];
	let t4;
	if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
		t4 = css({
			flexShrink: 0,
			color: theme.pageTextSubdued,
			"&[data-pressed]": { backgroundColor: "transparent" },
			marginLeft: -5
		});
		$[5] = t4;
	} else t4 = $[5];
	let t5;
	if ($[6] !== group.id || $[7] !== onToggleCollapse) {
		t5 = () => onToggleCollapse(group.id);
		$[6] = group.id;
		$[7] = onToggleCollapse;
		$[8] = t5;
	} else t5 = $[8];
	const t6 = isCollapsed(group.id) ? "rotate(-90deg)" : "";
	let t7;
	if ($[9] !== t6) {
		t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SvgExpandArrow, {
			width: 8,
			height: 8,
			style: {
				flexShrink: 0,
				transition: "transform .1s",
				transform: t6
			}
		});
		$[9] = t6;
		$[10] = t7;
	} else t7 = $[10];
	let t8;
	if ($[11] !== t5 || $[12] !== t7) {
		t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
			variant: "bare",
			className: t4,
			onPress: t5,
			children: t7
		});
		$[11] = t5;
		$[12] = t7;
		$[13] = t8;
	} else t8 = $[13];
	let t9;
	if ($[14] !== sidebarColumnWidth) {
		t9 = { maxWidth: sidebarColumnWidth };
		$[14] = sidebarColumnWidth;
		$[15] = t9;
	} else t9 = $[15];
	let t10;
	if ($[16] !== group.id || $[17] !== onEditCategoryGroup) {
		t10 = () => onEditCategoryGroup(group.id);
		$[16] = group.id;
		$[17] = onEditCategoryGroup;
		$[18] = t10;
	} else t10 = $[18];
	let t11;
	if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
		t11 = {
			flexDirection: "row",
			alignItems: "center",
			justifyContent: "flex-start"
		};
		$[19] = t11;
	} else t11 = $[19];
	let t12;
	if ($[20] === Symbol.for("react.memo_cache_sentinel")) {
		t12 = styles.lineClamp(2);
		$[20] = t12;
	} else t12 = $[20];
	let t13;
	if ($[21] !== sidebarColumnWidth) {
		t13 = {
			...t12,
			width: sidebarColumnWidth,
			textAlign: "left",
			...styles.smallText,
			fontWeight: "500"
		};
		$[21] = sidebarColumnWidth;
		$[22] = t13;
	} else t13 = $[22];
	let t14;
	if ($[23] !== group.name || $[24] !== t13) {
		t14 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
			style: t13,
			"data-testid": "category-group-name",
			children: group.name
		});
		$[23] = group.name;
		$[24] = t13;
		$[25] = t14;
	} else t14 = $[25];
	let t15;
	if ($[26] === Symbol.for("react.memo_cache_sentinel")) {
		t15 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SvgCheveronRight, {
			style: {
				flexShrink: 0,
				color: theme.tableTextSubdued
			},
			width: 14,
			height: 14
		});
		$[26] = t15;
	} else t15 = $[26];
	let t16;
	if ($[27] !== t14) {
		t16 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(View, {
			style: t11,
			children: [t14, t15]
		});
		$[27] = t14;
		$[28] = t16;
	} else t16 = $[28];
	let t17;
	if ($[29] !== t10 || $[30] !== t16 || $[31] !== t9) {
		t17 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
			variant: "bare",
			style: t9,
			onPress: t10,
			children: t16
		});
		$[29] = t10;
		$[30] = t16;
		$[31] = t9;
		$[32] = t17;
	} else t17 = $[32];
	let t18;
	if ($[33] !== t17 || $[34] !== t2 || $[35] !== t8) {
		t18 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(View, {
			style: t2,
			children: [
				t3,
				t8,
				t17
			]
		});
		$[33] = t17;
		$[34] = t2;
		$[35] = t8;
		$[36] = t18;
	} else t18 = $[36];
	return t18;
}
function ExpenseGroupCells(t0) {
	const $ = (0, import_compiler_runtime.c)(52);
	const { group, show3Columns, showBudgetedColumn } = t0;
	const [t1] = useSyncedPref("budgetType");
	const budgetType = t1 === void 0 ? "envelope" : t1;
	const format = useFormat();
	let t2;
	if ($[0] !== show3Columns) {
		t2 = getColumnWidth({ show3Columns });
		$[0] = show3Columns;
		$[1] = t2;
	} else t2 = $[1];
	const columnWidth = t2;
	let t3;
	if ($[2] !== columnWidth) {
		t3 = {
			...styles.tnum,
			width: columnWidth,
			fontSize: 12,
			fontWeight: "500",
			paddingLeft: 5,
			textAlign: "right"
		};
		$[2] = columnWidth;
		$[3] = t3;
	} else t3 = $[3];
	const amountStyle = t3;
	let t4;
	if ($[4] !== budgetType || $[5] !== group.id) {
		t4 = budgetType === "tracking" ? trackingBudget.groupBudgeted(group.id) : envelopeBudget.groupBudgeted(group.id);
		$[4] = budgetType;
		$[5] = group.id;
		$[6] = t4;
	} else t4 = $[6];
	const budgeted = t4;
	let t5;
	if ($[7] !== budgetType || $[8] !== group.id) {
		t5 = budgetType === "tracking" ? trackingBudget.groupSumAmount(group.id) : envelopeBudget.groupSumAmount(group.id);
		$[7] = budgetType;
		$[8] = group.id;
		$[9] = t5;
	} else t5 = $[9];
	const spent = t5;
	let t6;
	if ($[10] !== budgetType || $[11] !== group.id) {
		t6 = budgetType === "tracking" ? trackingBudget.groupBalance(group.id) : envelopeBudget.groupBalance(group.id);
		$[10] = budgetType;
		$[11] = group.id;
		$[12] = t6;
	} else t6 = $[12];
	const balance = t6;
	let t7;
	if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
		t7 = {
			flexDirection: "row",
			justifyContent: "flex-end",
			alignItems: "center",
			paddingRight: 5
		};
		$[13] = t7;
	} else t7 = $[13];
	let t8;
	if ($[14] !== show3Columns || $[15] !== showBudgetedColumn) {
		t8 = !show3Columns && !showBudgetedColumn && { display: "none" };
		$[14] = show3Columns;
		$[15] = showBudgetedColumn;
		$[16] = t8;
	} else t8 = $[16];
	let t9;
	if ($[17] !== t8) {
		t9 = { ...t8 };
		$[17] = t8;
		$[18] = t9;
	} else t9 = $[18];
	let t10;
	if ($[19] !== amountStyle || $[20] !== format) {
		t10 = (t11) => {
			const { type, value } = t11;
			return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PrivacyFilter, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AutoTextSize, {
				as: Text,
				minFontSizePx: 6,
				maxFontSizePx: 12,
				mode: "oneline",
				style: amountStyle,
				children: format(value, type)
			}, value) }) });
		};
		$[19] = amountStyle;
		$[20] = format;
		$[21] = t10;
	} else t10 = $[21];
	let t11;
	if ($[22] !== budgeted || $[23] !== t10) {
		t11 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CellValue, {
			binding: budgeted,
			type: "financial",
			children: t10
		});
		$[22] = budgeted;
		$[23] = t10;
		$[24] = t11;
	} else t11 = $[24];
	let t12;
	if ($[25] !== t11 || $[26] !== t9) {
		t12 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, {
			style: t9,
			children: t11
		});
		$[25] = t11;
		$[26] = t9;
		$[27] = t12;
	} else t12 = $[27];
	let t13;
	if ($[28] !== show3Columns || $[29] !== showBudgetedColumn) {
		t13 = !show3Columns && showBudgetedColumn && { display: "none" };
		$[28] = show3Columns;
		$[29] = showBudgetedColumn;
		$[30] = t13;
	} else t13 = $[30];
	let t14;
	if ($[31] !== t13) {
		t14 = { ...t13 };
		$[31] = t13;
		$[32] = t14;
	} else t14 = $[32];
	let t15;
	if ($[33] !== amountStyle || $[34] !== format) {
		t15 = (t16) => {
			const { type: type_0, value: value_0 } = t16;
			return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PrivacyFilter, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AutoTextSize, {
				as: Text,
				minFontSizePx: 6,
				maxFontSizePx: 12,
				mode: "oneline",
				style: amountStyle,
				children: format(value_0, type_0)
			}, value_0) }) });
		};
		$[33] = amountStyle;
		$[34] = format;
		$[35] = t15;
	} else t15 = $[35];
	let t16;
	if ($[36] !== spent || $[37] !== t15) {
		t16 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CellValue, {
			binding: spent,
			type: "financial",
			children: t15
		});
		$[36] = spent;
		$[37] = t15;
		$[38] = t16;
	} else t16 = $[38];
	let t17;
	if ($[39] !== t14 || $[40] !== t16) {
		t17 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, {
			style: t14,
			children: t16
		});
		$[39] = t14;
		$[40] = t16;
		$[41] = t17;
	} else t17 = $[41];
	let t18;
	if ($[42] !== amountStyle || $[43] !== format) {
		t18 = (t19) => {
			const { type: type_1, value: value_1 } = t19;
			return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PrivacyFilter, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AutoTextSize, {
				as: Text,
				minFontSizePx: 6,
				maxFontSizePx: 12,
				mode: "oneline",
				style: amountStyle,
				children: format(value_1, type_1)
			}, value_1) }) });
		};
		$[42] = amountStyle;
		$[43] = format;
		$[44] = t18;
	} else t18 = $[44];
	let t19;
	if ($[45] !== balance || $[46] !== t18) {
		t19 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CellValue, {
			binding: balance,
			type: "financial",
			children: t18
		});
		$[45] = balance;
		$[46] = t18;
		$[47] = t19;
	} else t19 = $[47];
	let t20;
	if ($[48] !== t12 || $[49] !== t17 || $[50] !== t19) {
		t20 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(View, {
			style: t7,
			children: [
				t12,
				t17,
				t19
			]
		});
		$[48] = t12;
		$[49] = t17;
		$[50] = t19;
		$[51] = t20;
	} else t20 = $[51];
	return t20;
}
//#endregion
//#region src/components/mobile/budget/ExpenseGroupList.tsx
function ExpenseGroupList(t0) {
	const $ = (0, import_compiler_runtime.c)(39);
	const { categoryGroups, show3Columns, showBudgetedColumn, month, onEditCategoryGroup, onEditCategory, onBudgetAction, showHiddenCategories, isCollapsed, onToggleCollapse } = t0;
	const { t } = useTranslation();
	const moveCategoryGroup = useMoveCategoryGroupMutation();
	let t1;
	if ($[0] !== categoryGroups || $[1] !== month || $[2] !== show3Columns || $[3] !== showBudgetedColumn) {
		t1 = (items) => {
			const draggedGroupId = items[0]["text/plain"];
			const group = categoryGroups.find((c) => c.id === draggedGroupId);
			if (!group) throw new Error(`Internal error: category group with ID ${draggedGroupId} not found.`);
			return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ExpenseGroupHeader, {
				categoryGroup: group,
				month,
				showBudgetedColumn,
				show3Columns,
				onEditCategoryGroup: _temp4$2,
				isCollapsed: _temp5$1,
				onToggleCollapse: _temp6$1,
				isHidden: false
			});
		};
		$[0] = categoryGroups;
		$[1] = month;
		$[2] = show3Columns;
		$[3] = showBudgetedColumn;
		$[4] = t1;
	} else t1 = $[4];
	let t2;
	if ($[5] !== categoryGroups || $[6] !== moveCategoryGroup) {
		t2 = (e) => {
			const [key_0] = e.keys;
			const groupIdToMove = key_0;
			const groupToMove = categoryGroups.find((c_0) => c_0.id === groupIdToMove);
			if (!groupToMove) throw new Error(`Internal error: category group with ID ${groupIdToMove} not found.`);
			const targetGroupId = e.target.key;
			if (e.target.dropPosition === "before") moveCategoryGroup.mutate({
				id: groupToMove.id,
				targetId: targetGroupId
			});
			else if (e.target.dropPosition === "after") {
				const targetGroupIndex = categoryGroups.findIndex((c_1) => c_1.id === targetGroupId);
				if (targetGroupIndex === -1) throw new Error(`Internal error: category group with ID ${targetGroupId} not found.`);
				const nextToTargetCategory = categoryGroups[targetGroupIndex + 1];
				moveCategoryGroup.mutate({
					id: groupToMove.id,
					targetId: nextToTargetCategory?.id || null
				});
			}
		};
		$[5] = categoryGroups;
		$[6] = moveCategoryGroup;
		$[7] = t2;
	} else t2 = $[7];
	let t3;
	if ($[8] !== t1 || $[9] !== t2) {
		t3 = {
			getItems: _temp2$12,
			renderDropIndicator: _temp3$4,
			renderDragPreview: t1,
			onReorder: t2
		};
		$[8] = t1;
		$[9] = t2;
		$[10] = t3;
	} else t3 = $[10];
	const { dragAndDropHooks } = $d8f176866e6dc039$export$2cfc5be7a55829f6(t3);
	let t4;
	if ($[11] !== t) {
		t4 = t("Expense category groups");
		$[11] = t;
		$[12] = t4;
	} else t4 = $[12];
	let t5;
	if ($[13] !== isCollapsed || $[14] !== month || $[15] !== onBudgetAction || $[16] !== onEditCategory || $[17] !== onEditCategoryGroup || $[18] !== onToggleCollapse || $[19] !== show3Columns || $[20] !== showBudgetedColumn || $[21] !== showHiddenCategories) {
		t5 = [
			month,
			onEditCategoryGroup,
			onEditCategory,
			onBudgetAction,
			show3Columns,
			showBudgetedColumn,
			showHiddenCategories,
			isCollapsed,
			onToggleCollapse
		];
		$[13] = isCollapsed;
		$[14] = month;
		$[15] = onBudgetAction;
		$[16] = onEditCategory;
		$[17] = onEditCategoryGroup;
		$[18] = onToggleCollapse;
		$[19] = show3Columns;
		$[20] = showBudgetedColumn;
		$[21] = showHiddenCategories;
		$[22] = t5;
	} else t5 = $[22];
	let t6;
	if ($[23] !== isCollapsed || $[24] !== month || $[25] !== onBudgetAction || $[26] !== onEditCategory || $[27] !== onEditCategoryGroup || $[28] !== onToggleCollapse || $[29] !== show3Columns || $[30] !== showBudgetedColumn || $[31] !== showHiddenCategories) {
		t6 = (categoryGroup) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ExpenseGroupListItem, {
			value: categoryGroup,
			month,
			onEditCategoryGroup,
			onEditCategory,
			onBudgetAction,
			showBudgetedColumn,
			show3Columns,
			showHiddenCategories,
			isCollapsed,
			onToggleCollapse,
			isHidden: !!categoryGroup.hidden
		}, categoryGroup.id);
		$[23] = isCollapsed;
		$[24] = month;
		$[25] = onBudgetAction;
		$[26] = onEditCategory;
		$[27] = onEditCategoryGroup;
		$[28] = onToggleCollapse;
		$[29] = show3Columns;
		$[30] = showBudgetedColumn;
		$[31] = showHiddenCategories;
		$[32] = t6;
	} else t6 = $[32];
	let t7;
	if ($[33] !== categoryGroups || $[34] !== dragAndDropHooks || $[35] !== t4 || $[36] !== t5 || $[37] !== t6) {
		t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)($72e60046c03fbe42$export$a7bfbda1311ca015, {
			"aria-label": t4,
			items: categoryGroups,
			dependencies: t5,
			dragAndDropHooks,
			children: t6
		});
		$[33] = categoryGroups;
		$[34] = dragAndDropHooks;
		$[35] = t4;
		$[36] = t5;
		$[37] = t6;
		$[38] = t7;
	} else t7 = $[38];
	return t7;
}
function _temp6$1() {}
function _temp5$1() {
	return true;
}
function _temp4$2() {}
function _temp3$4(target) {
	return /* @__PURE__ */ (0, import_jsx_runtime.jsx)($612b8eb6cb90e02d$export$62ed72bc21f6b8a6, {
		target,
		className: css({ "&[data-drop-target]": {
			height: 4,
			backgroundColor: theme.tableBorderSeparator,
			opacity: 1,
			borderRadius: 4
		} })
	});
}
function _temp2$12(keys) {
	return [...keys].map(_temp$16);
}
function _temp$16(key) {
	return { "text/plain": key };
}
//#endregion
//#region src/components/mobile/budget/IncomeCategoryListItem.tsx
function IncomeCategoryName(t0) {
	const $ = (0, import_compiler_runtime.c)(17);
	const { category, onEdit } = t0;
	let t1;
	if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
		t1 = getColumnWidth({
			isSidebar: true,
			offset: -10
		});
		$[0] = t1;
	} else t1 = $[0];
	const sidebarColumnWidth = t1;
	let t2;
	if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
		t2 = {
			flex: 1,
			justifyContent: "center",
			alignItems: "flex-start",
			width: sidebarColumnWidth
		};
		$[1] = t2;
	} else t2 = $[1];
	let t3;
	if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
		t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
			slot: "drag",
			style: {
				opacity: 0,
				width: 1,
				height: 1,
				position: "absolute",
				overflow: "hidden"
			}
		});
		$[2] = t3;
	} else t3 = $[2];
	let t4;
	if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
		t4 = { maxWidth: sidebarColumnWidth };
		$[3] = t4;
	} else t4 = $[3];
	let t5;
	if ($[4] !== category.id || $[5] !== onEdit) {
		t5 = () => onEdit?.(category.id);
		$[4] = category.id;
		$[5] = onEdit;
		$[6] = t5;
	} else t5 = $[6];
	let t6;
	if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
		t6 = {
			flexDirection: "row",
			alignItems: "center",
			justifyContent: "flex-start"
		};
		$[7] = t6;
	} else t6 = $[7];
	let t7;
	if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
		t7 = {
			...styles.lineClamp(2),
			width: sidebarColumnWidth,
			textAlign: "left",
			...styles.smallText
		};
		$[8] = t7;
	} else t7 = $[8];
	let t8;
	if ($[9] !== category.name) {
		t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
			style: t7,
			"data-testid": "category-name",
			children: category.name
		});
		$[9] = category.name;
		$[10] = t8;
	} else t8 = $[10];
	let t9;
	if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
		t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SvgCheveronRight, {
			style: {
				flexShrink: 0,
				color: theme.tableTextSubdued
			},
			width: 14,
			height: 14
		});
		$[11] = t9;
	} else t9 = $[11];
	let t10;
	if ($[12] !== t8) {
		t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(View, {
			style: t6,
			children: [t8, t9]
		});
		$[12] = t8;
		$[13] = t10;
	} else t10 = $[13];
	let t11;
	if ($[14] !== t10 || $[15] !== t5) {
		t11 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(View, {
			style: t2,
			children: [t3, /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
				variant: "bare",
				style: t4,
				onPress: t5,
				children: t10
			})]
		});
		$[14] = t10;
		$[15] = t5;
		$[16] = t11;
	} else t11 = $[16];
	return t11;
}
function IncomeCategoryCells(t0) {
	const $ = (0, import_compiler_runtime.c)(27);
	const { category, month, onBudgetAction, onPress } = t0;
	const { t } = useTranslation();
	let t1;
	if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
		t1 = getColumnWidth();
		$[0] = t1;
	} else t1 = $[0];
	const columnWidth = t1;
	const [t2] = useSyncedPref("budgetType");
	const budgetType = t2 === void 0 ? "envelope" : t2;
	let t3;
	if ($[1] !== budgetType || $[2] !== category.id) {
		t3 = budgetType === "tracking" ? trackingBudget.catBudgeted(category.id) : envelopeBudget.catBudgeted(category.id);
		$[1] = budgetType;
		$[2] = category.id;
		$[3] = t3;
	} else t3 = $[3];
	const budgeted = t3;
	let t4;
	if ($[4] !== budgetType || $[5] !== category.id) {
		t4 = budgetType === "tracking" ? trackingBudget.catSumAmount(category.id) : envelopeBudget.catSumAmount(category.id);
		$[4] = budgetType;
		$[5] = category.id;
		$[6] = t4;
	} else t4 = $[6];
	const balance = t4;
	let t5;
	if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
		t5 = {
			flexDirection: "row",
			justifyContent: "flex-end",
			alignItems: "center"
		};
		$[7] = t5;
	} else t5 = $[7];
	let t6;
	if ($[8] !== budgetType || $[9] !== budgeted || $[10] !== category || $[11] !== month || $[12] !== onBudgetAction) {
		t6 = budgetType === "tracking" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, {
			style: {
				width: columnWidth,
				justifyContent: "center",
				alignItems: "flex-end"
			},
			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BudgetCell, {
				binding: budgeted,
				type: "financial",
				category,
				month,
				onBudgetAction
			})
		});
		$[8] = budgetType;
		$[9] = budgeted;
		$[10] = category;
		$[11] = month;
		$[12] = onBudgetAction;
		$[13] = t6;
	} else t6 = $[13];
	let t7;
	if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
		t7 = {
			width: columnWidth,
			justifyContent: "center",
			alignItems: "flex-end"
		};
		$[14] = t7;
	} else t7 = $[14];
	let t8;
	if ($[15] !== budgetType || $[16] !== category.name || $[17] !== t) {
		t8 = budgetType === "envelope" ? t("Open balance menu for {{categoryName}} category", { categoryName: category.name }) : t("Show transactions for {{categoryName}} category", { categoryName: category.name });
		$[15] = budgetType;
		$[16] = category.name;
		$[17] = t;
		$[18] = t8;
	} else t8 = $[18];
	let t9;
	if ($[19] !== balance || $[20] !== category || $[21] !== onPress || $[22] !== t8) {
		t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, {
			style: t7,
			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BalanceCell, {
				binding: balance,
				category,
				onPress,
				"aria-label": t8
			})
		});
		$[19] = balance;
		$[20] = category;
		$[21] = onPress;
		$[22] = t8;
		$[23] = t9;
	} else t9 = $[23];
	let t10;
	if ($[24] !== t6 || $[25] !== t9) {
		t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(View, {
			style: t5,
			children: [t6, t9]
		});
		$[24] = t6;
		$[25] = t9;
		$[26] = t10;
	} else t10 = $[26];
	return t10;
}
function IncomeCategoryListItem(t0) {
	const $ = (0, import_compiler_runtime.c)(40);
	let month;
	let onBudgetAction;
	let onEdit;
	let props;
	if ($[0] !== t0) {
		({month, onEdit, onBudgetAction, ...props} = t0);
		$[0] = t0;
		$[1] = month;
		$[2] = onBudgetAction;
		$[3] = onEdit;
		$[4] = props;
	} else {
		month = $[1];
		onBudgetAction = $[2];
		onEdit = $[3];
		props = $[4];
	}
	const { value: category } = props;
	const dispatch = useDispatch();
	const navigate = useNavigate();
	const [t1] = useSyncedPref("budgetType");
	const budgetType = t1 === void 0 ? "envelope" : t1;
	let t2;
	if ($[5] !== category || $[6] !== month || $[7] !== navigate) {
		t2 = () => {
			if (!category) return null;
			navigate(`/categories/${category.id}?month=${month}`);
		};
		$[5] = category;
		$[6] = month;
		$[7] = navigate;
		$[8] = t2;
	} else t2 = $[8];
	const onShowActivity = t2;
	let t3;
	if ($[9] !== category || $[10] !== dispatch || $[11] !== month || $[12] !== onBudgetAction) {
		t3 = (carryover) => {
			if (!category) return;
			onBudgetAction(month, "carryover", {
				category: category.id,
				flag: carryover
			});
			dispatch(collapseModals({ rootModalName: "envelope-income-balance-menu" }));
		};
		$[9] = category;
		$[10] = dispatch;
		$[11] = month;
		$[12] = onBudgetAction;
		$[13] = t3;
	} else t3 = $[13];
	const onCarryover = t3;
	let t4;
	if ($[14] !== category || $[15] !== dispatch || $[16] !== month || $[17] !== onCarryover || $[18] !== onShowActivity) {
		t4 = () => {
			if (!category) return;
			dispatch(pushModal({ modal: {
				name: "envelope-income-balance-menu",
				options: {
					month,
					categoryId: category.id,
					onCarryover,
					onShowActivity
				}
			} }));
		};
		$[14] = category;
		$[15] = dispatch;
		$[16] = month;
		$[17] = onCarryover;
		$[18] = onShowActivity;
		$[19] = t4;
	} else t4 = $[19];
	const onOpenBalanceMenu = t4;
	if (!category) return null;
	const t5 = category.hidden ? .5 : void 0;
	const t6 = isCurrentMonth(month) ? theme.budgetCurrentMonth : theme.budgetOtherMonth;
	let t7;
	if ($[20] !== t5 || $[21] !== t6) {
		t7 = {
			height: 50,
			borderColor: theme.tableBorder,
			flexDirection: "row",
			alignItems: "center",
			justifyContent: "space-between",
			paddingLeft: 5,
			paddingRight: 5,
			borderBottomWidth: 1,
			opacity: t5,
			backgroundColor: t6
		};
		$[20] = t5;
		$[21] = t6;
		$[22] = t7;
	} else t7 = $[22];
	let t8;
	if ($[23] !== category || $[24] !== onEdit) {
		t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IncomeCategoryName, {
			category,
			onEdit
		});
		$[23] = category;
		$[24] = onEdit;
		$[25] = t8;
	} else t8 = $[25];
	const t9 = `${category.id}`;
	const t10 = budgetType === "envelope" ? onOpenBalanceMenu : onShowActivity;
	let t11;
	if ($[26] !== category || $[27] !== month || $[28] !== onBudgetAction || $[29] !== t10 || $[30] !== t9) {
		t11 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IncomeCategoryCells, {
			category,
			month,
			onBudgetAction,
			onPress: t10
		}, t9);
		$[26] = category;
		$[27] = month;
		$[28] = onBudgetAction;
		$[29] = t10;
		$[30] = t9;
		$[31] = t11;
	} else t11 = $[31];
	let t12;
	if ($[32] !== t11 || $[33] !== t7 || $[34] !== t8) {
		t12 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(View, {
			style: t7,
			children: [t8, t11]
		});
		$[32] = t11;
		$[33] = t7;
		$[34] = t8;
		$[35] = t12;
	} else t12 = $[35];
	let t13;
	if ($[36] !== category.name || $[37] !== props || $[38] !== t12) {
		t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)($72e60046c03fbe42$export$e96fc9a8407faa6b, {
			textValue: category.name,
			"data-testid": "category-row",
			...props,
			children: t12
		});
		$[36] = category.name;
		$[37] = props;
		$[38] = t12;
		$[39] = t13;
	} else t13 = $[39];
	return t13;
}
//#endregion
//#region src/components/mobile/budget/IncomeCategoryList.tsx
function IncomeCategoryList(t0) {
	const $ = (0, import_compiler_runtime.c)(16);
	const { categories, month, onEditCategory, onBudgetAction } = t0;
	const { t } = useTranslation();
	const moveCategory = useMoveCategoryMutation();
	let t1;
	if ($[0] !== categories || $[1] !== moveCategory) {
		t1 = {
			getItems: _temp2$11,
			renderDropIndicator: _temp3$3,
			onReorder: (e) => {
				const [key_0] = e.keys;
				const categoryIdToMove = key_0;
				const categoryToMove = categories.find((c) => c.id === categoryIdToMove);
				if (!categoryToMove) throw new Error(`Internal error: category with ID ${categoryIdToMove} not found.`);
				if (!categoryToMove.group) throw new Error(`Internal error: category ${categoryIdToMove} is not in a group and cannot be moved.`);
				const targetCategoryId = e.target.key;
				if (e.target.dropPosition === "before") moveCategory.mutate({
					id: categoryToMove.id,
					groupId: categoryToMove.group,
					targetId: targetCategoryId
				});
				else if (e.target.dropPosition === "after") {
					const targetCategoryIndex = categories.findIndex((c_0) => c_0.id === targetCategoryId);
					if (targetCategoryIndex === -1) throw new Error(`Internal error: category with ID ${targetCategoryId} not found.`);
					const nextToTargetCategory = categories[targetCategoryIndex + 1];
					moveCategory.mutate({
						id: categoryToMove.id,
						groupId: categoryToMove.group,
						targetId: nextToTargetCategory?.id || null
					});
				}
			}
		};
		$[0] = categories;
		$[1] = moveCategory;
		$[2] = t1;
	} else t1 = $[2];
	const { dragAndDropHooks } = $d8f176866e6dc039$export$2cfc5be7a55829f6(t1);
	let t2;
	if ($[3] !== t) {
		t2 = t("Income categories");
		$[3] = t;
		$[4] = t2;
	} else t2 = $[4];
	let t3;
	let t4;
	if ($[5] !== month || $[6] !== onBudgetAction || $[7] !== onEditCategory) {
		t3 = [
			month,
			onEditCategory,
			onBudgetAction
		];
		t4 = (category) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IncomeCategoryListItem, {
			value: category,
			month,
			onEdit: onEditCategory,
			onBudgetAction
		}, category.id);
		$[5] = month;
		$[6] = onBudgetAction;
		$[7] = onEditCategory;
		$[8] = t3;
		$[9] = t4;
	} else {
		t3 = $[8];
		t4 = $[9];
	}
	let t5;
	if ($[10] !== categories || $[11] !== dragAndDropHooks || $[12] !== t2 || $[13] !== t3 || $[14] !== t4) {
		t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)($72e60046c03fbe42$export$a7bfbda1311ca015, {
			"aria-label": t2,
			items: categories,
			dragAndDropHooks,
			dependencies: t3,
			children: t4
		});
		$[10] = categories;
		$[11] = dragAndDropHooks;
		$[12] = t2;
		$[13] = t3;
		$[14] = t4;
		$[15] = t5;
	} else t5 = $[15];
	return t5;
}
function _temp3$3(target) {
	return /* @__PURE__ */ (0, import_jsx_runtime.jsx)($612b8eb6cb90e02d$export$62ed72bc21f6b8a6, {
		target,
		className: css({ "&[data-drop-target]": {
			height: 4,
			backgroundColor: theme.tableBorderSeparator,
			opacity: 1,
			borderRadius: 4
		} })
	});
}
function _temp2$11(keys) {
	return [...keys].map(_temp$15);
}
function _temp$15(key) {
	return { "text/plain": key };
}
//#endregion
//#region src/components/mobile/budget/IncomeGroup.tsx
function IncomeGroup(t0) {
	const $ = (0, import_compiler_runtime.c)(36);
	const { categoryGroup, month, showHiddenCategories, onEditCategoryGroup, onEditCategory, onBudgetAction, isCollapsed, onToggleCollapse } = t0;
	const { t } = useTranslation();
	let t1;
	if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
		t1 = getColumnWidth();
		$[0] = t1;
	} else t1 = $[0];
	const columnWidth = t1;
	const [t2] = useSyncedPref("budgetType");
	const budgetType = t2 === void 0 ? "envelope" : t2;
	let t3;
	if ($[1] !== categoryGroup.categories || $[2] !== categoryGroup.id || $[3] !== isCollapsed || $[4] !== showHiddenCategories) {
		t3 = isCollapsed(categoryGroup.id) ? [] : categoryGroup.categories?.filter((category) => !category.hidden || showHiddenCategories) ?? [];
		$[1] = categoryGroup.categories;
		$[2] = categoryGroup.id;
		$[3] = isCollapsed;
		$[4] = showHiddenCategories;
		$[5] = t3;
	} else t3 = $[5];
	const categories = t3;
	let t4;
	if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
		t4 = {
			flexDirection: "row",
			alignItems: "center",
			justifyContent: "flex-end",
			marginTop: 50,
			marginBottom: 5,
			marginRight: 15
		};
		$[6] = t4;
	} else t4 = $[6];
	let t5;
	if ($[7] !== budgetType || $[8] !== t) {
		t5 = budgetType === "tracking" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Label, {
			title: t("Budgeted"),
			style: { width: columnWidth }
		});
		$[7] = budgetType;
		$[8] = t;
		$[9] = t5;
	} else t5 = $[9];
	let t6;
	if ($[10] !== t) {
		t6 = t("Received");
		$[10] = t;
		$[11] = t6;
	} else t6 = $[11];
	let t7;
	if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
		t7 = { width: columnWidth };
		$[12] = t7;
	} else t7 = $[12];
	let t8;
	if ($[13] !== t6) {
		t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Label, {
			title: t6,
			style: t7
		});
		$[13] = t6;
		$[14] = t8;
	} else t8 = $[14];
	let t9;
	if ($[15] !== t5 || $[16] !== t8) {
		t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(View, {
			style: t4,
			children: [t5, t8]
		});
		$[15] = t5;
		$[16] = t8;
		$[17] = t9;
	} else t9 = $[17];
	let t10;
	if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
		t10 = { marginTop: 0 };
		$[18] = t10;
	} else t10 = $[18];
	let t11;
	if ($[19] !== categoryGroup || $[20] !== isCollapsed || $[21] !== month || $[22] !== onEditCategoryGroup || $[23] !== onToggleCollapse) {
		t11 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IncomeGroupHeader, {
			group: categoryGroup,
			month,
			onEdit: onEditCategoryGroup,
			isCollapsed,
			onToggleCollapse
		});
		$[19] = categoryGroup;
		$[20] = isCollapsed;
		$[21] = month;
		$[22] = onEditCategoryGroup;
		$[23] = onToggleCollapse;
		$[24] = t11;
	} else t11 = $[24];
	let t12;
	if ($[25] !== categories || $[26] !== month || $[27] !== onBudgetAction || $[28] !== onEditCategory) {
		t12 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IncomeCategoryList, {
			categories,
			month,
			onEditCategory,
			onBudgetAction
		});
		$[25] = categories;
		$[26] = month;
		$[27] = onBudgetAction;
		$[28] = onEditCategory;
		$[29] = t12;
	} else t12 = $[29];
	let t13;
	if ($[30] !== t11 || $[31] !== t12) {
		t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Card, {
			style: t10,
			children: [t11, t12]
		});
		$[30] = t11;
		$[31] = t12;
		$[32] = t13;
	} else t13 = $[32];
	let t14;
	if ($[33] !== t13 || $[34] !== t9) {
		t14 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(View, { children: [t9, t13] });
		$[33] = t13;
		$[34] = t9;
		$[35] = t14;
	} else t14 = $[35];
	return t14;
}
function IncomeGroupHeader(t0) {
	const $ = (0, import_compiler_runtime.c)(19);
	const { group, month, onEdit, isCollapsed, onToggleCollapse, style } = t0;
	let t1;
	if ($[0] !== group.id || $[1] !== onToggleCollapse) {
		t1 = () => onToggleCollapse(group.id);
		$[0] = group.id;
		$[1] = onToggleCollapse;
		$[2] = t1;
	} else t1 = $[2];
	const t2 = group.hidden ? .5 : void 0;
	const t3 = isCurrentMonth(month) ? theme.budgetHeaderCurrentMonth : theme.budgetHeaderOtherMonth;
	let t4;
	if ($[3] !== style || $[4] !== t2 || $[5] !== t3) {
		t4 = {
			cursor: "pointer",
			height: 50,
			borderBottomWidth: 1,
			borderColor: theme.tableBorder,
			flexDirection: "row",
			alignItems: "center",
			paddingLeft: 5,
			paddingRight: 5,
			opacity: t2,
			backgroundColor: t3,
			...style
		};
		$[3] = style;
		$[4] = t2;
		$[5] = t3;
		$[6] = t4;
	} else t4 = $[6];
	let t5;
	if ($[7] !== group || $[8] !== isCollapsed || $[9] !== onEdit || $[10] !== onToggleCollapse) {
		t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IncomeGroupName, {
			group,
			onEdit,
			isCollapsed,
			onToggleCollapse
		});
		$[7] = group;
		$[8] = isCollapsed;
		$[9] = onEdit;
		$[10] = onToggleCollapse;
		$[11] = t5;
	} else t5 = $[11];
	let t6;
	if ($[12] !== group) {
		t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IncomeGroupCells, { group });
		$[12] = group;
		$[13] = t6;
	} else t6 = $[13];
	let t7;
	if ($[14] !== t1 || $[15] !== t4 || $[16] !== t5 || $[17] !== t6) {
		t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(View, {
			"data-testid": "category-group-row",
			onClick: t1,
			style: t4,
			children: [t5, t6]
		});
		$[14] = t1;
		$[15] = t4;
		$[16] = t5;
		$[17] = t6;
		$[18] = t7;
	} else t7 = $[18];
	return t7;
}
function IncomeGroupName(t0) {
	const $ = (0, import_compiler_runtime.c)(28);
	const { group, onEdit, isCollapsed, onToggleCollapse } = t0;
	let t1;
	if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
		t1 = getColumnWidth({
			isSidebar: true,
			offset: -13.5
		});
		$[0] = t1;
	} else t1 = $[0];
	const sidebarColumnWidth = t1;
	let t2;
	if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
		t2 = {
			flex: 1,
			flexDirection: "row",
			justifyContent: "flex-start",
			width: sidebarColumnWidth
		};
		$[1] = t2;
	} else t2 = $[1];
	let t3;
	if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
		t3 = css({
			flexShrink: 0,
			color: theme.pageTextSubdued,
			"&[data-pressed]": { backgroundColor: "transparent" },
			marginLeft: -5
		});
		$[2] = t3;
	} else t3 = $[2];
	let t4;
	if ($[3] !== group.id || $[4] !== onToggleCollapse) {
		t4 = () => onToggleCollapse(group.id);
		$[3] = group.id;
		$[4] = onToggleCollapse;
		$[5] = t4;
	} else t4 = $[5];
	const t5 = isCollapsed(group.id) ? "rotate(-90deg)" : "";
	let t6;
	if ($[6] !== t5) {
		t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SvgExpandArrow, {
			width: 8,
			height: 8,
			style: {
				flexShrink: 0,
				transition: "transform .1s",
				transform: t5
			}
		});
		$[6] = t5;
		$[7] = t6;
	} else t6 = $[7];
	let t7;
	if ($[8] !== t4 || $[9] !== t6) {
		t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
			variant: "bare",
			className: t3,
			onPress: t4,
			children: t6
		});
		$[8] = t4;
		$[9] = t6;
		$[10] = t7;
	} else t7 = $[10];
	let t8;
	if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
		t8 = { maxWidth: sidebarColumnWidth };
		$[11] = t8;
	} else t8 = $[11];
	let t9;
	if ($[12] !== group.id || $[13] !== onEdit) {
		t9 = () => onEdit(group.id);
		$[12] = group.id;
		$[13] = onEdit;
		$[14] = t9;
	} else t9 = $[14];
	let t10;
	if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
		t10 = {
			flexDirection: "row",
			alignItems: "center",
			justifyContent: "flex-start"
		};
		$[15] = t10;
	} else t10 = $[15];
	let t11;
	if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
		t11 = {
			...styles.lineClamp(2),
			width: sidebarColumnWidth,
			textAlign: "left",
			...styles.smallText
		};
		$[16] = t11;
	} else t11 = $[16];
	let t12;
	if ($[17] !== group.name) {
		t12 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
			style: t11,
			"data-testid": "category-group-name",
			children: group.name
		});
		$[17] = group.name;
		$[18] = t12;
	} else t12 = $[18];
	let t13;
	if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
		t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SvgCheveronRight, {
			style: {
				flexShrink: 0,
				color: theme.tableTextSubdued
			},
			width: 14,
			height: 14
		});
		$[19] = t13;
	} else t13 = $[19];
	let t14;
	if ($[20] !== t12) {
		t14 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(View, {
			style: t10,
			children: [t12, t13]
		});
		$[20] = t12;
		$[21] = t14;
	} else t14 = $[21];
	let t15;
	if ($[22] !== t14 || $[23] !== t9) {
		t15 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
			variant: "bare",
			style: t8,
			onPress: t9,
			children: t14
		});
		$[22] = t14;
		$[23] = t9;
		$[24] = t15;
	} else t15 = $[24];
	let t16;
	if ($[25] !== t15 || $[26] !== t7) {
		t16 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(View, {
			style: t2,
			children: [t7, t15]
		});
		$[25] = t15;
		$[26] = t7;
		$[27] = t16;
	} else t16 = $[27];
	return t16;
}
function IncomeGroupCells(t0) {
	const $ = (0, import_compiler_runtime.c)(19);
	const { group } = t0;
	const [t1] = useSyncedPref("budgetType");
	const budgetType = t1 === void 0 ? "envelope" : t1;
	const format = useFormat();
	let t2;
	if ($[0] !== budgetType || $[1] !== group.id) {
		t2 = budgetType === "tracking" ? trackingBudget.groupBudgeted(group.id) : null;
		$[0] = budgetType;
		$[1] = group.id;
		$[2] = t2;
	} else t2 = $[2];
	const budgeted = t2;
	let t3;
	if ($[3] !== budgetType || $[4] !== group.id) {
		t3 = budgetType === "tracking" ? trackingBudget.groupSumAmount(group.id) : envelopeBudget.groupSumAmount(group.id);
		$[3] = budgetType;
		$[4] = group.id;
		$[5] = t3;
	} else t3 = $[5];
	const balance = t3;
	let t4;
	if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
		t4 = getColumnWidth();
		$[6] = t4;
	} else t4 = $[6];
	const columnWidth = t4;
	let t5;
	if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
		t5 = {
			flexDirection: "row",
			justifyContent: "flex-end",
			alignItems: "center",
			paddingRight: 5
		};
		$[7] = t5;
	} else t5 = $[7];
	let t6;
	if ($[8] !== budgeted || $[9] !== format) {
		t6 = budgeted && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CellValue, {
			binding: budgeted,
			type: "financial",
			children: (t7) => {
				const { type, value } = t7;
				return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PrivacyFilter, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AutoTextSize, {
					as: Text,
					minFontSizePx: 6,
					maxFontSizePx: 12,
					mode: "oneline",
					style: {
						...styles.tnum,
						width: columnWidth,
						justifyContent: "center",
						alignItems: "flex-end",
						paddingLeft: 5,
						textAlign: "right",
						fontSize: 12,
						fontWeight: "500"
					},
					children: format(value, type)
				}, value) }) });
			}
		});
		$[8] = budgeted;
		$[9] = format;
		$[10] = t6;
	} else t6 = $[10];
	let t7;
	if ($[11] !== format) {
		t7 = (t8) => {
			const { type: type_0, value: value_0 } = t8;
			return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PrivacyFilter, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AutoTextSize, {
				as: Text,
				minFontSizePx: 6,
				maxFontSizePx: 12,
				mode: "oneline",
				style: {
					...styles.tnum,
					width: columnWidth,
					justifyContent: "center",
					alignItems: "flex-end",
					paddingLeft: 5,
					textAlign: "right",
					fontSize: 12,
					fontWeight: "500"
				},
				children: format(value_0, type_0)
			}, value_0) }) });
		};
		$[11] = format;
		$[12] = t7;
	} else t7 = $[12];
	let t8;
	if ($[13] !== balance || $[14] !== t7) {
		t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CellValue, {
			binding: balance,
			type: "financial",
			children: t7
		});
		$[13] = balance;
		$[14] = t7;
		$[15] = t8;
	} else t8 = $[15];
	let t9;
	if ($[16] !== t6 || $[17] !== t8) {
		t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(View, {
			style: t5,
			children: [t6, t8]
		});
		$[16] = t6;
		$[17] = t8;
		$[18] = t9;
	} else t9 = $[18];
	return t9;
}
//#endregion
//#region src/components/mobile/budget/BudgetTable.tsx
var PILL_STYLE = {
	borderRadius: 16,
	color: theme.pillText,
	backgroundColor: theme.pillBackgroundLight
};
function getColumnWidth({ show3Columns = false, isSidebar = false, offset = 0 } = {}) {
	if (!isSidebar) return show3Columns ? `${20 + offset}vw` : `${25 + offset}vw`;
	return show3Columns ? `${35 + offset}vw` : `${45 + offset}vw`;
}
function ToBudget(t0) {
	const $ = (0, import_compiler_runtime.c)(30);
	const { toBudget, onPress, show3Columns } = t0;
	const { t } = useTranslation();
	const amount = useSheetValue(toBudget) ?? 0;
	const format = useFormat();
	let t1;
	if ($[0] !== show3Columns) {
		t1 = getColumnWidth({
			show3Columns,
			isSidebar: true
		});
		$[0] = show3Columns;
		$[1] = t1;
	} else t1 = $[1];
	const sidebarColumnWidth = t1;
	let t2;
	if ($[2] !== sidebarColumnWidth) {
		t2 = {
			flexDirection: "row",
			justifyContent: "flex-start",
			alignItems: "center",
			width: sidebarColumnWidth
		};
		$[2] = sidebarColumnWidth;
		$[3] = t2;
	} else t2 = $[3];
	let t3;
	if ($[4] !== amount || $[5] !== t) {
		t3 = amount < 0 ? t("Overbudgeted") : t("To Budget");
		$[4] = amount;
		$[5] = t;
		$[6] = t3;
	} else t3 = $[6];
	let t4;
	if ($[7] !== amount) {
		t4 = amount < 0 ? styles.smallText : {};
		$[7] = amount;
		$[8] = t4;
	} else t4 = $[8];
	let t5;
	if ($[9] !== t4) {
		t5 = {
			...t4,
			color: theme.formInputText,
			flexShrink: 0,
			textAlign: "left"
		};
		$[9] = t4;
		$[10] = t5;
	} else t5 = $[10];
	let t6;
	if ($[11] !== t3 || $[12] !== t5) {
		t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AutoTextSize, {
			as: Label,
			minFontSizePx: 6,
			maxFontSizePx: 12,
			mode: "oneline",
			title: t3,
			style: t5
		}) });
		$[11] = t3;
		$[12] = t5;
		$[13] = t6;
	} else t6 = $[13];
	let t7;
	if ($[14] !== amount || $[15] !== format) {
		t7 = (t8) => {
			const { type, value } = t8;
			return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PrivacyFilter, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AutoTextSize, {
				as: Text,
				minFontSizePx: 6,
				maxFontSizePx: 12,
				mode: "oneline",
				style: {
					...styles.tnum,
					fontSize: 12,
					fontWeight: "700",
					color: amount < 0 ? theme.toBudgetNegative : amount > 0 ? theme.toBudgetPositive : theme.budgetNumberNeutral
				},
				children: format(value, type)
			}, value) }) });
		};
		$[14] = amount;
		$[15] = format;
		$[16] = t7;
	} else t7 = $[16];
	let t8;
	if ($[17] !== t7 || $[18] !== toBudget) {
		t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CellValue, {
			binding: toBudget,
			type: "financial",
			children: t7
		});
		$[17] = t7;
		$[18] = toBudget;
		$[19] = t8;
	} else t8 = $[19];
	let t9;
	if ($[20] !== t6 || $[21] !== t8) {
		t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(View, { children: [t6, t8] });
		$[20] = t6;
		$[21] = t8;
		$[22] = t9;
	} else t9 = $[22];
	let t10;
	if ($[23] === Symbol.for("react.memo_cache_sentinel")) {
		t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SvgCheveronRight, {
			style: {
				flexShrink: 0,
				color: theme.mobileHeaderTextSubdued,
				marginLeft: 5
			},
			width: 14,
			height: 14
		});
		$[23] = t10;
	} else t10 = $[23];
	let t11;
	if ($[24] !== onPress || $[25] !== t9) {
		t11 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button, {
			variant: "bare",
			onPress,
			children: [t9, t10]
		});
		$[24] = onPress;
		$[25] = t9;
		$[26] = t11;
	} else t11 = $[26];
	let t12;
	if ($[27] !== t11 || $[28] !== t2) {
		t12 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, {
			style: t2,
			children: t11
		});
		$[27] = t11;
		$[28] = t2;
		$[29] = t12;
	} else t12 = $[29];
	return t12;
}
function Saved(t0) {
	const $ = (0, import_compiler_runtime.c)(26);
	const { projected, onPress, show3Columns } = t0;
	const { t } = useTranslation();
	const binding = projected ? trackingBudget.totalBudgetedSaved : trackingBudget.totalSaved;
	const saved = useSheetValue(binding) || 0;
	const format = useFormat();
	const isNegative = saved < 0;
	let t1;
	if ($[0] !== show3Columns) {
		t1 = getColumnWidth({
			show3Columns,
			isSidebar: true
		});
		$[0] = show3Columns;
		$[1] = t1;
	} else t1 = $[1];
	const sidebarColumnWidth = t1;
	let t2;
	if ($[2] !== sidebarColumnWidth) {
		t2 = {
			flexDirection: "row",
			justifyContent: "flex-start",
			alignItems: "center",
			width: sidebarColumnWidth
		};
		$[2] = sidebarColumnWidth;
		$[3] = t2;
	} else t2 = $[3];
	let t3;
	if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
		t3 = { alignItems: "flex-start" };
		$[4] = t3;
	} else t3 = $[4];
	let t4;
	if ($[5] !== isNegative || $[6] !== projected || $[7] !== t) {
		t4 = projected ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AutoTextSize, {
			as: Label,
			minFontSizePx: 6,
			maxFontSizePx: 12,
			mode: "oneline",
			title: t("Projected savings"),
			style: {
				color: theme.formInputText,
				textAlign: "left",
				fontSize: 12
			}
		}) }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Label, {
			title: isNegative ? t("Overspent") : t("Saved"),
			style: {
				color: theme.formInputText,
				textAlign: "left"
			}
		});
		$[5] = isNegative;
		$[6] = projected;
		$[7] = t;
		$[8] = t4;
	} else t4 = $[8];
	let t5;
	if ($[9] !== format || $[10] !== isNegative || $[11] !== projected) {
		t5 = (t6) => {
			const { type, value } = t6;
			return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PrivacyFilter, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AutoTextSize, {
				as: Text,
				minFontSizePx: 6,
				maxFontSizePx: 12,
				mode: "oneline",
				style: {
					...styles.tnum,
					textAlign: "left",
					fontSize: 12,
					fontWeight: "700",
					color: projected ? theme.warningText : isNegative ? theme.errorTextDark : theme.formInputText
				},
				children: format(value, type)
			}, value) }) });
		};
		$[9] = format;
		$[10] = isNegative;
		$[11] = projected;
		$[12] = t5;
	} else t5 = $[12];
	let t6;
	if ($[13] !== binding || $[14] !== t5) {
		t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CellValue, {
			binding,
			type: "financial",
			children: t5
		});
		$[13] = binding;
		$[14] = t5;
		$[15] = t6;
	} else t6 = $[15];
	let t7;
	if ($[16] !== t4 || $[17] !== t6) {
		t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(View, {
			style: t3,
			children: [t4, t6]
		});
		$[16] = t4;
		$[17] = t6;
		$[18] = t7;
	} else t7 = $[18];
	let t8;
	if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
		t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SvgCheveronRight, {
			style: {
				flexShrink: 0,
				color: theme.mobileHeaderTextSubdued,
				marginLeft: 5
			},
			width: 14,
			height: 14
		});
		$[19] = t8;
	} else t8 = $[19];
	let t9;
	if ($[20] !== onPress || $[21] !== t7) {
		t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button, {
			variant: "bare",
			onPress,
			children: [t7, t8]
		});
		$[20] = onPress;
		$[21] = t7;
		$[22] = t9;
	} else t9 = $[22];
	let t10;
	if ($[23] !== t2 || $[24] !== t9) {
		t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, {
			style: t2,
			children: t9
		});
		$[23] = t2;
		$[24] = t9;
		$[25] = t10;
	} else t10 = $[25];
	return t10;
}
function BudgetGroups(t0) {
	const $ = (0, import_compiler_runtime.c)(40);
	const { categoryGroups, onEditCategoryGroup, onEditCategory, month, onBudgetAction, showBudgetedColumn, show3Columns, showHiddenCategories } = t0;
	let t1;
	let t2;
	if ($[0] !== categoryGroups || $[1] !== showHiddenCategories) {
		let t3;
		if ($[4] !== showHiddenCategories) {
			t3 = (group) => !group.hidden || showHiddenCategories;
			$[4] = showHiddenCategories;
			$[5] = t3;
		} else t3 = $[5];
		const categoryGroupsToDisplay = categoryGroups.filter(t3);
		t1 = categoryGroupsToDisplay.find(_temp$14);
		t2 = categoryGroupsToDisplay.filter(_temp2$10);
		$[0] = categoryGroups;
		$[1] = showHiddenCategories;
		$[2] = t1;
		$[3] = t2;
	} else {
		t1 = $[2];
		t2 = $[3];
	}
	let t3;
	if ($[6] !== t1 || $[7] !== t2) {
		t3 = {
			incomeGroup: t1,
			expenseGroups: t2
		};
		$[6] = t1;
		$[7] = t2;
		$[8] = t3;
	} else t3 = $[8];
	const { incomeGroup, expenseGroups } = t3;
	const [t4, setCollapsedGroupIdsPref] = useLocalPref("budget.collapsed");
	let t5;
	if ($[9] !== t4) {
		t5 = t4 === void 0 ? [] : t4;
		$[9] = t4;
		$[10] = t5;
	} else t5 = $[10];
	const collapsedGroupIds = t5;
	let t6;
	if ($[11] !== collapsedGroupIds || $[12] !== setCollapsedGroupIdsPref) {
		t6 = (id) => {
			setCollapsedGroupIdsPref(collapsedGroupIds.includes(id) ? collapsedGroupIds.filter((collapsedId) => collapsedId !== id) : [...collapsedGroupIds, id]);
		};
		$[11] = collapsedGroupIds;
		$[12] = setCollapsedGroupIdsPref;
		$[13] = t6;
	} else t6 = $[13];
	const onToggleCollapse = t6;
	let t7;
	if ($[14] !== collapsedGroupIds) {
		t7 = (id_0) => collapsedGroupIds.includes(id_0);
		$[14] = collapsedGroupIds;
		$[15] = t7;
	} else t7 = $[15];
	const isCollapsed = t7;
	let t8;
	if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
		t8 = {
			flex: "1 0 auto",
			overflowY: "auto",
			paddingBottom: 15
		};
		$[16] = t8;
	} else t8 = $[16];
	let t9;
	if ($[17] !== expenseGroups || $[18] !== isCollapsed || $[19] !== month || $[20] !== onBudgetAction || $[21] !== onEditCategory || $[22] !== onEditCategoryGroup || $[23] !== onToggleCollapse || $[24] !== show3Columns || $[25] !== showBudgetedColumn || $[26] !== showHiddenCategories) {
		t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ExpenseGroupList, {
			categoryGroups: expenseGroups,
			showBudgetedColumn,
			month,
			onEditCategoryGroup,
			onEditCategory,
			onBudgetAction,
			show3Columns,
			showHiddenCategories,
			isCollapsed,
			onToggleCollapse
		});
		$[17] = expenseGroups;
		$[18] = isCollapsed;
		$[19] = month;
		$[20] = onBudgetAction;
		$[21] = onEditCategory;
		$[22] = onEditCategoryGroup;
		$[23] = onToggleCollapse;
		$[24] = show3Columns;
		$[25] = showBudgetedColumn;
		$[26] = showHiddenCategories;
		$[27] = t9;
	} else t9 = $[27];
	let t10;
	if ($[28] !== incomeGroup || $[29] !== isCollapsed || $[30] !== month || $[31] !== onBudgetAction || $[32] !== onEditCategory || $[33] !== onEditCategoryGroup || $[34] !== onToggleCollapse || $[35] !== showHiddenCategories) {
		t10 = incomeGroup && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IncomeGroup, {
			categoryGroup: incomeGroup,
			month,
			showHiddenCategories,
			onEditCategoryGroup,
			onEditCategory,
			onBudgetAction,
			isCollapsed,
			onToggleCollapse
		});
		$[28] = incomeGroup;
		$[29] = isCollapsed;
		$[30] = month;
		$[31] = onBudgetAction;
		$[32] = onEditCategory;
		$[33] = onEditCategoryGroup;
		$[34] = onToggleCollapse;
		$[35] = showHiddenCategories;
		$[36] = t10;
	} else t10 = $[36];
	let t11;
	if ($[37] !== t10 || $[38] !== t9) {
		t11 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(View, {
			"data-testid": "budget-groups",
			style: t8,
			children: [t9, t10]
		});
		$[37] = t10;
		$[38] = t9;
		$[39] = t11;
	} else t11 = $[39];
	return t11;
}
function _temp2$10(group_1) {
	return !group_1.is_income;
}
function _temp$14(group_0) {
	return group_0.is_income;
}
function BudgetTable(t0) {
	const $ = (0, import_compiler_runtime.c)(27);
	const { categoryGroups, month, onShowBudgetSummary, onBudgetAction, onRefresh, onEditCategoryGroup, onEditCategory } = t0;
	const { width } = useResponsive();
	const show3Columns = width >= 300;
	const [t1, setShowSpentColumnPref] = useLocalPref("mobile.showSpentColumn");
	const showSpentColumn = t1 === void 0 ? false : t1;
	let t2;
	if ($[0] !== setShowSpentColumnPref || $[1] !== showSpentColumn) {
		t2 = function toggleSpentColumn() {
			setShowSpentColumnPref(!showSpentColumn);
		};
		$[0] = setShowSpentColumnPref;
		$[1] = showSpentColumn;
		$[2] = t2;
	} else t2 = $[2];
	const toggleSpentColumn = t2;
	const [t3] = useLocalPref("budget.showHiddenCategories");
	const showHiddenCategories = t3 === void 0 ? false : t3;
	const [t4] = useSyncedPref("budgetType");
	const budgetType = t4 === void 0 ? "envelope" : t4;
	let t5;
	if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
		t5 = q("schedules").select("*");
		$[3] = t5;
	} else t5 = $[3];
	const schedulesQuery = t5;
	let t6;
	if ($[4] !== month || $[5] !== onShowBudgetSummary || $[6] !== show3Columns || $[7] !== showSpentColumn || $[8] !== toggleSpentColumn) {
		t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BudgetTableHeader, {
			month,
			show3Columns,
			showSpentColumn,
			toggleSpentColumn,
			onShowBudgetSummary
		});
		$[4] = month;
		$[5] = onShowBudgetSummary;
		$[6] = show3Columns;
		$[7] = showSpentColumn;
		$[8] = toggleSpentColumn;
		$[9] = t6;
	} else t6 = $[9];
	let t7;
	if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
		t7 = {
			backgroundColor: theme.pageBackground,
			minHeight: "100vh",
			paddingBottom: MOBILE_NAV_HEIGHT
		};
		$[10] = t7;
	} else t7 = $[10];
	const t8 = !showSpentColumn;
	let t9;
	if ($[11] !== budgetType || $[12] !== categoryGroups || $[13] !== month || $[14] !== onBudgetAction || $[15] !== onEditCategory || $[16] !== onEditCategoryGroup || $[17] !== show3Columns || $[18] !== showHiddenCategories || $[19] !== t8) {
		t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, {
			"data-testid": "budget-table",
			style: t7,
			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SchedulesProvider, {
				query: schedulesQuery,
				children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BudgetGroups, {
					type: budgetType,
					categoryGroups,
					showBudgetedColumn: t8,
					show3Columns,
					showHiddenCategories,
					month,
					onEditCategoryGroup,
					onEditCategory,
					onBudgetAction
				})
			})
		});
		$[11] = budgetType;
		$[12] = categoryGroups;
		$[13] = month;
		$[14] = onBudgetAction;
		$[15] = onEditCategory;
		$[16] = onEditCategoryGroup;
		$[17] = show3Columns;
		$[18] = showHiddenCategories;
		$[19] = t8;
		$[20] = t9;
	} else t9 = $[20];
	let t10;
	if ($[21] !== onRefresh || $[22] !== t9) {
		t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PullToRefresh, {
			onRefresh,
			children: t9
		});
		$[21] = onRefresh;
		$[22] = t9;
		$[23] = t10;
	} else t10 = $[23];
	let t11;
	if ($[24] !== t10 || $[25] !== t6) {
		t11 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [t6, t10] });
		$[24] = t10;
		$[25] = t6;
		$[26] = t11;
	} else t11 = $[26];
	return t11;
}
function BudgetTableHeader(t0) {
	const $ = (0, import_compiler_runtime.c)(50);
	const { show3Columns, month, onShowBudgetSummary, showSpentColumn, toggleSpentColumn } = t0;
	const { t } = useTranslation();
	const format = useFormat();
	const [t1] = useSyncedPref("budgetType");
	const budgetType = t1 === void 0 ? "envelope" : t1;
	let t2;
	if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
		t2 = {
			padding: 0,
			backgroundColor: "transparent",
			borderRadius: "unset"
		};
		$[0] = t2;
	} else t2 = $[0];
	const buttonStyle = t2;
	let t3;
	if ($[1] !== show3Columns) {
		t3 = getColumnWidth({
			show3Columns,
			isSidebar: true
		});
		$[1] = show3Columns;
		$[2] = t3;
	} else t3 = $[2];
	const sidebarColumnWidth = t3;
	let t4;
	if ($[3] !== show3Columns) {
		t4 = getColumnWidth({ show3Columns });
		$[3] = show3Columns;
		$[4] = t4;
	} else t4 = $[4];
	const columnWidth = t4;
	let t5;
	if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
		t5 = {
			...styles.tnum,
			color: theme.budgetNumberNeutral,
			textAlign: "right",
			fontSize: 12,
			fontWeight: "500"
		};
		$[5] = t5;
	} else t5 = $[5];
	const amountStyle = t5;
	const t6 = isCurrentMonth(month) ? theme.budgetHeaderCurrentMonth : theme.budgetHeaderOtherMonth;
	let t7;
	if ($[6] !== t6) {
		t7 = {
			flexDirection: "row",
			justifyContent: "space-between",
			alignItems: "center",
			flexShrink: 0,
			padding: "10px 15px",
			paddingLeft: 10,
			backgroundColor: t6,
			borderBottomWidth: 1,
			borderColor: theme.tableBorder
		};
		$[6] = t6;
		$[7] = t7;
	} else t7 = $[7];
	let t8;
	if ($[8] !== sidebarColumnWidth) {
		t8 = {
			width: sidebarColumnWidth,
			flexDirection: "row",
			justifyContent: "flex-start",
			alignItems: "center"
		};
		$[8] = sidebarColumnWidth;
		$[9] = t8;
	} else t8 = $[9];
	let t9;
	if ($[10] !== budgetType || $[11] !== month || $[12] !== onShowBudgetSummary || $[13] !== show3Columns) {
		t9 = budgetType === "tracking" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Saved, {
			projected: month >= currentMonth(),
			onPress: onShowBudgetSummary,
			show3Columns
		}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToBudget, {
			toBudget: envelopeBudget.toBudget,
			onPress: onShowBudgetSummary,
			show3Columns
		});
		$[10] = budgetType;
		$[11] = month;
		$[12] = onShowBudgetSummary;
		$[13] = show3Columns;
		$[14] = t9;
	} else t9 = $[14];
	let t10;
	if ($[15] !== t8 || $[16] !== t9) {
		t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, {
			style: t8,
			children: t9
		});
		$[15] = t8;
		$[16] = t9;
		$[17] = t10;
	} else t10 = $[17];
	let t11;
	if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
		t11 = {
			flexDirection: "row",
			justifyContent: "flex-end",
			alignItems: "center"
		};
		$[18] = t11;
	} else t11 = $[18];
	let t12;
	if ($[19] !== budgetType || $[20] !== columnWidth || $[21] !== format || $[22] !== show3Columns || $[23] !== showSpentColumn || $[24] !== t || $[25] !== toggleSpentColumn) {
		t12 = (show3Columns || !showSpentColumn) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CellValue, {
			binding: budgetType === "tracking" ? trackingBudget.totalBudgetedExpense : envelopeBudget.totalBudgeted,
			type: "financial",
			children: (t13) => {
				const { type: formatType, value } = t13;
				return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
					variant: "bare",
					isDisabled: show3Columns,
					onPress: toggleSpentColumn,
					style: {
						...buttonStyle,
						width: columnWidth
					},
					children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(View, {
						style: {
							flex: 1,
							alignItems: "flex-end"
						},
						children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(View, {
							style: {
								flexDirection: "row",
								alignItems: "center"
							},
							children: [!show3Columns && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SvgViewShow, {
								width: 12,
								height: 12,
								style: {
									flexShrink: 0,
									color: theme.pageTextSubdued,
									marginRight: 5
								}
							}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AutoTextSize, {
								as: Label,
								minFontSizePx: 8,
								maxFontSizePx: 12,
								mode: "multiline",
								title: t("Budgeted"),
								style: {
									color: theme.formInputText,
									paddingRight: 4
								}
							}) })]
						}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PrivacyFilter, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AutoTextSize, {
							as: Text,
							minFontSizePx: 6,
							maxFontSizePx: 12,
							mode: "oneline",
							style: {
								...amountStyle,
								paddingRight: 4
							},
							children: format(budgetType === "tracking" ? value : -value, formatType)
						}, value) }) })]
					})
				});
			}
		});
		$[19] = budgetType;
		$[20] = columnWidth;
		$[21] = format;
		$[22] = show3Columns;
		$[23] = showSpentColumn;
		$[24] = t;
		$[25] = toggleSpentColumn;
		$[26] = t12;
	} else t12 = $[26];
	let t13;
	if ($[27] !== budgetType || $[28] !== columnWidth || $[29] !== format || $[30] !== show3Columns || $[31] !== showSpentColumn || $[32] !== t || $[33] !== toggleSpentColumn) {
		t13 = (show3Columns || showSpentColumn) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CellValue, {
			binding: budgetType === "tracking" ? trackingBudget.totalSpent : envelopeBudget.totalSpent,
			type: "financial",
			children: (t14) => {
				const { type, value: value_0 } = t14;
				return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
					variant: "bare",
					isDisabled: show3Columns,
					onPress: toggleSpentColumn,
					style: {
						...buttonStyle,
						width: columnWidth
					},
					children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(View, {
						style: {
							flex: 1,
							alignItems: "flex-end"
						},
						children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(View, {
							style: {
								flexDirection: "row",
								alignItems: "center"
							},
							children: [!show3Columns && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SvgViewShow, {
								width: 12,
								height: 12,
								style: {
									flexShrink: 0,
									color: theme.pageTextSubdued,
									marginRight: 5
								}
							}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AutoTextSize, {
								as: Label,
								minFontSizePx: 6,
								maxFontSizePx: 12,
								mode: "oneline",
								title: t("Spent"),
								style: {
									color: theme.formInputText,
									paddingRight: 4
								}
							}) })]
						}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PrivacyFilter, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AutoTextSize, {
							as: Text,
							minFontSizePx: 6,
							maxFontSizePx: 12,
							mode: "oneline",
							style: {
								...amountStyle,
								paddingRight: 4
							},
							children: format(value_0, type)
						}, value_0) }) })]
					})
				});
			}
		});
		$[27] = budgetType;
		$[28] = columnWidth;
		$[29] = format;
		$[30] = show3Columns;
		$[31] = showSpentColumn;
		$[32] = t;
		$[33] = toggleSpentColumn;
		$[34] = t13;
	} else t13 = $[34];
	const t14 = budgetType === "tracking" ? trackingBudget.totalLeftover : envelopeBudget.totalBalance;
	let t15;
	if ($[35] !== columnWidth || $[36] !== format || $[37] !== t) {
		t15 = (t16) => {
			const { type: type_0, value: value_1 } = t16;
			return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, {
				style: { width: columnWidth },
				children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(View, {
					style: {
						flex: 1,
						alignItems: "flex-end !important"
					},
					children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AutoTextSize, {
						as: Label,
						minFontSizePx: 6,
						maxFontSizePx: 12,
						mode: "oneline",
						title: t("Balance"),
						style: { color: theme.formInputText }
					}) }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PrivacyFilter, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AutoTextSize, {
						as: Text,
						minFontSizePx: 6,
						maxFontSizePx: 12,
						mode: "oneline",
						style: amountStyle,
						children: format(value_1, type_0)
					}, value_1) }) })]
				})
			});
		};
		$[35] = columnWidth;
		$[36] = format;
		$[37] = t;
		$[38] = t15;
	} else t15 = $[38];
	let t16;
	if ($[39] !== t14 || $[40] !== t15) {
		t16 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CellValue, {
			binding: t14,
			type: "financial",
			children: t15
		});
		$[39] = t14;
		$[40] = t15;
		$[41] = t16;
	} else t16 = $[41];
	let t17;
	if ($[42] !== t12 || $[43] !== t13 || $[44] !== t16) {
		t17 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(View, {
			style: t11,
			children: [
				t12,
				t13,
				t16
			]
		});
		$[42] = t12;
		$[43] = t13;
		$[44] = t16;
		$[45] = t17;
	} else t17 = $[45];
	let t18;
	if ($[46] !== t10 || $[47] !== t17 || $[48] !== t7) {
		t18 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(View, {
			"data-testid": "budget-table-header",
			style: t7,
			children: [t10, t17]
		});
		$[46] = t10;
		$[47] = t17;
		$[48] = t7;
		$[49] = t18;
	} else t18 = $[49];
	return t18;
}
//#endregion
//#region src/components/mobile/budget/BudgetPage.tsx
function isBudgetType(input) {
	return ["envelope", "tracking"].includes(input);
}
function BudgetPage() {
	const $ = (0, import_compiler_runtime.c)(150);
	const { t } = useTranslation();
	const locale = useLocale();
	const { data: t0 } = useCategories();
	let t1;
	if ($[0] !== t0) {
		t1 = t0 === void 0 ? {
			list: [],
			grouped: []
		} : t0;
		$[0] = t0;
		$[1] = t1;
	} else t1 = $[1];
	const { list: categories, grouped: categoryGroups } = t1;
	const [budgetTypePref] = useSyncedPref("budgetType");
	let t2;
	if ($[2] !== budgetTypePref) {
		t2 = isBudgetType(budgetTypePref) ? budgetTypePref : "envelope";
		$[2] = budgetTypePref;
		$[3] = t2;
	} else t2 = $[3];
	const budgetType = t2;
	const spreadsheet = useSpreadsheet();
	let t3;
	if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
		t3 = currentMonth();
		$[4] = t3;
	} else t3 = $[4];
	const currMonth = t3;
	const [t4, setStartMonthPref] = useLocalPref("budget.startMonth");
	const startMonth = t4 === void 0 ? currMonth : t4;
	let t5;
	if ($[5] !== startMonth) {
		t5 = {
			start: startMonth,
			end: startMonth
		};
		$[5] = startMonth;
		$[6] = t5;
	} else t5 = $[6];
	const [monthBounds, setMonthBounds] = (0, import_react.useState)(t5);
	const [initialized, setInitialized] = (0, import_react.useState)(false);
	const [_numberFormat] = useSyncedPref("numberFormat");
	const numberFormat = _numberFormat || "comma-dot";
	const [hideFraction] = useSyncedPref("hideFraction");
	const dispatch = useDispatch();
	const applyBudgetAction = useBudgetActions();
	const createCategory = useCreateCategoryMutation();
	const saveCategory = useSaveCategoryMutation();
	const deleteCategory = useDeleteCategoryMutation();
	const createCategoryGroup = useCreateCategoryGroupMutation();
	const saveCategoryGroup = useSaveCategoryGroupMutation();
	const deleteCategoryGroup = useDeleteCategoryGroupMutation();
	let t6;
	if ($[7] !== budgetType || $[8] !== spreadsheet || $[9] !== startMonth) {
		t6 = () => {
			(async function init() {
				const { start, end } = await send("get-budget-bounds");
				setMonthBounds({
					start,
					end
				});
				await prewarmMonth(budgetType, spreadsheet, startMonth);
				setInitialized(true);
			})();
		};
		$[7] = budgetType;
		$[8] = spreadsheet;
		$[9] = startMonth;
		$[10] = t6;
	} else t6 = $[10];
	let t7;
	if ($[11] !== budgetType || $[12] !== dispatch || $[13] !== spreadsheet || $[14] !== startMonth) {
		t7 = [
			budgetType,
			startMonth,
			dispatch,
			spreadsheet
		];
		$[11] = budgetType;
		$[12] = dispatch;
		$[13] = spreadsheet;
		$[14] = startMonth;
		$[15] = t7;
	} else t7 = $[15];
	(0, import_react.useEffect)(t6, t7);
	let t8;
	if ($[16] !== applyBudgetAction) {
		t8 = async (month, type, args) => {
			applyBudgetAction.mutate({
				month,
				type,
				args
			});
		};
		$[16] = applyBudgetAction;
		$[17] = t8;
	} else t8 = $[17];
	const onBudgetAction = t8;
	let t9;
	if ($[18] !== budgetType || $[19] !== dispatch || $[20] !== onBudgetAction || $[21] !== startMonth) {
		t9 = () => {
			if (budgetType === "tracking") dispatch(pushModal({ modal: {
				name: "tracking-budget-summary",
				options: { month: startMonth }
			} }));
			else dispatch(pushModal({ modal: {
				name: "envelope-budget-summary",
				options: {
					month: startMonth,
					onBudgetAction
				}
			} }));
		};
		$[18] = budgetType;
		$[19] = dispatch;
		$[20] = onBudgetAction;
		$[21] = startMonth;
		$[22] = t9;
	} else t9 = $[22];
	const onShowBudgetSummary = t9;
	let t10;
	if ($[23] !== createCategoryGroup || $[24] !== dispatch) {
		t10 = () => {
			dispatch(pushModal({ modal: {
				name: "new-category-group",
				options: {
					onValidate: _temp$13,
					onSubmit: async (name_0) => {
						createCategoryGroup.mutate({ name: name_0 }, { onSettled: () => {
							dispatch(collapseModals({ rootModalName: "budget-page-menu" }));
						} });
					}
				}
			} }));
		};
		$[23] = createCategoryGroup;
		$[24] = dispatch;
		$[25] = t10;
	} else t10 = $[25];
	const onOpenNewCategoryGroupModal = t10;
	let t11;
	if ($[26] !== createCategory || $[27] !== dispatch) {
		t11 = (groupId, isIncome) => {
			dispatch(pushModal({ modal: {
				name: "new-category",
				options: {
					onValidate: _temp2$9,
					onSubmit: async (name_2) => {
						createCategory.mutate({
							name: name_2,
							groupId,
							isIncome,
							isHidden: false
						}, { onSettled: () => {
							dispatch(collapseModals({ rootModalName: "category-group-menu" }));
						} });
					}
				}
			} }));
		};
		$[26] = createCategory;
		$[27] = dispatch;
		$[28] = t11;
	} else t11 = $[28];
	const onOpenNewCategoryModal = t11;
	let t12;
	if ($[29] !== saveCategoryGroup) {
		t12 = (group) => {
			saveCategoryGroup.mutate({ group });
		};
		$[29] = saveCategoryGroup;
		$[30] = t12;
	} else t12 = $[30];
	const onSaveGroup = t12;
	let t13;
	if ($[31] !== applyBudgetAction || $[32] !== startMonth) {
		t13 = async (categories_0) => {
			applyBudgetAction.mutate({
				month: startMonth,
				type: "apply-multiple-templates",
				args: { categories: categories_0 }
			});
		};
		$[31] = applyBudgetAction;
		$[32] = startMonth;
		$[33] = t13;
	} else t13 = $[33];
	const onApplyBudgetTemplatesInGroup = t13;
	let t14;
	if ($[34] !== deleteCategoryGroup || $[35] !== dispatch) {
		t14 = (groupId_0) => {
			deleteCategoryGroup.mutate({ id: groupId_0 }, { onSettled: () => {
				dispatch(collapseModals({ rootModalName: "category-group-menu" }));
			} });
		};
		$[34] = deleteCategoryGroup;
		$[35] = dispatch;
		$[36] = t14;
	} else t14 = $[36];
	const onDeleteGroup = t14;
	let t15;
	if ($[37] !== categoryGroups || $[38] !== dispatch || $[39] !== onSaveGroup) {
		t15 = (groupId_1) => {
			const group_0 = categoryGroups.find((g) => g.id === groupId_1);
			onSaveGroup({
				...group_0,
				hidden: group_0.hidden ? false : true
			});
			dispatch(collapseModals({ rootModalName: "category-group-menu" }));
		};
		$[37] = categoryGroups;
		$[38] = dispatch;
		$[39] = onSaveGroup;
		$[40] = t15;
	} else t15 = $[40];
	const onToggleGroupVisibility = t15;
	let t16;
	if ($[41] !== saveCategory) {
		t16 = (category) => {
			saveCategory.mutate({ category });
		};
		$[41] = saveCategory;
		$[42] = t16;
	} else t16 = $[42];
	const onSaveCategory = t16;
	let t17;
	if ($[43] !== deleteCategory || $[44] !== dispatch) {
		t17 = (categoryId) => {
			deleteCategory.mutate({ id: categoryId }, { onSettled: () => {
				dispatch(collapseModals({ rootModalName: "category-menu" }));
			} });
		};
		$[43] = deleteCategory;
		$[44] = dispatch;
		$[45] = t17;
	} else t17 = $[45];
	const onDeleteCategory = t17;
	let t18;
	if ($[46] !== categories || $[47] !== dispatch || $[48] !== onSaveCategory) {
		t18 = (categoryId_0) => {
			const category_0 = categories.find((c) => c.id === categoryId_0);
			onSaveCategory({
				...category_0,
				hidden: category_0.hidden ? false : true
			});
			dispatch(collapseModals({ rootModalName: "category-menu" }));
		};
		$[46] = categories;
		$[47] = dispatch;
		$[48] = onSaveCategory;
		$[49] = t18;
	} else t18 = $[49];
	const onToggleCategoryVisibility = t18;
	let t19;
	if ($[50] !== budgetType || $[51] !== setStartMonthPref || $[52] !== spreadsheet || $[53] !== startMonth) {
		t19 = async () => {
			const month_0 = subMonths(startMonth, 1);
			await prewarmMonth(budgetType, spreadsheet, month_0);
			setStartMonthPref(month_0);
			setInitialized(true);
		};
		$[50] = budgetType;
		$[51] = setStartMonthPref;
		$[52] = spreadsheet;
		$[53] = startMonth;
		$[54] = t19;
	} else t19 = $[54];
	const onPrevMonth = t19;
	let t20;
	if ($[55] !== budgetType || $[56] !== setStartMonthPref || $[57] !== spreadsheet || $[58] !== startMonth) {
		t20 = async () => {
			const month_1 = addMonths(startMonth, 1);
			await prewarmMonth(budgetType, spreadsheet, month_1);
			setStartMonthPref(month_1);
			setInitialized(true);
		};
		$[55] = budgetType;
		$[56] = setStartMonthPref;
		$[57] = spreadsheet;
		$[58] = startMonth;
		$[59] = t20;
	} else t20 = $[59];
	const onNextMonth = t20;
	let t21;
	if ($[60] !== budgetType || $[61] !== setStartMonthPref || $[62] !== spreadsheet) {
		t21 = async () => {
			await prewarmMonth(budgetType, spreadsheet, currMonth);
			setStartMonthPref(currMonth);
			setInitialized(true);
		};
		$[60] = budgetType;
		$[61] = setStartMonthPref;
		$[62] = spreadsheet;
		$[63] = t21;
	} else t21 = $[63];
	const onCurrentMonth = t21;
	const onSaveNotes = _temp3$2;
	let t22;
	if ($[64] !== categoryGroups || $[65] !== dispatch) {
		t22 = (id_0) => {
			dispatch(pushModal({ modal: {
				name: "notes",
				options: {
					id: id_0,
					name: categoryGroups.find((g_0) => g_0.id === id_0).name,
					onSave: onSaveNotes
				}
			} }));
		};
		$[64] = categoryGroups;
		$[65] = dispatch;
		$[66] = t22;
	} else t22 = $[66];
	const onOpenCategoryGroupNotesModal = t22;
	let t23;
	if ($[67] !== categories || $[68] !== dispatch) {
		t23 = (id_1) => {
			dispatch(pushModal({ modal: {
				name: "notes",
				options: {
					id: id_1,
					name: categories.find((c_0) => c_0.id === id_1).name,
					onSave: onSaveNotes
				}
			} }));
		};
		$[67] = categories;
		$[68] = dispatch;
		$[69] = t23;
	} else t23 = $[69];
	const onOpenCategoryNotesModal = t23;
	let t24;
	if ($[70] !== categoryGroups || $[71] !== dispatch || $[72] !== onApplyBudgetTemplatesInGroup || $[73] !== onDeleteGroup || $[74] !== onOpenCategoryGroupNotesModal || $[75] !== onOpenNewCategoryModal || $[76] !== onSaveGroup || $[77] !== onToggleGroupVisibility) {
		t24 = (id_2) => {
			dispatch(pushModal({ modal: {
				name: "category-group-menu",
				options: {
					groupId: categoryGroups.find((g_1) => g_1.id === id_2).id,
					onSave: onSaveGroup,
					onAddCategory: onOpenNewCategoryModal,
					onEditNotes: onOpenCategoryGroupNotesModal,
					onDelete: onDeleteGroup,
					onToggleVisibility: onToggleGroupVisibility,
					onApplyBudgetTemplatesInGroup
				}
			} }));
		};
		$[70] = categoryGroups;
		$[71] = dispatch;
		$[72] = onApplyBudgetTemplatesInGroup;
		$[73] = onDeleteGroup;
		$[74] = onOpenCategoryGroupNotesModal;
		$[75] = onOpenNewCategoryModal;
		$[76] = onSaveGroup;
		$[77] = onToggleGroupVisibility;
		$[78] = t24;
	} else t24 = $[78];
	const onOpenCategoryGroupMenuModal = t24;
	let t25;
	if ($[79] !== categories || $[80] !== dispatch || $[81] !== onDeleteCategory || $[82] !== onOpenCategoryNotesModal || $[83] !== onSaveCategory || $[84] !== onToggleCategoryVisibility) {
		t25 = (id_3) => {
			dispatch(pushModal({ modal: {
				name: "category-menu",
				options: {
					categoryId: categories.find((c_1) => c_1.id === id_3).id,
					onSave: onSaveCategory,
					onEditNotes: onOpenCategoryNotesModal,
					onDelete: onDeleteCategory,
					onToggleVisibility: onToggleCategoryVisibility
				}
			} }));
		};
		$[79] = categories;
		$[80] = dispatch;
		$[81] = onDeleteCategory;
		$[82] = onOpenCategoryNotesModal;
		$[83] = onSaveCategory;
		$[84] = onToggleCategoryVisibility;
		$[85] = t25;
	} else t25 = $[85];
	const onOpenCategoryMenuModal = t25;
	const [showHiddenCategories, setShowHiddenCategoriesPref] = useLocalPref("budget.showHiddenCategories");
	let t26;
	if ($[86] !== dispatch || $[87] !== setShowHiddenCategoriesPref || $[88] !== showHiddenCategories) {
		t26 = () => {
			setShowHiddenCategoriesPref(!showHiddenCategories);
			dispatch(collapseModals({ rootModalName: "budget-page-menu" }));
		};
		$[86] = dispatch;
		$[87] = setShowHiddenCategoriesPref;
		$[88] = showHiddenCategories;
		$[89] = t26;
	} else t26 = $[89];
	const onToggleHiddenCategories = t26;
	let t27;
	if ($[90] !== dispatch || $[91] !== locale) {
		t27 = (month_2) => {
			dispatch(pushModal({ modal: {
				name: "notes",
				options: {
					id: `budget-${month_2}`,
					name: format(month_2, "MMMM ''yy", locale),
					onSave: onSaveNotes
				}
			} }));
		};
		$[90] = dispatch;
		$[91] = locale;
		$[92] = t27;
	} else t27 = $[92];
	const onOpenBudgetMonthNotesModal = t27;
	let t28;
	if ($[93] !== dispatch) {
		t28 = () => {
			dispatch(closeBudget());
		};
		$[93] = dispatch;
		$[94] = t28;
	} else t28 = $[94];
	const onSwitchBudgetFile = t28;
	let t29;
	if ($[95] !== budgetType || $[96] !== dispatch || $[97] !== onBudgetAction || $[98] !== onOpenBudgetMonthNotesModal) {
		t29 = (month_3) => {
			dispatch(pushModal({ modal: {
				name: `${budgetType}-budget-month-menu`,
				options: {
					month: month_3,
					onBudgetAction,
					onEditNotes: onOpenBudgetMonthNotesModal
				}
			} }));
		};
		$[95] = budgetType;
		$[96] = dispatch;
		$[97] = onBudgetAction;
		$[98] = onOpenBudgetMonthNotesModal;
		$[99] = t29;
	} else t29 = $[99];
	const onOpenBudgetMonthMenu = t29;
	let t30;
	if ($[100] !== dispatch || $[101] !== onOpenNewCategoryGroupModal || $[102] !== onSwitchBudgetFile || $[103] !== onToggleHiddenCategories) {
		t30 = () => {
			dispatch(pushModal({ modal: {
				name: "budget-page-menu",
				options: {
					onAddCategoryGroup: onOpenNewCategoryGroupModal,
					onToggleHiddenCategories,
					onSwitchBudgetFile
				}
			} }));
		};
		$[100] = dispatch;
		$[101] = onOpenNewCategoryGroupModal;
		$[102] = onSwitchBudgetFile;
		$[103] = onToggleHiddenCategories;
		$[104] = t30;
	} else t30 = $[104];
	const onOpenBudgetPageMenu = t30;
	if (!categoryGroups || !initialized) {
		let t31;
		if ($[105] === Symbol.for("react.memo_cache_sentinel")) {
			t31 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, {
				style: {
					flex: 1,
					backgroundColor: theme.mobilePageBackground,
					alignItems: "center",
					justifyContent: "center",
					marginBottom: 25
				},
				children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AnimatedLoading, {
					width: 25,
					height: 25
				})
			});
			$[105] = t31;
		} else t31 = $[105];
		return t31;
	}
	let t31;
	if ($[106] !== monthBounds || $[107] !== onNextMonth || $[108] !== onOpenBudgetMonthMenu || $[109] !== onPrevMonth || $[110] !== startMonth) {
		t31 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MonthSelector, {
			month: startMonth,
			monthBounds,
			onOpenMonthMenu: onOpenBudgetMonthMenu,
			onPrevMonth,
			onNextMonth
		});
		$[106] = monthBounds;
		$[107] = onNextMonth;
		$[108] = onOpenBudgetMonthMenu;
		$[109] = onPrevMonth;
		$[110] = startMonth;
		$[111] = t31;
	} else t31 = $[111];
	let t32;
	if ($[112] === Symbol.for("react.memo_cache_sentinel")) {
		t32 = { margin: 10 };
		$[112] = t32;
	} else t32 = $[112];
	let t33;
	if ($[113] !== t) {
		t33 = t("Budget page menu");
		$[113] = t;
		$[114] = t33;
	} else t33 = $[114];
	let t34;
	if ($[115] === Symbol.for("react.memo_cache_sentinel")) {
		t34 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SvgLogo, {
			style: { color: theme.mobileHeaderText },
			width: "20",
			height: "20"
		});
		$[115] = t34;
	} else t34 = $[115];
	let t35;
	if ($[116] === Symbol.for("react.memo_cache_sentinel")) {
		t35 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SvgCheveronRight, {
			style: {
				flexShrink: 0,
				color: theme.mobileHeaderTextSubdued
			},
			width: "14",
			height: "14"
		});
		$[116] = t35;
	} else t35 = $[116];
	let t36;
	if ($[117] !== onOpenBudgetPageMenu || $[118] !== t33) {
		t36 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button, {
			variant: "bare",
			style: t32,
			onPress: onOpenBudgetPageMenu,
			"aria-label": t33,
			children: [t34, t35]
		});
		$[117] = onOpenBudgetPageMenu;
		$[118] = t33;
		$[119] = t36;
	} else t36 = $[119];
	let t37;
	if ($[120] !== onCurrentMonth || $[121] !== startMonth || $[122] !== t) {
		t37 = !isCurrentMonth(startMonth) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
			variant: "bare",
			onPress: onCurrentMonth,
			"aria-label": t("Today"),
			style: { margin: 10 },
			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SvgCalendar, {
				width: 20,
				height: 20
			})
		});
		$[120] = onCurrentMonth;
		$[121] = startMonth;
		$[122] = t;
		$[123] = t37;
	} else t37 = $[123];
	let t38;
	if ($[124] !== t31 || $[125] !== t36 || $[126] !== t37) {
		t38 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MobilePageHeader, {
			title: t31,
			leftContent: t36,
			rightContent: t37
		});
		$[124] = t31;
		$[125] = t36;
		$[126] = t37;
		$[127] = t38;
	} else t38 = $[127];
	let t39;
	if ($[128] !== startMonth) {
		t39 = sheetForMonth(startMonth);
		$[128] = startMonth;
		$[129] = t39;
	} else t39 = $[129];
	let t40;
	if ($[130] !== dispatch) {
		t40 = async () => {
			dispatch(sync());
		};
		$[130] = dispatch;
		$[131] = t40;
	} else t40 = $[131];
	let t41;
	if ($[132] !== categoryGroups || $[133] !== hideFraction || $[134] !== numberFormat || $[135] !== onBudgetAction || $[136] !== onOpenCategoryGroupMenuModal || $[137] !== onOpenCategoryMenuModal || $[138] !== onShowBudgetSummary || $[139] !== startMonth) {
		t41 = (t42) => {
			const { onRefresh } = t42;
			return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Banners, {
				month: startMonth,
				onBudgetAction
			}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BudgetTable, {
				categoryGroups,
				month: startMonth,
				onShowBudgetSummary,
				onBudgetAction,
				onRefresh,
				onEditCategoryGroup: onOpenCategoryGroupMenuModal,
				onEditCategory: onOpenCategoryMenuModal
			}, `${numberFormat}${hideFraction}`)] });
		};
		$[132] = categoryGroups;
		$[133] = hideFraction;
		$[134] = numberFormat;
		$[135] = onBudgetAction;
		$[136] = onOpenCategoryGroupMenuModal;
		$[137] = onOpenCategoryMenuModal;
		$[138] = onShowBudgetSummary;
		$[139] = startMonth;
		$[140] = t41;
	} else t41 = $[140];
	let t42;
	if ($[141] !== t40 || $[142] !== t41) {
		t42 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SyncRefresh, {
			onSync: t40,
			children: t41
		});
		$[141] = t40;
		$[142] = t41;
		$[143] = t42;
	} else t42 = $[143];
	let t43;
	if ($[144] !== t39 || $[145] !== t42) {
		t43 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SheetNameProvider, {
			name: t39,
			children: t42
		});
		$[144] = t39;
		$[145] = t42;
		$[146] = t43;
	} else t43 = $[146];
	let t44;
	if ($[147] !== t38 || $[148] !== t43) {
		t44 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Page, {
			padding: 0,
			header: t38,
			children: t43
		});
		$[147] = t38;
		$[148] = t43;
		$[149] = t44;
	} else t44 = $[149];
	return t44;
}
async function _temp3$2(id, notes) {
	await send("notes-save", {
		id,
		note: notes
	});
}
function _temp2$9(name_1) {
	return !name_1 ? "Name is required." : null;
}
function _temp$13(name) {
	return !name ? "Name is required." : null;
}
function Banners(t0) {
	const $ = (0, import_compiler_runtime.c)(13);
	const { month, onBudgetAction } = t0;
	const { t } = useTranslation();
	const [t1] = useSyncedPref("budgetType");
	const budgetType = t1 === void 0 ? "envelope" : t1;
	let t2;
	if ($[0] !== t) {
		t2 = t("Banners");
		$[0] = t;
		$[1] = t2;
	} else t2 = $[1];
	let t3;
	let t4;
	if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
		t3 = { backgroundColor: theme.mobilePageBackground };
		t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(UncategorizedTransactionsBanner, {});
		$[2] = t3;
		$[3] = t4;
	} else {
		t3 = $[2];
		t4 = $[3];
	}
	let t5;
	let t6;
	if ($[4] !== budgetType || $[5] !== month || $[6] !== onBudgetAction) {
		t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(OverspendingBanner, {
			month,
			onBudgetAction,
			budgetType
		});
		t6 = budgetType === "envelope" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(OverbudgetedBanner, {
			month,
			onBudgetAction
		});
		$[4] = budgetType;
		$[5] = month;
		$[6] = onBudgetAction;
		$[7] = t5;
		$[8] = t6;
	} else {
		t5 = $[7];
		t6 = $[8];
	}
	let t7;
	if ($[9] !== t2 || $[10] !== t5 || $[11] !== t6) {
		t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)($72e60046c03fbe42$export$a7bfbda1311ca015, {
			"aria-label": t2,
			style: t3,
			children: [
				t4,
				t5,
				t6
			]
		});
		$[9] = t2;
		$[10] = t5;
		$[11] = t6;
		$[12] = t7;
	} else t7 = $[12];
	return t7;
}
function Banner(t0) {
	const $ = (0, import_compiler_runtime.c)(5);
	const { type: t1, children } = t0;
	const type = t1 === void 0 ? "info" : t1;
	const t2 = type === "critical" ? theme.errorBackground : type === "warning" ? theme.warningBackground : theme.noticeBackground;
	let t3;
	if ($[0] !== t2) {
		t3 = {
			height: 50,
			marginTop: 10,
			marginBottom: 10,
			padding: 10,
			justifyContent: "center",
			backgroundColor: t2
		};
		$[0] = t2;
		$[1] = t3;
	} else t3 = $[1];
	let t4;
	if ($[2] !== children || $[3] !== t3) {
		t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Card, {
			style: t3,
			children
		});
		$[2] = children;
		$[3] = t3;
		$[4] = t4;
	} else t4 = $[4];
	return t4;
}
function UncategorizedTransactionsBanner(props) {
	const $ = (0, import_compiler_runtime.c)(57);
	const navigate = useNavigate();
	const format = useFormat();
	let t0;
	if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
		t0 = uncategorizedTransactions().select("*");
		$[0] = t0;
	} else t0 = $[0];
	const transactionsQuery = t0;
	let t1;
	if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
		t1 = {
			query: transactionsQuery,
			options: { pageSize: 1e3 }
		};
		$[1] = t1;
	} else t1 = $[1];
	const { transactions, isPending: isTransactionsLoading } = useTransactions(t1);
	if (isTransactionsLoading || transactions.length === 0) return null;
	let T0;
	let T1;
	let T2;
	let T3;
	let T4;
	let T5;
	let t10;
	let t2;
	let t3;
	let t4;
	let t5;
	let t6;
	let t7;
	let t8;
	let t9;
	if ($[2] !== format || $[3] !== props || $[4] !== transactions) {
		const totalUncategorizedAmount = transactions.reduce(_temp4$1, 0);
		T5 = $72e60046c03fbe42$export$e96fc9a8407faa6b;
		t9 = "Uncategorized transactions banner";
		t10 = props;
		T4 = Banner;
		t8 = "warning";
		T3 = View;
		if ($[20] === Symbol.for("react.memo_cache_sentinel")) {
			t7 = {
				flex: 1,
				flexDirection: "row",
				alignItems: "center",
				justifyContent: "space-between"
			};
			$[20] = t7;
		} else t7 = $[20];
		T2 = Text;
		T1 = Trans;
		t3 = transactions.length;
		t4 = "You have ";
		if ($[21] !== transactions.length) {
			t5 = { count: transactions.length };
			$[21] = transactions.length;
			$[22] = t5;
		} else t5 = $[22];
		t6 = " uncategorized transactions (";
		T0 = FinancialText;
		t2 = format(totalUncategorizedAmount, "financial");
		$[2] = format;
		$[3] = props;
		$[4] = transactions;
		$[5] = T0;
		$[6] = T1;
		$[7] = T2;
		$[8] = T3;
		$[9] = T4;
		$[10] = T5;
		$[11] = t10;
		$[12] = t2;
		$[13] = t3;
		$[14] = t4;
		$[15] = t5;
		$[16] = t6;
		$[17] = t7;
		$[18] = t8;
		$[19] = t9;
	} else {
		T0 = $[5];
		T1 = $[6];
		T2 = $[7];
		T3 = $[8];
		T4 = $[9];
		T5 = $[10];
		t10 = $[11];
		t2 = $[12];
		t3 = $[13];
		t4 = $[14];
		t5 = $[15];
		t6 = $[16];
		t7 = $[17];
		t8 = $[18];
		t9 = $[19];
	}
	let t11;
	if ($[23] !== t2) {
		t11 = { amount: t2 };
		$[23] = t2;
		$[24] = t11;
	} else t11 = $[24];
	const t12 = t11;
	let t13;
	if ($[25] !== T0 || $[26] !== t12) {
		t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(T0, { children: t12 });
		$[25] = T0;
		$[26] = t12;
		$[27] = t13;
	} else t13 = $[27];
	let t14;
	if ($[28] !== T1 || $[29] !== t13 || $[30] !== t3 || $[31] !== t4 || $[32] !== t5 || $[33] !== t6) {
		t14 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(T1, {
			count: t3,
			children: [
				t4,
				t5,
				t6,
				t13,
				")"
			]
		});
		$[28] = T1;
		$[29] = t13;
		$[30] = t3;
		$[31] = t4;
		$[32] = t5;
		$[33] = t6;
		$[34] = t14;
	} else t14 = $[34];
	let t15;
	if ($[35] !== T2 || $[36] !== t14) {
		t15 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(T2, { children: t14 });
		$[35] = T2;
		$[36] = t14;
		$[37] = t15;
	} else t15 = $[37];
	let t16;
	if ($[38] !== navigate) {
		t16 = () => navigate("/categories/uncategorized");
		$[38] = navigate;
		$[39] = t16;
	} else t16 = $[39];
	let t17;
	if ($[40] === Symbol.for("react.memo_cache_sentinel")) {
		t17 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Trans, { children: "Categorize" }) });
		$[40] = t17;
	} else t17 = $[40];
	let t18;
	if ($[41] !== t16) {
		t18 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
			onPress: t16,
			style: PILL_STYLE,
			children: t17
		});
		$[41] = t16;
		$[42] = t18;
	} else t18 = $[42];
	let t19;
	if ($[43] !== T3 || $[44] !== t15 || $[45] !== t18 || $[46] !== t7) {
		t19 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(T3, {
			style: t7,
			children: [t15, t18]
		});
		$[43] = T3;
		$[44] = t15;
		$[45] = t18;
		$[46] = t7;
		$[47] = t19;
	} else t19 = $[47];
	let t20;
	if ($[48] !== T4 || $[49] !== t19 || $[50] !== t8) {
		t20 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(T4, {
			type: t8,
			children: t19
		});
		$[48] = T4;
		$[49] = t19;
		$[50] = t8;
		$[51] = t20;
	} else t20 = $[51];
	let t21;
	if ($[52] !== T5 || $[53] !== t10 || $[54] !== t20 || $[55] !== t9) {
		t21 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(T5, {
			textValue: t9,
			...t10,
			children: t20
		});
		$[52] = T5;
		$[53] = t10;
		$[54] = t20;
		$[55] = t9;
		$[56] = t21;
	} else t21 = $[56];
	return t21;
}
function _temp4$1(sum, t) {
	return sum + (t.amount ?? 0);
}
function OverbudgetedBanner(t0) {
	const $ = (0, import_compiler_runtime.c)(27);
	let month;
	let onBudgetAction;
	let props;
	if ($[0] !== t0) {
		({month, onBudgetAction, ...props} = t0);
		$[0] = t0;
		$[1] = month;
		$[2] = onBudgetAction;
		$[3] = props;
	} else {
		month = $[1];
		onBudgetAction = $[2];
		props = $[3];
	}
	const { t } = useTranslation();
	const format = useFormat();
	const toBudgetAmount = useSheetValue(envelopeBudget.toBudget);
	const dispatch = useDispatch();
	const { showUndoNotification } = useUndo();
	const { data: t1 } = useCategories();
	let t2;
	if ($[4] !== t1) {
		t2 = t1 === void 0 ? { list: [] } : t1;
		$[4] = t1;
		$[5] = t2;
	} else t2 = $[5];
	const { list: categories } = t2;
	let t3;
	if ($[6] !== categories) {
		t3 = groupById(categories);
		$[6] = categories;
		$[7] = t3;
	} else t3 = $[7];
	const categoriesById = t3;
	let t4;
	if ($[8] !== categoriesById || $[9] !== dispatch || $[10] !== format.currency.code || $[11] !== month || $[12] !== onBudgetAction || $[13] !== showUndoNotification || $[14] !== t || $[15] !== toBudgetAmount) {
		t4 = () => {
			dispatch(pushModal({ modal: {
				name: "cover",
				options: {
					title: t("Cover overbudgeted"),
					month,
					amount: toBudgetAmount,
					showToBeBudgeted: false,
					onSubmit: (amount, categoryId) => {
						onBudgetAction(month, "cover-overbudgeted", {
							category: categoryId,
							amount,
							currencyCode: format.currency.code
						});
						showUndoNotification({ message: t("Covered overbudgeted from {{categoryName}}", { categoryName: categoriesById[categoryId].name }) });
					}
				}
			} }));
		};
		$[8] = categoriesById;
		$[9] = dispatch;
		$[10] = format.currency.code;
		$[11] = month;
		$[12] = onBudgetAction;
		$[13] = showUndoNotification;
		$[14] = t;
		$[15] = toBudgetAmount;
		$[16] = t4;
	} else t4 = $[16];
	const openCoverOverbudgetedModal = t4;
	if (!toBudgetAmount || toBudgetAmount >= 0) return null;
	let t5;
	if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
		t5 = {
			flexDirection: "row",
			alignItems: "center",
			justifyContent: "space-between"
		};
		$[17] = t5;
	} else t5 = $[17];
	let t6;
	if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
		t6 = {
			flexDirection: "row",
			alignItems: "center",
			gap: 10
		};
		$[18] = t6;
	} else t6 = $[18];
	let t7;
	if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
		t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SvgArrowButtonDown1, { style: {
			width: 15,
			height: 15
		} });
		$[19] = t7;
	} else t7 = $[19];
	let t8;
	if ($[20] === Symbol.for("react.memo_cache_sentinel")) {
		t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(View, {
			style: t6,
			children: [t7, /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Trans, { children: "You have budgeted more than your available funds" }) })]
		}) });
		$[20] = t8;
	} else t8 = $[20];
	let t9;
	if ($[21] === Symbol.for("react.memo_cache_sentinel")) {
		t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Trans, { children: "Cover" });
		$[21] = t9;
	} else t9 = $[21];
	let t10;
	if ($[22] !== openCoverOverbudgetedModal) {
		t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Banner, {
			type: "critical",
			children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(View, {
				style: t5,
				children: [t8, /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
					onPress: openCoverOverbudgetedModal,
					style: PILL_STYLE,
					children: t9
				})]
			})
		});
		$[22] = openCoverOverbudgetedModal;
		$[23] = t10;
	} else t10 = $[23];
	let t11;
	if ($[24] !== props || $[25] !== t10) {
		t11 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)($72e60046c03fbe42$export$e96fc9a8407faa6b, {
			textValue: "Overbudgeted banner",
			...props,
			children: t10
		});
		$[24] = props;
		$[25] = t10;
		$[26] = t11;
	} else t11 = $[26];
	return t11;
}
function OverspendingBanner({ month, onBudgetAction, budgetType, ...props }) {
	const { t } = useTranslation();
	const { data: { list: categories, grouped: categoryGroups } = {
		list: [],
		grouped: []
	} } = useCategories();
	const categoriesById = (0, import_react.useMemo)(() => groupById(categories), [categories]);
	const dispatch = useDispatch();
	const format = useFormat();
	const { categories: overspentCategories, amountsByCategory, totalAmount: totalOverspending } = useOverspentCategories({ month });
	const amountsByCategoryRef = (0, import_react.useRef)(amountsByCategory);
	amountsByCategoryRef.current = amountsByCategory;
	const categoryGroupsToShow = (0, import_react.useMemo)(() => categoryGroups.filter((g) => overspentCategories.some((c) => c.group === g.id)).map((g_0) => ({
		...g_0,
		categories: overspentCategories.filter((c_0) => c_0.group === g_0.id)
	})), [categoryGroups, overspentCategories]);
	const { showUndoNotification } = useUndo();
	const onOpenCoverCategoryModal = (0, import_react.useCallback)((categoryId) => {
		const category = categoriesById[categoryId];
		dispatch(pushModal({ modal: {
			name: "cover",
			options: {
				title: category.name,
				month,
				amount: amountsByCategoryRef.current.get(category.id),
				categoryId: category.id,
				onSubmit: (amount, fromCategoryId) => {
					onBudgetAction(month, "cover-overspending", {
						to: category.id,
						from: fromCategoryId,
						amount,
						currencyCode: format.currency.code
					});
					showUndoNotification({ message: t(`Covered {{toCategoryName}} overspending from {{fromCategoryName}}.`, {
						toCategoryName: category.name,
						fromCategoryName: fromCategoryId === "to-budget" ? t("To Budget") : categoriesById[fromCategoryId].name
					}) });
				}
			}
		} }));
	}, [
		categoriesById,
		dispatch,
		month,
		onBudgetAction,
		showUndoNotification,
		t,
		format.currency.code
	]);
	const onOpenCategorySelectionModal = (0, import_react.useCallback)(() => {
		dispatch(pushModal({ modal: {
			name: "category-autocomplete",
			options: {
				title: budgetType === "envelope" ? t("Cover overspending") : t("Overspent categories"),
				month,
				categoryGroups: categoryGroupsToShow,
				showHiddenCategories: true,
				onSelect: budgetType === "envelope" ? onOpenCoverCategoryModal : null,
				clearOnSelect: true,
				closeOnSelect: false
			}
		} }));
	}, [
		categoryGroupsToShow,
		dispatch,
		month,
		onOpenCoverCategoryModal,
		t,
		budgetType
	]);
	const numberOfOverspentCategories = overspentCategories.length;
	if (numberOfOverspentCategories === 0) return null;
	return /* @__PURE__ */ (0, import_jsx_runtime.jsx)($72e60046c03fbe42$export$e96fc9a8407faa6b, {
		textValue: "Overspent banner",
		...props,
		children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Banner, {
			type: "critical",
			children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(View, {
				style: {
					flexDirection: "row",
					alignItems: "center",
					justifyContent: "space-between"
				},
				children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Trans, {
					count: numberOfOverspentCategories,
					children: [
						"You have ",
						{ count: numberOfOverspentCategories },
						" overspent categories (",
						/* @__PURE__ */ (0, import_jsx_runtime.jsx)(FinancialText, { children: { amount: format(totalOverspending, "financial") } }),
						")"
					]
				}) }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button, {
					onPress: onOpenCategorySelectionModal,
					style: PILL_STYLE,
					children: [budgetType === "envelope" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Trans, { children: "Cover" }), budgetType === "tracking" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Trans, { children: "View" })]
				})]
			})
		})
	});
}
function MonthSelector(t0) {
	const $ = (0, import_compiler_runtime.c)(39);
	const { month, monthBounds, onOpenMonthMenu, onPrevMonth, onNextMonth } = t0;
	const locale = useLocale();
	const { t } = useTranslation();
	const prevEnabled = month > monthBounds.start;
	const nextEnabled = month < subMonths(monthBounds.end, 1);
	let t1;
	if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
		t1 = {
			padding: 10,
			margin: 2
		};
		$[0] = t1;
	} else t1 = $[0];
	const arrowButtonStyle = t1;
	let t2;
	if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
		t2 = {
			flex: 1,
			justifyContent: "center",
			alignItems: "center",
			flexDirection: "row"
		};
		$[1] = t2;
	} else t2 = $[1];
	let t3;
	if ($[2] !== t) {
		t3 = t("Previous month");
		$[2] = t;
		$[3] = t3;
	} else t3 = $[3];
	const t4 = !prevEnabled;
	const t5 = prevEnabled ? 1 : .6;
	let t6;
	if ($[4] !== t5) {
		t6 = {
			...arrowButtonStyle,
			opacity: t5
		};
		$[4] = t5;
		$[5] = t6;
	} else t6 = $[5];
	let t7;
	if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
		t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SvgArrowThinLeft, {
			width: "15",
			height: "15"
		});
		$[6] = t7;
	} else t7 = $[6];
	let t8;
	if ($[7] !== onPrevMonth || $[8] !== t3 || $[9] !== t4 || $[10] !== t6) {
		t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
			"aria-label": t3,
			variant: "bare",
			isDisabled: t4,
			onPress: onPrevMonth,
			style: t6,
			children: t7
		});
		$[7] = onPrevMonth;
		$[8] = t3;
		$[9] = t4;
		$[10] = t6;
		$[11] = t8;
	} else t8 = $[11];
	let t9;
	if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
		t9 = {
			textAlign: "center",
			fontSize: 16,
			fontWeight: 500
		};
		$[12] = t9;
	} else t9 = $[12];
	let t10;
	if ($[13] !== month || $[14] !== onOpenMonthMenu) {
		t10 = () => {
			onOpenMonthMenu?.(month);
		};
		$[13] = month;
		$[14] = onOpenMonthMenu;
		$[15] = t10;
	} else t10 = $[15];
	let t11;
	if ($[16] !== locale || $[17] !== month) {
		t11 = format(month, "MMMM ''yy", locale);
		$[16] = locale;
		$[17] = month;
		$[18] = t11;
	} else t11 = $[18];
	let t12;
	if ($[19] !== t11) {
		t12 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
			style: styles.underlinedText,
			children: t11
		});
		$[19] = t11;
		$[20] = t12;
	} else t12 = $[20];
	let t13;
	if ($[21] !== month || $[22] !== t10 || $[23] !== t12) {
		t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
			variant: "bare",
			style: t9,
			onPress: t10,
			"data-month": month,
			children: t12
		});
		$[21] = month;
		$[22] = t10;
		$[23] = t12;
		$[24] = t13;
	} else t13 = $[24];
	let t14;
	if ($[25] !== t) {
		t14 = t("Next month");
		$[25] = t;
		$[26] = t14;
	} else t14 = $[26];
	const t15 = !nextEnabled;
	const t16 = nextEnabled ? 1 : .6;
	let t17;
	if ($[27] !== t16) {
		t17 = {
			...arrowButtonStyle,
			opacity: t16
		};
		$[27] = t16;
		$[28] = t17;
	} else t17 = $[28];
	let t18;
	if ($[29] === Symbol.for("react.memo_cache_sentinel")) {
		t18 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SvgArrowThinRight, {
			width: "15",
			height: "15"
		});
		$[29] = t18;
	} else t18 = $[29];
	let t19;
	if ($[30] !== onNextMonth || $[31] !== t14 || $[32] !== t15 || $[33] !== t17) {
		t19 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
			"aria-label": t14,
			variant: "bare",
			isDisabled: t15,
			onPress: onNextMonth,
			style: t17,
			children: t18
		});
		$[30] = onNextMonth;
		$[31] = t14;
		$[32] = t15;
		$[33] = t17;
		$[34] = t19;
	} else t19 = $[34];
	let t20;
	if ($[35] !== t13 || $[36] !== t19 || $[37] !== t8) {
		t20 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(View, {
			style: t2,
			children: [
				t8,
				t13,
				t19
			]
		});
		$[35] = t13;
		$[36] = t19;
		$[37] = t8;
		$[38] = t20;
	} else t20 = $[38];
	return t20;
}
//#endregion
//#region src/components/mobile/accounts/AccountsPage.tsx
var ROW_HEIGHT = 60;
function AccountHeader$1(t0) {
	const $ = (0, import_compiler_runtime.c)(30);
	const { id, name, amount, style: t1, showCheveronDown: t2, onPress } = t0;
	let t3;
	if ($[0] !== t1) {
		t3 = t1 === void 0 ? {} : t1;
		$[0] = t1;
		$[1] = t3;
	} else t3 = $[1];
	const style = t3;
	const showCheveronDown = t2 === void 0 ? false : t2;
	const { t } = useTranslation();
	const navigate = useNavigate();
	const Cheveron = showCheveronDown ? SvgCheveronDown : SvgCheveronRight;
	let t4;
	if ($[2] !== name || $[3] !== t) {
		t4 = t("View {{name}} transactions", { name });
		$[2] = name;
		$[3] = t;
		$[4] = t4;
	} else t4 = $[4];
	let t5;
	if ($[5] !== id || $[6] !== navigate || $[7] !== onPress) {
		t5 = onPress ? onPress : () => navigate(`/accounts/${id}`);
		$[5] = id;
		$[6] = navigate;
		$[7] = onPress;
		$[8] = t5;
	} else t5 = $[8];
	let t6;
	if ($[9] !== style) {
		t6 = {
			height: ROW_HEIGHT,
			width: "100%",
			padding: "0 18px",
			color: theme.pageTextLight,
			...style
		};
		$[9] = style;
		$[10] = t6;
	} else t6 = $[10];
	let t7;
	if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
		t7 = css([{ "&[data-pressed], &[data-hovered]": {
			backgroundColor: "transparent",
			transform: "translateY(1px)"
		} }]);
		$[11] = t7;
	} else t7 = $[11];
	let t8;
	if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
		t8 = {
			flex: 1,
			alignItems: "center",
			flexDirection: "row"
		};
		$[12] = t8;
	} else t8 = $[12];
	let t9;
	if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
		t9 = {
			...styles.text,
			fontSize: 17
		};
		$[13] = t9;
	} else t9 = $[13];
	let t10;
	if ($[14] !== name) {
		t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
			style: t9,
			"data-testid": "name",
			children: name
		});
		$[14] = name;
		$[15] = t10;
	} else t10 = $[15];
	let t11;
	if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
		t11 = {
			flexShrink: 0,
			color: theme.mobileHeaderTextSubdued,
			marginLeft: 5
		};
		$[16] = t11;
	} else t11 = $[16];
	let t12;
	if ($[17] !== Cheveron) {
		t12 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Cheveron, {
			style: t11,
			width: styles.text.fontSize,
			height: styles.text.fontSize
		});
		$[17] = Cheveron;
		$[18] = t12;
	} else t12 = $[18];
	let t13;
	if ($[19] !== t10 || $[20] !== t12) {
		t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(View, {
			style: t8,
			children: [t10, t12]
		});
		$[19] = t10;
		$[20] = t12;
		$[21] = t13;
	} else t13 = $[21];
	let t14;
	if ($[22] !== amount) {
		t14 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CellValue, {
			binding: amount,
			type: "financial",
			children: _temp$12
		});
		$[22] = amount;
		$[23] = t14;
	} else t14 = $[23];
	let t15;
	if ($[24] !== t13 || $[25] !== t14 || $[26] !== t4 || $[27] !== t5 || $[28] !== t6) {
		t15 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button, {
			variant: "bare",
			"aria-label": t4,
			onPress: t5,
			style: t6,
			className: t7,
			children: [t13, t14]
		});
		$[24] = t13;
		$[25] = t14;
		$[26] = t4;
		$[27] = t5;
		$[28] = t6;
		$[29] = t15;
	} else t15 = $[29];
	return t15;
}
function _temp$12(props) {
	return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CellValueText, {
		...props,
		style: { ...styles.text }
	});
}
function AccountListItem(t0) {
	const $ = (0, import_compiler_runtime.c)(22);
	let getBalanceQuery;
	let isConnected;
	let isFailed;
	let isPending;
	let isUpdated;
	let onSelect;
	let props;
	if ($[0] !== t0) {
		({isUpdated, isConnected, isPending, isFailed, getBalanceQuery, onSelect, ...props} = t0);
		$[0] = t0;
		$[1] = getBalanceQuery;
		$[2] = isConnected;
		$[3] = isFailed;
		$[4] = isPending;
		$[5] = isUpdated;
		$[6] = onSelect;
		$[7] = props;
	} else {
		getBalanceQuery = $[1];
		isConnected = $[2];
		isFailed = $[3];
		isPending = $[4];
		isUpdated = $[5];
		onSelect = $[6];
		props = $[7];
	}
	const { value: account } = props;
	if (!account) return null;
	const t1 = account.name;
	let t2;
	if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
		t2 = css({
			borderBottom: `1px solid ${theme.tableBorder}`,
			"&:last-child": { borderBottom: "none" }
		});
		$[8] = t2;
	} else t2 = $[8];
	let t3;
	if ($[9] !== account || $[10] !== getBalanceQuery || $[11] !== isConnected || $[12] !== isFailed || $[13] !== isPending || $[14] !== isUpdated || $[15] !== onSelect) {
		t3 = (itemProps) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button, {
			...itemProps,
			style: {
				height: ROW_HEIGHT,
				width: "100%",
				backgroundColor: theme.tableBackground,
				border: "none",
				borderRadius: 0,
				paddingLeft: 8
			},
			"data-testid": "account-list-item",
			onPress: () => onSelect(account),
			children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(View, {
				style: {
					flex: 1,
					alignItems: "center",
					flexDirection: "row"
				},
				children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, { style: {
					backgroundColor: isPending ? theme.sidebarItemBackgroundPending : isFailed ? theme.sidebarItemBackgroundFailed : theme.sidebarItemBackgroundPositive,
					marginRight: "6px",
					width: 8,
					flexShrink: 0,
					height: 8,
					borderRadius: 8,
					opacity: isConnected ? 1 : 0
				} }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TextOneLine, {
					style: {
						...styles.text,
						fontSize: 17,
						fontWeight: 600,
						color: isUpdated ? theme.mobileAccountText : theme.pillText
					},
					"data-testid": "account-name",
					children: account.name
				})]
			}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CellValue, {
				binding: getBalanceQuery(account.id),
				type: "financial",
				children: _temp2$8
			})]
		});
		$[9] = account;
		$[10] = getBalanceQuery;
		$[11] = isConnected;
		$[12] = isFailed;
		$[13] = isPending;
		$[14] = isUpdated;
		$[15] = onSelect;
		$[16] = t3;
	} else t3 = $[16];
	let t4;
	if ($[17] !== account.name || $[18] !== props || $[19] !== t2 || $[20] !== t3) {
		t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)($eed445e0843c11d0$export$a11e76429ed99b4, {
			textValue: t1,
			className: t2,
			...props,
			children: t3
		});
		$[17] = account.name;
		$[18] = props;
		$[19] = t2;
		$[20] = t3;
		$[21] = t4;
	} else t4 = $[21];
	return t4;
}
function _temp2$8(props_0) {
	return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CellValueText, {
		...props_0,
		style: {
			fontSize: 16,
			...makeAmountFullStyle(props_0.value, {
				positiveColor: theme.numberPositive,
				negativeColor: theme.numberNegative,
				zeroColor: theme.numberNeutral
			})
		},
		"data-testid": "account-balance"
	});
}
function EmptyMessage() {
	const $ = (0, import_compiler_runtime.c)(2);
	let t0;
	if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
		t0 = {
			flex: 1,
			padding: 30
		};
		$[0] = t0;
	} else t0 = $[0];
	let t1;
	if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
		t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, {
			style: t0,
			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
				style: styles.text,
				children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Trans, { children: [
					"For Actual to be useful, you need to ",
					/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: "add an account" }),
					". You can link an account to automatically download transactions, or manage it locally yourself."
				] })
			})
		});
		$[1] = t1;
	} else t1 = $[1];
	return t1;
}
function AllAccountList(t0) {
	const $ = (0, import_compiler_runtime.c)(83);
	const { accounts, getAccountBalance, getAllAccountsBalance, getOnBudgetBalance, getOffBudgetBalance, getClosedAccountsBalance, onAddAccount, onOpenAccount, onSync } = t0;
	const { t } = useTranslation();
	let t1;
	if ($[0] !== accounts) {
		t1 = accounts.filter(_temp3$1);
		$[0] = accounts;
		$[1] = t1;
	} else t1 = $[1];
	const onBudgetAccounts = t1;
	let t2;
	if ($[2] !== accounts) {
		t2 = accounts.filter(_temp4);
		$[2] = accounts;
		$[3] = t2;
	} else t2 = $[3];
	const offBudgetAccounts = t2;
	let t3;
	if ($[4] !== accounts) {
		t3 = accounts.filter(_temp5);
		$[4] = accounts;
		$[5] = t3;
	} else t3 = $[5];
	const closedAccounts = t3;
	const closedAccountsRef = (0, import_react.useRef)(null);
	const [showClosedAccounts, setShowClosedAccountsPref] = useLocalPref("ui.showClosedAccounts");
	let t4;
	if ($[6] !== setShowClosedAccountsPref || $[7] !== showClosedAccounts) {
		t4 = () => {
			const toggledState = !showClosedAccounts;
			setShowClosedAccountsPref(toggledState);
			if (toggledState) setTimeout(() => {
				closedAccountsRef.current?.scrollIntoView({ behavior: "smooth" });
			});
		};
		$[6] = setShowClosedAccountsPref;
		$[7] = showClosedAccounts;
		$[8] = t4;
	} else t4 = $[8];
	const onToggleClosedAccounts = t4;
	let t5;
	if ($[9] !== t) {
		t5 = t("Accounts");
		$[9] = t;
		$[10] = t5;
	} else t5 = $[10];
	let t6;
	if ($[11] !== t) {
		t6 = t("Add account");
		$[11] = t;
		$[12] = t6;
	} else t6 = $[12];
	let t7;
	if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
		t7 = { margin: 10 };
		$[13] = t7;
	} else t7 = $[13];
	let t8;
	if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
		t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SvgAdd, {
			width: 20,
			height: 20
		});
		$[14] = t8;
	} else t8 = $[14];
	let t9;
	if ($[15] !== onAddAccount || $[16] !== t6) {
		t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
			variant: "bare",
			"aria-label": t6,
			style: t7,
			onPress: onAddAccount,
			children: t8
		});
		$[15] = onAddAccount;
		$[16] = t6;
		$[17] = t9;
	} else t9 = $[17];
	let t10;
	if ($[18] !== t5 || $[19] !== t9) {
		t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MobilePageHeader, {
			title: t5,
			rightContent: t9
		});
		$[18] = t5;
		$[19] = t9;
		$[20] = t10;
	} else t10 = $[20];
	let t11;
	if ($[21] !== accounts.length) {
		t11 = accounts.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyMessage, {});
		$[21] = accounts.length;
		$[22] = t11;
	} else t11 = $[22];
	let t12;
	if ($[23] !== t) {
		t12 = t("Account list");
		$[23] = t;
		$[24] = t12;
	} else t12 = $[24];
	let t13;
	if ($[25] === Symbol.for("react.memo_cache_sentinel")) {
		t13 = { paddingBottom: MOBILE_NAV_HEIGHT };
		$[25] = t13;
	} else t13 = $[25];
	let t14;
	if ($[26] !== t) {
		t14 = t("All accounts");
		$[26] = t;
		$[27] = t14;
	} else t14 = $[27];
	let t15;
	if ($[28] !== getAllAccountsBalance) {
		t15 = getAllAccountsBalance();
		$[28] = getAllAccountsBalance;
		$[29] = t15;
	} else t15 = $[29];
	let t16;
	if ($[30] !== t14 || $[31] !== t15) {
		t16 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccountHeader$1, {
			id: "all",
			name: t14,
			amount: t15
		});
		$[30] = t14;
		$[31] = t15;
		$[32] = t16;
	} else t16 = $[32];
	let t17;
	if ($[33] !== getOnBudgetBalance || $[34] !== onBudgetAccounts.length || $[35] !== t) {
		t17 = onBudgetAccounts.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccountHeader$1, {
			id: "onbudget",
			name: t("On budget"),
			amount: getOnBudgetBalance()
		});
		$[33] = getOnBudgetBalance;
		$[34] = onBudgetAccounts.length;
		$[35] = t;
		$[36] = t17;
	} else t17 = $[36];
	let t18;
	if ($[37] !== t) {
		t18 = t("On budget accounts");
		$[37] = t;
		$[38] = t18;
	} else t18 = $[38];
	let t19;
	if ($[39] !== getAccountBalance || $[40] !== onBudgetAccounts || $[41] !== onOpenAccount || $[42] !== t18) {
		t19 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccountList, {
			"aria-label": t18,
			accounts: onBudgetAccounts,
			getAccountBalance,
			onOpenAccount
		});
		$[39] = getAccountBalance;
		$[40] = onBudgetAccounts;
		$[41] = onOpenAccount;
		$[42] = t18;
		$[43] = t19;
	} else t19 = $[43];
	let t20;
	if ($[44] !== getOffBudgetBalance || $[45] !== offBudgetAccounts.length || $[46] !== t) {
		t20 = offBudgetAccounts.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccountHeader$1, {
			id: "offbudget",
			name: t("Off budget"),
			amount: getOffBudgetBalance()
		});
		$[44] = getOffBudgetBalance;
		$[45] = offBudgetAccounts.length;
		$[46] = t;
		$[47] = t20;
	} else t20 = $[47];
	let t21;
	if ($[48] !== t) {
		t21 = t("Off budget accounts");
		$[48] = t;
		$[49] = t21;
	} else t21 = $[49];
	let t22;
	if ($[50] !== getAccountBalance || $[51] !== offBudgetAccounts || $[52] !== onOpenAccount || $[53] !== t21) {
		t22 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccountList, {
			"aria-label": t21,
			accounts: offBudgetAccounts,
			getAccountBalance,
			onOpenAccount
		});
		$[50] = getAccountBalance;
		$[51] = offBudgetAccounts;
		$[52] = onOpenAccount;
		$[53] = t21;
		$[54] = t22;
	} else t22 = $[54];
	let t23;
	if ($[55] !== closedAccounts.length || $[56] !== getClosedAccountsBalance || $[57] !== onToggleClosedAccounts || $[58] !== showClosedAccounts || $[59] !== t) {
		t23 = closedAccounts.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccountHeader$1, {
			id: "closed",
			name: t("Closed"),
			onPress: onToggleClosedAccounts,
			amount: getClosedAccountsBalance(),
			style: { marginTop: 30 },
			showCheveronDown: showClosedAccounts
		});
		$[55] = closedAccounts.length;
		$[56] = getClosedAccountsBalance;
		$[57] = onToggleClosedAccounts;
		$[58] = showClosedAccounts;
		$[59] = t;
		$[60] = t23;
	} else t23 = $[60];
	let t24;
	if ($[61] !== closedAccounts || $[62] !== getAccountBalance || $[63] !== onOpenAccount || $[64] !== showClosedAccounts || $[65] !== t) {
		t24 = showClosedAccounts && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccountList, {
			"aria-label": t("Closed accounts"),
			accounts: closedAccounts,
			getAccountBalance,
			onOpenAccount,
			ref: (el) => {
				if (el) closedAccountsRef.current = el;
			}
		});
		$[61] = closedAccounts;
		$[62] = getAccountBalance;
		$[63] = onOpenAccount;
		$[64] = showClosedAccounts;
		$[65] = t;
		$[66] = t24;
	} else t24 = $[66];
	let t25;
	if ($[67] !== t12 || $[68] !== t16 || $[69] !== t17 || $[70] !== t19 || $[71] !== t20 || $[72] !== t22 || $[73] !== t23 || $[74] !== t24) {
		t25 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(View, {
			"aria-label": t12,
			style: t13,
			children: [
				t16,
				t17,
				t19,
				t20,
				t22,
				t23,
				t24
			]
		});
		$[67] = t12;
		$[68] = t16;
		$[69] = t17;
		$[70] = t19;
		$[71] = t20;
		$[72] = t22;
		$[73] = t23;
		$[74] = t24;
		$[75] = t25;
	} else t25 = $[75];
	let t26;
	if ($[76] !== onSync || $[77] !== t25) {
		t26 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PullToRefresh, {
			onRefresh: onSync,
			children: t25
		});
		$[76] = onSync;
		$[77] = t25;
		$[78] = t26;
	} else t26 = $[78];
	let t27;
	if ($[79] !== t10 || $[80] !== t11 || $[81] !== t26) {
		t27 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Page, {
			header: t10,
			padding: 0,
			children: [t11, t26]
		});
		$[79] = t10;
		$[80] = t11;
		$[81] = t26;
		$[82] = t27;
	} else t27 = $[82];
	return t27;
}
function _temp5(account_1) {
	return account_1.closed === 1;
}
function _temp4(account_0) {
	return account_0.offbudget === 1 && account_0.closed === 0;
}
function _temp3$1(account) {
	return account.offbudget === 0 && account.closed === 0;
}
var AccountList = (0, import_react.forwardRef)((t0, ref) => {
	const $ = (0, import_compiler_runtime.c)(21);
	const { "aria-label": ariaLabel, accounts, getAccountBalance: getBalanceBinding, onOpenAccount } = t0;
	const failedAccounts = useFailedAccounts();
	const syncingAccountIds = useSelector(_temp6);
	const updatedAccounts = useSelector(_temp7);
	const moveAccount = useMoveAccountMutation();
	let t1;
	if ($[0] !== accounts || $[1] !== moveAccount) {
		t1 = {
			getItems: _temp9,
			renderDropIndicator: _temp0,
			onReorder: (e) => {
				const [key_0] = e.keys;
				const accountIdToMove = key_0;
				const targetAccountId = e.target.key;
				if (e.target.dropPosition === "before") moveAccount.mutate({
					id: accountIdToMove,
					targetId: targetAccountId
				});
				else if (e.target.dropPosition === "after") {
					const targetAccountIndex = accounts.findIndex((account) => account.id === e.target.key);
					if (targetAccountIndex === -1) throw new Error(`Internal error: account with ID ${targetAccountId} not found.`);
					const nextToTargetAccount = accounts[targetAccountIndex + 1];
					moveAccount.mutate({
						id: accountIdToMove,
						targetId: nextToTargetAccount?.id || null
					});
				}
			}
		};
		$[0] = accounts;
		$[1] = moveAccount;
		$[2] = t1;
	} else t1 = $[2];
	const { dragAndDropHooks } = $d8f176866e6dc039$export$2cfc5be7a55829f6(t1);
	let t2;
	if ($[3] !== failedAccounts || $[4] !== syncingAccountIds || $[5] !== updatedAccounts) {
		t2 = [
			syncingAccountIds,
			failedAccounts,
			updatedAccounts
		];
		$[3] = failedAccounts;
		$[4] = syncingAccountIds;
		$[5] = updatedAccounts;
		$[6] = t2;
	} else t2 = $[6];
	let t3;
	if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
		t3 = {
			display: "flex",
			flexDirection: "column",
			margin: "0 8px",
			border: `1px solid ${theme.tableBorder}`,
			borderRadius: 8,
			overflow: "hidden"
		};
		$[7] = t3;
	} else t3 = $[7];
	let t4;
	if ($[8] !== failedAccounts || $[9] !== getBalanceBinding || $[10] !== onOpenAccount || $[11] !== syncingAccountIds || $[12] !== updatedAccounts) {
		t4 = (account_0) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccountListItem, {
			id: account_0.id,
			value: account_0,
			isUpdated: updatedAccounts && updatedAccounts.includes(account_0.id),
			isConnected: !!account_0.bank,
			isPending: syncingAccountIds.includes(account_0.id),
			isFailed: failedAccounts && failedAccounts.has(account_0.id),
			getBalanceQuery: getBalanceBinding,
			onSelect: onOpenAccount
		}, account_0.id);
		$[8] = failedAccounts;
		$[9] = getBalanceBinding;
		$[10] = onOpenAccount;
		$[11] = syncingAccountIds;
		$[12] = updatedAccounts;
		$[13] = t4;
	} else t4 = $[13];
	let t5;
	if ($[14] !== accounts || $[15] !== ariaLabel || $[16] !== dragAndDropHooks || $[17] !== ref || $[18] !== t2 || $[19] !== t4) {
		t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)($eed445e0843c11d0$export$41f133550aa26f48, {
			"aria-label": ariaLabel,
			items: accounts,
			dependencies: t2,
			dragAndDropHooks,
			ref,
			style: t3,
			children: t4
		});
		$[14] = accounts;
		$[15] = ariaLabel;
		$[16] = dragAndDropHooks;
		$[17] = ref;
		$[18] = t2;
		$[19] = t4;
		$[20] = t5;
	} else t5 = $[20];
	return t5;
});
AccountList.displayName = "AccountList";
function AccountsPage() {
	const $ = (0, import_compiler_runtime.c)(15);
	const dispatch = useDispatch();
	const { data: t0 } = useAccounts();
	let t1;
	if ($[0] !== t0) {
		t1 = t0 === void 0 ? [] : t0;
		$[0] = t0;
		$[1] = t1;
	} else t1 = $[1];
	const accounts = t1;
	const [_numberFormat] = useSyncedPref("numberFormat");
	const numberFormat = _numberFormat || "comma-dot";
	const [hideFraction] = useSyncedPref("hideFraction");
	const navigate = useNavigate();
	let t2;
	if ($[2] !== navigate) {
		t2 = (account) => {
			navigate(`/accounts/${account.id}`);
		};
		$[2] = navigate;
		$[3] = t2;
	} else t2 = $[3];
	const onOpenAccount = t2;
	let t3;
	if ($[4] !== dispatch) {
		t3 = () => {
			dispatch(replaceModal({ modal: {
				name: "add-account",
				options: {}
			} }));
		};
		$[4] = dispatch;
		$[5] = t3;
	} else t3 = $[5];
	const onAddAccount = t3;
	const syncAndDownload = useSyncAndDownloadMutation();
	let t4;
	if ($[6] !== syncAndDownload) {
		t4 = async () => {
			syncAndDownload.mutate({});
		};
		$[6] = syncAndDownload;
		$[7] = t4;
	} else t4 = $[7];
	const onSync = t4;
	let t5;
	if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
		t5 = { flex: 1 };
		$[8] = t5;
	} else t5 = $[8];
	const t6 = numberFormat + hideFraction;
	let t7;
	if ($[9] !== accounts || $[10] !== onAddAccount || $[11] !== onOpenAccount || $[12] !== onSync || $[13] !== t6) {
		t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, {
			style: t5,
			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AllAccountList, {
				accounts,
				getAccountBalance: accountBalance,
				getAllAccountsBalance: allAccountBalance,
				getOnBudgetBalance: onBudgetAccountBalance,
				getOffBudgetBalance: offBudgetAccountBalance,
				getClosedAccountsBalance: closedAccountBalance,
				onAddAccount,
				onOpenAccount,
				onSync
			}, t6)
		});
		$[9] = accounts;
		$[10] = onAddAccount;
		$[11] = onOpenAccount;
		$[12] = onSync;
		$[13] = t6;
		$[14] = t7;
	} else t7 = $[14];
	return t7;
}
function _temp6(state) {
	return state.account.accountsSyncing;
}
function _temp7(state_0) {
	return state_0.account.updatedAccounts;
}
function _temp8(key) {
	return { "text/plain": key };
}
function _temp9(keys) {
	return [...keys].map(_temp8);
}
function _temp0(target) {
	return /* @__PURE__ */ (0, import_jsx_runtime.jsx)($612b8eb6cb90e02d$export$62ed72bc21f6b8a6, {
		target,
		className: css({ "&[data-drop-target]": {
			height: 4,
			backgroundColor: theme.tableBorderSeparator,
			opacity: 1,
			borderRadius: 4
		} })
	});
}
//#endregion
//#region src/components/mobile/transactions/AddTransactionButton.tsx
function AddTransactionButton(t0) {
	const $ = (0, import_compiler_runtime.c)(12);
	const { to: t1, accountId, categoryId } = t0;
	const to = t1 === void 0 ? "/transactions/new" : t1;
	const { t } = useTranslation();
	const navigate = useNavigate();
	let t2;
	if ($[0] !== t) {
		t2 = t("Add transaction");
		$[0] = t;
		$[1] = t2;
	} else t2 = $[1];
	let t3;
	if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
		t3 = { margin: 10 };
		$[2] = t3;
	} else t3 = $[2];
	let t4;
	if ($[3] !== accountId || $[4] !== categoryId || $[5] !== navigate || $[6] !== to) {
		t4 = () => {
			navigate(to, { state: {
				accountId,
				categoryId
			} });
		};
		$[3] = accountId;
		$[4] = categoryId;
		$[5] = navigate;
		$[6] = to;
		$[7] = t4;
	} else t4 = $[7];
	let t5;
	if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
		t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SvgAdd, {
			width: 20,
			height: 20
		});
		$[8] = t5;
	} else t5 = $[8];
	let t6;
	if ($[9] !== t2 || $[10] !== t4) {
		t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
			variant: "bare",
			"aria-label": t2,
			style: t3,
			onPress: t4,
			children: t5
		});
		$[9] = t2;
		$[10] = t4;
		$[11] = t6;
	} else t6 = $[11];
	return t6;
}
//#endregion
//#region src/components/mobile/transactions/TransactionListWithBalances.tsx
function TransactionSearchInput(t0) {
	const $ = (0, import_compiler_runtime.c)(8);
	const { placeholder, onSearch } = t0;
	const [text, setText] = (0, import_react.useState)("");
	let t1;
	if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
		t1 = {
			flexDirection: "row",
			alignItems: "center",
			backgroundColor: theme.mobilePageBackground,
			padding: 10,
			width: "100%"
		};
		$[0] = t1;
	} else t1 = $[0];
	let t2;
	if ($[1] !== onSearch) {
		t2 = (text_0) => {
			setText(text_0);
			onSearch(text_0);
		};
		$[1] = onSearch;
		$[2] = t2;
	} else t2 = $[2];
	let t3;
	if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
		t3 = {
			backgroundColor: theme.tableBackground,
			borderColor: theme.formInputBorder
		};
		$[3] = t3;
	} else t3 = $[3];
	let t4;
	if ($[4] !== placeholder || $[5] !== t2 || $[6] !== text) {
		t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, {
			style: t1,
			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Search, {
				value: text,
				onChange: t2,
				placeholder,
				width: "100%",
				height: styles.mobileMinHeight,
				style: t3
			})
		});
		$[4] = placeholder;
		$[5] = t2;
		$[6] = text;
		$[7] = t4;
	} else t4 = $[7];
	return t4;
}
function TransactionListWithBalances(t0) {
	const $ = (0, import_compiler_runtime.c)(38);
	const { isLoading, transactions, balance, balanceCleared, balanceUncleared, showRunningBalances, runningBalances, searchPlaceholder: t1, onSearch, isLoadingMore, onLoadMore, onOpenTransaction, onRefresh, showMakeTransfer: t2 } = t0;
	const searchPlaceholder = t1 === void 0 ? "Search..." : t1;
	const showMakeTransfer = t2 === void 0 ? false : t2;
	let t3;
	if ($[0] !== transactions) {
		t3 = [...transactions];
		$[0] = transactions;
		$[1] = t3;
	} else t3 = $[1];
	let t4;
	if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
		t4 = [];
		$[2] = t4;
	} else t4 = $[2];
	const selectedInst = useSelected("transactions", t3, t4);
	let t5;
	if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
		t5 = {
			flexShrink: 0,
			marginTop: 10
		};
		$[3] = t5;
	} else t5 = $[3];
	let t6;
	if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
		t6 = {
			flexDirection: "row",
			justifyContent: "space-evenly"
		};
		$[4] = t6;
	} else t6 = $[4];
	let t7;
	if ($[5] !== balance || $[6] !== balanceCleared || $[7] !== balanceUncleared) {
		t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, {
			style: t6,
			children: balanceCleared && balanceUncleared ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BalanceWithCleared, {
				balance,
				balanceCleared,
				balanceUncleared
			}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Balance, { balance })
		});
		$[5] = balance;
		$[6] = balanceCleared;
		$[7] = balanceUncleared;
		$[8] = t7;
	} else t7 = $[8];
	let t8;
	if ($[9] !== onSearch || $[10] !== searchPlaceholder) {
		t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TransactionSearchInput, {
			placeholder: searchPlaceholder,
			onSearch
		});
		$[9] = onSearch;
		$[10] = searchPlaceholder;
		$[11] = t8;
	} else t8 = $[11];
	let t9;
	if ($[12] !== t7 || $[13] !== t8) {
		t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(View, {
			style: t5,
			children: [t7, t8]
		});
		$[12] = t7;
		$[13] = t8;
		$[14] = t9;
	} else t9 = $[14];
	const t10 = !isLoading && !!onRefresh;
	let t11;
	if ($[15] !== onRefresh) {
		t11 = async () => onRefresh?.();
		$[15] = onRefresh;
		$[16] = t11;
	} else t11 = $[16];
	let t12;
	if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
		t12 = { "& .ptr__children": { display: "flex" } };
		$[17] = t12;
	} else t12 = $[17];
	let t13;
	if ($[18] !== isLoading || $[19] !== isLoadingMore || $[20] !== onLoadMore || $[21] !== onOpenTransaction || $[22] !== runningBalances || $[23] !== showMakeTransfer || $[24] !== showRunningBalances || $[25] !== transactions) {
		t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TransactionList, {
			isLoading,
			transactions,
			showRunningBalances,
			runningBalances,
			isLoadingMore,
			onLoadMore,
			onOpenTransaction,
			showMakeTransfer
		});
		$[18] = isLoading;
		$[19] = isLoadingMore;
		$[20] = onLoadMore;
		$[21] = onOpenTransaction;
		$[22] = runningBalances;
		$[23] = showMakeTransfer;
		$[24] = showRunningBalances;
		$[25] = transactions;
		$[26] = t13;
	} else t13 = $[26];
	let t14;
	if ($[27] !== t10 || $[28] !== t11 || $[29] !== t13) {
		t14 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PullToRefresh, {
			isPullable: t10,
			onRefresh: t11,
			style: t12,
			children: t13
		});
		$[27] = t10;
		$[28] = t11;
		$[29] = t13;
		$[30] = t14;
	} else t14 = $[30];
	let t15;
	if ($[31] !== selectedInst || $[32] !== t14 || $[33] !== t9) {
		t15 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SelectedProvider, {
			instance: selectedInst,
			children: [t9, t14]
		});
		$[31] = selectedInst;
		$[32] = t14;
		$[33] = t9;
		$[34] = t15;
	} else t15 = $[34];
	let t16;
	if ($[35] !== t15 || $[36] !== transactions) {
		t16 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DisplayPayeeProvider, {
			transactions,
			children: t15
		});
		$[35] = t15;
		$[36] = transactions;
		$[37] = t16;
	} else t16 = $[37];
	return t16;
}
var TransactionListBalanceCellValue = (props) => {
	const $ = (0, import_compiler_runtime.c)(2);
	let t0;
	if ($[0] !== props) {
		t0 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CellValue, { ...props });
		$[0] = props;
		$[1] = t0;
	} else t0 = $[1];
	return t0;
};
function BalanceWithCleared(t0) {
	const $ = (0, import_compiler_runtime.c)(32);
	const { balanceUncleared, balanceCleared, balance } = t0;
	const { t } = useTranslation();
	const unclearedAmount = useSheetValue(balanceUncleared);
	const t1 = !unclearedAmount ? "none" : void 0;
	let t2;
	if ($[0] !== t1) {
		t2 = {
			display: t1,
			flexBasis: "33%"
		};
		$[0] = t1;
		$[1] = t2;
	} else t2 = $[1];
	let t3;
	if ($[2] !== t) {
		t3 = t("Cleared");
		$[2] = t;
		$[3] = t3;
	} else t3 = $[3];
	let t4;
	if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
		t4 = {
			textAlign: "center",
			fontSize: 12
		};
		$[4] = t4;
	} else t4 = $[4];
	let t5;
	if ($[5] !== t3) {
		t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Label, {
			title: t3,
			style: t4
		});
		$[5] = t3;
		$[6] = t5;
	} else t5 = $[6];
	let t6;
	if ($[7] !== balanceCleared) {
		t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TransactionListBalanceCellValue, {
			binding: balanceCleared,
			type: "financial",
			children: _temp$11
		});
		$[7] = balanceCleared;
		$[8] = t6;
	} else t6 = $[8];
	let t7;
	if ($[9] !== t2 || $[10] !== t5 || $[11] !== t6) {
		t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(View, {
			style: t2,
			children: [t5, t6]
		});
		$[9] = t2;
		$[10] = t5;
		$[11] = t6;
		$[12] = t7;
	} else t7 = $[12];
	let t8;
	if ($[13] !== balance) {
		t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Balance, { balance });
		$[13] = balance;
		$[14] = t8;
	} else t8 = $[14];
	const t9 = !unclearedAmount ? "none" : void 0;
	let t10;
	if ($[15] !== t9) {
		t10 = {
			display: t9,
			flexBasis: "33%"
		};
		$[15] = t9;
		$[16] = t10;
	} else t10 = $[16];
	let t11;
	if ($[17] !== t) {
		t11 = t("Uncleared");
		$[17] = t;
		$[18] = t11;
	} else t11 = $[18];
	let t12;
	if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
		t12 = {
			textAlign: "center",
			fontSize: 12
		};
		$[19] = t12;
	} else t12 = $[19];
	let t13;
	if ($[20] !== t11) {
		t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Label, {
			title: t11,
			style: t12
		});
		$[20] = t11;
		$[21] = t13;
	} else t13 = $[21];
	let t14;
	if ($[22] !== balanceUncleared) {
		t14 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TransactionListBalanceCellValue, {
			binding: balanceUncleared,
			type: "financial",
			children: _temp2$7
		});
		$[22] = balanceUncleared;
		$[23] = t14;
	} else t14 = $[23];
	let t15;
	if ($[24] !== t10 || $[25] !== t13 || $[26] !== t14) {
		t15 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(View, {
			style: t10,
			children: [t13, t14]
		});
		$[24] = t10;
		$[25] = t13;
		$[26] = t14;
		$[27] = t15;
	} else t15 = $[27];
	let t16;
	if ($[28] !== t15 || $[29] !== t7 || $[30] !== t8) {
		t16 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
			t7,
			t8,
			t15
		] });
		$[28] = t15;
		$[29] = t7;
		$[30] = t8;
		$[31] = t16;
	} else t16 = $[31];
	return t16;
}
function _temp2$7(props_0) {
	return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CellValueText, {
		...props_0,
		style: {
			fontSize: 12,
			textAlign: "center",
			fontWeight: "500"
		},
		"data-testid": "transactions-balance-uncleared"
	});
}
function _temp$11(props) {
	return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CellValueText, {
		...props,
		style: {
			fontSize: 12,
			textAlign: "center",
			fontWeight: "500"
		},
		"data-testid": "transactions-balance-cleared"
	});
}
function Balance(t0) {
	const $ = (0, import_compiler_runtime.c)(11);
	const { balance } = t0;
	const { t } = useTranslation();
	let t1;
	if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
		t1 = { flexBasis: "33%" };
		$[0] = t1;
	} else t1 = $[0];
	let t2;
	if ($[1] !== t) {
		t2 = t("Balance");
		$[1] = t;
		$[2] = t2;
	} else t2 = $[2];
	let t3;
	if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
		t3 = { textAlign: "center" };
		$[3] = t3;
	} else t3 = $[3];
	let t4;
	if ($[4] !== t2) {
		t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Label, {
			title: t2,
			style: t3
		});
		$[4] = t2;
		$[5] = t4;
	} else t4 = $[5];
	let t5;
	if ($[6] !== balance) {
		t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TransactionListBalanceCellValue, {
			binding: balance,
			type: "financial",
			children: _temp3
		});
		$[6] = balance;
		$[7] = t5;
	} else t5 = $[7];
	let t6;
	if ($[8] !== t4 || $[9] !== t5) {
		t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(View, {
			style: t1,
			children: [t4, t5]
		});
		$[8] = t4;
		$[9] = t5;
		$[10] = t6;
	} else t6 = $[10];
	return t6;
}
function _temp3(props) {
	return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CellValueText, {
		...props,
		style: {
			fontSize: 18,
			textAlign: "center",
			fontWeight: "500",
			color: props.value < 0 ? theme.numberNegative : props.value > 0 ? theme.numberPositive : theme.numberNeutral
		},
		"data-testid": "transactions-balance"
	});
}
//#endregion
//#region src/hooks/useTransactionsSearch.ts
var import_debounce = /* @__PURE__ */ __toESM(require_debounce());
function useTransactionsSearch({ updateQuery, resetQuery, dateFormat, delayMs = 150 }) {
	const [isSearching, setIsSearching] = (0, import_react.useState)(false);
	const updateQueryRef = (0, import_react.useRef)(updateQuery);
	updateQueryRef.current = updateQuery;
	const resetQueryRef = (0, import_react.useRef)(resetQuery);
	resetQueryRef.current = resetQuery;
	const updateSearchQuery = (0, import_react.useMemo)(() => (0, import_debounce.default)((searchText) => {
		if (searchText === "") {
			resetQueryRef.current?.();
			setIsSearching(false);
		} else if (searchText) {
			resetQueryRef.current?.();
			updateQueryRef.current((previousQuery) => transactionsSearch(previousQuery, searchText, dateFormat));
			setIsSearching(true);
		}
	}, delayMs), [dateFormat, delayMs]);
	(0, import_react.useEffect)(() => {
		return () => updateSearchQuery.cancel();
	}, [updateSearchQuery]);
	return {
		isSearching,
		search: updateSearchQuery
	};
}
//#endregion
//#region src/components/mobile/accounts/AccountTransactions.tsx
function AccountTransactions(t0) {
	const $ = (0, import_compiler_runtime.c)(7);
	const { account } = t0;
	let t1;
	if ($[0] !== account.id) {
		t1 = getSchedulesQuery(account.id);
		$[0] = account.id;
		$[1] = t1;
	} else t1 = $[1];
	const schedulesQuery = t1;
	let t2;
	if ($[2] !== account) {
		t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TransactionListWithPreviews$4, { account });
		$[2] = account;
		$[3] = t2;
	} else t2 = $[3];
	let t3;
	if ($[4] !== schedulesQuery || $[5] !== t2) {
		t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SchedulesProvider, {
			query: schedulesQuery,
			children: t2
		});
		$[4] = schedulesQuery;
		$[5] = t2;
		$[6] = t3;
	} else t3 = $[6];
	return t3;
}
function TransactionListWithPreviews$4(t0) {
	const $ = (0, import_compiler_runtime.c)(67);
	const { account } = t0;
	const { t } = useTranslation();
	const dateFormat = useDateFormat() || "MM/dd/yyyy";
	const dispatch = useDispatch();
	const navigate = useNavigate();
	const [showRunningBalances] = useSyncedPref(`show-balances-${account.id}`);
	const [hideReconciled] = useSyncedPref(`hide-reconciled-${account.id}`);
	let t1;
	if ($[0] !== account.id || $[1] !== hideReconciled) {
		t1 = () => {
			let query = transactions(account.id).options({ splits: "all" }).select("*");
			if (hideReconciled === "true") query = query.filter({ reconciled: { $eq: false } });
			return query;
		};
		$[0] = account.id;
		$[1] = hideReconciled;
		$[2] = t1;
	} else t1 = $[2];
	const baseTransactionsQuery = t1;
	let t2;
	if ($[3] !== baseTransactionsQuery) {
		t2 = baseTransactionsQuery();
		$[3] = baseTransactionsQuery;
		$[4] = t2;
	} else t2 = $[4];
	const [transactionsQuery, setTransactionsQuery] = (0, import_react.useState)(t2);
	let t3;
	let t4;
	if ($[5] !== baseTransactionsQuery) {
		t3 = () => {
			setTransactionsQuery(baseTransactionsQuery());
		};
		t4 = [baseTransactionsQuery];
		$[5] = baseTransactionsQuery;
		$[6] = t3;
		$[7] = t4;
	} else {
		t3 = $[6];
		t4 = $[7];
	}
	(0, import_react.useEffect)(t3, t4);
	let t5;
	if ($[8] !== baseTransactionsQuery) {
		t5 = () => setTransactionsQuery(baseTransactionsQuery());
		$[8] = baseTransactionsQuery;
		$[9] = t5;
	} else t5 = $[9];
	let t6;
	if ($[10] !== dateFormat || $[11] !== t5) {
		t6 = {
			updateQuery: setTransactionsQuery,
			resetQuery: t5,
			dateFormat
		};
		$[10] = dateFormat;
		$[11] = t5;
		$[12] = t6;
	} else t6 = $[12];
	const { isSearching, search: onSearch } = useTransactionsSearch(t6);
	const shouldCalculateRunningBalances = showRunningBalances === "true" && !!account?.id && !isSearching;
	let t7;
	if ($[13] !== account.id) {
		t7 = account?.id ? accountBalance(account?.id) : allAccountBalance();
		$[13] = account.id;
		$[14] = t7;
	} else t7 = $[14];
	const accountBalanceValue = useSheetValue(t7);
	const t8 = shouldCalculateRunningBalances ? calculateRunningBalancesTopDown : shouldCalculateRunningBalances;
	const t9 = accountBalanceValue || 0;
	let t10;
	if ($[15] !== t8 || $[16] !== t9) {
		t10 = {
			calculateRunningBalances: t8,
			startingBalance: t9
		};
		$[15] = t8;
		$[16] = t9;
		$[17] = t10;
	} else t10 = $[17];
	let t11;
	if ($[18] !== t10 || $[19] !== transactionsQuery) {
		t11 = {
			query: transactionsQuery,
			options: t10
		};
		$[18] = t10;
		$[19] = transactionsQuery;
		$[20] = t11;
	} else t11 = $[20];
	const { transactions: transactions$1, runningBalances, isPending: isTransactionsLoading, isFetchingNextPage: isLoadingMoreTransactions, fetchNextPage: fetchMoreTransactions } = useTransactions(t11);
	const t12 = account?.id;
	let t13;
	if ($[21] !== t12) {
		t13 = { accountId: t12 };
		$[21] = t12;
		$[22] = t13;
	} else t13 = $[22];
	const { previewTransactions, runningBalances: previewRunningBalances, isLoading: isPreviewTransactionsLoading } = useAccountPreviewTransactions(t13);
	const syncAndDownload = useSyncAndDownloadMutation();
	let t14;
	if ($[23] !== account.id || $[24] !== syncAndDownload) {
		t14 = () => {
			if (account.id) syncAndDownload.mutate({ id: account.id });
		};
		$[23] = account.id;
		$[24] = syncAndDownload;
		$[25] = t14;
	} else t14 = $[25];
	const onRefresh = t14;
	let t15;
	if ($[26] !== previewRunningBalances || $[27] !== runningBalances) {
		t15 = new Map([...previewRunningBalances, ...runningBalances]);
		$[26] = previewRunningBalances;
		$[27] = runningBalances;
		$[28] = t15;
	} else t15 = $[28];
	const allBalances = t15;
	let t16;
	let t17;
	if ($[29] !== account.id || $[30] !== dispatch) {
		t16 = () => {
			if (account.id) dispatch(markAccountRead({ id: account.id }));
		};
		t17 = [account.id, dispatch];
		$[29] = account.id;
		$[30] = dispatch;
		$[31] = t16;
		$[32] = t17;
	} else {
		t16 = $[31];
		t17 = $[32];
	}
	(0, import_react.useEffect)(t16, t17);
	let t18;
	if ($[33] !== dispatch || $[34] !== navigate) {
		t18 = (transaction) => {
			if (!isPreviewId(transaction.id)) navigate(`/transactions/${transaction.id}`);
			else dispatch(pushModal({ modal: {
				name: "scheduled-transaction-menu",
				options: {
					transactionId: transaction.id,
					onPost: async (transactionId, t19) => {
						const today = t19 === void 0 ? false : t19;
						await send("schedule/post-transaction", {
							id: transactionId.split("/")[1],
							today
						});
						dispatch(collapseModals({ rootModalName: "scheduled-transaction-menu" }));
					},
					onSkip: async (transactionId_0) => {
						await send("schedule/skip-next-date", { id: transactionId_0.split("/")[1] });
						dispatch(collapseModals({ rootModalName: "scheduled-transaction-menu" }));
					},
					onComplete: async (transactionId_1) => {
						await send("schedule/update", { schedule: {
							id: transactionId_1.split("/")[1],
							completed: true
						} });
						dispatch(collapseModals({ rootModalName: "scheduled-transaction-menu" }));
					}
				}
			} }));
		};
		$[33] = dispatch;
		$[34] = navigate;
		$[35] = t18;
	} else t18 = $[35];
	const onOpenTransaction = t18;
	let t19;
	if ($[36] !== account.id) {
		t19 = accountBalance(account.id);
		$[36] = account.id;
		$[37] = t19;
	} else t19 = $[37];
	let t20;
	if ($[38] !== account.id) {
		t20 = accountBalanceCleared(account.id);
		$[38] = account.id;
		$[39] = t20;
	} else t20 = $[39];
	let t21;
	if ($[40] !== account.id) {
		t21 = accountBalanceUncleared(account.id);
		$[40] = account.id;
		$[41] = t21;
	} else t21 = $[41];
	let t22;
	if ($[42] !== t19 || $[43] !== t20 || $[44] !== t21) {
		t22 = {
			balance: t19,
			cleared: t20,
			uncleared: t21
		};
		$[42] = t19;
		$[43] = t20;
		$[44] = t21;
		$[45] = t22;
	} else t22 = $[45];
	const balanceBindings = t22;
	let t23;
	if ($[46] !== isSearching || $[47] !== previewTransactions || $[48] !== transactions$1) {
		t23 = !isSearching ? previewTransactions.concat(transactions$1.filter(_temp$10)) : transactions$1;
		$[46] = isSearching;
		$[47] = previewTransactions;
		$[48] = transactions$1;
		$[49] = t23;
	} else t23 = $[49];
	const transactionsToDisplay = t23;
	const t24 = isSearching ? isTransactionsLoading : isTransactionsLoading || isPreviewTransactionsLoading;
	const t25 = balanceBindings.balance;
	const t26 = balanceBindings.cleared;
	const t27 = balanceBindings.uncleared;
	let t28;
	if ($[50] !== account.name || $[51] !== t) {
		t28 = t("Search {{accountName}}", { accountName: account.name });
		$[50] = account.name;
		$[51] = t;
		$[52] = t28;
	} else t28 = $[52];
	let t29;
	if ($[53] !== allBalances || $[54] !== balanceBindings.balance || $[55] !== balanceBindings.cleared || $[56] !== balanceBindings.uncleared || $[57] !== fetchMoreTransactions || $[58] !== isLoadingMoreTransactions || $[59] !== onOpenTransaction || $[60] !== onRefresh || $[61] !== onSearch || $[62] !== shouldCalculateRunningBalances || $[63] !== t24 || $[64] !== t28 || $[65] !== transactionsToDisplay) {
		t29 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TransactionListWithBalances, {
			isLoading: t24,
			transactions: transactionsToDisplay,
			balance: t25,
			balanceCleared: t26,
			balanceUncleared: t27,
			runningBalances: allBalances,
			showRunningBalances: shouldCalculateRunningBalances,
			isLoadingMore: isLoadingMoreTransactions,
			onLoadMore: fetchMoreTransactions,
			searchPlaceholder: t28,
			onSearch,
			onOpenTransaction,
			onRefresh
		});
		$[53] = allBalances;
		$[54] = balanceBindings.balance;
		$[55] = balanceBindings.cleared;
		$[56] = balanceBindings.uncleared;
		$[57] = fetchMoreTransactions;
		$[58] = isLoadingMoreTransactions;
		$[59] = onOpenTransaction;
		$[60] = onRefresh;
		$[61] = onSearch;
		$[62] = shouldCalculateRunningBalances;
		$[63] = t24;
		$[64] = t28;
		$[65] = transactionsToDisplay;
		$[66] = t29;
	} else t29 = $[66];
	return t29;
}
function _temp$10(t_0) {
	return !t_0.is_child;
}
//#endregion
//#region src/components/mobile/accounts/AllAccountTransactions.tsx
function AllAccountTransactions() {
	const $ = (0, import_compiler_runtime.c)(2);
	let t0;
	if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
		t0 = getSchedulesQuery();
		$[0] = t0;
	} else t0 = $[0];
	const schedulesQuery = t0;
	let t1;
	if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
		t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SchedulesProvider, {
			query: schedulesQuery,
			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TransactionListWithPreviews$3, {})
		});
		$[1] = t1;
	} else t1 = $[1];
	return t1;
}
function TransactionListWithPreviews$3() {
	const $ = (0, import_compiler_runtime.c)(24);
	const { t } = useTranslation();
	const baseTransactionsQuery = _temp$9;
	let t0;
	if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
		t0 = baseTransactionsQuery();
		$[0] = t0;
	} else t0 = $[0];
	const [transactionsQuery, setTransactionsQuery] = (0, import_react.useState)(t0);
	let t1;
	if ($[1] !== transactionsQuery) {
		t1 = { query: transactionsQuery };
		$[1] = transactionsQuery;
		$[2] = t1;
	} else t1 = $[2];
	const { transactions, isPending: isTransactionsLoading, isFetchingNextPage: isLoadingMoreTransactions, fetchNextPage: fetchMoreTransactions } = useTransactions(t1);
	const { previewTransactions, isLoading: isPreviewTransactionsLoading } = usePreviewTransactions();
	const dateFormat = useDateFormat() || "MM/dd/yyyy";
	const dispatch = useDispatch();
	const navigate = useNavigate();
	let t2;
	if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
		t2 = () => setTransactionsQuery(baseTransactionsQuery());
		$[3] = t2;
	} else t2 = $[3];
	let t3;
	if ($[4] !== dateFormat) {
		t3 = {
			updateQuery: setTransactionsQuery,
			resetQuery: t2,
			dateFormat
		};
		$[4] = dateFormat;
		$[5] = t3;
	} else t3 = $[5];
	const { isSearching, search: onSearch } = useTransactionsSearch(t3);
	let t4;
	if ($[6] !== dispatch || $[7] !== navigate) {
		t4 = (transaction) => {
			if (!isPreviewId(transaction.id)) navigate(`/transactions/${transaction.id}`);
			else dispatch(pushModal({ modal: {
				name: "scheduled-transaction-menu",
				options: {
					transactionId: transaction.id,
					onPost: async (transactionId, t5) => {
						const today = t5 === void 0 ? false : t5;
						await send("schedule/post-transaction", {
							id: transactionId.split("/")[1],
							today
						});
						dispatch(collapseModals({ rootModalName: "scheduled-transaction-menu" }));
					},
					onSkip: async (transactionId_0) => {
						await send("schedule/skip-next-date", { id: transactionId_0.split("/")[1] });
						dispatch(collapseModals({ rootModalName: "scheduled-transaction-menu" }));
					},
					onComplete: async (transactionId_1) => {
						await send("schedule/update", { schedule: {
							id: transactionId_1.split("/")[1],
							completed: true
						} });
						dispatch(collapseModals({ rootModalName: "scheduled-transaction-menu" }));
					}
				}
			} }));
		};
		$[6] = dispatch;
		$[7] = navigate;
		$[8] = t4;
	} else t4 = $[8];
	const onOpenTransaction = t4;
	let t5;
	if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
		t5 = { balance: allAccountBalance() };
		$[9] = t5;
	} else t5 = $[9];
	const balanceBindings = t5;
	let t6;
	if ($[10] !== isSearching || $[11] !== previewTransactions || $[12] !== transactions) {
		t6 = !isSearching ? previewTransactions.concat(transactions.filter(_temp2$6)) : transactions;
		$[10] = isSearching;
		$[11] = previewTransactions;
		$[12] = transactions;
		$[13] = t6;
	} else t6 = $[13];
	const transactionsToDisplay = t6;
	const t7 = isSearching ? isTransactionsLoading : isPreviewTransactionsLoading;
	const t8 = balanceBindings.balance;
	let t9;
	if ($[14] !== t) {
		t9 = t("Search All Accounts");
		$[14] = t;
		$[15] = t9;
	} else t9 = $[15];
	let t10;
	if ($[16] !== fetchMoreTransactions || $[17] !== isLoadingMoreTransactions || $[18] !== onOpenTransaction || $[19] !== onSearch || $[20] !== t7 || $[21] !== t9 || $[22] !== transactionsToDisplay) {
		t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TransactionListWithBalances, {
			isLoading: t7,
			transactions: transactionsToDisplay,
			balance: t8,
			isLoadingMore: isLoadingMoreTransactions,
			onLoadMore: fetchMoreTransactions,
			searchPlaceholder: t9,
			onSearch,
			onOpenTransaction,
			showMakeTransfer: true
		});
		$[16] = fetchMoreTransactions;
		$[17] = isLoadingMoreTransactions;
		$[18] = onOpenTransaction;
		$[19] = onSearch;
		$[20] = t7;
		$[21] = t9;
		$[22] = transactionsToDisplay;
		$[23] = t10;
	} else t10 = $[23];
	return t10;
}
function _temp2$6(t_0) {
	return !t_0.is_child;
}
function _temp$9() {
	return transactions().options({ splits: "all" }).select("*");
}
//#endregion
//#region src/components/mobile/accounts/OffBudgetAccountTransactions.tsx
function OffBudgetAccountTransactions() {
	const $ = (0, import_compiler_runtime.c)(2);
	let t0;
	if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
		t0 = getSchedulesQuery("offbudget");
		$[0] = t0;
	} else t0 = $[0];
	const schedulesQuery = t0;
	let t1;
	if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
		t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SchedulesProvider, {
			query: schedulesQuery,
			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TransactionListWithPreviews$2, {})
		});
		$[1] = t1;
	} else t1 = $[1];
	return t1;
}
function TransactionListWithPreviews$2() {
	const $ = (0, import_compiler_runtime.c)(30);
	const { t } = useTranslation();
	const baseTransactionsQuery = _temp$8;
	let t0;
	if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
		t0 = baseTransactionsQuery();
		$[0] = t0;
	} else t0 = $[0];
	const [transactionsQuery, setTransactionsQuery] = (0, import_react.useState)(t0);
	let t1;
	if ($[1] !== transactionsQuery) {
		t1 = { query: transactionsQuery };
		$[1] = transactionsQuery;
		$[2] = t1;
	} else t1 = $[2];
	const { transactions, isPending: isTransactionsLoading, isFetchingNextPage: isLoadingMoreTransactions, fetchNextPage: fetchMoreTransactions } = useTransactions(t1);
	const { data: t2 } = useOffBudgetAccounts();
	let t3;
	if ($[3] !== t2) {
		t3 = t2 === void 0 ? [] : t2;
		$[3] = t2;
		$[4] = t3;
	} else t3 = $[4];
	const offBudgetAccounts = t3;
	let t4;
	if ($[5] !== offBudgetAccounts) {
		t4 = (schedule) => offBudgetAccounts.some((a) => a.id === schedule._account);
		$[5] = offBudgetAccounts;
		$[6] = t4;
	} else t4 = $[6];
	const offBudgetAccountsFilter = t4;
	let t5;
	if ($[7] !== offBudgetAccountsFilter) {
		t5 = { filter: offBudgetAccountsFilter };
		$[7] = offBudgetAccountsFilter;
		$[8] = t5;
	} else t5 = $[8];
	const { previewTransactions, isLoading: isPreviewTransactionsLoading } = usePreviewTransactions(t5);
	const dateFormat = useDateFormat() || "MM/dd/yyyy";
	const dispatch = useDispatch();
	const navigate = useNavigate();
	let t6;
	if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
		t6 = () => setTransactionsQuery(baseTransactionsQuery());
		$[9] = t6;
	} else t6 = $[9];
	let t7;
	if ($[10] !== dateFormat) {
		t7 = {
			updateQuery: setTransactionsQuery,
			resetQuery: t6,
			dateFormat
		};
		$[10] = dateFormat;
		$[11] = t7;
	} else t7 = $[11];
	const { isSearching, search: onSearch } = useTransactionsSearch(t7);
	let t8;
	if ($[12] !== dispatch || $[13] !== navigate) {
		t8 = (transaction) => {
			if (!isPreviewId(transaction.id)) navigate(`/transactions/${transaction.id}`);
			else dispatch(pushModal({ modal: {
				name: "scheduled-transaction-menu",
				options: {
					transactionId: transaction.id,
					onPost: async (transactionId, t9) => {
						const today = t9 === void 0 ? false : t9;
						await send("schedule/post-transaction", {
							id: transactionId.split("/")[1],
							today
						});
						dispatch(collapseModals({ rootModalName: "scheduled-transaction-menu" }));
					},
					onSkip: async (transactionId_0) => {
						await send("schedule/skip-next-date", { id: transactionId_0.split("/")[1] });
						dispatch(collapseModals({ rootModalName: "scheduled-transaction-menu" }));
					},
					onComplete: async (transactionId_1) => {
						await send("schedule/update", { schedule: {
							id: transactionId_1.split("/")[1],
							completed: true
						} });
						dispatch(collapseModals({ rootModalName: "scheduled-transaction-menu" }));
					}
				}
			} }));
		};
		$[12] = dispatch;
		$[13] = navigate;
		$[14] = t8;
	} else t8 = $[14];
	const onOpenTransaction = t8;
	let t9;
	if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
		t9 = { balance: offBudgetAccountBalance() };
		$[15] = t9;
	} else t9 = $[15];
	const balanceBindings = t9;
	let t10;
	if ($[16] !== isSearching || $[17] !== previewTransactions || $[18] !== transactions) {
		t10 = !isSearching ? previewTransactions.concat(transactions.filter(_temp2$5)) : transactions;
		$[16] = isSearching;
		$[17] = previewTransactions;
		$[18] = transactions;
		$[19] = t10;
	} else t10 = $[19];
	const transactionsToDisplay = t10;
	const t11 = isSearching ? isTransactionsLoading : isPreviewTransactionsLoading;
	const t12 = balanceBindings.balance;
	let t13;
	if ($[20] !== t) {
		t13 = t("Search Off Budget Accounts");
		$[20] = t;
		$[21] = t13;
	} else t13 = $[21];
	let t14;
	if ($[22] !== fetchMoreTransactions || $[23] !== isLoadingMoreTransactions || $[24] !== onOpenTransaction || $[25] !== onSearch || $[26] !== t11 || $[27] !== t13 || $[28] !== transactionsToDisplay) {
		t14 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TransactionListWithBalances, {
			isLoading: t11,
			transactions: transactionsToDisplay,
			balance: t12,
			isLoadingMore: isLoadingMoreTransactions,
			onLoadMore: fetchMoreTransactions,
			searchPlaceholder: t13,
			onSearch,
			onOpenTransaction,
			showMakeTransfer: true
		});
		$[22] = fetchMoreTransactions;
		$[23] = isLoadingMoreTransactions;
		$[24] = onOpenTransaction;
		$[25] = onSearch;
		$[26] = t11;
		$[27] = t13;
		$[28] = transactionsToDisplay;
		$[29] = t14;
	} else t14 = $[29];
	return t14;
}
function _temp2$5(t_0) {
	return !t_0.is_child;
}
function _temp$8() {
	return transactions("offbudget").options({ splits: "all" }).select("*");
}
//#endregion
//#region src/components/mobile/accounts/OnBudgetAccountTransactions.tsx
function OnBudgetAccountTransactions() {
	const $ = (0, import_compiler_runtime.c)(2);
	let t0;
	if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
		t0 = getSchedulesQuery("onbudget");
		$[0] = t0;
	} else t0 = $[0];
	const schedulesQuery = t0;
	let t1;
	if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
		t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SchedulesProvider, {
			query: schedulesQuery,
			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TransactionListWithPreviews$1, {})
		});
		$[1] = t1;
	} else t1 = $[1];
	return t1;
}
function TransactionListWithPreviews$1() {
	const $ = (0, import_compiler_runtime.c)(30);
	const { t } = useTranslation();
	const baseTransactionsQuery = _temp$7;
	let t0;
	if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
		t0 = baseTransactionsQuery();
		$[0] = t0;
	} else t0 = $[0];
	const [transactionsQuery, setTransactionsQuery] = (0, import_react.useState)(t0);
	let t1;
	if ($[1] !== transactionsQuery) {
		t1 = { query: transactionsQuery };
		$[1] = transactionsQuery;
		$[2] = t1;
	} else t1 = $[2];
	const { transactions, isPending: isTransactionsLoading, isFetchingNextPage: isLoadingMoreTransactions, fetchNextPage: fetchMoreTransactions } = useTransactions(t1);
	const { data: t2 } = useOnBudgetAccounts();
	let t3;
	if ($[3] !== t2) {
		t3 = t2 === void 0 ? [] : t2;
		$[3] = t2;
		$[4] = t3;
	} else t3 = $[4];
	const onBudgetAccounts = t3;
	let t4;
	if ($[5] !== onBudgetAccounts) {
		t4 = (schedule) => onBudgetAccounts.some((a) => a.id === schedule._account);
		$[5] = onBudgetAccounts;
		$[6] = t4;
	} else t4 = $[6];
	const onBudgetAccountsFilter = t4;
	let t5;
	if ($[7] !== onBudgetAccountsFilter) {
		t5 = { filter: onBudgetAccountsFilter };
		$[7] = onBudgetAccountsFilter;
		$[8] = t5;
	} else t5 = $[8];
	const { previewTransactions, isLoading: isPreviewTransactionsLoading } = usePreviewTransactions(t5);
	const dateFormat = useDateFormat() || "MM/dd/yyyy";
	const dispatch = useDispatch();
	const navigate = useNavigate();
	let t6;
	if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
		t6 = () => setTransactionsQuery(baseTransactionsQuery());
		$[9] = t6;
	} else t6 = $[9];
	let t7;
	if ($[10] !== dateFormat) {
		t7 = {
			updateQuery: setTransactionsQuery,
			resetQuery: t6,
			dateFormat
		};
		$[10] = dateFormat;
		$[11] = t7;
	} else t7 = $[11];
	const { isSearching, search: onSearch } = useTransactionsSearch(t7);
	let t8;
	if ($[12] !== dispatch || $[13] !== navigate) {
		t8 = (transaction) => {
			if (!isPreviewId(transaction.id)) navigate(`/transactions/${transaction.id}`);
			else dispatch(pushModal({ modal: {
				name: "scheduled-transaction-menu",
				options: {
					transactionId: transaction.id,
					onPost: async (transactionId, t9) => {
						const today = t9 === void 0 ? false : t9;
						await send("schedule/post-transaction", {
							id: transactionId.split("/")[1],
							today
						});
						dispatch(collapseModals({ rootModalName: "scheduled-transaction-menu" }));
					},
					onSkip: async (transactionId_0) => {
						await send("schedule/skip-next-date", { id: transactionId_0.split("/")[1] });
						dispatch(collapseModals({ rootModalName: "scheduled-transaction-menu" }));
					},
					onComplete: async (transactionId_1) => {
						await send("schedule/update", { schedule: {
							id: transactionId_1.split("/")[1],
							completed: true
						} });
						dispatch(collapseModals({ rootModalName: "scheduled-transaction-menu" }));
					}
				}
			} }));
		};
		$[12] = dispatch;
		$[13] = navigate;
		$[14] = t8;
	} else t8 = $[14];
	const onOpenTransaction = t8;
	let t9;
	if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
		t9 = { balance: onBudgetAccountBalance() };
		$[15] = t9;
	} else t9 = $[15];
	const balanceBindings = t9;
	let t10;
	if ($[16] !== isSearching || $[17] !== previewTransactions || $[18] !== transactions) {
		t10 = !isSearching ? previewTransactions.concat(transactions.filter(_temp2$4)) : transactions;
		$[16] = isSearching;
		$[17] = previewTransactions;
		$[18] = transactions;
		$[19] = t10;
	} else t10 = $[19];
	const transactionsToDisplay = t10;
	const t11 = isSearching ? isTransactionsLoading : isPreviewTransactionsLoading;
	const t12 = balanceBindings.balance;
	let t13;
	if ($[20] !== t) {
		t13 = t("Search On Budget Accounts");
		$[20] = t;
		$[21] = t13;
	} else t13 = $[21];
	let t14;
	if ($[22] !== fetchMoreTransactions || $[23] !== isLoadingMoreTransactions || $[24] !== onOpenTransaction || $[25] !== onSearch || $[26] !== t11 || $[27] !== t13 || $[28] !== transactionsToDisplay) {
		t14 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TransactionListWithBalances, {
			isLoading: t11,
			transactions: transactionsToDisplay,
			balance: t12,
			isLoadingMore: isLoadingMoreTransactions,
			onLoadMore: fetchMoreTransactions,
			searchPlaceholder: t13,
			onSearch,
			onOpenTransaction,
			showMakeTransfer: true
		});
		$[22] = fetchMoreTransactions;
		$[23] = isLoadingMoreTransactions;
		$[24] = onOpenTransaction;
		$[25] = onSearch;
		$[26] = t11;
		$[27] = t13;
		$[28] = transactionsToDisplay;
		$[29] = t14;
	} else t14 = $[29];
	return t14;
}
function _temp2$4(t_0) {
	return !t_0.is_child;
}
function _temp$7() {
	return transactions("onbudget").options({ splits: "all" }).select("*");
}
//#endregion
//#region src/components/mobile/accounts/AccountPage.tsx
function AccountPage() {
	const $ = (0, import_compiler_runtime.c)(21);
	const { t } = useTranslation();
	const [_numberFormat] = useSyncedPref("numberFormat");
	const numberFormat = _numberFormat || "comma-dot";
	const [hideFraction] = useSyncedPref("hideFraction");
	const { id: accountIdParam } = useParams();
	const account = useAccount(accountIdParam || "");
	let t0;
	if ($[0] !== t) {
		t0 = (id) => {
			switch (id) {
				case "onbudget": return t("On Budget Accounts");
				case "offbudget": return t("Off Budget Accounts");
				case "uncategorized": return t("Uncategorized");
				case "closed": return t("Closed Accounts");
				default: return t("All Accounts");
			}
		};
		$[0] = t;
		$[1] = t0;
	} else t0 = $[1];
	const nameFromId = t0;
	let t1;
	if ($[2] !== account || $[3] !== accountIdParam || $[4] !== nameFromId) {
		t1 = account ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccountHeader, { account }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NameOnlyHeader, { name: nameFromId(accountIdParam) });
		$[2] = account;
		$[3] = accountIdParam;
		$[4] = nameFromId;
		$[5] = t1;
	} else t1 = $[5];
	let t2;
	if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
		t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MobileBackButton, {});
		$[6] = t2;
	} else t2 = $[6];
	const t3 = account?.id;
	let t4;
	if ($[7] !== t3) {
		t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AddTransactionButton, { accountId: t3 });
		$[7] = t3;
		$[8] = t4;
	} else t4 = $[8];
	let t5;
	if ($[9] !== t1 || $[10] !== t4) {
		t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MobilePageHeader, {
			title: t1,
			leftContent: t2,
			rightContent: t4
		});
		$[9] = t1;
		$[10] = t4;
		$[11] = t5;
	} else t5 = $[11];
	const t6 = numberFormat + hideFraction;
	let t7;
	if ($[12] !== account || $[13] !== accountIdParam) {
		t7 = account ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccountTransactions, { account }) : accountIdParam === "onbudget" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(OnBudgetAccountTransactions, {}) : accountIdParam === "offbudget" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(OffBudgetAccountTransactions, {}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AllAccountTransactions, {});
		$[12] = account;
		$[13] = accountIdParam;
		$[14] = t7;
	} else t7 = $[14];
	let t8;
	if ($[15] !== t6 || $[16] !== t7) {
		t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Fragment, { children: t7 }, t6);
		$[15] = t6;
		$[16] = t7;
		$[17] = t8;
	} else t8 = $[17];
	let t9;
	if ($[18] !== t5 || $[19] !== t8) {
		t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Page, {
			header: t5,
			padding: 0,
			children: t8
		});
		$[18] = t5;
		$[19] = t8;
		$[20] = t9;
	} else t9 = $[20];
	return t9;
}
function AccountHeader(t0) {
	const $ = (0, import_compiler_runtime.c)(53);
	const { account } = t0;
	const failedAccounts = useFailedAccounts();
	const { t } = useTranslation();
	const syncingAccountIds = useSelector(_temp$6);
	let t1;
	if ($[0] !== account.id || $[1] !== syncingAccountIds) {
		t1 = syncingAccountIds.includes(account.id);
		$[0] = account.id;
		$[1] = syncingAccountIds;
		$[2] = t1;
	} else t1 = $[2];
	const pending = t1;
	let t2;
	if ($[3] !== account.id || $[4] !== failedAccounts) {
		t2 = failedAccounts.has(account.id);
		$[3] = account.id;
		$[4] = failedAccounts;
		$[5] = t2;
	} else t2 = $[5];
	const failed = t2;
	const dispatch = useDispatch();
	const { mutate: updateAccount } = useUpdateAccountMutation();
	let t3;
	if ($[6] !== updateAccount) {
		t3 = (account_0) => {
			updateAccount({ account: account_0 });
		};
		$[6] = updateAccount;
		$[7] = t3;
	} else t3 = $[7];
	const onSave = t3;
	const onSaveNotes = _temp2$3;
	let t4;
	if ($[8] !== account.name || $[9] !== dispatch) {
		t4 = (id_0) => {
			dispatch(pushModal({ modal: {
				name: "notes",
				options: {
					id: `account-${id_0}`,
					name: account.name,
					onSave: onSaveNotes
				}
			} }));
		};
		$[8] = account.name;
		$[9] = dispatch;
		$[10] = t4;
	} else t4 = $[10];
	const onEditNotes = t4;
	let t5;
	if ($[11] !== account.id || $[12] !== dispatch) {
		t5 = () => {
			dispatch(openAccountCloseModal({ accountId: account.id }));
		};
		$[11] = account.id;
		$[12] = dispatch;
		$[13] = t5;
	} else t5 = $[13];
	const onCloseAccount = t5;
	const { mutate: reopenAccount } = useReopenAccountMutation();
	let t6;
	if ($[14] !== account.id || $[15] !== reopenAccount) {
		t6 = () => {
			reopenAccount({ id: account.id });
		};
		$[14] = account.id;
		$[15] = reopenAccount;
		$[16] = t6;
	} else t6 = $[16];
	const onReopenAccount = t6;
	const [showRunningBalances, setShowRunningBalances] = useSyncedPref(`show-balances-${account.id}`);
	const [hideReconciled, setHideReconciled] = useSyncedPref(`hide-reconciled-${account.id}`);
	let t7;
	if ($[17] !== dispatch || $[18] !== setShowRunningBalances || $[19] !== showRunningBalances) {
		t7 = () => {
			setShowRunningBalances(showRunningBalances === "true" ? "false" : "true");
			dispatch(collapseModals({ rootModalName: "account-menu" }));
		};
		$[17] = dispatch;
		$[18] = setShowRunningBalances;
		$[19] = showRunningBalances;
		$[20] = t7;
	} else t7 = $[20];
	const onToggleRunningBalance = t7;
	let t8;
	if ($[21] !== dispatch || $[22] !== hideReconciled || $[23] !== setHideReconciled) {
		t8 = () => {
			setHideReconciled(hideReconciled === "true" ? "false" : "true");
			dispatch(collapseModals({ rootModalName: "account-menu" }));
		};
		$[21] = dispatch;
		$[22] = hideReconciled;
		$[23] = setHideReconciled;
		$[24] = t8;
	} else t8 = $[24];
	const onToggleReconciled = t8;
	let t9;
	if ($[25] !== account.id || $[26] !== dispatch || $[27] !== onCloseAccount || $[28] !== onEditNotes || $[29] !== onReopenAccount || $[30] !== onSave || $[31] !== onToggleReconciled || $[32] !== onToggleRunningBalance) {
		t9 = () => {
			dispatch(pushModal({ modal: {
				name: "account-menu",
				options: {
					accountId: account.id,
					onSave,
					onEditNotes,
					onCloseAccount,
					onReopenAccount,
					onToggleRunningBalance,
					onToggleReconciled
				}
			} }));
		};
		$[25] = account.id;
		$[26] = dispatch;
		$[27] = onCloseAccount;
		$[28] = onEditNotes;
		$[29] = onReopenAccount;
		$[30] = onSave;
		$[31] = onToggleReconciled;
		$[32] = onToggleRunningBalance;
		$[33] = t9;
	} else t9 = $[33];
	const onClick = t9;
	let t10;
	if ($[34] === Symbol.for("react.memo_cache_sentinel")) {
		t10 = { flexDirection: "row" };
		$[34] = t10;
	} else t10 = $[34];
	let t11;
	if ($[35] !== account.bank || $[36] !== failed || $[37] !== pending) {
		t11 = account.bank && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, { style: {
			margin: "auto",
			marginRight: 5,
			width: 8,
			height: 8,
			borderRadius: 8,
			flexShrink: 0,
			backgroundColor: pending ? theme.sidebarItemBackgroundPending : failed ? theme.sidebarItemBackgroundFailed : theme.sidebarItemBackgroundPositive,
			transition: "transform .3s"
		} });
		$[35] = account.bank;
		$[36] = failed;
		$[37] = pending;
		$[38] = t11;
	} else t11 = $[38];
	let t12;
	if ($[39] === Symbol.for("react.memo_cache_sentinel")) {
		t12 = styles.lineClamp(2);
		$[39] = t12;
	} else t12 = $[39];
	let t13;
	if ($[40] === Symbol.for("react.memo_cache_sentinel")) {
		t13 = {
			fontSize: 17,
			fontWeight: 500,
			...styles.underlinedText,
			...t12
		};
		$[40] = t13;
	} else t13 = $[40];
	let t14;
	if ($[41] !== account.closed || $[42] !== account.name || $[43] !== t) {
		t14 = account.closed ? t("Closed: {{accountName}}", { accountName: account.name }) : account.name;
		$[41] = account.closed;
		$[42] = account.name;
		$[43] = t;
		$[44] = t14;
	} else t14 = $[44];
	let t15;
	if ($[45] !== t14) {
		t15 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
			style: t13,
			children: t14
		});
		$[45] = t14;
		$[46] = t15;
	} else t15 = $[46];
	let t16;
	if ($[47] !== onClick || $[48] !== t15) {
		t16 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
			variant: "bare",
			onPress: onClick,
			children: t15
		});
		$[47] = onClick;
		$[48] = t15;
		$[49] = t16;
	} else t16 = $[49];
	let t17;
	if ($[50] !== t11 || $[51] !== t16) {
		t17 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(View, {
			style: t10,
			children: [t11, t16]
		});
		$[50] = t11;
		$[51] = t16;
		$[52] = t17;
	} else t17 = $[52];
	return t17;
}
async function _temp2$3(id, notes) {
	await send("notes-save", {
		id,
		note: notes
	});
}
function _temp$6(state) {
	return state.account.accountsSyncing;
}
function NameOnlyHeader(t0) {
	const $ = (0, import_compiler_runtime.c)(5);
	const { name } = t0;
	let t1;
	if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
		t1 = { flexDirection: "row" };
		$[0] = t1;
	} else t1 = $[0];
	let t2;
	if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
		t2 = styles.lineClamp(2);
		$[1] = t2;
	} else t2 = $[1];
	let t3;
	if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
		t3 = { ...t2 };
		$[2] = t3;
	} else t3 = $[2];
	let t4;
	if ($[3] !== name) {
		t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, {
			style: t1,
			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
				style: t3,
				children: name
			})
		});
		$[3] = name;
		$[4] = t4;
	} else t4 = $[4];
	return t4;
}
//#endregion
//#region src/components/mobile/rules/AddRuleButton.tsx
function AddRuleButton() {
	const $ = (0, import_compiler_runtime.c)(9);
	const { t } = useTranslation();
	const navigate = useNavigate();
	let t0;
	if ($[0] !== navigate) {
		t0 = () => {
			navigate("/rules/new");
		};
		$[0] = navigate;
		$[1] = t0;
	} else t0 = $[1];
	const handleAddRule = t0;
	let t1;
	if ($[2] !== t) {
		t1 = t("Add new rule");
		$[2] = t;
		$[3] = t1;
	} else t1 = $[3];
	let t2;
	if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
		t2 = { margin: 10 };
		$[4] = t2;
	} else t2 = $[4];
	let t3;
	if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
		t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SvgAdd, {
			width: 20,
			height: 20
		});
		$[5] = t3;
	} else t3 = $[5];
	let t4;
	if ($[6] !== handleAddRule || $[7] !== t1) {
		t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
			variant: "bare",
			"aria-label": t1,
			style: t2,
			onPress: handleAddRule,
			children: t3
		});
		$[6] = handleAddRule;
		$[7] = t1;
		$[8] = t4;
	} else t4 = $[8];
	return t4;
}
//#endregion
//#region src/components/mobile/ActionableGridListItem.tsx
function ActionableGridListItem(t0) {
	const $ = (0, import_compiler_runtime.c)(55);
	let actions;
	let children;
	let onAction;
	let props;
	let t1;
	let t2;
	let textValue;
	let value;
	if ($[0] !== t0) {
		({value, textValue, actions, actionsBackgroundColor: t1, actionsWidth: t2, children, onAction, ...props} = t0);
		$[0] = t0;
		$[1] = actions;
		$[2] = children;
		$[3] = onAction;
		$[4] = props;
		$[5] = t1;
		$[6] = t2;
		$[7] = textValue;
		$[8] = value;
	} else {
		actions = $[1];
		children = $[2];
		onAction = $[3];
		props = $[4];
		t1 = $[5];
		t2 = $[6];
		textValue = $[7];
		value = $[8];
	}
	const actionsBackgroundColor = t1 === void 0 ? theme.errorBackground : t1;
	const actionsWidth = t2 === void 0 ? 100 : t2;
	const dragStartedRef = (0, import_react.useRef)(false);
	const [isRevealed, setIsRevealed] = (0, import_react.useState)(false);
	const hasActions = !!actions;
	let t3;
	if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
		t3 = [];
		$[9] = t3;
	} else t3 = $[9];
	const [t4, api] = useSpring(_temp$5, t3);
	const { x } = t4;
	let t5;
	if ($[10] !== actionsWidth || $[11] !== api || $[12] !== isRevealed) {
		t5 = (t6) => {
			const { active, movement: t7, velocity: t8 } = t6;
			const [mx] = t7;
			const [vx] = t8;
			const currentX = (isRevealed ? -actionsWidth : 0) + mx;
			if (active) {
				dragStartedRef.current = true;
				api.start({
					to: { x: Math.max(-actionsWidth, Math.min(0, currentX)) },
					onRest: () => {
						dragStartedRef.current = false;
					}
				});
				return;
			}
			const shouldReveal = currentX < -actionsWidth / 2 || vx < -.5 && currentX < -actionsWidth / 5;
			api.start({
				to: { x: shouldReveal ? -actionsWidth : 0 },
				onRest: () => {
					dragStartedRef.current = false;
					setIsRevealed(shouldReveal);
				}
			});
		};
		$[10] = actionsWidth;
		$[11] = api;
		$[12] = isRevealed;
		$[13] = t5;
	} else t5 = $[13];
	let t6;
	if ($[14] !== actionsWidth || $[15] !== isRevealed) {
		t6 = () => [isRevealed ? -actionsWidth : 0, 0];
		$[14] = actionsWidth;
		$[15] = isRevealed;
		$[16] = t6;
	} else t6 = $[16];
	let t7;
	if ($[17] !== hasActions || $[18] !== t6) {
		t7 = {
			axis: "x",
			from: t6,
			enabled: hasActions
		};
		$[17] = hasActions;
		$[18] = t6;
		$[19] = t7;
	} else t7 = $[19];
	const bind = useDrag(t5, t7);
	let t8;
	if ($[20] !== onAction) {
		t8 = () => {
			if (!dragStartedRef.current) onAction?.();
		};
		$[20] = onAction;
		$[21] = t8;
	} else t8 = $[21];
	const handleAction = t8;
	const t9 = hasActions ? actionsBackgroundColor : styles.mobileListItem.backgroundColor ?? "transparent";
	let t10;
	if ($[22] !== t9) {
		t10 = {
			...styles.mobileListItem,
			padding: 0,
			backgroundColor: t9,
			overflow: "hidden"
		};
		$[22] = t9;
		$[23] = t10;
	} else t10 = $[23];
	let t11;
	if ($[24] !== bind || $[25] !== hasActions) {
		t11 = hasActions ? bind() : {};
		$[24] = bind;
		$[25] = hasActions;
		$[26] = t11;
	} else t11 = $[26];
	let t12;
	if ($[27] !== hasActions || $[28] !== x) {
		t12 = hasActions ? { transform: x.to(_temp2$2) } : {};
		$[27] = hasActions;
		$[28] = x;
		$[29] = t12;
	} else t12 = $[29];
	const t13 = hasActions ? "pan-y" : "auto";
	const t14 = hasActions ? "grab" : "pointer";
	let t15;
	if ($[30] !== t12 || $[31] !== t13 || $[32] !== t14) {
		t15 = {
			...t12,
			display: "flex",
			touchAction: t13,
			cursor: t14
		};
		$[30] = t12;
		$[31] = t13;
		$[32] = t14;
		$[33] = t15;
	} else t15 = $[33];
	let t16;
	if ($[34] === Symbol.for("react.memo_cache_sentinel")) {
		t16 = {
			flex: 1,
			backgroundColor: theme.tableBackground,
			minWidth: "100%",
			padding: 16,
			textAlign: "left",
			borderRadius: 0,
			justifyContent: "flex-start",
			alignItems: "flex-start"
		};
		$[34] = t16;
	} else t16 = $[34];
	let t17;
	if ($[35] !== children || $[36] !== handleAction) {
		t17 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
			variant: "bare",
			style: t16,
			onClick: handleAction,
			children
		});
		$[35] = children;
		$[36] = handleAction;
		$[37] = t17;
	} else t17 = $[37];
	let t18;
	if ($[38] !== actions || $[39] !== actionsBackgroundColor || $[40] !== actionsWidth || $[41] !== api || $[42] !== hasActions) {
		t18 = hasActions && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
			style: {
				display: "flex",
				justifyContent: "center",
				backgroundColor: actionsBackgroundColor,
				minWidth: actionsWidth
			},
			children: typeof actions === "function" ? actions({ close: () => {
				api.start({
					to: { x: 0 },
					onRest: () => {
						setIsRevealed(false);
					}
				});
			} }) : actions
		});
		$[38] = actions;
		$[39] = actionsBackgroundColor;
		$[40] = actionsWidth;
		$[41] = api;
		$[42] = hasActions;
		$[43] = t18;
	} else t18 = $[43];
	let t19;
	if ($[44] !== t11 || $[45] !== t15 || $[46] !== t17 || $[47] !== t18) {
		t19 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(animated.div, {
			...t11,
			style: t15,
			children: [t17, t18]
		});
		$[44] = t11;
		$[45] = t15;
		$[46] = t17;
		$[47] = t18;
		$[48] = t19;
	} else t19 = $[48];
	let t20;
	if ($[49] !== props || $[50] !== t10 || $[51] !== t19 || $[52] !== textValue || $[53] !== value) {
		t20 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)($72e60046c03fbe42$export$e96fc9a8407faa6b, {
			...props,
			value,
			textValue,
			style: t10,
			children: t19
		});
		$[49] = props;
		$[50] = t10;
		$[51] = t19;
		$[52] = textValue;
		$[53] = value;
		$[54] = t20;
	} else t20 = $[54];
	return t20;
}
function _temp2$2(v) {
	return `translate3d(${v}px,0,0)`;
}
function _temp$5() {
	return {
		from: { x: 0 },
		config: config.stiff
	};
}
//#endregion
//#region src/components/mobile/rules/RulesListItem.tsx
function RulesListItem(t0) {
	const $ = (0, import_compiler_runtime.c)(94);
	let onDelete;
	let props;
	let rule;
	let style;
	if ($[0] !== t0) {
		({value: rule, onDelete, style, ...props} = t0);
		$[0] = t0;
		$[1] = onDelete;
		$[2] = props;
		$[3] = rule;
		$[4] = style;
	} else {
		onDelete = $[1];
		props = $[2];
		rule = $[3];
		style = $[4];
	}
	const { t } = useTranslation();
	let T0;
	let T1;
	let T2;
	let T3;
	let t1;
	let t10;
	let t11;
	let t12;
	let t13;
	let t14;
	let t2;
	let t3;
	let t4;
	let t5;
	let t6;
	let t7;
	let t8;
	let t9;
	if ($[5] !== onDelete || $[6] !== props || $[7] !== rule || $[8] !== style || $[9] !== t) {
		const actionSplits = groupActionsBySplitIndex(rule.actions);
		const hasSplits = actionSplits.length > 1;
		T3 = ActionableGridListItem;
		t9 = rule.id;
		t10 = rule;
		if ($[28] !== rule.id || $[29] !== t) {
			t11 = t("Rule {{id}}", { id: rule.id });
			$[28] = rule.id;
			$[29] = t;
			$[30] = t11;
		} else t11 = $[30];
		if ($[31] !== style) {
			t12 = {
				...styles.mobileListItem,
				padding: "8px 16px",
				...style
			};
			$[31] = style;
			$[32] = t12;
		} else t12 = $[32];
		let t15;
		let t16;
		if ($[33] === Symbol.for("react.memo_cache_sentinel")) {
			t15 = {
				color: theme.errorText,
				width: "100%"
			};
			t16 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Trans, { children: "Delete" });
			$[33] = t15;
			$[34] = t16;
		} else {
			t15 = $[33];
			t16 = $[34];
		}
		if ($[35] !== onDelete) {
			t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
				variant: "bare",
				onPress: onDelete,
				style: t15,
				children: t16
			});
			$[35] = onDelete;
			$[36] = t13;
		} else t13 = $[36];
		t14 = props;
		T2 = SpaceBetween;
		t6 = 12;
		if ($[37] === Symbol.for("react.memo_cache_sentinel")) {
			t7 = {
				alignItems: "flex-start",
				width: "100%"
			};
			$[37] = t7;
		} else t7 = $[37];
		let t17;
		if ($[38] === Symbol.for("react.memo_cache_sentinel")) {
			t17 = {
				flexShrink: 0,
				paddingTop: 2
			};
			$[38] = t17;
		} else t17 = $[38];
		const t18 = rule.stage === "pre" ? theme.noticeBackgroundLight : rule.stage === "post" ? theme.warningBackground : theme.pillBackgroundSelected;
		let t19;
		if ($[39] !== t18) {
			t19 = {
				backgroundColor: t18,
				paddingLeft: 6,
				paddingRight: 6,
				paddingTop: 2,
				paddingBottom: 2,
				borderRadius: 3
			};
			$[39] = t18;
			$[40] = t19;
		} else t19 = $[40];
		const t20 = rule.stage === "pre" ? theme.noticeTextLight : rule.stage === "post" ? theme.warningText : theme.pillTextSelected;
		let t21;
		if ($[41] !== t20) {
			t21 = {
				fontSize: 11,
				fontWeight: 500,
				color: t20
			};
			$[41] = t20;
			$[42] = t21;
		} else t21 = $[42];
		let t22;
		if ($[43] !== rule.stage || $[44] !== t) {
			t22 = rule.stage === "pre" ? t("PRE") : rule.stage === "post" ? t("POST") : t("DEFAULT");
			$[43] = rule.stage;
			$[44] = t;
			$[45] = t22;
		} else t22 = $[45];
		let t23;
		if ($[46] !== t21 || $[47] !== t22) {
			t23 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
				style: t21,
				"data-testid": "rule-stage-badge",
				children: t22
			});
			$[46] = t21;
			$[47] = t22;
			$[48] = t23;
		} else t23 = $[48];
		if ($[49] !== t19 || $[50] !== t23) {
			t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, {
				style: t17,
				children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, {
					style: t19,
					children: t23
				})
			});
			$[49] = t19;
			$[50] = t23;
			$[51] = t8;
		} else t8 = $[51];
		T1 = View;
		if ($[52] === Symbol.for("react.memo_cache_sentinel")) {
			t4 = {
				flex: 1,
				flexDirection: "column",
				gap: 4
			};
			$[52] = t4;
		} else t4 = $[52];
		let t24;
		if ($[53] === Symbol.for("react.memo_cache_sentinel")) {
			t24 = {
				fontSize: 13,
				fontWeight: 600,
				color: theme.pageTextLight,
				marginRight: 4
			};
			$[53] = t24;
		} else t24 = $[53];
		let t25;
		if ($[54] !== t) {
			t25 = t("IF");
			$[54] = t;
			$[55] = t25;
		} else t25 = $[55];
		let t26;
		if ($[56] !== t25) {
			t26 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
				style: t24,
				children: t25
			});
			$[56] = t25;
			$[57] = t26;
		} else t26 = $[57];
		let t27;
		if ($[58] !== rule.conditions) {
			t27 = rule.conditions.map(_temp$4);
			$[58] = rule.conditions;
			$[59] = t27;
		} else t27 = $[59];
		if ($[60] !== t26 || $[61] !== t27) {
			t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SpaceBetween, {
				gap: 6,
				children: [t26, t27]
			});
			$[60] = t26;
			$[61] = t27;
			$[62] = t5;
		} else t5 = $[62];
		T0 = View;
		let t28;
		if ($[63] === Symbol.for("react.memo_cache_sentinel")) {
			t1 = {
				flexDirection: "column",
				alignItems: "flex-start",
				gap: 4
			};
			t28 = {
				fontSize: 13,
				fontWeight: 600,
				color: theme.pageTextLight,
				marginBottom: 2
			};
			$[63] = t1;
			$[64] = t28;
		} else {
			t1 = $[63];
			t28 = $[64];
		}
		let t29;
		if ($[65] !== t) {
			t29 = t("THEN");
			$[65] = t;
			$[66] = t29;
		} else t29 = $[66];
		if ($[67] !== t29) {
			t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
				style: t28,
				children: t29
			});
			$[67] = t29;
			$[68] = t2;
		} else t2 = $[68];
		t3 = hasSplits ? actionSplits.map((split, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(View, {
			style: {
				width: "100%",
				flexDirection: "column",
				alignItems: "flex-start",
				marginTop: i > 0 ? 4 : 0,
				padding: "6px",
				borderColor: theme.tableBorder,
				borderWidth: "1px",
				borderRadius: "5px"
			},
			children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
				style: {
					fontSize: 11,
					fontWeight: 500,
					color: theme.pageTextLight,
					marginBottom: 4
				},
				children: i ? t("Split {{num}}", { num: i }) : t("Apply to all")
			}), split.actions.map((action, j) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, {
				style: {
					marginBottom: j !== split.actions.length - 1 ? 2 : 0,
					maxWidth: "100%"
				},
				children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ActionExpression, { ...action })
			}, j))]
		}, i)) : rule.actions.map(_temp2$1);
		$[5] = onDelete;
		$[6] = props;
		$[7] = rule;
		$[8] = style;
		$[9] = t;
		$[10] = T0;
		$[11] = T1;
		$[12] = T2;
		$[13] = T3;
		$[14] = t1;
		$[15] = t10;
		$[16] = t11;
		$[17] = t12;
		$[18] = t13;
		$[19] = t14;
		$[20] = t2;
		$[21] = t3;
		$[22] = t4;
		$[23] = t5;
		$[24] = t6;
		$[25] = t7;
		$[26] = t8;
		$[27] = t9;
	} else {
		T0 = $[10];
		T1 = $[11];
		T2 = $[12];
		T3 = $[13];
		t1 = $[14];
		t10 = $[15];
		t11 = $[16];
		t12 = $[17];
		t13 = $[18];
		t14 = $[19];
		t2 = $[20];
		t3 = $[21];
		t4 = $[22];
		t5 = $[23];
		t6 = $[24];
		t7 = $[25];
		t8 = $[26];
		t9 = $[27];
	}
	let t15;
	if ($[69] !== T0 || $[70] !== t1 || $[71] !== t2 || $[72] !== t3) {
		t15 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(T0, {
			style: t1,
			children: [t2, t3]
		});
		$[69] = T0;
		$[70] = t1;
		$[71] = t2;
		$[72] = t3;
		$[73] = t15;
	} else t15 = $[73];
	let t16;
	if ($[74] !== T1 || $[75] !== t15 || $[76] !== t4 || $[77] !== t5) {
		t16 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(T1, {
			style: t4,
			children: [t5, t15]
		});
		$[74] = T1;
		$[75] = t15;
		$[76] = t4;
		$[77] = t5;
		$[78] = t16;
	} else t16 = $[78];
	let t17;
	if ($[79] !== T2 || $[80] !== t16 || $[81] !== t6 || $[82] !== t7 || $[83] !== t8) {
		t17 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(T2, {
			gap: t6,
			style: t7,
			children: [t8, t16]
		});
		$[79] = T2;
		$[80] = t16;
		$[81] = t6;
		$[82] = t7;
		$[83] = t8;
		$[84] = t17;
	} else t17 = $[84];
	let t18;
	if ($[85] !== T3 || $[86] !== t10 || $[87] !== t11 || $[88] !== t12 || $[89] !== t13 || $[90] !== t14 || $[91] !== t17 || $[92] !== t9) {
		t18 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(T3, {
			id: t9,
			value: t10,
			textValue: t11,
			style: t12,
			actions: t13,
			...t14,
			children: t17
		});
		$[85] = T3;
		$[86] = t10;
		$[87] = t11;
		$[88] = t12;
		$[89] = t13;
		$[90] = t14;
		$[91] = t17;
		$[92] = t9;
		$[93] = t18;
	} else t18 = $[93];
	return t18;
}
function _temp2$1(action_0, index_0) {
	return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, {
		style: {
			marginBottom: 2,
			maxWidth: "100%"
		},
		children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ActionExpression, { ...action_0 })
	}, index_0);
}
function _temp$4(condition, index) {
	return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, {
		style: {
			marginRight: 4,
			marginBottom: 2
		},
		children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ConditionExpression, {
			field: condition.field,
			op: condition.op,
			value: condition.value,
			options: condition.options,
			inline: true
		})
	}, index);
}
//#endregion
//#region src/components/mobile/rules/RulesList.tsx
function RulesList(t0) {
	const $ = (0, import_compiler_runtime.c)(26);
	const { rules, isLoading, onRulePress, onRuleDelete } = t0;
	const { t } = useTranslation();
	if (isLoading && rules.length === 0) {
		let t1;
		if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
			t1 = {
				flex: 1,
				alignItems: "center",
				justifyContent: "center",
				paddingTop: 100
			};
			$[0] = t1;
		} else t1 = $[0];
		let t2;
		if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
			t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, {
				style: t1,
				children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AnimatedLoading, { style: {
					width: 25,
					height: 25
				} })
			});
			$[1] = t2;
		} else t2 = $[1];
		return t2;
	}
	if (rules.length === 0) {
		let t1;
		if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
			t1 = {
				flex: 1,
				alignItems: "center",
				justifyContent: "center",
				paddingHorizontal: 20
			};
			$[2] = t1;
		} else t1 = $[2];
		let t2;
		if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
			t2 = {
				fontSize: 16,
				color: theme.pageTextSubdued,
				textAlign: "center"
			};
			$[3] = t2;
		} else t2 = $[3];
		let t3;
		if ($[4] !== t) {
			t3 = t("No rules found. Create your first rule to get started!");
			$[4] = t;
			$[5] = t3;
		} else t3 = $[5];
		let t4;
		if ($[6] !== t3) {
			t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, {
				style: t1,
				children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
					style: t2,
					children: t3
				})
			});
			$[6] = t3;
			$[7] = t4;
		} else t4 = $[7];
		return t4;
	}
	let t1;
	if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
		t1 = {
			flex: 1,
			overflow: "auto"
		};
		$[8] = t1;
	} else t1 = $[8];
	let t2;
	if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
		t2 = {
			estimatedRowHeight: 140,
			padding: 0
		};
		$[9] = t2;
	} else t2 = $[9];
	let t3;
	if ($[10] !== t) {
		t3 = t("Rules");
		$[10] = t;
		$[11] = t3;
	} else t3 = $[11];
	const t4 = isLoading || void 0;
	let t5;
	if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
		t5 = { paddingBottom: MOBILE_NAV_HEIGHT };
		$[12] = t5;
	} else t5 = $[12];
	let t6;
	if ($[13] !== onRuleDelete || $[14] !== onRulePress) {
		t6 = (rule) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RulesListItem, {
			value: rule,
			onAction: () => onRulePress(rule),
			onDelete: () => onRuleDelete(rule)
		});
		$[13] = onRuleDelete;
		$[14] = onRulePress;
		$[15] = t6;
	} else t6 = $[15];
	let t7;
	if ($[16] !== rules || $[17] !== t3 || $[18] !== t4 || $[19] !== t6) {
		t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)($ce3a951440fc273f$export$89be5a243e59c4b2, {
			layout: $61ef60fc9b1041f4$export$cacbb3924155d68e,
			layoutOptions: t2,
			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)($72e60046c03fbe42$export$a7bfbda1311ca015, {
				"aria-label": t3,
				"aria-busy": t4,
				items: rules,
				style: t5,
				children: t6
			})
		});
		$[16] = rules;
		$[17] = t3;
		$[18] = t4;
		$[19] = t6;
		$[20] = t7;
	} else t7 = $[20];
	let t8;
	if ($[21] !== isLoading) {
		t8 = isLoading && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, {
			style: {
				alignItems: "center",
				paddingTop: 20
			},
			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AnimatedLoading, { style: {
				width: 20,
				height: 20
			} })
		});
		$[21] = isLoading;
		$[22] = t8;
	} else t8 = $[22];
	let t9;
	if ($[23] !== t7 || $[24] !== t8) {
		t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(View, {
			style: t1,
			children: [t7, t8]
		});
		$[23] = t7;
		$[24] = t8;
		$[25] = t9;
	} else t9 = $[25];
	return t9;
}
//#endregion
//#region src/components/mobile/rules/MobileRulesPage.tsx
function MobileRulesPage() {
	const { t } = useTranslation();
	const navigate = useNavigate();
	const dispatch = useDispatch();
	const { showUndoNotification } = useUndo();
	const [visibleRulesParam] = useUrlParam("visible-rules");
	const [allRules, setAllRules] = (0, import_react.useState)([]);
	const [isLoading, setIsLoading] = (0, import_react.useState)(true);
	const [filter, setFilter] = (0, import_react.useState)("");
	const { schedules = [] } = useSchedules({ query: (0, import_react.useMemo)(() => q("schedules").select("*"), []) });
	const { data: { list: categories } = { list: [] } } = useCategories();
	const { data: payees = [] } = usePayees();
	const { data: accounts = [] } = useAccounts();
	const filterData = (0, import_react.useMemo)(() => ({
		payees,
		accounts,
		schedules,
		categories
	}), [
		payees,
		accounts,
		schedules,
		categories
	]);
	const visibleRules = (0, import_react.useMemo)(() => {
		if (!visibleRulesParam || visibleRulesParam.trim() === "") return allRules;
		const visibleRuleIdsSet = new Set(visibleRulesParam.split(",").map((id) => id.trim()));
		return allRules.filter((rule) => visibleRuleIdsSet.has(rule.id));
	}, [allRules, visibleRulesParam]);
	const filteredRules = (0, import_react.useMemo)(() => {
		const rules = visibleRules.filter((rule_0) => {
			const schedule_0 = schedules.find((schedule) => schedule.rule === rule_0.id);
			return schedule_0 ? schedule_0.completed === false : true;
		});
		return filter === "" ? rules : rules.filter((rule_1) => getNormalisedString(ruleToString(rule_1, filterData)).includes(getNormalisedString(filter)));
	}, [
		visibleRules,
		filter,
		filterData,
		schedules
	]);
	const loadRules = (0, import_react.useCallback)(async () => {
		try {
			setIsLoading(true);
			setAllRules(await send("rules-get") || []);
		} catch (error) {
			console.error("Failed to load rules:", error);
			setAllRules([]);
		} finally {
			setIsLoading(false);
		}
	}, []);
	(0, import_react.useEffect)(() => {
		loadRules();
	}, [loadRules]);
	(0, import_react.useEffect)(() => {
		const onUndo = () => {
			loadRules();
		};
		if (getUndoState("undoEvent")) onUndo();
		return listen("undo-event", onUndo);
	}, [loadRules]);
	const handleRulePress = (0, import_react.useCallback)((rule_2) => {
		navigate(`/rules/${rule_2.id}`);
	}, [navigate]);
	const onSearchChange = (0, import_react.useCallback)((value) => {
		setFilter(value);
	}, [setFilter]);
	const handleRuleDelete = (0, import_react.useCallback)(async (rule_3) => {
		try {
			const { someDeletionsFailed } = await send("rule-delete-all", [rule_3.id]);
			if (someDeletionsFailed) dispatch(addNotification({ notification: {
				type: "warning",
				message: t("This rule could not be deleted because it is linked to a schedule.")
			} }));
			else showUndoNotification({ message: t("Rule deleted successfully") });
			await loadRules();
		} catch (error_0) {
			console.error("Failed to delete rule:", error_0);
			dispatch(addNotification({ notification: {
				type: "error",
				message: t("Failed to delete rule. Please try again.")
			} }));
		}
	}, [
		dispatch,
		showUndoNotification,
		t,
		loadRules
	]);
	return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Page, {
		header: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MobilePageHeader, {
			title: t("Rules"),
			rightContent: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AddRuleButton, {})
		}),
		padding: 0,
		children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, {
			style: {
				flexDirection: "row",
				alignItems: "center",
				backgroundColor: theme.mobilePageBackground,
				padding: 10,
				width: "100%",
				borderBottomWidth: 2,
				borderBottomStyle: "solid",
				borderBottomColor: theme.tableBorder
			},
			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Search, {
				placeholder: t("Filter rules…"),
				value: filter,
				onChange: onSearchChange,
				width: "100%",
				height: styles.mobileMinHeight,
				style: {
					backgroundColor: theme.tableBackground,
					borderColor: theme.formInputBorder
				}
			})
		}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RulesList, {
			rules: filteredRules,
			isLoading,
			onRulePress: handleRulePress,
			onRuleDelete: handleRuleDelete
		})]
	});
}
//#endregion
//#region src/components/mobile/rules/MobileRuleEditPage.tsx
function MobileRuleEditPage() {
	const { t } = useTranslation();
	const navigate = useNavigate();
	const { id } = useParams();
	const location = useLocation();
	const dispatch = useDispatch();
	const { showUndoNotification } = useUndo();
	const [rule, setRule] = (0, import_react.useState)(null);
	const [isLoading, setIsLoading] = (0, import_react.useState)(false);
	const { schedules = [] } = useSchedules({ query: (0, import_react.useMemo)(() => rule?.id ? q("schedules").filter({
		rule: rule.id,
		completed: false
	}).select("*") : q("schedules").filter({ id: null }).select("*"), [rule?.id]) });
	const isLinkedToSchedule = schedules.length > 0;
	(0, import_react.useEffect)(() => {
		if (id && id !== "new") {
			setIsLoading(true);
			send("rule-get", { id }).then((loadedRule) => {
				if (loadedRule) setRule(loadedRule);
				else navigate("/rules");
			}).catch((error) => {
				console.error("Failed to load rule:", error);
				navigate("/rules");
			}).finally(() => {
				setIsLoading(false);
			});
		}
	}, [id, navigate]);
	const defaultRule = rule || {
		stage: null,
		conditionsOp: "and",
		conditions: [{
			field: "payee",
			op: "is",
			value: "",
			type: "id"
		}],
		actions: [{
			field: "category",
			op: "set",
			value: "",
			type: "id"
		}],
		...location.state?.rule || {}
	};
	const handleSave = () => {
		if (rule?.id) showUndoNotification({ message: t("Rule saved successfully") });
		navigate("/rules");
	};
	const handleCancel = () => {
		navigate(-1);
	};
	const handleDelete = () => {
		if (!id || id === "new") throw new Error("Cannot delete rule: invalid id");
		dispatch(pushModal({ modal: {
			name: "confirm-delete",
			options: {
				message: t("Are you sure you want to delete this rule?"),
				onConfirm: async () => {
					try {
						await send("rule-delete", id);
						showUndoNotification({ message: t("Rule deleted successfully") });
						navigate("/rules");
					} catch (error_0) {
						console.error("Failed to delete rule:", error_0);
						dispatch(addNotification({ notification: {
							type: "error",
							message: t("Failed to delete rule. Please try again.")
						} }));
					}
				}
			}
		} }));
	};
	const isEditing = Boolean(id && id !== "new" && rule);
	const pageTitle = location.state?.rule ? t("Rule") : isEditing ? t("Edit Rule") : t("Create Rule");
	if (isLoading) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Page, {
		header: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MobilePageHeader, {
			title: t("Loading..."),
			leftContent: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MobileBackButton, { onPress: handleCancel })
		}),
		padding: 0,
		children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, {
			style: {
				flex: 1,
				backgroundColor: theme.mobilePageBackground,
				justifyContent: "center",
				alignItems: "center"
			},
			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Trans, { children: "Loading rule..." }) })
		})
	});
	return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Page, {
		header: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MobilePageHeader, {
			title: pageTitle,
			leftContent: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MobileBackButton, { onPress: handleCancel })
		}),
		padding: 0,
		children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RuleEditor, {
			rule: defaultRule,
			onSave: handleSave,
			onCancel: handleCancel,
			onDelete: isEditing && !isLinkedToSchedule ? handleDelete : void 0,
			style: {
				paddingTop: 10,
				flex: 1,
				backgroundColor: theme.mobilePageBackground
			}
		})
	});
}
//#endregion
//#region src/components/mobile/schedules/AddScheduleButton.tsx
function AddScheduleButton() {
	const $ = (0, import_compiler_runtime.c)(9);
	const { t } = useTranslation();
	const navigate = useNavigate();
	let t0;
	if ($[0] !== navigate) {
		t0 = () => {
			navigate("/schedules/new");
		};
		$[0] = navigate;
		$[1] = t0;
	} else t0 = $[1];
	const handleAddSchedule = t0;
	let t1;
	if ($[2] !== t) {
		t1 = t("Add new schedule");
		$[2] = t;
		$[3] = t1;
	} else t1 = $[3];
	let t2;
	if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
		t2 = { margin: 10 };
		$[4] = t2;
	} else t2 = $[4];
	let t3;
	if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
		t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SvgAdd, {
			width: 20,
			height: 20
		});
		$[5] = t3;
	} else t3 = $[5];
	let t4;
	if ($[6] !== handleAddSchedule || $[7] !== t1) {
		t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
			variant: "bare",
			"aria-label": t1,
			style: t2,
			onPress: handleAddSchedule,
			children: t3
		});
		$[6] = handleAddSchedule;
		$[7] = t1;
		$[8] = t4;
	} else t4 = $[8];
	return t4;
}
//#endregion
//#region src/components/mobile/schedules/SchedulesListItem.tsx
function SchedulesListItem(t0) {
	const $ = (0, import_compiler_runtime.c)(68);
	let onDelete;
	let props;
	let schedule;
	let status;
	let style;
	if ($[0] !== t0) {
		({value: schedule, onDelete, status, style, ...props} = t0);
		$[0] = t0;
		$[1] = onDelete;
		$[2] = props;
		$[3] = schedule;
		$[4] = status;
		$[5] = style;
	} else {
		onDelete = $[1];
		props = $[2];
		schedule = $[3];
		status = $[4];
		style = $[5];
	}
	const { t } = useTranslation();
	const format$2 = useFormat();
	const dateFormat = useDateFormat() || "MM/dd/yyyy";
	let t1;
	let t2;
	if ($[6] !== format$2 || $[7] !== schedule._amount || $[8] !== schedule._amountOp) {
		const amount = getScheduledAmount(schedule._amount);
		t1 = (schedule._amountOp === "isapprox" || schedule._amountOp === "isbetween" ? "~" : "") + (amount > 0 ? "+" : "");
		t2 = format$2(Math.abs(amount || 0), "financial");
		$[6] = format$2;
		$[7] = schedule._amount;
		$[8] = schedule._amountOp;
		$[9] = t1;
		$[10] = t2;
	} else {
		t1 = $[9];
		t2 = $[10];
	}
	const amountStr = t1 + t2;
	let t3;
	if ($[11] !== schedule.name || $[12] !== t) {
		t3 = schedule.name || t("Unnamed schedule");
		$[11] = schedule.name;
		$[12] = t;
		$[13] = t3;
	} else t3 = $[13];
	let t4;
	if ($[14] !== style) {
		t4 = {
			...styles.mobileListItem,
			padding: "8px 16px",
			...style
		};
		$[14] = style;
		$[15] = t4;
	} else t4 = $[15];
	let t5;
	let t6;
	if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
		t5 = {
			color: theme.errorText,
			width: "100%"
		};
		t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Trans, { children: "Delete" });
		$[16] = t5;
		$[17] = t6;
	} else {
		t5 = $[16];
		t6 = $[17];
	}
	let t7;
	if ($[18] !== onDelete) {
		t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
			variant: "bare",
			onPress: onDelete,
			style: t5,
			children: t6
		});
		$[18] = onDelete;
		$[19] = t7;
	} else t7 = $[19];
	let t8;
	if ($[20] === Symbol.for("react.memo_cache_sentinel")) {
		t8 = {
			alignItems: "flex-start",
			width: "100%"
		};
		$[20] = t8;
	} else t8 = $[20];
	let t9;
	if ($[21] === Symbol.for("react.memo_cache_sentinel")) {
		t9 = {
			flex: 1,
			flexDirection: "column",
			gap: 4
		};
		$[21] = t9;
	} else t9 = $[21];
	const t10 = schedule.name ? theme.pageText : theme.buttonNormalDisabledText;
	let t11;
	if ($[22] !== t10) {
		t11 = {
			fontSize: 15,
			fontWeight: 600,
			color: t10
		};
		$[22] = t10;
		$[23] = t11;
	} else t11 = $[23];
	let t12;
	if ($[24] !== schedule.name || $[25] !== t) {
		t12 = schedule.name || t("Unnamed schedule");
		$[24] = schedule.name;
		$[25] = t;
		$[26] = t12;
	} else t12 = $[26];
	let t13;
	if ($[27] !== t11 || $[28] !== t12) {
		t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
			style: t11,
			children: t12
		});
		$[27] = t11;
		$[28] = t12;
		$[29] = t13;
	} else t13 = $[29];
	let t14;
	if ($[30] === Symbol.for("react.memo_cache_sentinel")) {
		t14 = { flexWrap: "wrap" };
		$[30] = t14;
	} else t14 = $[30];
	let t15;
	if ($[31] === Symbol.for("react.memo_cache_sentinel")) {
		t15 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
			style: { color: theme.pageTextSubdued },
			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Trans, { children: "Payee:" })
		});
		$[31] = t15;
	} else t15 = $[31];
	let t16;
	if ($[32] !== schedule._payee) {
		t16 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SpaceBetween, {
			gap: 4,
			direction: "horizontal",
			children: [t15, /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DisplayId, {
				type: "payees",
				id: schedule._payee
			})]
		});
		$[32] = schedule._payee;
		$[33] = t16;
	} else t16 = $[33];
	let t17;
	if ($[34] === Symbol.for("react.memo_cache_sentinel")) {
		t17 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
			style: { color: theme.pageTextSubdued },
			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Trans, { children: "Account:" })
		});
		$[34] = t17;
	} else t17 = $[34];
	let t18;
	if ($[35] !== schedule._account) {
		t18 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SpaceBetween, {
			gap: 4,
			direction: "horizontal",
			children: [t17, /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DisplayId, {
				type: "accounts",
				id: schedule._account
			})]
		});
		$[35] = schedule._account;
		$[36] = t18;
	} else t18 = $[36];
	let t19;
	if ($[37] !== t16 || $[38] !== t18) {
		t19 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SpaceBetween, {
			gap: 4,
			style: t14,
			children: [t16, t18]
		});
		$[37] = t16;
		$[38] = t18;
		$[39] = t19;
	} else t19 = $[39];
	let t20;
	if ($[40] === Symbol.for("react.memo_cache_sentinel")) {
		t20 = { flexWrap: "wrap" };
		$[40] = t20;
	} else t20 = $[40];
	let t21;
	if ($[41] === Symbol.for("react.memo_cache_sentinel")) {
		t21 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
			style: { color: theme.pageTextSubdued },
			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Trans, { children: "Amount:" })
		});
		$[41] = t21;
	} else t21 = $[41];
	let t22;
	if ($[42] === Symbol.for("react.memo_cache_sentinel")) {
		t22 = {
			...styles.tnum,
			color: theme.pageText
		};
		$[42] = t22;
	} else t22 = $[42];
	let t23;
	if ($[43] !== amountStr) {
		t23 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SpaceBetween, {
			gap: 4,
			direction: "horizontal",
			children: [t21, /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
				style: t22,
				children: amountStr
			})]
		});
		$[43] = amountStr;
		$[44] = t23;
	} else t23 = $[44];
	let t24;
	if ($[45] !== dateFormat || $[46] !== schedule.next_date) {
		t24 = schedule.next_date && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SpaceBetween, {
			gap: 4,
			direction: "horizontal",
			children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
				style: { color: theme.pageTextSubdued },
				children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Trans, { children: "Next:" })
			}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
				style: { color: theme.pageText },
				children: format(schedule.next_date, dateFormat)
			})]
		});
		$[45] = dateFormat;
		$[46] = schedule.next_date;
		$[47] = t24;
	} else t24 = $[47];
	let t25;
	if ($[48] !== t23 || $[49] !== t24) {
		t25 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SpaceBetween, {
			gap: 8,
			style: t20,
			children: [t23, t24]
		});
		$[48] = t23;
		$[49] = t24;
		$[50] = t25;
	} else t25 = $[50];
	let t26;
	if ($[51] !== t13 || $[52] !== t19 || $[53] !== t25) {
		t26 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(View, {
			style: t9,
			children: [
				t13,
				t19,
				t25
			]
		});
		$[51] = t13;
		$[52] = t19;
		$[53] = t25;
		$[54] = t26;
	} else t26 = $[54];
	let t27;
	if ($[55] === Symbol.for("react.memo_cache_sentinel")) {
		t27 = {
			flexShrink: 0,
			paddingTop: 2
		};
		$[55] = t27;
	} else t27 = $[55];
	let t28;
	if ($[56] !== status) {
		t28 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, {
			style: t27,
			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StatusBadge, { status })
		});
		$[56] = status;
		$[57] = t28;
	} else t28 = $[57];
	let t29;
	if ($[58] !== t26 || $[59] !== t28) {
		t29 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SpaceBetween, {
			gap: 12,
			style: t8,
			children: [t26, t28]
		});
		$[58] = t26;
		$[59] = t28;
		$[60] = t29;
	} else t29 = $[60];
	let t30;
	if ($[61] !== props || $[62] !== schedule || $[63] !== t29 || $[64] !== t3 || $[65] !== t4 || $[66] !== t7) {
		t30 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ActionableGridListItem, {
			id: schedule.id,
			value: schedule,
			textValue: t3,
			style: t4,
			actions: t7,
			...props,
			children: t29
		});
		$[61] = props;
		$[62] = schedule;
		$[63] = t29;
		$[64] = t3;
		$[65] = t4;
		$[66] = t7;
		$[67] = t30;
	} else t30 = $[67];
	return t30;
}
//#endregion
//#region src/components/mobile/schedules/SchedulesList.tsx
function SchedulesList(t0) {
	const $ = (0, import_compiler_runtime.c)(34);
	const { schedules, isLoading, statuses, onSchedulePress, onScheduleDelete, hasCompletedSchedules: t1, showCompleted: t2, onShowCompleted } = t0;
	const hasCompletedSchedules = t1 === void 0 ? false : t1;
	const showCompleted = t2 === void 0 ? false : t2;
	const { t } = useTranslation();
	const shouldShowCompletedItem = hasCompletedSchedules && !showCompleted && onShowCompleted;
	let t3;
	if ($[0] !== schedules || $[1] !== shouldShowCompletedItem) {
		t3 = shouldShowCompletedItem ? [...schedules, { id: "show-completed" }] : schedules;
		$[0] = schedules;
		$[1] = shouldShowCompletedItem;
		$[2] = t3;
	} else t3 = $[2];
	const listItems = t3;
	let t4;
	if ($[3] !== t) {
		t4 = t("Show completed schedules");
		$[3] = t;
		$[4] = t4;
	} else t4 = $[4];
	const showCompletedLabel = t4;
	if (isLoading && listItems.length === 0) {
		let t5;
		if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
			t5 = {
				flex: 1,
				alignItems: "center",
				justifyContent: "center",
				paddingTop: 100
			};
			$[5] = t5;
		} else t5 = $[5];
		let t6;
		if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
			t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, {
				style: t5,
				children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AnimatedLoading, { style: {
					width: 25,
					height: 25
				} })
			});
			$[6] = t6;
		} else t6 = $[6];
		return t6;
	}
	if (listItems.length === 0) {
		let t5;
		if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
			t5 = {
				flex: 1,
				alignItems: "center",
				justifyContent: "center",
				paddingHorizontal: 20
			};
			$[7] = t5;
		} else t5 = $[7];
		let t6;
		if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
			t6 = {
				fontSize: 16,
				color: theme.pageTextSubdued,
				textAlign: "center",
				paddingLeft: 10,
				paddingRight: 10
			};
			$[8] = t6;
		} else t6 = $[8];
		let t7;
		if ($[9] !== t) {
			t7 = t("No schedules found. Create your first schedule to get started!");
			$[9] = t;
			$[10] = t7;
		} else t7 = $[10];
		let t8;
		if ($[11] !== t7) {
			t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, {
				style: t5,
				children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
					style: t6,
					children: t7
				})
			});
			$[11] = t7;
			$[12] = t8;
		} else t8 = $[12];
		return t8;
	}
	let t5;
	if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
		t5 = {
			flex: 1,
			overflow: "auto"
		};
		$[13] = t5;
	} else t5 = $[13];
	let t6;
	if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
		t6 = {
			estimatedRowHeight: 140,
			padding: 0
		};
		$[14] = t6;
	} else t6 = $[14];
	let t7;
	if ($[15] !== t) {
		t7 = t("Schedules");
		$[15] = t;
		$[16] = t7;
	} else t7 = $[16];
	const t8 = isLoading || void 0;
	let t9;
	if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
		t9 = { paddingBottom: MOBILE_NAV_HEIGHT };
		$[17] = t9;
	} else t9 = $[17];
	let t10;
	if ($[18] !== onScheduleDelete || $[19] !== onSchedulePress || $[20] !== onShowCompleted || $[21] !== showCompletedLabel || $[22] !== statuses) {
		t10 = (item) => !("completed" in item) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ActionableGridListItem, {
			id: "show-completed",
			value: item,
			textValue: showCompletedLabel,
			onAction: onShowCompleted,
			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, {
				style: {
					width: "100%",
					alignItems: "center"
				},
				children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
					style: {
						fontStyle: "italic",
						color: theme.pageTextSubdued
					},
					children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Trans, { children: "Show completed schedules" })
				})
			})
		}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SchedulesListItem, {
			value: item,
			status: statuses.get(item.id) || "scheduled",
			onAction: () => onSchedulePress(item),
			onDelete: () => onScheduleDelete(item)
		});
		$[18] = onScheduleDelete;
		$[19] = onSchedulePress;
		$[20] = onShowCompleted;
		$[21] = showCompletedLabel;
		$[22] = statuses;
		$[23] = t10;
	} else t10 = $[23];
	let t11;
	if ($[24] !== listItems || $[25] !== t10 || $[26] !== t7 || $[27] !== t8) {
		t11 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)($ce3a951440fc273f$export$89be5a243e59c4b2, {
			layout: $61ef60fc9b1041f4$export$cacbb3924155d68e,
			layoutOptions: t6,
			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)($72e60046c03fbe42$export$a7bfbda1311ca015, {
				"aria-label": t7,
				"aria-busy": t8,
				items: listItems,
				style: t9,
				children: t10
			})
		});
		$[24] = listItems;
		$[25] = t10;
		$[26] = t7;
		$[27] = t8;
		$[28] = t11;
	} else t11 = $[28];
	let t12;
	if ($[29] !== isLoading) {
		t12 = isLoading && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, {
			style: {
				alignItems: "center",
				paddingTop: 20
			},
			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AnimatedLoading, { style: {
				width: 20,
				height: 20
			} })
		});
		$[29] = isLoading;
		$[30] = t12;
	} else t12 = $[30];
	let t13;
	if ($[31] !== t11 || $[32] !== t12) {
		t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(View, {
			style: t5,
			children: [t11, t12]
		});
		$[31] = t11;
		$[32] = t12;
		$[33] = t13;
	} else t13 = $[33];
	return t13;
}
//#endregion
//#region src/components/mobile/schedules/MobileSchedulesPage.tsx
function MobileSchedulesPage() {
	const $ = (0, import_compiler_runtime.c)(48);
	const { t } = useTranslation();
	const navigate = useNavigate();
	const dispatch = useDispatch();
	const { showUndoNotification } = useUndo();
	const [filter, setFilter] = (0, import_react.useState)("");
	const [showCompleted, setShowCompleted] = (0, import_react.useState)(false);
	const format$1 = useFormat();
	const dateFormat = useDateFormat() || "MM/dd/yyyy";
	let t0;
	if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
		t0 = q("schedules").select("*");
		$[0] = t0;
	} else t0 = $[0];
	const schedulesQuery = t0;
	let t1;
	if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
		t1 = { query: schedulesQuery };
		$[1] = t1;
	} else t1 = $[1];
	const { isLoading: isSchedulesLoading, schedules, statuses } = useSchedules(t1);
	const { data: t2 } = usePayees();
	let t3;
	if ($[2] !== t2) {
		t3 = t2 === void 0 ? [] : t2;
		$[2] = t2;
		$[3] = t3;
	} else t3 = $[3];
	const payees = t3;
	const { data: t4 } = useAccounts();
	let t5;
	if ($[4] !== t4) {
		t5 = t4 === void 0 ? [] : t4;
		$[4] = t4;
		$[5] = t5;
	} else t5 = $[5];
	const accounts = t5;
	let t6;
	if ($[6] !== filter) {
		t6 = (str) => str ? getNormalisedString(str).includes(getNormalisedString(filter)) || getNormalisedString(filter).includes(getNormalisedString(str)) : false;
		$[6] = filter;
		$[7] = t6;
	} else t6 = $[7];
	const filterIncludes = t6;
	let t7;
	if ($[8] !== accounts || $[9] !== dateFormat || $[10] !== filter || $[11] !== filterIncludes || $[12] !== format$1 || $[13] !== payees || $[14] !== schedules || $[15] !== statuses) {
		t7 = filter ? schedules.filter((schedule) => {
			const payee = payees.find((p) => schedule._payee === p.id);
			const account = accounts.find((a) => schedule._account === a.id);
			const amount = getScheduledAmount(schedule._amount);
			const amountStr = (schedule._amountOp === "isapprox" || schedule._amountOp === "isbetween" ? "~" : "") + (amount > 0 ? "+" : "") + format$1(Math.abs(amount || 0), "financial");
			const dateStr = schedule.next_date ? format(schedule.next_date, dateFormat) : null;
			const statusLabel = statuses.get(schedule.id);
			return filterIncludes(schedule.name) || filterIncludes(payee?.name) || filterIncludes(account?.name) || filterIncludes(amountStr) || filterIncludes(statusLabel) || filterIncludes(dateStr);
		}) : schedules;
		$[8] = accounts;
		$[9] = dateFormat;
		$[10] = filter;
		$[11] = filterIncludes;
		$[12] = format$1;
		$[13] = payees;
		$[14] = schedules;
		$[15] = statuses;
		$[16] = t7;
	} else t7 = $[16];
	const baseSchedules = t7;
	let t8;
	if ($[17] !== baseSchedules) {
		t8 = baseSchedules.some(_temp$3);
		$[17] = baseSchedules;
		$[18] = t8;
	} else t8 = $[18];
	const hasCompletedSchedules = t8;
	let t9;
	if ($[19] !== baseSchedules || $[20] !== showCompleted) {
		t9 = showCompleted ? baseSchedules : baseSchedules.filter(_temp2);
		$[19] = baseSchedules;
		$[20] = showCompleted;
		$[21] = t9;
	} else t9 = $[21];
	const filteredSchedules = t9;
	let t10;
	if ($[22] !== navigate) {
		t10 = (schedule_2) => {
			navigate(`/schedules/${schedule_2.id}`);
		};
		$[22] = navigate;
		$[23] = t10;
	} else t10 = $[23];
	const handleSchedulePress = t10;
	let t11;
	if ($[24] !== dispatch || $[25] !== showUndoNotification || $[26] !== t) {
		t11 = async (schedule_3) => {
			try {
				await send("schedule/delete", { id: schedule_3.id });
				showUndoNotification({ message: t("Schedule deleted successfully") });
			} catch (t12) {
				console.error("Failed to delete schedule:", t12);
				dispatch(addNotification({ notification: {
					type: "error",
					message: t("Failed to delete schedule. Please try again.")
				} }));
			}
		};
		$[24] = dispatch;
		$[25] = showUndoNotification;
		$[26] = t;
		$[27] = t11;
	} else t11 = $[27];
	const handleScheduleDelete = t11;
	let t12;
	if ($[28] === Symbol.for("react.memo_cache_sentinel")) {
		t12 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MobilePageHeader, {
			title: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
				style: {
					...styles.underlinedText,
					fontSize: 16
				},
				children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Trans, { children: "Schedules" })
			}),
			rightContent: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AddScheduleButton, {})
		});
		$[28] = t12;
	} else t12 = $[28];
	let t13;
	if ($[29] === Symbol.for("react.memo_cache_sentinel")) {
		t13 = {
			flexDirection: "row",
			alignItems: "center",
			backgroundColor: theme.mobilePageBackground,
			padding: 10,
			width: "100%",
			borderBottomWidth: 2,
			borderBottomStyle: "solid",
			borderBottomColor: theme.tableBorder
		};
		$[29] = t13;
	} else t13 = $[29];
	let t14;
	if ($[30] !== t) {
		t14 = t("Filter schedules…");
		$[30] = t;
		$[31] = t14;
	} else t14 = $[31];
	let t15;
	if ($[32] === Symbol.for("react.memo_cache_sentinel")) {
		t15 = {
			backgroundColor: theme.tableBackground,
			borderColor: theme.formInputBorder
		};
		$[32] = t15;
	} else t15 = $[32];
	let t16;
	if ($[33] !== filter || $[34] !== t14) {
		t16 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, {
			style: t13,
			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Search, {
				placeholder: t14,
				value: filter,
				onChange: setFilter,
				width: "100%",
				height: styles.mobileMinHeight,
				style: t15
			})
		});
		$[33] = filter;
		$[34] = t14;
		$[35] = t16;
	} else t16 = $[35];
	let t17;
	if ($[36] === Symbol.for("react.memo_cache_sentinel")) {
		t17 = () => setShowCompleted(true);
		$[36] = t17;
	} else t17 = $[36];
	let t18;
	if ($[37] !== filteredSchedules || $[38] !== handleScheduleDelete || $[39] !== handleSchedulePress || $[40] !== hasCompletedSchedules || $[41] !== isSchedulesLoading || $[42] !== showCompleted || $[43] !== statuses) {
		t18 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SchedulesList, {
			schedules: filteredSchedules,
			isLoading: isSchedulesLoading,
			statuses,
			onSchedulePress: handleSchedulePress,
			onScheduleDelete: handleScheduleDelete,
			hasCompletedSchedules,
			showCompleted,
			onShowCompleted: t17
		});
		$[37] = filteredSchedules;
		$[38] = handleScheduleDelete;
		$[39] = handleSchedulePress;
		$[40] = hasCompletedSchedules;
		$[41] = isSchedulesLoading;
		$[42] = showCompleted;
		$[43] = statuses;
		$[44] = t18;
	} else t18 = $[44];
	let t19;
	if ($[45] !== t16 || $[46] !== t18) {
		t19 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Page, {
			header: t12,
			padding: 0,
			children: [t16, t18]
		});
		$[45] = t16;
		$[46] = t18;
		$[47] = t19;
	} else t19 = $[47];
	return t19;
}
function _temp2(schedule_1) {
	return !schedule_1.completed;
}
function _temp$3(schedule_0) {
	return schedule_0.completed;
}
//#endregion
//#region src/components/mobile/schedules/MobileScheduleEditPage.tsx
function MobileScheduleEditPage() {
	const { t } = useTranslation();
	const navigate = useNavigate();
	const { id } = useParams();
	const { showUndoNotification } = useUndo();
	const adding = !id || id === "new";
	const { state, dispatch, isLoading } = useScheduleEdit({
		scheduleId: id,
		adding,
		initialSchedule: adding ? (() => {
			const date = {
				start: currentDay(),
				frequency: "monthly",
				patterns: [],
				skipWeekend: false,
				weekendSolveMode: "after",
				endMode: "never",
				endOccurrences: 1,
				endDate: currentDay()
			};
			return {
				posts_transaction: false,
				_date: date,
				_conditions: [{
					op: "isapprox",
					field: "date",
					value: date
				}],
				_actions: []
			};
		})() : void 0,
		useGetScheduledAmount: true
	});
	const selectedInst = useSelected("transactions", state.transactions, []);
	async function onSave() {
		dispatch({
			type: "form-error",
			error: null
		});
		if (!state.schedule) return;
		if (state.fields.name) {
			const { data: sameName } = await aqlQuery(q("schedules").filter({ name: state.fields.name }).select("id"));
			if (sameName.length > 0 && sameName[0].id !== state.schedule.id) {
				dispatch({
					type: "form-error",
					error: t("There is already a schedule with this name")
				});
				return;
			}
		}
		const { error, conditions } = updateScheduleConditions(state.schedule, state.fields);
		if (error) {
			dispatch({
				type: "form-error",
				error
			});
			return;
		}
		const res = await sendCatch(adding ? "schedule/create" : "schedule/update", {
			schedule: {
				id: state.schedule.id,
				posts_transaction: state.fields.posts_transaction,
				custom_upcoming_length: state.fields.custom_upcoming_length,
				name: state.fields.name
			},
			conditions
		});
		if (res.error) {
			dispatch({
				type: "form-error",
				error: t("An error occurred while saving. Please visit https://actualbudget.org/contact/ for support.")
			});
			return;
		}
		if (adding) await onLinkTransactions([...selectedInst.items], res.data);
		showUndoNotification({ message: adding ? t("Schedule created successfully") : t("Schedule saved successfully") });
		navigate("/schedules");
	}
	async function onEditRule(ruleId) {
		navigate(`/rules/${ruleId}`);
	}
	async function onLinkTransactions(ids, scheduleId) {
		await send("transactions-batch-update", { updated: ids.map((id_0) => ({
			id: id_0,
			schedule: scheduleId
		})) });
		selectedInst.dispatch({ type: "select-none" });
	}
	async function onUnlinkTransactions(ids_0) {
		await send("transactions-batch-update", { updated: ids_0.map((id_1) => ({
			id: id_1,
			schedule: null
		})) });
		selectedInst.dispatch({ type: "select-none" });
	}
	const { schedule } = state;
	function onSwitchTransactions(mode) {
		dispatch({
			type: "switch-transactions",
			mode
		});
		selectedInst.dispatch({ type: "select-none" });
	}
	const repeats = state.fields.date && typeof state.fields.date !== "string" ? !!state.fields.date.frequency : false;
	const pageTitle = adding ? t("Create Schedule") : t("Edit Schedule");
	if (isLoading) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Page, {
		header: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MobilePageHeader, {
			title: t("Loading..."),
			leftContent: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MobileBackButton, { onPress: () => navigate(-1) })
		}),
		padding: 0,
		children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, {
			style: {
				flex: 1,
				backgroundColor: theme.mobilePageBackground,
				justifyContent: "center",
				alignItems: "center"
			},
			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Trans, { children: "Loading schedule..." }) })
		})
	});
	if (!schedule) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Page, {
		header: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MobilePageHeader, {
			title: t("Schedule not found"),
			leftContent: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MobileBackButton, { onPress: () => navigate("/schedules") })
		}),
		padding: 0,
		children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, {
			style: {
				flex: 1,
				backgroundColor: theme.mobilePageBackground,
				justifyContent: "center",
				alignItems: "center"
			},
			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Trans, { children: "Schedule not found" }) })
		})
	});
	return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Page, {
		header: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MobilePageHeader, {
			title: pageTitle,
			leftContent: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MobileBackButton, { onPress: () => navigate(-1) })
		}),
		footer: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, {
			style: {
				paddingLeft: styles.mobileEditingPadding,
				paddingRight: styles.mobileEditingPadding,
				paddingTop: 10,
				paddingBottom: "calc(10px + env(safe-area-inset-bottom))",
				backgroundColor: theme.tableHeaderBackground,
				borderTopWidth: 1,
				borderColor: theme.tableBorder
			},
			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
				variant: "primary",
				onPress: onSave,
				style: { height: styles.mobileMinHeight },
				children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Trans, { children: "Save" })
			})
		}),
		padding: 0,
		children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ScheduleEditForm, {
			fields: state.fields,
			dispatch,
			upcomingDates: state.upcomingDates,
			repeats,
			schedule,
			adding,
			isCustom: state.isCustom ?? false,
			onEditRule,
			transactions: state.transactions,
			transactionsMode: state.transactionsMode,
			error: state.error,
			selectedInst,
			onSwitchTransactions,
			onLinkTransactions,
			onUnlinkTransactions
		})
	});
}
//#endregion
//#region src/hooks/useCategoryPreviewTransactions.ts
function useCategoryPreviewTransactions({ categoryId, month }) {
	const { data: category } = useCategory(categoryId);
	const { schedules } = useCategoryScheduleGoalTemplates({ category });
	const schedulesToPreview = (0, import_react.useMemo)(() => new Set(schedules.filter((schedule) => getMonth(schedule.next_date) === month).map((schedule) => schedule.id)), [month, schedules]);
	const categoryBalanceValue = useSheetValue(categoryBalance(categoryId, month));
	const { previewTransactions: allPreviewTransactions, runningBalances: allRunningBalances, isLoading, error } = usePreviewTransactions({
		filter: (0, import_react.useCallback)((schedule) => schedulesToPreview.has(schedule.id), [schedulesToPreview]),
		options: { startingBalance: categoryBalanceValue ?? 0 }
	});
	return (0, import_react.useMemo)(() => {
		if (!category || !schedulesToPreview.size) return {
			previewTransactions: [],
			runningBalances: /* @__PURE__ */ new Map(),
			isLoading,
			error
		};
		const previewTransactions = allPreviewTransactions.filter((transaction) => transaction.schedule && schedulesToPreview.has(transaction.schedule));
		const transactionIds = new Set(previewTransactions.map((t) => t.id));
		return {
			previewTransactions,
			runningBalances: new Map([...allRunningBalances].filter(([id]) => transactionIds.has(id))),
			isLoading,
			error
		};
	}, [
		allPreviewTransactions,
		allRunningBalances,
		category,
		error,
		isLoading,
		schedulesToPreview
	]);
}
//#endregion
//#region src/components/mobile/budget/CategoryTransactions.tsx
function CategoryTransactions(t0) {
	const $ = (0, import_compiler_runtime.c)(4);
	const { category, month } = t0;
	let t1;
	if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
		t1 = q("schedules").select("*");
		$[0] = t1;
	} else t1 = $[0];
	const schedulesQuery = t1;
	let t2;
	if ($[1] !== category || $[2] !== month) {
		t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SchedulesProvider, {
			query: schedulesQuery,
			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TransactionListWithPreviews, {
				category,
				month
			})
		});
		$[1] = category;
		$[2] = month;
		$[3] = t2;
	} else t2 = $[3];
	return t2;
}
function TransactionListWithPreviews(t0) {
	const $ = (0, import_compiler_runtime.c)(41);
	const { category, month } = t0;
	const navigate = useNavigate();
	let t1;
	if ($[0] !== category || $[1] !== month) {
		t1 = () => q("transactions").options({ splits: "inline" }).filter(getCategoryMonthFilter(category, month)).select("*");
		$[0] = category;
		$[1] = month;
		$[2] = t1;
	} else t1 = $[2];
	const baseTransactionsQuery = t1;
	let t2;
	if ($[3] !== baseTransactionsQuery) {
		t2 = baseTransactionsQuery();
		$[3] = baseTransactionsQuery;
		$[4] = t2;
	} else t2 = $[4];
	const [transactionsQuery, setTransactionsQuery] = (0, import_react.useState)(t2);
	let t3;
	if ($[5] !== transactionsQuery) {
		t3 = { query: transactionsQuery };
		$[5] = transactionsQuery;
		$[6] = t3;
	} else t3 = $[6];
	const { transactions, isPending: isTransactionsLoading, isFetchingNextPage: isLoadingMoreTransactions, fetchNextPage: fetchMoreTransactions } = useTransactions(t3);
	const dateFormat = useDateFormat() || "MM/dd/yyyy";
	let t4;
	if ($[7] !== baseTransactionsQuery) {
		t4 = () => setTransactionsQuery(baseTransactionsQuery());
		$[7] = baseTransactionsQuery;
		$[8] = t4;
	} else t4 = $[8];
	let t5;
	if ($[9] !== dateFormat || $[10] !== t4) {
		t5 = {
			updateQuery: setTransactionsQuery,
			resetQuery: t4,
			dateFormat
		};
		$[9] = dateFormat;
		$[10] = t4;
		$[11] = t5;
	} else t5 = $[11];
	const { isSearching, search: onSearch } = useTransactionsSearch(t5);
	let t6;
	if ($[12] !== navigate) {
		t6 = (transaction) => {
			if (!isPreviewId(transaction.id)) navigate(`/transactions/${transaction.id}`);
		};
		$[12] = navigate;
		$[13] = t6;
	} else t6 = $[13];
	const onOpenTransaction = t6;
	let t7;
	if ($[14] !== category.id || $[15] !== month) {
		t7 = categoryBalance(category.id, month);
		$[14] = category.id;
		$[15] = month;
		$[16] = t7;
	} else t7 = $[16];
	const balance = t7;
	let t8;
	if ($[17] !== category.id || $[18] !== month) {
		t8 = categoryBalanceCleared(category.id, month);
		$[17] = category.id;
		$[18] = month;
		$[19] = t8;
	} else t8 = $[19];
	const balanceCleared = t8;
	let t9;
	if ($[20] !== category.id || $[21] !== month) {
		t9 = categoryBalanceUncleared(category.id, month);
		$[20] = category.id;
		$[21] = month;
		$[22] = t9;
	} else t9 = $[22];
	const balanceUncleared = t9;
	let t10;
	if ($[23] !== category.id || $[24] !== month) {
		t10 = {
			categoryId: category.id,
			month
		};
		$[23] = category.id;
		$[24] = month;
		$[25] = t10;
	} else t10 = $[25];
	const { previewTransactions, isLoading: isPreviewTransactionsLoading } = useCategoryPreviewTransactions(t10);
	let t11;
	if ($[26] !== isSearching || $[27] !== previewTransactions || $[28] !== transactions) {
		t11 = !isSearching ? previewTransactions.concat(transactions) : transactions;
		$[26] = isSearching;
		$[27] = previewTransactions;
		$[28] = transactions;
		$[29] = t11;
	} else t11 = $[29];
	const transactionsToDisplay = t11;
	const t12 = isSearching ? isTransactionsLoading : isTransactionsLoading || isPreviewTransactionsLoading;
	const t13 = `Search ${category.name}`;
	let t14;
	if ($[30] !== balance || $[31] !== balanceCleared || $[32] !== balanceUncleared || $[33] !== fetchMoreTransactions || $[34] !== isLoadingMoreTransactions || $[35] !== onOpenTransaction || $[36] !== onSearch || $[37] !== t12 || $[38] !== t13 || $[39] !== transactionsToDisplay) {
		t14 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TransactionListWithBalances, {
			isLoading: t12,
			transactions: transactionsToDisplay,
			balance,
			balanceCleared,
			balanceUncleared,
			searchPlaceholder: t13,
			onSearch,
			isLoadingMore: isLoadingMoreTransactions,
			onLoadMore: fetchMoreTransactions,
			onOpenTransaction
		});
		$[30] = balance;
		$[31] = balanceCleared;
		$[32] = balanceUncleared;
		$[33] = fetchMoreTransactions;
		$[34] = isLoadingMoreTransactions;
		$[35] = onOpenTransaction;
		$[36] = onSearch;
		$[37] = t12;
		$[38] = t13;
		$[39] = transactionsToDisplay;
		$[40] = t14;
	} else t14 = $[40];
	return t14;
}
function getCategoryMonthFilter(category, month) {
	return {
		category: category.id,
		date: {
			$transform: "$month",
			$eq: month
		}
	};
}
//#endregion
//#region src/components/mobile/budget/UncategorizedTransactions.tsx
function UncategorizedTransactions() {
	const $ = (0, import_compiler_runtime.c)(16);
	const navigate = useNavigate();
	const baseTransactionsQuery = _temp$2;
	let t0;
	if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
		t0 = baseTransactionsQuery();
		$[0] = t0;
	} else t0 = $[0];
	const [transactionsQuery, setTransactionsQuery] = (0, import_react.useState)(t0);
	let t1;
	if ($[1] !== transactionsQuery) {
		t1 = { query: transactionsQuery };
		$[1] = transactionsQuery;
		$[2] = t1;
	} else t1 = $[2];
	const { transactions, isPending: isTransactionsLoading, isFetchingNextPage: isLoadingMoreTransactions, fetchNextPage: fetchMoreTransactions } = useTransactions(t1);
	const dateFormat = useDateFormat() || "MM/dd/yyyy";
	let t2;
	if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
		t2 = () => setTransactionsQuery(baseTransactionsQuery());
		$[3] = t2;
	} else t2 = $[3];
	let t3;
	if ($[4] !== dateFormat) {
		t3 = {
			updateQuery: setTransactionsQuery,
			resetQuery: t2,
			dateFormat
		};
		$[4] = dateFormat;
		$[5] = t3;
	} else t3 = $[5];
	const { search: onSearch } = useTransactionsSearch(t3);
	let t4;
	if ($[6] !== navigate) {
		t4 = (transaction) => {
			if (!isPreviewId(transaction.id)) navigate(`/transactions/${transaction.id}`);
		};
		$[6] = navigate;
		$[7] = t4;
	} else t4 = $[7];
	const onOpenTransaction = t4;
	let t5;
	if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
		t5 = uncategorizedBalance();
		$[8] = t5;
	} else t5 = $[8];
	const balance = t5;
	let t6;
	if ($[9] !== fetchMoreTransactions || $[10] !== isLoadingMoreTransactions || $[11] !== isTransactionsLoading || $[12] !== onOpenTransaction || $[13] !== onSearch || $[14] !== transactions) {
		t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SchedulesProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TransactionListWithBalances, {
			isLoading: isTransactionsLoading,
			transactions,
			balance,
			searchPlaceholder: "Search uncategorized transactions",
			onSearch,
			isLoadingMore: isLoadingMoreTransactions,
			onLoadMore: fetchMoreTransactions,
			onOpenTransaction,
			showMakeTransfer: true
		}) });
		$[9] = fetchMoreTransactions;
		$[10] = isLoadingMoreTransactions;
		$[11] = isTransactionsLoading;
		$[12] = onOpenTransaction;
		$[13] = onSearch;
		$[14] = transactions;
		$[15] = t6;
	} else t6 = $[15];
	return t6;
}
function _temp$2() {
	return uncategorizedTransactions().options({ splits: "inline" }).select("*");
}
//#endregion
//#region src/components/mobile/budget/CategoryPage.tsx
function CategoryPage() {
	const $ = (0, import_compiler_runtime.c)(17);
	const locale = useLocale();
	const [_numberFormat] = useSyncedPref("numberFormat");
	const numberFormat = _numberFormat || "comma-dot";
	const [hideFraction] = useSyncedPref("hideFraction");
	const { id: categoryIdParam } = useParams();
	const [searchParams] = useSearchParams();
	const month = searchParams.get("month") || currentMonth();
	const { data: category } = useCategory(categoryIdParam);
	const T0 = Page;
	const T1 = MobilePageHeader;
	const t0 = category ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(View, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TextOneLine, { children: category.name }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TextOneLine, { children: [
		"(",
		format(month, "MMMM ''yy", locale),
		")"
	] })] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TextOneLine, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Trans, { children: "Uncategorized" }) });
	let t1;
	if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
		t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MobileBackButton, {});
		$[0] = t1;
	} else t1 = $[0];
	const t2 = category?.id;
	let t3;
	if ($[1] !== t2) {
		t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AddTransactionButton, { categoryId: t2 });
		$[1] = t2;
		$[2] = t3;
	} else t3 = $[2];
	let t4;
	if ($[3] !== T1 || $[4] !== t0 || $[5] !== t3) {
		t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(T1, {
			title: t0,
			leftContent: t1,
			rightContent: t3
		});
		$[3] = T1;
		$[4] = t0;
		$[5] = t3;
		$[6] = t4;
	} else t4 = $[6];
	const t5 = numberFormat + hideFraction;
	let t6;
	if ($[7] !== category || $[8] !== month) {
		t6 = category ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CategoryTransactions, {
			category,
			month
		}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(UncategorizedTransactions, {});
		$[7] = category;
		$[8] = month;
		$[9] = t6;
	} else t6 = $[9];
	let t7;
	if ($[10] !== t5 || $[11] !== t6) {
		t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Fragment, { children: t6 }, t5);
		$[10] = t5;
		$[11] = t6;
		$[12] = t7;
	} else t7 = $[12];
	let t8;
	if ($[13] !== T0 || $[14] !== t4 || $[15] !== t7) {
		t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(T0, {
			header: t4,
			padding: 0,
			children: t7
		});
		$[13] = T0;
		$[14] = t4;
		$[15] = t7;
		$[16] = t8;
	} else t8 = $[16];
	return t8;
}
//#endregion
//#region src/components/mobile/payees/PayeesListItem.tsx
function PayeesListItem(t0) {
	const $ = (0, import_compiler_runtime.c)(42);
	let isRuleCountLoading;
	let onDelete;
	let onViewRules;
	let payee;
	let props;
	let ruleCount;
	if ($[0] !== t0) {
		({value: payee, ruleCount, isRuleCountLoading, onDelete, onViewRules, ...props} = t0);
		$[0] = t0;
		$[1] = isRuleCountLoading;
		$[2] = onDelete;
		$[3] = onViewRules;
		$[4] = payee;
		$[5] = props;
		$[6] = ruleCount;
	} else {
		isRuleCountLoading = $[1];
		onDelete = $[2];
		onViewRules = $[3];
		payee = $[4];
		props = $[5];
		ruleCount = $[6];
	}
	const { t } = useTranslation();
	let t1;
	if ($[7] !== payee.name || $[8] !== payee.transfer_acct || $[9] !== t) {
		t1 = payee.transfer_acct ? t("Transfer: {{name}}", { name: payee.name }) : payee.name;
		$[7] = payee.name;
		$[8] = payee.transfer_acct;
		$[9] = t;
		$[10] = t1;
	} else t1 = $[10];
	const label = t1;
	let t2;
	if ($[11] !== onDelete || $[12] !== onViewRules || $[13] !== payee.transfer_acct || $[14] !== ruleCount) {
		t2 = !payee.transfer_acct && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(View, {
			style: {
				flexDirection: "row",
				flex: 1
			},
			children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
				variant: "bare",
				onPress: onViewRules,
				style: {
					color: theme.pillText,
					backgroundColor: theme.pillBackground,
					flex: 1,
					borderRadius: 0
				},
				children: ruleCount > 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Trans, { children: "View rules" }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Trans, { children: "Create rule" })
			}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
				variant: "bare",
				onPress: onDelete,
				style: {
					color: theme.errorText,
					flex: 1,
					borderRadius: 0
				},
				children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Trans, { children: "Delete" })
			})]
		});
		$[11] = onDelete;
		$[12] = onViewRules;
		$[13] = payee.transfer_acct;
		$[14] = ruleCount;
		$[15] = t2;
	} else t2 = $[15];
	let t3;
	if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
		t3 = { flex: 1 };
		$[16] = t3;
	} else t3 = $[16];
	let t4;
	if ($[17] !== payee.favorite) {
		t4 = payee.favorite && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SvgBookmark, {
			"aria-hidden": true,
			focusable: false,
			width: 15,
			height: 15,
			style: {
				color: theme.pageText,
				flexShrink: 0
			}
		});
		$[17] = payee.favorite;
		$[18] = t4;
	} else t4 = $[18];
	let t5;
	if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
		t5 = {
			justifyContent: "space-between",
			flex: 1,
			alignItems: "flex-start"
		};
		$[19] = t5;
	} else t5 = $[19];
	const t6 = payee.transfer_acct ? theme.pageTextSubdued : theme.pageText;
	let t7;
	if ($[20] !== t6) {
		t7 = {
			fontSize: 15,
			fontWeight: 500,
			color: t6,
			overflow: "hidden",
			textOverflow: "ellipsis",
			whiteSpace: "nowrap",
			flex: 1,
			textAlign: "left"
		};
		$[20] = t6;
		$[21] = t7;
	} else t7 = $[21];
	let t8;
	if ($[22] !== label || $[23] !== t7) {
		t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
			style: t7,
			title: label,
			children: label
		});
		$[22] = label;
		$[23] = t7;
		$[24] = t8;
	} else t8 = $[24];
	let t9;
	if ($[25] === Symbol.for("react.memo_cache_sentinel")) {
		t9 = {
			borderRadius: 4,
			padding: "3px 6px",
			backgroundColor: theme.noticeBackground,
			border: "1px solid " + theme.noticeBackground,
			color: theme.noticeTextDark,
			fontSize: 12,
			flexShrink: 0
		};
		$[25] = t9;
	} else t9 = $[25];
	let t10;
	if ($[26] === Symbol.for("react.memo_cache_sentinel")) {
		t10 = { fontSize: 12 };
		$[26] = t10;
	} else t10 = $[26];
	let t11;
	if ($[27] !== isRuleCountLoading || $[28] !== ruleCount) {
		t11 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
			style: t9,
			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PayeeRuleCountLabel, {
				count: ruleCount,
				isLoading: isRuleCountLoading,
				style: t10
			})
		});
		$[27] = isRuleCountLoading;
		$[28] = ruleCount;
		$[29] = t11;
	} else t11 = $[29];
	let t12;
	if ($[30] !== t11 || $[31] !== t8) {
		t12 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SpaceBetween, {
			style: t5,
			children: [t8, t11]
		});
		$[30] = t11;
		$[31] = t8;
		$[32] = t12;
	} else t12 = $[32];
	let t13;
	if ($[33] !== t12 || $[34] !== t4) {
		t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SpaceBetween, {
			gap: 5,
			style: t3,
			children: [t4, t12]
		});
		$[33] = t12;
		$[34] = t4;
		$[35] = t13;
	} else t13 = $[35];
	let t14;
	if ($[36] !== label || $[37] !== payee || $[38] !== props || $[39] !== t13 || $[40] !== t2) {
		t14 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ActionableGridListItem, {
			id: payee.id,
			value: payee,
			textValue: label,
			actionsWidth: 200,
			actions: t2,
			...props,
			children: t13
		});
		$[36] = label;
		$[37] = payee;
		$[38] = props;
		$[39] = t13;
		$[40] = t2;
		$[41] = t14;
	} else t14 = $[41];
	return t14;
}
//#endregion
//#region src/components/mobile/payees/PayeesList.tsx
function PayeesList(t0) {
	const $ = (0, import_compiler_runtime.c)(28);
	const { payees, ruleCounts, isRuleCountsLoading: t1, isLoading: t2, onPayeePress, onPayeeDelete, onPayeeRuleAction } = t0;
	const isRuleCountsLoading = t1 === void 0 ? false : t1;
	const isLoading = t2 === void 0 ? false : t2;
	const { t } = useTranslation();
	if (isLoading && payees.length === 0) {
		let t3;
		if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
			t3 = {
				flex: 1,
				alignItems: "center",
				justifyContent: "center",
				paddingTop: 100
			};
			$[0] = t3;
		} else t3 = $[0];
		let t4;
		if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
			t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, {
				style: t3,
				children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AnimatedLoading, { style: {
					width: 25,
					height: 25
				} })
			});
			$[1] = t4;
		} else t4 = $[1];
		return t4;
	}
	if (payees.length === 0) {
		let t3;
		if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
			t3 = {
				flex: 1,
				alignItems: "center",
				justifyContent: "center",
				paddingHorizontal: 20
			};
			$[2] = t3;
		} else t3 = $[2];
		let t4;
		if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
			t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, {
				style: t3,
				children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
					style: {
						fontSize: 16,
						color: theme.pageTextSubdued,
						textAlign: "center"
					},
					children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Trans, { children: "No payees found." })
				})
			});
			$[3] = t4;
		} else t4 = $[3];
		return t4;
	}
	let t3;
	if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
		t3 = { flex: 1 };
		$[4] = t3;
	} else t3 = $[4];
	let t4;
	if ($[5] !== t) {
		t4 = t("Payees");
		$[5] = t;
		$[6] = t4;
	} else t4 = $[6];
	const t5 = isLoading || void 0;
	let t6;
	if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
		t6 = {
			flex: 1,
			paddingBottom: MOBILE_NAV_HEIGHT,
			overflow: "auto"
		};
		$[7] = t6;
	} else t6 = $[7];
	let t7;
	if ($[8] !== isRuleCountsLoading || $[9] !== ruleCounts) {
		t7 = [ruleCounts, isRuleCountsLoading];
		$[8] = isRuleCountsLoading;
		$[9] = ruleCounts;
		$[10] = t7;
	} else t7 = $[10];
	let t8;
	if ($[11] !== isRuleCountsLoading || $[12] !== onPayeeDelete || $[13] !== onPayeePress || $[14] !== onPayeeRuleAction || $[15] !== ruleCounts) {
		t8 = (payee) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PayeesListItem, {
			value: payee,
			ruleCount: ruleCounts.get(payee.id) ?? 0,
			isRuleCountLoading: isRuleCountsLoading,
			onAction: () => onPayeePress(payee),
			onDelete: () => onPayeeDelete(payee),
			onViewRules: () => onPayeeRuleAction(payee)
		});
		$[11] = isRuleCountsLoading;
		$[12] = onPayeeDelete;
		$[13] = onPayeePress;
		$[14] = onPayeeRuleAction;
		$[15] = ruleCounts;
		$[16] = t8;
	} else t8 = $[16];
	let t9;
	if ($[17] !== payees || $[18] !== t4 || $[19] !== t5 || $[20] !== t7 || $[21] !== t8) {
		t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)($ce3a951440fc273f$export$89be5a243e59c4b2, {
			layout: $61ef60fc9b1041f4$export$cacbb3924155d68e,
			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)($72e60046c03fbe42$export$a7bfbda1311ca015, {
				"aria-label": t4,
				"aria-busy": t5,
				items: payees,
				style: t6,
				dependencies: t7,
				children: t8
			})
		});
		$[17] = payees;
		$[18] = t4;
		$[19] = t5;
		$[20] = t7;
		$[21] = t8;
		$[22] = t9;
	} else t9 = $[22];
	let t10;
	if ($[23] !== isLoading) {
		t10 = isLoading && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, {
			style: {
				alignItems: "center",
				paddingTop: 20
			},
			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AnimatedLoading, { style: {
				width: 20,
				height: 20
			} })
		});
		$[23] = isLoading;
		$[24] = t10;
	} else t10 = $[24];
	let t11;
	if ($[25] !== t10 || $[26] !== t9) {
		t11 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(View, {
			style: t3,
			children: [t9, t10]
		});
		$[25] = t10;
		$[26] = t9;
		$[27] = t11;
	} else t11 = $[27];
	return t11;
}
//#endregion
//#region src/components/mobile/payees/MobilePayeesPage.tsx
function MobilePayeesPage() {
	const { t } = useTranslation();
	const dispatch = useDispatch();
	const navigate = useNavigate();
	const { data: payees = [], isPending } = usePayees();
	const { showUndoNotification } = useUndo();
	const [filter, setFilter] = (0, import_react.useState)("");
	const { data: ruleCounts = /* @__PURE__ */ new Map(), isPending: isRuleCountsLoading } = usePayeeRuleCounts();
	const filteredPayees = (0, import_react.useMemo)(() => {
		if (!filter) return payees;
		const norm = getNormalisedString(filter);
		return payees.filter((p) => getNormalisedString(p.name).includes(norm));
	}, [payees, filter]);
	const onSearchChange = (0, import_react.useCallback)((value) => {
		setFilter(value);
	}, []);
	const handlePayeePress = (0, import_react.useCallback)((payee) => {
		navigate(`/payees/${payee.id}`);
	}, [navigate]);
	const handlePayeeRuleAction = (0, import_react.useCallback)(async (payee_0) => {
		if ((ruleCounts.get(payee_0.id) ?? 0) > 0) try {
			navigate(`/rules?visible-rules=${(await send("payees-get-rules", { id: payee_0.id })).map((rule) => rule.id).join(",")}`);
			return;
		} catch (error) {
			console.error("Failed to fetch payee rules:", error);
			navigate("/rules");
			return;
		}
		navigate("/rules/new", { state: { rule: { conditions: [{
			field: "payee",
			op: "is",
			value: payee_0.id,
			type: "id"
		}] } } });
	}, [navigate, ruleCounts]);
	const handlePayeeDelete = (0, import_react.useCallback)(async (payee_1) => {
		try {
			await send("payees-batch-change", { deleted: [{ id: payee_1.id }] });
			showUndoNotification({ message: t("Payee \"{{name}}\" deleted successfully", { name: payee_1.name }) });
		} catch (error_0) {
			console.error("Failed to delete payee:", error_0);
			dispatch(addNotification({ notification: {
				type: "error",
				message: t("Failed to delete payee. Please try again.")
			} }));
		}
	}, [
		dispatch,
		showUndoNotification,
		t
	]);
	return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Page, {
		header: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MobilePageHeader, { title: t("Payees") }),
		padding: 0,
		children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, {
			style: {
				flexDirection: "row",
				alignItems: "center",
				backgroundColor: theme.mobilePageBackground,
				padding: 10,
				width: "100%",
				borderBottomWidth: 2,
				borderBottomStyle: "solid",
				borderBottomColor: theme.tableBorder
			},
			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Search, {
				placeholder: t("Filter payees…"),
				value: filter,
				onChange: onSearchChange,
				width: "100%",
				height: styles.mobileMinHeight,
				style: {
					backgroundColor: theme.tableBackground,
					borderColor: theme.formInputBorder
				}
			})
		}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PayeesList, {
			payees: filteredPayees,
			ruleCounts,
			isRuleCountsLoading,
			isLoading: isPending,
			onPayeePress: handlePayeePress,
			onPayeeDelete: handlePayeeDelete,
			onPayeeRuleAction: handlePayeeRuleAction
		})]
	});
}
//#endregion
//#region src/components/mobile/payees/MobilePayeeEditPage.tsx
function MobilePayeeEditPage() {
	const $ = (0, import_compiler_runtime.c)(52);
	const { t } = useTranslation();
	const navigate = useNavigate();
	const { id } = useParams();
	const dispatch = useDispatch();
	const { showUndoNotification } = useUndo();
	const { data: t0 } = usePayees();
	let t1;
	if ($[0] !== t0) {
		t1 = t0 === void 0 ? [] : t0;
		$[0] = t0;
		$[1] = t1;
	} else t1 = $[1];
	const payees = t1;
	const [payee, setPayee] = (0, import_react.useState)(null);
	const [editedPayeeName, setEditedPayeeName] = (0, import_react.useState)("");
	const [isLoading, setIsLoading] = (0, import_react.useState)(true);
	let t2;
	let t3;
	if ($[2] !== id || $[3] !== navigate || $[4] !== payees) {
		t2 = () => {
			if (id) {
				setIsLoading(true);
				const foundPayee = payees.find((p) => p.id === id);
				if (foundPayee) {
					setPayee(foundPayee);
					setEditedPayeeName(foundPayee.name);
					setIsLoading(false);
				} else navigate("/payees");
			}
		};
		t3 = [
			id,
			payees,
			navigate
		];
		$[2] = id;
		$[3] = navigate;
		$[4] = payees;
		$[5] = t2;
		$[6] = t3;
	} else {
		t2 = $[5];
		t3 = $[6];
	}
	(0, import_react.useEffect)(t2, t3);
	let t4;
	if ($[7] !== navigate) {
		t4 = () => {
			navigate(-1);
		};
		$[7] = navigate;
		$[8] = t4;
	} else t4 = $[8];
	const handleCancel = t4;
	let t5;
	if ($[9] !== dispatch || $[10] !== editedPayeeName || $[11] !== navigate || $[12] !== payee || $[13] !== showUndoNotification || $[14] !== t) {
		t5 = async () => {
			if (!payee || !editedPayeeName.trim()) return;
			try {
				await send("payees-batch-change", { updated: [{
					id: payee.id,
					name: editedPayeeName.trim()
				}] });
				showUndoNotification({ message: t("Payee {{oldName}} renamed to {{newName}}", {
					oldName: payee.name,
					newName: editedPayeeName.trim()
				}) });
				navigate("/payees");
			} catch (t6) {
				console.error("Failed to update payee:", t6);
				dispatch(addNotification({ notification: {
					type: "error",
					message: t("Failed to update payee. Please try again.")
				} }));
			}
		};
		$[9] = dispatch;
		$[10] = editedPayeeName;
		$[11] = navigate;
		$[12] = payee;
		$[13] = showUndoNotification;
		$[14] = t;
		$[15] = t5;
	} else t5 = $[15];
	const handleSave = t5;
	if (isLoading) {
		let t6;
		if ($[16] !== t) {
			t6 = t("Loading...");
			$[16] = t;
			$[17] = t6;
		} else t6 = $[17];
		let t7;
		if ($[18] !== handleCancel) {
			t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MobileBackButton, { onPress: handleCancel });
			$[18] = handleCancel;
			$[19] = t7;
		} else t7 = $[19];
		let t8;
		if ($[20] !== t6 || $[21] !== t7) {
			t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MobilePageHeader, {
				title: t6,
				leftContent: t7
			});
			$[20] = t6;
			$[21] = t7;
			$[22] = t8;
		} else t8 = $[22];
		let t9;
		if ($[23] === Symbol.for("react.memo_cache_sentinel")) {
			t9 = {
				flex: 1,
				backgroundColor: theme.mobilePageBackground,
				justifyContent: "center",
				alignItems: "center"
			};
			$[23] = t9;
		} else t9 = $[23];
		let t10;
		if ($[24] === Symbol.for("react.memo_cache_sentinel")) {
			t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, {
				style: t9,
				children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Trans, { children: "Loading payee..." }) })
			});
			$[24] = t10;
		} else t10 = $[24];
		let t11;
		if ($[25] !== t8) {
			t11 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Page, {
				header: t8,
				padding: 0,
				children: t10
			});
			$[25] = t8;
			$[26] = t11;
		} else t11 = $[26];
		return t11;
	}
	let t6;
	if ($[27] !== t) {
		t6 = t("Edit Payee");
		$[27] = t;
		$[28] = t6;
	} else t6 = $[28];
	let t7;
	if ($[29] !== handleCancel) {
		t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MobileBackButton, { onPress: handleCancel });
		$[29] = handleCancel;
		$[30] = t7;
	} else t7 = $[30];
	let t8;
	if ($[31] !== t6 || $[32] !== t7) {
		t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MobilePageHeader, {
			title: t6,
			leftContent: t7
		});
		$[31] = t6;
		$[32] = t7;
		$[33] = t8;
	} else t8 = $[33];
	let t9;
	if ($[34] === Symbol.for("react.memo_cache_sentinel")) {
		t9 = {
			paddingLeft: styles.mobileEditingPadding,
			paddingRight: styles.mobileEditingPadding,
			paddingTop: 10,
			paddingBottom: "calc(10px + env(safe-area-inset-bottom))",
			backgroundColor: theme.tableHeaderBackground,
			borderTopWidth: 1,
			borderColor: theme.tableBorder
		};
		$[34] = t9;
	} else t9 = $[34];
	let t10;
	if ($[35] !== editedPayeeName) {
		t10 = editedPayeeName.trim();
		$[35] = editedPayeeName;
		$[36] = t10;
	} else t10 = $[36];
	const t11 = !t10;
	let t12;
	let t13;
	if ($[37] === Symbol.for("react.memo_cache_sentinel")) {
		t12 = { height: styles.mobileMinHeight };
		t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Trans, { children: "Save" });
		$[37] = t12;
		$[38] = t13;
	} else {
		t12 = $[37];
		t13 = $[38];
	}
	let t14;
	if ($[39] !== handleSave || $[40] !== t11) {
		t14 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, {
			style: t9,
			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
				variant: "primary",
				onPress: handleSave,
				isDisabled: t11,
				style: t12,
				children: t13
			})
		});
		$[39] = handleSave;
		$[40] = t11;
		$[41] = t14;
	} else t14 = $[41];
	let t15;
	if ($[42] === Symbol.for("react.memo_cache_sentinel")) {
		t15 = { paddingTop: 20 };
		$[42] = t15;
	} else t15 = $[42];
	let t16;
	if ($[43] !== t) {
		t16 = t("Payee name");
		$[43] = t;
		$[44] = t16;
	} else t16 = $[44];
	let t17;
	if ($[45] !== editedPayeeName || $[46] !== t16) {
		t17 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, {
			style: t15,
			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(InputField, {
				placeholder: t16,
				value: editedPayeeName,
				onChangeValue: setEditedPayeeName
			})
		});
		$[45] = editedPayeeName;
		$[46] = t16;
		$[47] = t17;
	} else t17 = $[47];
	let t18;
	if ($[48] !== t14 || $[49] !== t17 || $[50] !== t8) {
		t18 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Page, {
			header: t8,
			footer: t14,
			children: t17
		});
		$[48] = t14;
		$[49] = t17;
		$[50] = t8;
		$[51] = t18;
	} else t18 = $[51];
	return t18;
}
//#endregion
//#region src/components/mobile/banksync/BankSyncAccountsListItem.tsx
function BankSyncAccountsListItem(t0) {
	const $ = (0, import_compiler_runtime.c)(32);
	const { account, onAction, isLinked } = t0;
	const locale = useLocale();
	let t1;
	if ($[0] !== account.last_sync || $[1] !== isLinked || $[2] !== locale) {
		t1 = isLinked ? tsToRelativeTime(account.last_sync, locale, { capitalize: true }) : null;
		$[0] = account.last_sync;
		$[1] = isLinked;
		$[2] = locale;
		$[3] = t1;
	} else t1 = $[3];
	const lastSyncString = t1;
	let t2;
	if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
		t2 = {
			backgroundColor: theme.tableBackground,
			borderBottomWidth: 1,
			borderBottomColor: theme.tableBorder,
			borderBottomStyle: "solid",
			padding: 16,
			width: "100%",
			cursor: "pointer"
		};
		$[4] = t2;
	} else t2 = $[4];
	let t3;
	if ($[5] !== account || $[6] !== isLinked || $[7] !== onAction) {
		t3 = () => onAction(account, isLinked ? "edit" : "link");
		$[5] = account;
		$[6] = isLinked;
		$[7] = onAction;
		$[8] = t3;
	} else t3 = $[8];
	let t4;
	if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
		t4 = {
			flex: 1,
			alignItems: "flex-start"
		};
		$[9] = t4;
	} else t4 = $[9];
	let t5;
	if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
		t5 = {
			fontSize: 15,
			fontWeight: 500,
			color: theme.tableText
		};
		$[10] = t5;
	} else t5 = $[10];
	let t6;
	if ($[11] !== account.name) {
		t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
			style: t5,
			children: account.name
		});
		$[11] = account.name;
		$[12] = t6;
	} else t6 = $[12];
	let t7;
	if ($[13] !== account.bankName || $[14] !== isLinked) {
		t7 = isLinked && account.bankName && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
			style: {
				fontSize: 13,
				color: theme.pageTextSubdued
			},
			children: account.bankName
		});
		$[13] = account.bankName;
		$[14] = isLinked;
		$[15] = t7;
	} else t7 = $[15];
	let t8;
	if ($[16] !== isLinked || $[17] !== lastSyncString) {
		t8 = isLinked && lastSyncString && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
			style: {
				fontSize: 13,
				color: theme.pageTextSubdued
			},
			"data-vrt-mask": true,
			children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Trans, { children: ["Last sync: ", { time: lastSyncString }] })
		});
		$[16] = isLinked;
		$[17] = lastSyncString;
		$[18] = t8;
	} else t8 = $[18];
	let t9;
	if ($[19] !== t6 || $[20] !== t7 || $[21] !== t8) {
		t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SpaceBetween, {
			direction: "vertical",
			gap: 5,
			style: t4,
			children: [
				t6,
				t7,
				t8
			]
		});
		$[19] = t6;
		$[20] = t7;
		$[21] = t8;
		$[22] = t9;
	} else t9 = $[22];
	let t10;
	if ($[23] === Symbol.for("react.memo_cache_sentinel")) {
		t10 = {
			borderRadius: 4,
			padding: "5px 10px",
			backgroundColor: theme.noticeBackground,
			border: "1px solid " + theme.noticeBackground,
			color: theme.noticeTextDark,
			fontSize: 13,
			fontWeight: 500,
			flexShrink: 0
		};
		$[23] = t10;
	} else t10 = $[23];
	let t11;
	if ($[24] !== isLinked) {
		t11 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
			style: t10,
			children: isLinked ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Trans, { children: "Edit" }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Trans, { children: "Link account" })
		});
		$[24] = isLinked;
		$[25] = t11;
	} else t11 = $[25];
	let t12;
	if ($[26] !== t11 || $[27] !== t9) {
		t12 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SpaceBetween, {
			gap: 60,
			children: [t9, t11]
		});
		$[26] = t11;
		$[27] = t9;
		$[28] = t12;
	} else t12 = $[28];
	let t13;
	if ($[29] !== t12 || $[30] !== t3) {
		t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, {
			"data-testid": "bank-sync-account",
			style: t2,
			onClick: t3,
			children: t12
		});
		$[29] = t12;
		$[30] = t3;
		$[31] = t13;
	} else t13 = $[31];
	return t13;
}
//#endregion
//#region src/components/mobile/banksync/BankSyncAccountsList.tsx
function BankSyncAccountsList(t0) {
	const $ = (0, import_compiler_runtime.c)(12);
	const { groupedAccounts, syncSourceReadable, onAction } = t0;
	let t1;
	let t2;
	if ($[0] !== groupedAccounts || $[1] !== onAction || $[2] !== syncSourceReadable) {
		t2 = Symbol.for("react.early_return_sentinel");
		bb0: {
			const groupedAccountEntries = getGroupedBankSyncEntries(groupedAccounts);
			if (groupedAccountEntries.flatMap(_temp$1).length === 0) {
				let t3;
				if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
					t3 = {
						flex: 1,
						alignItems: "center",
						justifyContent: "center",
						paddingHorizontal: 20
					};
					$[5] = t3;
				} else t3 = $[5];
				let t4;
				if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
					t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, {
						style: t3,
						children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
							style: {
								fontSize: 16,
								color: theme.pageTextSubdued,
								textAlign: "center"
							},
							children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Trans, { children: "No accounts found matching your search." })
						})
					});
					$[6] = t4;
				} else t4 = $[6];
				t2 = t4;
				break bb0;
			}
			const shouldShowProviderHeaders = groupedAccountEntries.length > 1;
			let t3;
			if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
				t3 = {
					flex: 1,
					overflow: "auto",
					paddingBottom: MOBILE_NAV_HEIGHT
				};
				$[7] = t3;
			} else t3 = $[7];
			let t4;
			if ($[8] !== onAction || $[9] !== shouldShowProviderHeaders || $[10] !== syncSourceReadable) {
				t4 = (t5) => {
					const [provider, accounts_0] = t5;
					return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [shouldShowProviderHeaders && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
						style: {
							backgroundColor: theme.mobilePageBackground,
							padding: "12px 16px",
							borderBottom: `1px solid ${theme.tableBorder}`,
							display: "flex",
							alignItems: "center",
							justifyContent: "center",
							minHeight: 40
						},
						children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
							style: {
								fontSize: 14,
								fontWeight: 600,
								color: theme.pageTextLight,
								textTransform: "uppercase",
								letterSpacing: .5
							},
							children: syncSourceReadable[provider]
						})
					}), accounts_0.map((account) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BankSyncAccountsListItem, {
						account,
						onAction,
						isLinked: !!account.account_sync_source
					}, account.id))] }, provider);
				};
				$[8] = onAction;
				$[9] = shouldShowProviderHeaders;
				$[10] = syncSourceReadable;
				$[11] = t4;
			} else t4 = $[11];
			t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
				style: t3,
				children: groupedAccountEntries.map(t4)
			});
		}
		$[0] = groupedAccounts;
		$[1] = onAction;
		$[2] = syncSourceReadable;
		$[3] = t1;
		$[4] = t2;
	} else {
		t1 = $[3];
		t2 = $[4];
	}
	if (t2 !== Symbol.for("react.early_return_sentinel")) return t2;
	return t1;
}
function _temp$1(t0) {
	const [, accounts] = t0;
	return accounts;
}
//#endregion
//#region src/components/mobile/banksync/MobileBankSyncPage.tsx
function MobileBankSyncPage() {
	const $ = (0, import_compiler_runtime.c)(35);
	const { t } = useTranslation();
	const navigate = useNavigate();
	const dispatch = useDispatch();
	const { data: t0 } = useAccounts();
	let t1;
	if ($[0] !== t0) {
		t1 = t0 === void 0 ? [] : t0;
		$[0] = t0;
		$[1] = t1;
	} else t1 = $[1];
	const accounts = t1;
	const [filter, setFilter] = (0, import_react.useState)("");
	let t2;
	if ($[2] !== t) {
		t2 = getSyncSourceReadable(t);
		$[2] = t;
		$[3] = t2;
	} else t2 = $[3];
	const syncSourceReadable = t2;
	let t3;
	if ($[4] !== accounts) {
		t3 = accounts.filter(_temp);
		$[4] = accounts;
		$[5] = t3;
	} else t3 = $[5];
	const openAccounts = t3;
	let t4;
	if ($[6] !== openAccounts) {
		t4 = groupBankSyncAccounts(openAccounts);
		$[6] = openAccounts;
		$[7] = t4;
	} else t4 = $[7];
	const groupedAccounts = t4;
	let t5;
	bb0: {
		if (!filter) {
			t5 = groupedAccounts;
			break bb0;
		}
		let filtered;
		if ($[8] !== filter || $[9] !== groupedAccounts) {
			const filterLower = filter.toLowerCase();
			filtered = {};
			getGroupedBankSyncEntries(groupedAccounts).forEach((t6) => {
				const [provider, accounts_0] = t6;
				const filteredAccounts = accounts_0.filter((account) => account.name.toLowerCase().includes(filterLower) || account.bankName?.toLowerCase().includes(filterLower));
				if (filteredAccounts.length > 0) filtered[provider] = filteredAccounts;
			});
			$[8] = filter;
			$[9] = groupedAccounts;
			$[10] = filtered;
		} else filtered = $[10];
		t5 = filtered;
	}
	const filteredGroupedAccounts = t5;
	let t6;
	if ($[11] !== dispatch || $[12] !== navigate) {
		t6 = (account_0, action) => {
			bb41: switch (action) {
				case "edit":
					navigate(`/bank-sync/account/${account_0.id}/edit`);
					break bb41;
				case "link":
					dispatch(pushModal({ modal: {
						name: "add-account",
						options: { upgradingAccountId: account_0.id }
					} }));
					break bb41;
				default:
			}
		};
		$[11] = dispatch;
		$[12] = navigate;
		$[13] = t6;
	} else t6 = $[13];
	const onAction = t6;
	let t7;
	if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
		t7 = (value) => {
			setFilter(value);
		};
		$[14] = t7;
	} else t7 = $[14];
	const onSearchChange = t7;
	let t8;
	if ($[15] !== t) {
		t8 = t("Bank Sync");
		$[15] = t;
		$[16] = t8;
	} else t8 = $[16];
	let t9;
	if ($[17] !== t8) {
		t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MobilePageHeader, { title: t8 });
		$[17] = t8;
		$[18] = t9;
	} else t9 = $[18];
	let t10;
	if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
		t10 = {
			flexDirection: "row",
			alignItems: "center",
			backgroundColor: theme.mobilePageBackground,
			padding: 10,
			width: "100%",
			borderBottomWidth: 2,
			borderBottomStyle: "solid",
			borderBottomColor: theme.tableBorder
		};
		$[19] = t10;
	} else t10 = $[19];
	let t11;
	if ($[20] !== t) {
		t11 = t("Filter accounts…");
		$[20] = t;
		$[21] = t11;
	} else t11 = $[21];
	let t12;
	if ($[22] === Symbol.for("react.memo_cache_sentinel")) {
		t12 = {
			backgroundColor: theme.tableBackground,
			borderColor: theme.formInputBorder
		};
		$[22] = t12;
	} else t12 = $[22];
	let t13;
	if ($[23] !== filter || $[24] !== t11) {
		t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, {
			style: t10,
			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Search, {
				placeholder: t11,
				value: filter,
				onChange: onSearchChange,
				width: "100%",
				height: styles.mobileMinHeight,
				style: t12
			})
		});
		$[23] = filter;
		$[24] = t11;
		$[25] = t13;
	} else t13 = $[25];
	let t14;
	if ($[26] !== filteredGroupedAccounts || $[27] !== onAction || $[28] !== openAccounts.length || $[29] !== syncSourceReadable) {
		t14 = openAccounts.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(View, {
			style: {
				flex: 1,
				alignItems: "center",
				justifyContent: "center",
				paddingHorizontal: 20,
				paddingTop: 40
			},
			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
				style: {
					fontSize: 16,
					color: theme.pageTextSubdued,
					textAlign: "center"
				},
				children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Trans, { children: "To use the bank syncing features, you must first add an account." })
			})
		}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BankSyncAccountsList, {
			groupedAccounts: filteredGroupedAccounts,
			syncSourceReadable,
			onAction
		});
		$[26] = filteredGroupedAccounts;
		$[27] = onAction;
		$[28] = openAccounts.length;
		$[29] = syncSourceReadable;
		$[30] = t14;
	} else t14 = $[30];
	let t15;
	if ($[31] !== t13 || $[32] !== t14 || $[33] !== t9) {
		t15 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Page, {
			header: t9,
			padding: 0,
			children: [t13, t14]
		});
		$[31] = t13;
		$[32] = t14;
		$[33] = t9;
		$[34] = t15;
	} else t15 = $[34];
	return t15;
}
function _temp(a) {
	return !a.closed;
}
//#endregion
export { AccountPage as Account, AccountsPage as Accounts, MobileBankSyncPage as BankSync, MobileBankSyncAccountEditPage as BankSyncAccountEdit, BudgetPage as Budget, CategoryPage as Category, MobilePayeeEditPage as PayeeEdit, MobilePayeesPage as Payees, MobileRuleEditPage as RuleEdit, MobileRulesPage as Rules, MobileScheduleEditPage as ScheduleEdit, MobileSchedulesPage as Schedules };

//# sourceMappingURL=narrow.CjKQQxBs.chunk.js.map