1import { r as reactExports, t as useLayoutEffect, m as classNames, o as resetComponent, v as useComponentConfig } from "./app-DJioUbN4.js"; 2import { c as cloneElement, g as genStyleHooks, m as merge } from "./reactNode-B_hytNsN.js"; 3import { K as Keyframe } from "./ContextIsolator-B0hFr7x3.js"; 4function throttle(delay, callback, options) { 5 var _ref = options || {}, _ref$noTrailing = _ref.noTrailing, noTrailing = _ref$noTrailing === void 0 ? false : _ref$noTrailing, _ref$noLeading = _ref.noLeading, noLeading = _ref$noLeading === void 0 ? false : _ref$noLeading, _ref$debounceMode = _ref.debounceMode, debounceMode = _ref$debounceMode === void 0 ? void 0 : _ref$debounceMode; 6 var timeoutID; 7 var cancelled = false; 8 var lastExec = 0; 9 function clearExistingTimeout() { 10 if (timeoutID) { 11 clearTimeout(timeoutID); 12 } 13 } 14 function cancel(options2) { 15 var _ref2 = options2 || {}, _ref2$upcomingOnly = _ref2.upcomingOnly, upcomingOnly = _ref2$upcomingOnly === void 0 ? false : _ref2$upcomingOnly; 16 clearExistingTimeout(); 17 cancelled = !upcomingOnly; 18 } 19 function wrapper() { 20 for (var _len = arguments.length, arguments_ = new Array(_len), _key = 0; _key < _len; _key++) { 21 arguments_[_key] = arguments[_key]; 22 } 23 var self = this; 24 var elapsed = Date.now() - lastExec; 25 if (cancelled) { 26 return; 27 } 28 function exec() { 29 lastExec = Date.now(); 30 callback.apply(self, arguments_); 31 } 32 function clear() { 33 timeoutID = void 0; 34 } 35 if (!noLeading && debounceMode && !timeoutID) { 36 exec(); 37 } 38 clearExistingTimeout(); 39 if (debounceMode === void 0 && elapsed > delay) { 40 if (noLeading) { 41 lastExec = Date.now(); 42 if (!noTrailing) { 43 timeoutID = setTimeout(debounceMode ? clear : exec, delay); 44 } 45 } else { 46 exec(); 47 } 48 } else if (noTrailing !== true) { 49 timeoutID = setTimeout(debounceMode ? clear : exec, debounceMode === void 0 ? delay - elapsed : delay); 50 } 51 } 52 wrapper.cancel = cancel; 53 return wrapper; 54} 55function debounce(delay, callback, options) { 56 var _ref = {}, _ref$atBegin = _ref.atBegin, atBegin = _ref$atBegin === void 0 ? false : _ref$atBegin; 57 return throttle(delay, callback, { 58 debounceMode: atBegin !== false 59 }); 60} 61const viewSize = 100; 62const borderWidth = viewSize / 5; 63const radius = viewSize / 2 - borderWidth / 2; 64const circumference = radius * 2 * Math.PI; 65const position = 50; 66const CustomCircle = (props) => { 67 const { 68 dotClassName, 69 style, 70 hasCircleCls 71 } = props; 72 return /* @__PURE__ */ reactExports.createElement("circle", { 73 className: classNames(`${dotClassName}-circle`, { 74 [`${dotClassName}-circle-bg`]: hasCircleCls 75 }), 76 r: radius, 77 cx: position, 78 cy: position, 79 strokeWidth: borderWidth, 80 style 81 }); 82}; 83const Progress = ({ 84 percent, 85 prefixCls 86}) => { 87 const dotClassName = `${prefixCls}-dot`; 88 const holderClassName = `${dotClassName}-holder`; 89 const hideClassName = `${holderClassName}-hidden`; 90 const [render, setRender] = reactExports.useState(false); 91 useLayoutEffect(() => { 92 if (percent !== 0) { 93 setRender(true); 94 } 95 }, [percent !== 0]); 96 const safePtg = Math.max(Math.min(percent, 100), 0); 97 if (!render) { 98 return null; 99 } 100 const circleStyle = { 101 strokeDashoffset: `${circumference / 4}`, 102 strokeDasharray: `${circumference * safePtg / 100} ${circumference * (100 - safePtg) / 100}` 103 }; 104 return /* @__PURE__ */ reactExports.createElement("span", { 105 className: classNames(holderClassName, `${dotClassName}-progress`, safePtg <= 0 && hideClassName) 106 }, /* @__PURE__ */ reactExports.createElement("svg", { 107 viewBox: `0 0 ${viewSize} ${viewSize}`, 108 role: "progressbar", 109 "aria-valuemin": 0, 110 "aria-valuemax": 100, 111 "aria-valuenow": safePtg 112 }, /* @__PURE__ */ reactExports.createElement(CustomCircle, { 113 dotClassName, 114 hasCircleCls: true 115 }), /* @__PURE__ */ reactExports.createElement(CustomCircle, { 116 dotClassName, 117 style: circleStyle 118 }))); 119}; 120function Looper(props) { 121 const { 122 prefixCls, 123 percent = 0 124 } = props; 125 const dotClassName = `${prefixCls}-dot`; 126 const holderClassName = `${dotClassName}-holder`; 127 const hideClassName = `${holderClassName}-hidden`; 128 return /* @__PURE__ */ reactExports.createElement(reactExports.Fragment, null, /* @__P
128URE__ */ reactExports.createElement("span", { 129 className: classNames(holderClassName, percent > 0 && hideClassName) 130 }, /* @__PURE__ */ reactExports.createElement("span", { 131 className: classNames(dotClassName, `${prefixCls}-dot-spin`) 132 }, [1, 2, 3, 4].map((i) => /* @__PURE__ */ reactExports.createElement("i", { 133 className: `${prefixCls}-dot-item`, 134 key: i 135 })))), /* @__PURE__ */ reactExports.createElement(Progress, { 136 prefixCls, 137 percent 138 })); 139} 140function Indicator(props) { 141 var _a; 142 const { 143 prefixCls, 144 indicator, 145 percent 146 } = props; 147 const dotClassName = `${prefixCls}-dot`; 148 if (indicator && /* @__PURE__ */ reactExports.isValidElement(indicator)) { 149 return cloneElement(indicator, { 150 className: classNames((_a = indicator.props) === null || _a === void 0 ? void 0 : _a.className, dotClassName), 151 percent 152 }); 153 } 154 return /* @__PURE__ */ reactExports.createElement(Looper, { 155 prefixCls, 156 percent 157 }); 158} 159const antSpinMove = new Keyframe("antSpinMove", { 160 to: { 161 opacity: 1 162 } 163}); 164const antRotate = new Keyframe("antRotate", { 165 to: { 166 transform: "rotate(405deg)" 167 } 168}); 169const genSpinStyle = (token) => { 170 const { 171 componentCls, 172 calc 173 } = token; 174 return { 175 [componentCls]: Object.assign(Object.assign({}, resetComponent(token)), { 176 position: "absolute", 177 display: "none", 178 color: token.colorPrimary, 179 fontSize: 0, 180 textAlign: "center", 181 verticalAlign: "middle", 182 opacity: 0, 183 transition: `transform ${token.motionDurationSlow} ${token.motionEaseInOutCirc}`, 184 "&-spinning": { 185 position: "relative", 186 display: "inline-block", 187 opacity: 1 188 }, 189 [`${componentCls}-text`]: { 190 fontSize: token.fontSize, 191 paddingTop: calc(calc(token.dotSize).sub(token.fontSize)).div(2).add(2).equal() 192 }, 193 "&-fullscreen": { 194 position: "fixed", 195 width: "100vw", 196 height: "100vh", 197 backgroundColor: token.colorBgMask, 198 zIndex: token.zIndexPopupBase, 199 inset: 0, 200 display: "flex", 201 alignItems: "center", 202 flexDirection: "column", 203 justifyContent: "center", 204 opacity: 0, 205 visibility: "hidden", 206 transition: `all ${token.motionDurationMid}`, 207 "&-show": { 208 opacity: 1, 209 visibility: "visible" 210 }, 211 [componentCls]: { 212 [`${componentCls}-dot-holder`]: { 213 color: token.colorWhite 214 }, 215 [`${componentCls}-text`]: { 216 color: token.colorTextLightSolid 217 } 218 } 219 }, 220 "&-nested-loading": { 221 position: "relative", 222 [`> div > ${componentCls}`]: { 223 position: "absolute", 224 top: 0, 225 insetInlineStart: 0, 226 zIndex: 4, 227 display: "block", 228 width: "100%", 229 height: "100%", 230 maxHeight: token.contentHeight, 231 [`${componentCls}-dot`]: { 232 position: "absolute", 233 top: "50%", 234 insetInlineStart: "50%", 235 margin: calc(token.dotSize).mul(-1).div(2).equal() 236 }, 237 [`${componentCls}-text`]: { 238 position: "absolute", 239 top: "50%", 240 width: "100%", 241 textShadow: `0 1px 2px ${token.colorBgContainer}` 242 // FIXME: shadow 243 }, 244 [`&${componentCls}-show-text ${componentCls}-dot`]: { 245 marginTop: calc(token.dotSize).div(2).mul(-1).sub(10).equal() 246 }, 247 "&-sm": { 248 [`${componentCls}-dot`]: { 249 margin: calc(token.dotSizeSM).mul(-1).div(2).equal() 250 }, 251 [`${componentCls}-text`]: { 252 paddingTop: calc(calc(token.dotSizeSM).sub(token.fontSize)).div(2).add(2).equal() 253 }, 254 [`&${componentCls}-show-text ${componentCls}-dot`]: { 255 marginTop: calc(token.dotSizeSM).div(2).mul(-1).sub(10).equal() 256 } 257 }, 258 "&-lg": { 259 [`${componentCls}-dot`]: { 260 margin: calc(token.dotSizeLG).mul(-1).div(2).equal() 261 }, 262 [`${componentCls}-text`]: { 263 paddingTop: calc(calc(token.dotSizeLG).sub(token.fontSize)).div(2).add(2).equal() 264 }, 265 [`&${componentCls}-show-text ${componentCls}-dot`]: { 266 marginTop: calc(token.dotSizeLG).div(2).mul(-1).sub(10).equal() 267 } 268 } 269 }, 270 [`${componentCls}-container`]: { 271 position: "relative", 272 transition: `opacity ${token.motionDurationSlow}`, 273 "&::after": { 274 position: "absolute", 275 top: 0, 276 insetInlineEnd: 0, 277 bottom: 0, 278 insetInlineStart: 0, 279 zIndex: 10, 280 width: "100%", 281 height: "100%", 282 background: token.colorBgContainer, 283 opacity: 0, 284 transition: `all ${token.motionDurationSlow}`, 285 content: '""', 286 pointerEvents: "none" 287 } 288 }, 289 [`${componentCls}-blur`]: { 290 clear: "both", 291 opacity: 0.5, 292 userSelect: "none", 293 pointerEvents: "none", 294 "&::after": { 295 opacity: 0.4, 296 pointerEvents: "auto" 297 } 298 } 299 }, 300 // tip 301 // ------------------------------ 302 "&-tip": { 303 color: token.spinDotDefault 304 }, 305 // holder 306 // ------------------------------ 307 [`${componentCls}-dot-holder`]: { 308 width: "1em", 309 height: "1em", 310 fontSize: token.dotSize, 311 display: "inline-block", 312 transition: `transform ${token.motionDurationSlow} ease, opacity ${token.motionDurationSlow} ease`, 313 transformOrigin: "50% 50%", 314 lineHeight: 1, 315 color: token.colorPrimary, 316 "&-hidden": { 317 transform: "scale(0.3)", 318 opacity: 0 319 } 320 }, 321 // progress 322 // ------------------------------ 323 [`${componentCls}-dot-progress`]: { 324 position: "absolute", 325 inset: 0 326 }, 327 // dots 328 // ------------------------------ 329 [`${componentCls}-dot`]: { 330 position: "relative", 331 display: "inline-block", 332 fontSize: token.dotSize, 333 width: "1em", 334 height: "1em", 335 "&-item": { 336 position: "absolute", 337 display: "block", 338 width: calc(token.dotSize).sub(calc(token.marginXXS).div(2)).div(2).equal(), 339 height: calc(token.dotSize).sub(calc(token.marginXXS).div(2)).div(2).equal(), 340 background: "currentColor", 341 borderRadius: "100%", 342 transform: "scale(0.75)", 343 transformOrigin: "50% 50%", 344 opacity: 0.3, 345 animationName: antSpinMove, 346 animationDuration: "1s", 347 animationIterationCount: "infinite", 348 animationTimingFunction: "linear", 349 animationDirection: "alternate", 350 "&:nth-child(1)": { 351 top: 0, 352 insetInlineStart: 0, 353 animationDelay: "0s" 354 }, 355 "&:nth-child(2)": { 356 top: 0, 357 insetInlineEnd: 0, 358 animationDelay: "0.4s" 359 }, 360 "&:nth-child(3)": { 361 insetInlineEnd: 0, 362 bottom: 0, 363 animationDelay: "0.8s" 364 }, 365 "&:nth-child(4)": { 366 bottom: 0, 367 insetInlineStart: 0, 368 animationDelay: "1.2s" 369 } 370 }, 371 "&-spin": { 372 transform: "rotate(45deg)", 373 animationName: antRotate, 374 animationDuration: "1.2s", 375 animationIterationCount: "infinite", 376 animationTimingFunction: "linear" 377 }, 378 "&-circle": { 379 strokeLinecap: "round", 380 transition: ["stroke-dashoffset", "stroke-dasharray", "stroke", "stroke-width", "opacity"].map((item) => `${item} ${token.motionDurationSlow} ease`).join(","), 381 fillOpacity: 0, 382 stroke: "currentcolor" 383 }, 384 "&-circle-bg": { 385 stroke: token.colorFillSecondary 386 } 387 }, 388 // small 389 [`&-sm ${componentCls}-dot`]: { 390 "&, &-holder": { 391 fontSize: token.dotSizeSM 392 } 393 }, 394 [`&-sm ${componentCls}-dot-holder`]: { 395 i: { 396 width: calc(calc(token.dotSizeSM).sub(calc(token.marginXXS).div(2))).div(2).equal(), 397 height: calc(calc(token.dotSizeSM).sub(calc(token.marginXXS).div(2))).div(2).equal() 398 } 399 }, 400 // large 401 [`&-lg ${componentCls}-dot`]: { 402 "&, &-holder": { 403 fontSize: token.dotSizeLG 404 } 405 }, 406 [`&-lg ${componentCls}-dot-holder`]: { 407 i: { 408 width: calc(calc(token.dotSizeLG).sub(token.marginXXS)).div(2).equal(), 409 height: calc(calc(token.dotSizeLG).sub(token.marginXXS)).div(2).equal() 410 } 411 }, 412 [`&${componentCls}-show-text ${componentCls}-text`]: { 413 display: "block" 414 } 415 }) 416 }; 417}; 418const prepareComponentToken = (token) => { 419 const { 420 controlHeightLG, 421 controlHeight 422 } = token; 423 return { 424 contentHeight: 400, 425 dotSize: controlHeightLG / 2, 426 dotSizeSM: controlHeightLG * 0.35, 427 dotSizeLG: controlHeight 428 }; 429}; 430const useStyle = genStyleHooks("Spin", (token) => { 431 const spinToken = merge(token, { 432 spinDotDefault: token.colorTextDescription 433 }); 434 return genSpinStyle(spinToken); 435}, prepareComponentToken); 436const AUTO_INTERVAL = 200; 437const STEP_BUCKETS = [[30, 0.05], [70, 0.03], [96, 0.01]]; 438function usePercent(spinning, percent) { 439 const [mockPercent, setMockPercent] = reactExports.useState(0); 440 const mockIntervalRef = reactExports.useRef(null); 441 const isAuto = percent === "auto"; 442 reactExports.useEffect(() => { 443 if (isAuto && spinning) { 444 setMockPercent(0); 445 mockIntervalRef.current = setInterval(() => { 446 setMockPercent((prev) => { 447 const restPTG = 100 - prev; 448 for (let i = 0; i < STEP_BUCKETS.length; i += 1) { 449 const [limit, stepPtg] = STEP_BUCKETS[i]; 450 if (prev <= limit) { 451 return prev + restPTG * stepPtg; 452 } 453 } 454 return prev; 455 }); 456 }, AUTO_INTERVAL); 457 } 458 return () => { 459 if (mockIntervalRef.current) { 460 clearInterval(mockIntervalRef.current); 461 mockIntervalRef.current = null; 462 } 463 }; 464 }, [isAuto, spinning]); 465 return isAuto ? mockPercent : percent; 466} 467var __rest = function(s, e) { 468 var t = {}; 469 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; 470 if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { 471 if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; 472 } 473 return t; 474}; 475let defaultIndicator; 476function shouldDelay(spinning, delay) { 477 return !!spinning && !!delay && !Number.isNaN(Number(delay)); 478} 479const Spin = (props) => { 480 var _a; 481 const { 482 prefixCls: customizePrefixCls, 483 spinning: customSpinning = true,
484 delay = 0, 485 className, 486 rootClassName, 487 size = "default", 488 tip, 489 wrapperClassName, 490 style, 491 children, 492 fullscreen = false, 493 indicator, 494 percent 495 } = props, restProps = __rest(props, ["prefixCls", "spinning", "delay", "className", "rootClassName", "size", "tip", "wrapperClassName", "style", "children", "fullscreen", "indicator", "percent"]); 496 const { 497 getPrefixCls, 498 direction, 499 className: contextClassName, 500 style: contextStyle, 501 indicator: contextIndicator 502 } = useComponentConfig("spin"); 503 const prefixCls = getPrefixCls("spin", customizePrefixCls); 504 const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls); 505 const [spinning, setSpinning] = reactExports.useState(() => customSpinning && !shouldDelay(customSpinning, delay)); 506 const mergedPercent = usePercent(spinning, percent); 507 reactExports.useEffect(() => { 508 if (customSpinning) { 509 const showSpinning = debounce(delay, () => { 510 setSpinning(true); 511 }); 512 showSpinning(); 513 return () => { 514 var _a2; 515 (_a2 = showSpinning === null || showSpinning === void 0 ? void 0 : showSpinning.cancel) === null || _a2 === void 0 ? void 0 : _a2.call(showSpinning); 516 }; 517 } 518 setSpinning(false); 519 }, [delay, customSpinning]); 520 const isNestedPattern = reactExports.useMemo(() => typeof children !== "undefined" && !fullscreen, [children, fullscreen]); 521 const spinClassName = classNames(prefixCls, contextClassName, { 522 [`${prefixCls}-sm`]: size === "small", 523 [`${prefixCls}-lg`]: size === "large", 524 [`${prefixCls}-spinning`]: spinning, 525 [`${prefixCls}-show-text`]: !!tip, 526 [`${prefixCls}-rtl`]: direction === "rtl" 527 }, className, !fullscreen && rootClassName, hashId, cssVarCls); 528 const containerClassName = classNames(`${prefixCls}-container`, { 529 [`${prefixCls}-blur`]: spinning 530 }); 531 const mergedIndicator = (_a = indicator !== null && indicator !== void 0 ? indicator : contextIndicator) !== null && _a !== void 0 ? _a : defaultIndicator; 532 const mergedStyle = Object.assign(Object.assign({}, contextStyle), style); 533 const spinElement = /* @__PURE__ */ reactExports.createElement("div", Object.assign({}, restProps, { 534 style: mergedStyle, 535 className: spinClassName, 536 "aria-live": "polite", 537 "aria-busy": spinning 538 }), /* @__PURE__ */ reactExports.createElement(Indicator, { 539 prefixCls, 540 indicator: mergedIndicator, 541 percent: mergedPercent 542 }), tip && (isNestedPattern || fullscreen) ? /* @__PURE__ */ reactExports.createElement("div", { 543 className: `${prefixCls}-text` 544 }, tip) : null); 545 if (isNestedPattern) { 546 return wrapCSSVar(/* @__PURE__ */ reactExports.createElement("div", Object.assign({}, restProps, { 547 className: classNames(`${prefixCls}-nested-loading`, wrapperClassName, hashId, cssVarCls) 548 }), spinning && /* @__PURE__ */ reactExports.createElement("div", { 549 key: "loading" 550 }, spinElement), /* @__PURE__ */ reactExports.createElement("div", { 551 className: containerClassName, 552 key: "container" 553 }, children))); 554 } 555 if (fullscreen) { 556 return wrapCSSVar(/* @__PURE__ */ reactExports.createElement("div", { 557 className: classNames(`${prefixCls}-fullscreen`, { 558 [`${prefixCls}-fullscreen-show`]: spinning 559 }, rootClassName, hashId, cssVarCls) 560 }, spinElement)); 561 } 562 return wrapCSSVar(spinElement); 563}; 564Spin.setDefaultIndicator = (indicator) => { 565 defaultIndicator = indicator; 566}; 567export { 568 Spin as S 569};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.