"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
require("../../../../../../node_modules/.pnpm/vue@3.3.4/node_modules/vue/dist/vue.runtime.esm-bundler.js");
const settingStore = require("../../../../../store/modules/settingStore/settingStore.js");
require("../../../../../../node_modules/.pnpm/screenfull@6.0.2/node_modules/screenfull/index.js");
require("../../../../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_root.js");
require("../../../../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseGetTag.js");
require("../../../../../../node_modules/.pnpm/html2canvas@1.4.1/node_modules/html2canvas/dist/html2canvas.esm.js");
require("../../../../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseClone.js");
require("../../../../../../node_modules/.pnpm/crypto-js@4.1.1/node_modules/crypto-js/index.js");
require("../../../../../enums/pageEnum.js");
require("../../../../../router/index.js");
require("../../../../../store/modules/designStore/designStore.js");
require("../../../../../../node_modules/.pnpm/vue3-lazyload@0.2.5-beta_a6dezdz3je235ci4e3tu4rayna/node_modules/vue3-lazyload/dist/vue3-lazyload.esm.js");
require("../../../../../components/GoSkeleton/index.vue.js");
require("../../../../../components/GoLoading/index.js");
require("../../../../../settings/designSetting.js");
const components = require("../../../../../utils/components.js");
const packagesStore = require("../../../../../store/modules/packagesStore/packagesStore.js");
const runtimeCore_esmBundler = require("../../../../../../node_modules/.pnpm/@vue_runtime-core@3.3.4/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js");
const reactivity_esmBundler = require("../../../../../../node_modules/.pnpm/@vue_reactivity@3.3.4/node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js");
const _hoisted_1 = { class: "go-chart-common" };
const _hoisted_2 = { class: "chart-content-list" };
const _sfc_main = /* @__PURE__ */ runtimeCore_esmBundler.defineComponent({
  __name: "index",
  props: {
    selectOptions: {
      type: Object,
      default: () => {
      }
    }
  },
  setup(__props) {
    const props = __props;
    const ChartsItemBox = components.loadAsyncComponent(() => Promise.resolve().then(() => require("../ChartsItemBox/index.vue.js")));
    const packagesStore$1 = packagesStore.usePackagesStore();
    const settingStore$1 = settingStore.useSettingStore();
    runtimeCore_esmBundler.computed(() => {
      if (packages.categorysNum > 2)
        return true;
      return !settingStore$1.getHidePackageOneCategory;
    });
    let packages = reactivity_esmBundler.reactive({
      // 侧边栏
      menuOptions: [],
      // 当前选择
      selectOptions: {},
      // 分类归档
      categorys: {
        all: []
      },
      categoryNames: {
        all: "所有"
      },
      // 分类归档数量
      categorysNum: 0,
      // 存储不同类别组件进来的选中值
      saveSelectOptions: {}
    });
    const selectValue = reactivity_esmBundler.ref("all");
    const setSelectOptions = (categorys) => {
      for (const val in categorys) {
        packages.selectOptions = categorys[val];
        break;
      }
    };
    runtimeCore_esmBundler.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
      }
    );
    runtimeCore_esmBundler.watch(
      () => packagesStore$1.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 = runtimeCore_esmBundler.resolveComponent("n-scrollbar");
      return runtimeCore_esmBundler.openBlock(), runtimeCore_esmBundler.createElementBlock("div", _hoisted_1, [
        runtimeCore_esmBundler.createElementVNode("div", _hoisted_2, [
          runtimeCore_esmBundler.createVNode(_component_n_scrollbar, { trigger: "none" }, {
            default: runtimeCore_esmBundler.withCtx(() => [
              runtimeCore_esmBundler.createVNode(reactivity_esmBundler.unref(ChartsItemBox), {
                menuOptions: reactivity_esmBundler.unref(packages).selectOptions,
                onDeletePhoto: deleteHandle
              }, null, 8, ["menuOptions"])
            ]),
            _: 1
          })
        ])
      ]);
    };
  }
});
exports.default = _sfc_main;
