Repository: mermaid-js/mermaid
File: packages/mermaid/src/diagrams/mindmap/mindmapDb.ts (TypeScript)

Code before:
        return 'bang';
      case this.nodeType.HEXAGON:
        return 'hexgon'; // cspell: disable-line
      default:
        return 'no-border';
    }
  }

  /**
   * Assign section numbers to nodes based on their position relative to root
   * @param node - The mindmap node to process
   * @param sectionNumber - The section number to assign (undefined for root)
   */
  public assignSections(node: MindmapNode, sectionNumber?: number): void {
    // For root node, section should be undefined (not -1)
    if (node.level === 0) {
      node.section = undefined;
    } else {
      // For non-root nodes, assign the section number
      node.section = sectionNumber;
    }
    // For root node's children, assign section numbers based on their index
    // For other nodes, inherit parent's section number
    if (node.children) {
      for (const [index, child] of node.children.entries()) {
        const childSectionNumber = node.level === 0 ? (index % MAX_SECTIONS) - 1 : sectionNumber;
        this.assignSections(child, childSectionNumber);
      }
    }
  }

  /**
   * Convert mindmap tree structure to flat array of nodes
   * @param node - The mindmap node to process
   * @param processedNodes - Array to collect processed nodes
   */
  public flattenNodes(node: MindmapNode, processedNodes: MindmapLayoutNode[]): void {
    // Build CSS classes for the node
    const cssClasses = ['mindmap-node'];

    if (node.isRoot === true) {
      // Root node gets special classes
      cssClasses.push('section-root', 'section--1');
    } else if (node.section !== undefined) {
      // Child nodes get section class based on their section number
      cssClasses.push(`section-${node.section}`);
    }

    // Add any custom classes from the node
    if (node.class) {
      cssClasses.push(node.class);

Review comment (suggestion):
Shouldn't it be this?

```suggestion
        const childSectionNumber = node.level === 0 ? index % (MAX_SECTIONS - 1) : sectionNumber;
```

Code after:
        return 'bang';
      case this.nodeType.HEXAGON:
        return 'hexgon'; // cspell: disable-line
      default:
        return 'no-border';
    }
  }

  /**
   * Assign section numbers to nodes based on their position relative to root
   * @param node - The mindmap node to process
   * @param sectionNumber - The section number to assign (undefined for root)
   */
  public assignSections(node: MindmapNode, sectionNumber?: number): void {
    // For root node, section should be undefined (not -1)
    if (node.level === 0) {
      node.section = undefined;
    } else {
      // For non-root nodes, assign the section number
      node.section = sectionNumber;
    }
    // For root node's children, assign section numbers based on their index
    // For other nodes, inherit parent's section number
    if (node.children) {
      for (const [index, child] of node.children.entries()) {
        const childSectionNumber = node.level === 0 ? index % (MAX_SECTIONS - 1) : sectionNumber;
        this.assignSections(child, childSectionNumber);
      }
    }
  }

  /**
   * Convert mindmap tree structure to flat array of nodes
   * @param node - The mindmap node to process
   * @param processedNodes - Array to collect processed nodes
   */
  public flattenNodes(node: MindmapNode, processedNodes: MindmapLayoutNode[]): void {
    // Build CSS classes for the node
    const cssClasses = ['mindmap-node'];

    if (node.isRoot === true) {
      // Root node gets special classes
      cssClasses.push('section-root', 'section--1');
    } else if (node.section !== undefined) {
      // Child nodes get section class based on their section number
      cssClasses.push(`section-${node.section}`);
    }

    // Add any custom classes from the node
    if (node.class) {
      cssClasses.push(node.class);