/**
 * ldesign v0.4.2
 * (c) 2023 ldesign
 * @license MIT
 */

import { _ as _objectWithoutProperties } from '../_chunks/dep-b6a73f93.mjs';
import { _ as _toConsumableArray } from '../_chunks/dep-e091cfd9.mjs';
import { _ as _slicedToArray } from '../_chunks/dep-55846619.mjs';
import { _ as _defineProperty } from '../_chunks/dep-eb20e23f.mjs';
import { defineComponent, toRefs, ref, computed, provide, watch, nextTick, createVNode, mergeProps } from 'vue';
import { p as pick_1 } from '../_chunks/dep-e9bfe96d.mjs';
import { i as isArray_1 } from '../_chunks/dep-e3b14d70.mjs';
import { i as isFunction_1 } from '../_chunks/dep-6b22dd27.mjs';
import { d as debounce_1 } from '../_chunks/dep-96bb54d5.mjs';
import { c as cloneDeep_1 } from '../_chunks/dep-44417261.mjs';
import { g as get_1 } from '../_chunks/dep-4c3e8dd5.mjs';
import { i as intersection_1 } from '../_chunks/dep-0492e83e.mjs';
import FakeArrow from '../common-components/fake-arrow.mjs';
import { SelectInput } from '../select-input/index.mjs';
import { useFormDisabled } from '../form/hooks.mjs';
import useDefaultValue from '../hooks/useDefaultValue.mjs';
import useVModel from '../hooks/useVModel.mjs';
import { useTNodeJSX } from '../hooks/tnode.mjs';
import { usePrefixClass } from '../hooks/useConfig.mjs';
import props from './props.mjs';
import SelectPanel from './select-panel.mjs';
import { getSingleContent, getMultipleContent, getNewMultipleValue, selectInjectKey } from './helper.mjs';
import { useSelectOptions } from './hooks/useSelectOptions.mjs';
import { useConfig } from '../config-provider/useConfig.mjs';
import '../_chunks/dep-cfcedf47.mjs';
import '../_chunks/dep-b4041200.mjs';
import '../_chunks/dep-a0b4a044.mjs';
import '../_chunks/dep-7acc11cb.mjs';
import '../_chunks/dep-66d6733b.mjs';
import '../_chunks/dep-be27d184.mjs';
import '../_chunks/dep-c959a6fb.mjs';
import '../_chunks/dep-c31e1d9e.mjs';
import '../_chunks/dep-0bfbf721.mjs';
import '../_chunks/dep-39cc276d.mjs';
import '../_chunks/dep-8f777748.mjs';
import '../_chunks/dep-0f0c89ff.mjs';
import '../_chunks/dep-ae357f26.mjs';
import '../_chunks/dep-37ba476d.mjs';
import '../_chunks/dep-ea5448a5.mjs';
import '../_chunks/dep-352691c2.mjs';
import '../_chunks/dep-2cfd5b3a.mjs';
import '../_chunks/dep-c852a61a.mjs';
import '../_chunks/dep-05fa17c9.mjs';
import '../_chunks/dep-10085c61.mjs';
import '../_chunks/dep-774ac2d0.mjs';
import '../_chunks/dep-23a0f453.mjs';
import '../_chunks/dep-3afa94cf.mjs';
import '../_chunks/dep-6205fc47.mjs';
import '../_chunks/dep-bf74f1c2.mjs';
import '../_chunks/dep-79821ff2.mjs';
import '../_chunks/dep-a9c8a5d5.mjs';
import '../_chunks/dep-1b058de3.mjs';
import '../_chunks/dep-92e7085e.mjs';
import '../_chunks/dep-44f056cd.mjs';
import '../_chunks/dep-5d966cee.mjs';
import '../_chunks/dep-c7e9ce16.mjs';
import '../utils/withInstall.mjs';
import '../select-input/select-input.mjs';
import '../popup/index.mjs';
import '../popup/popup.mjs';
import '@popperjs/core';
import '../_chunks/dep-1cf2b129.mjs';
import '../hooks/index.mjs';
import '../hooks/icon.mjs';
import '../hooks/slot.mjs';
import '../hooks/useCommonClassName.mjs';
import '../hooks/useDestroyOnClose.mjs';
import '../hooks/useKeepAnimation.mjs';
import '../_chunks/dep-99920870.mjs';
import '../_chunks/dep-ba3c0b2e.mjs';
import '../_chunks/dep-ee57d235.mjs';
import '../_common/js/global-config/default-config.mjs';
import '../_common/js/global-config/locale/zh_CN.mjs';
import '../_chunks/dep-6b4aa943.mjs';
import '../_chunks/dep-d52291a9.mjs';
import '../hooks/useRipple.mjs';
import '../utils/set-style.mjs';
import '../hooks/useVirtualScroll.mjs';
import '../utils/dom.mjs';
import '../utils/easing.mjs';
import '../_common/js/utils/set-style.mjs';
import '../popup/container.mjs';
import '../hooks/useResizeObserver.mjs';
import '../popup/props.mjs';
import '../popup/style/css.mjs';
import '../popup/type.mjs';
import '../_chunks/dep-f6649a46.mjs';
import '../_chunks/dep-1fe0ad42.mjs';
import '../_chunks/dep-d54f2690.mjs';
import '../_chunks/dep-59c8420d.mjs';
import '../_chunks/dep-74848b92.mjs';
import '../_chunks/dep-c4e1a112.mjs';
import '../utils/render-tnode.mjs';
import '../_chunks/dep-bd03960e.mjs';
import '../config-provider/type.mjs';
import '../select-input/props.mjs';
import '../select-input/useSingle.mjs';
import '../input/index.mjs';
import '../input/input.mjs';
import '@ldesign/icons-vue-next';
import '../_chunks/dep-30451c48.mjs';
import '../hooks/useGlobalIcon.mjs';
import '../input/props.mjs';
import '../input/useInput.mjs';
import '../form/const.mjs';
import '../input/useLengthLimit.mjs';
import '../_chunks/dep-6eea369f.mjs';
import '../_common/js/log/index.mjs';
import '../_common/js/log/log.mjs';
import '../_common/js/utils/helper.mjs';
import '../_chunks/dep-6f89b77e.mjs';
import '../input/useInputEventHandler.mjs';
import '../input/useInputWidth.mjs';
import '../input/input-group.mjs';
import '../input/input-group-props.mjs';
import '../input/style/css.mjs';
import '../input/type.mjs';
import '../loading/index.mjs';
import '../loading/directive.mjs';
import '../loading/plugin.mjs';
import '../loading/loading.mjs';
import '../hooks/useTeleport.mjs';
import '../loading/props.mjs';
import '../loading/icon/gradient.mjs';
import '../_common/js/loading/circle-adapter.mjs';
import '../loading/style/css.mjs';
import '../loading/type.mjs';
import '../select-input/useMultiple.mjs';
import '../tag-input/index.mjs';
import '../tag-input/tag-input.mjs';
import '../tag-input/props.mjs';
import '../tag-input/hooks/useTagScroll.mjs';
import '../tag-input/useTagList.mjs';
import '../tag/index.mjs';
import '../tag/tag.mjs';
import '../tag/props.mjs';
import '../tag/check-tag.mjs';
import '../tag/check-tag-props.mjs';
import '../tag/style/css.mjs';
import '../tag/type.mjs';
import '../tag-input/hooks/useHover.mjs';
import '../tag-input/hooks/useDragSorter.mjs';
import '../tag-input/style/css.mjs';
import '../tag-input/type.mjs';
import '../select-input/useOverlayInnerStyle.mjs';
import '../select-input/style/css.mjs';
import '../select-input/type.mjs';
import '../_chunks/dep-b2af48ba.mjs';
import './option.mjs';
import '../checkbox/index.mjs';
import '../checkbox/checkbox.mjs';
import '../checkbox/props.mjs';
import '../checkbox/constants.mjs';
import '../checkbox/group.mjs';
import '../checkbox/checkbox-group-props.mjs';
import '../checkbox/style/css.mjs';
import '../checkbox/type.mjs';
import './option-props.mjs';
import './optionGroup.mjs';
import './option-group-props.mjs';
import './hooks/usePanelVirtualScroll.mjs';

var _excluded = ["overlayClassName"];
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
var _Select = defineComponent({
  name: "TSelect",
  props: _objectSpread({}, props),
  setup: function setup(props2, _ref) {
    var slots = _ref.slots;
    var classPrefix = usePrefixClass();
    var disabled = useFormDisabled();
    var renderTNodeJSX = useTNodeJSX();
    var COMPONENT_NAME = usePrefixClass("select");
    var _useConfig = useConfig("select"),
      globalConfig = _useConfig.globalConfig,
      t = _useConfig.t;
    var _toRefs = toRefs(props2),
      popupVisible = _toRefs.popupVisible,
      inputValue = _toRefs.inputValue,
      modelValue = _toRefs.modelValue,
      value = _toRefs.value;
    var _useVModel = useVModel(value, modelValue, props2.defaultValue, props2.onChange),
      _useVModel2 = _slicedToArray(_useVModel, 2),
      orgValue = _useVModel2[0],
      setOrgValue = _useVModel2[1];
    var selectPanelRef = ref(null);
    var selectInputRef = ref(null);
    var keys = computed(function () {
      var _props2$keys, _props2$keys2;
      return {
        label: ((_props2$keys = props2.keys) === null || _props2$keys === void 0 ? void 0 : _props2$keys.label) || "label",
        value: ((_props2$keys2 = props2.keys) === null || _props2$keys2 === void 0 ? void 0 : _props2$keys2.value) || "value"
      };
    });
    var _useSelectOptions = useSelectOptions(props2, keys),
      options = _useSelectOptions.options,
      optionsMap = _useSelectOptions.optionsMap,
      optionsList = _useSelectOptions.optionsList,
      optionsCache = _useSelectOptions.optionsCache;
    var innerValue = computed(function () {
      if (orgValue.value === void 0) return props2.multiple ? [] : void 0;
      if (props2.valueType === "object") {
        return !props2.multiple ? orgValue.value[keys.value.value] : orgValue.value.map(function (option) {
          return option[keys.value.value];
        });
      }
      return orgValue.value;
    });
    var setInnerValue = function setInnerValue(newVal, e) {
      if (props2.valueType === "object") {
        var _keys$value = keys.value,
          value2 = _keys$value.value,
          label = _keys$value.label;
        var getOption = function getOption(val) {
          var _ref2;
          if (val === void 0) return void 0;
          var option = optionsMap.value.get(val);
          return _ref2 = {}, _defineProperty(_ref2, value2, get_1(option, value2)), _defineProperty(_ref2, label, get_1(option, label)), _ref2;
        };
        newVal = props2.multiple ? newVal.map(function (val) {
          return getOption(val);
        }) : getOption(newVal);
      }
      if (newVal === orgValue.value) return;
      setOrgValue(newVal, {
        selectedOptions: getSelectedOptions(newVal),
        trigger: e.trigger,
        e: e.e
      });
    };
    var _useDefaultValue = useDefaultValue(inputValue, props2.defaultInputValue, props2.onInputChange, "inputValue"),
      _useDefaultValue2 = _slicedToArray(_useDefaultValue, 2),
      innerInputValue = _useDefaultValue2[0],
      setInputValue = _useDefaultValue2[1];
    var _useDefaultValue3 = useDefaultValue(popupVisible, false, function (visible, context) {
        var _props2$onPopupVisibl;
        (_props2$onPopupVisibl = props2.onPopupVisibleChange) === null || _props2$onPopupVisibl === void 0 ? void 0 : _props2$onPopupVisibl.call(props2, visible, context);
      }, "popupVisible"),
      _useDefaultValue4 = _slicedToArray(_useDefaultValue3, 2),
      innerPopupVisible = _useDefaultValue4[0],
      setInnerPopupVisible = _useDefaultValue4[1];
    var placeholderText = computed(function () {
      var _ref3;
      return (_ref3 = !props2.multiple && innerPopupVisible.value && getSingleContent(innerValue.value, optionsMap) || props2.placeholder) !== null && _ref3 !== void 0 ? _ref3 : t(globalConfig.value.placeholder);
    });
    var displayText = computed(function () {
      return props2.multiple ? getMultipleContent(innerValue.value, optionsMap) : getSingleContent(innerValue.value, optionsMap);
    });
    var valueDisplayParams = computed(function () {
      var val = props2.multiple && isArray_1(innerValue.value) ? innerValue.value.map(function (value2) {
        var _optionsMap$value$get;
        return {
          value: value2,
          label: (_optionsMap$value$get = optionsMap.value.get(value2)) === null || _optionsMap$value$get === void 0 ? void 0 : _optionsMap$value$get.label
        };
      }) : innerValue.value;
      var params = {
        value: val,
        onClose: props2.multiple ? function (index) {
          return removeTag(index);
        } : function () {}
      };
      if (props2.minCollapsedNum && props2.multiple) {
        var _val$slice;
        return _objectSpread(_objectSpread({}, params), {}, {
          displayValue: val === null || val === void 0 ? void 0 : (_val$slice = val.slice) === null || _val$slice === void 0 ? void 0 : _val$slice.call(val, 0, props2.minCollapsedNum)
        });
      }
      return params;
    });
    var isFilterable = computed(function () {
      return Boolean(props2.filterable || globalConfig.value.filterable || isFunction_1(props2.filter));
    });
    var removeTag = function removeTag(index, e) {
      var _props2$onRemove;
      e && e.stopPropagation();
      var selectValue = cloneDeep_1(innerValue.value);
      var value2 = selectValue[index];
      selectValue.splice(index, 1);
      setInnerValue(selectValue, {
        selectedOptions: getSelectedOptions(selectValue),
        trigger: "tag-remove",
        e: e
      });
      (_props2$onRemove = props2.onRemove) === null || _props2$onRemove === void 0 ? void 0 : _props2$onRemove.call(props2, {
        value: value2,
        data: optionsMap.value.get(value2),
        e: e
      });
    };
    var handleCreate = function handleCreate() {
      var _props2$onCreate;
      if (!innerInputValue.value) return;
      (_props2$onCreate = props2.onCreate) === null || _props2$onCreate === void 0 ? void 0 : _props2$onCreate.call(props2, innerInputValue.value);
      setInputValue("");
    };
    var hoverIndex = ref(-1);
    var handleKeyDown = function handleKeyDown(e) {
      var _optionsList$value$ne, _optionsList$value$ne2;
      var optionsListLength = optionsList.value.length;
      var newIndex = hoverIndex.value;
      switch (e.code) {
        case "ArrowUp":
          e.preventDefault();
          if (hoverIndex.value === -1) newIndex = 0;else if (hoverIndex.value === 0) newIndex = optionsListLength - 1;else newIndex--;
          if ((_optionsList$value$ne = optionsList.value[newIndex]) !== null && _optionsList$value$ne !== void 0 && _optionsList$value$ne.disabled) newIndex--;
          hoverIndex.value = newIndex;
          break;
        case "ArrowDown":
          e.preventDefault();
          if (hoverIndex.value === -1 || hoverIndex.value === optionsListLength - 1) newIndex = 0;else newIndex++;
          if ((_optionsList$value$ne2 = optionsList.value[newIndex]) !== null && _optionsList$value$ne2 !== void 0 && _optionsList$value$ne2.disabled) newIndex++;
          hoverIndex.value = newIndex;
          break;
        case "Enter":
          if (hoverIndex.value === -1) break;
          if (!innerPopupVisible.value) {
            setInnerPopupVisible(true, {
              e: e
            });
            break;
          }
          if (!props2.multiple) {
            setInnerValue(optionsList.value[hoverIndex.value].value, {
              selectedOptions: getSelectedOptions(optionsList.value[hoverIndex.value].value),
              trigger: "check",
              e: e
            });
            setInnerPopupVisible(false, {
              e: e
            });
          } else {
            var _optionsList$value$ho;
            if (hoverIndex.value === -1) return;
            var optionValue = (_optionsList$value$ho = optionsList.value[hoverIndex.value]) === null || _optionsList$value$ho === void 0 ? void 0 : _optionsList$value$ho.value;
            if (!optionValue) return;
            var newValue = getNewMultipleValue(innerValue.value, optionValue);
            setInnerValue(newValue.value, {
              selectedOptions: getSelectedOptions(newValue.value),
              trigger: newValue.isCheck ? "check" : "uncheck",
              e: e
            });
          }
          break;
        case "Escape":
          setInnerPopupVisible(false, {
            e: e
          });
          break;
      }
    };
    var popupContentRef = computed(function () {
      var _selectInputRef$value;
      return (_selectInputRef$value = selectInputRef.value) === null || _selectInputRef$value === void 0 ? void 0 : _selectInputRef$value.popupRef.getOverlay();
    });
    var optionalList = computed(function () {
      return optionsList.value.filter(function (item) {
        return !item.disabled && !item["check-all"] && !item.checkAll;
      });
    });
    var getSelectedOptions = function getSelectedOptions() {
      var selectValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : innerValue.value;
      return optionsList.value.filter(function (option) {
        if (option.checkAll) return;
        if (isArray_1(selectValue)) return selectValue.includes(option.value);
        return selectValue === option.value;
      });
    };
    var onCheckAllChange = function onCheckAllChange(checked) {
      if (!props2.multiple) return;
      var value2 = checked ? optionalList.value.map(function (option) {
        return option.value;
      }) : [];
      setInnerValue(value2, {
        selectedOptions: getSelectedOptions(value2),
        trigger: checked ? "check" : "clear"
      });
    };
    var intersectionLen = computed(function () {
      var values = optionalList.value.map(function (item) {
        return item.value;
      });
      var n = intersection_1(innerValue.value, values);
      return n.length;
    });
    var isCheckAll = computed(function () {
      return intersectionLen.value === optionalList.value.length;
    });
    var indeterminate = computed(function () {
      return !isCheckAll.value && intersectionLen.value !== 0;
    });
    var SelectProvide = computed(function () {
      return {
        max: props2.max,
        multiple: props2.multiple,
        hoverIndex: hoverIndex.value,
        selectValue: innerValue.value,
        reserveKeyword: props2.reserveKeyword,
        handleValueChange: setInnerValue,
        handlerInputChange: setInputValue,
        handlePopupVisibleChange: setInnerPopupVisible,
        handleCreate: handleCreate,
        size: props2.size,
        popupContentRef: popupContentRef,
        indeterminate: indeterminate.value,
        isCheckAll: isCheckAll.value,
        onCheckAllChange: onCheckAllChange,
        getSelectedOptions: getSelectedOptions
      };
    });
    provide(selectInjectKey, SelectProvide);
    var checkValueInvalid = function checkValueInvalid() {
      if (!props2.multiple && isArray_1(orgValue.value)) setOrgValue(void 0);
      if (props2.multiple && !isArray_1(orgValue.value)) setOrgValue([]);
    };
    var handleSearch = debounce_1(function (value2, _ref4) {
      var _props2$onSearch;
      var e = _ref4.e;
      (_props2$onSearch = props2.onSearch) === null || _props2$onSearch === void 0 ? void 0 : _props2$onSearch.call(props2, "".concat(value2), {
        e: e
      });
    }, 300);
    var addCache = function addCache(val) {
      if (props2.multiple) {
        var newCache = [];
        var _iterator = _createForOfIteratorHelper(val || []),
          _step;
        try {
          for (_iterator.s(); !(_step = _iterator.n()).done;) {
            var item = _step.value;
            var option = optionsMap.value.get(item);
            if (option) newCache.push(option);
          }
        } catch (err) {
          _iterator.e(err);
        } finally {
          _iterator.f();
        }
        optionsCache.value = Array.from( /* @__PURE__ */new Set([].concat(newCache, _toConsumableArray(optionsCache.value))));
      } else {
        var _option = optionsMap.value.get(val);
        if (_option) optionsCache.value = Array.from( /* @__PURE__ */new Set([_option].concat(_toConsumableArray(optionsCache.value))));
      }
    };
    watch(orgValue, function (val) {
      checkValueInvalid();
      nextTick(function () {
        addCache(val);
      });
    }, {
      immediate: true
    });
    watch(function () {
      return props2.multiple;
    }, function () {
      checkValueInvalid();
    });
    watch(innerPopupVisible, function (value2) {
      if (value2) {
        hoverIndex.value = -1;
      } else {
        if (innerInputValue.value) setInputValue("");
      }
    });
    var updateScrollTop = function updateScrollTop(content) {
      var _selectPanelRef$value, _selectPanelRef$value2;
      if (!selectPanelRef.value) return;
      var firstSelectedNode = (_selectPanelRef$value = selectPanelRef.value) === null || _selectPanelRef$value === void 0 ? void 0 : (_selectPanelRef$value2 = _selectPanelRef$value.innerRef) === null || _selectPanelRef$value2 === void 0 ? void 0 : _selectPanelRef$value2.querySelector(".".concat(classPrefix.value, "-is-selected"));
      nextTick(function () {
        if (firstSelectedNode && content) {
          var _getComputedStyle = getComputedStyle(firstSelectedNode),
            paddingBottom = _getComputedStyle.paddingBottom;
          var _getComputedStyle2 = getComputedStyle(content),
            marginBottom = _getComputedStyle2.marginBottom;
          var elementBottomHeight = parseInt(paddingBottom, 10) + parseInt(marginBottom, 10);
          var updateValue = firstSelectedNode.offsetTop - content.offsetTop - (content.clientHeight - firstSelectedNode.clientHeight) + elementBottomHeight;
          content.scrollTop = updateValue;
        }
      });
    };
    provide("updateScrollTop", updateScrollTop);
    return function () {
      var _ref5 = props2.popupProps || {},
        overlayClassName = _ref5.overlayClassName,
        restPopupProps = _objectWithoutProperties(_ref5, _excluded);
      return createVNode("div", {
        "class": "".concat(COMPONENT_NAME.value, "__wrap")
      }, [createVNode(SelectInput, mergeProps({
        autoWidth: props2.autoWidth,
        readonly: props2.readonly,
        borderless: props2.borderless,
        multiple: props2.multiple,
        clearable: props2.clearable,
        loading: props2.loading,
        status: props2.status,
        tips: props2.tips,
        minCollapsedNum: props2.minCollapsedNum,
        autofocus: props2.autofocus,
        suffix: props2.suffix
      }, {
        "ref": selectInputRef,
        "class": COMPONENT_NAME.value,
        "value": displayText.value,
        "disabled": disabled.value,
        "popupVisible": innerPopupVisible.value,
        "inputValue": innerPopupVisible.value ? innerInputValue.value : "",
        "placeholder": "".concat(placeholderText.value),
        "allowInput": isFilterable.value,
        "collapsed-items": props2.collapsedItems,
        "inputProps": _objectSpread(_objectSpread({
          size: props2.size
        }, props2.inputProps), {}, {
          onkeydown: handleKeyDown
        }),
        "tagInputProps": _objectSpread({
          size: props2.size
        }, props2.tagInputProps),
        "onTagChange": function onTagChange(val, ctx) {
          removeTag(ctx.index);
        },
        "tagProps": _objectSpread({}, props2.tagProps),
        "popupProps": _objectSpread({
          overlayClassName: ["".concat(COMPONENT_NAME.value, "__dropdown"), overlayClassName]
        }, restPopupProps),
        "label": function label() {
          return renderTNodeJSX("prefixIcon");
        },
        "suffixIcon": function suffixIcon() {
          if (props2.suffixIcon || slots.suffixIcon) return renderTNodeJSX("suffixIcon");
          return props2.showArrow && createVNode(FakeArrow, {
            "overlayClassName": "".concat(COMPONENT_NAME.value, "__right-icon"),
            "isActive": innerPopupVisible.value
          }, null);
        },
        "valueDisplay": function valueDisplay() {
          return renderTNodeJSX("valueDisplay", {
            params: valueDisplayParams.value
          });
        },
        "onPopupVisibleChange": function onPopupVisibleChange(val, context) {
          setInnerPopupVisible(val, context);
        },
        "onInputChange": function onInputChange(value2, context) {
          if (!innerPopupVisible.value || context.trigger === "blur") return;
          setInputValue(value2);
          handleSearch("".concat(value2), {
            e: context.e
          });
        },
        "onClear": function onClear(_ref6) {
          var _props2$onClear;
          var e = _ref6.e;
          setInnerValue(props2.multiple ? [] : void 0, {
            selectedOptions: getSelectedOptions(props2.multiple ? [] : void 0),
            trigger: "clear",
            e: e
          });
          (_props2$onClear = props2.onClear) === null || _props2$onClear === void 0 ? void 0 : _props2$onClear.call(props2, {
            e: e
          });
        },
        "onEnter": function onEnter(inputValue2, _ref7) {
          var _props2$onEnter;
          var e = _ref7.e;
          (_props2$onEnter = props2.onEnter) === null || _props2$onEnter === void 0 ? void 0 : _props2$onEnter.call(props2, {
            inputValue: "".concat(innerInputValue.value),
            e: e,
            value: innerValue.value
          });
          handleCreate();
        },
        "onBlur": function onBlur(inputValue2, _ref8) {
          var _props2$onBlur;
          var e = _ref8.e;
          (_props2$onBlur = props2.onBlur) === null || _props2$onBlur === void 0 ? void 0 : _props2$onBlur.call(props2, {
            e: e,
            value: innerValue.value
          });
        },
        "onFocus": function onFocus(inputValue2, _ref9) {
          var _props2$onFocus;
          var e = _ref9.e;
          (_props2$onFocus = props2.onFocus) === null || _props2$onFocus === void 0 ? void 0 : _props2$onFocus.call(props2, {
            e: e,
            value: innerValue.value
          });
        }
      }, props2.selectInputProps), {
        panel: function panel() {
          return createVNode(SelectPanel, mergeProps({
            "ref": selectPanelRef
          }, pick_1(props2, ["size", "multiple", "empty", "loading", "loadingText", "filterable", "creatable", "panelTopContent", "panelBottomContent", "filter", "scroll"]), {
            "options": options.value,
            "inputValue": innerInputValue.value
          }), slots);
        },
        collapsedItems: slots.collapsedItems,
        suffix: slots.suffix
      })]);
    };
  }
});

export { _Select as default };
//# sourceMappingURL=select.mjs.map
