import * as React from 'react';
import classNames from 'classnames';
import isEmpty from 'lodash/isEmpty';
import { Accordion } from '@box/blueprint-web';
import { useFeatureConfig } from '../../common/feature-checking';
import './DocGenSidebar.scss';
const TagTree = ({
  data,
  level = 0
}) => {
  const {
    enabled: isPreviewModernizationEnabled
  } = useFeatureConfig('previewModernization');
  if (!data) {
    return null;
  }
  return /*#__PURE__*/React.createElement(Accordion, {
    type: "multiple",
    className: "bcs-DocGen-accordion"
  }, Object.keys(data).sort().map(key => {
    if (isEmpty(data[key])) {
      return /*#__PURE__*/React.createElement(Accordion.Item, {
        value: key,
        key: `${key}-${level}`,
        fixed: true,
        className: "bcs-DocGen-collapsible"
      }, /*#__PURE__*/React.createElement("span", {
        className: classNames('bcs-DocGen-tagPath', {
          'bcs-DocGen-tagPath--modernized': isPreviewModernizationEnabled
        }),
        tabIndex: 0,
        role: "button",
        "aria-disabled": "true"
      }, key));
    }
    return /*#__PURE__*/React.createElement(Accordion.Item, {
      value: key,
      title: key,
      key: `${key}-${level}`,
      className: "bcs-DocGen-collapsible"
    }, data[key] && /*#__PURE__*/React.createElement(TagTree, {
      data: data[key],
      level: level + 1
    }));
  }));
};
export default TagTree;
//# sourceMappingURL=TagTree.js.map