import "../../../../../../node_modules/.pnpm/vue@3.3.4/node_modules/vue/dist/vue.runtime.esm-bundler.mjs";
import { useSettingStore } from "../../../../../store/modules/settingStore/settingStore.mjs";
import "../../../../../../node_modules/.pnpm/screenfull@6.0.2/node_modules/screenfull/index.mjs";
import "../../../../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_root.mjs";
import "../../../../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseGetTag.mjs";
import "../../../../../../node_modules/.pnpm/html2canvas@1.4.1/node_modules/html2canvas/dist/html2canvas.esm.mjs";
import "../../../../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseClone.mjs";
import "../../../../../../node_modules/.pnpm/crypto-js@4.1.1/node_modules/crypto-js/index.mjs";
import "../../../../../enums/pageEnum.mjs";
import "../../../../../router/index.mjs";
import "../../../../../store/modules/designStore/designStore.mjs";
import "../../../../../../node_modules/.pnpm/vue3-lazyload@0.2.5-beta_a6dezdz3je235ci4e3tu4rayna/node_modules/vue3-lazyload/dist/vue3-lazyload.esm.mjs";
import "../../../../../components/GoSkeleton/index.vue.mjs";
import "../../../../../components/GoLoading/index.mjs";
import "../../../../../settings/designSetting.mjs";
import { loadAsyncComponent } from "../../../../../utils/components.mjs";
import { usePackagesStore } from "../../../../../store/modules/packagesStore/packagesStore.mjs";
import { defineComponent, computed, watch, resolveComponent, openBlock, createElementBlock, createElementVNode as createBaseVNode, createVNode, withCtx } from "../../../../../../node_modules/.pnpm/@vue_runtime-core@3.3.4/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.mjs";
import { reactive, ref, unref } from "../../../../../../node_modules/.pnpm/@vue_reactivity@3.3.4/node_modules/@vue/reactivity/dist/reactivity.esm-bundler.mjs";
const _hoisted_1 = { class: "go-chart-common" };
const _hoisted_2 = { class: "chart-content-list" };
const _sfc_main = /* @__PURE__ */ defineComponent({
  __name: "index",
  props: {
    selectOptions: {
      type: Object,
      default: () => {
      }
    }
  },
  setup(__props) {
    const props = __props;
    const ChartsItemBox = loadAsyncComponent(() => import("../ChartsItemBox/index.vue.mjs"));
    const packagesStore = usePackagesStore();
    const settingStore = useSettingStore();
    computed(() => {
      if (packages.categorysNum > 2)
        return true;
      return !settingStore.getHidePackageOneCategory;
    });
    let packages = reactive({
      // 侧边栏
      menuOptions: [],
      // 当前选择
      selectOptions: {},
      // 分类归档
      categorys: {
        all: []
      },
      categoryNames: {
        all: "所有"
      },
      // 分类归档数量
      categorysNum: 0,
      // 存储不同类别组件进来的选中值
      saveSelectOptions: {}
    });
    const selectValue = ref("all");
    const setSelectOptions = (categorys) => {
      for (const val in categorys) {
        packages.selectOptions = categorys[val];
        break;
      }
    };
    watch(
      // @ts-ignore
      () => props.selectOptions,
      (newData) => {
        packages.categorysNum = 0;
        if (!newData)
          return;
        newData.list.forEach((e) => {
          const value = packages.categorys[e.category];
          packages.categorys[e.category] = value && value.length ? [...value, e] : [e];
          packages.categoryNames[e.category] = e.categoryName;
          packages.categorys["all"].push(e);
        });
        for (const val in packages.categorys) {
          packages.categorysNum += 1;
          packages.menuOptions.push({
            key: val,
            label: packages.categoryNames[val]
          });
        }
        setSelectOptions(packages.categorys);
        selectValue.value = packages.menuOptions[0]["key"];
      },
      {
        immediate: true
      }
    );
    watch(
      () => packagesStore.newPhoto,
      (newPhoto) => {
        if (!newPhoto)
          return;
        const newPhotoCategory = newPhoto.category;
        packages.categorys[newPhotoCategory].splice(1, 0, newPhoto);
        packages.categorys["all"].splice(1, 0, newPhoto);
      }
    );
    const deleteHandle = (item, index) => {
      packages.categorys[item.category].splice(index, 1);
      packages.categorys["all"].splice(index, 1);
    };
    return (_ctx, _cache) => {
      const _component_n_scrollbar = resolveComponent("n-scrollbar");
      return openBlock(), createElementBlock("div", _hoisted_1, [
        createBaseVNode("div", _hoisted_2, [
          createVNode(_component_n_scrollbar, { trigger: "none" }, {
            default: withCtx(() => [
              createVNode(unref(ChartsItemBox), {
                menuOptions: unref(packages).selectOptions,
                onDeletePhoto: deleteHandle
              }, null, 8, ["menuOptions"])
            ]),
            _: 1
          })
        ])
      ]);
    };
  }
});
export {
  _sfc_main as default
};
