(function(d,r){typeof exports=="object"&&typeof module!="undefined"?r(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],r):(d=typeof globalThis!="undefined"?globalThis:d||self,r(d.index={},d.Vue))})(this,function(d,r){"use strict";class y{constructor(){this.top="50%",this.left="50%"}}const h={message:String,backdrop:Boolean,view:{type:Object,default:()=>new y},zIndex:Number,isFull:{type:Boolean,default:!1}};class m{constructor(){this.backdrop=!0,this.positionType="relative",this.view=new y}}function u(e,o,n){let t=e;return o&&(t+=`__${o}`),n&&(t+=`--${n}`),t}function P(e,o=!1){const n=o?`.devui-${e}`:`devui-${e}`;return{b:()=>u(n),e:c=>c?u(n,c):"",m:c=>c?u(n,"",c):"",em:(c,f)=>c&&f?u(n,c,f):""}}var j="",b=r.defineComponent({name:"DLoading",inheritAttrs:!1,props:h,setup(e){const o={top:e.view.top,left:e.view.left,zIndex:e.zIndex};e.message||(o.background="none");const n=r.ref(!1);return{style:o,isShow:n,open:()=>{n.value=!0},close:()=>{n.value=!1}}},render(){var c;const{isShow:e,isFull:o,backdrop:n,style:t,message:s,$slots:a}=this,i=P("loading");return e&&r.createVNode("div",{class:[i.b(),o?i.m("full"):""]},[((c=a.default)==null?void 0:c.call(a))||r.createVNode("div",{class:i.e("wrapper")},[n?r.createVNode("div",{class:i.e("mask")},null):null,r.createVNode("div",{style:t,class:i.e("area")},[r.createVNode("div",{class:i.e("busy-default-spinner")},[r.createVNode("div",{class:i.e("bar1")},null),r.createVNode("div",{class:i.e("bar2")},null),r.createVNode("div",{class:i.e("bar3")},null),r.createVNode("div",{class:i.e("bar4")},null)]),s?r.createVNode("span",{class:i.e("text")},[s]):null])])])}});const v=Symbol("dev_component_container");function w(e,o,n=null){const t=r.h(e,{...o},n),s=document.createElement("div");return t[v]=s,r.render(t,s),t.component}function k(e){r.render(null,e==null?void 0:e.vnode[v])}const O=r.defineComponent(b),l=new WeakSet,g=e=>{if(!e)return!0;if(Array.isArray(e))return e.length===0;if(e instanceof Set||e instanceof Map)return e.size===0;if(e instanceof Promise)return!1;if(typeof e=="object")try{return Object.keys(e).length===0}catch{return!1}return!1},N=e=>Object.prototype.toString.call(e).slice(8,-1).toLowerCase(),C=e=>{switch(N(e)){case"promise":return[e];case"array":return e.some(n=>N(n)!=="promise")?(console.error(new TypeError("Binding values should all be of type Promise")),"error"):e;default:return!1}},T=e=>{l.delete(e),e.instance.proxy.close(),k(e.instance)},A=(e,o)=>{var n,t,s;if(o.value){const a=C(o.value);if(a==="error")return;(s=(t=(n=e==null?void 0:e.instance)==null?void 0:n.proxy)==null?void 0:t.open)==null||s.call(t),e.appendChild(e.mask),l.add(e),a&&Promise.all(a).catch(i=>{console.error(new Error("Promise handling errors"),i)}).finally(()=>{T(e)})}else T(e)},x=e=>{e.removeAttribute("zindex"),e.removeAttribute("positiontype"),e.removeAttribute("backdrop"),e.removeAttribute("message"),e.removeAttribute("view"),e.removeAttribute("loadingtemplateref")},S=(e,o)=>{var a;const n={...new m,...o},t=n.loadingTemplateRef,s=w(O,{...n},t?()=>t:null);e.style.position=n.positionType,e.options=n,e.instance=s,e.mask=(a=s==null?void 0:s.proxy)==null?void 0:a.$el},V={mounted:function(e,o,n){S(e,n.props),x(e),!g(o.value)&&A(e,o)},updated:function(e,o,n){!g(o.value)&&l.has(e)||g(o.value)&&!l.has(e)||(!l.has(e)&&S(e,n.props),x(e),A(e,o))}},_=r.defineComponent(b),p=new WeakMap,L={open(e={}){var a,i,c;const o=e.target||document.body;if(p.has(o))return p.get(o);o.style&&(o.style.position=e.positionType);const n=document.body===o;e={...new m,...e};const t=w(_,{...e,isFull:n},e.loadingTemplateRef?()=>e.loadingTemplateRef:null);p.set(o,t),(a=t==null?void 0:t.proxy)==null||a.open(),o.appendChild((i=t==null?void 0:t.proxy)==null?void 0:i.$el);const s=(c=t==null?void 0:t.proxy)==null?void 0:c.close;return t&&(t.loadingInstance=t==null?void 0:t.proxy,t.loadingInstance&&(t.loadingInstance.close=(...f)=>{p.delete(o),s==null||s(...f)})),t}};var $={title:"Loading \u52A0\u8F7D\u63D0\u793A",category:"\u53CD\u9988",status:"100%",install(e){e.directive("dLoading",V),e.config.globalProperties.$loadingService=L}};d.Loading=V,d.LoadingOptions=m,d.LoadingService=L,d.default=$,d.loadingProps=h,Object.defineProperties(d,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
