You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
NewEduCoderBuild/49127.194ee0eb.async.js

863 lines
30 KiB

"use strict";
(self["webpackChunk"] = self["webpackChunk"] || []).push([[49127],{
/***/ 49127:
/*!*********************************************************************!*\
!*** ./node_modules/_antd@5.9.0@antd/es/badge/index.js + 5 modules ***!
\*********************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
Z: function() { return /* binding */ badge; }
});
// EXTERNAL MODULE: ./node_modules/_classnames@2.5.1@classnames/index.js
var _classnames_2_5_1_classnames = __webpack_require__(92310);
var _classnames_2_5_1_classnames_default = /*#__PURE__*/__webpack_require__.n(_classnames_2_5_1_classnames);
// EXTERNAL MODULE: ./node_modules/_rc-motion@2.9.5@rc-motion/es/index.js + 13 modules
var es = __webpack_require__(77900);
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
var _react_17_0_2_react = __webpack_require__(59301);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/_util/colors.js
var colors = __webpack_require__(36785);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/_util/reactNode.js
var reactNode = __webpack_require__(92343);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/config-provider/context.js
var context = __webpack_require__(36355);
// EXTERNAL MODULE: ./node_modules/_@ant-design_cssinjs@1.24.0@@ant-design/cssinjs/es/index.js + 39 modules
var cssinjs_es = __webpack_require__(36237);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/style/index.js
var style = __webpack_require__(17313);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/theme/util/genPresetColor.js
var genPresetColor = __webpack_require__(45157);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/theme/util/statistic.js
var statistic = __webpack_require__(37613);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/theme/util/genComponentStyleHook.js
var genComponentStyleHook = __webpack_require__(83116);
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/badge/style/index.js
const antStatusProcessing = new cssinjs_es.Keyframes('antStatusProcessing', {
'0%': {
transform: 'scale(0.8)',
opacity: 0.5
},
'100%': {
transform: 'scale(2.4)',
opacity: 0
}
});
const antZoomBadgeIn = new cssinjs_es.Keyframes('antZoomBadgeIn', {
'0%': {
transform: 'scale(0) translate(50%, -50%)',
opacity: 0
},
'100%': {
transform: 'scale(1) translate(50%, -50%)'
}
});
const antZoomBadgeOut = new cssinjs_es.Keyframes('antZoomBadgeOut', {
'0%': {
transform: 'scale(1) translate(50%, -50%)'
},
'100%': {
transform: 'scale(0) translate(50%, -50%)',
opacity: 0
}
});
const antNoWrapperZoomBadgeIn = new cssinjs_es.Keyframes('antNoWrapperZoomBadgeIn', {
'0%': {
transform: 'scale(0)',
opacity: 0
},
'100%': {
transform: 'scale(1)'
}
});
const antNoWrapperZoomBadgeOut = new cssinjs_es.Keyframes('antNoWrapperZoomBadgeOut', {
'0%': {
transform: 'scale(1)'
},
'100%': {
transform: 'scale(0)',
opacity: 0
}
});
const antBadgeLoadingCircle = new cssinjs_es.Keyframes('antBadgeLoadingCircle', {
'0%': {
transformOrigin: '50%'
},
'100%': {
transform: 'translate(50%, -50%) rotate(360deg)',
transformOrigin: '50%'
}
});
const genSharedBadgeStyle = token => {
const {
componentCls,
iconCls,
antCls,
badgeShadowSize,
motionDurationSlow,
textFontSize,
textFontSizeSM,
statusSize,
dotSize,
textFontWeight,
indicatorHeight,
indicatorHeightSM,
marginXS
} = token;
const numberPrefixCls = `${antCls}-scroll-number`;
const colorPreset = (0,genPresetColor/* default */.Z)(token, (colorKey, _ref) => {
let {
darkColor
} = _ref;
return {
[`&${componentCls} ${componentCls}-color-${colorKey}`]: {
background: darkColor,
[`&:not(${componentCls}-count)`]: {
color: darkColor
}
}
};
});
return {
[componentCls]: Object.assign(Object.assign(Object.assign(Object.assign({}, (0,style/* resetComponent */.Wf)(token)), {
position: 'relative',
display: 'inline-block',
width: 'fit-content',
lineHeight: 1,
[`${componentCls}-count`]: {
zIndex: token.indicatorZIndex,
minWidth: indicatorHeight,
height: indicatorHeight,
color: token.badgeTextColor,
fontWeight: textFontWeight,
fontSize: textFontSize,
lineHeight: `${indicatorHeight}px`,
whiteSpace: 'nowrap',
textAlign: 'center',
background: token.badgeColor,
borderRadius: indicatorHeight / 2,
boxShadow: `0 0 0 ${badgeShadowSize}px ${token.badgeShadowColor}`,
transition: `background ${token.motionDurationMid}`,
a: {
color: token.badgeTextColor
},
'a:hover': {
color: token.badgeTextColor
},
'a:hover &': {
background: token.badgeColorHover
}
},
[`${componentCls}-count-sm`]: {
minWidth: indicatorHeightSM,
height: indicatorHeightSM,
fontSize: textFontSizeSM,
lineHeight: `${indicatorHeightSM}px`,
borderRadius: indicatorHeightSM / 2
},
[`${componentCls}-multiple-words`]: {
padding: `0 ${token.paddingXS}px`,
bdi: {
unicodeBidi: 'plaintext'
}
},
[`${componentCls}-dot`]: {
zIndex: token.indicatorZIndex,
width: dotSize,
minWidth: dotSize,
height: dotSize,
background: token.badgeColor,
borderRadius: '100%',
boxShadow: `0 0 0 ${badgeShadowSize}px ${token.badgeShadowColor}`
},
[`${componentCls}-dot${numberPrefixCls}`]: {
transition: `background ${motionDurationSlow}`
},
[`${componentCls}-count, ${componentCls}-dot, ${numberPrefixCls}-custom-component`]: {
position: 'absolute',
top: 0,
insetInlineEnd: 0,
transform: 'translate(50%, -50%)',
transformOrigin: '100% 0%',
[`&${iconCls}-spin`]: {
animationName: antBadgeLoadingCircle,
animationDuration: '1s',
animationIterationCount: 'infinite',
animationTimingFunction: 'linear'
}
},
[`&${componentCls}-status`]: {
lineHeight: 'inherit',
verticalAlign: 'baseline',
[`${componentCls}-status-dot`]: {
position: 'relative',
top: -1,
display: 'inline-block',
width: statusSize,
height: statusSize,
verticalAlign: 'middle',
borderRadius: '50%'
},
[`${componentCls}-status-success`]: {
backgroundColor: token.colorSuccess
},
[`${componentCls}-status-processing`]: {
overflow: 'visible',
color: token.colorPrimary,
backgroundColor: token.colorPrimary,
'&::after': {
position: 'absolute',
top: 0,
insetInlineStart: 0,
width: '100%',
height: '100%',
borderWidth: badgeShadowSize,
borderStyle: 'solid',
borderColor: 'inherit',
borderRadius: '50%',
animationName: antStatusProcessing,
animationDuration: token.badgeProcessingDuration,
animationIterationCount: 'infinite',
animationTimingFunction: 'ease-in-out',
content: '""'
}
},
[`${componentCls}-status-default`]: {
backgroundColor: token.colorTextPlaceholder
},
[`${componentCls}-status-error`]: {
backgroundColor: token.colorError
},
[`${componentCls}-status-warning`]: {
backgroundColor: token.colorWarning
},
[`${componentCls}-status-text`]: {
marginInlineStart: marginXS,
color: token.colorText,
fontSize: token.fontSize
}
}
}), colorPreset), {
[`${componentCls}-zoom-appear, ${componentCls}-zoom-enter`]: {
animationName: antZoomBadgeIn,
animationDuration: token.motionDurationSlow,
animationTimingFunction: token.motionEaseOutBack,
animationFillMode: 'both'
},
[`${componentCls}-zoom-leave`]: {
animationName: antZoomBadgeOut,
animationDuration: token.motionDurationSlow,
animationTimingFunction: token.motionEaseOutBack,
animationFillMode: 'both'
},
[`&${componentCls}-not-a-wrapper`]: {
[`${componentCls}-zoom-appear, ${componentCls}-zoom-enter`]: {
animationName: antNoWrapperZoomBadgeIn,
animationDuration: token.motionDurationSlow,
animationTimingFunction: token.motionEaseOutBack
},
[`${componentCls}-zoom-leave`]: {
animationName: antNoWrapperZoomBadgeOut,
animationDuration: token.motionDurationSlow,
animationTimingFunction: token.motionEaseOutBack
},
[`&:not(${componentCls}-status)`]: {
verticalAlign: 'middle'
},
[`${numberPrefixCls}-custom-component, ${componentCls}-count`]: {
transform: 'none'
},
[`${numberPrefixCls}-custom-component, ${numberPrefixCls}`]: {
position: 'relative',
top: 'auto',
display: 'block',
transformOrigin: '50% 50%'
}
},
[`${numberPrefixCls}`]: {
overflow: 'hidden',
[`${numberPrefixCls}-only`]: {
position: 'relative',
display: 'inline-block',
height: indicatorHeight,
transition: `all ${token.motionDurationSlow} ${token.motionEaseOutBack}`,
WebkitTransformStyle: 'preserve-3d',
WebkitBackfaceVisibility: 'hidden',
[`> p${numberPrefixCls}-only-unit`]: {
height: indicatorHeight,
margin: 0,
WebkitTransformStyle: 'preserve-3d',
WebkitBackfaceVisibility: 'hidden'
}
},
[`${numberPrefixCls}-symbol`]: {
verticalAlign: 'top'
}
},
// ====================== RTL =======================
'&-rtl': {
direction: 'rtl',
[`${componentCls}-count, ${componentCls}-dot, ${numberPrefixCls}-custom-component`]: {
transform: 'translate(-50%, -50%)'
}
}
})
};
};
// ============================== Export ==============================
const prepareToken = token => {
const {
fontSize,
lineHeight,
lineWidth,
marginXS,
colorBorderBg
} = token;
const badgeFontHeight = Math.round(fontSize * lineHeight);
const badgeShadowSize = lineWidth;
const badgeTextColor = token.colorBgContainer;
const badgeColor = token.colorError;
const badgeColorHover = token.colorErrorHover;
const badgeToken = (0,statistic/* merge */.TS)(token, {
badgeFontHeight,
badgeShadowSize,
badgeTextColor,
badgeColor,
badgeColorHover,
badgeShadowColor: colorBorderBg,
badgeProcessingDuration: '1.2s',
badgeRibbonOffset: marginXS,
// Follow token just by Design. Not related with token
badgeRibbonCornerTransform: 'scaleY(0.75)',
badgeRibbonCornerFilter: `brightness(75%)`
});
return badgeToken;
};
const prepareComponentToken = token => {
const {
fontSize,
lineHeight,
fontSizeSM,
lineWidth
} = token;
return {
indicatorZIndex: 'auto',
indicatorHeight: Math.round(fontSize * lineHeight) - 2 * lineWidth,
indicatorHeightSM: fontSize,
dotSize: fontSizeSM / 2,
textFontSize: fontSizeSM,
textFontSizeSM: fontSizeSM,
textFontWeight: 'normal',
statusSize: fontSizeSM / 2
};
};
/* harmony default export */ var badge_style = ((0,genComponentStyleHook/* default */.Z)('Badge', token => {
const badgeToken = prepareToken(token);
return [genSharedBadgeStyle(badgeToken)];
}, prepareComponentToken));
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/badge/style/ribbon.js
// ============================== Ribbon ==============================
const genRibbonStyle = token => {
const {
antCls,
badgeFontHeight,
marginXS,
badgeRibbonOffset
} = token;
const ribbonPrefixCls = `${antCls}-ribbon`;
const ribbonWrapperPrefixCls = `${antCls}-ribbon-wrapper`;
const statusRibbonPreset = (0,genPresetColor/* default */.Z)(token, (colorKey, _ref) => {
let {
darkColor
} = _ref;
return {
[`&${ribbonPrefixCls}-color-${colorKey}`]: {
background: darkColor,
color: darkColor
}
};
});
return {
[`${ribbonWrapperPrefixCls}`]: {
position: 'relative'
},
[`${ribbonPrefixCls}`]: Object.assign(Object.assign(Object.assign(Object.assign({}, (0,style/* resetComponent */.Wf)(token)), {
position: 'absolute',
top: marginXS,
padding: `0 ${token.paddingXS}px`,
color: token.colorPrimary,
lineHeight: `${badgeFontHeight}px`,
whiteSpace: 'nowrap',
backgroundColor: token.colorPrimary,
borderRadius: token.borderRadiusSM,
[`${ribbonPrefixCls}-text`]: {
color: token.colorTextLightSolid
},
[`${ribbonPrefixCls}-corner`]: {
position: 'absolute',
top: '100%',
width: badgeRibbonOffset,
height: badgeRibbonOffset,
color: 'currentcolor',
border: `${badgeRibbonOffset / 2}px solid`,
transform: token.badgeRibbonCornerTransform,
transformOrigin: 'top',
filter: token.badgeRibbonCornerFilter
}
}), statusRibbonPreset), {
[`&${ribbonPrefixCls}-placement-end`]: {
insetInlineEnd: -badgeRibbonOffset,
borderEndEndRadius: 0,
[`${ribbonPrefixCls}-corner`]: {
insetInlineEnd: 0,
borderInlineEndColor: 'transparent',
borderBlockEndColor: 'transparent'
}
},
[`&${ribbonPrefixCls}-placement-start`]: {
insetInlineStart: -badgeRibbonOffset,
borderEndStartRadius: 0,
[`${ribbonPrefixCls}-corner`]: {
insetInlineStart: 0,
borderBlockEndColor: 'transparent',
borderInlineStartColor: 'transparent'
}
},
// ====================== RTL =======================
'&-rtl': {
direction: 'rtl'
}
})
};
};
// ============================== Export ==============================
/* harmony default export */ var ribbon = ((0,genComponentStyleHook/* default */.Z)(['Badge', 'Ribbon'], token => {
const badgeToken = prepareToken(token);
return [genRibbonStyle(badgeToken)];
}, prepareComponentToken));
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/badge/Ribbon.js
"use client";
const Ribbon = props => {
const {
className,
prefixCls: customizePrefixCls,
style,
color,
children,
text,
placement = 'end',
rootClassName
} = props;
const {
getPrefixCls,
direction
} = _react_17_0_2_react.useContext(context/* ConfigContext */.E_);
const prefixCls = getPrefixCls('ribbon', customizePrefixCls);
const colorInPreset = (0,colors/* isPresetColor */.o2)(color, false);
const ribbonCls = _classnames_2_5_1_classnames_default()(prefixCls, `${prefixCls}-placement-${placement}`, {
[`${prefixCls}-rtl`]: direction === 'rtl',
[`${prefixCls}-color-${color}`]: colorInPreset
}, className);
const [wrapSSR, hashId] = ribbon(prefixCls);
const colorStyle = {};
const cornerColorStyle = {};
if (color && !colorInPreset) {
colorStyle.background = color;
cornerColorStyle.color = color;
}
return wrapSSR( /*#__PURE__*/_react_17_0_2_react.createElement("div", {
className: _classnames_2_5_1_classnames_default()(`${prefixCls}-wrapper`, rootClassName, hashId)
}, children, /*#__PURE__*/_react_17_0_2_react.createElement("div", {
className: _classnames_2_5_1_classnames_default()(ribbonCls, hashId),
style: Object.assign(Object.assign({}, colorStyle), style)
}, /*#__PURE__*/_react_17_0_2_react.createElement("span", {
className: `${prefixCls}-text`
}, text), /*#__PURE__*/_react_17_0_2_react.createElement("div", {
className: `${prefixCls}-corner`,
style: cornerColorStyle
}))));
};
if (false) {}
/* harmony default export */ var badge_Ribbon = (Ribbon);
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/badge/SingleNumber.js
"use client";
function UnitNumber(_ref) {
let {
prefixCls,
value,
current,
offset = 0
} = _ref;
let style;
if (offset) {
style = {
position: 'absolute',
top: `${offset}00%`,
left: 0
};
}
return /*#__PURE__*/_react_17_0_2_react.createElement("span", {
style: style,
className: _classnames_2_5_1_classnames_default()(`${prefixCls}-only-unit`, {
current
})
}, value);
}
function getOffset(start, end, unit) {
let index = start;
let offset = 0;
while ((index + 10) % 10 !== end) {
index += unit;
offset += unit;
}
return offset;
}
function SingleNumber(props) {
const {
prefixCls,
count: originCount,
value: originValue
} = props;
const value = Number(originValue);
const count = Math.abs(originCount);
const [prevValue, setPrevValue] = _react_17_0_2_react.useState(value);
const [prevCount, setPrevCount] = _react_17_0_2_react.useState(count);
// ============================= Events =============================
const onTransitionEnd = () => {
setPrevValue(value);
setPrevCount(count);
};
// Fallback if transition event not support
_react_17_0_2_react.useEffect(() => {
const timeout = setTimeout(() => {
onTransitionEnd();
}, 1000);
return () => {
clearTimeout(timeout);
};
}, [value]);
// ============================= Render =============================
// Render unit list
let unitNodes;
let offsetStyle;
if (prevValue === value || Number.isNaN(value) || Number.isNaN(prevValue)) {
// Nothing to change
unitNodes = [/*#__PURE__*/_react_17_0_2_react.createElement(UnitNumber, Object.assign({}, props, {
key: value,
current: true
}))];
offsetStyle = {
transition: 'none'
};
} else {
unitNodes = [];
// Fill basic number units
const end = value + 10;
const unitNumberList = [];
for (let index = value; index <= end; index += 1) {
unitNumberList.push(index);
}
// Fill with number unit nodes
const prevIndex = unitNumberList.findIndex(n => n % 10 === prevValue);
unitNodes = unitNumberList.map((n, index) => {
const singleUnit = n % 10;
return /*#__PURE__*/_react_17_0_2_react.createElement(UnitNumber, Object.assign({}, props, {
key: n,
value: singleUnit,
offset: index - prevIndex,
current: index === prevIndex
}));
});
// Calculate container offset value
const unit = prevCount < count ? 1 : -1;
offsetStyle = {
transform: `translateY(${-getOffset(prevValue, value, unit)}00%)`
};
}
return /*#__PURE__*/_react_17_0_2_react.createElement("span", {
className: `${prefixCls}-only`,
style: offsetStyle,
onTransitionEnd: onTransitionEnd
}, unitNodes);
}
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/badge/ScrollNumber.js
"use client";
var __rest = undefined && undefined.__rest || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const ScrollNumber = /*#__PURE__*/_react_17_0_2_react.forwardRef((props, ref) => {
const {
prefixCls: customizePrefixCls,
count,
className,
motionClassName,
style,
title,
show,
component: Component = 'sup',
children
} = props,
restProps = __rest(props, ["prefixCls", "count", "className", "motionClassName", "style", "title", "show", "component", "children"]);
const {
getPrefixCls
} = _react_17_0_2_react.useContext(context/* ConfigContext */.E_);
const prefixCls = getPrefixCls('scroll-number', customizePrefixCls);
// ============================ Render ============================
const newProps = Object.assign(Object.assign({}, restProps), {
'data-show': show,
style,
className: _classnames_2_5_1_classnames_default()(prefixCls, className, motionClassName),
title: title
});
// Only integer need motion
let numberNodes = count;
if (count && Number(count) % 1 === 0) {
const numberList = String(count).split('');
numberNodes = /*#__PURE__*/_react_17_0_2_react.createElement("bdi", null, numberList.map((num, i) => /*#__PURE__*/_react_17_0_2_react.createElement(SingleNumber, {
prefixCls: prefixCls,
count: Number(count),
value: num,
// eslint-disable-next-line react/no-array-index-key
key: numberList.length - i
})));
}
// allow specify the border
// mock border-color by box-shadow for compatible with old usage:
// <Badge count={4} style={{ backgroundColor: '#fff', color: '#999', borderColor: '#d9d9d9' }} />
if (style && style.borderColor) {
newProps.style = Object.assign(Object.assign({}, style), {
boxShadow: `0 0 0 1px ${style.borderColor} inset`
});
}
if (children) {
return (0,reactNode/* cloneElement */.Tm)(children, oriProps => ({
className: _classnames_2_5_1_classnames_default()(`${prefixCls}-custom-component`, oriProps === null || oriProps === void 0 ? void 0 : oriProps.className, motionClassName)
}));
}
return /*#__PURE__*/_react_17_0_2_react.createElement(Component, Object.assign({}, newProps, {
ref: ref
}), numberNodes);
});
/* harmony default export */ var badge_ScrollNumber = (ScrollNumber);
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/badge/index.js
"use client";
var badge_rest = undefined && undefined.__rest || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const InternalBadge = (props, ref) => {
var _a, _b, _c, _d, _e;
const {
prefixCls: customizePrefixCls,
scrollNumberPrefixCls: customizeScrollNumberPrefixCls,
children,
status,
text,
color,
count = null,
overflowCount = 99,
dot = false,
size = 'default',
title,
offset,
style,
className,
rootClassName,
classNames,
styles,
showZero = false
} = props,
restProps = badge_rest(props, ["prefixCls", "scrollNumberPrefixCls", "children", "status", "text", "color", "count", "overflowCount", "dot", "size", "title", "offset", "style", "className", "rootClassName", "classNames", "styles", "showZero"]);
const {
getPrefixCls,
direction,
badge
} = _react_17_0_2_react.useContext(context/* ConfigContext */.E_);
const prefixCls = getPrefixCls('badge', customizePrefixCls);
// Style
const [wrapSSR, hashId] = badge_style(prefixCls);
// ================================ Misc ================================
const numberedDisplayCount = count > overflowCount ? `${overflowCount}+` : count;
const isZero = numberedDisplayCount === '0' || numberedDisplayCount === 0;
const ignoreCount = count === null || isZero && !showZero;
const hasStatus = (status !== null && status !== undefined || color !== null && color !== undefined) && ignoreCount;
const showAsDot = dot && !isZero;
const mergedCount = showAsDot ? '' : numberedDisplayCount;
const isHidden = (0,_react_17_0_2_react.useMemo)(() => {
const isEmpty = mergedCount === null || mergedCount === undefined || mergedCount === '';
return (isEmpty || isZero && !showZero) && !showAsDot;
}, [mergedCount, isZero, showZero, showAsDot]);
// Count should be cache in case hidden change it
const countRef = (0,_react_17_0_2_react.useRef)(count);
if (!isHidden) {
countRef.current = count;
}
const livingCount = countRef.current;
// We need cache count since remove motion should not change count display
const displayCountRef = (0,_react_17_0_2_react.useRef)(mergedCount);
if (!isHidden) {
displayCountRef.current = mergedCount;
}
const displayCount = displayCountRef.current;
// We will cache the dot status to avoid shaking on leaved motion
const isDotRef = (0,_react_17_0_2_react.useRef)(showAsDot);
if (!isHidden) {
isDotRef.current = showAsDot;
}
// =============================== Styles ===============================
const mergedStyle = (0,_react_17_0_2_react.useMemo)(() => {
if (!offset) {
return Object.assign(Object.assign({}, badge === null || badge === void 0 ? void 0 : badge.style), style);
}
const offsetStyle = {
marginTop: offset[1]
};
if (direction === 'rtl') {
offsetStyle.left = parseInt(offset[0], 10);
} else {
offsetStyle.right = -parseInt(offset[0], 10);
}
return Object.assign(Object.assign(Object.assign({}, offsetStyle), badge === null || badge === void 0 ? void 0 : badge.style), style);
}, [direction, offset, style, badge === null || badge === void 0 ? void 0 : badge.style]);
// =============================== Render ===============================
// >>> Title
const titleNode = title !== null && title !== void 0 ? title : typeof livingCount === 'string' || typeof livingCount === 'number' ? livingCount : undefined;
// >>> Status Text
const statusTextNode = isHidden || !text ? null : /*#__PURE__*/_react_17_0_2_react.createElement("span", {
className: `${prefixCls}-status-text`
}, text);
// >>> Display Component
const displayNode = !livingCount || typeof livingCount !== 'object' ? undefined : (0,reactNode/* cloneElement */.Tm)(livingCount, oriProps => ({
style: Object.assign(Object.assign({}, mergedStyle), oriProps.style)
}));
// InternalColor
const isInternalColor = (0,colors/* isPresetColor */.o2)(color, false);
// Shared styles
const statusCls = _classnames_2_5_1_classnames_default()(classNames === null || classNames === void 0 ? void 0 : classNames.indicator, (_a = badge === null || badge === void 0 ? void 0 : badge.classNames) === null || _a === void 0 ? void 0 : _a.indicator, {
[`${prefixCls}-status-dot`]: hasStatus,
[`${prefixCls}-status-${status}`]: !!status,
[`${prefixCls}-color-${color}`]: isInternalColor
});
const statusStyle = {};
if (color && !isInternalColor) {
statusStyle.color = color;
statusStyle.background = color;
}
const badgeClassName = _classnames_2_5_1_classnames_default()(prefixCls, {
[`${prefixCls}-status`]: hasStatus,
[`${prefixCls}-not-a-wrapper`]: !children,
[`${prefixCls}-rtl`]: direction === 'rtl'
}, className, rootClassName, badge === null || badge === void 0 ? void 0 : badge.className, (_b = badge === null || badge === void 0 ? void 0 : badge.classNames) === null || _b === void 0 ? void 0 : _b.root, classNames === null || classNames === void 0 ? void 0 : classNames.root, hashId);
// <Badge status="success" />
if (!children && hasStatus) {
const statusTextColor = mergedStyle.color;
return wrapSSR( /*#__PURE__*/_react_17_0_2_react.createElement("span", Object.assign({}, restProps, {
className: badgeClassName,
style: Object.assign(Object.assign(Object.assign({}, styles === null || styles === void 0 ? void 0 : styles.root), (_c = badge === null || badge === void 0 ? void 0 : badge.styles) === null || _c === void 0 ? void 0 : _c.root), mergedStyle)
}), /*#__PURE__*/_react_17_0_2_react.createElement("span", {
className: statusCls,
style: Object.assign(Object.assign(Object.assign({}, styles === null || styles === void 0 ? void 0 : styles.indicator), (_d = badge === null || badge === void 0 ? void 0 : badge.styles) === null || _d === void 0 ? void 0 : _d.indicator), statusStyle)
}), text && /*#__PURE__*/_react_17_0_2_react.createElement("span", {
style: {
color: statusTextColor
},
className: `${prefixCls}-status-text`
}, text)));
}
return wrapSSR( /*#__PURE__*/_react_17_0_2_react.createElement("span", Object.assign({
ref: ref
}, restProps, {
className: badgeClassName,
style: Object.assign(Object.assign({}, (_e = badge === null || badge === void 0 ? void 0 : badge.styles) === null || _e === void 0 ? void 0 : _e.root), styles === null || styles === void 0 ? void 0 : styles.root)
}), children, /*#__PURE__*/_react_17_0_2_react.createElement(es["default"], {
visible: !isHidden,
motionName: `${prefixCls}-zoom`,
motionAppear: false,
motionDeadline: 1000
}, _ref => {
let {
className: motionClassName,
ref: scrollNumberRef
} = _ref;
var _a, _b;
const scrollNumberPrefixCls = getPrefixCls('scroll-number', customizeScrollNumberPrefixCls);
const isDot = isDotRef.current;
const scrollNumberCls = _classnames_2_5_1_classnames_default()(classNames === null || classNames === void 0 ? void 0 : classNames.indicator, (_a = badge === null || badge === void 0 ? void 0 : badge.classNames) === null || _a === void 0 ? void 0 : _a.indicator, {
[`${prefixCls}-dot`]: isDot,
[`${prefixCls}-count`]: !isDot,
[`${prefixCls}-count-sm`]: size === 'small',
[`${prefixCls}-multiple-words`]: !isDot && displayCount && displayCount.toString().length > 1,
[`${prefixCls}-status-${status}`]: !!status,
[`${prefixCls}-color-${color}`]: isInternalColor
});
let scrollNumberStyle = Object.assign(Object.assign(Object.assign({}, styles === null || styles === void 0 ? void 0 : styles.indicator), (_b = badge === null || badge === void 0 ? void 0 : badge.styles) === null || _b === void 0 ? void 0 : _b.indicator), mergedStyle);
if (color && !isInternalColor) {
scrollNumberStyle = scrollNumberStyle || {};
scrollNumberStyle.background = color;
}
return /*#__PURE__*/_react_17_0_2_react.createElement(badge_ScrollNumber, {
prefixCls: scrollNumberPrefixCls,
show: !isHidden,
motionClassName: motionClassName,
className: scrollNumberCls,
count: displayCount,
title: titleNode,
style: scrollNumberStyle,
key: "scrollNumber",
ref: scrollNumberRef
}, displayNode);
}), statusTextNode));
};
const Badge = /*#__PURE__*/_react_17_0_2_react.forwardRef(InternalBadge);
Badge.Ribbon = badge_Ribbon;
if (false) {}
/* harmony default export */ var badge = (Badge);
/***/ })
}]);