'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var React = require('react');
var Container = require('react-bootstrap/Container');
var Nav = require('react-bootstrap/Nav');
var Navbar = require('react-bootstrap/Navbar');
var NavDropdown = require('react-bootstrap/NavDropdown');
var index_esm = require('./index.esm-3b9b8952.js');
var Search = require('./Search.js');
var Segment = require('./Segment.js');
require('./iconBase-68959171.js');
require('./slicedToArray-5d1bc3b3.js');
require('./_commonjsHelpers-06173234.js');
require('./web.dom.iterable-46657b5c.js');
require('./es6.string.iterator-c2573ffd.js');
require('./_to-object-6de10e57.js');
require('./core.get-iterator-method-f474eacc.js');
require('react-bootstrap/Form');
require('react-bootstrap/FormControl');
require('react-bootstrap/Button');
require('./asyncToGenerator-58c289d9.js');
require('./_library-dd23b178.js');
require('./_iter-detect-55a5657a.js');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
var Container__default = /*#__PURE__*/_interopDefaultLegacy(Container);
var Nav__default = /*#__PURE__*/_interopDefaultLegacy(Nav);
var Navbar__default = /*#__PURE__*/_interopDefaultLegacy(Navbar);
var NavDropdown__default = /*#__PURE__*/_interopDefaultLegacy(NavDropdown);

var NavNormal = function NavNormal(props) {
  var logo = props.logo,
      dataObject = props.dataObject,
      _props$website = props.website,
      website = _props$website === undefined ? {} : _props$website;


  var ref = React.useRef(null);

  React.useEffect(function () {

    setTimeout(function () {
      var segmentLinks = ref.current.querySelectorAll('a[needsegmentsupport="true"]');
      for (var i = 0; i < segmentLinks.length; i++) {
        var link = segmentLinks[i];
        var href = link.getAttribute('href');
        var newHref = Segment.getURL(href, { needSegmentSupport: true });
        link.setAttribute('href', newHref);
      }
    }, 1000);
  }, []);

  return React__default['default'].createElement(
    'section',
    { ref: ref },
    React__default['default'].createElement(
      Navbar__default['default'],
      { expand: 'lg' },
      React__default['default'].createElement(
        Container__default['default'],
        null,
        React__default['default'].createElement('img', { src: logo, style: { height: '50px' }, alt: website.title ? website.title : website.name ? website.name : 'Website Logo' }),
        React__default['default'].createElement(
          'div',
          null,
          React__default['default'].createElement(index_esm.MdEmail, null),
          ' Subscribe',
          React__default['default'].createElement('br', null),
          React__default['default'].createElement(index_esm.MdMouse, null),
          ' Login'
        )
      )
    ),
    React__default['default'].createElement(
      Navbar__default['default'],
      { variant: 'dark', expand: 'lg', bg: 'primary' },
      React__default['default'].createElement(
        Container__default['default'],
        null,
        React__default['default'].createElement(Navbar__default['default'].Toggle, { 'aria-controls': 'basic-navbar-nav' }),
        React__default['default'].createElement(
          Navbar__default['default'].Collapse,
          { id: 'basic-navbar-nav' },
          React__default['default'].createElement(
            Nav__default['default'],
            { className: 'mr-auto' },
            dataObject && dataObject.map(function (row) {
              if (row.type === 'dropdown') {
                return React__default['default'].createElement(
                  NavDropdown__default['default'],
                  { title: row.name, id: 'basic-nav-dropdown', renderMenuOnMount: true },
                  row.dropdown && row.dropdown.map(function (ddRow, ddItems) {
                    if (ddRow.type === 'divider') {
                      return React__default['default'].createElement(NavDropdown__default['default'].Divider, null);
                    } else {
                      return React__default['default'].createElement(
                        NavDropdown__default['default'].Item,
                        { href: ddRow.url, needsegmentsupport: ddRow.needSegmentSupport ? 'true' : '', target: ddRow.blank ? '_blank' : '_self' },
                        ddRow.name
                      );
                    }
                  })
                );
              } else {
                // Link default
                return React__default['default'].createElement(
                  Nav__default['default'].Link,
                  { href: row.url, needsegmentsupport: row.needSegmentSupport ? 'true' : '', target: row.blank ? '_blank' : '_self' },
                  row.name
                );
              }
            })
          )
        ),
        React__default['default'].createElement(Search, null)
      )
    ),
    React__default['default'].createElement(
      'style',
      { jsx: 'true' },
      '\n        @media screen and (max-width: 991px) {\n          .dropdown-menu {\n            max-height: 315px;\n            overflow: auto;\n          }\n          ::-webkit-scrollbar {\n            width: 10px;\n          }\n          ::-webkit-scrollbar-thumb {\n            border-radius: 4px;\n            background-color: rgba(214, 214, 214, 0.8);\n            box-shadow: 0 0 1px rgba(255, 255, 255, 0.5);\n            -webkit-box-shadow: 0 0 1px rgba(255, 255, 255, 0.5);\n          }\n        }\n      '
    )
  );
};

exports.NavNormal = NavNormal;
exports.default = NavNormal;
