var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropNames = Object.getOwnPropertyNames;
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 __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var stdin_exports = {};
__export(stdin_exports, {
  SiderMenu: () => SiderMenuWrapper
});
module.exports = __toCommonJS(stdin_exports);
var import_vue = require("vue");
var import_pro_provider = require("@antdv/pro-provider");
var import_pro_utils = require("@antdv/pro-utils");
var import_ant_design_vue = require("ant-design-vue");
var import_context = require("ant-design-vue/lib/config-provider/context");
var import_vue2 = require("vue");
var import_SiderMenu = require("./SiderMenu");
var import_style = require("./style/index");
const SiderMenuWrapper = (0, import_vue2.defineComponent)({
  name: "SiderMenuWrapper",
  inheritAttrs: false,
  props: __spreadValues(__spreadValues({}, import_SiderMenu.siderMenuProps), (0, import_SiderMenu.privateSiderMenuProps)()),
  setup(props) {
    const {
      token
    } = import_pro_provider.ProProvider.useContext();
    const {
      direction
    } = (0, import_context.useConfigContextInject)();
    (0, import_vue2.watchEffect)(() => {
      var _a;
      if (props.isMobile === true) {
        (_a = props.onCollapse) == null ? void 0 : _a.call(props, true);
      }
    });
    const {
      wrapSSR,
      hashId
    } = (0, import_style.useStyle)((0, import_vue2.computed)(() => `${props.prefixCls}-sider`), {
      proLayoutCollapsedWidth: 64
    });
    return () => {
      var _a, _b, _c;
      const {
        isMobile,
        siderWidth,
        collapsed,
        onCollapse,
        style,
        className,
        hide,
        prefixCls,
        getContainer
      } = props;
      const siderClassName = (0, import_pro_utils.classNames)(`${prefixCls}-sider`, className, hashId.value);
      const omitProps = __spreadProps(__spreadValues({}, (0, import_pro_utils.omit)(props, ["className", "style"])), {
        originCollapsed: (_a = props.originCollapsed) != null ? _a : collapsed
      });
      if (hide) {
        return null;
      }
      return wrapSSR(isMobile ? (0, import_vue.createVNode)(import_vue.Fragment, null, [(0, import_vue.createVNode)(import_ant_design_vue.Drawer, {
        "placement": (direction == null ? void 0 : direction.value) === "rtl" ? "right" : "left",
        "class": (0, import_pro_utils.classNames)(`${prefixCls}-drawer-sider`, className),
        "open": !collapsed,
        "onUpdate:open": () => {
          onCollapse == null ? void 0 : onCollapse(true);
        },
        "style": __spreadValues({
          padding: 0,
          height: "100vh"
        }, style),
        "onClose": () => {
          onCollapse == null ? void 0 : onCollapse(true);
        },
        "maskClosable": true,
        "closable": false,
        "getContainer": getContainer || false,
        "width": siderWidth,
        "bodyStyle": {
          height: "100vh",
          padding: 0,
          display: "flex",
          flexDirection: "row",
          backgroundColor: (_c = (_b = token == null ? void 0 : token.layout) == null ? void 0 : _b.sider) == null ? void 0 : _c.colorMenuBackground
        }
      }, {
        default: () => [(0, import_vue.createVNode)(import_SiderMenu.SiderMenu, (0, import_vue.mergeProps)(omitProps, {
          "isMobile": true,
          "className": siderClassName,
          "collapsed": isMobile ? false : collapsed,
          "splitMenus": false
        }), null)]
      })]) : (0, import_vue.createVNode)(import_SiderMenu.SiderMenu, (0, import_vue.mergeProps)({
        "className": siderClassName
      }, omitProps, {
        "style": style
      }), null));
    };
  }
});
