import{defineComponent as b,computed as a,createVNode as l}from"vue";import w from"@ant-design/icons-vue/CheckCircleFilled";import N from"@ant-design/icons-vue/CheckOutlined";import O from"@ant-design/icons-vue/CloseCircleFilled";import z from"@ant-design/icons-vue/CloseOutlined";import F from"../_util/props-util/initDefaultProps.mjs";import L from"../config-provider/hooks/useConfigInject.mjs";import j from"./Circle.mjs";import D from"./Line.mjs";import E from"./Steps.mjs";import{progressStatuses as G,progressProps as M}from"./props.mjs";import R from"./style/index.mjs";import{getSuccessPercent as p,getSize as T,validProgress as g}from"./utils.mjs";const ee=b({compatConfig:{MODE:3},name:"AProgress",inheritAttrs:!1,props:F(M(),{type:"line",percent:0,showInfo:!0,trailColor:null,size:"default",strokeLinecap:"round"}),slots:Object,setup(e,{slots:m,attrs:k}){const{prefixCls:i,direction:d}=L("progress",e),[y,h]=R(i),C=a(()=>Array.isArray(e.strokeColor)?e.strokeColor[0]:e.strokeColor),S=a(()=>{const{percent:t=0}=e,o=p(e);return Number.parseInt(o!==void 0?o.toString():t.toString(),10)}),c=a(()=>{const{status:t}=e;return!G.includes(t)&&S.value>=100?"success":t||"normal"}),$=a(()=>{const{type:t,showInfo:o,size:n}=e,r=i.value;return{[r]:!0,[`${r}-inline-circle`]:t==="circle"&&T(n,"circle").width<=20,[`${r}-${t==="dashboard"&&"circle"||t}`]:!0,[`${r}-status-${c.value}`]:!0,[`${r}-show-info`]:o,[`${r}-${n}`]:n,[`${r}-rtl`]:d.value==="rtl",[h.value]:!0}}),x=a(()=>typeof e.strokeColor=="string"||Array.isArray(e.strokeColor)?e.strokeColor:void 0),P=()=>{const{showInfo:t,format:o,type:n,percent:r,title:f}=e,u=p(e);if(!t)return null;let s;const A=o||m?.format||(I=>`${I}%`),v=n==="line";return o||m?.format||c.value!=="exception"&&c.value!=="success"?s=A(g(r),g(u)):c.value==="exception"?s=v?l(O,null,null):l(z,null,null):c.value==="success"&&(s=v?l(w,null,null):l(N,null,null)),l("span",{class:`${i.value}-text`,title:f===void 0&&typeof s=="string"?s:void 0},[s])};return()=>{const{type:t,steps:o,title:n}=e,{class:r,...f}=k,u=P();let s;return t==="line"?s=o?l(E,{...e,strokeColor:x.value,prefixCls:i.value,steps:o},{default:()=>[u]}):l(D,{...e,strokeColor:C.value,prefixCls:i.value,direction:d.value},{default:()=>[u]}):(t==="circle"||t==="dashboard")&&(s=l(j,{...e,prefixCls:i.value,strokeColor:C.value,progressStatus:c.value},{default:()=>[u]})),y(l("div",{role:"progressbar",...f,class:[$.value,r],title:n},[s]))}}});export{ee as default};
