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

import { _ as _slicedToArray } from '../_chunks/dep-55846619.mjs';
import { _ as _defineProperty } from '../_chunks/dep-eb20e23f.mjs';
import { isVNode, defineComponent, computed, watch, createVNode, mergeProps } from 'vue';
import { d as dayjs } from '../_chunks/dep-6b4aa943.mjs';
import '../_chunks/dep-a0b4a044.mjs';
import { _ as _typeof } from '../_chunks/dep-b4041200.mjs';
import { a as _Stack } from '../_chunks/dep-79821ff2.mjs';
import { _ as _baseIsEqual } from '../_chunks/dep-f0017956.mjs';
import { i as isObject_1 } from '../_chunks/dep-0f0c89ff.mjs';
import { i as isFunction_1 } from '../_chunks/dep-6b22dd27.mjs';
import { k as keys_1 } from '../_chunks/dep-bf74f1c2.mjs';
import { g as get_1 } from '../_chunks/dep-4c3e8dd5.mjs';
import { h as hasIn_1 } from '../_chunks/dep-e9bfe96d.mjs';
import { _ as _isKey, a as _toKey, b as _baseGet } from '../_chunks/dep-7acc11cb.mjs';
import { i as identity_1 } from '../_chunks/dep-3afa94cf.mjs';
import { i as isArray_1 } from '../_chunks/dep-e3b14d70.mjs';
import '../_chunks/dep-66d6733b.mjs';
import { _ as _baseProperty } from '../_chunks/dep-777f7d4b.mjs';
import { _ as _baseUnset } from '../_chunks/dep-b2af48ba.mjs';
import { _ as _isIndex } from '../_chunks/dep-c852a61a.mjs';
import '../hooks/useConfig.mjs';
import { useContent } from '../hooks/tnode.mjs';
import { Select } from '../select/index.mjs';
import { RadioGroup, RadioButton } from '../radio/index.mjs';
import { Button } from '../button/index.mjs';
import { CheckTag } from '../tag/index.mjs';
import { COMPONENT_NAME, MIN_YEAR, FIRST_MONTH_OF_YEAR, LAST_MONTH_OF_YEAR, DEFAULT_YEAR_CELL_NUMINROW } from './const.mjs';
import './hook/index.mjs';
import { createMonthCellsData, createYearCellsData } from './utils.mjs';
import props from './props.mjs';
import CalendarCellItem from './calendar-cell.mjs';
import { useConfig } from '../config-provider/useConfig.mjs';
import { useState } from './hook/useState.mjs';
import { useCalendarClass } from './hook/useCalendarClass.mjs';
import { useColHeaders } from './hook/useColHeaders.mjs';
import { userController } from './hook/useController.mjs';
import '../_chunks/dep-cfcedf47.mjs';
import '../_chunks/dep-0bfbf721.mjs';
import '../_chunks/dep-39cc276d.mjs';
import '../_chunks/dep-8f777748.mjs';
import '../_chunks/dep-c959a6fb.mjs';
import '../_chunks/dep-ae357f26.mjs';
import '../_chunks/dep-352691c2.mjs';
import '../_chunks/dep-2cfd5b3a.mjs';
import '../_chunks/dep-05fa17c9.mjs';
import '../_chunks/dep-c31e1d9e.mjs';
import '../_chunks/dep-a9c8a5d5.mjs';
import '../_chunks/dep-10085c61.mjs';
import '../_chunks/dep-1b058de3.mjs';
import '../_chunks/dep-92e7085e.mjs';
import '../_chunks/dep-5d966cee.mjs';
import '../_chunks/dep-44f056cd.mjs';
import '../_chunks/dep-23a0f453.mjs';
import '../_chunks/dep-ea5448a5.mjs';
import '../_chunks/dep-774ac2d0.mjs';
import '../_chunks/dep-be27d184.mjs';
import '../_chunks/dep-37ba476d.mjs';
import '../_chunks/dep-59c8420d.mjs';
import '../_chunks/dep-ba3c0b2e.mjs';
import '../_chunks/dep-f6649a46.mjs';
import '../_chunks/dep-1fe0ad42.mjs';
import '../_chunks/dep-d54f2690.mjs';
import '../_chunks/dep-74848b92.mjs';
import '../_chunks/dep-c4e1a112.mjs';
import '../utils/render-tnode.mjs';
import '../_chunks/dep-bd03960e.mjs';
import '../_chunks/dep-1cf2b129.mjs';
import '../utils/withInstall.mjs';
import '../select/select.mjs';
import '../_chunks/dep-b6a73f93.mjs';
import '../_chunks/dep-e091cfd9.mjs';
import '../_chunks/dep-96bb54d5.mjs';
import '../_chunks/dep-6205fc47.mjs';
import '../_chunks/dep-44417261.mjs';
import '../_chunks/dep-0492e83e.mjs';
import '../_chunks/dep-c7e9ce16.mjs';
import '../common-components/fake-arrow.mjs';
import '../select-input/index.mjs';
import '../select-input/select-input.mjs';
import '../popup/index.mjs';
import '../popup/popup.mjs';
import '@popperjs/core';
import '../hooks/index.mjs';
import '../hooks/icon.mjs';
import '../hooks/slot.mjs';
import '../hooks/useCommonClassName.mjs';
import '../hooks/useDefaultValue.mjs';
import '../hooks/useDestroyOnClose.mjs';
import '../hooks/useKeepAnimation.mjs';
import '../_chunks/dep-99920870.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-d52291a9.mjs';
import '../hooks/useRipple.mjs';
import '../utils/set-style.mjs';
import '../hooks/useVirtualScroll.mjs';
import '../hooks/useVModel.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 '../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 '../form/hooks.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-input/hooks/useHover.mjs';
import '../tag-input/hooks/useDragSorter.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/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 '../select/props.mjs';
import '../select/select-panel.mjs';
import '../select/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 '../select/option-props.mjs';
import '../select/helper.mjs';
import '../select/optionGroup.mjs';
import '../select/option-group-props.mjs';
import '../select/hooks/usePanelVirtualScroll.mjs';
import '../select/hooks/useSelectOptions.mjs';
import '../select/style/css.mjs';
import '../select/type.mjs';
import '../radio/radio.mjs';
import '../utils/helper.mjs';
import '../radio/constants.mjs';
import '../radio/props.mjs';
import '../radio/group.mjs';
import '../_chunks/dep-beaa677e.mjs';
import '../_chunks/dep-51aacdc9.mjs';
import '../watermark/hooks.mjs';
import '../radio/radio-group-props.mjs';
import '../radio/useKeyboard.mjs';
import '../radio/radio-button.mjs';
import '../radio/style/css.mjs';
import '../radio/type.mjs';
import '../button/button.mjs';
import '../button/props.mjs';
import '../button/style/css.mjs';
import '../button/type.mjs';
import '../_chunks/dep-0cfc2d3f.mjs';

var Stack = _Stack,
  baseIsEqual$1 = _baseIsEqual;

/** Used to compose bitmasks for value comparisons. */
var COMPARE_PARTIAL_FLAG$1 = 1,
  COMPARE_UNORDERED_FLAG$1 = 2;

/**
 * The base implementation of `_.isMatch` without support for iteratee shorthands.
 *
 * @private
 * @param {Object} object The object to inspect.
 * @param {Object} source The object of property values to match.
 * @param {Array} matchData The property names, values, and compare flags to match.
 * @param {Function} [customizer] The function to customize comparisons.
 * @returns {boolean} Returns `true` if `object` is a match, else `false`.
 */
function baseIsMatch$1(object, source, matchData, customizer) {
  var index = matchData.length,
    length = index,
    noCustomizer = !customizer;
  if (object == null) {
    return !length;
  }
  object = Object(object);
  while (index--) {
    var data = matchData[index];
    if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) {
      return false;
    }
  }
  while (++index < length) {
    data = matchData[index];
    var key = data[0],
      objValue = object[key],
      srcValue = data[1];
    if (noCustomizer && data[2]) {
      if (objValue === undefined && !(key in object)) {
        return false;
      }
    } else {
      var stack = new Stack();
      if (customizer) {
        var result = customizer(objValue, srcValue, key, object, source, stack);
      }
      if (!(result === undefined ? baseIsEqual$1(srcValue, objValue, COMPARE_PARTIAL_FLAG$1 | COMPARE_UNORDERED_FLAG$1, customizer, stack) : result)) {
        return false;
      }
    }
  }
  return true;
}
var _baseIsMatch = baseIsMatch$1;

var isObject = isObject_1;

/**
 * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
 *
 * @private
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` if suitable for strict
 *  equality comparisons, else `false`.
 */
function isStrictComparable$2(value) {
  return value === value && !isObject(value);
}
var _isStrictComparable = isStrictComparable$2;

var isStrictComparable$1 = _isStrictComparable,
  keys = keys_1;

/**
 * Gets the property names, values, and compare flags of `object`.
 *
 * @private
 * @param {Object} object The object to query.
 * @returns {Array} Returns the match data of `object`.
 */
function getMatchData$1(object) {
  var result = keys(object),
    length = result.length;
  while (length--) {
    var key = result[length],
      value = object[key];
    result[length] = [key, value, isStrictComparable$1(value)];
  }
  return result;
}
var _getMatchData = getMatchData$1;

/**
 * A specialized version of `matchesProperty` for source values suitable
 * for strict equality comparisons, i.e. `===`.
 *
 * @private
 * @param {string} key The key of the property to get.
 * @param {*} srcValue The value to match.
 * @returns {Function} Returns the new spec function.
 */
function matchesStrictComparable$2(key, srcValue) {
  return function (object) {
    if (object == null) {
      return false;
    }
    return object[key] === srcValue && (srcValue !== undefined || key in Object(object));
  };
}
var _matchesStrictComparable = matchesStrictComparable$2;

var baseIsMatch = _baseIsMatch,
  getMatchData = _getMatchData,
  matchesStrictComparable$1 = _matchesStrictComparable;

/**
 * The base implementation of `_.matches` which doesn't clone `source`.
 *
 * @private
 * @param {Object} source The object of property values to match.
 * @returns {Function} Returns the new spec function.
 */
function baseMatches$1(source) {
  var matchData = getMatchData(source);
  if (matchData.length == 1 && matchData[0][2]) {
    return matchesStrictComparable$1(matchData[0][0], matchData[0][1]);
  }
  return function (object) {
    return object === source || baseIsMatch(object, source, matchData);
  };
}
var _baseMatches = baseMatches$1;

var baseIsEqual = _baseIsEqual,
  get = get_1,
  hasIn = hasIn_1,
  isKey$1 = _isKey,
  isStrictComparable = _isStrictComparable,
  matchesStrictComparable = _matchesStrictComparable,
  toKey$1 = _toKey;

/** Used to compose bitmasks for value comparisons. */
var COMPARE_PARTIAL_FLAG = 1,
  COMPARE_UNORDERED_FLAG = 2;

/**
 * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
 *
 * @private
 * @param {string} path The path of the property to get.
 * @param {*} srcValue The value to match.
 * @returns {Function} Returns the new spec function.
 */
function baseMatchesProperty$1(path, srcValue) {
  if (isKey$1(path) && isStrictComparable(srcValue)) {
    return matchesStrictComparable(toKey$1(path), srcValue);
  }
  return function (object) {
    var objValue = get(object, path);
    return objValue === undefined && objValue === srcValue ? hasIn(object, path) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  };
}
var _baseMatchesProperty = baseMatchesProperty$1;

var baseGet = _baseGet;

/**
 * A specialized version of `baseProperty` which supports deep paths.
 *
 * @private
 * @param {Array|string} path The path of the property to get.
 * @returns {Function} Returns the new accessor function.
 */
function basePropertyDeep$1(path) {
  return function (object) {
    return baseGet(object, path);
  };
}
var _basePropertyDeep = basePropertyDeep$1;

var baseProperty = _baseProperty,
  basePropertyDeep = _basePropertyDeep,
  isKey = _isKey,
  toKey = _toKey;

/**
 * Creates a function that returns the value at `path` of a given object.
 *
 * @static
 * @memberOf _
 * @since 2.4.0
 * @category Util
 * @param {Array|string} path The path of the property to get.
 * @returns {Function} Returns the new accessor function.
 * @example
 *
 * var objects = [
 *   { 'a': { 'b': 2 } },
 *   { 'a': { 'b': 1 } }
 * ];
 *
 * _.map(objects, _.property('a.b'));
 * // => [2, 1]
 *
 * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
 * // => [1, 2]
 */
function property$1(path) {
  return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
}
var property_1 = property$1;

var baseMatches = _baseMatches,
  baseMatchesProperty = _baseMatchesProperty,
  identity = identity_1,
  isArray = isArray_1,
  property = property_1;

/**
 * The base implementation of `_.iteratee`.
 *
 * @private
 * @param {*} [value=_.identity] The value to convert to an iteratee.
 * @returns {Function} Returns the iteratee.
 */
function baseIteratee$1(value) {
  // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  if (typeof value == 'function') {
    return value;
  }
  if (value == null) {
    return identity;
  }
  if (_typeof(value) == 'object') {
    return isArray(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value);
  }
  return property(value);
}
var _baseIteratee = baseIteratee$1;

var baseUnset = _baseUnset,
  isIndex = _isIndex;

/** Used for built-in method references. */
var arrayProto = Array.prototype;

/** Built-in value references. */
var splice = arrayProto.splice;

/**
 * The base implementation of `_.pullAt` without support for individual
 * indexes or capturing the removed elements.
 *
 * @private
 * @param {Array} array The array to modify.
 * @param {number[]} indexes The indexes of elements to remove.
 * @returns {Array} Returns `array`.
 */
function basePullAt$1(array, indexes) {
  var length = array ? indexes.length : 0,
    lastIndex = length - 1;
  while (length--) {
    var index = indexes[length];
    if (length == lastIndex || index !== previous) {
      var previous = index;
      if (isIndex(index)) {
        splice.call(array, index, 1);
      } else {
        baseUnset(array, index);
      }
    }
  }
  return array;
}
var _basePullAt = basePullAt$1;

var baseIteratee = _baseIteratee,
  basePullAt = _basePullAt;

/**
 * Removes all elements from `array` that `predicate` returns truthy for
 * and returns an array of the removed elements. The predicate is invoked
 * with three arguments: (value, index, array).
 *
 * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
 * to pull elements from an array by value.
 *
 * @static
 * @memberOf _
 * @since 2.0.0
 * @category Array
 * @param {Array} array The array to modify.
 * @param {Function} [predicate=_.identity] The function invoked per iteration.
 * @returns {Array} Returns the new array of removed elements.
 * @example
 *
 * var array = [1, 2, 3, 4];
 * var evens = _.remove(array, function(n) {
 *   return n % 2 == 0;
 * });
 *
 * console.log(array);
 * // => [1, 3]
 *
 * console.log(evens);
 * // => [2, 4]
 */
function remove(array, predicate) {
  var result = [];
  if (!(array && array.length)) {
    return result;
  }
  var index = -1,
    indexes = [],
    length = array.length;
  predicate = baseIteratee(predicate, 3);
  while (++index < length) {
    var value = array[index];
    if (predicate(value, index, array)) {
      result.push(value);
      indexes.push(index);
    }
  }
  basePullAt(array, indexes);
  return result;
}
var remove_1 = remove;

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; }
function _isSlot(s) {
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
}
var _Calendar = defineComponent({
  name: "TCalendar",
  props: _objectSpread({}, props),
  setup: function setup(props2, _ref) {
    var slots = _ref.slots;
    var renderContent = useContent();
    var _useConfig = useConfig(COMPONENT_NAME),
      t = _useConfig.t,
      globalConfig = _useConfig.globalConfig;
    var _useState = useState(props2),
      state = _useState.state,
      toToday = _useState.toToday,
      checkDayVisible = _useState.checkDayVisible;
    var cls = useCalendarClass(props2, state);
    var _useColHeaders = useColHeaders(props2, state),
      cellColHeaders = _useColHeaders.cellColHeaders;
    var controller = userController(props2, state);
    var rangeFromTo = computed(function () {
      if (!props2.range || props2.range.length < 2) return null;
      var _props2$range = _slicedToArray(props2.range, 2),
        v1 = _props2$range[0],
        v2 = _props2$range[1];
      if (dayjs(v1).isBefore(dayjs(v2))) {
        return {
          from: v1,
          to: v2
        };
      }
      return {
        from: v2,
        to: v1
      };
    });
    function checkMonthAndYearSelectedDisabled(year, month) {
      var disabled = false;
      if (rangeFromTo.value && rangeFromTo.value.from && rangeFromTo.value.to) {
        var beginYear = dayjs(rangeFromTo.value.from).year();
        var endYear = dayjs(rangeFromTo.value.to).year();
        if (year === beginYear) {
          var beginMon = parseInt(dayjs(rangeFromTo.value.from).format("M"), 10);
          disabled = month < beginMon;
        } else if (year === endYear) {
          var endMon = parseInt(dayjs(rangeFromTo.value.to).format("M"), 10);
          disabled = month > endMon;
        }
      }
      return disabled;
    }
    watch(function () {
      return {
        year: "".concat(state.curSelectedYear),
        month: "".concat(state.curSelectedMonth)
      };
    }, function (v) {
      isFunction_1(props2.onMonthChange) && props2.onMonthChange(_objectSpread({}, v));
      controller.emitControllerChange();
    });
    var dateSelect = {
      yearSelectOptionList: computed(function () {
        var re = [];
        var begin = state.curSelectedYear - 10;
        var end = state.curSelectedYear + 10;
        if (rangeFromTo.value && rangeFromTo.value.from && rangeFromTo.value.to) {
          begin = dayjs(rangeFromTo.value.from).year();
          end = dayjs(rangeFromTo.value.to).year();
        }
        if (begin < MIN_YEAR) begin = MIN_YEAR;
        if (end < MIN_YEAR) end = MIN_YEAR;
        for (var i = begin; i <= end; i++) {
          var disabled = checkMonthAndYearSelectedDisabled(i, state.curSelectedMonth);
          re.push({
            value: i,
            label: t(globalConfig.value.yearSelection, {
              year: i
            }),
            disabled: disabled
          });
        }
        return re;
      }),
      isYearSelectVisible: computed(function () {
        return controller.checkControllerVisible("year");
      }),
      isYearSelectDisabled: computed(function () {
        return controller.checkControllerDisabled("year", "selectProps");
      }),
      monthSelectOptionList: computed(function () {
        var re = [];
        for (var i = FIRST_MONTH_OF_YEAR; i <= LAST_MONTH_OF_YEAR; i++) {
          var disabled = checkMonthAndYearSelectedDisabled(state.curSelectedYear, i);
          re.push({
            value: i,
            label: t(globalConfig.value.monthSelection, {
              month: i
            }),
            disabled: disabled
          });
        }
        return re;
      }),
      isMonthSelectVisible: computed(function () {
        return state.curSelectedMode === "month" && controller.checkControllerVisible("month");
      }),
      isMonthSelectDisabled: computed(function () {
        return controller.checkControllerDisabled("month", "selectProps");
      })
    };
    var modeSelect = {
      optionList: computed(function () {
        return [{
          value: "month",
          label: t(globalConfig.value.monthRadio)
        }, {
          value: "year",
          label: t(globalConfig.value.yearRadio)
        }];
      }),
      isVisible: computed(function () {
        return controller.checkControllerVisible("mode");
      }),
      isDisabled: computed(function () {
        return controller.checkControllerDisabled("mode", "radioGroupProps");
      })
    };
    var weekendBtn = {
      text: computed(function () {
        return state.isShowWeekend ? t(globalConfig.value.hideWeekend) : t(globalConfig.value.showWeekend);
      }),
      vBind: computed(function () {
        var c = controller.configData.value.weekend;
        return state.isShowWeekend ? c.hideWeekendButtonProps : c.showWeekendButtonProps;
      }),
      isVisible: computed(function () {
        return props2.theme === "full" && controller.checkControllerVisible("current") && controller.checkControllerVisible("weekend");
      }),
      isDisabled: computed(function () {
        var p = state.isShowWeekend ? "hideWeekendButtonProps" : "showWeekendButtonProps";
        return controller.checkControllerDisabled("weekend", p);
      })
    };
    var currentBtn = {
      text: computed(function () {
        return state.curSelectedMode === "month" ? t(globalConfig.value.today) : t(globalConfig.value.thisMonth);
      }),
      vBind: computed(function () {
        var c = controller.configData.value.current;
        return state.curSelectedMode === "month" ? c.currentDayButtonProps : c.currentMonthButtonProps;
      }),
      isVisible: computed(function () {
        return props2.theme === "full" && controller.checkControllerVisible("current");
      }),
      isDisabled: computed(function () {
        var p = state.curSelectedMode === "month" ? "currentDayButtonProps" : "currentMonthButtonProps";
        return controller.checkControllerDisabled("current", p);
      })
    };
    var renderControl = function renderControl() {
      var _slot;
      return createVNode("div", {
        "class": cls.control.value
      }, [createVNode("div", {
        "class": cls.title.value
      }, [renderContent("head", void 0, {
        params: _objectSpread({}, controller.options.value)
      })]), createVNode("div", {
        "class": cls.controlSection.value
      }, [dateSelect.isYearSelectVisible.value && createVNode("div", {
        "class": cls.controlSectionCell.value
      }, [createVNode(Select, mergeProps({
        "modelValue": state.curSelectedYear,
        "onUpdate:modelValue": function onUpdateModelValue($event) {
          return state.curSelectedYear = $event;
        },
        "size": state.controlSize,
        "autoWidth": true
      }, controller.configData.value.year.selectProps, {
        "disabled": dateSelect.isYearSelectDisabled.value,
        "options": dateSelect.yearSelectOptionList.value
      }), null)]), dateSelect.isMonthSelectVisible.value && createVNode("div", {
        "class": cls.controlSectionCell.value
      }, [createVNode(Select, mergeProps({
        "autoWidth": true,
        "modelValue": state.curSelectedMonth,
        "onUpdate:modelValue": function onUpdateModelValue($event) {
          return state.curSelectedMonth = $event;
        },
        "size": state.controlSize
      }, controller.configData.value.month.selectProps, {
        "disabled": dateSelect.isMonthSelectDisabled.value,
        "options": dateSelect.monthSelectOptionList.value
      }), null)]), modeSelect.isVisible.value && createVNode("div", {
        "class": cls.controlSectionCell.value,
        "style": "height: auto"
      }, [createVNode(RadioGroup, mergeProps({
        "modelValue": state.curSelectedMode,
        "onUpdate:modelValue": function onUpdateModelValue($event) {
          return state.curSelectedMode = $event;
        },
        "variant": "default-filled",
        "size": state.controlSize
      }, controller.configData.value.mode.radioGroupProps, {
        "disabled": modeSelect.isDisabled.value,
        "onChange": controller.emitControllerChange
      }), _isSlot(_slot = modeSelect.optionList.value.map(function (item) {
        return createVNode(RadioButton, {
          "key": item.value,
          "value": item.value
        }, {
          "default": function _default() {
            return [item.label];
          }
        });
      })) ? _slot : {
        "default": function _default() {
          return [_slot];
        }
      })]), weekendBtn.isVisible.value && createVNode("div", {
        "class": cls.controlSectionCell.value
      }, [createVNode(CheckTag, mergeProps({
        "class": cls.controlTag.value,
        "theme": state.isShowWeekend ? "default" : "primary",
        "size": "large"
      }, weekendBtn.vBind.value, {
        "disabled": weekendBtn.isDisabled.value,
        "onClick": function onClick() {
          state.isShowWeekend = !state.isShowWeekend;
          controller.emitControllerChange();
        }
      }), {
        "default": function _default() {
          return [weekendBtn.text.value];
        }
      })]), currentBtn.isVisible.value && createVNode("div", {
        "class": cls.controlSectionCell.value
      }, [createVNode(Button, mergeProps({
        "size": state.controlSize
      }, currentBtn.vBind.value, {
        "disabled": currentBtn.isDisabled.value,
        "onClick": function onClick() {
          toToday();
        }
      }), {
        "default": function _default() {
          return [currentBtn.text.value];
        }
      })])])]);
    };
    var cellClickEmit = function cellClickEmit(eventPropsName, e, cellData) {
      if (isFunction_1(props2[eventPropsName])) {
        var options = {
          cell: _objectSpread(_objectSpread({}, cellData), controller.options.value),
          e: e
        };
        props2[eventPropsName](options);
      }
    };
    var clickCell = function clickCell(e, cellData) {
      var d = dayjs(cellData.date);
      if (props2.multiple) {
        if (state.curDateList.find(function (item) {
          return item.isSame(d);
        })) state.curDateList = remove_1(state.curDateList, function (item) {
          return !item.isSame(d);
        });else state.curDateList.push(d);
      } else {
        state.curDate = d;
      }
      cellClickEmit("onCellClick", e, cellData);
    };
    var doubleClickCell = function doubleClickCell(e, cellData) {
      cellClickEmit("onCellDoubleClick", e, cellData);
    };
    var rightClickCell = function rightClickCell(e, cellData) {
      if (props2.preventCellContextmenu) e.preventDefault();
      cellClickEmit("onCellRightClick", e, cellData);
    };
    var monthCellsData = computed(function () {
      var daysArr = createMonthCellsData(props2, state);
      return daysArr;
    });
    var renderMonthBody = function renderMonthBody() {
      return createVNode("table", {
        "class": cls.table.value
      }, [createVNode("thead", {
        "class": cls.tableHead.value
      }, [createVNode("tr", {
        "class": cls.tableHeadRow.value
      }, [cellColHeaders.value.map(function (item, index) {
        return checkDayVisible(item.num) && createVNode("th", {
          "class": cls.tableHeadCell.value
        }, [isArray_1(props2.week) ? props2.week[index] : renderContent("week", void 0, {
          defaultNode: createVNode("span", null, [item.display]),
          params: {
            day: item.num
          }
        })]);
      })])]), createVNode("tbody", {
        "class": cls.tableBody.value
      }, [monthCellsData.value.map(function (week, weekIndex) {
        return createVNode("tr", {
          "class": cls.tableBodyRow.value
        }, [week.map(function (item, itemIndex) {
          return (state.isShowWeekend || item.day < 6) && createVNode(CalendarCellItem, {
            "key": "d-".concat(weekIndex, "-").concat(itemIndex),
            "item": item,
            "theme": props2.theme,
            "t": t,
            "global": globalConfig.value,
            "cell": props2.cell,
            "cellAppend": props2.cellAppend,
            "fillWithZero": props2.fillWithZero,
            "onClick": function onClick(e) {
              return clickCell(e, item);
            },
            "onDblclick": function onDblclick(e) {
              return doubleClickCell(e, item);
            },
            "onRightclick": function onRightclick(e) {
              return rightClickCell(e, item);
            }
          }, _objectSpread({}, slots));
        })]);
      })])]);
    };
    var yearCellsData = computed(function () {
      var re = [];
      var monthsArr = createYearCellsData(props2, state);
      var rowCount = Math.ceil(monthsArr.length / DEFAULT_YEAR_CELL_NUMINROW);
      var index = 0;
      for (var i = 1; i <= rowCount; i++) {
        var row = [];
        for (var j = 1; j <= DEFAULT_YEAR_CELL_NUMINROW; j++) {
          row.push(monthsArr[index]);
          index += 1;
        }
        re.push(row);
      }
      return re;
    });
    var renderYearBody = function renderYearBody() {
      return createVNode("table", {
        "class": cls.table.value
      }, [createVNode("tbody", {
        "class": cls.tableBody.value
      }, [yearCellsData.value.map(function (cell, cellIndex) {
        return createVNode("tr", {
          "class": cls.tableBodyRow.value
        }, [cell.map(function (item, itemIndex) {
          return createVNode(CalendarCellItem, {
            "key": "m-".concat(cellIndex, "-").concat(itemIndex),
            "item": item,
            "theme": props2.theme,
            "t": t,
            "global": globalConfig.value,
            "cell": props2.cell,
            "cellAppend": props2.cellAppend,
            "fillWithZero": props2.fillWithZero,
            "onClick": function onClick(e) {
              return clickCell(e, item);
            },
            "onDblclick": function onDblclick(e) {
              return doubleClickCell(e, item);
            },
            "onRightclick": function onRightclick(e) {
              return rightClickCell(e, item);
            }
          }, _objectSpread({}, slots));
        })]);
      })])]);
    };
    return function () {
      return createVNode("div", {
        "class": cls.body.value
      }, [controller.visible.value && renderControl(), createVNode("div", {
        "class": cls.panel.value
      }, [state.curSelectedMode === "month" ? renderMonthBody() : renderYearBody()])]);
    };
  }
});

export { _Calendar as default };
//# sourceMappingURL=calendar.mjs.map
