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

'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var vue = require('vue');
var isObject = require('lodash/isObject');
var configProvider_useConfig = require('../../config-provider/useConfig.js');
var calendar_const = require('../const.js');
var calendar_utils = require('../utils.js');
require('lodash/cloneDeep');
require('lodash/isFunction');
require('lodash/isString');
require('../../config-provider/context.js');
require('lodash/mergeWith');
require('lodash/merge');
require('lodash/isArray');
require('../../_common/js/global-config/default-config.js');
require('../../_common/js/global-config/locale/zh_CN.js');
require('@babel/runtime/helpers/typeof');
require('../../_chunks/dep-f4db2590.js');
require('dayjs');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var isObject__default = /*#__PURE__*/_interopDefaultLegacy(isObject);

function useColHeaders(props, state) {
  var _useConfig = configProvider_useConfig.useConfig(calendar_const.COMPONENT_NAME),
    t = _useConfig.t,
    globalConfig = _useConfig.globalConfig;
  var weekDipalyText = vue.computed(function () {
    return props.week || t(globalConfig.value.week).split(",");
  });
  function getWeekDisplay(weekNum) {
    var weekText = weekDipalyText.value;
    return isObject__default["default"](weekText) && weekText[weekNum - 1] ? weekText[weekNum - 1] : calendar_utils.getDayCn(weekNum);
  }
  var cellColHeaders = vue.computed(function () {
    var re = [];
    var min = 1;
    var max = 7;
    for (var i = state.realFirstDayOfWeek; i <= max; i++) {
      re.push({
        num: i,
        display: getWeekDisplay(i)
      });
    }
    if (state.realFirstDayOfWeek > min) {
      for (var _i = min; _i < state.realFirstDayOfWeek; _i++) {
        re.push({
          num: _i,
          display: getWeekDisplay(_i)
        });
      }
    }
    return re;
  });
  return {
    cellColHeaders: cellColHeaders
  };
}

exports.useColHeaders = useColHeaders;
//# sourceMappingURL=useColHeaders.js.map
