import e from"../_util/props-util/initDefaultProps.mjs";import{filterEmpty as t,getPropsSlot as n}from"../_util/props-util/index.mjs";import r from"../config-provider/hooks/useConfigInject.mjs";import i from"../_util/vue-types/index.mjs";import{debounce as a}from"../node_modules/.pnpm/throttle-debounce@5.0.2/node_modules/throttle-debounce/esm/index.mjs";import o from"./style/index.mjs";import{cloneVNode as s,createVNode as c,defineComponent as l,isVNode as u,onBeforeUnmount as d,shallowRef as f,watch as p}from"vue";var m=()=>({prefixCls:String,spinning:{type:Boolean,default:void 0},size:String,wrapperClassName:String,tip:i.any,delay:Number,indicator:i.any}),h=null;function g(e,t){return!!e&&!!t&&!isNaN(Number(t))}function _(e){let t=e.indicator;h=typeof t==`function`?t:()=>c(t,null,null)}var v=l({compatConfig:{MODE:3},name:`ASpin`,inheritAttrs:!1,props:e(m(),{size:`default`,spinning:!0,wrapperClassName:``}),setup(e,{attrs:i,slots:l}){let{prefixCls:m,size:_,direction:v}=r(`spin`,e),[y,b]=o(m),x=f(e.spinning&&!g(e.spinning,e.delay)),S;return p([()=>e.spinning,()=>e.delay],()=>{S?.cancel(),S=a(e.delay,()=>{x.value=e.spinning}),S?.()},{immediate:!0,flush:`post`}),d(()=>{S?.cancel()}),()=>{let{class:r,...a}=i,{tip:o=l.tip?.()}=e,d=l.default?.(),f={[b.value]:!0,[m.value]:!0,[`${m.value}-sm`]:_.value===`small`,[`${m.value}-lg`]:_.value===`large`,[`${m.value}-spinning`]:x.value,[`${m.value}-show-text`]:!!o,[`${m.value}-rtl`]:v.value===`rtl`,[r]:!!r};function p(t){let r=`${t}-dot`,i=n(l,e,`indicator`);return i===null?null:(Array.isArray(i)&&(i=i.length===1?i[0]:i),u(i)?s(i,{class:r}):h&&u(h())?s(h(),{class:r}):c(`span`,{class:`${r} ${t}-dot-spin`},[c(`i`,{class:`${t}-dot-item`},null),c(`i`,{class:`${t}-dot-item`},null),c(`i`,{class:`${t}-dot-item`},null),c(`i`,{class:`${t}-dot-item`},null)]))}let g=c(`div`,{...a,class:f,"aria-live":`polite`,"aria-busy":x.value},[p(m.value),o?c(`div`,{class:`${m.value}-text`},[o]):null]);if(d&&t(d).length){let t={[`${m.value}-container`]:!0,[`${m.value}-blur`]:x.value};return y(c(`div`,{class:[`${m.value}-nested-loading`,e.wrapperClassName,b.value]},[x.value&&c(`div`,{key:`loading`},[g]),c(`div`,{class:t,key:`container`},[d])]))}return y(g)}}});export{v as default,_ as setDefaultIndicator,m as spinProps};