var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
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, {
  LayoutSetting: () => LayoutSetting,
  renderLayoutSettingItem: () => renderLayoutSettingItem
});
module.exports = __toCommonJS(stdin_exports);
var import_vue = require("vue");
var import_pro_utils = require("@antdv/pro-utils");
var import_ant_design_vue = require("ant-design-vue");
var import_vue2 = require("vue");
var import_defaultSettings = require("../../defaultSettings");
var import_index = require("./index");
function renderLayoutSettingItem({
  item
}) {
  const action = (0, import_pro_utils.cloneElement)(item.action, {
    disabled: item.disabled
  });
  return (0, import_vue.createVNode)(import_ant_design_vue.Tooltip, {
    "title": item.disabled ? item.disabledReason : "",
    "placement": "left"
  }, {
    default: () => [(0, import_vue.createVNode)(import_ant_design_vue.List.Item, {
      "actions": [action]
    }, {
      default: () => [(0, import_vue.createVNode)("span", {
        "style": {
          opacity: item.disabled ? 0.5 : 1
        }
      }, [item.title])]
    })]
  });
}
const layoutSettingProps = {
  settings: (0, import_pro_utils.objectType)().isRequired,
  changeSetting: (0, import_pro_utils.funcType)().isRequired,
  hashId: (0, import_pro_utils.stringType)().isRequired,
  prefixCls: (0, import_pro_utils.stringType)().isRequired
};
const LayoutSetting = (0, import_vue2.defineComponent)({
  name: "LayoutSetting",
  props: layoutSettingProps,
  setup(props) {
    return () => {
      const {
        settings,
        prefixCls,
        changeSetting,
        hashId
      } = props;
      const formatMessage = (0, import_index.getFormatMessage)();
      const {
        contentWidth,
        splitMenus,
        fixedHeader,
        layout,
        fixSiderbar
      } = settings || import_defaultSettings.defaultSettings;
      return (0, import_vue.createVNode)(import_ant_design_vue.List, {
        "class": `${prefixCls}-list ${hashId}`.trim(),
        "split": false,
        "dataSource": [{
          title: formatMessage({
            id: "app.setting.content-width",
            defaultMessage: "Content Width"
          }),
          action: (0, import_vue.createVNode)(import_ant_design_vue.Select, {
            "value": contentWidth || "Fixed",
            "size": "small",
            "class": `content-width ${hashId}`.trim(),
            "onSelect": (value) => {
              changeSetting("contentWidth", value);
            },
            "style": {
              width: `80px`
            }
          }, {
            default: () => [layout === "side" ? null : (0, import_vue.createVNode)(import_ant_design_vue.Select.Option, {
              "value": "Fixed"
            }, {
              default: () => [formatMessage({
                id: "app.setting.content-width.fixed",
                defaultMessage: "Fixed"
              })]
            }), (0, import_vue.createVNode)(import_ant_design_vue.Select.Option, {
              "value": "Fluid"
            }, {
              default: () => [formatMessage({
                id: "app.setting.content-width.fluid",
                defaultMessage: "Fluid"
              })]
            })]
          })
        }, {
          title: formatMessage({
            id: "app.setting.fixedheader",
            defaultMessage: "Fixed Header"
          }),
          action: (0, import_vue.createVNode)(import_ant_design_vue.Switch, {
            "size": "small",
            "class": "fixed-header",
            "checked": !!fixedHeader,
            "onChange": (checked) => {
              changeSetting("fixedHeader", checked);
            }
          }, null)
        }, {
          title: formatMessage({
            id: "app.setting.fixedsidebar",
            defaultMessage: "Fixed Sidebar"
          }),
          disabled: layout === "top",
          disabledReason: formatMessage({
            id: "app.setting.fixedsidebar.hint",
            defaultMessage: "Works on Side Menu Layout"
          }),
          action: (0, import_vue.createVNode)(import_ant_design_vue.Switch, {
            "size": "small",
            "class": "fix-siderbar",
            "checked": !!fixSiderbar,
            "onChange": (checked) => changeSetting("fixSiderbar", checked)
          }, null)
        }, {
          title: formatMessage({
            id: "app.setting.splitMenus"
          }),
          disabled: layout !== "mix",
          action: (0, import_vue.createVNode)(import_ant_design_vue.Switch, {
            "size": "small",
            "checked": !!splitMenus,
            "class": "split-menus",
            "onChange": (checked) => {
              changeSetting("splitMenus", checked);
            }
          }, null)
        }],
        "renderItem": renderLayoutSettingItem
      }, null);
    };
  }
});
