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, {
  SimpleContent: () => SimpleContent,
  renderLogo: () => renderLogo
});
module.exports = __toCommonJS(stdin_exports);
var import_vue = require("vue");
var import_pro_utils = require("@antdv/pro-utils");
var import_vue2 = require("vue");
function renderLogo(logo, title) {
  if (logo && typeof logo === "string" && (0, import_pro_utils.isUrl)(logo)) {
    return (0, import_vue.createVNode)("img", {
      "src": logo,
      "alt": "logo"
    }, null);
  }
  if (typeof logo === "function") {
    return logo();
  }
  if (logo && typeof logo === "string") {
    return (0, import_vue.createVNode)("div", {
      "id": "avatarLogo"
    }, [logo]);
  }
  if (!logo && title && typeof title === "string") {
    const symbol = title.substring(0, 1);
    return (0, import_vue.createVNode)("div", {
      "id": "avatarLogo"
    }, [symbol]);
  }
  return logo;
}
const simpleContentProps = {
  appList: (0, import_pro_utils.arrayType)(),
  itemClick: (0, import_pro_utils.funcType)(),
  baseClassName: (0, import_pro_utils.stringType)(),
  hashId: (0, import_pro_utils.stringType)()
};
const SimpleContent = (0, import_vue2.defineComponent)({
  name: "SimpleContent",
  inheritAttrs: false,
  props: simpleContentProps,
  setup(props) {
    return () => {
      const {
        appList,
        baseClassName,
        hashId,
        itemClick
      } = props;
      return (0, import_vue.createVNode)("div", {
        "class": `${baseClassName}-content ${hashId}`.trim()
      }, [(0, import_vue.createVNode)("ul", {
        "class": `${baseClassName}-content-list ${hashId}`.trim()
      }, [appList == null ? void 0 : appList.map((app, index) => {
        var _a;
        if ((_a = app == null ? void 0 : app.children) == null ? void 0 : _a.length) {
          return (0, import_vue.createVNode)("div", {
            "key": index,
            "class": `${baseClassName}-content-list-item-group ${hashId}`.trim()
          }, [(0, import_vue.createVNode)("div", {
            "class": `${baseClassName}-content-list-item-group-title ${hashId}`.trim()
          }, [app.title]), (0, import_vue.createVNode)(SimpleContent, {
            "hashId": hashId,
            "itemClick": itemClick,
            "appList": app == null ? void 0 : app.children,
            "baseClassName": baseClassName
          }, null)]);
        }
        return (0, import_vue.createVNode)("li", {
          "key": index,
          "class": `${baseClassName}-content-list-item ${hashId}`.trim(),
          "onClick": (e) => {
            e.stopPropagation();
            itemClick == null ? void 0 : itemClick(app);
          }
        }, [(0, import_vue.createVNode)("a", {
          "href": itemClick ? "javascript:;" : app.url,
          "target": app.target,
          "rel": "noreferrer"
        }, [renderLogo(app.icon, app.title), (0, import_vue.createVNode)("div", null, [(0, import_vue.createVNode)("div", null, [app.title])])])]);
      })])]);
    };
  }
});
