doctype html
html(lang='en')
  head
    meta(charset='UTF-8')
    meta(name='viewport' content='width=device-width, initial-scale=1')
    meta(http-equiv='Content-Language', content='en')
    meta(name='version', content=settings.explorer_version + (settings.revision == null || settings.revision == '' ? '' : `-${settings.revision}`))
    title=(page_title_prefix == null || page_title_prefix == '' ? settings.localization.error_title.replace('{1}', settings.coin.name) : page_title_prefix) + ' - ' + settings.shared_pages.page_title
    if settings.shared_pages.favicons.favicon32 != ''
      link(rel='icon', href='/' + settings.shared_pages.favicons.favicon32, sizes='32x32')
    if settings.shared_pages.favicons.favicon128 != ''
      link(rel='icon', href='/' + settings.shared_pages.favicons.favicon128, sizes='128x128')
    if settings.shared_pages.favicons.favicon180 != ''
      link(rel='icon', href='/' + settings.shared_pages.favicons.favicon180, sizes='180x180')
    if settings.shared_pages.favicons.favicon192 != ''
      link(rel='icon', href='/' + settings.shared_pages.favicons.favicon192, sizes='192x192')
    link(rel='stylesheet', href='/css/themes/' + settings.shared_pages.theme.toLowerCase() + '/bootstrap.min.css' + (themeHash == null ? '' : '?h=' + themeHash))
    link(rel='stylesheet', href='https://use.fontawesome.com/releases/v6.4.2/css/all.css')
    if active == 'network'
      link(rel='stylesheet', href='https://cdnjs.cloudflare.com/ajax/libs/flag-icons/6.11.1/css/flag-icons.min.css')
    link(rel='stylesheet', type='text/css', href='https://cdn.datatables.net/v/bs5/dt-1.13.6/datatables.min.css')
    link(rel='stylesheet', href='https://cdnjs.cloudflare.com/ajax/libs/overlayscrollbars/2.3.2/styles/overlayscrollbars.min.css')
    link(rel='stylesheet', href='/css/style.min.css' + (styleHash == null ? '' : '?h=' + styleHash))
    link(rel='stylesheet', href='/css/custom.min.css' + (customHash == null ? '' : '?h=' + customHash))
    script(type='text/javascript', src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js', integrity='sha512-v2CJ7UaYy4JwqLDIrZUI/4hqeoQieOmAZNXBeQyjo21dadnwR+8ZaIJVT8EE2iyI61OV8e6M8PP2/4hpQINQ/g==', crossorigin='anonymous', referrerpolicy='no-referrer')
    script(type='text/javascript', src='https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js', integrity='sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p', crossorigin='anonymous')
    script(type='text/javascript', src='/js/custom.js')
    script(type='text/javascript', src='https://cdn.datatables.net/v/bs5/dt-1.13.6/datatables.min.js')
    script(type='text/javascript', src='https://cdnjs.cloudflare.com/ajax/libs/overlayscrollbars/2.3.2/browser/overlayscrollbars.browser.es6.min.js', integrity="sha512-jh4tHrf3Zaee6k2wOl1kVm4Gm5uIFbOQkUPfA419yLxADm1Q9jtihcGAJUl9ThBR8yc4/VYCOQCY/K87g14kSw==", crossorigin="anonymous", referrerpolicy="no-referrer")
    - var showPanels = false
    - var showNethashChart = false
    - var showDifficultyChart = false
    case active
      when 'home'
        if settings.index_page.show_panels == true
          - showPanels = true
        if settings.index_page.show_nethash_chart == true
          - showNethashChart = true
        if settings.index_page.show_difficulty_chart == true
          - showDifficultyChart = true
      when 'block'
        if settings.block_page.show_panels == true
          - showPanels = true
        if settings.block_page.show_nethash_chart == true
          - showNethashChart = true
        if settings.block_page.show_difficulty_chart == true
          - showDifficultyChart = true
      when 'tx'
        if settings.transaction_page.show_panels == true
          - showPanels = true
        if settings.transaction_page.show_nethash_chart == true
          - showNethashChart = true
        if settings.transaction_page.show_difficulty_chart == true
          - showDifficultyChart = true
      when 'address'
        if settings.address_page.show_panels == true
          - showPanels = true
        if settings.address_page.show_nethash_chart == true
          - showNethashChart = true
        if settings.address_page.show_difficulty_chart == true
          - showDifficultyChart = true
      when 'masternodes'
        if settings.masternodes_page.show_panels == true
          - showPanels = true
        if settings.masternodes_page.show_nethash_chart == true
          - showNethashChart = true
        if settings.masternodes_page.show_difficulty_chart == true
          - showDifficultyChart = true
      when 'movement'
        if settings.movement_page.show_panels == true
          - showPanels = true
        if settings.movement_page.show_nethash_chart == true
          - showNethashChart = true
        if settings.movement_page.show_difficulty_chart == true
          - showDifficultyChart = true
      when 'network'
        if settings.network_page.show_panels == true
          - showPanels = true
        if settings.network_page.show_nethash_chart == true
          - showNethashChart = true
        if settings.network_page.show_difficulty_chart == true
          - showDifficultyChart = true
      when 'richlist'
        if settings.richlist_page.show_panels == true
          - showPanels = true
        if settings.richlist_page.show_nethash_chart == true
          - showNethashChart = true
        if settings.richlist_page.show_difficulty_chart == true
          - showDifficultyChart = true
      when 'markets'
        if settings.markets_page.show_panels == true
          - showPanels = true
        if settings.markets_page.show_nethash_chart == true
          - showNethashChart = true
        if settings.markets_page.show_difficulty_chart == true
          - showDifficultyChart = true
      when 'info'
        if settings.api_page.show_panels == true
          - showPanels = true
        if settings.api_page.show_nethash_chart == true
          - showNethashChart = true
        if settings.api_page.show_difficulty_chart == true
          - showDifficultyChart = true
      when 'claim-address'
        if settings.claim_address_page.show_panels == true
          - showPanels = true
        if settings.claim_address_page.show_nethash_chart == true
          - showNethashChart = true
        if settings.claim_address_page.show_difficulty_chart == true
          - showDifficultyChart = true
        if settings.claim_address_page.enable_captcha == true
          - var selected_captcha_object = null
          - var selected_captcha_name = ''
          each captcha, name in settings.captcha
            if selected_captcha_object == null && captcha != null && captcha.enabled == true
              - selected_captcha_object = captcha
              - selected_captcha_name = name
          if selected_captcha_object != null
            case selected_captcha_name
              when 'google_recaptcha3'
                script(type='text/javascript', src='https://www.google.com/recaptcha/api.js?render=' + settings.captcha.google_recaptcha3.site_key, async, defer)
              when 'google_recaptcha2'
                script(type='text/javascript', src='https://www.google.com/recaptcha/api.js', async, defer)
              when 'hcaptcha'
                script(type='text/javascript', src='https://js.hcaptcha.com/1/api.js', async, defer)
      when 'orphans'
        if settings.orphans_page.show_panels == true
          - showPanels = true
        if settings.orphans_page.show_nethash_chart == true
          - showNethashChart = true
        if settings.orphans_page.show_difficulty_chart == true
          - showDifficultyChart = true
      when 'reward'
        if settings.blockchain_specific.heavycoin.reward_page.show_panels == true
          - showPanels = true
        if settings.blockchain_specific.heavycoin.reward_page.show_nethash_chart == true
          - showNethashChart = true
        if settings.blockchain_specific.heavycoin.reward_page.show_difficulty_chart == true
          - showDifficultyChart = true
      default
        - var found_plugin = false
        each plugin in settings.plugins.allowed_plugins
          if plugin != null && plugin.enabled == true && plugin.pages != null && plugin.pages.length > 0
            each pg in plugin.pages
              if pg.enabled == true && pg.page_id == active
                - found_plugin = true
                if pg.show_panels == true
                  - showPanels = true
                if pg.show_nethash_chart == true
                  - showNethashChart = true
                if pg.show_difficulty_chart == true
                  - showDifficultyChart = true
        if !found_plugin
          if settings.error_page.show_panels == true
            - showPanels = true
          if settings.error_page.show_nethash_chart == true
            - showNethashChart = true
          if settings.error_page.show_difficulty_chart == true
            - showDifficultyChart = true
    if settings.network_history.enabled == true
      if !(showNethashChart == true && settings.shared_pages.page_header.network_charts.nethash_chart.enabled == true && settings.shared_pages.show_hashrate == true)
        - showNethashChart = false
      if !(showDifficultyChart == true && settings.shared_pages.page_header.network_charts.difficulty_chart.enabled == true)
        - showDifficultyChart = false
    else
      - showNethashChart = false
      - showDifficultyChart = false
    if active == 'home' || active == 'address' || active == 'block' || active == 'markets' || active == 'masternodes' || active == 'movement' || active == 'network' || active == 'orphans' || active == 'reward' || active == 'richlist' || active == 'tx'
      include ./includes/common.pug
    if active == 'markets' || active == 'richlist' || active == 'reward' || showNethashChart == true || showDifficultyChart == true
      script(type='text/javascript', src='https://cdn.jsdelivr.net/npm/chart.js@4.4.7/dist/chart.umd.min.js')
    if active == 'markets'
      script(type='text/javascript', src='https://cdn.jsdelivr.net/npm/chartjs-chart-financial@0.1.1/dist/chartjs-chart-financial.min.js')
    if active == 'markets' || showNethashChart == true || showDifficultyChart == true
      script(type='text/javascript', src='https://cdn.jsdelivr.net/gh/joeuhren/chartjs-plugin-crosshair@v2.0.5/build/chartjs-plugin-crosshair.min.js')
      script(type='text/javascript', src='https://cdn.jsdelivr.net/npm/chartjs-adapter-luxon@1.3.1')
    if showNethashChart == true || showDifficultyChart == true
      script(type='text/javascript', src='https://cdn.jsdelivr.net/npm/chartjs-plugin-annotation@3.1.0/dist/chartjs-plugin-annotation.min.js')
    - var sideBarClasses = [];
    if settings.shared_pages.page_header.bgcolor != null && settings.shared_pages.page_header.bgcolor != ''
      - sideBarClasses.push('bg-' + settings.shared_pages.page_header.bgcolor);
      if settings.shared_pages.page_header.bgcolor.toString().toLowerCase() == 'dark' || settings.shared_pages.page_header.bgcolor.toString().toLowerCase() == 'light'
        - sideBarClasses.push('navbar-' + settings.shared_pages.page_header.bgcolor);
    else
      - sideBarClasses.push('bg-primary');
      - sideBarClasses.push('navbar-dark');
    - var showNetworkPanel = false
    - var market_currency = (settings.markets_page.market_price == 'COINGECKO' ? (settings.markets_page.coingecko_currency == null || settings.markets_page.coingecko_currency == '' ? '' : settings.markets_page.coingecko_currency) : (settings.markets_page.default_exchange.trading_pair != null && settings.markets_page.default_exchange.trading_pair.indexOf('/') > -1 ? settings.markets_page.default_exchange.trading_pair.split('/')[1] : '')).toUpperCase();
    if settings.panel1 == 'network_panel' || settings.panel2 == 'network_panel' || settings.panel3 == 'network_panel' || settings.panel4 == 'network_panel' || settings.panel5 == 'network_panel'
      - showNetworkPanel = true
    script.
      const { OverlayScrollbars } = OverlayScrollbarsGlobal;
      var isDocumentReady = false;

      /* special thanks to the stackoverflow community for the getParameterByName function: https://stackoverflow.com/a/901144/3038650 */
      function getParameterByName(name, url = window.location.href) {
        name = name.replace(/[\[\]]/g, '\\$&');
        const regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'),
            results = regex.exec(url);
        if (!results) return null;
        if (!results[2]) return '';
        return decodeURIComponent(results[2].replace(/\+/g, ' '));
      }
      function fixFooterHeightAndPosition() {
        const screenWidth = $(window).outerWidth();
        let socialLinkHeight = 70;

        if (screenWidth <= 575) {
          // mobile
          $('#footer-container').css('height', '!{settings.shared_pages.page_footer.footer_height_mobile}');
          socialLinkHeight = !{settings.shared_pages.page_footer.social_link_percent_height_mobile};
        } else if (screenWidth >= 576 && screenWidth <= 991) {
          // tablet
          $('#footer-container').css('height', '!{settings.shared_pages.page_footer.footer_height_tablet}');
          socialLinkHeight = !{settings.shared_pages.page_footer.social_link_percent_height_tablet};
        } else {
          // desktop
          $('#footer-container').css('height', '!{settings.shared_pages.page_footer.footer_height_desktop}');
          socialLinkHeight = !{settings.shared_pages.page_footer.social_link_percent_height_desktop};
        }

        if (!#{settings.shared_pages.page_footer.sticky_footer}) {
          // wait a tick before fixing footer position to give time for elements to be rendered
          setTimeout(function() {
            // ensure footer is shown at the bottom of the viewport
            const offset = (window.innerHeight - $('#footer-container').position().top - $('#footer-container').outerHeight());
            $('#footer-container').css('margin-top', (offset > 0 ? offset - 1 : '10') + 'px');

            if ('#{settings.shared_pages.page_header.menu}' == 'side')
              fixSidebarHeight();
          }, 1);
        } else {
          // add spacing to the bottom of the body for the sticky footer
          $('body').css('margin-bottom', ($('#footer-container').outerHeight() + 10) + 'px');

          if ('#{settings.shared_pages.page_header.menu}' == 'side')
            fixSidebarHeight();
        }

        // fix social link font size
        const fontSize = $('#footer-container').height() * (socialLinkHeight / 100);
        $('#footer-container .social-link').css('font-size', fontSize);
        $('#footer-container .social-link > img').css('width', fontSize + 'px').css('height', fontSize + 'px');
      }
      function enableTooltips() {
        if ($().tooltip) {
          // enable tooltips only if browser supports them
          $('[data-bs-toggle="tooltip"]').tooltip();
        }
      }
      function fixDataTableColumns() {
        // wait 2 ticks before adjusting table columns to give time for elements to be rendered (1 tick doesn't seem to be enough for some tables)
        setTimeout(function() {
          // ensure columns are properly aligned
          $($.fn.dataTable.tables(true)).DataTable().columns.adjust();
        }, 2);
      }
      function rotateElement(elementSelector) {
        const element = $(elementSelector);

        if (element.length > 0) {
          $({ deg: 0 }).animate({ deg: 360 }, {
            duration: 2000,
            step: function(deg) {
              element.css({
                transform: 'rotateY(' + deg + 'deg)'
              });
            },
            done: function() {
              setTimeout(function() {
                rotateElement(elementSelector);
              }, 1500);
            }
          });
        }
      }
      function startRotateElement(elementSelector) {
        setTimeout(function() {
          rotateElement(elementSelector);
        }, 100);
      }
      function update_block_and_connection_stats() {
        const summary_headers = {
          'Accept': 'application/json, text/javascript, */*; q=0.01',
          'footer-only': 'true'
        };

        $.ajax({url: '/ext/getsummary', headers: summary_headers, cache: false, success: function(json) {
          $("#lblConnections").text(json.connections + ' connections');
          $("#lblBlockcount").text(json.blockcount + ' blocks');
        }});
      }
      $(document).on('click', 'button.btn-close', function (e) {
        e.preventDefault();

        $('.alert-dismissible').on('closed.bs.alert', function (e) {
          e.preventDefault();
          fixFooterHeightAndPosition();
        });
      });
      $(document).on('click', 'button#search-header-button', function (e) {
        if ($().tooltip)
          $('#search-header-span').tooltip('hide');
      });
      $(window).resize(function () {
        if (isDocumentReady) {
          fixDataTableColumns();
          fixFooterHeightAndPosition();
        }
      });
      $(document).ready(function() {
        if ('#{active}' != '')
          $('##{active} > a.nav-link').addClass('active');

        $('#search-navbar-collapse').on('shown.bs.collapse', function (e) {
          fixFooterHeightAndPosition();
        });
        $('#search-navbar-collapse').on('hidden.bs.collapse', function (e) {
          fixFooterHeightAndPosition();
        });

        setInterval(function() {
          update_block_and_connection_stats();
        }, 60000);

        update_block_and_connection_stats();
        fixFooterHeightAndPosition();
        enableTooltips();
        isDocumentReady = true;
      });
    if showPanels == true
      script.
        function showTopPanelData(dataElement, loadingElement) {
          if ($('#' + loadingElement).length) {
            $('#' + loadingElement).fadeOut('slow', function() {
              $('#' + loadingElement).remove();
              $('#' + dataElement).fadeIn();
            });
          }
        }
        function getNetworkPanel() {
          return '<div class="card-header"><strong>#{settings.localization.network} <span class="small fw-normal">' + getNetHashUnits() + '</span></strong></div><div class="card-body"><div id="hashratePanelLoading" class="header-panel"><i class="fa-solid fa-spinner fa-spin-pulse"></i></div><div id="hashratepanel" class="header-panel" style="display:none;"><span class="fa-solid fa-gears"></span><label id="hashrate"></label></div></div>';
        }
        function getDifficultyPanel() {
          let difficultyType='<label id="difficulty"></label>';
          if ('#{settings.shared_pages.difficulty}' == 'Hybrid') difficultyType+='<br /><span class="fa-solid fa-sliders"></span><label id="difficultyHybrid"></label>';
          return '<div class="card-header"><strong>#{settings.localization.difficulty}</strong></div><div class="card-body"><div id="difficultyPanelLoading" class="header-panel"><i class="fa-solid fa-spinner fa-spin-pulse"></i></div><div id="difficultypanel" class="header-panel" style="display:none;"><span class="fa-solid fa-sliders"></span>'+difficultyType+'</div></div>';
        }
        function getMasternodesPanel() {
          return '<div class="card-header"><strong>#{settings.localization.masternodecount}</strong></div><div class="card-body"><div id="masternodePanelLoading" class="header-panel"><i class="fa-solid fa-spinner fa-spin-pulse"></i></div><div id="masternodepanel" class="header-panel" style="display:none;"><span id="spnMasternodeCountOnline" class="fa-solid fa-circle-check" data-bs-toggle="tooltip" data-bs-placement="top"></span><label id="masternodeCountOnline" data-bs-toggle="tooltip" data-bs-placement="top"></label><label>&nbsp;/&nbsp;</label><label id="masternodeCountOffline" data-bs-toggle="tooltip" data-bs-placement="top"></label><span id="spnMasternodeCountOffline" class="fa-solid fa-triangle-exclamation" data-bs-toggle="tooltip" data-bs-placement="top"></span></div></div>';
        }
        function getCoinSupplyPanel() {
          return `<div class="card-header"><strong>#{settings.localization.ex_supply} <span class="small fw-normal">(${"#{settings.coin.symbol}".replace(/"/g, '&quot;')})</span></strong></div><div class="card-body"><div id="supplyPanelLoading" class="header-panel"><i class="fa-solid fa-spinner fa-spin-pulse"></i></div><div id="supplypanel" class="header-panel" style="display:none;"><span class="fa-solid fa-chart-pie"></span><label id="supply"></label></div></div>`;
        }
        function getPricePanel() {
          return '<div class="card-header"><strong>Price <span class="small fw-normal">(#{market_currency})</span></strong></div><div class="card-body"><div id="pricePanelLoading" class="header-panel"><i class="fa-solid fa-spinner fa-spin-pulse"></i></div><div id="pricepanel" class="header-panel" style="display:none;"><span class="fa-solid fa-rocket"></span><label id="lastPrice">-</label></div></div>';
        }
        function getUSDPricePanel() {
          return '<div class="card-header"><strong>Price <span class="small fw-normal">(USD)</span></strong></div><div class="card-body"><div id="usdPricePanelLoading" class="header-panel"><i class="fa-solid fa-spinner fa-spin-pulse"></i></div><div id="usdpricepanel" class="header-panel" style="display:none;"><span class="fa-solid fa-dollar-sign"></span><label id="lastUSDPrice">-</label></div></div>';
        }
        function getMarketCapPanel() {
          return '<div class="card-header"><strong>Market Cap <span class="small fw-normal">(#{market_currency})</span></strong></div><div class="card-body"><div id="marketCapPanelLoading" class="header-panel"><i class="fa-solid fa-spinner fa-spin-pulse"></i></div><div id="marketCapPanel" class="header-panel" style="display:none;"><span class="fa-solid fa-chart-line"></span><label id="marketCap"></label></div></div>';
        }
        function getUSDMarketCapPanel() {
          return '<div class="card-header"><strong>Market Cap <span class="small fw-normal">(USD)</span></strong></div><div class="card-body"><div id="usdMarketCapPanelLoading" class="header-panel"><i class="fa-solid fa-spinner fa-spin-pulse"></i></div><div id="usdMarketCapPanel" class="header-panel" style="display:none;"><span class="fa-solid fa-chart-line"></span><label id="usdMarketCap"></label></div></div>';
        }
        function getLogoPanel() {
          return `<img id="logo-panel" src="#{settings.shared_pages.logo}" style="height:128px;" alt="${"#{settings.coin.name}".replace(/"/g, '&quot;')} Logo" title="${"#{settings.coin.name}".replace(/"/g, '&quot;')} Logo" />`;
        }
        function getSpacerPanel() {
          return `<div class="panel_spacer"></div>`;
        }
        function getActivePanel(panelName) {
          let sReturn = '';

          switch (panelName) {
            case "network_panel":
              sReturn = getNetworkPanel();
              break;
            case "difficulty_panel":
              sReturn = getDifficultyPanel();
              break;
            case "masternodes_panel":
              sReturn = getMasternodesPanel();
              break;
            case "coin_supply_panel":
              sReturn = getCoinSupplyPanel();
              break;
            case "price_panel":
              sReturn = getPricePanel();
              break;
            case "usd_price_panel":
              sReturn = getUSDPricePanel();
              break;
            case "market_cap_panel":
              sReturn = getMarketCapPanel();
              break;
            case "usd_market_cap_panel":
              sReturn = getUSDMarketCapPanel();
              break;
            case "logo_panel":
              sReturn = getLogoPanel();
              break;
            case "spacer_panel_1":
            case "spacer_panel_2":
            case "spacer_panel_3":
              sReturn = getSpacerPanel();
              break;
          }

          return sReturn;
        }
        function hideShowPanel(panelID, panelName) {
          const oPanel = document.getElementById(panelName);

          if (typeof(oPanel) != 'undefined' && oPanel != null) {
            document.getElementById(panelName).innerHTML = getActivePanel(panelID);

            if (panelID == 'logo_panel') {
              // remove css classes from logo panel
              $(oPanel).removeClass();
            }
          }
        }
        function update_stats() {
          const summary_headers = {
            Accept: 'application/json, text/javascript, */*; q=0.01'
          };

          $.ajax({url: '/ext/getsummary', headers: summary_headers, cache: false, success: function(json) {
            if (json.masternodeCountOnline == null)
              json.masternodeCountOnline = '-';
            if (json.masternodeCountOffline == null)
              json.masternodeCountOffline = '-';

            const mnOnlineText = json.masternodeCountOnline + " node"+(json.masternodeCountOnline == 1 ? "" : "s") + " online";
            const mnOfflineText = json.masternodeCountOffline + " unreachable node" + (json.masternodeCountOffline == 1 ? "" : "s");

            $("#masternodeCountOnline").text(json.masternodeCountOnline).prop("alt", mnOnlineText).prop("title", mnOnlineText).attr("data-bs-original-title", mnOnlineText);
            $("#masternodeCountOffline").text(json.masternodeCountOffline).prop("alt", mnOfflineText).prop("title", mnOfflineText).attr("data-bs-original-title", mnOfflineText);
            $("#spnMasternodeCountOnline").prop("alt", mnOnlineText).prop("title", mnOnlineText).attr("data-bs-original-title", mnOnlineText);
            $("#spnMasternodeCountOffline").prop("alt", mnOfflineText).prop("title", mnOfflineText).attr("data-bs-original-title", mnOfflineText);
            showTopPanelData('masternodepanel', 'masternodePanelLoading');

            let supplyString = json.supply;
            let diffString = json.difficulty;
            let hashrateString = json.hashrate;
            let splitValue, splitParts;

            if (!isNaN(json.difficulty))
              diffString = Number(json.difficulty).toLocaleString('en',{'minimumFractionDigits':2,'maximumFractionDigits':8,'useGrouping':true});
            if (!isNaN(json.supply))
              supplyString = parseInt(parseFloat(json.supply).toFixed(0)).toLocaleString('en');
            if (!isNaN(json.hashrate))
              hashrateString = Number(json.hashrate).toLocaleString('en',{'minimumFractionDigits':2,'maximumFractionDigits':8,'useGrouping':true});

            $("#supply").text(supplyString);
            showTopPanelData('supplypanel', 'supplyPanelLoading');

            splitValue = Number(parseFloat(json.lastPrice).toFixed(8) * parseInt(parseFloat(json.supply).toFixed(0))).toLocaleString('en',{'minimumFractionDigits':2,'maximumFractionDigits':8,'useGrouping':true});
            splitParts = splitValue.split('.');
            $("#marketCap").html(splitParts[0] + '.<span class="decimal">' + splitParts[1] + '</span>');
            showTopPanelData('marketCapPanel', 'marketCapPanelLoading');

            splitValue = Number(parseFloat(json.lastUSDPrice).toFixed(8) * parseInt(parseFloat(json.supply).toFixed(0))).toLocaleString('en',{'minimumFractionDigits':2,'maximumFractionDigits':8,'useGrouping':true});
            splitParts = splitValue.split('.');
            $("#usdMarketCap").html(splitParts[0] + '.<span class="decimal">' + splitParts[1] + '</span>');
            showTopPanelData('usdMarketCapPanel', 'usdMarketCapPanelLoading');

            splitParts = diffString.split('.');
            $("#difficulty").html(splitParts[0] + '.<span class="decimal">' + splitParts[1] + '</span>');

            if (json.difficultyHybrid == null || json.difficultyHybrid == '')
              $("#difficultyHybrid").html('-');
            else {
              splitParts = json.difficultyHybrid.split('.');
              $("#difficultyHybrid").html(splitParts[0] + '.<span class="decimal">' + splitParts[1] + '</span>');
            }

            showTopPanelData('difficultypanel', 'difficultyPanelLoading');

            if (hashrateString == null || hashrateString == '' || hashrateString == '-')
              $("#hashrate").html('-');
            else {
              splitParts = hashrateString.split('.');
              $("#hashrate").html(splitParts[0] + '.<span class="decimal">' + splitParts[1] + '</span>');
            }
            showTopPanelData('hashratepanel', 'hashratePanelLoading');

            splitValue = Number(json.lastPrice).toLocaleString('en',{'minimumFractionDigits':2,'maximumFractionDigits':8,'useGrouping':true});
            splitParts = splitValue.split('.');
            $("#lastPrice").html(splitParts[0] + '.<span class="decimal">' + splitParts[1] + '</span>');
            showTopPanelData('pricepanel', 'pricePanelLoading');

            splitValue = Number(json.lastUSDPrice).toLocaleString('en',{'minimumFractionDigits':2,'maximumFractionDigits':8,'useGrouping':true});
            splitParts = splitValue.split('.');
            $("#lastUSDPrice").html(splitParts[0] + '.<span class="decimal">' + splitParts[1] + '</span>');
            showTopPanelData('usdpricepanel', 'usdPricePanelLoading');
          }});
        }
        $(document).ready(function() {
          hideShowPanel('#{settings.panel1}', 'pnlOne');
          hideShowPanel('#{settings.panel2}', 'pnlTwo');
          hideShowPanel('#{settings.panel3}', 'pnlThree');
          hideShowPanel('#{settings.panel4}', 'pnlFour');
          hideShowPanel('#{settings.panel5}', 'pnlFive');

          setInterval(function() {
            update_stats();
          }, 60000);

          update_stats();
        });
    if showNethashChart == true || showDifficultyChart == true
      script.
        const maxSavedRecords = #{settings.network_history.max_saved_records};
        const countDecimals = function(value) {
          const text = value.toString();

          if (text.indexOf('e-') > -1) {
            return parseInt(text.split('e-'), 10);
          } else if (Math.floor(value) !== value)
            return value.toString().split(".")[1].length || 0;
          else
            return 0;
        }
        function update_network_charts() {
          $.ajax({
            url: '/ext/getnetworkchartdata',
            success: function(result) {
              if (typeof populateNethashChart !== 'undefined' && typeof populateNethashChart === 'function')
                populateNethashChart(result);

              if (typeof populateDifficultyChart !== 'undefined' && typeof populateDifficultyChart === 'function')
                populateDifficultyChart(result);
            }
          });
        }
        function roundToNearestMinute(timestamp) {
          return Math.floor(timestamp * 1000 / (60 * 1000)) * (60 * 1000);
        }
        function formatNetworkChartValue(val, roundDecimals, lbl, returnNum) {
          let max = 20;

          if (roundDecimals != -1)
            max = roundDecimals;
          else {
            const decimalCount = countDecimals(val || 0);

            if (decimalCount < max)
              max = decimalCount;
          }

          if (returnNum)
            return (val || 0);
          else
            return Number((val || 0)).toLocaleString('en',{'minimumFractionDigits':0,'maximumFractionDigits':max,'useGrouping':true}) + (lbl == 'Hashrate' ? ' ' + getNetHashUnits() : '');
        }
        function populateHourChartData(result) {
          const roundedDataMap = new Map();

          result.forEach((entry) => {
            const roundedTimestamp = roundToNearestMinute(entry.timestamp);

            if (roundedTimestamp != 0 && !roundedDataMap.has(roundedTimestamp))
              roundedDataMap.set(roundedTimestamp, { ...entry, tick: roundedTimestamp });
          });

          let normalizedData = Array.from(roundedDataMap.values()).sort((a, b) => a.tick - b.tick);
          let lastKnownValue = { blockindex: 0, difficulty_pow: 0, difficulty_pos: 0, nethash: 0 };
          let maxTimestamp = new Date().getTime();
          let hourData = [];

          if (normalizedData.length > 0)
            maxTimestamp = normalizedData[normalizedData.length - 1].tick;

          const minTimestamp = maxTimestamp - ((#{settings.network_history.max_hours} * 60 * 60 * 1000) - (60 * 1000)); // x hours before maxTimestamp minus 1 minute to encompass the full timeframe

          if (normalizedData.length > 0 && normalizedData[0].tick > minTimestamp) {
            // use the first real data point values but set blockindex to 0
            lastKnownValue = { ...normalizedData[0], blockindex: 0 };

            // backfill from minTimestamp up to the first real data point
            for (let ts = minTimestamp; ts < normalizedData[0].tick; ts += 60 * 1000)
              hourData.push({ ...lastKnownValue, tick: ts });
          }

          let currentTimestamp = Math.max(minTimestamp, normalizedData[0]?.tick || minTimestamp);

          for (let i = 0; i < normalizedData.length; i++) {
            const dataPoint = normalizedData[i];

            // fill any gap between currentTimestamp and the current dataPoint.tick
            while (currentTimestamp < dataPoint.tick) {
              hourData.push({ ...lastKnownValue, tick: currentTimestamp, blockindex: 0 });
              currentTimestamp += 60 * 1000; // move to the next minute
            }

            // add the real data point to hourData
            lastKnownValue = dataPoint;
            hourData.push({ ...dataPoint, tick: dataPoint.tick });

            // move currentTimestamp to the next minute after the current data point
            currentTimestamp = dataPoint.tick + 60 * 1000;
          }

          // fill remaining range up to maxTimestamp with last known values
          while (currentTimestamp < maxTimestamp) {
            hourData.push({ ...lastKnownValue, tick: currentTimestamp, blockindex: 0 });
            currentTimestamp += 60 * 1000;
          }

          xScale = {
            type: 'time',
            time: {
              unit: 'minute',
              stepSize: 60,
              displayFormats: {
                minute: '#{settings.shared_pages.date_time.display_format}'
              }
            },
            min: minTimestamp,  // Set x-axis to start at the first data point
            max: maxTimestamp,  // Set x-axis to end at the last data point
            ticks: {
              maxTicksLimit: #{settings.network_history.max_hours},
              callback: function(value) {
                return format_unixtime(Math.floor(value / 1000));
              }
            }
          };

          return {
            hourData: hourData,
            minTimestamp: minTimestamp,
            maxTimestamp: maxTimestamp,
            xScale: xScale
          };
        }
        function populatePluginDataTitle(chartData, chartTitleSettings, roundDecimals, netHashOnly, difficultyOnly) {
          let showPOW = false;
          let showPOS = false;
          let highestNethash = 0;
          let lowestNethash = -1;
          let highestPowDifficulty = 0;
          let lowestPowDifficulty = -1;
          let highestPosDifficulty = 0;
          let lowestPosDifficulty = -1;
          let highestBlock = 0;
          let lowestBlock = -1;
          let pluginTitle = {};
          const currentNethash = formatNetworkChartValue((chartData.length > 0 && chartData[0].nethash != null ? chartData[chartData.length - 1].nethash : 0), roundDecimals, 'Hashrate', true);
          const currentPowDifficulty = formatNetworkChartValue((chartData.length > 0 && chartData[0].difficulty_pow != null ? chartData[chartData.length - 1].difficulty_pow : 0), roundDecimals, 'Difficulty', true);
          const currentPosDifficulty = formatNetworkChartValue((chartData.length > 0 && chartData[0].difficulty_pos != null ? chartData[chartData.length - 1].difficulty_pos : 0), roundDecimals, 'Difficulty', true);

          for (let i = 0; i < chartData.length; i++) {
            if (chartData[i].difficulty_pow != null && chartData[i].difficulty_pow != 0)
              showPOW = true;
            if (chartData[i].difficulty_pos != null && chartData[i].difficulty_pos != 0)
              showPOS = true;
            if (chartData[i].nethash != null && chartData[i].nethash > highestNethash)
              highestNethash = formatNetworkChartValue(chartData[i].nethash, roundDecimals, 'Hashrate', true);
            if (chartData[i].nethash != null && (lowestNethash == -1 || chartData[i].nethash < lowestNethash))
              lowestNethash = formatNetworkChartValue(chartData[i].nethash, roundDecimals, 'Hashrate', true);
            if (chartData[i].difficulty_pow != null && chartData[i].difficulty_pow > highestPowDifficulty)
              highestPowDifficulty = formatNetworkChartValue(chartData[i].difficulty_pow, roundDecimals, 'Difficulty', true);
            if (chartData[i].difficulty_pow != null && (lowestPowDifficulty == -1 || chartData[i].difficulty_pow < lowestPowDifficulty))
              lowestPowDifficulty = formatNetworkChartValue(chartData[i].difficulty_pow, roundDecimals, 'Difficulty', true);
            if (chartData[i].difficulty_pos != null && chartData[i].difficulty_pos > highestPosDifficulty)
              highestPosDifficulty = formatNetworkChartValue(chartData[i].difficulty_pos, roundDecimals, 'Difficulty', true);
            if (chartData[i].difficulty_pos != null && (lowestPosDifficulty == -1 || chartData[i].difficulty_pos < lowestPosDifficulty))
              lowestPosDifficulty = formatNetworkChartValue(chartData[i].difficulty_pos, roundDecimals, 'Difficulty', true);
            if (chartData[i].blockindex > highestBlock)
              highestBlock = chartData[i].blockindex;
            if (chartData[i].blockindex > 0 && (lowestBlock == -1 || chartData[i].blockindex < lowestBlock))
              lowestBlock = chartData[i].blockindex;
          }

          if (chartTitleSettings.enabled == true) {
            let chart_title = chartTitleSettings.title_text.replace(/\n/g, '\\n')
              .replace(/{coin_name}/g, '#{settings.coin.name}')
              .replace(/{max_saved_records}/g, maxSavedRecords)
              .replace(/{max_hours}/g, '#{settings.network_history.max_hours}')
              .replace(/{highest_block}/g, highestBlock)
              .replace(/{lowest_block}/g, lowestBlock);

            if (netHashOnly || (!netHashOnly && !difficultyOnly)) {
              chart_title = chart_title
                .replace(/{current_nethash}/g, formatNetworkChartValue(currentNethash, roundDecimals, 'Hashrate', false))
                .replace(/{highest_nethash}/g, formatNetworkChartValue(highestNethash, roundDecimals, 'Hashrate', false))
                .replace(/{lowest_nethash}/g, formatNetworkChartValue(lowestNethash, roundDecimals, 'Hashrate', false));
            }

            if (difficultyOnly || (!netHashOnly && !difficultyOnly)) {
              chart_title = chart_title
                .replace(/{current_pow_difficulty}/g, formatNetworkChartValue(currentPowDifficulty, roundDecimals, 'Difficulty', false))
                .replace(/{highest_pow_difficulty}/g, formatNetworkChartValue(highestPowDifficulty, roundDecimals, 'Difficulty', false))
                .replace(/{lowest_pow_difficulty}/g, formatNetworkChartValue(lowestPowDifficulty, roundDecimals, 'Difficulty', false))
                .replace(/{current_pos_difficulty}/g, formatNetworkChartValue(currentPosDifficulty, roundDecimals, 'Difficulty', false))
                .replace(/{highest_pos_difficulty}/g, formatNetworkChartValue(highestPosDifficulty, roundDecimals, 'Difficulty', false))
                .replace(/{lowest_pos_difficulty}/g, formatNetworkChartValue(lowestPosDifficulty, roundDecimals, 'Difficulty', false))
            }

            pluginTitle = {
              display: true,
              text: chart_title.split('\\n'),
              position: 'top',
              align: chartTitleSettings.alignment.replace('left', 'start').replace('right', 'end'),
              color: chartTitleSettings.color,
              font: {
                family: chartTitleSettings.font.family,
                size: chartTitleSettings.font.size,
                weight: chartTitleSettings.font.weight
              },
              padding: {
                top: 10,
                bottom: 10
              }
            };
          } else {
            pluginTitle = {
              display: false
            };
          }

          return {
            showPOW: showPOW,
            showPOS: showPOS,
            pluginTitle: pluginTitle
          };
        }
        function populateBlockIndexAnnotations(hourData, blockLineSettings) {
          let blockIndexAnnotations = null;

          if (blockLineSettings.enabled && maxSavedRecords == 0) {
            blockIndexAnnotations = {
              annotations: (
                hourData
                  .filter(d => d.blockindex)
                  .map(d => ({
                    type: 'line',
                    mode: 'vertical',
                    scaleID: 'x',
                    value: d.tick,
                    borderColor: blockLineSettings.block_line_color,
                    borderWidth: 1,
                    label: {
                      enabled: false
                    }
                  }))
              )
            };
          }

          return blockIndexAnnotations;
        }
        $(document).ready(function() {
          const setting_reload_chart_seconds = #{settings.shared_pages.page_header.network_charts.reload_chart_seconds};

          if (setting_reload_chart_seconds > 0) {
            setInterval(function() {
              update_network_charts();
            }, (setting_reload_chart_seconds * 1000));
          }

          update_network_charts();
        });
    if showNethashChart == true
      script.
        let nethashChart;

        function populateNethashChart(result) {
          const ctxNethash = document.getElementById('nethashChart').getContext('2d');
          let timeData = {};

          if (maxSavedRecords == 0)
            timeData = populateHourChartData(result);

          const extraData = populatePluginDataTitle((maxSavedRecords == 0 ? timeData.hourData : result), !{JSON.stringify(settings.shared_pages.page_header.network_charts.nethash_chart.chart_title)}, #{settings.shared_pages.page_header.network_charts.nethash_chart.round_decimals}, true, false);

          const netHashDataSet = [
            {
              label: 'Hashrate',
              data: (maxSavedRecords == 0 ?
                timeData.hourData.map(a => ({
                  x: a.tick,
                  y: a.nethash,
                  blockindex: a.blockindex
                })) :
                result.map(function(a) {return a.nethash;})
              ),
              backgroundColor: ['#{settings.shared_pages.page_header.network_charts.nethash_chart.fill_color}'],
              borderColor: ['#{settings.shared_pages.page_header.network_charts.nethash_chart.line_color}'],
              fill: 'start'
            }
          ];

          const pluginData = {
            title: extraData.pluginTitle,
            legend: {
              display: #{settings.shared_pages.page_header.network_charts.nethash_chart.legend.enabled},
              position: '#{settings.shared_pages.page_header.network_charts.nethash_chart.legend.position}'
            },
            tooltip: {
              mode: 'index',
              intersect: false,
              displayColors: true,
              callbacks: {
                title: function(context) {
                  if (maxSavedRecords == 0)
                    return format_unixtime(Math.floor(context[0].parsed.x / 1000));
                  else
                    return 'Block ' + context[0].label + ' Hashrate';
                },
                label: function(context) {
                  if (maxSavedRecords == 0)
                    return formatNetworkChartValue(context.raw.y, #{settings.shared_pages.page_header.network_charts.nethash_chart.round_decimals}, context.dataset.label, false);
                  else
                    return formatNetworkChartValue(context.raw, #{settings.shared_pages.page_header.network_charts.nethash_chart.round_decimals}, context.dataset.label, false);
                },
                afterLabel: function(context) {
                  if (maxSavedRecords == 0) {
                    const tooltipItems = context.chart.tooltip.dataPoints;
                    const isLastVisibleItem = tooltipItems[tooltipItems.length - 1] === context;

                    // only display blockindex if this is the last visible tooltip item
                    if (isLastVisibleItem) {
                      const blockindex = context.raw.blockindex;

                      if (blockindex && blockindex !== 0)
                        return `Block: ${blockindex}`;
                    }
                  }

                  return '';
                }
              }
            },
            crosshair: {
              line: {
                color: '#{settings.shared_pages.page_header.network_charts.nethash_chart.crosshair_color}',
                width: 1
              },
              sync: {
                enabled: #{settings.shared_pages.page_header.network_charts.sync_charts},
                group: 1,
                suppressTooltips: false,
                axis: 'x'
              },
              zoom: {
                enabled: false
              }
            },
            annotation: populateBlockIndexAnnotations(timeData.hourData, !{JSON.stringify(settings.shared_pages.page_header.network_charts.nethash_chart.block_line)})
          };

          if (nethashChart == null) {
            nethashChart = new Chart(ctxNethash, {
              type: 'line',
              data: {
                labels: (maxSavedRecords == 0 ? timeData.hourData.map(function(a) {return a.tick;}) : result.map(function(a) {return a.blockindex;})),
                datasets: netHashDataSet
              },
              options: {
                maintainAspectRatio: false,
                elements: {
                  point: {
                    radius: 1
                  },
                  line: {
                    tension: 0.1
                  }
                },
                scales: {
                  y: {
                    title: {
                      display: true,
                      text: 'Hashrate ' + getNetHashUnits(),
                      font: {
                        weight: 'bold'
                      }
                    }
                  }
                },
                plugins: pluginData
              }
            });

            if (maxSavedRecords == 0)
              nethashChart.options.scales.x = timeData.xScale;

            $('#nethashChartParent').fadeIn();
          } else {
            nethashChart.data.labels = (maxSavedRecords == 0 ? timeData.hourData.map(function(a) {return a.tick;}) : result.map(function(a) {return a.blockindex;}));
            nethashChart.data.datasets = netHashDataSet;
            nethashChart.options.plugins = pluginData;

            if (maxSavedRecords == 0) {
              nethashChart.options.scales.x.min = timeData.minTimestamp;
              nethashChart.options.scales.x.max = timeData.maxTimestamp;
            }

            nethashChart.update('none');
          }
        }
    if showDifficultyChart == true
      script.
        let difficultyChart;

        function populateDifficultyChart(result) {
          const ctxDifficulty = document.getElementById('difficultyChart').getContext('2d');
          let timeData = {};
          let diffDataSets = [];
          let showPOW = false;
          let showPOS = false;

          if (maxSavedRecords == 0)
            timeData = populateHourChartData(result);

          const extraData = populatePluginDataTitle((maxSavedRecords == 0 ? timeData.hourData : result), !{JSON.stringify(settings.shared_pages.page_header.network_charts.difficulty_chart.chart_title)}, #{settings.shared_pages.page_header.network_charts.difficulty_chart.round_decimals}, false, true);

          for (let i = 0; i < result.length; i++) {
            if (result[i].difficulty_pow != 0)
              showPOW = true;
            if (result[i].difficulty_pos != 0)
              showPOS = true;
          }

          if (showPOS) {
            diffDataSets.push({
              label: 'POS Difficulty',
              data: (maxSavedRecords == 0 ?
                timeData.hourData.map(a => ({
                  x: a.tick,
                  y: a.difficulty_pos,
                  blockindex: a.blockindex
                })) :
                result.map(function(a) {return a.difficulty_pos;})
              ),
              backgroundColor: ['#{settings.shared_pages.page_header.network_charts.difficulty_chart.pos_fill_color}'],
              borderColor: ['#{settings.shared_pages.page_header.network_charts.difficulty_chart.pos_line_color}'],
              fill: 'start'
            });
          }

          if (showPOW || !showPOS) {
            diffDataSets.push({
              label: 'POW Difficulty',
              data: (maxSavedRecords == 0 ?
                timeData.hourData.map(a => ({
                  x: a.tick,
                  y: a.difficulty_pow,
                  blockindex: a.blockindex
                })) :
                result.map(function(a) {return a.difficulty_pow;})
              ),
              backgroundColor: ['#{settings.shared_pages.page_header.network_charts.difficulty_chart.pow_fill_color}'],
              borderColor: ['#{settings.shared_pages.page_header.network_charts.difficulty_chart.pow_line_color}'],
              fill: 'start'
            });
          }

          const pluginData = {
            title: extraData.pluginTitle,
            legend: {
              display: #{settings.shared_pages.page_header.network_charts.difficulty_chart.legend.enabled},
              position: '#{settings.shared_pages.page_header.network_charts.difficulty_chart.legend.position}'
            },
            tooltip: {
              mode: 'index',
              intersect: false,
              displayColors: true,
              callbacks: {
                title: function(context) {
                  if (maxSavedRecords == 0)
                    return format_unixtime(Math.floor(context[0].parsed.x / 1000));
                  else
                    return 'Block ' + context[0].label + ' Difficulty';
                },
                label: function(context) {
                  if (maxSavedRecords == 0)
                    return formatNetworkChartValue(context.raw.y, #{settings.shared_pages.page_header.network_charts.difficulty_chart.round_decimals}, context.dataset.label, false);
                  else
                    return formatNetworkChartValue(context.raw, #{settings.shared_pages.page_header.network_charts.difficulty_chart.round_decimals}, context.dataset.label, false);
                },
                afterLabel: function(context) {
                  if (maxSavedRecords == 0) {
                    const tooltipItems = context.chart.tooltip.dataPoints;
                    const isLastVisibleItem = tooltipItems[tooltipItems.length - 1] === context;

                    // only display blockindex if this is the last visible tooltip item
                    if (isLastVisibleItem) {
                      const blockindex = context.raw.blockindex;

                      if (blockindex && blockindex !== 0)
                        return `Block: ${blockindex}`;
                    }
                  }

                  return '';
                }
              }
            },
            crosshair: {
              line: {
                color: '#{settings.shared_pages.page_header.network_charts.difficulty_chart.crosshair_color}',
                width: 1
              },
              sync: {
                enabled: #{settings.shared_pages.page_header.network_charts.sync_charts},
                group: 1,
                suppressTooltips: false,
                axis: 'x'
              },
              zoom: {
                enabled: false
              }
            },
            annotation: populateBlockIndexAnnotations(timeData.hourData, !{JSON.stringify(settings.shared_pages.page_header.network_charts.difficulty_chart.block_line)})
          };

          if (difficultyChart == null) {
            difficultyChart = new Chart(ctxDifficulty, {
              type: 'line',
              data: {
                labels: (maxSavedRecords == 0 ? timeData.hourData.map(function(a) {return a.tick;}) : result.map(function(a) {return a.blockindex;})),
                datasets: diffDataSets
              },
              options: {
                maintainAspectRatio: false,
                elements: {
                  point: {
                    radius: 1
                  },
                  line: {
                    tension: 0.1
                  }
                },
                scales: {
                  y: {
                    title: {
                      display: true,
                      text: 'Difficulty',
                      font: {
                        weight: 'bold'
                      }
                    }
                  }
                },
                plugins: pluginData
              }
            });

            if (maxSavedRecords == 0)
              difficultyChart.options.scales.x = timeData.xScale;

            $('#difficultyChartParent').fadeIn();
          } else {
            difficultyChart.data.labels = (maxSavedRecords == 0 ? timeData.hourData.map(function(a) {return a.tick;}) : result.map(function(a) {return a.blockindex;}));
            difficultyChart.data.datasets = diffDataSets;
            difficultyChart.options.plugins = pluginData;

            if (maxSavedRecords == 0) {
              difficultyChart.options.scales.x.min = timeData.minTimestamp;
              difficultyChart.options.scales.x.max = timeData.maxTimestamp;
            }

            difficultyChart.update('none');
          }
        }
    if (showPanels == true && showNetworkPanel == true) || showNethashChart == true || showDifficultyChart == true
      script.
        function getNetHashUnits() {
          let networkSuffix = '';

          switch ('#{settings.shared_pages.page_header.panels.network_panel.nethash_units}') {
            case "K":
              networkSuffix='(KH/s)';
              break;
            case "M":
              networkSuffix='(MH/s)';
              break;
            case "G":
              networkSuffix='(GH/s)';
              break;
            case "T":
              networkSuffix='(TH/s)';
              break;
            case "P":
              networkSuffix='(PH/s)';
              break;
            case "H":
              networkSuffix='(H/s)';
              break;
          }

          return networkSuffix;
        }
    if settings.shared_pages.page_header.menu == 'side'
      script.
        let sideMarketVisible = false;
        const sideBarClasses = '!{sideBarClasses}'.replace(/,/g, " ");

        function fixSidebarHeight() {
          if ('#{settings.shared_pages.page_footer.sticky_footer}' != 'true')
            $('div#side-nav-bar').css('margin-bottom', -($('div#body-container > div#side-nav-bar').length ? ($('div#footer-container').offset().top - $('div#footer-container').position().top + 1) : 0).toString() + 'px');
          else if ($('div#footer-container').offset().top > ($('#main-container').position().top + $('#main-container').outerHeight(true)))
            $('div#side-nav-bar').css('margin-bottom', -($('div#body-container > div#side-nav-bar').length ? ($('div#footer-container').offset().top - ($('#main-container').position().top + $('#main-container').outerHeight(true)) + $('div#footer-container').outerHeight(true)) : 0).toString() + 'px');
          else
            $('div#side-nav-bar').css('margin-bottom', '');
        }
        function hideMarketDropdown() {
          if ($('div#side-market-menu').hasClass('show')) {
            // close the market dropdown which was left open
            bootstrap.Dropdown.getOrCreateInstance($('li.side-market-menu > a.dropdown-toggle')).hide();
          }
        }
        function positionSidebarSearch() {
          if (#{settings.shared_pages.page_header.search.enabled} == true && '#{settings.shared_pages.page_header.search.position.toString().toLowerCase()}' == 'inside-header') {
            if ($(window).outerWidth() < 992) {
              if ($('div#inner-header-side > div.container > div#search-navbar-collapse').length)
                $('div#search-navbar-collapse').addClass('collapse').removeClass('flexGrow1').appendTo('header#main-header-side');
            } else {
              if ($('header#main-header-side > div#search-navbar-collapse').length)
                $('div#search-navbar-collapse').addClass('flexGrow1').removeClass('collapse').appendTo('div#inner-header-side > div.container');
            }
          }
        }
        function fixSideBarTop() {
          if ('#{settings.shared_pages.page_header.sticky_header}' == 'true') {
            if ($(window).outerWidth() < 992)
              $('div#side-nav-bar').css('margin-top', '');
            else
              $('div#side-nav-bar').css('margin-top', $('header#main-header-side').outerHeight(true).toString() + 'px');
          } else
            $('div#side-nav-bar').css('margin-top', '0');
        }
        function fixSidebar() {
          if ($(window).outerWidth() < 992) {
            if ($('div#side-nav-bar').hasClass('show-menu'))
              toggleSideMenu();

            if ($('div#body-container > div#side-nav-bar').length > 0) {
              let hasScrollbar = false;

              $('#side-nav-bar li.nav-item > a.nav-link > span:last-child').show();
              $('nav.side-nav').css('overflow', 'visible');
              $('div#side-nav-bar').removeClass(sideBarClasses);

              if ($('div#side-offcanvas > div.offcanvas-body > div[data-overlayscrollbars-viewport="scrollbarHidden"]').length > 0) {
                $('div#body-container > div#side-nav-bar').appendTo('div#side-offcanvas > div.offcanvas-body > div[data-overlayscrollbars-viewport="scrollbarHidden"]');
                hasScrollbar = true;
              } else
                $('div#body-container > div#side-nav-bar').appendTo('div#side-offcanvas > div.offcanvas-body');

              hideMarketDropdown();
              $('a#side-header-toggle').attr('data-bs-toggle', 'offcanvas').attr('data-bs-target', '#side-offcanvas').attr('aria-controls', 'side-offcanvas');

              if ($().tooltip)
                $('nav.side-nav li.nav-item').tooltip('disable');

              $('li.side-market-menu').removeClass('dropend').addClass('dropdown');
              $('li.side-market-menu > a.nav-link').attr('data-bs-toggle', 'collapse').attr('data-bs-target', '#side-market-menu').attr('aria-controls', '#side-market-menu').attr('aria-expanded', 'false');
              $('div#side-market-menu').removeClass('dropdown-menu dropdown-menu-dark').addClass('collapse');

              if (!hasScrollbar)
                OverlayScrollbars($('div#side-offcanvas > div.offcanvas-body')[0], {overflow: {x: 'hidden'}});

              fixSidebarHeight();
            }
          } else if ($('div#side-offcanvas > div.offcanvas-body div#side-nav-bar').length > 0) {
            if ($('div#side-market-menu').hasClass('show')) {
              // close the market collapse which was left open
              bootstrap.Collapse.getOrCreateInstance($('#side-market-menu')).hide();
            }

            if ($('div#side-offcanvas').hasClass('show')) {
              // close the offcanvas side-menu which was left open
              bootstrap.Offcanvas.getOrCreateInstance($('div#side-offcanvas')).hide();
            }

            resetSideBarWidth();
            $('#side-nav-bar li.nav-item > a.nav-link > span:last-child').hide();
            $('div#side-nav-bar').addClass(sideBarClasses);
            $('div#side-offcanvas > div.offcanvas-body div#side-nav-bar').prependTo('div#body-container');
            $('a#side-header-toggle').removeAttr('data-bs-toggle').removeAttr('data-bs-target').removeAttr('aria-controls');

            if ($().tooltip)
              $('nav.side-nav li.nav-item').tooltip('enable');

            $('li.side-market-menu').removeClass('dropdown').addClass('dropend');
            $('li.side-market-menu > a.nav-link').removeAttr('data-bs-toggle').removeAttr('data-bs-target').removeAttr('aria-controls').removeAttr('aria-expanded');
            $('div#side-market-menu').removeClass('collapse').addClass('dropdown-menu' + ('#{settings.shared_pages.page_header.bgcolor}' == null || '#{settings.shared_pages.page_header.bgcolor}' == 'null' || '#{settings.shared_pages.page_header.bgcolor}' == '' || '#{settings.shared_pages.page_header.bgcolor}'.toLowerCase() == 'dark' ? ' dropdown-menu-dark' : ''));

            fixSidebarHeight();
          }

          fixSideBarTop();
        }
        function toggleSideMenu() {
          if (!$('div#side-nav-bar').hasClass('activating')) {
            $('div#side-nav-bar').toggleClass('activating');
            $('div#side-nav-bar').toggleClass('show-menu');

            const showMenu = $('div#side-nav-bar').hasClass('show-menu');

            $('a#side-header-toggle > span').toggleClass('fa-regular fa-solid fa-rectangle-xmark fa-bars').attr('data-bs-original-title', (showMenu ? 'Shrink Menu' : 'Expand Menu')).attr('alt', (showMenu ? 'Shrink Menu' : 'Expand Menu'));
            hideMarketDropdown();

            if ($().tooltip) {
              $('a#side-header-toggle > span').tooltip('hide');
              $('nav.side-nav li.nav-item').tooltip((showMenu ? 'disable' : 'enable'));
            }

            $('nav.side-nav').css('overflow', 'hidden');

            if (showMenu)
              $('#side-nav-bar li.nav-item > a.nav-link > span:last-child').show();

            // wait for the side bar to reach the desired width
            let sideBarActivateSetIntervalID = setInterval(function() {
              // check if the side bar has reached the full width or menu has been activated before finish
              if (
                (showMenu && Math.round($('div#side-nav-bar').outerWidth()) >= 224) ||
                (!showMenu && Math.round($('div#side-nav-bar').outerWidth()) <= 68) ||
                (showMenu != $('div#side-nav-bar').hasClass('show-menu'))
              ) {
                // stop setInterval from running again
                clearInterval(sideBarActivateSetIntervalID);

                $('div#side-nav-bar').toggleClass('activating');

                if (!showMenu)
                  $('#side-nav-bar li.nav-item > a.nav-link > span:last-child').hide();

                $('nav.side-nav').css('overflow', 'visible');

                // programatically call the resize event
                $(window).trigger('resize');
              }
            }, 1, "tmrWaitActivateSideMenu");
          }
        }
        function resetSideBarWidth() {
          $('div#side-offcanvas').css('width', '');
          $('div#side-nav-bar').css('width', '');
        }
        $(document).on('click', 'a#side-header-toggle', function(e) {
          e.preventDefault();

          if ($(window).outerWidth() >= 992)
            toggleSideMenu();
          else if ($().tooltip)
            $('a#side-header-toggle > span').tooltip('hide');
        });
        $(document).on('click', 'li#sidebar-offcanvas-close > a.nav-link', function(e) {
          e.preventDefault();

          if ($().tooltip)
            $('li#sidebar-offcanvas-close > a.nav-link').tooltip('hide');
        });
        $(window).resize(function () {
          fixSidebar();
          positionSidebarSearch();
        });
        $(window).on('load', function() {
          fixSidebar();
          positionSidebarSearch();
        });
    else
      script.
        let topMenuExpanded = false;

        function fixTopMenuCollapse(isResizing) {
          if (topMenuExpanded && isResizing) {
            // force collapse the menu if it is open and the screen is being resized,
            // otherwise it could cause problems with the market dropdown after resizing back and forth between mobile and desktop sizes
            bootstrap.Collapse.getOrCreateInstance($('#navbar-collapse')).hide();
            topMenuExpanded = false;
          }

          if ($().tooltip)
            $('#navbar-toggler-span').tooltip('hide');

          if (topMenuExpanded) {
            $('#search-header-button').hide();
            $('#search-navbar-collapse').addClass('d-none');
            $('#navbar-collapse').css('max-height', ($(window).outerHeight() - ($('#main-header div.navbar-header').outerHeight()) - (#{settings.shared_pages.page_footer.sticky_footer} == true ? $('div#footer-container').outerHeight(true) : 0) - 20).toString() + 'px');
          } else
            $('#navbar-collapse').css('max-height', 'none');
        }
        function hideMarketDropdown() {
          if ($('li#markets > div.dropdown-menu').hasClass('show')) {
            // close the market dropdown which was left open
            bootstrap.Dropdown.getOrCreateInstance($('li#markets > a.dropdown-toggle')).hide();
          }
        }
        $(window).resize(function () {
          if ($(window).outerWidth() < 992)
            hideMarketDropdown();

          fixTopMenuCollapse(true);
        });
        $(document).ready(function() {
          $('#navbar-collapse').on('show.bs.collapse', function (e) {
            topMenuExpanded = true;
            fixTopMenuCollapse(false);
          });
          $('#navbar-collapse').on('shown.bs.collapse', function (e) {
            // initialize the scrollbar only after the navbar collapse has finished since it goes too slow if initialized before
            OverlayScrollbars($('#navbar-collapse')[0], {});
          });
          $('#navbar-collapse').on('hide.bs.collapse', function (e) {
            topMenuExpanded = false;
            fixTopMenuCollapse(false);
            OverlayScrollbars($('#navbar-collapse')[0], {}).destroy();
          });
          $('#navbar-collapse').on('hidden.bs.collapse', function (e) {
            $('#search-header-button').show();
            $('#search-navbar-collapse').removeClass('d-none');
          });
        });
    if settings.shared_pages.page_header.menu == 'side' && settings.markets_page.enabled == true && settings.markets_page.show_market_dropdown_menu == true && settings.market_count > 1
      script.
        /* Add a click event for the whole document when markets are enabled to emulate the autoClose feature which doesn't work when controlling bootstrap dropdowns via javascript - More info: https://github.com/twbs/bootstrap/issues/37042 */
        $(document).on('click', function(e) {
          if (sideMarketVisible)
            bootstrap.Dropdown.getOrCreateInstance($('li.side-market-menu > a.dropdown-toggle')).hide();
        });
        $(document).on('click', 'li.side-market-menu', function(e) {
          if ($().tooltip && !$('#side-nav-bar').hasClass('show-menu') && $(window).outerWidth() >= 992)
            $('nav.side-nav li#markets.nav-item').tooltip('hide');
        });
        $(document).on('click', 'li.side-market-menu > a.dropdown-toggle', function(e) {
          e.preventDefault();

          if ($('div#body-container > div#side-nav-bar').length > 0) {
            // manually set the positon of the market dropdown since bootstrap disables popper when called from within a .navbar
            $('#side-market-menu').css({
              'position': 'absolute',
              'inset': 'auto auto 0px 0px',
              'margin': '0px',
              'transform': 'translate3d(' + e.pageX.toString() + 'px, 30px, 0px)'
            });

            // programatically trigger the dropdown since controlling bs dropdowns via data attributes has some unintended consequences of
            // keeping the popper attributes around too long in specific scenarios when changing screen size and the dropdown is left open
            bootstrap.Dropdown.getOrCreateInstance($('li.side-market-menu > a.dropdown-toggle')).toggle();
          } else {
            if ($('li.side-market-menu > a.dropdown-toggle[aria-expanded="true"]').length > 0) {
              const sideBarWidth = 226;
              const normalItemWidth = 192;
              const firstItem = $('div#side-market-menu > a.dropdown-item').first();
              const leftRightPadding = (firstItem == null ? 0 : parseFloat(firstItem.css('padding-right').replace('px', '')) + parseFloat(firstItem.css('margin-right').replace('px', ''))) * 2;
              let largestItemWidth = 0;

              // find the largest market item to see if the sidebar should be expanded even wider
              $('div#side-market-menu > a.dropdown-item').each(function () {
                const currentItemWidth = $(this).find('> img').outerWidth(true) + $(this).find('> span').outerWidth(true);
                largestItemWidth = (currentItemWidth > largestItemWidth ? currentItemWidth : largestItemWidth);
              });

              if (largestItemWidth > (normalItemWidth - leftRightPadding)) {
                $('div#side-offcanvas').css('width', (sideBarWidth + largestItemWidth - (normalItemWidth - leftRightPadding)).toString() + 'px');
                $('div#side-nav-bar').css('width', 'auto');
              } else
                resetSideBarWidth();
            } else
              resetSideBarWidth();
          }
        });
        $(document).ready(function() {
          $('li.side-market-menu > a.dropdown-toggle').on('shown.bs.dropdown', function (e) {
            if ($().tooltip)
              $('li#markets.nav-item').tooltip('disable');

            // wait a tick before upating the sideMarketVisible value
            setTimeout(function() {
              sideMarketVisible = true;
            }, 1);
          });
          $('li.side-market-menu > a.dropdown-toggle').on('hidden.bs.dropdown', function (e) {
            sideMarketVisible = false;

            if ($().tooltip && !$('div#side-nav-bar').hasClass('show-menu'))
              $('li#markets.nav-item').tooltip('enable');

            $('#side-market-menu').css({
              'position': '',
              'inset': '',
              'margin': '',
              'transform': ''
            });
          });
        });
    - var bodyClasses = [];
    - var bodyContainerClasses = [];
    - var mainContainerClasses = [];
    - var mainContainerChildClasses = [];
    if settings.shared_pages.page_header.menu == 'side'
      - bodyContainerClasses.push('transition05s');
      - bodyContainerClasses.push('displayFlex');
      - bodyClasses.push('transition05s');
      - mainContainerClasses.push('flexGrow1');
      - mainContainerClasses.push('width1');
      - mainContainerChildClasses.push('container');
      if settings.shared_pages.page_header.sticky_header == true
        - mainContainerChildClasses.push('marginTop80');
      else
        - mainContainerChildClasses.push('marginTop20');
    else
      - bodyContainerClasses.push('container');
      if settings.shared_pages.page_header.sticky_header == true
        - bodyContainerClasses.push('marginTop80');
      else
        - bodyContainerClasses.push('marginTop20');
  body(class=bodyClasses)
    - var headerClasses = [];
    - var footerClasses = ['nav','navbar','navbar-default','d-flex','footer'];
    - var dropdownClasses = ['dropdown-menu'];
    if settings.shared_pages.page_header.sticky_header == true
      - headerClasses.push('fixed-top');
    if settings.shared_pages.page_footer.sticky_footer == true
      - footerClasses.push('fixed-bottom');
    if settings.shared_pages.page_header.bgcolor != null && settings.shared_pages.page_header.bgcolor != ''
      - headerClasses.push('bg-' + settings.shared_pages.page_header.bgcolor);
      - dropdownClasses.push('bg-' + settings.shared_pages.page_header.bgcolor);
      if settings.shared_pages.page_header.bgcolor.toString().toLowerCase() == 'dark' || settings.shared_pages.page_header.bgcolor.toString().toLowerCase() == 'light'
        - headerClasses.push('navbar-' + settings.shared_pages.page_header.bgcolor);
        if settings.shared_pages.page_header.bgcolor.toString().toLowerCase() == 'dark'
          - dropdownClasses.push('dropdown-menu-dark');
    else
      - headerClasses.push('bg-primary');
      - headerClasses.push('navbar-dark');
      - dropdownClasses.push('bg-primary');
      - dropdownClasses.push('dropdown-menu-dark');
    if settings.shared_pages.page_footer.bgcolor != null && settings.shared_pages.page_footer.bgcolor != ''
      - footerClasses.push('bg-' + settings.shared_pages.page_footer.bgcolor);
      if settings.shared_pages.page_footer.bgcolor.toString().toLowerCase() == 'dark' || settings.shared_pages.page_footer.bgcolor.toString().toLowerCase() == 'light'
        - footerClasses.push('navbar-' + settings.shared_pages.page_footer.bgcolor);
    else
      - footerClasses.push('bg-primary');
      - footerClasses.push('navbar-dark');
    if settings.shared_pages.page_header.menu == 'top'
      div#main-header.navbar(class=headerClasses)
        div.navbar.navbar-expand-lg(style=settings.shared_pages.page_header.home_link == 'logo' ? 'padding-left:0;' : '')
          div.container
            .navbar-header
              span#navbar-toggler-span(alt='Toggle Menu', title='Toggle Menu', data-bs-toggle='tooltip', data-bs-placement='left')
                button.navbar-toggler(type='button', data-bs-toggle='collapse', data-bs-target='#navbar-collapse', aria-controls='navbar-collapse', aria-expanded='false', aria-label='Toggle navigation')
                  span.navbar-toggler-icon
            if settings.shared_pages.page_header.home_link == 'title'
              a.navbar-brand(href='/', style='order:-1;') #{settings.shared_pages.page_title}
            else if settings.shared_pages.page_header.home_link == 'coin'
              a.navbar-brand(href='/', style='order:-1;') #{settings.coin.name}
            else if settings.shared_pages.page_header.home_link == 'logo'
              a(href='/', alt=settings.coin.name + ' Home', title=settings.coin.name + ' Home', style='order:-1;', data-bs-toggle='tooltip', data-bs-placement='bottom')
                img.logo-main(src=(settings.shared_pages.page_header.home_link_logo == null || settings.shared_pages.page_header.home_link_logo == '' ? settings.shared_pages.logo : settings.shared_pages.page_header.home_link_logo), style='margin:0;max-height:' + settings.shared_pages.page_header.home_link_logo_height + 'px;')
            .collapse.navbar-collapse(id='navbar-collapse')
              ul.navbar-nav(style='width:100%;')
                li#home.nav-item
                  a.nav-link(href='/')
                    span.fa-solid.fa-cubes
                    span.margin-left-5 #{settings.localization.menu_explorer}
                if settings.blockchain_specific.heavycoin.enabled == true && settings.blockchain_specific.heavycoin.reward_page.enabled == true
                  li#reward.nav-item
                    a.nav-link(href='/reward')
                      span.fa-solid.fa-star
                      span.margin-left-5 #{settings.localization.menu_reward}
                if settings.masternodes_page.enabled == true
                  li#masternodes.nav-item
                    a.nav-link(href='/masternodes')
                      span.fa-solid.fa-share-nodes
                      span.margin-left-5 Masternodes
                if settings.movement_page.enabled == true
                  li#movement.nav-item
                    a.nav-link(href='/movement')
                      span.fa-regular.fa-money-bill-1
                      span.margin-left-5 #{settings.localization.menu_movement}
                if settings.network_page.enabled == true
                  li#network.nav-item
                    a.nav-link(href='/network')
                      span.fa-solid.fa-network-wired
                      span.margin-left-5 #{settings.localization.menu_network}
                if settings.richlist_page.enabled == true
                  li#richlist.nav-item
                    a.nav-link(href='/richlist')
                      span.fa-brands.fa-btc
                      span.margin-left-5 #{settings.localization.menu_richlist}
                if settings.markets_page.enabled == true
                  if settings.markets_page.show_market_dropdown_menu == true && settings.market_count > 1
                    li#markets.dropdown.nav-item
                      a.nav-link.dropdown-toggle(data-bs-toggle='dropdown', href='#')
                        span.fa-solid.fa-chart-line
                        span.margin-left-5 #{settings.localization.menu_markets}
                      div.navbar(class=dropdownClasses)
                        each mkt in settings.market_data
                          if mkt != null && mkt.id != null
                            each pair in mkt.trading_pairs
                              a.dropdown-item(href='/markets/' + mkt.id + '/' + pair.pair)
                                if pair.isAlt == true
                                  if mkt.alt_logo != null && mkt.alt_logo != ''
                                    img.market-logo(src='data:image/png;base64,' + mkt.alt_logo, title=mkt.alt_name + ' (' + pair.pair + ')', alt=mkt.alt_name + ' (' + pair.pair + ')')
                                  else
                                    i.market-logo.fa-solid.fa-circle-question
                                  span #{mkt.alt_name}
                                    span.small.fw-normal  (#{pair.pair})
                                else
                                  if mkt.logo != null && mkt.logo != ''
                                    img.market-logo(src='data:image/png;base64,' + mkt.logo, title=mkt.name + ' (' + pair.pair + ')', alt=mkt.name + ' (' + pair.pair + ')')
                                  else
                                    i.market-logo.fa-solid.fa-circle-question
                                  span #{mkt.name}
                                    span.small.fw-normal  (#{pair.pair})
                  else
                    li#markets.nav-item
                      a.nav-link(href='/markets/' + settings.markets_page.default_exchange.exchange_name + '/' + settings.markets_page.default_exchange.trading_pair)
                        span.fa-solid.fa-chart-line
                        span.margin-left-5 #{settings.localization.menu_markets}
                if settings.api_page.enabled == true
                  li#info.nav-item
                    a.nav-link(href='/info')
                      span.fa-solid.fa-circle-info
                      span.margin-left-5 #{settings.localization.menu_api}
                if settings.claim_address_page.show_header_menu == true && settings.claim_address_page.enabled == true
                  li#claim-address.nav-item
                    a.nav-link(href='/claim')
                      span.fa-regular.fa-address-card
                      span.margin-left-5 #{settings.localization.menu_claim_address}
                if settings.orphans_page.enabled == true
                  li#orphans.nav-item
                    a.nav-link(href='/orphans')
                      span.fa-regular.fa-rectangle-xmark
                      span.margin-left-5 #{settings.localization.menu_orphans}
                each plugin in settings.plugins.allowed_plugins
                  if plugin != null && plugin.enabled == true && plugin.pages != null && plugin.pages.length > 0
                    each pg in plugin.pages
                      if pg.enabled == true && pg.show_header_menu == true
                        li.nav-item(id=pg.page_id)
                          a.nav-link(href='/' + pg.route_suffix)
                            span(class=pg.menu_fontawesome_class)
                            span.margin-left-5=pg.menu_title
            if settings.shared_pages.page_header.search.enabled == true && settings.shared_pages.page_header.search.position.toString().toLowerCase() == 'inside-header'
              span#search-header-span(alt='Search', title='Search', data-bs-toggle='tooltip', data-bs-placement='left')
                button#search-header-button(data-bs-toggle='collapse', data-bs-target='#search-navbar-collapse')
                  span.fa-solid.fa-magnifying-glass
        if settings.shared_pages.page_header.search.enabled == true && settings.shared_pages.page_header.search.position.toString().toLowerCase() == 'inside-header'
          div#search-navbar-collapse.collapse
            div.navbar-nav.align-items-lg-center.search-box-custom(style='width:100%;')
              form.form-inline.col-12.d-flex.justify-content-center(method='post', action='/search')
                div.input-group.input-group-md.search-for(style='width:100%;')
                  input.form-control(type='text', name='search', placeholder=settings.localization.ex_search_message)
                  button.btn.btn-success.btn-sm(type='submit') #{settings.localization.ex_search_button}
    else
      header#main-header-side.side-header.navbar(class=headerClasses)
        div#inner-header-side.navbar.navbar-expand-lg
          div.container
            if settings.shared_pages.page_header.home_link == 'title'
              a.navbar-brand.nav-link(href='/', style='order:-1;') #{settings.shared_pages.page_title}
            else if settings.shared_pages.page_header.home_link == 'coin'
              a.navbar-brand.nav-link(href='/', style='order:-1;') #{settings.coin.name}
            else if settings.shared_pages.page_header.home_link == 'logo'
              a(href='/', alt=settings.coin.name + ' Home', title=settings.coin.name + ' Home', style='order:-1;', data-bs-toggle='tooltip', data-bs-placement='bottom')
                img.logo-main(src=(settings.shared_pages.page_header.home_link_logo == null || settings.shared_pages.page_header.home_link_logo == '' ? settings.shared_pages.logo : settings.shared_pages.page_header.home_link_logo), style='margin:0;max-height:' + settings.shared_pages.page_header.home_link_logo_height + 'px;')
            a#side-header-toggle.side-header-toggle(href='#')
              span.fa-solid.fa-bars(alt='Expand Menu', title='Expand Menu', data-bs-toggle='tooltip', data-bs-placement='right', style='width: 24px;')
            if settings.shared_pages.page_header.search.enabled == true && settings.shared_pages.page_header.search.position.toString().toLowerCase() == 'inside-header'
              span#search-header-span(alt='Search', title='Search', data-bs-toggle='tooltip', data-bs-placement='left')
                button#search-header-button(data-bs-toggle='collapse', data-bs-target='#search-navbar-collapse')
                  span.fa-solid.fa-magnifying-glass
        if settings.shared_pages.page_header.search.enabled == true && settings.shared_pages.page_header.search.position.toString().toLowerCase() == 'inside-header'
          div#search-navbar-collapse.collapse.flexGrow1
            div.navbar-nav.align-items-lg-center.search-box-custom(style='width:100%;')
              form.form-inline.col-12.d-flex.justify-content-center(method='post', action='/search')
                div.input-group.input-group-md.search-for(style='width:100%;')
                  input.form-control(type='text', name='search', placeholder=settings.localization.ex_search_message)
                  button.btn.btn-success.btn-sm(type='submit') #{settings.localization.ex_search_button}
    div#body-container(class=bodyContainerClasses)
      if settings.shared_pages.page_header.menu == 'side'
        div#side-nav-bar.navbar(class=sideBarClasses)
          nav.side-nav
            ul.navbar-nav
              li#sidebar-offcanvas-close.nav-item.text-end
                a.nav-link.d-inline(href='#', alt='Close Menu', title='Close Menu', data-bs-toggle='tooltip', data-bs-placement='right')
                  span.fa-2xl.fa-regular.fa-rectangle-xmark(type='button', data-bs-dismiss='offcanvas' aria-label='Close')
              li#home.nav-item(alt=settings.localization.menu_explorer, title=settings.localization.menu_explorer, data-bs-toggle='tooltip', data-bs-placement='right')
                a.nav-link(href='/')
                  span.nav-icon.fa-solid.fa-cubes
                  span.margin-left-5 #{settings.localization.menu_explorer}
              if settings.blockchain_specific.heavycoin.enabled == true && settings.blockchain_specific.heavycoin.reward_page.enabled == true
                li#reward.nav-item(alt=settings.localization.menu_reward, title=settings.localization.menu_reward, data-bs-toggle='tooltip', data-bs-placement='right')
                  a.nav-link(href='/reward')
                    span.nav-icon.fa-solid.fa-star
                    span.margin-left-5 #{settings.localization.menu_reward}
              if settings.masternodes_page.enabled == true
                li#masternodes.nav-item(alt="Masternodes", title="Masternodes", data-bs-toggle='tooltip', data-bs-placement='right')
                  a.nav-link(href='/masternodes')
                    span.nav-icon.fa-solid.fa-share-nodes
                    span.margin-left-5 Masternodes
              if settings.movement_page.enabled == true
                li#movement.nav-item(alt=settings.localization.menu_movement, title=settings.localization.menu_movement, data-bs-toggle='tooltip', data-bs-placement='right')
                  a.nav-link(href='/movement')
                    span.nav-icon.fa-regular.fa-money-bill-1
                    span.margin-left-5 #{settings.localization.menu_movement}
              if settings.network_page.enabled == true
                li#network.nav-item(alt=settings.localization.menu_network, title=settings.localization.menu_network, data-bs-toggle='tooltip', data-bs-placement='right')
                  a.nav-link(href='/network')
                    span.nav-icon.fa-solid.fa-network-wired
                    span.margin-left-5 #{settings.localization.menu_network}
              if settings.richlist_page.enabled == true
                li#richlist.nav-item(alt=settings.localization.menu_richlist, title=settings.localization.menu_richlist, data-bs-toggle='tooltip', data-bs-placement='right')
                  a.nav-link(href='/richlist')
                    span.nav-icon.fa-brands.fa-btc
                    span.margin-left-5 #{settings.localization.menu_richlist}
              if settings.markets_page.enabled == true
                if settings.markets_page.show_market_dropdown_menu == true && settings.market_count > 1
                  li#markets.dropend.nav-item.side-market-menu(alt=settings.localization.menu_markets, title=settings.localization.menu_markets, data-bs-toggle='tooltip', data-bs-placement='right')
                    a.nav-link.dropdown-toggle(href='#')
                      span.nav-icon.fa-solid.fa-chart-line
                      span.margin-left-5 #{settings.localization.menu_markets}
                    div#side-market-menu.navbar(class=dropdownClasses)
                      each mkt in settings.market_data
                        if mkt != null && mkt.id != null
                          each pair in mkt.trading_pairs
                            a.dropdown-item(href='/markets/' + mkt.id + '/' + pair.pair)
                              if pair.isAlt == true
                                if mkt.alt_logo != null && mkt.alt_logo != ''
                                  img.market-logo(src='data:image/png;base64,' + mkt.alt_logo, title=mkt.alt_name + ' (' + pair.pair + ')', alt=mkt.alt_name + ' (' + pair.pair + ')')
                                else
                                  i.market-logo.fa-solid.fa-circle-question
                                span #{mkt.alt_name}
                                  span.small.fw-normal  (#{pair.pair})
                              else
                                if mkt.logo != null && mkt.logo != ''
                                  img.market-logo(src='data:image/png;base64,' + mkt.logo, title=mkt.name + ' (' + pair.pair + ')', alt=mkt.name + ' (' + pair.pair + ')')
                                else
                                  i.market-logo.fa-solid.fa-circle-question
                                span #{mkt.name}
                                  span.small.fw-normal  (#{pair.pair})
                else
                  li#markets.nav-item(alt=settings.localization.menu_markets, title=settings.localization.menu_markets, data-bs-toggle='tooltip', data-bs-placement='right')
                    a.nav-link(href='/markets/' + settings.markets_page.default_exchange.exchange_name + '/' + settings.markets_page.default_exchange.trading_pair)
                      span.nav-icon.fa-solid.fa-chart-line
                      span.margin-left-5 #{settings.localization.menu_markets}
              if settings.api_page.enabled == true
                li#info.nav-item(alt=settings.localization.menu_api, title=settings.localization.menu_api, data-bs-toggle='tooltip', data-bs-placement='right')
                  a.nav-link(href='/info')
                    span.nav-icon.fa-solid.fa-circle-info
                    span.margin-left-5 #{settings.localization.menu_api}
              if settings.claim_address_page.show_header_menu == true && settings.claim_address_page.enabled == true
                li#claim-address.nav-item(alt=settings.localization.menu_claim_address, title=settings.localization.menu_claim_address, data-bs-toggle='tooltip', data-bs-placement='right')
                  a.nav-link(href='/claim')
                    span.nav-icon.fa-regular.fa-address-card
                    span.margin-left-5 #{settings.localization.menu_claim_address}
              if settings.orphans_page.enabled == true
                li#orphans.nav-item(alt=settings.localization.menu_orphans, title=settings.localization.menu_orphans, data-bs-toggle='tooltip', data-bs-placement='right')
                  a.nav-link(href='/orphans')
                    span.nav-icon.fa-regular.fa-rectangle-xmark
                    span.margin-left-5 #{settings.localization.menu_orphans}
              each plugin in settings.plugins.allowed_plugins
                if plugin != null && plugin.enabled == true && plugin.pages != null && plugin.pages.length > 0
                  each pg in plugin.pages
                    if pg.enabled == true && pg.show_header_menu == true
                      li.nav-item(id=pg.page_id, alt=pg.menu_title, title=pg.menu_title, data-bs-toggle='tooltip', data-bs-placement='right')
                        a.nav-link(href='/' + pg.route_suffix)
                          span.nav-icon(class=pg.menu_fontawesome_class)
                          span.margin-left-5=pg.menu_title
        div#side-offcanvas.offcanvas.offcanvas-start(tabindex='-1')
          div.offcanvas-body.navbar(class=sideBarClasses)
      div#main-container(class=mainContainerClasses)
        div#main-child-container(class=mainContainerChildClasses)
          if showSync != null && showSync == true
            .col-lg-12
              .alert.alert-warning
                .cardSpacer
                  span.fa-solid.fa-triangle-exclamation(style='margin-right:5px;')
                  strong #{settings.localization.ex_warning}
                div #{settings.localization.initial_index_alert}
          if showPanels == true || (settings.shared_pages.page_header.search.enabled == true && settings.shared_pages.page_header.search.position.toString().toLowerCase() == 'below-header')
            .col-lg-12
              if showPanels == true
                .row.text-center.d-flex.justify-content-center
                  div(class="col-lg-2 col-lg-offset-" + settings.paneloffset)
                    - if (settings.panel1 != '') {
                      .card.card-default.border-0.d-lg-block.d-block.cardSpacer(id='pnlOne')
                    - }
                  - if (settings.panel2 != '') {
                    .col-lg-2
                      .card.card-default.border-0.d-lg-block.d-block.cardSpacer(id='pnlTwo')
                  - }
                  - if (settings.panel3 != '') {
                    .col-lg-2
                      .card.card-default.border-0.d-lg-block.d-block.cardSpacer(id='pnlThree')
                  - }
                  - if (settings.panel4 != '') {
                    .col-lg-2
                      .card.card-default.border-0.d-lg-block.d-block.cardSpacer(id='pnlFour')
                  - }
                  - if (settings.panel5 != '') {
                  .col-lg-2
                    .card.card-default.border-0.d-lg-block.d-block.cardSpacer(id='pnlFive')
                  - }
              if settings.shared_pages.page_header.search.enabled == true && settings.shared_pages.page_header.search.position.toString().toLowerCase() == 'below-header'
                div#search-row.row.text-center
                  form.form-inline.col-12.d-flex.justify-content-center(method='post', action='/search')
                    #index-search.form-group.d-flex.justify-content-center
                      input.form-control(type='text', name='search', placeholder=settings.localization.ex_search_message, style='min-width:80%;margin-right:5px;')
                      button.btn.btn-success(type='submit') #{settings.localization.ex_search_button}
          if showNethashChart == true || showDifficultyChart == true
            - var chartColumnClass = 'col-lg-12';
            .container(style='padding-left:0;padding-right:0;')
              .row.align-items-start
                if showNethashChart == true && showDifficultyChart == true && settings.shared_pages.page_header.network_charts.nethash_chart.full_row == false && settings.shared_pages.page_header.network_charts.difficulty_chart.full_row == false
                  - chartColumnClass = 'col-lg-6';
                  include ./includes/nethash_chart.pug
                  include ./includes/difficulty_chart.pug
                else if showNethashChart == true
                  include ./includes/nethash_chart.pug
                else if showDifficultyChart == true
                  include ./includes/difficulty_chart.pug
            if showNethashChart == true && showDifficultyChart == true && (settings.shared_pages.page_header.network_charts.nethash_chart.full_row == true || settings.shared_pages.page_header.network_charts.difficulty_chart.full_row == true)
              .container(style='padding-left:0;padding-right:0;')
                .row.align-items-start
                  include ./includes/difficulty_chart.pug
          block content
    div#footer-container(class=footerClasses, role='navigation')
      .col-4.navbar-nav
        ul.nav.justify-content-left
          each social in settings.shared_pages.page_footer.social_links
            if social.enabled
              li.float-start
                a.nav-link.social-link.border-0(href=social.url, target='_blank', alt=settings.coin.name + ' ' + social.tooltip_text, title=settings.coin.name + ' ' + social.tooltip_text, data-bs-toggle='tooltip', data-bs-placement='top')
                  if social.fontawesome_class != null && social.fontawesome_class != ''
                    span(class='vertical-align-middle ' + social.fontawesome_class)
                  else
                    img(class='vertical-align-middle', src=social.image_path)
      .col-4.navbar-nav
        ul.nav.justify-content-center
          li.text-center
            p
              | !{settings.shared_pages.page_footer.powered_by_text.replace('{explorer_version}', settings.explorer_version + (settings.revision == null || settings.revision == '' ? '' : `-${settings.revision}`))}
      .col-4.navbar-nav
        ui.nav.justify-content-end
          label#lblBlockcount.badge.nav-link.border-0.float-end
          label#lblConnections.badge.nav-link.border-0.float-end