import './_commonjsHelpers-0c4b6f40.js';
import './_to-object-ded78eb9.js';
import './es6.string.iterator-9b2af4a5.js';
import './_library-528f1934.js';
import './_iter-detect-59409a32.js';
import './toConsumableArray-725434a0.js';
import './core.get-iterator-method-54d2e411.js';
import './_object-pie-71ac75a4.js';
import { _ as _extends } from './extends-cc5da797.js';
import './_object-sap-4d59d5bd.js';
import './inherits-7ee3e0c1.js';
import './define-property-de3fc946.js';
import './web.dom.iterable-8956f9a5.js';
import './typeof-08f2c380.js';
import './_is-array-49698029.js';
import React__default, { useState, useEffect } from 'react';
import './index-0e45a0b2.js';
import 'prop-types';
import 'react-bootstrap/Row';
import 'react-bootstrap/Col';
import './moment-e2f9b20c.js';
import { useRouter } from 'next/router';
import './isSymbol-807e927e.js';
import './debounce-1a993acf.js';
import 'react-dom';
import './index-73819142.js';
import './index-5f9f807a.js';
import './main-5d1e4bd3.js';
import './entities-7cc3bf45.js';
import './stringify-008c8802.js';
import { _ as _slicedToArray } from './slicedToArray-7021e5df.js';
import './asyncToGenerator-7c654f36.js';
import './_set-species-cede29f8.js';
import './Segment.js';
import './Beam.js';
import './AdSlot.js';
import { B as BlockContent } from './BlockContent-e9b4ddcf.js';
import './smoothscroll-4b699764.js';
import './GroupDeck.js';
import 'react-bootstrap';
import './iconBase-602d52fe.js';
import './index.esm-29e48d38.js';
import Button from 'react-bootstrap/Button';
import { m as momentTimezone } from './index-ef6d5dcf.js';
import { g as getSerializers } from './index-c376cd8e.js';
import './util-7700fc59.js';
import './brightcove-react-player-loader.es-83f53e4e.js';
import 'react-bootstrap/Pagination';
import 'next/head';

var ExternalResources = function ExternalResources(props) {
  var resources = props.resources,
      display = props.display,
      client = props.client,
      _props$cta = props.cta,
      cta = _props$cta === undefined ? 'Learn More' : _props$cta,
      _props$url = props.url,
      url = _props$url === undefined ? 'resources' : _props$url;

  var _useState = useState(display && (display === 'recent' || display === 'archived') ? display : 'recent'),
      _useState2 = _slicedToArray(_useState, 2),
      active = _useState2[0],
      setActive = _useState2[1];

  var router = useRouter();
  useEffect(function () {
    router.push(router.pathname, '/' + url + '?display=' + active, { shallow: true });
  }, [active]);
  return React__default.createElement(
    'div',
    { id: 'resources' },
    React__default.createElement(
      'div',
      { id: 'toggles' },
      React__default.createElement(
        'div',
        { onClick: function onClick() {
            return setActive(function () {
              return 'recent';
            });
          }, className: active === 'recent' ? 'active' : '' },
        'Recent'
      ),
      React__default.createElement(
        'div',
        { onClick: function onClick() {
            return setActive(function () {
              return 'archived';
            });
          }, className: active === 'archived' ? 'active' : '' },
        'Archive'
      )
    ),
    resources[active].length > 0 ? resources[active].map(function (r, i) {
      return React__default.createElement(
        'div',
        { key: i, className: 'resource' },
        React__default.createElement(
          'div',
          { id: 'thumb' },
          React__default.createElement(
            'a',
            { href: r.destination, target: '_blank', rel: 'noopener noreferrer' },
            React__default.createElement('img', { src: r.thumbnail })
          )
        ),
        React__default.createElement(
          'div',
          { id: 'details' },
          React__default.createElement(
            'a',
            { href: r.destination, target: '_blank', rel: 'noopener noreferrer' },
            React__default.createElement(
              'p',
              { id: 'title' },
              r.title
            ),
            r.intro && React__default.createElement(
              'div',
              { id: 'intro' },
              React__default.createElement(BlockContent, _extends({ serializers: getSerializers(client), blocks: r.intro }, client.config()))
            ),
            React__default.createElement(
              'div',
              { id: 'date' },
              React__default.createElement(
                'p',
                { style: { fontWeight: 'bold' } },
                'Date:'
              ),
              React__default.createElement(
                'p',
                null,
                momentTimezone.tz(r.displayDate, 'America/New_York').format('MMMM Do YYYY, h:mm a z')
              )
            ),
            r.speakers && React__default.createElement(
              'div',
              { id: 'speakers' },
              React__default.createElement(
                'p',
                { style: { fontWeight: 'bold' } },
                'Speakers:'
              ),
              React__default.createElement(BlockContent, _extends({ serializers: getSerializers(client), blocks: r.speakers }, client.config()))
            ),
            r.location && React__default.createElement(
              'div',
              { id: 'location' },
              React__default.createElement(
                'p',
                { style: { fontWeight: 'bold' } },
                'Location:'
              ),
              r.location
            ),
            r.sponsor && React__default.createElement(
              'div',
              { id: 'sponsor' },
              React__default.createElement(
                'p',
                { style: { fontWeight: 'bold' } },
                'Sponsors:'
              ),
              r.sponsor
            )
          ),
          React__default.createElement(
            Button,
            { id: 'cta', variant: 'secondary', href: r.destination, target: '_blank', rel: 'noopener noreferrer' },
            cta
          )
        )
      );
    }) : React__default.createElement(
      'p',
      null,
      'No ' + active + ' resources available. '
    ),
    React__default.createElement(
      'style',
      { jsx: true },
      '\n        .resource {\n          display: flex;\n          position: relative;\n          margin: 0 0 1rem 0;\n        }\n        .resource #thumb {\n          box-sizing: border-box;\n          padding: 0.5rem;\n          width: 25%;\n        }\n        .resource #thumb img {\n          width: 100%;\n        }\n        .resource #details {\n          box-sizing: border-box;\n          padding: 0.5rem;\n          width: 75%;\n        }\n        #resources .resource p {\n          margin: 0;\n        }\n        #toggles {\n          display: flex;\n          margin: 0 0 1rem 0;\n        }\n        #toggles > div {\n          padding: 0.5rem;\n          cursor: pointer;\n        }\n        #toggles > div:hover {\n          font-weight: bold;\n          border-bottom: 2px solid #cecece;\n        }\n        #toggles > div.active {\n          font-weight: bold;\n          border-bottom: 2px solid var(--primary);\n        }\n        .resource #title {\n          font-weight: bold;\n          font-size: 1.25rem;\n        }\n        .resource #date,\n        .resource #speakers,\n        .resource #location,\n        .resource #sponsor,\n        .resource #cta {\n          margin: 1rem 0 0 0;\n        }\n      '
    )
  );
};

export default ExternalResources;
