"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;

var _react = _interopRequireDefault(require("react"));

require("./style.sass");

var _context = require("../../context");

var _svgs = require("../../svgs");

var _constants = require("../../constants");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

var mobileBar = /*#__PURE__*/_react["default"].createContext(null);

var Right = function Right(props) {
  var contactNumber = props.contactNumber,
      contactLink = props.contactLink;

  var toggleView = function toggleView() {
    var _mobileBar$current, _mobileBar$current$cl, _mobileBar$current2, _mobileBar$current2$c, _mobileBar$current3, _mobileBar$current3$c;

    if (mobileBar !== null && mobileBar !== void 0 && (_mobileBar$current = mobileBar.current) !== null && _mobileBar$current !== void 0 && (_mobileBar$current$cl = _mobileBar$current.className) !== null && _mobileBar$current$cl !== void 0 && _mobileBar$current$cl.match('change')) mobileBar === null || mobileBar === void 0 ? void 0 : (_mobileBar$current2 = mobileBar.current) === null || _mobileBar$current2 === void 0 ? void 0 : (_mobileBar$current2$c = _mobileBar$current2.classList) === null || _mobileBar$current2$c === void 0 ? void 0 : _mobileBar$current2$c.remove('change');else mobileBar === null || mobileBar === void 0 ? void 0 : (_mobileBar$current3 = mobileBar.current) === null || _mobileBar$current3 === void 0 ? void 0 : (_mobileBar$current3$c = _mobileBar$current3.classList) === null || _mobileBar$current3$c === void 0 ? void 0 : _mobileBar$current3$c.add('change');
  };

  return /*#__PURE__*/_react["default"].createElement(_context.MainContext.Consumer, null, function (data) {
    var _data$headerLinks;

    var socialMediaLinks = (data === null || data === void 0 ? void 0 : data.socialMediaLinks) || {};
    var arr = Object.keys(socialMediaLinks) || [];
    return /*#__PURE__*/_react["default"].createElement("nav", {
      className: "wizrd-site-navigation wizrd-site-navigation-social"
    }, _constants.WEBSIT_TYPE.includes(data === null || data === void 0 ? void 0 : data.templateType) ? /*#__PURE__*/_react["default"].createElement("ul", null, /*#__PURE__*/_react["default"].createElement("li", null, /*#__PURE__*/_react["default"].createElement("a", {
      href: "tel:".concat(contactNumber)
    }, contactNumber)), /*#__PURE__*/_react["default"].createElement("li", null, contactLink)) : /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("div", {
      "class": "wizrd-mobile-icon",
      ref: mobileBar,
      onClick: toggleView
    }, /*#__PURE__*/_react["default"].createElement("span", {
      className: "wizrd-mobile-open-icon"
    }, /*#__PURE__*/_react["default"].createElement("svg", {
      width: "24",
      height: "20",
      viewBox: "0 0 24 20",
      fill: "none",
      xmlns: "http://www.w3.org/2000/svg"
    }, /*#__PURE__*/_react["default"].createElement("path", {
      d: "M1.33301 2H22.6663",
      stroke: "#0C014F",
      "stroke-width": "2.5",
      "stroke-linecap": "round",
      "stroke-linejoin": "round"
    }), /*#__PURE__*/_react["default"].createElement("path", {
      d: "M1.33301 10H22.6663",
      stroke: "#0C014F",
      "stroke-width": "2.5",
      "stroke-linecap": "round",
      "stroke-linejoin": "round"
    }), /*#__PURE__*/_react["default"].createElement("path", {
      d: "M1.33301 18H22.6663",
      stroke: "#0C014F",
      "stroke-width": "2.5",
      "stroke-linecap": "round",
      "stroke-linejoin": "round"
    }))), /*#__PURE__*/_react["default"].createElement("span", {
      className: "wizrd-mobile-close-icon"
    }, /*#__PURE__*/_react["default"].createElement("svg", {
      width: "20",
      height: "19",
      viewBox: "0 0 20 19",
      fill: "none",
      xmlns: "http://www.w3.org/2000/svg"
    }, /*#__PURE__*/_react["default"].createElement("path", {
      d: "M2.45703 2L17.542 17.0849",
      stroke: "#0C014F",
      "stroke-width": "2.5",
      "stroke-linecap": "round",
      "stroke-linejoin": "round"
    }), /*#__PURE__*/_react["default"].createElement("path", {
      d: "M17.542 2L2.45705 17.0849",
      stroke: "#0C014F",
      "stroke-width": "2.5",
      "stroke-linecap": "round",
      "stroke-linejoin": "round"
    })))), /*#__PURE__*/_react["default"].createElement("ul", null, data === null || data === void 0 ? void 0 : (_data$headerLinks = data.headerLinks) === null || _data$headerLinks === void 0 ? void 0 : _data$headerLinks.map(function (headerLink) {
      return /*#__PURE__*/_react["default"].createElement("li", {
        onClick: toggleView,
        className: "wizrd-mobile-nav"
      }, headerLink);
    }), arr.map(function (item) {
      var link = socialMediaLinks[item];
      return /*#__PURE__*/_react["default"].createElement("li", {
        className: "wizrd-header-social-links"
      }, /*#__PURE__*/_react["default"].createElement("a", {
        rel: "noopener",
        "aria-label": item,
        href: link !== null && link !== void 0 && link.match('http') ? link : "https://".concat(link),
        target: "_blank"
      }, (0, _svgs.svgData)()[item]));
    }), /*#__PURE__*/_react["default"].createElement("li", null, data !== null && data !== void 0 && data.readOnly ? /*#__PURE__*/_react["default"].createElement("a", {
      href: "javasript:void(0)",
      className: "btn btn-primary"
    }, "Subscribe") : /*#__PURE__*/_react["default"].createElement("button", {
      className: "btn btn-primary",
      onClick: props.handleSubscribe
    }, "Subscribe")))));
  });
};

var _default = Right;
exports["default"] = _default;