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

import { _ as _defineProperty } from '../_chunks/dep-2db7b3ec.mjs';
import { _ as _slicedToArray } from '../_chunks/dep-84acf3c2.mjs';
import { defineComponent, toRefs, computed, provide, createVNode } from 'vue';
import useVModel from '../hooks/useVModel.mjs';
import { useTNodeJSX } from '../hooks/tnode.mjs';
import { usePrefixClass } from '../hooks/useConfig.mjs';
import props from './props.mjs';
import '../_chunks/dep-255303ba.mjs';
import '../_chunks/dep-b8d7992c.mjs';
import '../_chunks/dep-9a85dac1.mjs';
import '../_chunks/dep-eba0ea6e.mjs';
import '../_chunks/dep-1372b2d3.mjs';
import '../_chunks/dep-42cc3015.mjs';
import '../_chunks/dep-469b4ae0.mjs';
import '../_chunks/dep-b57180d0.mjs';
import '../_chunks/dep-c8d7b6b4.mjs';
import '../_chunks/dep-2bc37d52.mjs';
import '../_chunks/dep-3da99438.mjs';
import '../_chunks/dep-5717e263.mjs';
import '../_chunks/dep-a8bcacea.mjs';
import '../_chunks/dep-406cd044.mjs';
import '../_chunks/dep-327559e8.mjs';
import '../_chunks/dep-b2235f26.mjs';
import '../_chunks/dep-8b989474.mjs';
import '../utils/render-tnode.mjs';
import '../_chunks/dep-888e80c4.mjs';
import '../_chunks/dep-334a4f6b.mjs';
import '../_chunks/dep-e5eb9f23.mjs';
import '../_chunks/dep-9fe2ef12.mjs';
import '../_chunks/dep-672e7d1a.mjs';
import '../_chunks/dep-4d7a675b.mjs';
import '../_chunks/dep-2e7f59b1.mjs';
import '../_chunks/dep-1434aa15.mjs';
import '../_chunks/dep-9262ee2f.mjs';
import '../_chunks/dep-876fb3ec.mjs';
import '../config-provider/useConfig.mjs';
import '../_chunks/dep-095107f7.mjs';
import '../_chunks/dep-c989dff3.mjs';
import '../_chunks/dep-9cf86cf1.mjs';
import '../_chunks/dep-bc1d737a.mjs';
import '../_chunks/dep-855db8bc.mjs';
import '../_chunks/dep-a87f3e4c.mjs';
import '../_chunks/dep-1e566bb5.mjs';
import '../_chunks/dep-42a19209.mjs';
import '../_chunks/dep-8d3e9aa3.mjs';
import '../_chunks/dep-40d69a9c.mjs';
import '../_chunks/dep-dcc83161.mjs';
import '../_chunks/dep-0fc02184.mjs';
import '../_chunks/dep-f1994936.mjs';
import '../_chunks/dep-345e1be3.mjs';
import '../_common/js/global-config/default-config.mjs';
import '../_common/js/global-config/locale/zh_CN.mjs';
import '../_chunks/dep-9888611c.mjs';
import '../_chunks/dep-697a1365.mjs';
import '../config-provider/type.mjs';

var _Collapse = defineComponent({
  name: "TCollapse",
  props: props,
  setup: function setup(props2) {
    var componentName = usePrefixClass("collapse");
    var borderlessClass = usePrefixClass("-border-less");
    var renderTNodeJSX = useTNodeJSX();
    var _toRefs = toRefs(props2),
      value = _toRefs.value,
      expandMutex = _toRefs.expandMutex,
      borderless = _toRefs.borderless,
      modelValue = _toRefs.modelValue;
    var _useVModel = useVModel(value, modelValue, props2.defaultValue, props2.onChange),
      _useVModel2 = _slicedToArray(_useVModel, 2),
      collapseValue = _useVModel2[0],
      setCollapseValue = _useVModel2[1];
    var updateCollapseValue = function updateCollapseValue(value2) {
      var newValue = [].concat(collapseValue.value || []);
      var index = newValue.indexOf(value2);
      if (index >= 0) newValue.splice(index, 1);else if (expandMutex.value) newValue = [value2];else newValue.push(value2);
      setCollapseValue(newValue);
    };
    var classes = computed(function () {
      return [componentName.value, _defineProperty({}, borderlessClass.value, !!borderless.value)];
    });
    var getUniqId = function () {
      var index = 0;
      return function () {
        return index++;
      };
    }();
    provide("collapseValue", collapseValue);
    provide("updateCollapseValue", updateCollapseValue);
    provide("collapseProps", toRefs(props2));
    provide("getUniqId", getUniqId);
    provide("renderParentTNode", renderTNodeJSX);
    return function () {
      var nodes = renderTNodeJSX("default");
      return createVNode("div", {
        "class": classes.value
      }, [nodes]);
    };
  }
});

export { _Collapse as default };
//# sourceMappingURL=collapse.mjs.map
