import "../../../node_modules/element-plus/es/index.mjs";
/* empty css                                                       */
/* empty css                                                              */
/* empty css                                                                    */
import { ref, watch, computed, createElementBlock, openBlock, createElementVNode, createVNode, withCtx, createTextVNode } from "vue";
import { ElCheckbox, ElCheckboxGroup } from "../../../node_modules/element-plus/es/components/checkbox/index.mjs";
const _hoisted_1 = { class: "accept-type-container" };
const _hoisted_2 = { class: "quick-options" };
const _hoisted_3 = { class: "type-category" };
const _hoisted_4 = { class: "type-category" };
const _hoisted_5 = { class: "type-category" };
const _sfc_main = {
  __name: "FileTypeSelect",
  props: {
    modelValue: {
      type: Array,
      default: () => []
    }
  },
  emits: ["update:modelValue"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const allFileTypes = [
      "doc",
      "xls",
      "ppt",
      "pdf",
      "text",
      "image",
      "video",
      "audio",
      "zip"
    ];
    const localAcceptType = ref([...props.modelValue]);
    watch(
      () => props.modelValue,
      (newVal) => {
        if (JSON.stringify(newVal) !== JSON.stringify(localAcceptType.value)) {
          localAcceptType.value = [...newVal];
        }
      }
    );
    watch(
      localAcceptType,
      (newVal) => {
        emit("update:modelValue", [...newVal]);
      },
      { flush: "post" }
    );
    const isAllSelected = computed(() => {
      return allFileTypes.every((type) => {
        var _a;
        return (_a = localAcceptType.value) == null ? void 0 : _a.includes(type);
      });
    });
    const toggleSelectAll = () => {
      if (isAllSelected.value) {
        localAcceptType.value = [];
      } else {
        localAcceptType.value = [...allFileTypes];
      }
    };
    return (_ctx, _cache) => {
      const _component_el_checkbox = ElCheckbox;
      const _component_el_checkbox_group = ElCheckboxGroup;
      return openBlock(), createElementBlock("div", _hoisted_1, [
        createElementVNode("div", _hoisted_2, [
          createVNode(_component_el_checkbox, {
            "model-value": isAllSelected.value,
            onChange: toggleSelectAll,
            size: "small",
            class: "select-all-checkbox"
          }, {
            default: withCtx(() => _cache[1] || (_cache[1] = [
              createTextVNode(" 全部 ")
            ])),
            _: 1
          }, 8, ["model-value"])
        ]),
        createVNode(_component_el_checkbox_group, {
          modelValue: localAcceptType.value,
          "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => localAcceptType.value = $event),
          size: "small",
          class: "type-checkbox-group"
        }, {
          default: withCtx(() => [
            createElementVNode("div", _hoisted_3, [
              createVNode(_component_el_checkbox, {
                label: "Word文档",
                value: "doc"
              }),
              createVNode(_component_el_checkbox, {
                label: "Excel文档",
                value: "xls"
              }),
              createVNode(_component_el_checkbox, {
                label: "PowerPoint文档",
                value: "ppt"
              }),
              createVNode(_component_el_checkbox, {
                label: "PDF文档",
                value: "pdf"
              }),
              createVNode(_component_el_checkbox, {
                label: "文本文件",
                value: "text"
              })
            ]),
            createElementVNode("div", _hoisted_4, [
              createVNode(_component_el_checkbox, {
                label: "图片",
                value: "image"
              }),
              createVNode(_component_el_checkbox, {
                label: "视频",
                value: "video"
              }),
              createVNode(_component_el_checkbox, {
                label: "音频",
                value: "audio"
              })
            ]),
            createElementVNode("div", _hoisted_5, [
              createVNode(_component_el_checkbox, {
                label: "压缩包",
                value: "zip"
              })
            ])
          ]),
          _: 1
        }, 8, ["modelValue"])
      ]);
    };
  }
};
export {
  _sfc_main as default
};
