<template>
	<NuxtLoadingIndicator color="#dc2626" />
	<NuxtLayout>
		<NuxtPage />
	</NuxtLayout>
</template>

<script setup lang="ts">
// Initialize cart on app mount (client-side only)
// Skip on checkout pages that have their own order loading logic
const route = useRoute();
const { initialize: initCart } = useCart();

// Pages that manage their own order state and shouldn't have cart auto-init
const skipCartInitPaths = ["/checkout/3", "/checkout/result"];

onMounted(() => {
	const shouldSkip = skipCartInitPaths.some((path) => route.path.startsWith(path));
	if (!shouldSkip) {
		initCart();
	}
});
</script>
