import{r,k as M,m as H,o as I,F as _,c as L,p as B,u as U,aa as O,a9 as V}from"./createLucideIcon-BcINIXoS.js";import{N as X}from"../assets/admin-D0g83suT.js";const A=t=>{const{value:n,formatter:o,precision:e,decimalSeparator:a,groupSeparator:u="",prefixCls:i}=t;let c;if(typeof o=="function")c=o(n);else{const s=String(n),f=s.match(/^(-?)(\d*)(\.(\d+))?$/);if(!f||s==="-")c=s;else{const d=f[1];let p=f[2]||"0",m=f[4]||"";p=p.replace(/\B(?=(\d{3})+(?!\d))/g,u),typeof e=="number"&&(m=m.padEnd(e,"0").slice(0,e>0?e:0)),m&&(m=`${a}${m}`),c=[r.createElement("span",{key:"int",className:`${i}-content-value-int`},d,p),m&&r.createElement("span",{key:"decimal",className:`${i}-content-value-decimal`},m)]}}return r.createElement("span",{className:`${i}-content-value`},c)},Y=t=>{const{componentCls:n,marginXXS:o,padding:e,colorTextDescription:a,titleFontSize:u,colorTextHeading:i,contentFontSize:c,fontFamily:s}=t;return{[n]:Object.assign(Object.assign({},I(t)),{[`${n}-title`]:{marginBottom:o,color:a,fontSize:u},[`${n}-skeleton`]:{paddingTop:e},[`${n}-content`]:{color:i,fontSize:c,fontFamily:s,[`${n}-content-value`]:{display:"inline-block",direction:"ltr"},[`${n}-content-prefix, ${n}-content-suffix`]:{display:"inline-block"},[`${n}-content-prefix`]:{marginInlineEnd:o},[`${n}-content-suffix`]:{marginInlineStart:o}}})}},q=t=>{const{fontSizeHeading3:n,fontSize:o}=t;return{titleFontSize:o,contentFontSize:n}},G=M("Statistic",t=>{const n=H(t,{});return Y(n)},q);var J=function(t,n){var o={};for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&n.indexOf(e)<0&&(o[e]=t[e]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,e=Object.getOwnPropertySymbols(t);a<e.length;a++)n.indexOf(e[a])<0&&Object.prototype.propertyIsEnumerable.call(t,e[a])&&(o[e[a]]=t[e[a]]);return o};const y=r.forwardRef((t,n)=>{const{prefixCls:o,className:e,rootClassName:a,style:u,valueStyle:i,value:c=0,title:s,valueRender:f,prefix:d,suffix:p,loading:m=!1,formatter:l,precision:g,decimalSeparator:S=".",groupSeparator:w=",",onMouseEnter:$,onMouseLeave:C}=t,h=J(t,["prefixCls","className","rootClassName","style","valueStyle","value","title","valueRender","prefix","suffix","loading","formatter","precision","decimalSeparator","groupSeparator","onMouseEnter","onMouseLeave"]),{getPrefixCls:N,direction:j,className:T,style:k}=_("statistic"),v=N("statistic",o),[R,z,P]=G(v),x=r.createElement(A,{decimalSeparator:S,groupSeparator:w,prefixCls:v,formatter:l,precision:g,value:c}),D=L(v,{[`${v}-rtl`]:j==="rtl"},T,e,a,z,P),b=r.useRef(null);r.useImperativeHandle(n,()=>({nativeElement:b.current}));const F=B(h,{aria:!0,data:!0});return R(r.createElement("div",Object.assign({},F,{ref:b,className:D,style:Object.assign(Object.assign({},k),u),onMouseEnter:$,onMouseLeave:C}),s&&r.createElement("div",{className:`${v}-title`},s),r.createElement(X,{paragraph:!1,loading:m,className:`${v}-skeleton`,active:!0},r.createElement("div",{style:i,className:`${v}-content`},d&&r.createElement("span",{className:`${v}-content-prefix`},d),f?f(x):x,p&&r.createElement("span",{className:`${v}-content-suffix`},p)))))}),K=[["Y",1e3*60*60*24*365],["M",1e3*60*60*24*30],["D",1e3*60*60*24],["H",1e3*60*60],["m",1e3*60],["s",1e3],["S",1]];function Q(t,n){let o=t;const e=/\[[^\]]*]/g,a=(n.match(e)||[]).map(s=>s.slice(1,-1)),u=n.replace(e,"[]"),i=K.reduce((s,[f,d])=>{if(s.includes(f)){const p=Math.floor(o/d);return o-=p*d,s.replace(new RegExp(`${f}+`,"g"),m=>{const l=m.length;return p.toString().padStart(l,"0")})}return s},u);let c=0;return i.replace(e,()=>{const s=a[c];return c+=1,s})}function W(t,n,o){const{format:e=""}=n,a=new Date(t).getTime(),u=Date.now(),i=Math.max(o?a-u:u-a,0);return Q(i,e)}var Z=function(t,n){var o={};for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&n.indexOf(e)<0&&(o[e]=t[e]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,e=Object.getOwnPropertySymbols(t);a<e.length;a++)n.indexOf(e[a])<0&&Object.prototype.propertyIsEnumerable.call(t,e[a])&&(o[e[a]]=t[e[a]]);return o};function ee(t){return new Date(t).getTime()}const E=t=>{const{value:n,format:o="HH:mm:ss",onChange:e,onFinish:a,type:u}=t,i=Z(t,["value","format","onChange","onFinish","type"]),c=u==="countdown",[s,f]=r.useState(null),d=U(()=>{const l=Date.now(),g=ee(n);f({});const S=c?g-l:l-g;return e==null||e(S),c&&g<l?(a==null||a(),!1):!0});r.useEffect(()=>{let l;const g=()=>O.cancel(l),S=()=>{l=O(()=>{d()&&S()})};return S(),g},[n,c]),r.useEffect(()=>{f({})},[]);const p=(l,g)=>s?W(l,Object.assign(Object.assign({},g),{format:o}),c):"-",m=l=>V(l,{title:void 0});return r.createElement(y,Object.assign({},i,{value:n,valueRender:m,formatter:p}))},te=t=>r.createElement(E,Object.assign({},t,{type:"countdown"})),ne=r.memo(te);y.Timer=E;y.Countdown=ne;export{y as S};
