import "../../../../@ant-design/cssinjs/es/extractStyle.mjs";
import "../../../../@ant-design/cssinjs/es/hooks/useCacheToken.mjs";
import "react";
import "../../../../@ant-design/cssinjs/es/StyleContext.mjs";
import { unit as a } from "../../../../@ant-design/cssinjs/es/util/index.mjs";
import "../../../../@ant-design/cssinjs/es/hooks/useCompatibleInsertionEffect.mjs";
import "../../../../@ant-design/cssinjs/es/hooks/useEffectCleanupRegister.mjs";
import "../../../../@ant-design/cssinjs/es/hooks/useHMR.mjs";
import "../../../../rc-util/es/warning.mjs";
import "../../../../@ant-design/cssinjs/es/theme/createTheme.mjs";
import "../../../../@ant-design/cssinjs/es/theme/ThemeCache.mjs";
import "../../../../@ant-design/cssinjs/es/transformers/legacyLogicalProperties.mjs";
import { resetComponent as r } from "../../style/index.mjs";
import { genStyleHooks as l } from "../../theme/util/genComponentStyleHook.mjs";
import { merge as d } from "../../theme/util/statistic.mjs";
const o = (i) => {
  const {
    componentCls: t,
    calc: e
  } = i;
  return {
    [t]: Object.assign(Object.assign({}, r(i)), {
      margin: 0,
      padding: 0,
      listStyle: "none",
      [`${t}-item`]: {
        position: "relative",
        margin: 0,
        paddingBottom: i.itemPaddingBottom,
        fontSize: i.fontSize,
        listStyle: "none",
        "&-tail": {
          position: "absolute",
          insetBlockStart: i.itemHeadSize,
          insetInlineStart: e(e(i.itemHeadSize).sub(i.tailWidth)).div(2).equal(),
          height: `calc(100% - ${a(i.itemHeadSize)})`,
          borderInlineStart: `${a(i.tailWidth)} ${i.lineType} ${i.tailColor}`
        },
        "&-pending": {
          [`${t}-item-head`]: {
            fontSize: i.fontSizeSM,
            backgroundColor: "transparent"
          },
          [`${t}-item-tail`]: {
            display: "none"
          }
        },
        "&-head": {
          position: "absolute",
          width: i.itemHeadSize,
          height: i.itemHeadSize,
          backgroundColor: i.dotBg,
          border: `${a(i.dotBorderWidth)} ${i.lineType} transparent`,
          borderRadius: "50%",
          "&-blue": {
            color: i.colorPrimary,
            borderColor: i.colorPrimary
          },
          "&-red": {
            color: i.colorError,
            borderColor: i.colorError
          },
          "&-green": {
            color: i.colorSuccess,
            borderColor: i.colorSuccess
          },
          "&-gray": {
            color: i.colorTextDisabled,
            borderColor: i.colorTextDisabled
          }
        },
        "&-head-custom": {
          position: "absolute",
          insetBlockStart: e(i.itemHeadSize).div(2).equal(),
          insetInlineStart: e(i.itemHeadSize).div(2).equal(),
          width: "auto",
          height: "auto",
          marginBlockStart: 0,
          paddingBlock: i.customHeadPaddingVertical,
          lineHeight: 1,
          textAlign: "center",
          border: 0,
          borderRadius: 0,
          transform: "translate(-50%, -50%)"
        },
        "&-content": {
          position: "relative",
          insetBlockStart: e(e(i.fontSize).mul(i.lineHeight).sub(i.fontSize)).mul(-1).add(i.lineWidth).equal(),
          marginInlineStart: e(i.margin).add(i.itemHeadSize).equal(),
          marginInlineEnd: 0,
          marginBlockStart: 0,
          marginBlockEnd: 0,
          wordBreak: "break-word"
        },
        "&-last": {
          [`> ${t}-item-tail`]: {
            display: "none"
          },
          [`> ${t}-item-content`]: {
            minHeight: e(i.controlHeightLG).mul(1.2).equal()
          }
        }
      },
      [`&${t}-alternate,
        &${t}-right,
        &${t}-label`]: {
        [`${t}-item`]: {
          "&-tail, &-head, &-head-custom": {
            insetInlineStart: "50%"
          },
          "&-head": {
            marginInlineStart: e(i.marginXXS).mul(-1).equal(),
            "&-custom": {
              marginInlineStart: e(i.tailWidth).div(2).equal()
            }
          },
          "&-left": {
            [`${t}-item-content`]: {
              insetInlineStart: `calc(50% - ${a(i.marginXXS)})`,
              width: `calc(50% - ${a(i.marginSM)})`,
              textAlign: "start"
            }
          },
          "&-right": {
            [`${t}-item-content`]: {
              width: `calc(50% - ${a(i.marginSM)})`,
              margin: 0,
              textAlign: "end"
            }
          }
        }
      },
      [`&${t}-right`]: {
        [`${t}-item-right`]: {
          [`${t}-item-tail,
            ${t}-item-head,
            ${t}-item-head-custom`]: {
            insetInlineStart: `calc(100% - ${a(e(e(i.itemHeadSize).add(i.tailWidth)).div(2).equal())})`
          },
          [`${t}-item-content`]: {
            width: `calc(100% - ${a(e(i.itemHeadSize).add(i.marginXS).equal())})`
          }
        }
      },
      [`&${t}-pending
        ${t}-item-last
        ${t}-item-tail`]: {
        display: "block",
        height: `calc(100% - ${a(i.margin)})`,
        borderInlineStart: `${a(i.tailWidth)} dotted ${i.tailColor}`
      },
      [`&${t}-reverse
        ${t}-item-last
        ${t}-item-tail`]: {
        display: "none"
      },
      [`&${t}-reverse ${t}-item-pending`]: {
        [`${t}-item-tail`]: {
          insetBlockStart: i.margin,
          display: "block",
          height: `calc(100% - ${a(i.margin)})`,
          borderInlineStart: `${a(i.tailWidth)} dotted ${i.tailColor}`
        },
        [`${t}-item-content`]: {
          minHeight: e(i.controlHeightLG).mul(1.2).equal()
        }
      },
      [`&${t}-label`]: {
        [`${t}-item-label`]: {
          position: "absolute",
          insetBlockStart: e(e(i.fontSize).mul(i.lineHeight).sub(i.fontSize)).mul(-1).add(i.tailWidth).equal(),
          width: `calc(50% - ${a(i.marginSM)})`,
          textAlign: "end"
        },
        [`${t}-item-right`]: {
          [`${t}-item-label`]: {
            insetInlineStart: `calc(50% + ${a(i.marginSM)})`,
            width: `calc(50% - ${a(i.marginSM)})`,
            textAlign: "start"
          }
        }
      },
      // ====================== RTL =======================
      "&-rtl": {
        direction: "rtl",
        [`${t}-item-head-custom`]: {
          transform: "translate(50%, -50%)"
        }
      }
    })
  };
}, n = (i) => ({
  tailColor: i.colorSplit,
  tailWidth: i.lineWidthBold,
  dotBorderWidth: i.wireframe ? i.lineWidthBold : i.lineWidth * 3,
  dotBg: i.colorBgContainer,
  itemPaddingBottom: i.padding * 1.25
}), C = l("Timeline", (i) => {
  const t = d(i, {
    itemHeadSize: 10,
    customHeadPaddingVertical: i.paddingXXS,
    paddingInlineEnd: 2
  });
  return [o(t)];
}, n);
export {
  C as default,
  n as prepareComponentToken
};
