import{p as Q,a as r,f,h as i,e as s,i as l,t as d,k as N,m as c,n,r as R,z as M,l as T,g as L,c as V,j as W,o as X}from"./index-DUEdOLeb.js";var Y=f('<span class="metric-icon"> </span>'),Z=f("<div> </div>"),$=f('<span class="spark svelte-314kjy"></span>'),ee=f('<div class="metric-sparkline svelte-314kjy"></div>'),ae=f('<div class="metric svelte-314kjy"><div class="metric-header svelte-314kjy"><span class="metric-label"> </span> <!></div> <div class="metric-value svelte-314kjy"><!> <!></div> <!> <!></div>');function re(z,t){Q(t,!0);let C=r(t,"format",3,"number"),x=r(t,"prefix",3,void 0),h=r(t,"suffix",3,void 0),v=r(t,"change",3,void 0),D=r(t,"changeLabel",3,"vs last period"),u=r(t,"sparkline",3,void 0),p=r(t,"icon",3,void 0),y=r(t,"color",3,void 0);const S=e=>{if(typeof e=="string")return e;switch(C()){case"currency":return new Intl.NumberFormat(void 0,{style:"currency",currency:"USD"}).format(e);case"percent":return new Intl.NumberFormat(void 0,{style:"percent"}).format(e);case"compact":return new Intl.NumberFormat(void 0,{notation:"compact"}).format(e);default:return new Intl.NumberFormat().format(e)}},U=V(()=>v()!==void 0?v()>=0?"positive":"negative":"");var m=ae(),b=s(m),g=s(b),q=s(g),A=i(g,2);{var B=e=>{var a=Y(),o=s(a);d(()=>c(o,p())),n(e,a)};l(A,e=>{p()&&e(B)})}var k=i(b,2),j=s(k);{var E=e=>{var a=M();d(()=>c(a,x())),n(e,a)};l(j,e=>{x()&&e(E)})}var w=i(j,1,!0),G=i(w);{var H=e=>{var a=M();d(()=>c(a,h())),n(e,a)};l(G,e=>{h()&&e(H)})}var F=i(k,2);{var J=e=>{var a=Z(),o=s(a);d(_=>{T(a,1,`metric-change ${L(U)}`,"svelte-314kjy"),c(o,`${v()>=0?"+":""}${_??""}% ${D()??""}`)},[()=>(v()*100).toFixed(1)]),n(e,a)};l(F,e=>{v()!==void 0&&e(J)})}var K=i(F,2);{var O=e=>{var a=ee();W(a,21,u,X,(o,_)=>{var I=$();d(P=>N(I,P),[()=>`height: ${Math.max(8,L(_)/Math.max(...u())*30)}px`]),n(o,I)}),n(e,a)};l(K,e=>{u()&&e(O)})}d(e=>{N(m,y()?`border-color: ${y()}`:""),c(q,t.label),c(w,e)},[()=>S(t.value)]),n(z,m),R()}export{re as default};
