import{aq as M,ar as D,m as L,r as c,C as B,g as _,w as q,Z as H,h as E,d as b,M as U,x as k,A as w,t as V}from"./index-C9R49v6m.js";var X=/\s/;function Z(e){for(var n=e.length;n--&&X.test(e.charAt(n)););return n}var G=Z,J=G,K=/^\s+/;function Q(e){return e&&e.slice(0,J(e)+1).replace(K,"")}var Y=Q;function ee(e){var n=typeof e;return e!=null&&(n=="object"||n=="function")}var z=ee,ne=Y,A=z,te=M,R=NaN,re=/^[-+]0x[0-9a-f]+$/i,ae=/^0b[01]+$/i,ie=/^0o[0-7]+$/i,se=parseInt;function ce(e){if(typeof e=="number")return e;if(te(e))return R;if(A(e)){var n=typeof e.valueOf=="function"?e.valueOf():e;e=A(n)?n+"":n}if(typeof e!="string")return e===0?e:+e;e=ne(e);var t=ae.test(e);return t||ie.test(e)?se(e.slice(2),t?2:8):re.test(e)?R:+e}var oe=ce,le=D,ue=function(){return le.Date.now()},de=ue,fe=z,j=de,W=oe,me="Expected a function",ve=Math.max,pe=Math.min;function ge(e,n,t){var r,i,o,l,s,u,f=0,h=!1,g=!1,N=!0;if(typeof e!="function")throw new TypeError(me);n=W(n)||0,fe(t)&&(h=!!t.leading,g="maxWait"in t,o=g?ve(W(t.maxWait)||0,n):o,N="trailing"in t?!!t.trailing:N);function C(a){var d=r,p=i;return r=i=void 0,f=a,l=e.apply(p,d),l}function P(a){return f=a,s=setTimeout(x,n),h?C(a):l}function I(a){var d=a-u,p=a-f,S=n-d;return g?pe(S,o-p):S}function y(a){var d=a-u,p=a-f;return u===void 0||d>=n||d<0||g&&p>=o}function x(){var a=j();if(y(a))return O(a);s=setTimeout(x,I(a))}function O(a){return s=void 0,N&&r?C(a):(r=i=void 0,l)}function $(){s!==void 0&&clearTimeout(s),f=0,r=u=i=s=void 0}function m(){return s===void 0?l:O(j())}function v(){var a=j(),d=y(a);if(r=arguments,i=this,u=a,d){if(s===void 0)return P(u);if(g)return clearTimeout(s),s=setTimeout(x,n),C(u)}return s===void 0&&(s=setTimeout(x,n)),l}return v.cancel=$,v.flush=m,v}var ye=ge;const Ne=L(ye);var xe=function(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)n.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(t[r[i]]=e[r[i]]);return t};V("small","default","large");var T=null;function be(e,n){var t=n.indicator,r="".concat(e,"-dot");return t===null?null:k(t)?w(t,{className:E(t.props.className,r)}):k(T)?w(T,{className:E(T.props.className,r)}):c.createElement("span",{className:E(r,"".concat(e,"-dot-spin"))},c.createElement("i",{className:"".concat(e,"-dot-item")}),c.createElement("i",{className:"".concat(e,"-dot-item")}),c.createElement("i",{className:"".concat(e,"-dot-item")}),c.createElement("i",{className:"".concat(e,"-dot-item")}))}function Ee(e,n){return!!e&&!!n&&!isNaN(Number(n))}var Ce=function(n){var t=n.spinPrefixCls,r=n.spinning,i=r===void 0?!0:r,o=n.delay,l=n.className,s=n.size,u=s===void 0?"default":s,f=n.tip,h=n.wrapperClassName,g=n.style,N=n.children,C=xe(n,["spinPrefixCls","spinning","delay","className","size","tip","wrapperClassName","style","children"]),P=c.useState(function(){return i&&!Ee(i,o)}),I=q(P,2),y=I[0],x=I[1];c.useEffect(function(){var m=Ne(function(){x(i)},o);return m(),function(){var v;(v=m==null?void 0:m.cancel)===null||v===void 0||v.call(m)}},[o,i]);var O=function(){return typeof N<"u"},$=function(v){var a=v.direction,d=E(t,b(b(b(b(b({},"".concat(t,"-sm"),u==="small"),"".concat(t,"-lg"),u==="large"),"".concat(t,"-spinning"),y),"".concat(t,"-show-text"),!!f),"".concat(t,"-rtl"),a==="rtl"),l),p=U(C,["indicator","prefixCls"]),S=c.createElement("div",_({},p,{style:g,className:d,"aria-live":"polite","aria-busy":y}),be(t,n),f?c.createElement("div",{className:"".concat(t,"-text")},f):null);if(O()){var F=E("".concat(t,"-container"),b({},"".concat(t,"-blur"),y));return c.createElement("div",_({},p,{className:E("".concat(t,"-nested-loading"),h)}),y&&c.createElement("div",{key:"loading"},S),c.createElement("div",{className:F,key:"container"},N))}return S};return c.createElement(H,null,$)},Se=function(n){var t=n.prefixCls,r=c.useContext(B),i=r.getPrefixCls,o=i("spin",t),l=_(_({},n),{spinPrefixCls:o});return c.createElement(Ce,_({},l))};Se.setDefaultIndicator=function(e){T=e};export{Se as S};
