* @license     GNU General Public License version 2 or later; see LICENSE.txt
 */
defined('_JEXEC') or die;
use Joomla\CMS\Helper\ModuleHelper;
/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
$wa = $app->getDocument()->getWebAssetManager();
$wa->registerAndUseScript('mod_menu', 'mod_menu/menu.min.js', [], ['type' => 'module']);
$wa->registerAndUseScript('mod_menu', 'mod_menu/menu-es5.min.js', [], ['nomodule' => true, 'defer' => true]);
$id = '';
$count_childitem = 0;
$contofigli = 0;
$countereee = 0;
$countduecol=0;
$oldparent_id=0;
if ($tagId = $params->get('tag_id', '')) {
    $id = ' id="' . $tagId . '"';
}
$arrayfigli =[];
$arraypadri =[];
?>
 class="navbar-nav " data-element="menu">
 $item) {
    if (array_key_exists($item->parent_id, $arrayfigli)== false){
        $arrayfigli[$item->parent_id] = 0;
    }
    $arrayfigli[$item->parent_id] += 1;
} 
$parent_id = null;
$megamenu = false;
foreach ($list as $i => &$item) {
    $itemParams = $item->getParams();
    $class      = 'nav-item item-' . $item->id;
    if ($item->id == $default_id) {
        $class .= ' default';
    }
    if ($item->id == $active_id || ($item->type === 'alias' && $itemParams->get('aliasoptions') == $active_id)) {
        $class .= ' current';
    }
    if (in_array($item->id, $path)) {
        $class .= ' active';
    } elseif ($item->type === 'alias') {
        $aliasToId = $itemParams->get('aliasoptions');
        if (count($path) > 0 && $aliasToId == $path[count($path) - 1]) {
            $class .= ' active';
        } elseif (in_array($aliasToId, $path)) {
            $class .= ' alias-parent-active';
        }
    }
    if ($item->type === 'separator') {
        $class .= ' divider';
    }
    if ($item->deeper) {
        $class .= ' deeper dropdown';
    }
    if ($item->parent) {
        $class .= ' parent';
    }
if( ($item->level == 1 && $item->anchor_css !== 'megamenu') || $item->level > 1 && $megamenu == false) {
    $parent_id = $item->id;
    $megamenu = false;
    echo '- ';
    switch ($item->type) :
        case 'separator':
        case 'component':
        case 'heading':
        case 'url':
            require ModuleHelper::getLayoutPath('mod_menu', 'default_' . $item->type);
            break;
        default:
            require ModuleHelper::getLayoutPath('mod_menu', 'default_url');
            break;
    endswitch;
    // The next item is deeper.
    if ($item->deeper && $item->level == 1) {
        
    echo '