"use strict";
const vue = require("vue");
const icons = require("../_utils/icons.js");
const index = require("../layer/index.js");
const types = require("./types.js");
const dom = require("../_utils/dom.js");
const _hoisted_1 = { class: "o-loading-icon" };
const _hoisted_2 = {
  key: 0,
  class: "o-loading-label"
};
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
  __name: "OLoading",
  props: types.loadingProps,
  emits: ["change", "update:visible"],
  setup(__props, { expose: __expose, emit: __emit }) {
    const props = __props;
    const emits = __emit;
    const layerRef = vue.ref(null);
    __expose({
      toggle(show) {
        var _a;
        (_a = layerRef.value) == null ? void 0 : _a.toggle(show);
      }
    });
    return (_ctx, _cache) => {
      return vue.openBlock(), vue.createBlock(vue.unref(index.OLayer), {
        ref_key: "layerRef",
        ref: layerRef,
        class: "o-loading",
        visible: props.visible,
        wrapper: props.wrapper,
        "unmount-on-hide": props.unmountOnHide,
        "main-class": vue.unref(dom.mergeClass)("o-loading-main", props.mainClass),
        "main-transition": props.mainTransition,
        "mask-transition": props.maskTransition,
        "transition-orign": "css",
        mask: props.mask,
        "mask-close": false,
        onChange: _cache[0] || (_cache[0] = (v) => emits("change", v)),
        "onUpdate:visible": _cache[1] || (_cache[1] = (v, e) => emits("update:visible", v, e))
      }, {
        default: vue.withCtx(() => [
          vue.renderSlot(_ctx.$slots, "default", {}, () => [
            vue.createElementVNode("div", _hoisted_1, [
              vue.renderSlot(_ctx.$slots, "icon", {}, () => [
                props.icon ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(props.icon), {
                  key: 0,
                  class: vue.normalizeClass({ "o-rotating": props.iconRotating })
                }, null, 8, ["class"])) : (vue.openBlock(), vue.createBlock(vue.unref(icons.IconLoading), {
                  key: 1,
                  class: "o-rotating"
                }))
              ])
            ]),
            _ctx.$slots.label || props.label ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2, [
              vue.renderSlot(_ctx.$slots, "label", {}, () => [
                vue.createTextVNode(
                  vue.toDisplayString(props.label),
                  1
                  /* TEXT */
                )
              ])
            ])) : vue.createCommentVNode("v-if", true)
          ])
        ]),
        _: 3
        /* FORWARDED */
      }, 8, ["visible", "wrapper", "unmount-on-hide", "main-class", "main-transition", "mask-transition", "mask"]);
    };
  }
});
module.exports = _sfc_main;
