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

'use strict';

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

var Vue = require('vue');
var cloneDeep = require('lodash/cloneDeep');
var configProvider_context = require('./context.js');
require('lodash/merge');
require('lodash/mergeWith');
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-7c884501.js');
require('dayjs');

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

var Vue__default = /*#__PURE__*/_interopDefaultLegacy(Vue);
var cloneDeep__default = /*#__PURE__*/_interopDefaultLegacy(cloneDeep);

var globalConfigSymbol = "__TDESIGN__INSTANCE__GLOBAL__CONFIG__";
var ConfigProvider = Vue__default["default"].extend({
  name: "TConfigProvider",
  provide: function provide() {
    return {
      globalConfig: this.mergedGlobalConfig
    };
  },
  props: {
    globalConfig: Object
  },
  data: function data() {
    return {
      defaultData: cloneDeep__default["default"](configProvider_context.defaultGlobalConfig)
    };
  },
  computed: {
    mergedGlobalConfig: function mergedGlobalConfig() {
      var mergedGlobalConfig = configProvider_context.mergeWith(this.defaultData, this.globalConfig);
      Vue__default["default"].prototype[globalConfigSymbol] = mergedGlobalConfig;
      return mergedGlobalConfig;
    }
  },
  render: function render() {
    var _this$$slots$default;
    var h = arguments[0];
    if (((_this$$slots$default = this.$slots["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.length) === 1) return this.$slots["default"][0];
    return h("div", [this.$slots["default"]]);
  }
});

exports["default"] = ConfigProvider;
exports.globalConfigSymbol = globalConfigSymbol;
//# sourceMappingURL=config-provider.js.map
