import { defineComponent, ref, reactive, computed, toRef, nextTick, watch, onMounted, onUnmounted, resolveComponent, createBlock, openBlock, withCtx, createElementVNode, normalizeClass, unref, createElementBlock, createCommentVNode, Fragment, renderList, toDisplayString, createVNode, Teleport, normalizeStyle, withModifiers } from 'vue';
import '../../../utils/index.mjs';
import { Form } from 'ant-design-vue';
import { tagGroupEmits, tagGroupProps } from './tag-group.mjs';
import { LlEmpty } from '../../empty/index.mjs';
import { createNamespace } from '../../../utils/create-namespace.mjs';

"use strict";
const _hoisted_1 = ["onClick"];
const _hoisted_2 = ["onClick"];
const _hoisted_3 = ["onClick"];
const itemHeight = 36;
var _sfc_main = /* @__PURE__ */ defineComponent({
  ...{ name: "LlTagGroup" },
  __name: "tag-group",
  props: tagGroupProps,
  emits: tagGroupEmits,
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emits = __emit;
    const bem = createNamespace("tag-group");
    const formItemContext = Form.useInjectFormItemContext();
    const loading = ref(false);
    const inputValue = ref("");
    const visible = ref(false);
    const inputRef = ref();
    const more = ref(0);
    const mouseMove = ref(false);
    const tagsTypeRef = ref(null);
    const tagContainerRef = ref(null);
    const tagRefs = reactive([]);
    const filterOptionsValue = ref([]);
    const sessionBaseOptions = ref([]);
    const customOptions = ref([]);
    const tagsTypeWidth = ref(0);
    const shownArr = ref([]);
    const btnRef = ref();
    const popoverRef = ref();
    const selectBoxRef = ref(null);
    const popoverStyle = ref({});
    const arrowStyle = ref({});
    const moreRef = ref();
    const morePopoverRef = ref();
    const morePopoverStyle = ref({});
    const moreArrowStyle = ref({});
    const moreVisible = ref(false);
    const moreIsHovering = ref(false);
    let moreHideTimer = null;
    let animationFrameId = null;
    let moreAnimationFrameId = null;
    const value = computed({
      get: () => {
        return props.value;
      },
      set: (val) => {
        emits("update:value", val);
        emits("change", val);
      }
    });
    const exceededMaxTagCount = computed(() => {
      return props.maxTagCount > 0 && value.value.length >= props.maxTagCount;
    });
    const innerOptions = computed(() => {
      return props.options || [];
    });
    const concatOptions = computed(() => {
      const set = /* @__PURE__ */ new Set([
        ...customOptions.value,
        ...innerOptions.value,
        ...value.value
      ]);
      return Array.from(set);
    });
    const sortTags = (tags) => {
      if (props.sortBy === "alphabetical") {
        return [...tags].sort((a, b) => {
          return a.localeCompare(b, "zh-CN", { sensitivity: "base" });
        });
      }
      return tags;
    };
    const sortedValue = computed(() => {
      return sortTags(value.value);
    });
    const hiddenTags = computed(() => {
      if (props.overflowDisplay !== "collapse") return [];
      if (shownArr.value.length === 0) return sortedValue.value;
      return sortedValue.value.filter((item) => !shownArr.value.includes(item));
    });
    const getTagRefs = (i) => {
      return (el) => {
        if (el) {
          tagRefs[i] = toRef(el);
        } else {
          tagRefs.splice(i, 1);
        }
      };
    };
    let resizeObserver = null;
    const getWidth = () => {
      if (tagsTypeRef.value) {
        tagsTypeWidth.value = tagsTypeRef.value.offsetWidth - 90;
      }
    };
    const handleEnter = () => {
      const val = inputValue.value.trim();
      if (!val) return;
      if (exceededMaxTagCount.value) return;
      if (!props.allowCreate && !concatOptions.value.includes(val)) return;
      if (props.allowCreate && !concatOptions.value.includes(val)) {
        customOptions.value.push(val);
        emits("update:options", concatOptions.value);
        const prevScrollTop = selectBoxRef.value?.scrollTop ?? 0;
        sessionBaseOptions.value = [val, ...sessionBaseOptions.value];
        filterOptionsValue.value = [val, ...filterOptionsValue.value];
        if (prevScrollTop > 0) {
          nextTick(() => {
            const box = selectBoxRef.value;
            if (box) {
              box.scrollTop = prevScrollTop + itemHeight;
              scrollTop.value = prevScrollTop + itemHeight;
            }
          });
        }
      }
      if (concatOptions.value.includes(val)) {
        const arr = [...value.value];
        const idx = arr.indexOf(val);
        if (idx < 0) {
          arr.push(val);
        } else {
          arr.splice(idx, 1);
        }
        value.value = arr;
      }
      inputValue.value = "";
    };
    const handleFilter = () => {
      if (props.filter && typeof props.filter === "function" && inputValue.value) {
        filterOptionsValue.value = props.filter(
          inputValue.value,
          sessionBaseOptions.value
        );
      } else {
        filterOptionsValue.value = sessionBaseOptions.value;
      }
    };
    const removeCustomOption = (item) => {
      if (!customOptions.value.includes(item)) return;
      customOptions.value = customOptions.value.filter((o) => o !== item);
      sessionBaseOptions.value = sessionBaseOptions.value.filter((o) => o !== item);
      filterOptionsValue.value = filterOptionsValue.value.filter((o) => o !== item);
      emits("update:options", concatOptions.value);
    };
    const handleDelByValue = (tag) => {
      if (!tag) return;
      removeCustomOption(tag);
      value.value = value.value.filter((e) => e !== tag);
    };
    const handleClickFilter = (item) => {
      let arr = [...value.value];
      if (arr.indexOf(item) >= 0) {
        arr = arr.filter((e) => e !== item);
        value.value = arr;
        removeCustomOption(item);
      } else {
        if (exceededMaxTagCount.value) {
          return;
        }
        arr.push(item);
        value.value = arr;
      }
      inputValue.value = "";
    };
    const scrollTop = ref(0);
    const totalHeight = computed(() => {
      return filterOptionsValue.value.length * itemHeight + (props.listLoading ? itemHeight : 0);
    });
    const visibleData = computed(() => {
      const totalCount = filterOptionsValue.value.length + (props.listLoading ? 1 : 0);
      const visibleCount = Math.ceil(180 / itemHeight) + 4;
      let start = Math.floor(scrollTop.value / itemHeight);
      if (totalCount > 0 && start >= totalCount) {
        start = Math.max(0, totalCount - visibleCount);
      }
      const end = Math.min(start + visibleCount, totalCount);
      const result = [];
      for (let i = start; i < end; i++) {
        const isLoader = i === filterOptionsValue.value.length && props.listLoading;
        result.push({
          index: i,
          value: isLoader ? "" : filterOptionsValue.value[i],
          isLoader
        });
      }
      return result;
    });
    const offsetTop = computed(() => {
      if (visibleData.value.length === 0) return 0;
      return visibleData.value[0].index * itemHeight;
    });
    const scrollbarVisible = ref(false);
    const isHovering = ref(false);
    let scrollTimer = null;
    const showScrollbar = () => {
      scrollbarVisible.value = true;
      if (scrollTimer) clearTimeout(scrollTimer);
    };
    const hideScrollbarWithDelay = () => {
      if (scrollTimer) clearTimeout(scrollTimer);
      scrollTimer = setTimeout(() => {
        if (!isHovering.value) {
          scrollbarVisible.value = false;
        }
      }, 3e3);
    };
    const handleMouseEnterList = () => {
      isHovering.value = true;
      showScrollbar();
    };
    const handleMouseLeaveList = () => {
      isHovering.value = false;
      hideScrollbarWithDelay();
    };
    const handleScroll = (e) => {
      const target = e.target;
      scrollTop.value = target.scrollTop;
      const { clientHeight, scrollHeight } = target;
      if (target.scrollTop + clientHeight >= scrollHeight - props.triggerDistance) {
        emits("scroll-bottom");
      }
      showScrollbar();
      hideScrollbarWithDelay();
    };
    const updatePosition = () => {
      if (!visible.value || !btnRef.value || !popoverRef.value) {
        if (animationFrameId !== null) {
        }
        if (visible.value) animationFrameId = requestAnimationFrame(updatePosition);
        return;
      }
      const rect = btnRef.value.getBoundingClientRect();
      const popRect = popoverRef.value.getBoundingClientRect();
      let left = rect.left + rect.width / 2 - popRect.width / 2;
      const top = rect.bottom + 12;
      if (left < 10) left = 10;
      if (left + popRect.width > window.innerWidth - 10) {
        left = window.innerWidth - popRect.width - 10;
      }
      popoverStyle.value = {
        position: "fixed",
        left: `${left}px`,
        top: `${top}px`,
        zIndex: 2e3
      };
      const btnCenter = rect.left + rect.width / 2;
      const arrowLeft = btnCenter - left;
      arrowStyle.value = {
        left: `${arrowLeft}px`
      };
      animationFrameId = requestAnimationFrame(updatePosition);
    };
    const updateMorePosition = () => {
      if (!moreVisible.value || !moreRef.value || !morePopoverRef.value) {
        if (moreVisible.value) {
          moreAnimationFrameId = requestAnimationFrame(updateMorePosition);
        }
        return;
      }
      const rect = moreRef.value.getBoundingClientRect();
      const popRect = morePopoverRef.value.getBoundingClientRect();
      let left = rect.left + rect.width / 2 - popRect.width / 2;
      const top = rect.bottom + 12;
      if (left < 10) left = 10;
      if (left + popRect.width > window.innerWidth - 10) {
        left = window.innerWidth - popRect.width - 10;
      }
      morePopoverStyle.value = {
        position: "fixed",
        left: `${left}px`,
        top: `${top}px`,
        zIndex: 2e3
      };
      const btnCenter = rect.left + rect.width / 2;
      const arrowLeft = btnCenter - left;
      moreArrowStyle.value = {
        left: `${arrowLeft}px`
      };
      moreAnimationFrameId = requestAnimationFrame(updateMorePosition);
    };
    const toggleVisible = () => {
      visible.value = !visible.value;
    };
    const handleClickOutside = (e) => {
      if (!visible.value) return;
      const target = e.target;
      if (popoverRef.value && popoverRef.value.contains(target) || btnRef.value && btnRef.value.contains(target)) {
        return;
      }
      visible.value = false;
    };
    const showMorePopover = () => {
      if (props.overflowDisplay !== "collapse") return;
      if (hiddenTags.value.length === 0) return;
      moreVisible.value = true;
      if (moreHideTimer) {
        clearTimeout(moreHideTimer);
        moreHideTimer = null;
      }
      nextTick(() => {
        updateMorePosition();
      });
    };
    const hideMorePopoverImmediate = () => {
      moreVisible.value = false;
      if (moreHideTimer) {
        clearTimeout(moreHideTimer);
        moreHideTimer = null;
      }
      if (moreAnimationFrameId !== null) {
        cancelAnimationFrame(moreAnimationFrameId);
        moreAnimationFrameId = null;
      }
    };
    const hideMorePopoverWithDelay = () => {
      if (moreHideTimer) clearTimeout(moreHideTimer);
      moreHideTimer = setTimeout(() => {
        if (!moreIsHovering.value) {
          moreVisible.value = false;
          if (moreAnimationFrameId !== null) {
            cancelAnimationFrame(moreAnimationFrameId);
            moreAnimationFrameId = null;
          }
        }
      }, 150);
    };
    const handleMoreMouseEnter = () => {
      moreIsHovering.value = true;
      showMorePopover();
    };
    const handleMoreMouseLeave = () => {
      moreIsHovering.value = false;
      hideMorePopoverWithDelay();
    };
    const handleMorePopoverEnter = () => {
      moreIsHovering.value = true;
      showMorePopover();
    };
    const handleMorePopoverLeave = () => {
      moreIsHovering.value = false;
      hideMorePopoverWithDelay();
    };
    watch(visible, (val) => {
      if (val) {
        scrollTop.value = 0;
        const all = concatOptions.value;
        const selectedSet = new Set(value.value);
        const selected = sortTags(all.filter((i) => selectedSet.has(i)));
        const unselected = all.filter((i) => !selectedSet.has(i));
        sessionBaseOptions.value = [...selected, ...unselected];
        filterOptionsValue.value = sessionBaseOptions.value;
        window.addEventListener("mousedown", handleClickOutside);
        nextTick(() => {
          updatePosition();
          if (selectBoxRef.value) {
            selectBoxRef.value.scrollTop = 0;
          }
          setTimeout(() => {
            inputRef.value?.focus();
          }, 100);
        });
      } else {
        inputValue.value = "";
        window.removeEventListener("mousedown", handleClickOutside);
        if (animationFrameId !== null) {
          cancelAnimationFrame(animationFrameId);
          animationFrameId = null;
        }
      }
    });
    watch(
      [filterOptionsValue, () => props.listLoading],
      () => {
        if (!visible.value) return;
        const maxScrollTopByData = Math.max(
          0,
          (filterOptionsValue.value.length + (props.listLoading ? 1 : 0) - 1) * itemHeight
        );
        if (scrollTop.value > maxScrollTopByData) {
          scrollTop.value = maxScrollTopByData;
        }
        nextTick(() => {
          const box = selectBoxRef.value;
          if (!box) return;
          const maxScrollTop = Math.max(0, box.scrollHeight - box.clientHeight);
          if (box.scrollTop > maxScrollTop) {
            box.scrollTop = maxScrollTop;
          }
          scrollTop.value = box.scrollTop;
        });
      },
      { deep: true }
    );
    watch(
      [
        () => props.overflowDisplay,
        () => more.value,
        () => hiddenTags.value.length
      ],
      () => {
        if (props.overflowDisplay !== "collapse" || more.value <= 0) {
          hideMorePopoverImmediate();
          return;
        }
        if (hiddenTags.value.length === 0) {
          hideMorePopoverImmediate();
        }
      }
    );
    watch(
      () => props.options,
      (newOpts) => {
        if (!visible.value) return;
        const incoming = newOpts || [];
        const allKnown = /* @__PURE__ */ new Set([
          ...value.value,
          ...customOptions.value,
          ...incoming
        ]);
        const kept = sessionBaseOptions.value.filter((item) => allKnown.has(item));
        const keptSet = new Set(kept);
        const addedSet = new Set(incoming.filter((item) => !keptSet.has(item)));
        sessionBaseOptions.value = [...kept, ...addedSet];
        handleFilter();
      },
      { deep: true }
    );
    watch(
      [
        () => value.value.length,
        tagsTypeWidth,
        () => props.sortBy,
        () => props.overflowDisplay,
        () => props.collapseThreshold
      ],
      async (n, o) => {
        await nextTick();
        const checkValidate = () => {
          if (o && o[0]) {
            if (n[0] !== o[0]) {
              formItemContext.onFieldChange();
              formItemContext.onFieldBlur();
            }
          }
        };
        if (props.overflowDisplay === "wrap") {
          shownArr.value = sortedValue.value;
          more.value = 0;
          checkValidate();
          return;
        }
        if (props.overflowDisplay === "collapse" && props.collapseThreshold > 0) {
          const sorted2 = sortedValue.value;
          shownArr.value = sorted2.slice(0, props.collapseThreshold);
          const diff2 = sorted2.length - props.collapseThreshold;
          more.value = diff2 > 0 ? diff2 : 0;
          checkValidate();
          return;
        }
        const arr = [];
        let moreLeftValue = 0;
        const sorted = sortedValue.value;
        for (let i = 0; i < sorted.length; i++) {
          const tagEl = tagRefs[i]?.value;
          if (!tagEl) continue;
          const targetWidth = tagEl.offsetWidth + 10;
          if (moreLeftValue + targetWidth >= n[1]) {
            break;
          } else {
            moreLeftValue += targetWidth;
            arr.push(sorted[i]);
          }
        }
        const diff = n[0] - arr.length;
        more.value = diff > 0 ? diff : 0;
        shownArr.value = arr;
        checkValidate();
      },
      {
        deep: true,
        immediate: true
      }
    );
    watch(inputValue, () => {
      emits("input", inputValue.value);
      handleFilter();
    });
    onMounted(() => {
      nextTick(() => {
        getWidth();
      });
      if (tagsTypeRef.value) {
        resizeObserver = new ResizeObserver(getWidth);
        resizeObserver.observe(tagsTypeRef.value);
      }
    });
    onUnmounted(() => {
      resizeObserver?.disconnect();
      resizeObserver = null;
      window.removeEventListener("mousedown", handleClickOutside);
      if (animationFrameId !== null) {
        cancelAnimationFrame(animationFrameId);
        animationFrameId = null;
      }
      hideMorePopoverImmediate();
    });
    return (_ctx, _cache) => {
      const _component_ll_icon = resolveComponent("ll-icon");
      const _component_ll_input = resolveComponent("ll-input");
      const _component_a_spin = resolveComponent("a-spin");
      return openBlock(), createBlock(_component_a_spin, { spinning: loading.value }, {
        default: withCtx(() => [
          createElementVNode(
            "div",
            {
              ref_key: "tagsTypeRef",
              ref: tagsTypeRef,
              class: normalizeClass([
                unref(bem).b(),
                props.size ? unref(bem).m(props.size) : "",
                props.overflowDisplay === "wrap" ? unref(bem).is("wrap") : ""
              ])
            },
            [
              createElementVNode(
                "div",
                {
                  ref_key: "tagContainerRef",
                  ref: tagContainerRef,
                  class: normalizeClass([unref(bem).e("tag-container")])
                },
                [
                  (openBlock(true), createElementBlock(
                    Fragment,
                    null,
                    renderList(sortedValue.value, (item, i) => {
                      return openBlock(), createElementBlock(
                        "div",
                        {
                          key: i,
                          ref_for: true,
                          ref: getTagRefs(i),
                          class: normalizeClass([
                            unref(bem).m("item"),
                            !shownArr.value.includes(item) ? unref(bem).is("hidden") : ""
                          ])
                        },
                        [
                          createElementVNode(
                            "div",
                            {
                              class: normalizeClass(unref(bem).m("text"))
                            },
                            toDisplayString(item),
                            3
                            /* TEXT, CLASS */
                          ),
                          createElementVNode("span", {
                            class: normalizeClass([unref(bem).m("close"), props.disabled ? unref(bem).m("disabled") : ""]),
                            onClick: ($event) => handleDelByValue(item)
                          }, [
                            createVNode(_component_ll_icon, {
                              "icon-name": "icon-close2",
                              "class-name": unref(bem).m("close-icon")
                            }, null, 8, ["class-name"])
                          ], 10, _hoisted_1)
                        ],
                        2
                        /* CLASS */
                      );
                    }),
                    128
                    /* KEYED_FRAGMENT */
                  )),
                  more.value > 0 ? (openBlock(), createElementBlock(
                    "div",
                    {
                      key: 0,
                      ref_key: "moreRef",
                      ref: moreRef,
                      class: normalizeClass(unref(bem).m("more")),
                      onMouseenter: handleMoreMouseEnter,
                      onMouseleave: handleMoreMouseLeave
                    },
                    " +" + toDisplayString(more.value),
                    35
                    /* TEXT, CLASS, NEED_HYDRATION */
                  )) : createCommentVNode("v-if", true),
                  (openBlock(), createBlock(Teleport, { to: "body" }, [
                    moreVisible.value ? (openBlock(), createElementBlock(
                      "div",
                      {
                        key: 0,
                        ref_key: "morePopoverRef",
                        ref: morePopoverRef,
                        class: normalizeClass(unref(bem).e("more-popover")),
                        style: normalizeStyle(morePopoverStyle.value),
                        onMouseenter: handleMorePopoverEnter,
                        onMouseleave: handleMorePopoverLeave
                      },
                      [
                        createElementVNode(
                          "div",
                          {
                            class: normalizeClass(unref(bem).e("arrow")),
                            style: normalizeStyle(moreArrowStyle.value)
                          },
                          null,
                          6
                          /* CLASS, STYLE */
                        ),
                        createElementVNode(
                          "div",
                          {
                            class: normalizeClass(unref(bem).e("more-list"))
                          },
                          [
                            (openBlock(true), createElementBlock(
                              Fragment,
                              null,
                              renderList(hiddenTags.value, (item, i) => {
                                return openBlock(), createElementBlock(
                                  "div",
                                  {
                                    key: i,
                                    class: normalizeClass(unref(bem).e("more-item"))
                                  },
                                  [
                                    createElementVNode(
                                      "span",
                                      null,
                                      toDisplayString(item),
                                      1
                                      /* TEXT */
                                    ),
                                    createVNode(_component_ll_icon, {
                                      "icon-name": "icon-delete",
                                      onClick: withModifiers(($event) => handleDelByValue(item), ["stop"])
                                    }, null, 8, ["onClick"])
                                  ],
                                  2
                                  /* CLASS */
                                );
                              }),
                              128
                              /* KEYED_FRAGMENT */
                            ))
                          ],
                          2
                          /* CLASS */
                        )
                      ],
                      38
                      /* CLASS, STYLE, NEED_HYDRATION */
                    )) : createCommentVNode("v-if", true)
                  ])),
                  createElementVNode(
                    "div",
                    {
                      class: normalizeClass(unref(bem).e("add-container"))
                    },
                    [
                      createElementVNode(
                        "div",
                        {
                          ref_key: "btnRef",
                          ref: btnRef,
                          class: normalizeClass([
                            mouseMove.value || visible.value ? unref(bem).is("active") : "",
                            unref(bem).m("add-item"),
                            props.disabled ? unref(bem).m("disabled") : ""
                          ]),
                          onClick: withModifiers(toggleVisible, ["stop"]),
                          onMouseover: _cache[0] || (_cache[0] = ($event) => mouseMove.value = true),
                          onMouseleave: _cache[1] || (_cache[1] = ($event) => mouseMove.value = false)
                        },
                        [
                          createVNode(_component_ll_icon, {
                            "icon-name": _ctx.addIcon || "icon-add",
                            color: "#666",
                            "class-name": unref(bem).m("add-icon")
                          }, null, 8, ["icon-name", "class-name"]),
                          _ctx.addText ? (openBlock(), createElementBlock(
                            "span",
                            {
                              key: 0,
                              class: normalizeClass(unref(bem).m("add-text"))
                            },
                            toDisplayString(_ctx.addText),
                            3
                            /* TEXT, CLASS */
                          )) : createCommentVNode("v-if", true)
                        ],
                        34
                        /* CLASS, NEED_HYDRATION */
                      ),
                      (openBlock(), createBlock(Teleport, { to: "body" }, [
                        visible.value ? (openBlock(), createElementBlock(
                          "div",
                          {
                            key: 0,
                            ref_key: "popoverRef",
                            ref: popoverRef,
                            class: normalizeClass([
                              unref(bem).e("popover"),
                              exceededMaxTagCount.value ? unref(bem).m("exceeded") : ""
                            ]),
                            style: normalizeStyle(popoverStyle.value),
                            onClick: _cache[3] || (_cache[3] = withModifiers(() => {
                            }, ["stop"])),
                            onMousedown: _cache[4] || (_cache[4] = withModifiers(() => {
                            }, ["stop"]))
                          },
                          [
                            createElementVNode(
                              "div",
                              {
                                class: normalizeClass(unref(bem).e("arrow")),
                                style: normalizeStyle(arrowStyle.value)
                              },
                              null,
                              6
                              /* CLASS, STYLE */
                            ),
                            createVNode(_component_ll_input, {
                              ref_key: "inputRef",
                              ref: inputRef,
                              value: inputValue.value,
                              "onUpdate:value": _cache[2] || (_cache[2] = ($event) => inputValue.value = $event),
                              size: props.size,
                              class: normalizeClass(unref(bem).e("search")),
                              "is-gray": props.isGray,
                              placeholder: props.placeholder,
                              "prefix-icon": `icon-search`,
                              onPressEnter: withModifiers(handleEnter, ["prevent"])
                            }, null, 8, ["value", "size", "class", "is-gray", "placeholder"]),
                            filterOptionsValue.value.length > 0 || props.listLoading ? (openBlock(), createElementBlock(
                              "div",
                              {
                                key: 0,
                                class: normalizeClass(unref(bem).m("select-box-container")),
                                style: normalizeStyle({
                                  paddingRight: scrollbarVisible.value ? "6px" : "12px"
                                })
                              },
                              [
                                props.virtual ? (openBlock(), createElementBlock(
                                  "div",
                                  {
                                    key: 0,
                                    ref_key: "selectBoxRef",
                                    ref: selectBoxRef,
                                    class: normalizeClass([
                                      unref(bem).m("select-box"),
                                      !scrollbarVisible.value ? unref(bem).is("scrollbar-hidden") : ""
                                    ]),
                                    style: { "position": "relative" },
                                    onScroll: handleScroll,
                                    onMouseenter: handleMouseEnterList,
                                    onMouseleave: handleMouseLeaveList
                                  },
                                  [
                                    createElementVNode(
                                      "div",
                                      {
                                        style: normalizeStyle({
                                          height: `${totalHeight.value}px`,
                                          width: "100%"
                                        })
                                      },
                                      null,
                                      4
                                      /* STYLE */
                                    ),
                                    createElementVNode(
                                      "ul",
                                      {
                                        style: normalizeStyle({
                                          transform: `translateY(${offsetTop.value}px)`,
                                          position: "absolute",
                                          top: 0,
                                          left: 0,
                                          width: "100%"
                                        })
                                      },
                                      [
                                        (openBlock(true), createElementBlock(
                                          Fragment,
                                          null,
                                          renderList(visibleData.value, (item) => {
                                            return openBlock(), createElementBlock("li", {
                                              key: item.index,
                                              class: normalizeClass([
                                                unref(bem).m("select-item"),
                                                value.value.indexOf(item.value) >= 0 && item.value ? unref(bem).m("select-check") : ""
                                              ]),
                                              style: normalizeStyle(
                                                item.isLoader ? "justify-content: center; margin: 0; width: 100%" : ""
                                              ),
                                              onClick: ($event) => !item.isLoader && handleClickFilter(item.value)
                                            }, [
                                              createElementVNode(
                                                "span",
                                                {
                                                  class: normalizeClass(unref(bem).m("select-text"))
                                                },
                                                toDisplayString(item.value),
                                                3
                                                /* TEXT, CLASS */
                                              ),
                                              createVNode(_component_ll_icon, {
                                                "icon-name": "icon-check",
                                                color: "#1890FF"
                                              })
                                            ], 14, _hoisted_2);
                                          }),
                                          128
                                          /* KEYED_FRAGMENT */
                                        ))
                                      ],
                                      4
                                      /* STYLE */
                                    ),
                                    props.listLoading ? (openBlock(), createElementBlock(
                                      "li",
                                      {
                                        key: 0,
                                        class: normalizeClass(unref(bem).m("select-item")),
                                        style: { "justify-content": "center", "margin": "0", "width": "100%" }
                                      },
                                      [
                                        createVNode(_component_a_spin)
                                      ],
                                      2
                                      /* CLASS */
                                    )) : createCommentVNode("v-if", true)
                                  ],
                                  34
                                  /* CLASS, NEED_HYDRATION */
                                )) : (openBlock(), createElementBlock(
                                  "ul",
                                  {
                                    key: 1,
                                    ref_key: "selectBoxRef",
                                    ref: selectBoxRef,
                                    class: normalizeClass([
                                      unref(bem).m("select-box"),
                                      !scrollbarVisible.value ? unref(bem).is("scrollbar-hidden") : ""
                                    ]),
                                    onScroll: handleScroll,
                                    onMouseenter: handleMouseEnterList,
                                    onMouseleave: handleMouseLeaveList
                                  },
                                  [
                                    (openBlock(true), createElementBlock(
                                      Fragment,
                                      null,
                                      renderList(filterOptionsValue.value, (item, i) => {
                                        return openBlock(), createElementBlock("li", {
                                          key: i,
                                          class: normalizeClass([
                                            unref(bem).m("select-item"),
                                            value.value.indexOf(item) >= 0 && item ? unref(bem).m("select-check") : ""
                                          ]),
                                          onClick: ($event) => handleClickFilter(item)
                                        }, [
                                          createElementVNode(
                                            "span",
                                            {
                                              class: normalizeClass(unref(bem).m("select-text"))
                                            },
                                            toDisplayString(item),
                                            3
                                            /* TEXT, CLASS */
                                          ),
                                          createVNode(_component_ll_icon, {
                                            "icon-name": "icon-check",
                                            color: "#1890FF"
                                          })
                                        ], 10, _hoisted_3);
                                      }),
                                      128
                                      /* KEYED_FRAGMENT */
                                    )),
                                    props.listLoading ? (openBlock(), createElementBlock(
                                      "li",
                                      {
                                        key: 0,
                                        class: normalizeClass(unref(bem).m("select-item")),
                                        style: { "justify-content": "center", "margin": "0", "width": "100%" }
                                      },
                                      [
                                        createVNode(_component_a_spin)
                                      ],
                                      2
                                      /* CLASS */
                                    )) : createCommentVNode("v-if", true)
                                  ],
                                  34
                                  /* CLASS, NEED_HYDRATION */
                                ))
                              ],
                              6
                              /* CLASS, STYLE */
                            )) : (openBlock(), createElementBlock(
                              "div",
                              {
                                key: 1,
                                class: normalizeClass(unref(bem).e("empty"))
                              },
                              [
                                createVNode(unref(LlEmpty), {
                                  title: props.emptyText
                                }, null, 8, ["title"])
                              ],
                              2
                              /* CLASS */
                            ))
                          ],
                          38
                          /* CLASS, STYLE, NEED_HYDRATION */
                        )) : createCommentVNode("v-if", true)
                      ]))
                    ],
                    2
                    /* CLASS */
                  )
                ],
                2
                /* CLASS */
              )
            ],
            2
            /* CLASS */
          )
        ]),
        _: 1
        /* STABLE */
      }, 8, ["spinning"]);
    };
  }
});

export { _sfc_main as default };
//# sourceMappingURL=tag-group.vue2.mjs.map
