import { PathId } from "../../routes.js";
import { useActiveEntities } from "../../store/active-entities.js";
import ViewLayout_default from "../../components/ViewLayout/ViewLayout.vue.js";
import ViewLayoutSection_default from "../../components/ViewLayout/ViewLayoutSection.vue.js";
import CollectionNavigation_default from "./CollectionNavigation.vue.js";
import { computed, createBlock, createElementVNode, createVNode, defineComponent, openBlock, ref, unref, watch, withCtx } from "vue";
import { RouterView, useRouter } from "vue-router";
import { useScroll } from "@vueuse/core";
//#region src/views/Collection/Collection.vue?vue&type=script&setup=true&lang.ts
var _hoisted_1 = { class: "w-full md:mx-auto md:max-w-[720px]" };
var Collection_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
	__name: "Collection",
	setup(__props) {
		const { activeCollection } = useActiveEntities();
		const router = useRouter();
		const el = ref(null);
		const { y } = useScroll(el);
		const isSticky = computed(() => y.value > 104);
		watch(activeCollection, (collection) => {
			if (collection?.info?.title === "Drafts") {
				const firstRequest = collection.requests[0];
				router.push({
					name: "request",
					params: { [PathId.Request]: firstRequest }
				});
			}
		}, { immediate: true });
		return (_ctx, _cache) => {
			return openBlock(), createBlock(ViewLayout_default, {
				ref_key: "el",
				ref: el,
				class: "h-fit overflow-auto pb-6 xl:overflow-auto"
			}, {
				default: withCtx(() => [createVNode(ViewLayoutSection_default, { class: "xl:h-fit" }, {
					default: withCtx(() => [createVNode(CollectionNavigation_default, { isSticky: isSticky.value }, null, 8, ["isSticky"]), createElementVNode("div", _hoisted_1, [createVNode(unref(RouterView))])]),
					_: 1
				})]),
				_: 1
			}, 512);
		};
	}
});
//#endregion
export { Collection_vue_vue_type_script_setup_true_lang_default as default };

//# sourceMappingURL=Collection.vue.script.js.map