/**
 * ldesign v0.2.22
 * (c) 2022/12/7 16:21 built by swimly
 * @license MIT
 */

import Vue from 'vue';
import props from '../props.js';
import { removeDom, getAttach } from '../../../utils/dom.js';
import 'raf';
import 'lodash/isString';
import '../../../_chunks/dep-eaa95999.js';
import '../../../_chunks/dep-102361be.js';
import '../../../utils/easing.js';

var Container = Vue.extend({
  props: {
    mode: props.mode,
    renderModal: Function,
    renderViewer: Function
  },
  data() {
    return {
      content: null,
      timer: null
    };
  },
  methods: {
    mountContent() {
      clearTimeout(this.timer);
      if (this.content) return;
      const _this = this;
      const elm = document.createElement("div");
      elm.style.cssText = "position: absolute; top: 0px; left: 0px; width: 100%";
      this.content = new this.$root.constructor({
        render() {
          return _this.mode === "modeless" ? _this.renderModal() : _this.renderViewer();
        },
        destroyed() {
          if (_this.content.$el) removeDom(_this.content.$el);
          _this.content = null;
        }
      });
      getAttach(document.body).appendChild(elm);
      this.content.$mount(elm);
    },
    unmountContent() {
      clearTimeout(this.timer);
      this.timer = setTimeout(() => {
        this.content?.$destroy?.();
      }, 200);
    }
  },
  render() {
    const h = arguments[0];
    const children = this.$slots.default || [];
    if (children.length > 1 || !children[0]?.tag) return h("span", [children]);
    return children[0];
  }
});

export { Container as default };
//# sourceMappingURL=Container.js.map
