import { defineComponent, defineAsyncComponent, ref, onMounted, watch, nextTick, resolveComponent, openBlock, createBlock, withCtx, createVNode, unref } from 'vue';
import { useRoute } from 'vue-router';
import { storeToRefs } from 'pinia';
import '../../../../stores/index.mjs';
import { useThemeConfig } from '../../../../stores/themeConfig.mjs';

var _sfc_main = /* @__PURE__ */ defineComponent({
  __name: "columns",
  setup(__props) {
    const LayoutAside = defineAsyncComponent(() => import('../component/aside.vue.mjs'));
    const LayoutHeader = defineAsyncComponent(() => import('../component/header.vue.mjs'));
    const LayoutMain = defineAsyncComponent(() => import('../component/main.vue.mjs'));
    const ColumnsAside = defineAsyncComponent(() => import('../component/columnsAside.vue.mjs'));
    const layoutScrollbarRef = ref("");
    const layoutMainRef = ref();
    const route = useRoute();
    const storesThemeConfig = useThemeConfig();
    const { themeConfig } = storeToRefs(storesThemeConfig);
    const updateScrollbar = () => {
      layoutScrollbarRef.value.update();
      layoutMainRef.value && layoutMainRef.value.layoutMainScrollbarRef.update();
    };
    const initScrollBarHeight = () => {
      nextTick(() => {
        setTimeout(() => {
          updateScrollbar();
          layoutScrollbarRef.value.wrapRef.scrollTop = 0;
          if (layoutMainRef.value != void 0) layoutMainRef.value.layoutMainScrollbarRef.wrapRef.scrollTop = 0;
        }, 500);
      });
    };
    onMounted(() => {
      initScrollBarHeight();
    });
    watch(
      () => route.path,
      () => {
        initScrollBarHeight();
      }
    );
    watch(
      () => [themeConfig.value.isTagsview, themeConfig.value.isFixedHeader],
      () => {
        nextTick(() => {
          updateScrollbar();
        });
      },
      {
        deep: true
      }
    );
    return (_ctx, _cache) => {
      const _component_el_scrollbar = resolveComponent("el-scrollbar");
      const _component_el_container = resolveComponent("el-container");
      return openBlock(), createBlock(_component_el_container, { class: "layout-container" }, {
        default: withCtx(() => [
          createVNode(unref(ColumnsAside)),
          createVNode(_component_el_container, { class: "layout-columns-warp layout-container-view h100" }, {
            default: withCtx(() => [
              createVNode(unref(LayoutAside)),
              createVNode(
                _component_el_scrollbar,
                {
                  ref_key: "layoutScrollbarRef",
                  ref: layoutScrollbarRef,
                  class: "layout-backtop"
                },
                {
                  default: withCtx(() => [
                    createVNode(unref(LayoutHeader)),
                    createVNode(
                      unref(LayoutMain),
                      {
                        ref_key: "layoutMainRef",
                        ref: layoutMainRef
                      },
                      null,
                      512
                      /* NEED_PATCH */
                    )
                  ]),
                  _: 1
                  /* STABLE */
                },
                512
                /* NEED_PATCH */
              )
            ]),
            _: 1
            /* STABLE */
          })
        ]),
        _: 1
        /* STABLE */
      });
    };
  }
});

export { _sfc_main as default };
