import { writable } from "svelte/store"

const initLoc = {
    path: (typeof window !== "undefined" && window.location?.pathname) || "/",
    search: (typeof window !== "undefined" && window.location?.search) || "",
    hash: (typeof window !== "undefined" && window.location?.hash) || "",
    push: false,
    pop: false,
    categoryPath: "",
}
export const location = writable(initLoc)
export let content = writable<{ [id: string]: Content }>({})
export let pages = writable<{ [path: string]: Content }>({})
export let modules = writable<{ [id: string]: Module }>({})
export let mediaLibrary = writable<{ [id: string]: MediaLibrary }>({})
export let navigation = writable<NavElement[]>([])
export let serviceNavigation = writable<NavElement[]>([])
export let rerender = writable(false)
