import { b9 as V, a0 as t, bb as E, bv as w, w as T, bK as L, ei as P, bB as v, ej as I, bO as B, U as M, V as n, P as r, bh as b, bi as i, bj as s, bg as c, bn as j, cy as A, ek as D } from "./684d2f28.js";
import { useContext as d, useState as K, useEffect as $ } from "react";
import { treeCommonChildren as F, treeDataPropertyView as H, formSection as N, valuePropertyView as q, TreeNameConfigs as z, useTree as O } from "./639bcad1.js";
import { SelectInputValidationSection as R, selectInputValidate as U } from "./1312a48b.js";
import "react-dom";
import "./00dac55d.js";
import "./7ca8657c.js";
import "./d6402597.js";
const G = V.div`
  height: 100%;
  padding: 4px;
  background: ${(e) => e.background};
  border: 1px solid ${(e) => e.border};
  border-radius: ${(e) => e.radius};
  .ant-tree-show-line .ant-tree-switcher {
    background: ${(e) => e.background};
  }
  .ant-tree:hover .ant-tree-list-scrollbar-show {
    display: block !important;
  }
  .ant-tree-list-scrollbar {
    width: 6px !important;
  }
  .ant-tree-list-scrollbar-thumb {
    border-radius: 9999px !important;
    background: rgba(139, 143, 163, 0.2) !important;
  }
  .ant-tree-list-scrollbar-thumb:hover {
    background: rgba(139, 143, 163, 0.5) !important;
  }
`, J = [{
  label: t("tree.noSelect"),
  value: "none"
}, {
  label: t("tree.singleSelect"),
  value: "single"
}, {
  label: t("tree.multiSelect"),
  value: "multi"
}, {
  label: t("tree.checkbox"),
  value: "check"
}], Q = {
  ...F,
  selectType: E(J, "single"),
  checkStrictly: w,
  autoExpandParent: w,
  label: T(L, {
    position: "column"
  }),
  // TODO: more event
  onEvent: P,
  style: v(I),
  labelStyle: v(B.filter((e) => ["accent", "validate"].includes(e.name) === !1))
}, W = (e) => {
  const {
    treeData: f,
    selectType: l,
    value: a,
    expanded: h,
    checkStrictly: y,
    style: u,
    labelStyle: S
  } = e, [k, x] = K(), m = l === "single" || l === "multi", g = l === "check";
  return $(() => {
    l === "none" && a.value.length > 0 ? a.onChange([]) : l === "single" && a.value.length > 1 && a.onChange(a.value.slice(0, 1));
  }, [l]), O(e), e.label({
    required: e.required,
    ...U(e),
    style: u,
    labelStyle: S,
    children: /* @__PURE__ */ n(A, {
      onResize: (o, C) => x(C),
      children: /* @__PURE__ */ n(G, {
        ...u,
        children: /* @__PURE__ */ n(D, {
          disabled: e.disabled,
          height: k,
          rootStyle: {
            background: "transparent",
            color: u.text
          },
          fieldNames: {
            title: "label",
            key: "value"
          },
          treeData: f,
          selectable: m,
          multiple: l === "multi",
          selectedKeys: m ? a.value : [],
          checkable: g,
          checkedKeys: g ? y ? {
            checked: a.value,
            halfChecked: []
          } : a.value : void 0,
          checkStrictly: y,
          showLine: e.showLine ? {
            showLeafIcon: e.showLeafIcon
          } : !1,
          expandedKeys: h.value,
          autoExpandParent: e.autoExpandParent,
          onSelect: (o) => {
            a.onChange(o), e.onEvent("change");
          },
          onCheck: (o) => {
            a.onChange(Array.isArray(o) ? o : o.checked), e.onEvent("change");
          },
          onExpand: (o) => {
            h.onChange(o);
          },
          onFocus: () => e.onEvent("focus"),
          onBlur: () => e.onEvent("blur")
        }, l)
      })
    })
  });
};
let p = function() {
  return new M(Q, (e) => /* @__PURE__ */ n(W, {
    ...e
  })).setPropertyViewFn((e) => /* @__PURE__ */ r(b, {
    children: [/* @__PURE__ */ n(i, {
      name: s.basic,
      children: H(e)
    }), ["logic", "both"].includes(d(c).editorModeStatus) && /* @__PURE__ */ r(b, {
      children: [/* @__PURE__ */ n(R, {
        ...e
      }), N(e), /* @__PURE__ */ r(i, {
        name: s.interaction,
        children: [e.onEvent.getPropertyView(), e.hidden.propertyView({
          label: t("prop.hide")
        }), e.disabled.propertyView({
          label: t("prop.disabled")
        }), e.selectType.propertyView({
          label: t("tree.selectType")
        }), e.selectType.getView() !== "none" && q(e), e.selectType.getView() === "check" && e.checkStrictly.propertyView({
          label: t("tree.checkStrictly"),
          tooltip: t("tree.checkStrictlyTooltip")
        })]
      })]
    }), ["layout", "both"].includes(d(c).editorModeStatus) && /* @__PURE__ */ r(i, {
      name: s.layout,
      children: [e.expanded.propertyView({
        label: t("tree.expanded")
      }), e.defaultExpandAll.propertyView({
        label: t("tree.defaultExpandAll")
      }), e.showLine.propertyView({
        label: t("tree.showLine")
      }), e.showLine.getView() && e.showLeafIcon.propertyView({
        label: t("tree.showLeafIcon")
      })]
    }), ["layout", "both"].includes(d(c).editorModeStatus) && e.label.getPropertyView(), ["layout", "both"].includes(d(c).editorModeStatus) && /* @__PURE__ */ r(b, {
      children: [/* @__PURE__ */ n(i, {
        name: s.style,
        children: e.style.getPropertyView()
      }), /* @__PURE__ */ n(i, {
        name: s.labelStyle,
        children: e.labelStyle.getPropertyView()
      })]
    })]
  })).build();
}();
p = class extends p {
  autoHeight() {
    return !1;
  }
};
const oe = j(p, z);
export {
  oe as TreeComp
};
