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

import LoadingPlugin from './plugin.js';
import '@babel/runtime/helpers/defineProperty';
import 'vue';
import '../utils/dom.js';
import '../_chunks/dep-2e5d8948.js';
import 'lodash/isString';
import 'lodash/isFunction';
import 'lodash/isArray';
import '../utils/easing.js';
import '../hooks/useConfig.js';
import '../config-provider/useConfig.js';
import 'lodash/cloneDeep';
import '../config-provider/context.js';
import 'lodash/mergeWith';
import 'lodash/merge';
import '../_common/js/global-config/default-config.js';
import '../_common/js/global-config/locale/zh_CN.js';
import '@babel/runtime/helpers/typeof';
import 'dayjs';
import '../_chunks/dep-4580aabe.js';
import '../config-provider/type.js';
import './loading.js';
import '@babel/runtime/helpers/slicedToArray';
import '../utils/render-tnode.js';
import 'lodash/isEmpty';
import 'lodash/isObject';
import 'lodash/camelCase';
import 'lodash/kebabCase';
import '../hooks/useTeleport.js';
import './props.js';
import './icon/gradient.js';
import '../_common/js/loading/circle-adapter.js';
import '../_common/js/utils/set-style.js';
import '../_common/js/utils/helper.js';
import '@babel/runtime/helpers/toConsumableArray';
import '@babel/runtime/helpers/objectWithoutProperties';
import 'lodash/isNull';
import 'lodash/isUndefined';
import 'lodash/isNumber';

var INSTANCE_KEY = Symbol("TdLoading");
var createInstance = function createInstance(el, binding) {
  var _binding$modifiers = binding.modifiers,
    fullscreen = _binding$modifiers.fullscreen,
    inheritColor = _binding$modifiers.inheritColor;
  var options = {
    attach: function attach() {
      return el;
    },
    fullscreen: fullscreen !== null && fullscreen !== void 0 ? fullscreen : false,
    inheritColor: inheritColor !== null && inheritColor !== void 0 ? inheritColor : false,
    loading: binding.value
  };
  el[INSTANCE_KEY] = {
    options: options,
    instance: LoadingPlugin(options)
  };
};
var vLoading = {
  mounted: function mounted(el, binding) {
    if (binding.value) createInstance(el, binding);
  },
  updated: function updated(el, binding) {
    var instance = el[INSTANCE_KEY];
    var value = binding.value,
      oldValue = binding.oldValue;
    if (!!oldValue !== !!value) {
      if (value) createInstance(el, binding);else instance === null || instance === void 0 ? void 0 : instance.instance.hide();
    }
  },
  unmounted: function unmounted(el) {
    var _el$INSTANCE_KEY;
    (_el$INSTANCE_KEY = el[INSTANCE_KEY]) === null || _el$INSTANCE_KEY === void 0 ? void 0 : _el$INSTANCE_KEY.instance.hide();
  }
};

export { vLoading };
//# sourceMappingURL=directive.js.map
