text: const { NotImplementedError } = require('../extensions/index.js');
  
  /**
   * Implement class DepthCalculator with method calculateDepth
   * that calculates deoth of nested array
   * 
   * @example
   * 
   * const depthCalc = new DepthCalculator();
   * depthCalc.calculateDepth([1, 2, 3, 4, 5]) => 1
   * depthCalc.calculateDepth([1, 2, 3, [4, 5]]) => 2
   * depthCalc.calculateDepth([[[]]]) => 3
   *
   */
  
  class DepthCalculator {
    constructor() {
    }
    
    calculateDepth(arr) {
      if (Array.isArray(arr)) {
        // first input
        return this.calculateDepth({m:arr, c: 0});
      } else {
        // repeat
        let maxDeep = ++arr.c;
        arr.m.forEach(el => {
          if (Array.isArray(el)) {
            let t = this.calculateDepth({m:el, c: arr.c});
            if (t > maxDeep) maxDeep = t;
          };
        });
        return maxDeep;
      }
    }
  }
  
  
  module.exports = {
    DepthCalculator
  };
  