import React, { useContext, useMemo, useRef } from "react";
import classnames from "classnames";
import ActionBarContext from "./ActionBarContext";
import ConfigProviderContext from "../config-provider/ConfigProviderContext";
import { usePlaceholder } from "../hooks/use-placeholder";
const ActionBar = (props) => {
  const {
    prefixCls,
    createNamespace
  } = useContext(ConfigProviderContext);
  const [bem] = createNamespace("action-bar", prefixCls);
  const root = useRef(null);
  const children = useMemo(() => React.Children.toArray(props.children), [props.children]);
  const renderPlaceholder = usePlaceholder(root, bem);
  const renderActionBar = () => /* @__PURE__ */ React.createElement(ActionBarContext.Provider, {
    value: {
      parent: {
        children
      }
    }
  }, /* @__PURE__ */ React.createElement("div", {
    ref: root,
    className: classnames(props.className, bem(), {
      "rc-safe-area-bottom": props.safeAreaInsetBottom
    }),
    style: props.style
  }, React.Children.toArray(props.children).filter(Boolean).map((child, index) => {
    return /* @__PURE__ */ React.cloneElement(child, {
      index
    });
  })));
  return props.placeholder ? renderPlaceholder(renderActionBar) : renderActionBar();
};
ActionBar.defaultProps = {
  safeAreaInsetBottom: true,
  placeholder: false
};
var stdin_default = ActionBar;
export {
  stdin_default as default
};
