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 { genStyleHooks as l } from "../../theme/util/genComponentStyleHook.mjs";
import { merge as p } from "../../theme/util/statistic.mjs";
const m = (r) => {
  const {
    componentCls: e
  } = r;
  return {
    // Grid system
    [e]: {
      display: "flex",
      flexFlow: "row wrap",
      minWidth: 0,
      "&::before, &::after": {
        display: "flex"
      },
      "&-no-wrap": {
        flexWrap: "nowrap"
      },
      // The origin of the X-axis
      "&-start": {
        justifyContent: "flex-start"
      },
      // The center of the X-axis
      "&-center": {
        justifyContent: "center"
      },
      // The opposite of the X-axis
      "&-end": {
        justifyContent: "flex-end"
      },
      "&-space-between": {
        justifyContent: "space-between"
      },
      "&-space-around": {
        justifyContent: "space-around"
      },
      "&-space-evenly": {
        justifyContent: "space-evenly"
      },
      // Align at the top
      "&-top": {
        alignItems: "flex-start"
      },
      // Align at the center
      "&-middle": {
        alignItems: "center"
      },
      "&-bottom": {
        alignItems: "flex-end"
      }
    }
  };
}, d = (r) => {
  const {
    componentCls: e
  } = r;
  return {
    // Grid system
    [e]: {
      position: "relative",
      maxWidth: "100%",
      // Prevent columns from collapsing when empty
      minHeight: 1
    }
  };
}, $ = (r, e) => {
  const {
    componentCls: n,
    gridColumns: i
  } = r, o = {};
  for (let t = i; t >= 0; t--)
    t === 0 ? (o[`${n}${e}-${t}`] = {
      display: "none"
    }, o[`${n}-push-${t}`] = {
      insetInlineStart: "auto"
    }, o[`${n}-pull-${t}`] = {
      insetInlineEnd: "auto"
    }, o[`${n}${e}-push-${t}`] = {
      insetInlineStart: "auto"
    }, o[`${n}${e}-pull-${t}`] = {
      insetInlineEnd: "auto"
    }, o[`${n}${e}-offset-${t}`] = {
      marginInlineStart: 0
    }, o[`${n}${e}-order-${t}`] = {
      order: 0
    }) : (o[`${n}${e}-${t}`] = [
      // https://github.com/ant-design/ant-design/issues/44456
      // Form set `display: flex` on Col which will override `display: block`.
      // Let's get it from css variable to support override.
      {
        "--ant-display": "block",
        // Fallback to display if variable not support
        display: "block"
      },
      {
        display: "var(--ant-display)",
        flex: `0 0 ${t / i * 100}%`,
        maxWidth: `${t / i * 100}%`
      }
    ], o[`${n}${e}-push-${t}`] = {
      insetInlineStart: `${t / i * 100}%`
    }, o[`${n}${e}-pull-${t}`] = {
      insetInlineEnd: `${t / i * 100}%`
    }, o[`${n}${e}-offset-${t}`] = {
      marginInlineStart: `${t / i * 100}%`
    }, o[`${n}${e}-order-${t}`] = {
      order: t
    });
  return o;
}, s = (r, e) => $(r, e), c = (r, e, n) => ({
  [`@media (min-width: ${a(e)})`]: Object.assign({}, s(r, n))
}), u = () => ({}), f = () => ({}), L = l("Grid", m, u), O = l("Grid", (r) => {
  const e = p(r, {
    gridColumns: 24
    // Row is divided into 24 parts in Grid
  }), n = {
    "-sm": e.screenSMMin,
    "-md": e.screenMDMin,
    "-lg": e.screenLGMin,
    "-xl": e.screenXLMin,
    "-xxl": e.screenXXLMin
  };
  return [d(e), s(e, ""), s(e, "-xs"), Object.keys(n).map((i) => c(e, n[i], i)).reduce((i, o) => Object.assign(Object.assign({}, i), o), {})];
}, f);
export {
  f as prepareColComponentToken,
  u as prepareRowComponentToken,
  O as useColStyle,
  L as useRowStyle
};
