import { a2 as w, a4 as H, a3 as V, e as A, f as K, a1 as F, h as D, ax as E, d as P, _ as $, i as N, ay as Y, a9 as q, g as Q, m as U, r as J, ah as Z, u as ee, az as te, at as re, aA as se, as as oe, b as ne } from "./index2.js"; import { defineComponent as I, computed as u, createVNode as g, Fragment as z, ref as B, onUpdated as ie } from "vue"; const le = ["normal", "exception", "active", "success"], W = () => ({ prefixCls: String, type: w(), percent: Number, format: H(), status: w(), showInfo: V(), strokeWidth: Number, strokeLinecap: w(), strokeColor: A(), trailColor: String, /** @deprecated Use `size` instead */ width: Number, success: K(), gapDegree: Number, gapPosition: w(), size: F([String, Number, Array]), steps: Number, /** @deprecated Use `success` instead */ successPercent: Number, title: String, progressStatus: w() }); function x(e) { return !e || e < 0 ? 0 : e > 100 ? 100 : e; } function _(e) { let { success: t, successPercent: s } = e, r = s; return t && "progress" in t && (D(!1, "Progress", "`success.progress` is deprecated. Please use `success.percent` instead."), r = t.progress), t && "percent" in t && (r = t.percent), r; } function ae(e) { let { percent: t, success: s, successPercent: r } = e; const o = x(_({ success: s, successPercent: r })); return [o, x(x(t) - o)]; } function ce(e) { let { success: t = {}, strokeColor: s } = e; const { strokeColor: r } = t; return [r || E.green, s || null]; } const j = (e, t, s) => { var r, o, p, i; let n = -1, l = -1; if (t === "step") { const v = s.steps, d = s.strokeWidth; typeof e == "string" || typeof e == "undefined" ? (n = e === "small" ? 2 : 14, l = d != null ? d : 8) : typeof e == "number" ? [n, l] = [e, e] : [n = 14, l = 8] = e, n *= v; } else if (t === "line") { const v = s == null ? void 0 : s.strokeWidth; typeof e == "string" || typeof e == "undefined" ? l = v || (e === "small" ? 6 : 8) : typeof e == "number" ? [n, l] = [e, e] : [n = -1, l = 8] = e; } else (t === "circle" || t === "dashboard") && (typeof e == "string" || typeof e == "undefined" ? [n, l] = e === "small" ? [60, 60] : [120, 120] : typeof e == "number" ? [n, l] = [e, e] : (process.env.NODE_ENV !== "production" && D(!1, "Progress", 'Type "circle" and "dashboard" do not accept array as `size`, please use number or preset size instead.'), n = (o = (r = e[0]) !== null && r !== void 0 ? r : e[1]) !== null && o !== void 0 ? o : 120, l = (i = (p = e[0]) !== null && p !== void 0 ? p : e[1]) !== null && i !== void 0 ? i : 120)); return { width: n, height: l }; }; var ue = function(e, t) { var s = {}; for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && t.indexOf(r) < 0 && (s[r] = e[r]); if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var o = 0, r = Object.getOwnPropertySymbols(e); o < r.length; o++) t.indexOf(r[o]) < 0 && Object.prototype.propertyIsEnumerable.call(e, r[o]) && (s[r[o]] = e[r[o]]); return s; }; const de = () => P(P({}, W()), { strokeColor: A(), direction: w() }), ge = (e) => { let t = []; return Object.keys(e).forEach((s) => { const r = parseFloat(s.replace(/%/g, "")); isNaN(r) || t.push({ key: r, value: e[s] }); }), t = t.sort((s, r) => s.key - r.key), t.map((s) => { let { key: r, value: o } = s; return `${o} ${r}%`; }).join(", "); }, fe = (e, t) => { const { from: s = E.blue, to: r = E.blue, direction: o = t === "rtl" ? "to left" : "to right" } = e, p = ue(e, ["from", "to", "direction"]); if (Object.keys(p).length !== 0) { const i = ge(p); return { backgroundImage: `linear-gradient(${o}, ${i})` }; } return { backgroundImage: `linear-gradient(${o}, ${s}, ${r})` }; }, pe = I({ compatConfig: { MODE: 3 }, name: "ProgressLine", inheritAttrs: !1, props: de(), setup(e, t) { let { slots: s, attrs: r } = t; const o = u(() => { const { strokeColor: a, direction: f } = e; return a && typeof a != "string" ? fe(a, f) : { backgroundColor: a }; }), p = u(() => e.strokeLinecap === "square" || e.strokeLinecap === "butt" ? 0 : void 0), i = u(() => e.trailColor ? { backgroundColor: e.trailColor } : void 0), n = u(() => { var a; return (a = e.size) !== null && a !== void 0 ? a : [-1, e.strokeWidth || (e.size === "small" ? 6 : 8)]; }), l = u(() => j(n.value, "line", { strokeWidth: e.strokeWidth })); process.env.NODE_ENV !== "production" && D("strokeWidth" in e, "Progress", "`strokeWidth` is deprecated. Please use `size` instead."); const v = u(() => { const { percent: a } = e; return P({ width: `${x(a)}%`, height: `${l.value.height}px`, borderRadius: p.value }, o.value); }), d = u(() => _(e)), C = u(() => { const { success: a } = e; return { width: `${x(d.value)}%`, height: `${l.value.height}px`, borderRadius: p.value, backgroundColor: a == null ? void 0 : a.strokeColor }; }), h = { width: l.value.width < 0 ? "100%" : l.value.width, height: `${l.value.height}px` }; return () => { var a; return g(z, null, [g("div", $($({}, r), {}, { class: [`${e.prefixCls}-outer`, r.class], style: [r.style, h] }), [g("div", { class: `${e.prefixCls}-inner`, style: i.value }, [g("div", { class: `${e.prefixCls}-bg`, style: v.value }, null), d.value !== void 0 ? g("div", { class: `${e.prefixCls}-success-bg`, style: C.value }, null) : null])]), (a = s.default) === null || a === void 0 ? void 0 : a.call(s)]); }; } }), he = { percent: 0, prefixCls: "vc-progress", strokeColor: "#2db7f5", strokeLinecap: "round", strokeWidth: 1, trailColor: "#D9D9D9", trailWidth: 1 }, ve = (e) => { const t = B(null); return ie(() => { const s = Date.now(); let r = !1; e.value.forEach((o) => { const p = (o == null ? void 0 : o.$el) || o; if (!p) return; r = !0; const i = p.style; i.transitionDuration = ".3s, .3s, .3s, .06s", t.value && s - t.value < 100 && (i.transitionDuration = "0s, 0s"); }), r && (t.value = Date.now()); }), e; }, me = { gapDegree: Number, gapPosition: { type: String }, percent: { type: [Array, Number] }, prefixCls: String, strokeColor: { type: [Object, String, Array] }, strokeLinecap: { type: String }, strokeWidth: Number, trailColor: String, trailWidth: Number, transition: String }; var ye = function(e, t) { var s = {}; for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && t.indexOf(r) < 0 && (s[r] = e[r]); if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var o = 0, r = Object.getOwnPropertySymbols(e); o < r.length; o++) t.indexOf(r[o]) < 0 && Object.prototype.propertyIsEnumerable.call(e, r[o]) && (s[r[o]] = e[r[o]]); return s; }; let R = 0; function T(e) { return +e.replace("%", ""); } function M(e) { return Array.isArray(e) ? e : [e]; } function X(e, t, s, r) { let o = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : 0, p = arguments.length > 5 ? arguments[5] : void 0; const i = 50 - r / 2; let n = 0, l = -i, v = 0, d = -2 * i; switch (p) { case "left": n = -i, l = 0, v = 2 * i, d = 0; break; case "right": n = i, l = 0, v = -2 * i, d = 0; break; case "bottom": l = i, d = 2 * i; break; } const C = `M 50,50 m ${n},${l} a ${i},${i} 0 1 1 ${v},${-d} a ${i},${i} 0 1 1 ${-v},${d}`, h = Math.PI * 2 * i, a = { stroke: s, strokeDasharray: `${t / 100 * (h - o)}px ${h}px`, strokeDashoffset: `-${o / 2 + e / 100 * (h - o)}px`, transition: "stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s, opacity .3s ease 0s" // eslint-disable-line }; return { pathString: C, pathStyle: a }; } const Ce = I({ compatConfig: { MODE: 3 }, name: "VCCircle", props: N(me, he), setup(e) { R += 1; const t = B(R), s = u(() => M(e.percent)), r = u(() => M(e.strokeColor)), [o, p] = Y(); ve(p); const i = () => { const { prefixCls: n, strokeWidth: l, strokeLinecap: v, gapDegree: d, gapPosition: C } = e; let h = 0; return s.value.map((a, f) => { const c = r.value[f] || r.value[r.value.length - 1], b = Object.prototype.toString.call(c) === "[object Object]" ? `url(#${n}-gradient-${t.value})` : "", { pathString: y, pathStyle: S } = X(h, a, c, l, d, C); h += a; const k = { key: f, d: y, stroke: b, "stroke-linecap": v, "stroke-width": l, opacity: a === 0 ? 0 : 1, "fill-opacity": "0", class: `${n}-circle-path`, style: S }; return g("path", $({ ref: o(f) }, k), null); }); }; return () => { const { prefixCls: n, strokeWidth: l, trailWidth: v, gapDegree: d, gapPosition: C, trailColor: h, strokeLinecap: a, strokeColor: f } = e, c = ye(e, ["prefixCls", "strokeWidth", "trailWidth", "gapDegree", "gapPosition", "trailColor", "strokeLinecap", "strokeColor"]), { pathString: b, pathStyle: y } = X(0, 100, h, l, d, C); delete c.percent; const S = r.value.find((m) => Object.prototype.toString.call(m) === "[object Object]"), k = { d: b, stroke: h, "stroke-linecap": a, "stroke-width": v || l, "fill-opacity": "0", class: `${n}-circle-trail`, style: y }; return g("svg", $({ class: `${n}-circle`, viewBox: "0 0 100 100" }, c), [S && g("defs", null, [g("linearGradient", { id: `${n}-gradient-${t.value}`, x1: "100%", y1: "0%", x2: "0%", y2: "0%" }, [Object.keys(S).sort((m, O) => T(m) - T(O)).map((m, O) => g("stop", { key: O, offset: m, "stop-color": S[m] }, null))])]), g("path", k, null), i().reverse()]); }; } }), be = () => P(P({}, W()), { strokeColor: A() }), $e = 3, Se = (e) => $e / e * 100, ke = I({ compatConfig: { MODE: 3 }, name: "ProgressCircle", inheritAttrs: !1, props: N(be(), { trailColor: null }), setup(e, t) { let { slots: s, attrs: r } = t; const o = u(() => { var c; return (c = e.width) !== null && c !== void 0 ? c : 120; }), p = u(() => { var c; return (c = e.size) !== null && c !== void 0 ? c : [o.value, o.value]; }), i = u(() => j(p.value, "circle")), n = u(() => { if (e.gapDegree || e.gapDegree === 0) return e.gapDegree; if (e.type === "dashboard") return 75; }), l = u(() => ({ width: `${i.value.width}px`, height: `${i.value.height}px`, fontSize: `${i.value.width * 0.15 + 6}px` })), v = u(() => { var c; return (c = e.strokeWidth) !== null && c !== void 0 ? c : Math.max(Se(i.value.width), 6); }), d = u(() => e.gapPosition || e.type === "dashboard" && "bottom" || void 0), C = u(() => ae(e)), h = u(() => Object.prototype.toString.call(e.strokeColor) === "[object Object]"), a = u(() => ce({ success: e.success, strokeColor: e.strokeColor })), f = u(() => ({ [`${e.prefixCls}-inner`]: !0, [`${e.prefixCls}-circle-gradient`]: h.value })); return () => { var c; const b = g(Ce, { percent: C.value, strokeWidth: v.value, trailWidth: v.value, strokeColor: a.value, strokeLinecap: e.strokeLinecap, trailColor: e.trailColor, prefixCls: e.prefixCls, gapDegree: n.value, gapPosition: d.value }, null); return g("div", $($({}, r), {}, { class: [f.value, r.class], style: [r.style, l.value] }), [i.value.width <= 20 ? g(q, null, { default: () => [g("span", null, [b])], title: s.default }) : g(z, null, [b, (c = s.default) === null || c === void 0 ? void 0 : c.call(s)])]); }; } }), Pe = () => P(P({}, W()), { steps: Number, strokeColor: F(), trailColor: String }), xe = I({ compatConfig: { MODE: 3 }, name: "Steps", props: Pe(), setup(e, t) { let { slots: s } = t; const r = u(() => Math.round(e.steps * ((e.percent || 0) / 100))), o = u(() => { var n; return (n = e.size) !== null && n !== void 0 ? n : [e.size === "small" ? 2 : 14, e.strokeWidth || 8]; }), p = u(() => j(o.value, "step", { steps: e.steps, strokeWidth: e.strokeWidth || 8 })), i = u(() => { const { steps: n, strokeColor: l, trailColor: v, prefixCls: d } = e, C = []; for (let h = 0; h < n; h += 1) { const a = Array.isArray(l) ? l[h] : l, f = { [`${d}-steps-item`]: !0, [`${d}-steps-item-active`]: h <= r.value - 1 }; C.push(g("div", { key: h, class: f, style: { backgroundColor: h <= r.value - 1 ? a : v, width: `${p.value.width / n}px`, height: `${p.value.height}px` } }, null)); } return C; }); return () => { var n; return g("div", { class: `${e.prefixCls}-steps-outer` }, [i.value, (n = s.default) === null || n === void 0 ? void 0 : n.call(s)]); }; } }), we = new Z("antProgressActive", { "0%": { transform: "translateX(-100%) scaleX(0)", opacity: 0.1 }, "20%": { transform: "translateX(-100%) scaleX(0)", opacity: 0.5 }, to: { transform: "translateX(0) scaleX(1)", opacity: 0 } }), Oe = (e) => { const { componentCls: t, iconCls: s } = e; return { [t]: P(P({}, J(e)), { display: "inline-block", "&-rtl": { direction: "rtl" }, "&-line": { position: "relative", width: "100%", fontSize: e.fontSize, marginInlineEnd: e.marginXS, marginBottom: e.marginXS }, [`${t}-outer`]: { display: "inline-block", width: "100%" }, [`&${t}-show-info`]: { [`${t}-outer`]: { marginInlineEnd: `calc(-2em - ${e.marginXS}px)`, paddingInlineEnd: `calc(2em + ${e.paddingXS}px)` } }, [`${t}-inner`]: { position: "relative", display: "inline-block", width: "100%", overflow: "hidden", verticalAlign: "middle", backgroundColor: e.progressRemainingColor, borderRadius: e.progressLineRadius }, [`${t}-inner:not(${t}-circle-gradient)`]: { [`${t}-circle-path`]: { stroke: e.colorInfo } }, [`${t}-success-bg, ${t}-bg`]: { position: "relative", backgroundColor: e.colorInfo, borderRadius: e.progressLineRadius, transition: `all ${e.motionDurationSlow} ${e.motionEaseInOutCirc}` }, [`${t}-success-bg`]: { position: "absolute", insetBlockStart: 0, insetInlineStart: 0, backgroundColor: e.colorSuccess }, [`${t}-text`]: { display: "inline-block", width: "2em", marginInlineStart: e.marginXS, color: e.progressInfoTextColor, lineHeight: 1, whiteSpace: "nowrap", textAlign: "start", verticalAlign: "middle", wordBreak: "normal", [s]: { fontSize: e.fontSize } }, [`&${t}-status-active`]: { [`${t}-bg::before`]: { position: "absolute", inset: 0, backgroundColor: e.colorBgContainer, borderRadius: e.progressLineRadius, opacity: 0, animationName: we, animationDuration: e.progressActiveMotionDuration, animationTimingFunction: e.motionEaseOutQuint, animationIterationCount: "infinite", content: '""' } }, [`&${t}-status-exception`]: { [`${t}-bg`]: { backgroundColor: e.colorError }, [`${t}-text`]: { color: e.colorError } }, [`&${t}-status-exception ${t}-inner:not(${t}-circle-gradient)`]: { [`${t}-circle-path`]: { stroke: e.colorError } }, [`&${t}-status-success`]: { [`${t}-bg`]: { backgroundColor: e.colorSuccess }, [`${t}-text`]: { color: e.colorSuccess } }, [`&${t}-status-success ${t}-inner:not(${t}-circle-gradient)`]: { [`${t}-circle-path`]: { stroke: e.colorSuccess } } }) }; }, De = (e) => { const { componentCls: t, iconCls: s } = e; return { [t]: { [`${t}-circle-trail`]: { stroke: e.progressRemainingColor }, [`&${t}-circle ${t}-inner`]: { position: "relative", lineHeight: 1, backgroundColor: "transparent" }, [`&${t}-circle ${t}-text`]: { position: "absolute", insetBlockStart: "50%", insetInlineStart: 0, width: "100%", margin: 0, padding: 0, color: e.colorText, lineHeight: 1, whiteSpace: "normal", textAlign: "center", transform: "translateY(-50%)", [s]: { fontSize: `${e.fontSize / e.fontSizeSM}em` } }, [`${t}-circle&-status-exception`]: { [`${t}-text`]: { color: e.colorError } }, [`${t}-circle&-status-success`]: { [`${t}-text`]: { color: e.colorSuccess } } }, [`${t}-inline-circle`]: { lineHeight: 1, [`${t}-inner`]: { verticalAlign: "bottom" } } }; }, Ie = (e) => { const { componentCls: t } = e; return { [t]: { [`${t}-steps`]: { display: "inline-block", "&-outer": { display: "flex", flexDirection: "row", alignItems: "center" }, "&-item": { flexShrink: 0, minWidth: e.progressStepMinWidth, marginInlineEnd: e.progressStepMarginInlineEnd, backgroundColor: e.progressRemainingColor, transition: `all ${e.motionDurationSlow}`, "&-active": { backgroundColor: e.colorInfo } } } } }; }, _e = (e) => { const { componentCls: t, iconCls: s } = e; return { [t]: { [`${t}-small&-line, ${t}-small&-line ${t}-text ${s}`]: { fontSize: e.fontSizeSM } } }; }, We = Q("Progress", (e) => { const t = e.marginXXS / 2, s = U(e, { progressLineRadius: 100, progressInfoTextColor: e.colorText, progressDefaultColor: e.colorInfo, progressRemainingColor: e.colorFillSecondary, progressStepMarginInlineEnd: t, progressStepMinWidth: t, progressActiveMotionDuration: "2.4s" }); return [Oe(s), De(s), Ie(s), _e(s)]; }); var je = function(e, t) { var s = {}; for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && t.indexOf(r) < 0 && (s[r] = e[r]); if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var o = 0, r = Object.getOwnPropertySymbols(e); o < r.length; o++) t.indexOf(r[o]) < 0 && Object.prototype.propertyIsEnumerable.call(e, r[o]) && (s[r[o]] = e[r[o]]); return s; }; const Ee = I({ compatConfig: { MODE: 3 }, name: "AProgress", inheritAttrs: !1, props: N(W(), { type: "line", percent: 0, showInfo: !0, // null for different theme definition trailColor: null, size: "default", strokeLinecap: "round" }), slots: Object, setup(e, t) { let { slots: s, attrs: r } = t; const { prefixCls: o, direction: p } = ee("progress", e), [i, n] = We(o); process.env.NODE_ENV !== "production" && (D("successPercent" in e, "Progress", "`successPercent` is deprecated. Please use `success.percent` instead."), D("width" in e, "Progress", "`width` is deprecated. Please use `size` instead.")); const l = u(() => Array.isArray(e.strokeColor) ? e.strokeColor[0] : e.strokeColor), v = u(() => { const { percent: f = 0 } = e, c = _(e); return parseInt(c !== void 0 ? c.toString() : f.toString(), 10); }), d = u(() => { const { status: f } = e; return !le.includes(f) && v.value >= 100 ? "success" : f || "normal"; }), C = u(() => { const { type: f, showInfo: c, size: b } = e, y = o.value; return { [y]: !0, [`${y}-inline-circle`]: f === "circle" && j(b, "circle").width <= 20, [`${y}-${f === "dashboard" && "circle" || f}`]: !0, [`${y}-status-${d.value}`]: !0, [`${y}-show-info`]: c, [`${y}-${b}`]: b, [`${y}-rtl`]: p.value === "rtl", [n.value]: !0 }; }), h = u(() => typeof e.strokeColor == "string" || Array.isArray(e.strokeColor) ? e.strokeColor : void 0), a = () => { const { showInfo: f, format: c, type: b, percent: y, title: S } = e, k = _(e); if (!f) return null; let m; const O = c || (s == null ? void 0 : s.format) || ((G) => `${G}%`), L = b === "line"; return c || s != null && s.format || d.value !== "exception" && d.value !== "success" ? m = O(x(y), x(k)) : d.value === "exception" ? m = L ? g(te, null, null) : g(re, null, null) : d.value === "success" && (m = L ? g(se, null, null) : g(oe, null, null)), g("span", { class: `${o.value}-text`, title: S === void 0 && typeof m == "string" ? m : void 0 }, [m]); }; return () => { const { type: f, steps: c, title: b } = e, { class: y } = r, S = je(r, ["class"]), k = a(); let m; return f === "line" ? m = c ? g(xe, $($({}, e), {}, { strokeColor: h.value, prefixCls: o.value, steps: c }), { default: () => [k] }) : g(pe, $($({}, e), {}, { strokeColor: l.value, prefixCls: o.value, direction: p.value }), { default: () => [k] }) : (f === "circle" || f === "dashboard") && (m = g(ke, $($({}, e), {}, { prefixCls: o.value, strokeColor: l.value, progressStatus: d.value }), { default: () => [k] })), i(g("div", $($({ role: "progressbar" }, S), {}, { class: [C.value, y], title: b }), [m])); }; } }), Le = ne(Ee); export { Le as P };