'use strict';

var asyncToGenerator = require('./asyncToGenerator-77821af0.js');
var _extends = require('./extends-7c86182f.js');
var slicedToArray = require('./slicedToArray-067dd3bc.js');
var toConsumableArray = require('./toConsumableArray-d7797c2b.js');
var React = require('react');
var reactBootstrap = require('react-bootstrap');
var moment = require('./moment-aca40de1.js');
var index = require('./index-d2a6ef75.js');
var Router = require('next/router');
var index$1 = require('./index-65621b6c.js');
var lodash = require('./lodash-f0783643.js');
var main = require('./main-6054981e.js');
var entities = require('./entities-df1aed86.js');
var ADInfeed = require('./ADInfeed-f316b66a.js');
var AuthorComponent = require('./AuthorComponent-7d00f6d5.js');
var ADlgInfeed = require('./ADlgInfeed-2003306e.js');
var getContentCategory = require('./getContentCategory-f38a4c00.js');
var timeDifferenceCalc = require('./timeDifferenceCalc.js');
var urlFor = require('./urlFor.js');
var Pagination = require('./Pagination-6359861a.js');
require('./_commonjsHelpers-06173234.js');
require('./core.get-iterator-method-5643aa10.js');
require('./web.dom.iterable-d98303e0.js');
require('./_library-dd23b178.js');
require('./_iter-detect-b1df62f0.js');
require('./_object-pie-083f2dd6.js');
require('./events-1b438fe7.js');
require('prop-types');
require('react-dom');
require('react-bootstrap/Card');
require('./AdSlot.js');
require('./debounce-d4a2369b.js');
require('./isSymbol-03abbdf0.js');
require('./toNumber-5e1fac58.js');
require('./Beam.js');
require('./stringify-f7a37a8d.js');
require('./Segment.js');
require('./index-d48b231c.js');
require('react-bootstrap/Button');
require('./index.esm-d51c9ac6.js');
require('./iconBase-be4097c0.js');

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

var React__default = /*#__PURE__*/_interopDefaultLegacy(React);

var _this = undefined;

var renderCardImage = function renderCardImage(row, client) {
  var imageHeight = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  var imageWidth = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  var imageMaxHeight = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
  var imageFit = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : null;
  return urlFor({ client: client, source: row.thumbnail, imageHeight: imageHeight, imageWidth: imageWidth, imageMaxHeight: imageMaxHeight, imageFit: imageFit });
};

var checkExternalUrl = function checkExternalUrl(url) {
  return new RegExp(['http', 'https'].join('|')).test(url);
};

var CardLoader = function CardLoader(_ref) {
  var data = _ref.data,
      client = _ref.client,
      mapping = _ref.mapping,
      showPublished = _ref.showPublished,
      defaultImage = _ref.defaultImage,
      showAuthor = _ref.showAuthor,
      showCategory = _ref.showCategory,
      imageHeight = _ref.imageHeight,
      imageWidth = _ref.imageWidth,
      imageMaxHeight = _ref.imageMaxHeight,
      imageFit = _ref.imageFit,
      rightItems = _ref.rightItems,
      brandInsightAd = _ref.brandInsightAd,
      showBI = _ref.showBI,
      heroContent = _ref.heroContent,
      lgInfeedAd = _ref.lgInfeedAd,
      showPubInfo = _ref.showPubInfo,
      contentCategoryMapping = _ref.contentCategoryMapping,
      showTimeDiff = _ref.showTimeDiff,
      showTaxonomies = _ref.showTaxonomies,
      showIntro = _ref.showIntro;

  var numberOfItemsBeforeAd = data.length < 6 ? data.length : 6;
  var insertBrandInsightAd = function insertBrandInsightAd(arr, index, newElement) {
    return [].concat(toConsumableArray._toConsumableArray(arr.slice(0, index)), [newElement], toConsumableArray._toConsumableArray(arr.slice(index)));
  };

  var _useState = React.useState(!showBI || !brandInsightAd ? true : false),
      _useState2 = slicedToArray._slicedToArray(_useState, 2),
      dataRemapped = _useState2[0],
      setDataRemapped = _useState2[1];
  //  Need to pass flag "lgInfeedAd={true}" along with brandInsightAd from site level for large infeed-ad to render
  //  Checking window and lgInfeedAd flag in desktop view ( window >= 1400px ).


  if (lgInfeedAd && brandInsightAd && typeof window !== 'undefined' && window.innerWidth >= 1400) {
    var lgInfeed = {
      _type: 'lg-infeed',
      adUnit: brandInsightAd.adUnit,
      className: 'lg-infeed',
      networkID: brandInsightAd.networkID,
      sizes: [728, 90],
      //  Adding sizeMapping for showing ad above 1400px
      sizeMapping: [{
        viewport: [1400, 0],
        sizes: [[728, 90]]
      }, { viewport: [0, 0], sizes: [] }],
      targeting: {
        content_placement: brandInsightAd.targeting.content_placement,
        document_url: brandInsightAd.targeting.document_url,
        document_group: brandInsightAd.targeting.document_gorup,
        rootDocumentGroup: brandInsightAd.targeting.rootDocumentGroup
      },
      /* Passing refresh flag */
      refreshFlag: brandInsightAd.refreshFlag ? brandInsightAd.refreshFlag : false
    };

    var chunks = lodash.lodash.chunk(data, 6).map(function (chunk) {
      var set = lodash.lodash.chunk(chunk, 2);
      for (var i = 0; i < set.length; i++) {
        if (i !== set.length - 1) {
          set[i].push(lgInfeed);
        }
      }
      return lodash.lodash.flattenDeep(set);
    });
    data = lodash.lodash.flatten(chunks);
    !dataRemapped && setDataRemapped(true); // To detect if appending of insights ads are completed
  }

  // set dataRemap to true as there are no infeed or BI ads or window width is less than limit
  React.useEffect(function () {
    if (typeof window !== 'undefined' && (!lgInfeedAd || !brandInsightAd || window.innerWidth < 1400) && !dataRemapped) {
      setDataRemapped(true);
    }
  }, []);

  if (showBI && brandInsightAd) {
    //  Checking window and lgInfeedAd flag in desktop view ( window >= 1400px ).
    if (lgInfeedAd && typeof window !== 'undefined' && window.innerWidth >= 1400) brandInsightAd.interval = 8;
    var pos = 0;
    for (var i = 1; pos < data.length; i++) {
      var inFeedAd = {
        adUnit: brandInsightAd.adUnit,
        className: brandInsightAd.className,
        networkID: brandInsightAd.networkID,
        sizes: brandInsightAd.sizes,
        slotId: brandInsightAd.slotId + '_' + i,
        targeting: {
          pos: 'infeed',
          content_placement: brandInsightAd.targeting.content_placement,
          document_url: brandInsightAd.targeting.document_url,
          document_group: brandInsightAd.targeting.document_group,
          rootDocumentGroup: brandInsightAd.targeting.rootDocumentGroup
        },
        _type: 'brandInsightAd',
        /* Passing refresh flag */
        refreshFlag: brandInsightAd.refreshFlag ? brandInsightAd.refreshFlag : false
      };

      data = insertBrandInsightAd(data, pos, inFeedAd);
      pos += brandInsightAd.interval + 1;
    }
  }

  data = data.map(function (ele, i) {
    if (ele._type === 'lg-infeed') {
      //  Setting pos as top2 for the first occurence of large infeed ad
      // const pos = data.indexOf(data.find((d) => d._type === 'lg-infeed')) === i ? 'top2' : `lg-infeed_${i}`
      return _extends._extends({}, ele, { slotId: 'lg-infeed_' + i, targeting: _extends._extends({}, ele.targeting, { pos: 'lg-infeed' }) });
    } else return ele;
  });

  var featureCount = 0;
  return React__default["default"].createElement(
    'div',
    null,
    data && data.length > 0 ? dataRemapped ? // For Javascript Enabled Cases
    data.map(function (article, index) {
      var contentCategoryName = article.contentCategory ? article.contentCategory.name : 'Articles';

      if (article._type === 'feature') {
        featureCount++;
        if (article.blank || checkExternalUrl(article.url.current)) {
          return React__default["default"].createElement(
            reactBootstrap.Media,
            {
              key: article._id ? article._id : index,
              className: 'feature-media',
              style: { flexDirection: 'column', marginBottom: '1.25rem', paddingBottom: '1.25rem', borderBottom: '1px solid #ddd' } },
            (article.thumbnail && article.thumbnail.asset || defaultImage) && React__default["default"].createElement(
              'a',
              { rel: 'noopener', href: article.url.current, target: '_blank', className: 'feature-wrapper' },
              React__default["default"].createElement(
                index$1.LazyLoad,
                { height: imageHeight, placeholder: React__default["default"].createElement(ImagePlaceholder, null) },
                article.thumbnail && article.thumbnail.asset ? React__default["default"].createElement('img', { className: 'img-fluid', src: renderCardImage(article, client, imageHeight, imageWidth, imageMaxHeight, imageFit), alt: article.title }) : article.thumbnail ? React__default["default"].createElement('img', { src: article.thumbnail, className: 'mr-3', alt: article.title }) : React__default["default"].createElement('img', { src: defaultImage, src2: article.thumbnail, className: 'mr-3', width: '240', height: '135', alt: article.title })
              ),
              article.source && React__default["default"].createElement(
                'div',
                { className: 'content-category-label' },
                React__default["default"].createElement(
                  'div',
                  { className: 'mb-1 sanityDisplayLabel displayLabelThumb' },
                  article.source
                )
              )
            ),
            React__default["default"].createElement(
              reactBootstrap.Media.Body,
              null,
              React__default["default"].createElement(
                'a',
                { rel: 'noopener', href: article.url.current, target: '_blank' },
                article.title && React__default["default"].createElement(
                  'h4',
                  { className: 'card-title', style: { fontWeight: '500', color: 'var(--gray-dark)', marginBottom: '.5rem' } },
                  article.title
                )
              ),
              showPublished && !showTimeDiff && article.published && React__default["default"].createElement(
                'p',
                { className: 'card-text', style: { color: 'var(--dark)', margin: '.25rem 0' } },
                moment.moment(article.published).format('MMMM DD, YYYY')
              ),
              showTimeDiff && article.published && React__default["default"].createElement(
                'p',
                { className: 'card-text', style: { color: '#464644', lineHeight: '1.25', fontSize: '.875rem', margin: '.25rem 0' } },
                showTaxonomies && article.taxonomyMapping && article.taxonomyMapping.map(function (taxonomy, index) {
                  if (index > 3) {
                    return null;
                  }
                  if (index === 3) {
                    return React__default["default"].createElement(
                      React__default["default"].Fragment,
                      null,
                      React__default["default"].createElement(
                        'em',
                        { style: { marginRight: '.5rem' } },
                        '...'
                      )
                    );
                  }
                  return React__default["default"].createElement(
                    React__default["default"].Fragment,
                    null,
                    React__default["default"].createElement(
                      'em',
                      null,
                      taxonomy.name
                    ),
                    ' |',
                    ' '
                  );
                }),
                ' ',
                React__default["default"].createElement(
                  'span',
                  { style: { display: 'inline-block' } },
                  timeDifferenceCalc(article.published)
                )
              ),
              showAuthor && article.authorMapping && article.authorMapping.length > 0 && React__default["default"].createElement(
                index$1.LazyLoad,
                { height: 50 },
                React__default["default"].createElement(AuthorComponent.AuthorComponent, { key: index.toString(), index: index, authors: article.authorMapping })
              ),
              !article.thumbnail && !defaultImage && article.source && React__default["default"].createElement(
                'div',
                { className: 'content-category-label' },
                React__default["default"].createElement(
                  'div',
                  { className: 'mb-1 sanityDisplayLabel displayLabelThumb' },
                  article.source
                )
              ),
              React__default["default"].createElement(
                'div',
                { style: { display: 'flex', alignItems: 'center', justifyContent: 'flex-start' } },
                showCategory && article.contentCategory && React__default["default"].createElement(
                  'p',
                  {
                    className: 'article-category',
                    style: {
                      background: '#3FB618',
                      color: '#ffffff',
                      marginBottom: '.25rem',
                      display: 'inline-block',
                      padding: '0 .25rem',
                      fontSize: '.8rem'
                    } },
                  getContentCategory.getContentCategory(article.contentCategory.name, contentCategoryMapping)
                ),
                article.issueSection && article.issueSection.name && React__default["default"].createElement(
                  'p',
                  {
                    className: 'issueSection',
                    style: {
                      background: '#000000',
                      color: '#ffffff',
                      marginBottom: '.25rem',
                      marginLeft: '.25rem',
                      display: 'inline-block',
                      padding: '0 .25rem',
                      fontSize: '.8rem'
                    } },
                  article.issueSection.name
                )
              ),
              showPubInfo && (article.issue || article.volume) && React__default["default"].createElement(
                'div',
                { className: 'pubInfo' },
                article.volume && React__default["default"].createElement(
                  'p',
                  { className: 'qdeVolume' },
                  article.volume
                ),
                article.issue && React__default["default"].createElement(
                  'p',
                  { className: 'qdeIssue' },
                  article.issue
                )
              ),
              showIntro && article.summary && React__default["default"].createElement(
                'p',
                { className: 'pt-2 card-text' },
                entities.clean_html_1(article.summary)
              )
            )
          );
        } else {
          return React__default["default"].createElement(
            reactBootstrap.Media,
            {
              key: article._id ? article._id : index,
              className: 'feature-media',
              style: { flexDirection: 'column', marginBottom: '1.25rem', paddingBottom: '1.25rem', borderBottom: '1px solid #ddd' } },
            (article.thumbnail && article.thumbnail.asset || defaultImage) && React__default["default"].createElement(
              'a',
              { href: article.url.current, className: 'feature-wrapper' },
              React__default["default"].createElement(
                index$1.LazyLoad,
                { height: imageHeight, placeholder: React__default["default"].createElement(ImagePlaceholder, null) },
                article.thumbnail && article.thumbnail.asset ? React__default["default"].createElement('img', { className: 'img-fluid', src: renderCardImage(article, client, imageHeight, imageWidth, imageMaxHeight, imageFit), alt: article.title }) : article.thumbnail ? React__default["default"].createElement('img', { src: article.thumbnail, className: 'mr-3', alt: article.title }) : React__default["default"].createElement('img', { src: defaultImage, src2: article.thumbnail, className: 'mr-3', width: '240', height: '135', alt: article.title })
              ),
              article.source && React__default["default"].createElement(
                'div',
                { className: 'content-category-label' },
                React__default["default"].createElement(
                  'div',
                  { className: 'mb-1 sanityDisplayLabel displayLabelThumb' },
                  article.source
                )
              )
            ),
            React__default["default"].createElement(
              reactBootstrap.Media.Body,
              null,
              React__default["default"].createElement(
                'a',
                { href: article.url.current },
                article.title && React__default["default"].createElement(
                  'h4',
                  { className: 'card-title', style: { fontWeight: '500', color: 'var(--gray-dark)', marginBottom: '.5rem' } },
                  article.title
                )
              ),
              showPublished && !showTimeDiff && article.published && React__default["default"].createElement(
                'p',
                { className: 'card-text', style: { color: 'var(--dark)', margin: '.25rem 0' } },
                moment.moment(article.published).format('MMMM DD, YYYY')
              ),
              showTimeDiff && article.published && React__default["default"].createElement(
                'p',
                { className: 'card-text', style: { color: '#464644', lineHeight: '1.25', fontSize: '.875rem', margin: '.25rem 0' } },
                showTaxonomies && article.taxonomyMapping && article.taxonomyMapping.map(function (taxonomy, index) {
                  if (index > 3) {
                    return null;
                  }
                  if (index === 3) {
                    return React__default["default"].createElement(
                      React__default["default"].Fragment,
                      null,
                      React__default["default"].createElement(
                        'em',
                        { style: { marginRight: '.5rem' } },
                        '...'
                      )
                    );
                  }
                  if (index === 3) {
                    return React__default["default"].createElement(
                      React__default["default"].Fragment,
                      null,
                      React__default["default"].createElement(
                        'em',
                        { style: { marginRight: '.5rem' } },
                        '...'
                      )
                    );
                  }
                  return React__default["default"].createElement(
                    React__default["default"].Fragment,
                    null,
                    React__default["default"].createElement(
                      'em',
                      null,
                      taxonomy.name
                    ),
                    ' |',
                    ' '
                  );
                }),
                ' ',
                React__default["default"].createElement(
                  'span',
                  { style: { display: 'inline-block' } },
                  timeDifferenceCalc(article.published)
                )
              ),
              showAuthor && article.authorMapping && article.authorMapping.length > 0 && React__default["default"].createElement(
                index$1.LazyLoad,
                { height: 50 },
                React__default["default"].createElement(AuthorComponent.AuthorComponent, { key: index.toString(), index: index, authors: article.authorMapping })
              ),
              !article.thumbnail && !defaultImage && article.source && React__default["default"].createElement(
                'div',
                { className: 'content-category-label' },
                React__default["default"].createElement(
                  'div',
                  { className: 'mb-1 sanityDisplayLabel displayLabelThumb' },
                  article.source
                )
              ),
              React__default["default"].createElement(
                'div',
                { style: { display: 'flex', alignItems: 'center', justifyContent: 'flex-start' } },
                showCategory && article.contentCategory && React__default["default"].createElement(
                  'p',
                  {
                    className: 'article-category',
                    style: {
                      background: '#3FB618',
                      color: '#ffffff',
                      marginBottom: '.25rem',
                      display: 'inline-block',
                      padding: '0 .25rem',
                      fontSize: '.8rem'
                    } },
                  getContentCategory.getContentCategory(article.contentCategory.name, contentCategoryMapping)
                ),
                article.issueSection && article.issueSection.name && React__default["default"].createElement(
                  'p',
                  {
                    className: 'issueSection',
                    style: {
                      background: '#000000',
                      color: '#ffffff',
                      marginBottom: '.25rem',
                      marginLeft: '.25rem',
                      display: 'inline-block',
                      padding: '0 .25rem',
                      fontSize: '.8rem'
                    } },
                  article.issueSection.name
                )
              ),
              showPubInfo && (article.issue || article.volume) && React__default["default"].createElement(
                'div',
                { className: 'pubInfo' },
                article.volume && React__default["default"].createElement(
                  'p',
                  { className: 'qdeVolume' },
                  article.volume
                ),
                article.issue && React__default["default"].createElement(
                  'p',
                  { className: 'qdeIssue' },
                  article.issue
                )
              ),
              showIntro && article.summary && React__default["default"].createElement(
                'p',
                { className: 'pt-2 card-text' },
                entities.clean_html_1(article.summary)
              )
            )
          );
        }
      } else if (article._type === 'lg-infeed' && article.adUnit) {
        return React__default["default"].createElement(ADlgInfeed.ADlgInfeed, _extends._extends({ index: index }, article));
      } else if (article._type === 'brandInsightAd' && article.adUnit) {
        return React__default["default"].createElement(ADInfeed.ADInfeed, { index: index, infeedAd: article });
      }
      if ((brandInsightAd ? index > heroContent + featureCount : index + 1 > heroContent + featureCount) && (!article._type || !['lg-infeed', 'brandInsightAd'].includes(article._type))) {
        return React__default["default"].createElement(
          React__default["default"].Fragment,
          { key: article._id ? article._id : index },
          React__default["default"].createElement(
            reactBootstrap.Media,
            {
              key: article._id ? article._id : index,
              style: { flexDirection: 'row', marginBottom: '1.25rem', paddingBottom: '1.25rem', borderBottom: '1px solid #ddd' } },
            (article.thumbnail && article.thumbnail.asset || defaultImage) && React__default["default"].createElement(
              'a',
              { href: mapping[contentCategoryName] + '/' + article.url.current, className: 'img-wrapper' },
              React__default["default"].createElement(
                index$1.LazyLoad,
                { height: imageHeight, placeholder: React__default["default"].createElement(ImagePlaceholder, null) },
                article.thumbnail && article.thumbnail.asset ? React__default["default"].createElement('img', { className: 'mr-3 img-fluid', src: renderCardImage(article, client, imageHeight, imageWidth, imageMaxHeight, imageFit), alt: article.title }) : article.thumbnail ? React__default["default"].createElement('img', { src: article.thumbnail, className: 'mr-3', alt: article.title }) : React__default["default"].createElement('img', { src: defaultImage, src2: article.thumbnail, className: 'mr-3', width: '240', height: '135', alt: article.title })
              ),
              article.source && React__default["default"].createElement(
                'div',
                { className: 'content-category-label' },
                React__default["default"].createElement(
                  'div',
                  { className: 'mb-1 sanityDisplayLabel displayLabelThumb' },
                  article.source
                )
              )
            ),
            React__default["default"].createElement(
              reactBootstrap.Media.Body,
              null,
              React__default["default"].createElement(
                'a',
                { href: mapping[contentCategoryName] + '/' + article.url.current },
                article.title && React__default["default"].createElement(
                  'h4',
                  { className: 'card-title', style: { fontWeight: '500', color: 'var(--gray-dark)', marginBottom: '.5rem' } },
                  article.title
                )
              ),
              showPublished && !showTimeDiff && article.published && React__default["default"].createElement(
                'p',
                { className: 'card-text', style: { color: 'var(--dark)', margin: '.25rem 0' } },
                moment.moment(article.published).format('MMMM DD, YYYY')
              ),
              showTimeDiff && article.published && React__default["default"].createElement(
                'p',
                { className: 'card-text', style: { color: '#464644', lineHeight: '1.25', fontSize: '.875rem', margin: '.25rem 0' } },
                showTaxonomies && article.taxonomyMapping && article.taxonomyMapping.map(function (taxonomy, index) {
                  if (index > 3) {
                    return null;
                  }
                  if (index === 3) {
                    return React__default["default"].createElement(
                      React__default["default"].Fragment,
                      null,
                      React__default["default"].createElement(
                        'em',
                        { style: { marginRight: '.5rem' } },
                        '...'
                      )
                    );
                  }
                  return React__default["default"].createElement(
                    React__default["default"].Fragment,
                    null,
                    React__default["default"].createElement(
                      'em',
                      null,
                      taxonomy.name
                    ),
                    ' |',
                    ' '
                  );
                }),
                ' ',
                React__default["default"].createElement(
                  'span',
                  { style: { display: 'inline-block' } },
                  timeDifferenceCalc(article.published)
                )
              ),
              React__default["default"].createElement(
                'div',
                { className: 'author-sec', style: { lineHeight: 1.5 } },
                showAuthor && article.authorMapping && article.authorMapping.length > 0 && React__default["default"].createElement(
                  index$1.LazyLoad,
                  { height: 50 },
                  React__default["default"].createElement(AuthorComponent.AuthorComponent, { key: index.toString(), index: index, authors: article.authorMapping })
                )
              ),
              !article.thumbnail && !defaultImage && article.source && React__default["default"].createElement(
                'div',
                { className: 'content-category-label' },
                React__default["default"].createElement(
                  'div',
                  { className: 'mb-1 sanityDisplayLabel displayLabelThumb' },
                  article.source
                )
              ),
              React__default["default"].createElement(
                'div',
                { style: { display: 'flex', alignItems: 'center', justifyContent: 'flex-start' } },
                showCategory && article.contentCategory && React__default["default"].createElement(
                  'p',
                  {
                    className: 'article-category',
                    style: {
                      background: '#3FB618',
                      color: '#ffffff',
                      marginBottom: '.25rem',
                      display: 'inline-block',
                      padding: '0 .25rem',
                      fontSize: '.8rem'
                    } },
                  getContentCategory.getContentCategory(article.contentCategory.name, contentCategoryMapping)
                ),
                article.issueSection && article.issueSection.name && React__default["default"].createElement(
                  'p',
                  {
                    className: 'issueSection',
                    style: {
                      background: '#000000',
                      color: '#ffffff',
                      marginBottom: '.25rem',
                      marginLeft: '.25rem',
                      display: 'inline-block',
                      padding: '0 .25rem',
                      fontSize: '.8rem'
                    } },
                  article.issueSection.name
                )
              ),
              showPubInfo && (article.issue || article.volume) && React__default["default"].createElement(
                'div',
                { className: 'pubInfo' },
                article.volume && React__default["default"].createElement(
                  'p',
                  { className: 'qdeVolume' },
                  article.volume
                ),
                article.issue && React__default["default"].createElement(
                  'p',
                  { className: 'qdeIssue' },
                  article.issue
                )
              ),
              showIntro && article.summary && React__default["default"].createElement(
                'p',
                { className: 'pt-2 card-text' },
                entities.clean_html_1(article.summary)
              )
            )
          ),
          React__default["default"].createElement(
            'div',
            null,
            main.main_43 && rightItems && (index + 1) % numberOfItemsBeforeAd === 0 && renderMobileAd(index, numberOfItemsBeforeAd, rightItems)
          )
        );
      } else return null;
    }) :
    // For Javascript Disabled Cases
    React__default["default"].createElement(
      'noscript',
      null,
      data.map(function (article, index) {
        var contentCategoryName = article.contentCategory ? article.contentCategory.name : 'Articles';

        if (article._type === 'feature') {
          featureCount++;
          if (article.blank || checkExternalUrl(article.url.current)) {
            return React__default["default"].createElement(
              reactBootstrap.Media,
              {
                key: article._id ? article._id : index,
                className: 'feature-media',
                style: { flexDirection: 'column', marginBottom: '1.25rem', paddingBottom: '1.25rem', borderBottom: '1px solid #ddd' } },
              (article.thumbnail && article.thumbnail.asset || defaultImage) && React__default["default"].createElement(
                'a',
                { rel: 'noopener', href: article.url.current, target: '_blank', className: 'feature-wrapper' },
                React__default["default"].createElement(
                  index$1.LazyLoad,
                  { height: imageHeight, placeholder: React__default["default"].createElement(ImagePlaceholder, null) },
                  article.thumbnail && article.thumbnail.asset ? React__default["default"].createElement('img', { className: 'img-fluid', src: renderCardImage(article, client, imageHeight, imageWidth, imageMaxHeight, imageFit), alt: article.title }) : article.thumbnail ? React__default["default"].createElement('img', { src: article.thumbnail, className: 'mr-3', alt: article.title }) : React__default["default"].createElement('img', { src: defaultImage, src2: article.thumbnail, className: 'mr-3', width: '240', height: '135', alt: article.title })
                ),
                article.source && React__default["default"].createElement(
                  'div',
                  { className: 'content-category-label' },
                  React__default["default"].createElement(
                    'div',
                    { className: 'mb-1 sanityDisplayLabel displayLabelThumb' },
                    article.source
                  )
                )
              ),
              React__default["default"].createElement(
                reactBootstrap.Media.Body,
                null,
                React__default["default"].createElement(
                  'a',
                  { rel: 'noopener', href: article.url.current, target: '_blank' },
                  article.title && React__default["default"].createElement(
                    'h4',
                    { className: 'card-title', style: { fontWeight: '500', color: 'var(--gray-dark)', marginBottom: '.5rem' } },
                    article.title
                  )
                ),
                showPublished && article.published && React__default["default"].createElement(
                  'p',
                  { className: 'card-text', style: { color: 'var(--dark)', marginBottom: '.25rem' } },
                  moment.moment(article.published).format('MMMM DD, YYYY')
                ),
                showTimeDiff && article.published && React__default["default"].createElement(
                  'p',
                  { className: 'card-text', style: { color: '#464644', lineHeight: '1.25', fontSize: '.875rem', margin: '.25rem 0' } },
                  showTaxonomies && article.taxonomyMapping && article.taxonomyMapping.map(function (taxonomy, index) {
                    if (index > 3) {
                      return null;
                    }
                    if (index === 3) {
                      return React__default["default"].createElement(
                        React__default["default"].Fragment,
                        null,
                        React__default["default"].createElement(
                          'em',
                          { style: { marginRight: '.5rem' } },
                          '...'
                        )
                      );
                    }
                    return React__default["default"].createElement(
                      React__default["default"].Fragment,
                      null,
                      React__default["default"].createElement(
                        'em',
                        null,
                        taxonomy.name
                      ),
                      ' |',
                      ' '
                    );
                  }),
                  ' ',
                  React__default["default"].createElement(
                    'span',
                    { style: { display: 'inline-block' } },
                    timeDifferenceCalc(article.published)
                  )
                ),
                showAuthor && article.authorMapping && article.authorMapping.length > 0 && React__default["default"].createElement(
                  index$1.LazyLoad,
                  { height: 50 },
                  React__default["default"].createElement(AuthorComponent.AuthorComponent, { key: index.toString(), index: index, authors: article.authorMapping })
                ),
                !article.thumbnail && !defaultImage && article.source && React__default["default"].createElement(
                  'div',
                  { className: 'content-category-label' },
                  React__default["default"].createElement(
                    'div',
                    { className: 'mb-1 sanityDisplayLabel displayLabelThumb' },
                    article.source
                  )
                ),
                React__default["default"].createElement(
                  'div',
                  { style: { display: 'flex', alignItems: 'center', justifyContent: 'flex-start' } },
                  showCategory && article.contentCategory && React__default["default"].createElement(
                    'p',
                    {
                      className: 'article-category',
                      style: {
                        background: '#3FB618',
                        color: '#ffffff',
                        marginBottom: '.25rem',
                        display: 'inline-block',
                        padding: '0 .25rem',
                        fontSize: '.8rem'
                      } },
                    getContentCategory.getContentCategory(article.contentCategory.name, contentCategoryMapping)
                  ),
                  article.issueSection && article.issueSection.name && React__default["default"].createElement(
                    'p',
                    {
                      className: 'issueSection',
                      style: {
                        background: '#000000',
                        color: '#ffffff',
                        marginBottom: '.25rem',
                        marginLeft: '.25rem',
                        display: 'inline-block',
                        padding: '0 .25rem',
                        fontSize: '.8rem'
                      } },
                    article.issueSection.name
                  )
                ),
                showPubInfo && (article.issue || article.volume) && React__default["default"].createElement(
                  'div',
                  { className: 'pubInfo' },
                  article.volume && React__default["default"].createElement(
                    'p',
                    { className: 'qdeVolume' },
                    article.volume
                  ),
                  article.issue && React__default["default"].createElement(
                    'p',
                    { className: 'qdeIssue' },
                    article.issue
                  )
                ),
                showIntro && article.summary && React__default["default"].createElement(
                  'p',
                  { className: 'pt-2 card-text' },
                  entities.clean_html_1(article.summary)
                )
              )
            );
          } else {
            return React__default["default"].createElement(
              reactBootstrap.Media,
              {
                key: article._id ? article._id : index,
                className: 'feature-media',
                style: { flexDirection: 'column', marginBottom: '1.25rem', paddingBottom: '1.25rem', borderBottom: '1px solid #ddd' } },
              (article.thumbnail && article.thumbnail.asset || defaultImage) && React__default["default"].createElement(
                'a',
                { href: article.url.current, className: 'feature-wrapper' },
                React__default["default"].createElement(
                  index$1.LazyLoad,
                  { height: imageHeight, placeholder: React__default["default"].createElement(ImagePlaceholder, null) },
                  article.thumbnail && article.thumbnail.asset ? React__default["default"].createElement('img', { className: 'img-fluid', src: renderCardImage(article, client, imageHeight, imageWidth, imageMaxHeight, imageFit), alt: article.title }) : article.thumbnail ? React__default["default"].createElement('img', { src: article.thumbnail, className: 'mr-3', alt: article.title }) : React__default["default"].createElement('img', { src: defaultImage, src2: article.thumbnail, className: 'mr-3', width: '240', height: '135', alt: article.title })
                ),
                article.source && React__default["default"].createElement(
                  'div',
                  { className: 'content-category-label' },
                  React__default["default"].createElement(
                    'div',
                    { className: 'mb-1 sanityDisplayLabel displayLabelThumb' },
                    article.source
                  )
                )
              ),
              React__default["default"].createElement(
                reactBootstrap.Media.Body,
                null,
                React__default["default"].createElement(
                  'a',
                  { href: article.url.current },
                  article.title && React__default["default"].createElement(
                    'h4',
                    { className: 'card-title', style: { fontWeight: '500', color: 'var(--gray-dark)', marginBottom: '.5rem' } },
                    article.title
                  )
                ),
                showPublished && article.published && React__default["default"].createElement(
                  'p',
                  { className: 'card-text', style: { color: 'var(--dark)', marginBottom: '.25rem' } },
                  moment.moment(article.published).format('MMMM DD, YYYY')
                ),
                showTimeDiff && article.published && React__default["default"].createElement(
                  'p',
                  { className: 'card-text', style: { color: '#464644', lineHeight: '1.25', fontSize: '.875rem', margin: '.25rem 0' } },
                  showTaxonomies && article.taxonomyMapping && article.taxonomyMapping.map(function (taxonomy, index) {
                    if (index > 3) {
                      return null;
                    }
                    if (index === 3) {
                      return React__default["default"].createElement(
                        React__default["default"].Fragment,
                        null,
                        React__default["default"].createElement(
                          'em',
                          { style: { marginRight: '.5rem' } },
                          '...'
                        )
                      );
                    }
                    return React__default["default"].createElement(
                      React__default["default"].Fragment,
                      null,
                      React__default["default"].createElement(
                        'em',
                        null,
                        taxonomy.name
                      ),
                      ' |',
                      ' '
                    );
                  }),
                  ' ',
                  React__default["default"].createElement(
                    'span',
                    { style: { display: 'inline-block' } },
                    timeDifferenceCalc(article.published)
                  )
                ),
                showAuthor && article.authorMapping && article.authorMapping.length > 0 && React__default["default"].createElement(
                  index$1.LazyLoad,
                  { height: 50 },
                  React__default["default"].createElement(AuthorComponent.AuthorComponent, { key: index.toString(), index: index, authors: article.authorMapping })
                ),
                !article.thumbnail && !defaultImage && article.source && React__default["default"].createElement(
                  'div',
                  { className: 'content-category-label' },
                  React__default["default"].createElement(
                    'div',
                    { className: 'mb-1 sanityDisplayLabel displayLabelThumb' },
                    article.source
                  )
                ),
                React__default["default"].createElement(
                  'div',
                  { style: { display: 'flex', alignItems: 'center', justifyContent: 'flex-start' } },
                  showCategory && article.contentCategory && React__default["default"].createElement(
                    'p',
                    {
                      className: 'article-category',
                      style: {
                        background: '#3FB618',
                        color: '#ffffff',
                        marginBottom: '.25rem',
                        display: 'inline-block',
                        padding: '0 .25rem',
                        fontSize: '.8rem'
                      } },
                    getContentCategory.getContentCategory(article.contentCategory.name, contentCategoryMapping)
                  ),
                  article.issueSection && article.issueSection.name && React__default["default"].createElement(
                    'p',
                    {
                      className: 'issueSection',
                      style: {
                        background: '#000000',
                        color: '#ffffff',
                        marginBottom: '.25rem',
                        marginLeft: '.25rem',
                        display: 'inline-block',
                        padding: '0 .25rem',
                        fontSize: '.8rem'
                      } },
                    article.issueSection.name
                  )
                ),
                showPubInfo && (article.issue || article.volume) && React__default["default"].createElement(
                  'div',
                  { className: 'pubInfo' },
                  article.volume && React__default["default"].createElement(
                    'p',
                    { className: 'qdeVolume' },
                    article.volume
                  ),
                  article.issue && React__default["default"].createElement(
                    'p',
                    { className: 'qdeIssue' },
                    article.issue
                  )
                ),
                showIntro && article.summary && React__default["default"].createElement(
                  'p',
                  { className: 'pt-2 card-text' },
                  entities.clean_html_1(article.summary)
                )
              )
            );
          }
        } else if (article._type === 'lg-infeed' && article.adUnit) {
          return React__default["default"].createElement(ADlgInfeed.ADlgInfeed, _extends._extends({ index: index }, article));
        } else if (article._type === 'brandInsightAd' && article.adUnit) {
          return React__default["default"].createElement(ADInfeed.ADInfeed, { index: index, infeedAd: article });
        }
        if ((brandInsightAd ? index > heroContent + featureCount : index + 1 > heroContent + featureCount) && (!article._type || !['lg-infeed', 'brandInsightAd'].includes(article._type))) {
          return React__default["default"].createElement(
            React__default["default"].Fragment,
            { key: article._id ? article._id : index },
            React__default["default"].createElement(
              reactBootstrap.Media,
              {
                key: article._id ? article._id : index,
                style: { flexDirection: 'row', marginBottom: '1.25rem', paddingBottom: '1.25rem', borderBottom: '1px solid #ddd' } },
              (article.thumbnail && article.thumbnail.asset || defaultImage) && React__default["default"].createElement(
                'a',
                { href: mapping[contentCategoryName] + '/' + article.url.current, className: 'img-wrapper' },
                React__default["default"].createElement(
                  index$1.LazyLoad,
                  { height: imageHeight, placeholder: React__default["default"].createElement(ImagePlaceholder, null) },
                  article.thumbnail && article.thumbnail.asset ? React__default["default"].createElement('img', { className: 'mr-3 img-fluid', src: renderCardImage(article, client, imageHeight, imageWidth, imageMaxHeight, imageFit), alt: article.title }) : article.thumbnail ? React__default["default"].createElement('img', { src: article.thumbnail, className: 'mr-3', alt: article.title }) : React__default["default"].createElement('img', { src: defaultImage, src2: article.thumbnail, className: 'mr-3', width: '240', height: '135', alt: article.title })
                ),
                article.source && React__default["default"].createElement(
                  'div',
                  { className: 'content-category-label' },
                  React__default["default"].createElement(
                    'div',
                    { className: 'mb-1 sanityDisplayLabel displayLabelThumb' },
                    article.source
                  )
                )
              ),
              React__default["default"].createElement(
                reactBootstrap.Media.Body,
                null,
                React__default["default"].createElement(
                  'a',
                  { href: mapping[contentCategoryName] + '/' + article.url.current },
                  article.title && React__default["default"].createElement(
                    'h4',
                    { className: 'card-title', style: { fontWeight: '500', color: 'var(--gray-dark)', marginBottom: '.5rem' } },
                    article.title
                  )
                ),
                showPublished && article.published && React__default["default"].createElement(
                  'p',
                  { className: 'card-text', style: { color: 'var(--dark)', marginBottom: '.25rem' } },
                  moment.moment(article.published).format('MMMM DD, YYYY')
                ),
                showTimeDiff && article.published && React__default["default"].createElement(
                  'p',
                  { className: 'card-text', style: { color: '#464644', lineHeight: '1.25', fontSize: '.875rem', margin: '.25rem 0' } },
                  showTaxonomies && article.taxonomyMapping && article.taxonomyMapping.map(function (taxonomy, index) {
                    if (index > 3) {
                      return null;
                    }
                    if (index === 3) {
                      return React__default["default"].createElement(
                        React__default["default"].Fragment,
                        null,
                        React__default["default"].createElement(
                          'em',
                          { style: { marginRight: '.5rem' } },
                          '...'
                        )
                      );
                    }
                    return React__default["default"].createElement(
                      React__default["default"].Fragment,
                      null,
                      React__default["default"].createElement(
                        'em',
                        null,
                        taxonomy.name
                      ),
                      ' |',
                      ' '
                    );
                  }),
                  ' ',
                  React__default["default"].createElement(
                    'span',
                    { style: { display: 'inline-block' } },
                    timeDifferenceCalc(article.published)
                  )
                ),
                React__default["default"].createElement(
                  'div',
                  { className: 'author-sec', style: { lineHeight: 1.5 } },
                  showAuthor && article.authorMapping && article.authorMapping.length > 0 && React__default["default"].createElement(
                    index$1.LazyLoad,
                    { height: 50 },
                    React__default["default"].createElement(AuthorComponent.AuthorComponent, { key: index.toString(), index: index, authors: article.authorMapping })
                  )
                ),
                !article.thumbnail && !defaultImage && article.source && React__default["default"].createElement(
                  'div',
                  { className: 'content-category-label' },
                  React__default["default"].createElement(
                    'div',
                    { className: 'mb-1 sanityDisplayLabel displayLabelThumb' },
                    article.source
                  )
                ),
                React__default["default"].createElement(
                  'div',
                  { style: { display: 'flex', alignItems: 'center', justifyContent: 'flex-start' } },
                  showCategory && article.contentCategory && React__default["default"].createElement(
                    'p',
                    {
                      className: 'article-category',
                      style: {
                        background: '#3FB618',
                        color: '#ffffff',
                        marginBottom: '.25rem',
                        display: 'inline-block',
                        padding: '0 .25rem',
                        fontSize: '.8rem'
                      } },
                    getContentCategory.getContentCategory(article.contentCategory.name, contentCategoryMapping)
                  ),
                  article.issueSection && article.issueSection.name && React__default["default"].createElement(
                    'p',
                    {
                      className: 'issueSection',
                      style: {
                        background: '#000000',
                        color: '#ffffff',
                        marginBottom: '.25rem',
                        marginLeft: '.25rem',
                        display: 'inline-block',
                        padding: '0 .25rem',
                        fontSize: '.8rem'
                      } },
                    article.issueSection.name
                  )
                ),
                showPubInfo && (article.issue || article.volume) && React__default["default"].createElement(
                  'div',
                  { className: 'pubInfo' },
                  article.volume && React__default["default"].createElement(
                    'p',
                    { className: 'qdeVolume' },
                    article.volume
                  ),
                  article.issue && React__default["default"].createElement(
                    'p',
                    { className: 'qdeIssue' },
                    article.issue
                  )
                ),
                showIntro && article.summary && React__default["default"].createElement(
                  'p',
                  { className: 'pt-2 card-text' },
                  entities.clean_html_1(article.summary)
                )
              )
            ),
            React__default["default"].createElement(
              'div',
              null,
              main.main_43 && rightItems && (index + 1) % numberOfItemsBeforeAd === 0 && renderMobileAd(index, numberOfItemsBeforeAd, rightItems)
            )
          );
        } else return null;
      })
    ) : React__default["default"].createElement(
      'div',
      null,
      React__default["default"].createElement(
        'h5',
        null,
        React__default["default"].createElement(
          'em',
          null,
          'New content coming soon, please check back later.'
        )
      )
    ),
    React__default["default"].createElement(
      'style',
      { jsx: 'true' },
      '\n          .displayLabelThumb {\n            margin: 0 auto;\n            margin-top: -1.25rem;\n            background-color: white;\n            position: relative;\n          }\n          .content-category-label {\n            margin: 0.5rem 0;\n            display: block;\n          }\n          .sanityDisplayLabel {\n            margin: 0.5rem 0;\n            border: 1px solid black;\n            width: fit-content;\n            width: -moz-fit-content;\n            padding: 5px;\n            color: #484848;\n            border-radius: 2px;\n          }\n          .feature-media > .media-body {\n            -webkit-box-flex: none;\n            -ms-flex: none;\n            flex: none;\n          }\n          .img-wrapper img {\n            max-height: 240px;\n            height: auto;\n            width: 100%;\n            object-fit: contain;\n          }\n          .feature-wrapper {\n            height: 100%;\n            width: 100%;\n          }\n          .feature-wrapper img {\n            width: 100%;\n            margin-bottom: 1em;\n          }\n          @media only screen and (min-width: 768px) {\n            .img-wrapper > img {\n              padding-right: 1em;\n            }\n          }\n          @media only screen and (max-width: 767px) {\n            .sanityDisplayLabel {\n              max-width: 100%;\n            }\n            .img-wrapper {\n              width: 100%;\n            }\n            .img-wrapper img {\n              padding-bottom: 1em;\n            }\n            .media {\n              flex-direction: column !important;\n            }\n          }\n        '
    )
  );
};

var ImagePlaceholder = function ImagePlaceholder() {
  return React__default["default"].createElement(
    React__default["default"].Fragment,
    null,
    React__default["default"].createElement('div', { className: 'queuedeck-exp-image-placeholder' }),
    React__default["default"].createElement(
      'style',
      { jsx: 'true' },
      '\n      .queuedeck-exp-image-placeholder {\n        width: 240px;\n        height: 0;\n        padding-top: calc(240px * 9 / 16);\n        margin: 0 1rem 0 0;\n      }\n      @media only screen and (max-width: 767px) {\n        .queuedeck-exp-image-placeholder {\n          width: 100%;\n          height: 0;\n          padding-top: calc(100% * 9 / 16);\n          margin: 0 0 1rem 0;\n        }\n      }\n    '
    )
  );
};

var renderMobileAd = function renderMobileAd(index, numberOfItemsBeforeAd, rightItems) {
  var i = numberOfItemsBeforeAd < 6 ? 0 : ((index + 1) / numberOfItemsBeforeAd - 1) % rightItems.length;
  return React__default["default"].createElement(
    'div',
    { style: { display: 'flex', flex: '1 0 auto' } },
    rightItems[i].component
  );
};

var usePrevious = function usePrevious(value) {
  var ref = React.useRef();
  React.useEffect(function () {
    ref.current = value;
  });
  return ref.current;
};

var QueueDeckExpanded = function QueueDeckExpanded(props) {
  var router = Router.useRouter();
  var initialData = props.dataRecord,
      initialCurrentPage = props.currentPage,
      client = props.client,
      params = props.params,
      query = props.query,
      pointer = props.pointer,
      pointerArray = props.pointerArray,
      mapping = props.mapping,
      seoPaginate = props.seoPaginate,
      pageview = props.pageview,
      defaultImage = props.defaultImage,
      showAuthor = props.showAuthor,
      showCategory = props.showCategory,
      imageHeight = props.imageHeight,
      imageWidth = props.imageWidth,
      imageMaxHeight = props.imageMaxHeight,
      imageFit = props.imageFit,
      rightItems = props.rightItems,
      brandInsightAd = props.brandInsightAd,
      _props$showBI = props.showBI,
      showBI = _props$showBI === undefined ? false : _props$showBI,
      _props$heroContent = props.heroContent,
      heroContent = _props$heroContent === undefined ? 0 : _props$heroContent,
      _props$lgInfeedAd = props.lgInfeedAd,
      lgInfeedAd = _props$lgInfeedAd === undefined ? false : _props$lgInfeedAd,
      _props$showPubInfo = props.showPubInfo,
      showPubInfo = _props$showPubInfo === undefined ? false : _props$showPubInfo,
      _props$showTimeDiff = props.showTimeDiff,
      showTimeDiff = _props$showTimeDiff === undefined ? false : _props$showTimeDiff,
      _props$showTaxonomies = props.showTaxonomies,
      showTaxonomies = _props$showTaxonomies === undefined ? false : _props$showTaxonomies,
      _props$showIntro = props.showIntro,
      showIntro = _props$showIntro === undefined ? true : _props$showIntro,
      _props$contentCategor = props.contentCategoryMapping,
      contentCategoryMapping = _props$contentCategor === undefined ? [] : _props$contentCategor,
      showPublished = props.showPublished,
      totalDataCount = props.totalDataCount;

  var _useState3 = React.useState(initialData),
      _useState4 = slicedToArray._slicedToArray(_useState3, 2),
      data = _useState4[0],
      setData = _useState4[1];

  var _useState5 = React.useState(false),
      _useState6 = slicedToArray._slicedToArray(_useState5, 2),
      isDataLoading = _useState6[0],
      setIsDataLoading = _useState6[1];

  var _useState7 = React.useState(initialCurrentPage || 1),
      _useState8 = slicedToArray._slicedToArray(_useState7, 2),
      currentPage = _useState8[0],
      setCurrentPage = _useState8[1];

  var itemsPerPage = params && params.itemsPerPage ? params.itemsPerPage : params && params.from && params.to ? params.to - params.from : 10;

  // Logging GA Pageview on path change
  var prevPath = usePrevious(lodash.lodash.get(router, 'asPath', undefined));
  React.useEffect(function () {
    var currentPath = router.asPath;
    if (prevPath && prevPath !== currentPath && pageview) {
      pageview(router.asPath);
    }
  }, [router]);

  var seoPagination = function seoPagination(pageNumber) {
    var path = router.asPath;
    var qrIndex = path.indexOf('?');
    var pathname = router.pathname;
    var queryString = '';
    if (qrIndex > 0) {
      path = path.substring(1, qrIndex);
      var partialQS = router.asPath.substring(qrIndex + 1);
      var partialQSArr = partialQS.split('&');
      // exclude page=xxx from query string
      partialQSArr.map(function (item) {
        var itemArr = item.split('=');
        var key = itemArr[0];
        var val = itemArr[1];
        if (key !== 'page') queryString += (queryString.length === 0 ? '' : '&') + key + '=' + val;
      });
    }
    if (queryString.length > 0) path += '?' + queryString;
    pageNumber = parseInt(pageNumber);
    if (currentPage !== pageNumber) {
      if (path[0] !== '/') path = '/' + path;
      var newPath = pageNumber === 1 ? '' + path : '' + path + (queryString.length > 0 ? '&' : '?') + 'page=' + pageNumber;
      router.push(pathname, newPath, {
        shallow: true
      });
    }
  };

  var handlePageChange = function () {
    var _ref2 = asyncToGenerator._asyncToGenerator( /*#__PURE__*/asyncToGenerator.regenerator.mark(function _callee(selectedPage) {
      var start, newParams, newData;
      return asyncToGenerator.regenerator.wrap(function _callee$(_context) {
        while (1) {
          switch (_context.prev = _context.next) {
            case 0:
              console.log('selectedPage', selectedPage);
              setIsDataLoading(true);
              setCurrentPage(selectedPage);
              seoPaginate && seoPagination(selectedPage);
              index.lib_3.refresh();
              document.body.scrollTop = 0;
              document.documentElement.scrollTop = 0;
              start = (selectedPage - 1) * itemsPerPage;
              newParams = _extends._extends({}, params, {
                from: start,
                to: start + itemsPerPage
              });
              _context.prev = 9;
              _context.next = 12;
              return client.fetch(query, newParams);

            case 12:
              newData = _context.sent;

              if (pointer && pointerArray) newData = newData[pointerArray][pointer];
              if (newData && newData.length > 0) {
                setIsDataLoading(false);
                setData(newData);
              }
              _context.next = 20;
              break;

            case 17:
              _context.prev = 17;
              _context.t0 = _context['catch'](9);

              console.error(_context.t0);

            case 20:
            case 'end':
              return _context.stop();
          }
        }
      }, _callee, _this, [[9, 17]]);
    }));

    return function handlePageChange(_x5) {
      return _ref2.apply(this, arguments);
    };
  }();

  return React__default["default"].createElement(
    'div',
    { className: 'queuedeck-expanded' },
    isDataLoading ? React__default["default"].createElement(
      'div',
      { className: 'd-flex justify-content-center', style: { marginTop: '100px' } },
      React__default["default"].createElement(
        reactBootstrap.Spinner,
        { animation: 'border', role: 'status' },
        React__default["default"].createElement(
          'span',
          { className: 'sr-only' },
          'Loading...'
        )
      )
    ) : React__default["default"].createElement(
      reactBootstrap.Container,
      null,
      React__default["default"].createElement(CardLoader, {
        data: data,
        client: client,
        mapping: mapping,
        showPublished: showPublished,
        defaultImage: defaultImage,
        showAuthor: showAuthor,
        showCategory: showCategory,
        imageHeight: imageHeight,
        imageWidth: imageWidth,
        imageMaxHeight: imageMaxHeight,
        imageFit: imageFit,
        rightItems: rightItems,
        brandInsightAd: brandInsightAd,
        showBI: showBI,
        heroContent: heroContent,
        lgInfeedAd: lgInfeedAd,
        showPubInfo: showPubInfo,
        contentCategoryMapping: contentCategoryMapping,
        showTimeDif: showTimeDiff,
        showTaxonomies: showTaxonomies,
        showIntro: showIntro
      }),
      React__default["default"].createElement(
        'div',
        { className: 'pagination-wrapper' },
        React__default["default"].createElement(Pagination.Pagination, {
          pageCount: Math.ceil(totalDataCount / itemsPerPage),
          pageRangeDisplayed: main.main_43 ? 3 : 9,
          currentPage: currentPage,
          onPageChange: handlePageChange,
          needLargePaginateButtons: props.needLargePaginateButtons
        }),
        React__default["default"].createElement(
          'style',
          { jsx: 'true' },
          '\n              .pagination-wrapper {\n                margin: 3rem 0 100px 0;\n              }\n            '
        )
      )
    )
  );
};

module.exports = QueueDeckExpanded;
