var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
  for (var prop in b || (b = {}))
    if (__hasOwnProp.call(b, prop))
      __defNormalProp(a, prop, b[prop]);
  if (__getOwnPropSymbols)
    for (var prop of __getOwnPropSymbols(b)) {
      if (__propIsEnum.call(b, prop))
        __defNormalProp(a, prop, b[prop]);
    }
  return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
var __objRest = (source, exclude) => {
  var target = {};
  for (var prop in source)
    if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
      target[prop] = source[prop];
  if (source != null && __getOwnPropSymbols)
    for (var prop of __getOwnPropSymbols(source)) {
      if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
        target[prop] = source[prop];
    }
  return target;
};
import { Fragment as _Fragment, createVNode as _createVNode, mergeProps as _mergeProps } from "vue";
import { classNames, isBrowser, omit } from "@antdv/pro-utils";
import { useConfigContextInject } from "ant-design-vue/lib/config-provider/context";
import { computed, defineComponent, onMounted, onUnmounted, Teleport } from "vue";
import { RouteContext } from "../../index.mjs";
import { useStyle } from "./style/index.mjs";
import { useStylish } from "./style/stylish.mjs";
const FooterToolbar = defineComponent((props, {
  attrs,
  slots
}) => {
  const contextValue = RouteContext.useContext();
  const {
    getPrefixCls,
    getTargetContainer
  } = useConfigContextInject();
  const prefixCls = props.prefixCls || getPrefixCls("pro");
  const baseClassName = computed(() => `${prefixCls}-footer-bar`);
  const {
    wrapSSR,
    hashId
  } = useStyle(baseClassName);
  onMounted(() => {
    contextValue.hasFooterToolbar = true;
  });
  onUnmounted(() => {
    contextValue.hasFooterToolbar = false;
  });
  const width = computed(() => {
    if (!contextValue.hasSiderMenu) {
      return void 0;
    }
    if (!contextValue.siderWidth) {
      return "100%";
    }
    return contextValue.isMobile ? "100%" : `calc(100% - ${contextValue.siderWidth}px)`;
  });
  const stylish = useStylish(computed(() => `${baseClassName.value}.${baseClassName.value}-stylish`), {
    stylish: props.stylish
  });
  return () => {
    var _a, _b, _d;
    const _c = props, {
      children = (_a = slots.default) == null ? void 0 : _a.call(slots),
      className = attrs.class,
      extra = (_b = slots.extra) == null ? void 0 : _b.call(slots),
      portalDom = true,
      style,
      renderContent
    } = _c, restProps = __objRest(_c, [
      "children",
      "className",
      "extra",
      "portalDom",
      "style",
      "renderContent"
    ]);
    const containerDom = typeof window === "undefined" || typeof document === "undefined" ? null : ((_d = getTargetContainer == null ? void 0 : getTargetContainer.value) == null ? void 0 : _d.call(getTargetContainer)) || document.body;
    const dom = _createVNode(_Fragment, null, [_createVNode("div", {
      "class": `${baseClassName.value}-left ${hashId.value}`.trim()
    }, [extra]), _createVNode("div", {
      "class": `${baseClassName.value}-right ${hashId.value}`.trim()
    }, [children])]);
    const renderDom = _createVNode("div", _mergeProps({
      "class": classNames(className, hashId.value, baseClassName.value, {
        [`${baseClassName.value}-stylish`]: !!props.stylish
      }),
      "style": __spreadValues({
        width: width.value
      }, style)
    }, omit(restProps, ["prefixCls"])), [renderContent ? renderContent(__spreadProps(__spreadValues(__spreadValues({}, props), contextValue), {
      leftWidth: width.value
    })) : dom]);
    const ssrDom = !isBrowser() || !portalDom || !containerDom ? renderDom : _createVNode(Teleport, {
      "to": containerDom
    }, {
      default: () => [renderDom]
    });
    return stylish.wrapSSR(wrapSSR(_createVNode(_Fragment, null, [ssrDom])));
  };
}, {
  name: "FooterToolbar",
  inheritAttrs: false,
  props: ["extra", "style", "className", "renderContent", "prefixCls", "stylish", "children", "portalDom"],
  slots: Object
});
export {
  FooterToolbar
};
