"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
require("../../../node_modules/element-plus/es/index.js");
;/* empty css                                                       */
;/* empty css                                                              */
;/* empty css                                                                    */
const Vue = require("vue");
const index = require("../../../node_modules/element-plus/es/components/checkbox/index.js");
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 = Vue.ref([...props.modelValue]);
    Vue.watch(
      () => props.modelValue,
      (newVal) => {
        if (JSON.stringify(newVal) !== JSON.stringify(localAcceptType.value)) {
          localAcceptType.value = [...newVal];
        }
      }
    );
    Vue.watch(
      localAcceptType,
      (newVal) => {
        emit("update:modelValue", [...newVal]);
      },
      { flush: "post" }
    );
    const isAllSelected = Vue.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 = index.ElCheckbox;
      const _component_el_checkbox_group = index.ElCheckboxGroup;
      return Vue.openBlock(), Vue.createElementBlock("div", _hoisted_1, [
        Vue.createElementVNode("div", _hoisted_2, [
          Vue.createVNode(_component_el_checkbox, {
            "model-value": isAllSelected.value,
            onChange: toggleSelectAll,
            size: "small",
            class: "select-all-checkbox"
          }, {
            default: Vue.withCtx(() => _cache[1] || (_cache[1] = [
              Vue.createTextVNode(" 全部 ")
            ])),
            _: 1
          }, 8, ["model-value"])
        ]),
        Vue.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: Vue.withCtx(() => [
            Vue.createElementVNode("div", _hoisted_3, [
              Vue.createVNode(_component_el_checkbox, {
                label: "Word文档",
                value: "doc"
              }),
              Vue.createVNode(_component_el_checkbox, {
                label: "Excel文档",
                value: "xls"
              }),
              Vue.createVNode(_component_el_checkbox, {
                label: "PowerPoint文档",
                value: "ppt"
              }),
              Vue.createVNode(_component_el_checkbox, {
                label: "PDF文档",
                value: "pdf"
              }),
              Vue.createVNode(_component_el_checkbox, {
                label: "文本文件",
                value: "text"
              })
            ]),
            Vue.createElementVNode("div", _hoisted_4, [
              Vue.createVNode(_component_el_checkbox, {
                label: "图片",
                value: "image"
              }),
              Vue.createVNode(_component_el_checkbox, {
                label: "视频",
                value: "video"
              }),
              Vue.createVNode(_component_el_checkbox, {
                label: "音频",
                value: "audio"
              })
            ]),
            Vue.createElementVNode("div", _hoisted_5, [
              Vue.createVNode(_component_el_checkbox, {
                label: "压缩包",
                value: "zip"
              })
            ])
          ]),
          _: 1
        }, 8, ["modelValue"])
      ]);
    };
  }
};
exports.default = _sfc_main;
