"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const jsxRuntime = require("react/jsx-runtime");
;/* empty css                                                                                                                          */
const RcTree = require("rc-tree");
const React = require("react");
const motion = require("./motion.cjs");
const renderSwitcherIcon = require("./renderSwitcherIcon.cjs");
const useCss = require("../../node_modules/.pnpm/@mantine_emotion@7.15.2_@emotion_cache@11.14.0_@emotion_react@11.14.0_@types_react@18.3.18_re_vflj3eioazr6wkrxpatinf66nq/node_modules/@mantine/emotion/esm/use-css.cjs");
const Global = require("../../node_modules/.pnpm/@mantine_emotion@7.15.2_@emotion_cache@11.14.0_@emotion_react@11.14.0_@types_react@18.3.18_re_vflj3eioazr6wkrxpatinf66nq/node_modules/@mantine/emotion/esm/Global.cjs");
const Tree = React.forwardRef((props, ref) => {
  const {
    prefixCls = "tc-uikit-tree",
    className,
    switcherIcon,
    showIcon = false,
    showLine,
    blockNode = false,
    checkable = false,
    selectable = true,
    motion: motion$1 = { ...motion.collapseMotion, motionAppear: false }
  } = props;
  const newProps = {
    ...props,
    checkable,
    selectable,
    showIcon,
    motion: motion$1,
    blockNode,
    showLine: Boolean(showLine)
  };
  const { cx } = useCss.useCss();
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
    /* @__PURE__ */ jsxRuntime.jsx(
      RcTree,
      {
        ...newProps,
        itemHeight: 20,
        ref,
        className: cx(
          {
            [`${prefixCls}-icon-hide`]: !showIcon,
            [`${prefixCls}-block-node`]: blockNode,
            [`${prefixCls}-unselectable`]: !selectable
          },
          className
        ),
        checkable: checkable ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: `${prefixCls}-checkbox-inner` }) : checkable,
        prefixCls,
        switcherIcon: (nodeProps) => renderSwitcherIcon.default(prefixCls, switcherIcon, showLine, nodeProps)
      }
    ),
    /* @__PURE__ */ jsxRuntime.jsx(
      Global.Global,
      {
        styles: (theme) => ({
          ".tc-uikit-tree": {
            lineHeight: "24px"
          },
          ".tc-uikit-tree-title": {
            color: theme.colors.carbon[8]
          },
          ".tc-uikit-tree .tc-uikit-tree-treenode": {
            display: "flex",
            alignItems: "flex-start",
            padding: "0 0 4px",
            outline: "none"
          },
          ".tc-uikit-tree .tc-uikit-tree-treenode-disabled .tc-uikit-tree-node-content-wrapper": {
            cursor: "not-allowed"
          },
          ".tc-uikit-tree-motion-collapse": {
            overflow: "hidden",
            transition: "height 0.2s cubic-bezier(0.645, 0.045, 0.355, 1), opacity 0.2s cubic-bezier(0.645, 0.045, 0.355, 1) !important"
          },
          ".tc-uikit-tree-switcher": {
            position: "relative",
            cursor: "pointer",
            width: 24,
            height: "24px",
            display: "flex",
            justifyContent: "center",
            alignItems: "center"
          },
          ".tc-uikit-tree-switcher-noop": {
            cursor: "default"
          },
          ".tc-uikit-tree-switcher > svg": {
            color: theme.colors.carbon[8],
            transition: "transform 0.3s",
            margin: 0,
            fontSize: 12,
            textTransform: "none",
            textRendering: "optimizeLegibility",
            display: "inline-flex",
            justifyContent: "center",
            alignItems: "center"
          },
          ".tc-uikit-tree-switcher_close > svg": {
            transform: "rotate(-90deg)"
          },
          ".tc-uikit-tree-switcher_open > svg": {
            transform: "rotate(0deg)"
          },
          ".tc-uikit-tree-indent-unit": {
            display: "inline-block",
            width: 24
          },
          ".tc-uikit-tree-checkbox": {
            boxSizing: "border-box",
            margin: 0,
            padding: 0,
            marginRight: 6,
            color: theme.colors.carbon[8],
            fontSize: 14,
            fontVariant: "tabular-nums",
            listStyle: "none",
            fontFeatureSettings: "tnum",
            position: "relative",
            top: 5,
            whiteSpace: "nowrap",
            outline: "none",
            cursor: "pointer"
          },
          ".tc-uikit-tree-checkbox-disabled": {
            cursor: "not-allowed"
          },
          ".tc-uikit-tree-checkbox-inner": {
            position: "relative",
            top: 0,
            left: 0,
            display: "block",
            width: 16,
            height: 16,
            direction: "ltr",
            backgroundColor: theme.white,
            border: `1px solid ${theme.colors.carbon[4]}`,
            borderRadius: 2,
            borderCollapse: "separate",
            transition: "all 0.3s"
          },
          ".tc-uikit-tree-checkbox-inner:after": {
            position: "absolute",
            top: "50%",
            left: "21.5%",
            display: "table",
            width: 6,
            height: 9,
            border: `2px solid ${theme.white}`,
            borderTop: 0,
            borderLeft: 0,
            transform: "rotate(45deg) scale(0) translate(-50%, -50%)",
            opacity: 0,
            transition: "all 0.1s cubic-bezier(0.71, -0.46, 0.88, 0.6), opacity 0.1s",
            content: '" "'
          },
          ".tc-uikit-tree-checkbox-checked .tc-uikit-tree-checkbox-inner": {
            backgroundColor: theme.colors.carbon[8],
            borderColor: theme.colors.carbon[8]
          },
          ".tc-uikit-tree-checkbox-checked .tc-uikit-tree-checkbox-inner:after": {
            position: "absolute",
            display: "table",
            border: `2px solid ${theme.white}`,
            borderTop: 0,
            borderLeft: 0,
            transform: "rotate(45deg) scale(1) translate(-50%, -50%)",
            opacity: 1,
            transition: "all 0.2s cubic-bezier(0.12, 0.4, 0.29, 1.46) 0.1s",
            content: '" "'
          },
          ".tc-uikit-tree-checkbox-indeterminate .tc-uikit-tree-checkbox-inner:after": {
            top: "50%",
            left: "50%",
            width: 8,
            height: 8,
            backgroundColor: theme.colors.carbon[8],
            border: 0,
            transform: "translate(-50%, -50%) scale(1)",
            opacity: 1,
            content: '" "'
          },
          ".tc-uikit-tree-checkbox-indeterminate .tc-uikit-tree-checkbox-inner": {
            backgroundColor: theme.white,
            borderColor: theme.colors.carbon[4]
          },
          ".tc-uikit-tree-checkbox-disabled .tc-uikit-tree-checkbox-inner": {
            backgroundColor: theme.colors.carbon[3],
            borderColor: theme.colors.carbon[4]
          },
          ".tc-uikit-tree-checkbox-disabled.tc-uikit-tree-checkbox-checked .tc-uikit-tree-checkbox-inner:after": {
            borderColor: theme.colors.carbon[6],
            animationName: "none"
          },
          ".tc-uikit-tree-checkbox-disabled .tc-uikit-tree-checkbox-inner:after": {
            borderColor: theme.colors.carbon[4],
            borderCollapse: "separate",
            animationName: "none"
          }
        })
      }
    )
  ] });
});
exports.Tree = Tree;
