"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.SidebarSubMenu = SidebarSubMenu;
var _react = _interopRequireWildcard(require("react"));
var _sidebarMenuItem = require("./sidebar-menu-item");
var _sidebarMenuLink = require("./sidebar-menu-link");
var _utils = require("./utils");
var _jsxRuntime = require("react/jsx-runtime");
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
function SidebarSubMenu({
  activeKey,
  expandedKeys,
  level,
  handleActiveItemChange,
  testId,
  onDelete,
  onEdit,
  onChange,
  shouldShowActiveBgOnTopLevel,
  levels = _utils.defaultLevelsConfig,
  subOptions = [],
  LinkComponent = _sidebarMenuLink.SidebarMenuLink,
  editItemInputPlaceholder,
  deleteAriaLabel,
  editAriaLabel
}) {
  const levelsConfig = {
    ..._utils.defaultLevelsConfig,
    ...levels
  };
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("ul", {
    "test-id": testId,
    className: "sidebar-sub-menu",
    children: subOptions && subOptions.length >= 1 && subOptions.map(({
      key,
      validity,
      ...rest
    }) => {
      const subOptionsTestId = rest.testId || key;
      return /*#__PURE__*/(0, _react.createElement)(_sidebarMenuItem.SidebarMenuItem, {
        ...rest,
        key: key,
        itemKey: key,
        activeKey: activeKey,
        expandedKeys: expandedKeys,
        level: level,
        levels: levelsConfig,
        handleActiveItemChange: handleActiveItemChange,
        testId: typeof subOptionsTestId === 'number' ? `${subOptionsTestId}` : subOptionsTestId,
        LinkComponent: LinkComponent,
        shouldShowActiveBgOnTopLevel: shouldShowActiveBgOnTopLevel,
        onDelete: onDelete,
        onEdit: onEdit,
        onChange: onChange,
        validity: validity,
        editItemInputPlaceholder: editItemInputPlaceholder,
        deleteAriaLabel: deleteAriaLabel,
        editAriaLabel: editAriaLabel
      });
    })
  });
}