'use strict';

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

function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }

require('./_commonjsHelpers-06173234.js');
require('./_to-object-329a650b.js');
require('./es6.string.iterator-cc0bbaa4.js');
require('./_library-dd23b178.js');
require('./_iter-detect-60b2f026.js');
require('./core.get-iterator-method-f62321d4.js');
require('./web.dom.iterable-a0e279c1.js');
var React = require('react');
var React__default = _interopDefault(React);
var Container = _interopDefault(require('react-bootstrap/Container'));
require('./slicedToArray-8f385299.js');
require('./asyncToGenerator-533d476a.js');
require('./_set-species-f92c67c5.js');
var Segment = require('./Segment.js');
require('./iconBase-68959171.js');
require('react-bootstrap/Button');
require('react-bootstrap/Form');
var Nav = _interopDefault(require('react-bootstrap/Nav'));
var Navbar = _interopDefault(require('react-bootstrap/Navbar'));
var NavDropdown = _interopDefault(require('react-bootstrap/NavDropdown'));
var index_esm$1 = require('./index.esm-66ffa47a.js');
require('react-bootstrap/FormControl');
var Search = require('./Search.js');

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.createElement(
    'section',
    { ref: ref },
    React__default.createElement(
      Navbar,
      { expand: 'lg' },
      React__default.createElement(
        Container,
        null,
        React__default.createElement('img', { src: logo, style: { height: '50px' }, alt: website.title ? website.title : website.name ? website.name : 'Website Logo' }),
        React__default.createElement(
          'div',
          null,
          React__default.createElement(index_esm$1.MdEmail, null),
          ' Subscribe',
          React__default.createElement('br', null),
          React__default.createElement(index_esm$1.MdMouse, null),
          ' Login'
        )
      )
    ),
    React__default.createElement(
      Navbar,
      { variant: 'dark', expand: 'lg', bg: 'primary' },
      React__default.createElement(
        Container,
        null,
        React__default.createElement(Navbar.Toggle, { 'aria-controls': 'basic-navbar-nav' }),
        React__default.createElement(
          Navbar.Collapse,
          { id: 'basic-navbar-nav' },
          React__default.createElement(
            Nav,
            { className: 'mr-auto' },
            dataObject && dataObject.map(function (row) {
              if (row.type === 'dropdown') {
                return React__default.createElement(
                  NavDropdown,
                  { title: row.name, id: 'basic-nav-dropdown', renderMenuOnMount: true },
                  row.dropdown && row.dropdown.map(function (ddRow, ddItems) {
                    if (ddRow.type === 'divider') {
                      return React__default.createElement(NavDropdown.Divider, null);
                    } else {
                      return React__default.createElement(
                        NavDropdown.Item,
                        { href: ddRow.url, needsegmentsupport: ddRow.needSegmentSupport ? 'true' : '', target: ddRow.blank ? '_blank' : '_self' },
                        ddRow.name
                      );
                    }
                  })
                );
              } else {
                // Link default
                return React__default.createElement(
                  Nav.Link,
                  { href: row.url, needsegmentsupport: row.needSegmentSupport ? 'true' : '', target: row.blank ? '_blank' : '_self' },
                  row.name
                );
              }
            })
          )
        ),
        React__default.createElement(Search, null)
      )
    ),
    React__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;
