import{defineComponent as k,computed as i,createVNode as a,Fragment as b}from"vue";import{presetPrimaryColors as g}from"../node_modules/.pnpm/@ant-design_colors@7.2.1/node_modules/@ant-design/colors/es/presets.mjs";import{stringType as $,anyType as C}from"../_util/type.mjs";import{progressProps as P}from"./props.mjs";import{getSize as x,validProgress as h,getSuccessPercent as S}from"./utils.mjs";const p=()=>({...P(),strokeColor:C(),direction:$()}),w=e=>{let o=[];return Object.keys(e).forEach(t=>{const r=Number.parseFloat(t.replace(/%/g,""));isNaN(r)||o.push({key:r,value:e[t]})}),o=o.sort((t,r)=>t.key-r.key),o.map(({key:t,value:r})=>`${r} ${t}%`).join(", ")},z=(e,o)=>{const{from:t=g.blue,to:r=g.blue,direction:l=o==="rtl"?"to left":"to right",...c}=e;if(Object.keys(c).length!==0){const u=w(c);return{backgroundImage:`linear-gradient(${l}, ${u})`}}return{backgroundImage:`linear-gradient(${l}, ${t}, ${r})`}},O=k({compatConfig:{MODE:3},name:"ProgressLine",inheritAttrs:!1,props:p(),setup(e,{slots:o,attrs:t}){const r=i(()=>{const{strokeColor:s,direction:y}=e;return s&&typeof s!="string"?z(s,y):{backgroundColor:s}}),l=i(()=>e.strokeLinecap==="square"||e.strokeLinecap==="butt"?0:void 0),c=i(()=>e.trailColor?{backgroundColor:e.trailColor}:void 0),u=i(()=>e.size??[-1,e.strokeWidth||(e.size==="small"?6:8)]),n=i(()=>x(u.value,"line",{strokeWidth:e.strokeWidth})),m=i(()=>{const{percent:s}=e;return{width:`${h(s)}%`,height:`${n.value.height}px`,borderRadius:l.value,...r.value}}),d=i(()=>S(e)),v=i(()=>{const{success:s}=e;return{width:`${h(d.value)}%`,height:`${n.value.height}px`,borderRadius:l.value,backgroundColor:s?.strokeColor}}),f={width:n.value.width<0?"100%":n.value.width,height:`${n.value.height}px`};return()=>a(b,null,[a("div",{...t,class:[`${e.prefixCls}-outer`,t.class],style:[t.style,f]},[a("div",{class:`${e.prefixCls}-inner`,style:c.value},[a("div",{class:`${e.prefixCls}-bg`,style:m.value},null),d.value!==void 0?a("div",{class:`${e.prefixCls}-success-bg`,style:v.value},null):null])]),o.default?.()])}});export{O as default,z as handleGradient,p as lineProps,w as sortGradient};
