@mjhls/mjh-framework 1.0.51 → 1.0.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -503,1523 +503,879 @@ var getYoutubeId = createCommonjsModule(function (module, exports) {
503
503
  }));
504
504
  });
505
505
 
506
- var classCallCheck = function (instance, Constructor) {
507
- if (!(instance instanceof Constructor)) {
508
- throw new TypeError("Cannot call a class as a function");
509
- }
510
- };
511
-
512
- var createClass = function () {
513
- function defineProperties(target, props) {
514
- for (var i = 0; i < props.length; i++) {
515
- var descriptor = props[i];
516
- descriptor.enumerable = descriptor.enumerable || false;
517
- descriptor.configurable = true;
518
- if ("value" in descriptor) descriptor.writable = true;
519
- Object.defineProperty(target, descriptor.key, descriptor);
506
+ var parseAssetId_1 = createCommonjsModule(function (module, exports) {
507
+ Object.defineProperty(exports, "__esModule", { value: true });
508
+ var example = 'image-Tb9Ew8CXIwaY6R1kjMvI0uRR-2000x3000-jpg';
509
+ function parseAssetId(ref) {
510
+ var _a = ref.split('-'), id = _a[1], dimensionString = _a[2], format = _a[3];
511
+ if (!id || !dimensionString || !format) {
512
+ throw new Error("Malformed asset _ref '" + ref + "'. Expected an id like \"" + example + "\".");
520
513
  }
521
- }
514
+ var _b = dimensionString.split('x'), imgWidthStr = _b[0], imgHeightStr = _b[1];
515
+ var width = +imgWidthStr;
516
+ var height = +imgHeightStr;
517
+ var isValidAssetId = isFinite(width) && isFinite(height);
518
+ if (!isValidAssetId) {
519
+ throw new Error("Malformed asset _ref '" + ref + "'. Expected an id like \"" + example + "\".");
520
+ }
521
+ return { id: id, width: width, height: height, format: format };
522
+ }
523
+ exports.default = parseAssetId;
522
524
 
523
- return function (Constructor, protoProps, staticProps) {
524
- if (protoProps) defineProperties(Constructor.prototype, protoProps);
525
- if (staticProps) defineProperties(Constructor, staticProps);
526
- return Constructor;
527
- };
528
- }();
525
+ });
529
526
 
530
- var inherits = function (subClass, superClass) {
531
- if (typeof superClass !== "function" && superClass !== null) {
532
- throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
533
- }
527
+ unwrapExports(parseAssetId_1);
534
528
 
535
- subClass.prototype = Object.create(superClass && superClass.prototype, {
536
- constructor: {
537
- value: subClass,
538
- enumerable: false,
539
- writable: true,
540
- configurable: true
541
- }
542
- });
543
- if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
529
+ var parseSource_1 = createCommonjsModule(function (module, exports) {
530
+ var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
531
+ __assign = Object.assign || function(t) {
532
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
533
+ s = arguments[i];
534
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
535
+ t[p] = s[p];
536
+ }
537
+ return t;
538
+ };
539
+ return __assign.apply(this, arguments);
544
540
  };
545
-
546
- var possibleConstructorReturn = function (self, call) {
547
- if (!self) {
548
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
549
- }
550
-
551
- return call && (typeof call === "object" || typeof call === "function") ? call : self;
541
+ Object.defineProperty(exports, "__esModule", { value: true });
542
+ var isRef = function (src) {
543
+ var source = src;
544
+ return source ? typeof source._ref === 'string' : false;
552
545
  };
553
-
554
- var slicedToArray = function () {
555
- function sliceIterator(arr, i) {
556
- var _arr = [];
557
- var _n = true;
558
- var _d = false;
559
- var _e = undefined;
560
-
561
- try {
562
- for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
563
- _arr.push(_s.value);
564
-
565
- if (i && _arr.length === i) break;
566
- }
567
- } catch (err) {
568
- _d = true;
569
- _e = err;
570
- } finally {
571
- try {
572
- if (!_n && _i["return"]) _i["return"]();
573
- } finally {
574
- if (_d) throw _e;
575
- }
546
+ var isAsset = function (src) {
547
+ var source = src;
548
+ return source ? typeof source._id === 'string' : false;
549
+ };
550
+ var isAssetStub = function (src) {
551
+ var source = src;
552
+ return source && source.asset ? typeof source.asset.url === 'string' : false;
553
+ };
554
+ // Convert an asset-id, asset or image to an image record suitable for processing
555
+ // eslint-disable-next-line complexity
556
+ function parseSource(source) {
557
+ if (!source) {
558
+ return null;
576
559
  }
577
-
578
- return _arr;
579
- }
580
-
581
- return function (arr, i) {
582
- if (Array.isArray(arr)) {
583
- return arr;
584
- } else if (Symbol.iterator in Object(arr)) {
585
- return sliceIterator(arr, i);
586
- } else {
587
- throw new TypeError("Invalid attempt to destructure non-iterable instance");
560
+ var image;
561
+ if (typeof source === 'string' && isUrl(source)) {
562
+ // Someone passed an existing image url?
563
+ image = {
564
+ asset: { _ref: urlToId(source) }
565
+ };
588
566
  }
589
- };
590
- }();
591
-
592
- var toConsumableArray = function (arr) {
593
- if (Array.isArray(arr)) {
594
- for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
595
-
596
- return arr2;
597
- } else {
598
- return Array.from(arr);
599
- }
600
- };
601
-
602
- var DeckContent = function (_React$Component) {
603
- inherits(DeckContent, _React$Component);
604
-
605
- function DeckContent() {
606
- var _ref;
607
-
608
- var _temp, _this, _ret;
609
-
610
- classCallCheck(this, DeckContent);
611
-
612
- for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
613
- args[_key] = arguments[_key];
567
+ else if (typeof source === 'string') {
568
+ // Just an asset id
569
+ image = {
570
+ asset: { _ref: source }
571
+ };
614
572
  }
615
-
616
- return _ret = (_temp = (_this = possibleConstructorReturn(this, (_ref = DeckContent.__proto__ || Object.getPrototypeOf(DeckContent)).call.apply(_ref, [this].concat(args))), _this), _this.mapping = _this.props.mapping, _this.data = _this.props.dataRecord, _this.query = _this.props.query, _this.params = _this.props.params, _this.pointer = _this.props.pointer ? _this.props.pointer : false, _this.pointerArray = _this.props.pointerArray ? _this.props.pointerArray : false, _this.defaultImage = _this.props.defaultImage ? _this.props.defaultImage : '/placeholder.jpg', _this.state = {
617
- data: _this.data,
618
- dataKeptToCompareNewDatarecord: _this.data,
619
- per: _this.params ? _this.params.to : 2,
620
- page: 1,
621
- from: _this.params ? _this.params.from : 0,
622
- to: _this.params ? _this.params.to : 2,
623
- total_pages: null,
624
- scrolling: true,
625
- query: _this.query
626
- }, _this.loadMore = function () {
627
- setTimeout(function () {
628
- _this.setState(function (state) {
629
- return {
630
- page: state.page + 1,
631
- from: state.from + state.per,
632
- to: state.to + state.per
633
- };
634
- }, _this.loadData);
635
- }, 10);
636
- }, _this.loadData = function () {
637
- var _this$state = _this.state,
638
- from = _this$state.from,
639
- to = _this$state.to,
640
- data = _this$state.data,
641
- query = _this$state.query;
642
- var client = _this.props.client;
643
-
644
-
645
- var params = { from: from, to: to };
646
- var queryUpdated = query.replace('$from', params.from).replace('$to', params.to);
647
- // const query = '*[_type == "article" && defined(title) && defined(thumbnail)][$from...$to] { title, summary, thumbnail { asset-> }, url }'
648
-
649
- if (_this.pointer && _this.pointerArray) {
650
- var pointer = _this.pointer;
651
- client.fetch(queryUpdated).then(function (dataArr) {
652
- _this.setState(function (state, props) {
653
- if (dataArr[_this.pointerArray][pointer].length > 0) {
654
- return {
655
- data: [].concat(toConsumableArray(data), toConsumableArray(dataArr[_this.pointerArray][pointer])),
656
- scrolling: true
657
- };
658
- } else {
659
- return {
660
- scrolling: false
661
- };
573
+ else if (isRef(source)) {
574
+ // We just got passed an asset directly
575
+ image = {
576
+ asset: source
577
+ };
578
+ }
579
+ else if (isAsset(source)) {
580
+ // If we were passed an image asset document
581
+ image = {
582
+ asset: {
583
+ _ref: source._id || ''
662
584
  }
663
- });
664
- });
665
- } else {
666
- client.fetch(queryUpdated).then(function (dataArr) {
667
- _this.setState(function (state, props) {
668
- if (dataArr.length > 0) {
669
- return {
670
- data: [].concat(toConsumableArray(data), toConsumableArray(dataArr)),
671
- scrolling: true
672
- };
673
- } else {
674
- return {
675
- scrolling: false
676
- };
585
+ };
586
+ }
587
+ else if (isAssetStub(source)) {
588
+ // If we were passed a partial asset (`url`, but no `_id`)
589
+ image = {
590
+ asset: {
591
+ _ref: urlToId(source.asset.url)
677
592
  }
678
- });
679
- });
680
- }
681
- }, _this.renderCardImage = function (row, page) {
682
- if (row.thumbnail && row.thumbnail.asset) {
683
- return row.thumbnail.asset.url;
684
- /*} else if (page === 'videos' && row.youtubeURL) {
685
- return `https://img.youtube.com/vi/${getYouTubeId(row.youtubeURL)}/0.jpg`*/
686
- } else {
687
- return _this.defaultImage;
688
- }
689
- }, _this.cardLoader = function (page, columns, variant) {
690
- var mode = variant && variant === 'bottom' ? 'column-reverse' : 'column';
691
-
692
- var itemCounter = 0;
693
- var lgVar = 12;
694
- return React__default.createElement(
695
- Row,
696
- null,
697
- _this.state.data && _this.state.data.map(function (row, index) {
698
- if (columns === 'rotate' && itemCounter % 3 === 0) {
699
- lgVar = 12;
700
- } else if (columns && columns !== 'rotate') {
701
- lgVar = Math.floor(12 / columns);
702
- } else {
703
- lgVar = 6;
704
- }
705
-
706
- return React__default.createElement(
707
- Col,
708
- { key: itemCounter, md: 12, lg: lgVar, counter: itemCounter++, style: { display: 'flex', flex: '1 0 auto' } },
709
- React__default.createElement(
710
- Card,
711
- { className: 'content-card', style: { flexDirection: mode } },
712
- React__default.createElement(
713
- Link,
714
- { href: _this.mapping[row.contentCategory.name] + '/[url]', as: _this.mapping[row.contentCategory.name] + '/' + row.url.current },
715
- React__default.createElement(
716
- 'a',
717
- null,
718
- React__default.createElement(Card.Img, { variant: 'top', src: _this.renderCardImage(row, page), alt: row.thumbnail && row.thumbnail.asset ? row.thumbnail.asset.originalFilename : '' })
719
- )
720
- ),
721
- React__default.createElement(
722
- Card.Body,
723
- null,
724
- React__default.createElement(
725
- Link,
726
- { href: _this.mapping[row.contentCategory.name] + '/[url]', as: _this.mapping[row.contentCategory.name] + '/' + row.url.current },
727
- React__default.createElement(
728
- 'a',
729
- null,
730
- React__default.createElement(
731
- Card.Title,
732
- null,
733
- row.title
734
- ),
735
- React__default.createElement(
736
- Card.Text,
737
- null,
738
- row.summary
739
- )
740
- )
741
- )
742
- )
743
- )
744
- );
745
- })
746
- );
747
- }, _temp), possibleConstructorReturn(_this, _ret);
748
- }
749
-
750
- createClass(DeckContent, [{
751
- key: 'componentDidUpdate',
752
- value: function componentDidUpdate(prevProps, prevState) {
753
- if (this.state.dataKeptToCompareNewDatarecord !== this.props.dataRecord) {
754
- // eslint-disable-next-line react/no-did-update-set-state
755
- this.setState({
756
- data: this.props.dataRecord,
757
- dataKeptToCompareNewDatarecord: this.props.dataRecord,
758
- per: this.props.params ? this.props.params.to : 2,
759
- page: 1,
760
- from: this.props.params ? this.props.params.from : 0,
761
- to: this.props.params ? this.props.params.to : 2,
762
- total_pages: null,
763
- scrolling: true,
764
- query: this.props.query
765
- });
766
- }
593
+ };
767
594
  }
768
- }, {
769
- key: 'componentDidMount',
770
- value: function componentDidMount() {
771
- // this.loadData();
595
+ else if (typeof source.asset === 'object') {
596
+ // Probably an actual image with materialized asset
597
+ image = source;
772
598
  }
773
- }, {
774
- key: 'render',
775
- value: function render() {
776
- var _this2 = this;
777
-
778
- var _props = this.props,
779
- columns = _props.columns,
780
- variant = _props.variant,
781
- autoScroll = _props.autoScroll,
782
- page = _props.page;
783
-
784
-
785
- return React__default.createElement(
786
- 'div',
787
- { className: 'contentDeck' },
788
- autoScroll ? React__default.createElement(
789
- React__default.Fragment,
790
- null,
791
- React__default.createElement(
792
- InfiniteScroll,
793
- { dataLength: this.state.data.length, next: this.loadMore, hasMore: this.state.scrolling },
794
- this.cardLoader(page, columns, variant)
795
- ),
796
- React__default.createElement(
797
- 'noscript',
798
- null,
799
- 'Manual Pagination Here'
800
- )
801
- ) : React__default.createElement(
802
- React__default.Fragment,
803
- null,
804
- this.cardLoader(page, columns, variant),
805
- React__default.createElement(
806
- 'div',
807
- { style: { padding: '0px 10px' } },
808
- this.state.scrolling ? React__default.createElement(
809
- 'button',
810
- {
811
- style: { margin: 'auto', width: '100%' },
812
- onClick: function onClick(e) {
813
- _this2.loadMore();
814
- } },
815
- 'Load More'
816
- ) : React__default.createElement(
817
- 'p',
818
- { style: { textAlign: 'center' } },
819
- React__default.createElement(
820
- 'b',
821
- null,
822
- 'End of data'
823
- )
824
- )
825
- ),
826
- React__default.createElement(
827
- 'noscript',
828
- null,
829
- 'Manual Pagination Here'
830
- )
831
- )
832
- );
599
+ else {
600
+ // We got something that does not look like an image, or it is an image
601
+ // that currently isn't sporting an asset.
602
+ return null;
833
603
  }
834
- }]);
835
- return DeckContent;
836
- }(React__default.Component);
837
-
838
- /**
839
- * Checks if `value` is classified as an `Array` object.
840
- *
841
- * @static
842
- * @memberOf _
843
- * @since 0.1.0
844
- * @category Lang
845
- * @param {*} value The value to check.
846
- * @returns {boolean} Returns `true` if `value` is an array, else `false`.
847
- * @example
848
- *
849
- * _.isArray([1, 2, 3]);
850
- * // => true
851
- *
852
- * _.isArray(document.body.children);
853
- * // => false
854
- *
855
- * _.isArray('abc');
856
- * // => false
857
- *
858
- * _.isArray(_.noop);
859
- * // => false
860
- */
861
- var isArray = Array.isArray;
862
-
863
- var isArray_1 = isArray;
864
-
865
- /** Detect free variable `global` from Node.js. */
866
- var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
867
-
868
- var _freeGlobal = freeGlobal;
869
-
870
- /** Detect free variable `self`. */
871
- var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
872
-
873
- /** Used as a reference to the global object. */
874
- var root = _freeGlobal || freeSelf || Function('return this')();
875
-
876
- var _root = root;
877
-
878
- /** Built-in value references. */
879
- var Symbol$1 = _root.Symbol;
880
-
881
- var _Symbol = Symbol$1;
882
-
883
- /** Used for built-in method references. */
884
- var objectProto = Object.prototype;
885
-
886
- /** Used to check objects for own properties. */
887
- var hasOwnProperty = objectProto.hasOwnProperty;
888
-
889
- /**
890
- * Used to resolve the
891
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
892
- * of values.
893
- */
894
- var nativeObjectToString = objectProto.toString;
895
-
896
- /** Built-in value references. */
897
- var symToStringTag = _Symbol ? _Symbol.toStringTag : undefined;
898
-
899
- /**
900
- * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
901
- *
902
- * @private
903
- * @param {*} value The value to query.
904
- * @returns {string} Returns the raw `toStringTag`.
905
- */
906
- function getRawTag(value) {
907
- var isOwn = hasOwnProperty.call(value, symToStringTag),
908
- tag = value[symToStringTag];
909
-
910
- try {
911
- value[symToStringTag] = undefined;
912
- } catch (e) {}
913
-
914
- var result = nativeObjectToString.call(value);
915
- {
916
- if (isOwn) {
917
- value[symToStringTag] = tag;
918
- } else {
919
- delete value[symToStringTag];
604
+ var img = source;
605
+ if (img.crop) {
606
+ image.crop = img.crop;
920
607
  }
921
- }
922
- return result;
923
- }
924
-
925
- var _getRawTag = getRawTag;
926
-
927
- /** Used for built-in method references. */
928
- var objectProto$1 = Object.prototype;
929
-
930
- /**
931
- * Used to resolve the
932
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
933
- * of values.
934
- */
935
- var nativeObjectToString$1 = objectProto$1.toString;
936
-
937
- /**
938
- * Converts `value` to a string using `Object.prototype.toString`.
939
- *
940
- * @private
941
- * @param {*} value The value to convert.
942
- * @returns {string} Returns the converted string.
943
- */
944
- function objectToString(value) {
945
- return nativeObjectToString$1.call(value);
608
+ if (img.hotspot) {
609
+ image.hotspot = img.hotspot;
610
+ }
611
+ return applyDefaults(image);
946
612
  }
947
-
948
- var _objectToString = objectToString;
949
-
950
- /** `Object#toString` result references. */
951
- var nullTag = '[object Null]',
952
- undefinedTag = '[object Undefined]';
953
-
954
- /** Built-in value references. */
955
- var symToStringTag$1 = _Symbol ? _Symbol.toStringTag : undefined;
956
-
957
- /**
958
- * The base implementation of `getTag` without fallbacks for buggy environments.
959
- *
960
- * @private
961
- * @param {*} value The value to query.
962
- * @returns {string} Returns the `toStringTag`.
963
- */
964
- function baseGetTag(value) {
965
- if (value == null) {
966
- return value === undefined ? undefinedTag : nullTag;
967
- }
968
- return (symToStringTag$1 && symToStringTag$1 in Object(value))
969
- ? _getRawTag(value)
970
- : _objectToString(value);
613
+ exports.default = parseSource;
614
+ function isUrl(url) {
615
+ return /^https?:\/\//.test("" + url);
971
616
  }
972
-
973
- var _baseGetTag = baseGetTag;
974
-
975
- /**
976
- * Checks if `value` is object-like. A value is object-like if it's not `null`
977
- * and has a `typeof` result of "object".
978
- *
979
- * @static
980
- * @memberOf _
981
- * @since 4.0.0
982
- * @category Lang
983
- * @param {*} value The value to check.
984
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
985
- * @example
986
- *
987
- * _.isObjectLike({});
988
- * // => true
989
- *
990
- * _.isObjectLike([1, 2, 3]);
991
- * // => true
992
- *
993
- * _.isObjectLike(_.noop);
994
- * // => false
995
- *
996
- * _.isObjectLike(null);
997
- * // => false
998
- */
999
- function isObjectLike(value) {
1000
- return value != null && typeof value == 'object';
617
+ function urlToId(url) {
618
+ var parts = url.split('/').slice(-1);
619
+ return ("image-" + parts[0]).replace(/\.([a-z]+)$/, '-$1');
1001
620
  }
1002
-
1003
- var isObjectLike_1 = isObjectLike;
1004
-
1005
- /** `Object#toString` result references. */
1006
- var symbolTag = '[object Symbol]';
1007
-
1008
- /**
1009
- * Checks if `value` is classified as a `Symbol` primitive or object.
1010
- *
1011
- * @static
1012
- * @memberOf _
1013
- * @since 4.0.0
1014
- * @category Lang
1015
- * @param {*} value The value to check.
1016
- * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
1017
- * @example
1018
- *
1019
- * _.isSymbol(Symbol.iterator);
1020
- * // => true
1021
- *
1022
- * _.isSymbol('abc');
1023
- * // => false
1024
- */
1025
- function isSymbol(value) {
1026
- return typeof value == 'symbol' ||
1027
- (isObjectLike_1(value) && _baseGetTag(value) == symbolTag);
621
+ // Mock crop and hotspot if image lacks it
622
+ function applyDefaults(image) {
623
+ if (image.crop && image.hotspot) {
624
+ return image;
625
+ }
626
+ // We need to pad in default values for crop or hotspot
627
+ var result = __assign({}, image);
628
+ if (!result.crop) {
629
+ result.crop = {
630
+ left: 0,
631
+ top: 0,
632
+ bottom: 0,
633
+ right: 0
634
+ };
635
+ }
636
+ if (!result.hotspot) {
637
+ result.hotspot = {
638
+ x: 0.5,
639
+ y: 0.5,
640
+ height: 1.0,
641
+ width: 1.0
642
+ };
643
+ }
644
+ return result;
1028
645
  }
1029
646
 
1030
- var isSymbol_1 = isSymbol;
647
+ });
1031
648
 
1032
- /** Used to match property names within property paths. */
1033
- var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
1034
- reIsPlainProp = /^\w*$/;
649
+ unwrapExports(parseSource_1);
1035
650
 
1036
- /**
1037
- * Checks if `value` is a property name and not a property path.
1038
- *
1039
- * @private
1040
- * @param {*} value The value to check.
1041
- * @param {Object} [object] The object to query keys on.
1042
- * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
1043
- */
1044
- function isKey(value, object) {
1045
- if (isArray_1(value)) {
1046
- return false;
1047
- }
1048
- var type = typeof value;
1049
- if (type == 'number' || type == 'symbol' || type == 'boolean' ||
1050
- value == null || isSymbol_1(value)) {
1051
- return true;
1052
- }
1053
- return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
1054
- (object != null && value in Object(object));
651
+ var urlForImage_1 = createCommonjsModule(function (module, exports) {
652
+ var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
653
+ __assign = Object.assign || function(t) {
654
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
655
+ s = arguments[i];
656
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
657
+ t[p] = s[p];
658
+ }
659
+ return t;
660
+ };
661
+ return __assign.apply(this, arguments);
662
+ };
663
+ var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
664
+ return (mod && mod.__esModule) ? mod : { "default": mod };
665
+ };
666
+ Object.defineProperty(exports, "__esModule", { value: true });
667
+ var parseAssetId_1$$1 = __importDefault(parseAssetId_1);
668
+ var parseSource_1$$1 = __importDefault(parseSource_1);
669
+ exports.parseSource = parseSource_1$$1.default;
670
+ exports.SPEC_NAME_TO_URL_NAME_MAPPINGS = [
671
+ ['width', 'w'],
672
+ ['height', 'h'],
673
+ ['format', 'fm'],
674
+ ['download', 'dl'],
675
+ ['blur', 'blur'],
676
+ ['sharpen', 'sharp'],
677
+ ['invert', 'invert'],
678
+ ['orientation', 'or'],
679
+ ['minHeight', 'min-h'],
680
+ ['maxHeight', 'max-h'],
681
+ ['minWidth', 'min-w'],
682
+ ['maxWidth', 'max-w'],
683
+ ['quality', 'q'],
684
+ ['fit', 'fit'],
685
+ ['crop', 'crop'],
686
+ ['auto', 'auto'],
687
+ ['dpr', 'dpr']
688
+ ];
689
+ function urlForImage(options) {
690
+ var spec = __assign({}, (options || {}));
691
+ var source = spec.source;
692
+ delete spec.source;
693
+ var image = parseSource_1$$1.default(source);
694
+ if (!image) {
695
+ return null;
696
+ }
697
+ var id = image.asset._ref || image.asset._id || '';
698
+ var asset = parseAssetId_1$$1.default(id);
699
+ // Compute crop rect in terms of pixel coordinates in the raw source image
700
+ var cropLeft = Math.round(image.crop.left * asset.width);
701
+ var cropTop = Math.round(image.crop.top * asset.height);
702
+ var crop = {
703
+ left: cropLeft,
704
+ top: cropTop,
705
+ width: Math.round(asset.width - image.crop.right * asset.width - cropLeft),
706
+ height: Math.round(asset.height - image.crop.bottom * asset.height - cropTop)
707
+ };
708
+ // Compute hot spot rect in terms of pixel coordinates
709
+ var hotSpotVerticalRadius = (image.hotspot.height * asset.height) / 2;
710
+ var hotSpotHorizontalRadius = (image.hotspot.width * asset.width) / 2;
711
+ var hotSpotCenterX = image.hotspot.x * asset.width;
712
+ var hotSpotCenterY = image.hotspot.y * asset.height;
713
+ var hotspot = {
714
+ left: hotSpotCenterX - hotSpotHorizontalRadius,
715
+ top: hotSpotCenterY - hotSpotVerticalRadius,
716
+ right: hotSpotCenterX + hotSpotHorizontalRadius,
717
+ bottom: hotSpotCenterY + hotSpotVerticalRadius
718
+ };
719
+ // If irrelevant, or if we are requested to: don't perform crop/fit based on
720
+ // the crop/hotspot.
721
+ if (!(spec.rect || spec.focalPoint || spec.ignoreImageParams || spec.crop)) {
722
+ spec = __assign({}, spec, fit({ crop: crop, hotspot: hotspot }, spec));
723
+ }
724
+ return specToImageUrl(__assign({}, spec, { asset: asset }));
1055
725
  }
1056
-
1057
- var _isKey = isKey;
1058
-
1059
- /**
1060
- * Checks if `value` is the
1061
- * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
1062
- * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
1063
- *
1064
- * @static
1065
- * @memberOf _
1066
- * @since 0.1.0
1067
- * @category Lang
1068
- * @param {*} value The value to check.
1069
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
1070
- * @example
1071
- *
1072
- * _.isObject({});
1073
- * // => true
1074
- *
1075
- * _.isObject([1, 2, 3]);
1076
- * // => true
1077
- *
1078
- * _.isObject(_.noop);
1079
- * // => true
1080
- *
1081
- * _.isObject(null);
1082
- * // => false
1083
- */
1084
- function isObject(value) {
1085
- var type = typeof value;
1086
- return value != null && (type == 'object' || type == 'function');
726
+ exports.default = urlForImage;
727
+ // eslint-disable-next-line complexity
728
+ function specToImageUrl(spec) {
729
+ var cdnUrl = spec.baseUrl || 'https://cdn.sanity.io';
730
+ var filename = spec.asset.id + "-" + spec.asset.width + "x" + spec.asset.height + "." + spec.asset.format;
731
+ var baseUrl = cdnUrl + "/images/" + spec.projectId + "/" + spec.dataset + "/" + filename;
732
+ var params = [];
733
+ if (spec.rect) {
734
+ // Only bother url with a crop if it actually crops anything
735
+ var _a = spec.rect, left = _a.left, top_1 = _a.top, width = _a.width, height = _a.height;
736
+ var isEffectiveCrop = left !== 0 || top_1 !== 0 || height !== spec.asset.height || width !== spec.asset.width;
737
+ if (isEffectiveCrop) {
738
+ params.push("rect=" + left + "," + top_1 + "," + width + "," + height);
739
+ }
740
+ }
741
+ if (spec.bg) {
742
+ params.push("bg=" + spec.bg);
743
+ }
744
+ if (spec.focalPoint) {
745
+ params.push("fp-x=" + spec.focalPoint.x);
746
+ params.push("fp-x=" + spec.focalPoint.y);
747
+ }
748
+ var flip = [spec.flipHorizontal && 'h', spec.flipVertical && 'v'].filter(Boolean).join('');
749
+ if (flip) {
750
+ params.push("flip=" + flip);
751
+ }
752
+ // Map from spec name to url param name, and allow using the actual param name as an alternative
753
+ exports.SPEC_NAME_TO_URL_NAME_MAPPINGS.forEach(function (mapping) {
754
+ var specName = mapping[0], param = mapping[1];
755
+ if (typeof spec[specName] !== 'undefined') {
756
+ params.push(param + "=" + encodeURIComponent(spec[specName]));
757
+ }
758
+ else if (typeof spec[param] !== 'undefined') {
759
+ params.push(param + "=" + encodeURIComponent(spec[param]));
760
+ }
761
+ });
762
+ if (params.length === 0) {
763
+ return baseUrl;
764
+ }
765
+ return baseUrl + "?" + params.join('&');
1087
766
  }
1088
-
1089
- var isObject_1 = isObject;
1090
-
1091
- /** `Object#toString` result references. */
1092
- var asyncTag = '[object AsyncFunction]',
1093
- funcTag = '[object Function]',
1094
- genTag = '[object GeneratorFunction]',
1095
- proxyTag = '[object Proxy]';
1096
-
1097
- /**
1098
- * Checks if `value` is classified as a `Function` object.
1099
- *
1100
- * @static
1101
- * @memberOf _
1102
- * @since 0.1.0
1103
- * @category Lang
1104
- * @param {*} value The value to check.
1105
- * @returns {boolean} Returns `true` if `value` is a function, else `false`.
1106
- * @example
1107
- *
1108
- * _.isFunction(_);
1109
- * // => true
1110
- *
1111
- * _.isFunction(/abc/);
1112
- * // => false
1113
- */
1114
- function isFunction(value) {
1115
- if (!isObject_1(value)) {
1116
- return false;
1117
- }
1118
- // The use of `Object#toString` avoids issues with the `typeof` operator
1119
- // in Safari 9 which returns 'object' for typed arrays and other constructors.
1120
- var tag = _baseGetTag(value);
1121
- return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
767
+ function fit(source, spec) {
768
+ var cropRect;
769
+ var imgWidth = spec.width;
770
+ var imgHeight = spec.height;
771
+ // If we are not constraining the aspect ratio, we'll just use the whole crop
772
+ if (!(imgWidth && imgHeight)) {
773
+ return { width: imgWidth, height: imgHeight, rect: source.crop };
774
+ }
775
+ var crop = source.crop;
776
+ var hotspot = source.hotspot;
777
+ // If we are here, that means aspect ratio is locked and fitting will be a bit harder
778
+ var desiredAspectRatio = imgWidth / imgHeight;
779
+ var cropAspectRatio = crop.width / crop.height;
780
+ if (cropAspectRatio > desiredAspectRatio) {
781
+ // The crop is wider than the desired aspect ratio. That means we are cutting from the sides
782
+ var height = crop.height;
783
+ var width = height * desiredAspectRatio;
784
+ var top_2 = crop.top;
785
+ // Center output horizontally over hotspot
786
+ var hotspotXCenter = (hotspot.right - hotspot.left) / 2 + hotspot.left;
787
+ var left = hotspotXCenter - width / 2;
788
+ // Keep output within crop
789
+ if (left < crop.left) {
790
+ left = crop.left;
791
+ }
792
+ else if (left + width > crop.left + crop.width) {
793
+ left = crop.left + crop.width - width;
794
+ }
795
+ cropRect = {
796
+ left: Math.round(left),
797
+ top: Math.round(top_2),
798
+ width: Math.round(width),
799
+ height: Math.round(height)
800
+ };
801
+ }
802
+ else {
803
+ // The crop is taller than the desired ratio, we are cutting from top and bottom
804
+ var width = crop.width;
805
+ var height = width / desiredAspectRatio;
806
+ var left = crop.left;
807
+ // Center output vertically over hotspot
808
+ var hotspotYCenter = (hotspot.bottom - hotspot.top) / 2 + hotspot.top;
809
+ var top_3 = hotspotYCenter - height / 2;
810
+ // Keep output rect within crop
811
+ if (top_3 < crop.top) {
812
+ top_3 = crop.top;
813
+ }
814
+ else if (top_3 + height > crop.top + crop.height) {
815
+ top_3 = crop.top + crop.height - height;
816
+ }
817
+ cropRect = {
818
+ left: Math.max(0, Math.floor(left)),
819
+ top: Math.max(0, Math.floor(top_3)),
820
+ width: Math.round(width),
821
+ height: Math.round(height)
822
+ };
823
+ }
824
+ return {
825
+ width: imgWidth,
826
+ height: imgHeight,
827
+ rect: cropRect
828
+ };
1122
829
  }
1123
830
 
1124
- var isFunction_1 = isFunction;
1125
-
1126
- /** Used to detect overreaching core-js shims. */
1127
- var coreJsData = _root['__core-js_shared__'];
1128
-
1129
- var _coreJsData = coreJsData;
831
+ });
1130
832
 
1131
- /** Used to detect methods masquerading as native. */
1132
- var maskSrcKey = (function() {
1133
- var uid = /[^.]+$/.exec(_coreJsData && _coreJsData.keys && _coreJsData.keys.IE_PROTO || '');
1134
- return uid ? ('Symbol(src)_1.' + uid) : '';
1135
- }());
833
+ unwrapExports(urlForImage_1);
834
+ var urlForImage_2 = urlForImage_1.parseSource;
835
+ var urlForImage_3 = urlForImage_1.SPEC_NAME_TO_URL_NAME_MAPPINGS;
1136
836
 
1137
- /**
1138
- * Checks if `func` has its source masked.
1139
- *
1140
- * @private
1141
- * @param {Function} func The function to check.
1142
- * @returns {boolean} Returns `true` if `func` is masked, else `false`.
1143
- */
1144
- function isMasked(func) {
1145
- return !!maskSrcKey && (maskSrcKey in func);
837
+ var builder = createCommonjsModule(function (module, exports) {
838
+ var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
839
+ __assign = Object.assign || function(t) {
840
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
841
+ s = arguments[i];
842
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
843
+ t[p] = s[p];
844
+ }
845
+ return t;
846
+ };
847
+ return __assign.apply(this, arguments);
848
+ };
849
+ var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
850
+ if (mod && mod.__esModule) return mod;
851
+ var result = {};
852
+ if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
853
+ result["default"] = mod;
854
+ return result;
855
+ };
856
+ Object.defineProperty(exports, "__esModule", { value: true });
857
+ var urlForImage_1$$1 = __importStar(urlForImage_1);
858
+ var validFits = ['clip', 'crop', 'fill', 'fillmax', 'max', 'scale', 'min'];
859
+ var validCrops = ['top', 'bottom', 'left', 'right', 'center', 'focalpoint', 'entropy'];
860
+ var validAutoModes = ['format'];
861
+ function isSanityClient(client) {
862
+ return client ? typeof client.clientConfig === 'object' : false;
1146
863
  }
1147
-
1148
- var _isMasked = isMasked;
1149
-
1150
- /** Used for built-in method references. */
1151
- var funcProto = Function.prototype;
1152
-
1153
- /** Used to resolve the decompiled source of functions. */
1154
- var funcToString = funcProto.toString;
1155
-
1156
- /**
1157
- * Converts `func` to its source code.
1158
- *
1159
- * @private
1160
- * @param {Function} func The function to convert.
1161
- * @returns {string} Returns the source code.
1162
- */
1163
- function toSource(func) {
1164
- if (func != null) {
1165
- try {
1166
- return funcToString.call(func);
1167
- } catch (e) {}
1168
- try {
1169
- return (func + '');
1170
- } catch (e) {}
1171
- }
1172
- return '';
864
+ function rewriteSpecName(key) {
865
+ var specs = urlForImage_1$$1.SPEC_NAME_TO_URL_NAME_MAPPINGS;
866
+ for (var _i = 0, specs_1 = specs; _i < specs_1.length; _i++) {
867
+ var entry = specs_1[_i];
868
+ var specName = entry[0], param = entry[1];
869
+ if (key === specName || key === param) {
870
+ return specName;
871
+ }
872
+ }
873
+ return key;
1173
874
  }
875
+ function urlBuilder(options) {
876
+ // Did we get a SanityClient?
877
+ var client = options;
878
+ if (isSanityClient(client)) {
879
+ // Inherit config from client
880
+ var _a = client.clientConfig, apiHost = _a.apiHost, projectId = _a.projectId, dataset = _a.dataset;
881
+ return new ImageUrlBuilder(null, {
882
+ baseUrl: apiHost.replace(/^https:\/\/api\./, 'https://cdn.'),
883
+ projectId: projectId,
884
+ dataset: dataset
885
+ });
886
+ }
887
+ // Or just accept the options as given
888
+ return new ImageUrlBuilder(null, options);
889
+ }
890
+ exports.default = urlBuilder;
891
+ var ImageUrlBuilder = /** @class */ (function () {
892
+ function ImageUrlBuilder(parent, options) {
893
+ this.options = parent
894
+ ? __assign({}, (parent.options || {}), (options || {})) : __assign({}, (options || {})); // Copy options
895
+ }
896
+ ImageUrlBuilder.prototype.withOptions = function (options) {
897
+ var baseUrl = options.baseUrl || '';
898
+ var newOptions = { baseUrl: baseUrl };
899
+ for (var key in options) {
900
+ if (options.hasOwnProperty(key)) {
901
+ var specKey = rewriteSpecName(key);
902
+ newOptions[specKey] = options[key];
903
+ }
904
+ }
905
+ return new ImageUrlBuilder(this, __assign({ baseUrl: baseUrl }, newOptions));
906
+ };
907
+ // The image to be represented. Accepts a Sanity 'image'-document, 'asset'-document or
908
+ // _id of asset. To get the benefit of automatic hot-spot/crop integration with the content
909
+ // studio, the 'image'-document must be provided.
910
+ ImageUrlBuilder.prototype.image = function (source) {
911
+ return this.withOptions({ source: source });
912
+ };
913
+ // Specify the dataset
914
+ ImageUrlBuilder.prototype.dataset = function (dataset) {
915
+ return this.withOptions({ dataset: dataset });
916
+ };
917
+ // Specify the projectId
918
+ ImageUrlBuilder.prototype.projectId = function (projectId) {
919
+ return this.withOptions({ projectId: projectId });
920
+ };
921
+ // Specify background color
922
+ ImageUrlBuilder.prototype.bg = function (bg) {
923
+ return this.withOptions({ bg: bg });
924
+ };
925
+ // Set DPR scaling factor
926
+ ImageUrlBuilder.prototype.dpr = function (dpr) {
927
+ return this.withOptions({ dpr: dpr });
928
+ };
929
+ // Specify the width of the image in pixels
930
+ ImageUrlBuilder.prototype.width = function (width) {
931
+ return this.withOptions({ width: width });
932
+ };
933
+ // Specify the height of the image in pixels
934
+ ImageUrlBuilder.prototype.height = function (height) {
935
+ return this.withOptions({ height: height });
936
+ };
937
+ // Specify focal point in fraction of image dimensions. Each component 0.0-1.0
938
+ ImageUrlBuilder.prototype.focalPoint = function (x, y) {
939
+ return this.withOptions({ focalPoint: { x: x, y: y } });
940
+ };
941
+ ImageUrlBuilder.prototype.maxWidth = function (maxWidth) {
942
+ return this.withOptions({ maxWidth: maxWidth });
943
+ };
944
+ ImageUrlBuilder.prototype.minWidth = function (minWidth) {
945
+ return this.withOptions({ minWidth: minWidth });
946
+ };
947
+ ImageUrlBuilder.prototype.maxHeight = function (maxHeight) {
948
+ return this.withOptions({ maxHeight: maxHeight });
949
+ };
950
+ ImageUrlBuilder.prototype.minHeight = function (minHeight) {
951
+ return this.withOptions({ minHeight: minHeight });
952
+ };
953
+ // Specify width and height in pixels
954
+ ImageUrlBuilder.prototype.size = function (width, height) {
955
+ return this.withOptions({ width: width, height: height });
956
+ };
957
+ // Specify blur between 0 and 100
958
+ ImageUrlBuilder.prototype.blur = function (blur) {
959
+ return this.withOptions({ blur: blur });
960
+ };
961
+ ImageUrlBuilder.prototype.sharpen = function (sharpen) {
962
+ return this.withOptions({ sharpen: sharpen });
963
+ };
964
+ // Specify the desired rectangle of the image
965
+ ImageUrlBuilder.prototype.rect = function (left, top, width, height) {
966
+ return this.withOptions({ rect: { left: left, top: top, width: width, height: height } });
967
+ };
968
+ // Specify the image format of the image. 'jpg', 'pjpg', 'png', 'webp'
969
+ ImageUrlBuilder.prototype.format = function (format) {
970
+ return this.withOptions({ format: format });
971
+ };
972
+ ImageUrlBuilder.prototype.invert = function (invert) {
973
+ return this.withOptions({ invert: invert });
974
+ };
975
+ // Rotation in degrees 0, 90, 180, 270
976
+ ImageUrlBuilder.prototype.orientation = function (orientation) {
977
+ return this.withOptions({ orientation: orientation });
978
+ };
979
+ // Compression quality 0-100
980
+ ImageUrlBuilder.prototype.quality = function (quality) {
981
+ return this.withOptions({ quality: quality });
982
+ };
983
+ // Make it a download link. Parameter is default filename.
984
+ ImageUrlBuilder.prototype.forceDownload = function (download) {
985
+ return this.withOptions({ download: download });
986
+ };
987
+ // Flip image horizontally
988
+ ImageUrlBuilder.prototype.flipHorizontal = function () {
989
+ return this.withOptions({ flipHorizontal: true });
990
+ };
991
+ // Flip image verically
992
+ ImageUrlBuilder.prototype.flipVertical = function () {
993
+ return this.withOptions({ flipVertical: true });
994
+ };
995
+ // Ignore crop/hotspot from image record, even when present
996
+ ImageUrlBuilder.prototype.ignoreImageParams = function () {
997
+ return this.withOptions({ ignoreImageParams: true });
998
+ };
999
+ ImageUrlBuilder.prototype.fit = function (value) {
1000
+ if (validFits.indexOf(value) === -1) {
1001
+ throw new Error("Invalid fit mode \"" + value + "\"");
1002
+ }
1003
+ return this.withOptions({ fit: value });
1004
+ };
1005
+ ImageUrlBuilder.prototype.crop = function (value) {
1006
+ if (validCrops.indexOf(value) === -1) {
1007
+ throw new Error("Invalid crop mode \"" + value + "\"");
1008
+ }
1009
+ return this.withOptions({ crop: value });
1010
+ };
1011
+ ImageUrlBuilder.prototype.auto = function (value) {
1012
+ if (validAutoModes.indexOf(value) === -1) {
1013
+ throw new Error("Invalid auto mode \"" + value + "\"");
1014
+ }
1015
+ return this.withOptions({ auto: value });
1016
+ };
1017
+ // Gets the url based on the submitted parameters
1018
+ ImageUrlBuilder.prototype.url = function () {
1019
+ return urlForImage_1$$1.default(this.options);
1020
+ };
1021
+ // Synonym for url()
1022
+ ImageUrlBuilder.prototype.toString = function () {
1023
+ return this.url();
1024
+ };
1025
+ return ImageUrlBuilder;
1026
+ }());
1174
1027
 
1175
- var _toSource = toSource;
1176
-
1177
- /**
1178
- * Used to match `RegExp`
1179
- * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
1180
- */
1181
- var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
1182
-
1183
- /** Used to detect host constructors (Safari). */
1184
- var reIsHostCtor = /^\[object .+?Constructor\]$/;
1028
+ });
1185
1029
 
1186
- /** Used for built-in method references. */
1187
- var funcProto$1 = Function.prototype,
1188
- objectProto$2 = Object.prototype;
1030
+ unwrapExports(builder);
1189
1031
 
1190
- /** Used to resolve the decompiled source of functions. */
1191
- var funcToString$1 = funcProto$1.toString;
1032
+ var node = createCommonjsModule(function (module) {
1033
+ var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
1034
+ return (mod && mod.__esModule) ? mod : { "default": mod };
1035
+ };
1036
+ var builder_1 = __importDefault(builder);
1037
+ module.exports = builder_1.default;
1192
1038
 
1193
- /** Used to check objects for own properties. */
1194
- var hasOwnProperty$1 = objectProto$2.hasOwnProperty;
1039
+ });
1195
1040
 
1196
- /** Used to detect if a method is native. */
1197
- var reIsNative = RegExp('^' +
1198
- funcToString$1.call(hasOwnProperty$1).replace(reRegExpChar, '\\$&')
1199
- .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
1200
- );
1041
+ var imageUrlBuilder = unwrapExports(node);
1201
1042
 
1202
- /**
1203
- * The base implementation of `_.isNative` without bad shim checks.
1204
- *
1205
- * @private
1206
- * @param {*} value The value to check.
1207
- * @returns {boolean} Returns `true` if `value` is a native function,
1208
- * else `false`.
1209
- */
1210
- function baseIsNative(value) {
1211
- if (!isObject_1(value) || _isMasked(value)) {
1212
- return false;
1043
+ var classCallCheck = function (instance, Constructor) {
1044
+ if (!(instance instanceof Constructor)) {
1045
+ throw new TypeError("Cannot call a class as a function");
1213
1046
  }
1214
- var pattern = isFunction_1(value) ? reIsNative : reIsHostCtor;
1215
- return pattern.test(_toSource(value));
1216
- }
1217
-
1218
- var _baseIsNative = baseIsNative;
1219
-
1220
- /**
1221
- * Gets the value at `key` of `object`.
1222
- *
1223
- * @private
1224
- * @param {Object} [object] The object to query.
1225
- * @param {string} key The key of the property to get.
1226
- * @returns {*} Returns the property value.
1227
- */
1228
- function getValue(object, key) {
1229
- return object == null ? undefined : object[key];
1230
- }
1231
-
1232
- var _getValue = getValue;
1233
-
1234
- /**
1235
- * Gets the native function at `key` of `object`.
1236
- *
1237
- * @private
1238
- * @param {Object} object The object to query.
1239
- * @param {string} key The key of the method to get.
1240
- * @returns {*} Returns the function if it's native, else `undefined`.
1241
- */
1242
- function getNative(object, key) {
1243
- var value = _getValue(object, key);
1244
- return _baseIsNative(value) ? value : undefined;
1245
- }
1246
-
1247
- var _getNative = getNative;
1047
+ };
1248
1048
 
1249
- /* Built-in method references that are verified to be native. */
1250
- var nativeCreate = _getNative(Object, 'create');
1049
+ var createClass = function () {
1050
+ function defineProperties(target, props) {
1051
+ for (var i = 0; i < props.length; i++) {
1052
+ var descriptor = props[i];
1053
+ descriptor.enumerable = descriptor.enumerable || false;
1054
+ descriptor.configurable = true;
1055
+ if ("value" in descriptor) descriptor.writable = true;
1056
+ Object.defineProperty(target, descriptor.key, descriptor);
1057
+ }
1058
+ }
1251
1059
 
1252
- var _nativeCreate = nativeCreate;
1060
+ return function (Constructor, protoProps, staticProps) {
1061
+ if (protoProps) defineProperties(Constructor.prototype, protoProps);
1062
+ if (staticProps) defineProperties(Constructor, staticProps);
1063
+ return Constructor;
1064
+ };
1065
+ }();
1253
1066
 
1254
- /**
1255
- * Removes all key-value entries from the hash.
1256
- *
1257
- * @private
1258
- * @name clear
1259
- * @memberOf Hash
1260
- */
1261
- function hashClear() {
1262
- this.__data__ = _nativeCreate ? _nativeCreate(null) : {};
1263
- this.size = 0;
1264
- }
1067
+ var inherits = function (subClass, superClass) {
1068
+ if (typeof superClass !== "function" && superClass !== null) {
1069
+ throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
1070
+ }
1265
1071
 
1266
- var _hashClear = hashClear;
1072
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
1073
+ constructor: {
1074
+ value: subClass,
1075
+ enumerable: false,
1076
+ writable: true,
1077
+ configurable: true
1078
+ }
1079
+ });
1080
+ if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
1081
+ };
1267
1082
 
1268
- /**
1269
- * Removes `key` and its value from the hash.
1270
- *
1271
- * @private
1272
- * @name delete
1273
- * @memberOf Hash
1274
- * @param {Object} hash The hash to modify.
1275
- * @param {string} key The key of the value to remove.
1276
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
1277
- */
1278
- function hashDelete(key) {
1279
- var result = this.has(key) && delete this.__data__[key];
1280
- this.size -= result ? 1 : 0;
1281
- return result;
1282
- }
1083
+ var possibleConstructorReturn = function (self, call) {
1084
+ if (!self) {
1085
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
1086
+ }
1283
1087
 
1284
- var _hashDelete = hashDelete;
1088
+ return call && (typeof call === "object" || typeof call === "function") ? call : self;
1089
+ };
1285
1090
 
1286
- /** Used to stand-in for `undefined` hash values. */
1287
- var HASH_UNDEFINED = '__lodash_hash_undefined__';
1091
+ var slicedToArray = function () {
1092
+ function sliceIterator(arr, i) {
1093
+ var _arr = [];
1094
+ var _n = true;
1095
+ var _d = false;
1096
+ var _e = undefined;
1288
1097
 
1289
- /** Used for built-in method references. */
1290
- var objectProto$3 = Object.prototype;
1098
+ try {
1099
+ for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
1100
+ _arr.push(_s.value);
1291
1101
 
1292
- /** Used to check objects for own properties. */
1293
- var hasOwnProperty$2 = objectProto$3.hasOwnProperty;
1102
+ if (i && _arr.length === i) break;
1103
+ }
1104
+ } catch (err) {
1105
+ _d = true;
1106
+ _e = err;
1107
+ } finally {
1108
+ try {
1109
+ if (!_n && _i["return"]) _i["return"]();
1110
+ } finally {
1111
+ if (_d) throw _e;
1112
+ }
1113
+ }
1294
1114
 
1295
- /**
1296
- * Gets the hash value for `key`.
1297
- *
1298
- * @private
1299
- * @name get
1300
- * @memberOf Hash
1301
- * @param {string} key The key of the value to get.
1302
- * @returns {*} Returns the entry value.
1303
- */
1304
- function hashGet(key) {
1305
- var data = this.__data__;
1306
- if (_nativeCreate) {
1307
- var result = data[key];
1308
- return result === HASH_UNDEFINED ? undefined : result;
1115
+ return _arr;
1309
1116
  }
1310
- return hasOwnProperty$2.call(data, key) ? data[key] : undefined;
1311
- }
1312
-
1313
- var _hashGet = hashGet;
1314
-
1315
- /** Used for built-in method references. */
1316
- var objectProto$4 = Object.prototype;
1317
1117
 
1318
- /** Used to check objects for own properties. */
1319
- var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
1320
-
1321
- /**
1322
- * Checks if a hash value for `key` exists.
1323
- *
1324
- * @private
1325
- * @name has
1326
- * @memberOf Hash
1327
- * @param {string} key The key of the entry to check.
1328
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
1329
- */
1330
- function hashHas(key) {
1331
- var data = this.__data__;
1332
- return _nativeCreate ? (data[key] !== undefined) : hasOwnProperty$3.call(data, key);
1333
- }
1334
-
1335
- var _hashHas = hashHas;
1336
-
1337
- /** Used to stand-in for `undefined` hash values. */
1338
- var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
1339
-
1340
- /**
1341
- * Sets the hash `key` to `value`.
1342
- *
1343
- * @private
1344
- * @name set
1345
- * @memberOf Hash
1346
- * @param {string} key The key of the value to set.
1347
- * @param {*} value The value to set.
1348
- * @returns {Object} Returns the hash instance.
1349
- */
1350
- function hashSet(key, value) {
1351
- var data = this.__data__;
1352
- this.size += this.has(key) ? 0 : 1;
1353
- data[key] = (_nativeCreate && value === undefined) ? HASH_UNDEFINED$1 : value;
1354
- return this;
1355
- }
1356
-
1357
- var _hashSet = hashSet;
1118
+ return function (arr, i) {
1119
+ if (Array.isArray(arr)) {
1120
+ return arr;
1121
+ } else if (Symbol.iterator in Object(arr)) {
1122
+ return sliceIterator(arr, i);
1123
+ } else {
1124
+ throw new TypeError("Invalid attempt to destructure non-iterable instance");
1125
+ }
1126
+ };
1127
+ }();
1358
1128
 
1359
- /**
1360
- * Creates a hash object.
1361
- *
1362
- * @private
1363
- * @constructor
1364
- * @param {Array} [entries] The key-value pairs to cache.
1365
- */
1366
- function Hash(entries) {
1367
- var index = -1,
1368
- length = entries == null ? 0 : entries.length;
1129
+ var toConsumableArray = function (arr) {
1130
+ if (Array.isArray(arr)) {
1131
+ for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
1369
1132
 
1370
- this.clear();
1371
- while (++index < length) {
1372
- var entry = entries[index];
1373
- this.set(entry[0], entry[1]);
1133
+ return arr2;
1134
+ } else {
1135
+ return Array.from(arr);
1374
1136
  }
1375
- }
1376
-
1377
- // Add methods to `Hash`.
1378
- Hash.prototype.clear = _hashClear;
1379
- Hash.prototype['delete'] = _hashDelete;
1380
- Hash.prototype.get = _hashGet;
1381
- Hash.prototype.has = _hashHas;
1382
- Hash.prototype.set = _hashSet;
1383
-
1384
- var _Hash = Hash;
1137
+ };
1385
1138
 
1386
- /**
1387
- * Removes all key-value entries from the list cache.
1388
- *
1389
- * @private
1390
- * @name clear
1391
- * @memberOf ListCache
1392
- */
1393
- function listCacheClear() {
1394
- this.__data__ = [];
1395
- this.size = 0;
1396
- }
1139
+ var DeckContent = function (_React$Component) {
1140
+ inherits(DeckContent, _React$Component);
1397
1141
 
1398
- var _listCacheClear = listCacheClear;
1142
+ function DeckContent() {
1143
+ var _ref;
1399
1144
 
1400
- /**
1401
- * Performs a
1402
- * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
1403
- * comparison between two values to determine if they are equivalent.
1404
- *
1405
- * @static
1406
- * @memberOf _
1407
- * @since 4.0.0
1408
- * @category Lang
1409
- * @param {*} value The value to compare.
1410
- * @param {*} other The other value to compare.
1411
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
1412
- * @example
1413
- *
1414
- * var object = { 'a': 1 };
1415
- * var other = { 'a': 1 };
1416
- *
1417
- * _.eq(object, object);
1418
- * // => true
1419
- *
1420
- * _.eq(object, other);
1421
- * // => false
1422
- *
1423
- * _.eq('a', 'a');
1424
- * // => true
1425
- *
1426
- * _.eq('a', Object('a'));
1427
- * // => false
1428
- *
1429
- * _.eq(NaN, NaN);
1430
- * // => true
1431
- */
1432
- function eq(value, other) {
1433
- return value === other || (value !== value && other !== other);
1434
- }
1145
+ var _temp, _this, _ret;
1435
1146
 
1436
- var eq_1 = eq;
1147
+ classCallCheck(this, DeckContent);
1437
1148
 
1438
- /**
1439
- * Gets the index at which the `key` is found in `array` of key-value pairs.
1440
- *
1441
- * @private
1442
- * @param {Array} array The array to inspect.
1443
- * @param {*} key The key to search for.
1444
- * @returns {number} Returns the index of the matched value, else `-1`.
1445
- */
1446
- function assocIndexOf(array, key) {
1447
- var length = array.length;
1448
- while (length--) {
1449
- if (eq_1(array[length][0], key)) {
1450
- return length;
1149
+ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
1150
+ args[_key] = arguments[_key];
1451
1151
  }
1452
- }
1453
- return -1;
1454
- }
1455
1152
 
1456
- var _assocIndexOf = assocIndexOf;
1457
-
1458
- /** Used for built-in method references. */
1459
- var arrayProto = Array.prototype;
1460
-
1461
- /** Built-in value references. */
1462
- var splice = arrayProto.splice;
1463
-
1464
- /**
1465
- * Removes `key` and its value from the list cache.
1466
- *
1467
- * @private
1468
- * @name delete
1469
- * @memberOf ListCache
1470
- * @param {string} key The key of the value to remove.
1471
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
1472
- */
1473
- function listCacheDelete(key) {
1474
- var data = this.__data__,
1475
- index = _assocIndexOf(data, key);
1476
-
1477
- if (index < 0) {
1478
- return false;
1479
- }
1480
- var lastIndex = data.length - 1;
1481
- if (index == lastIndex) {
1482
- data.pop();
1483
- } else {
1484
- splice.call(data, index, 1);
1485
- }
1486
- --this.size;
1487
- return true;
1488
- }
1489
-
1490
- var _listCacheDelete = listCacheDelete;
1491
-
1492
- /**
1493
- * Gets the list cache value for `key`.
1494
- *
1495
- * @private
1496
- * @name get
1497
- * @memberOf ListCache
1498
- * @param {string} key The key of the value to get.
1499
- * @returns {*} Returns the entry value.
1500
- */
1501
- function listCacheGet(key) {
1502
- var data = this.__data__,
1503
- index = _assocIndexOf(data, key);
1153
+ return _ret = (_temp = (_this = possibleConstructorReturn(this, (_ref = DeckContent.__proto__ || Object.getPrototypeOf(DeckContent)).call.apply(_ref, [this].concat(args))), _this), _this.mapping = _this.props.mapping, _this.data = _this.props.dataRecord, _this.query = _this.props.query, _this.params = _this.props.params, _this.pointer = _this.props.pointer ? _this.props.pointer : false, _this.pointerArray = _this.props.pointerArray ? _this.props.pointerArray : false, _this.defaultImage = _this.props.defaultImage ? _this.props.defaultImage : '/placeholder.jpg', _this.state = {
1154
+ data: _this.data,
1155
+ dataKeptToCompareNewDatarecord: _this.data,
1156
+ per: _this.params ? _this.params.to : 2,
1157
+ page: 1,
1158
+ from: _this.params ? _this.params.from : 0,
1159
+ to: _this.params ? _this.params.to : 2,
1160
+ total_pages: null,
1161
+ scrolling: true,
1162
+ query: _this.query
1163
+ }, _this.loadMore = function () {
1164
+ setTimeout(function () {
1165
+ _this.setState(function (state) {
1166
+ return {
1167
+ page: state.page + 1,
1168
+ from: state.from + state.per,
1169
+ to: state.to + state.per
1170
+ };
1171
+ }, _this.loadData);
1172
+ }, 10);
1173
+ }, _this.loadData = function () {
1174
+ var _this$state = _this.state,
1175
+ from = _this$state.from,
1176
+ to = _this$state.to,
1177
+ data = _this$state.data,
1178
+ query = _this$state.query;
1179
+ var client = _this.props.client;
1504
1180
 
1505
- return index < 0 ? undefined : data[index][1];
1506
- }
1507
1181
 
1508
- var _listCacheGet = listCacheGet;
1182
+ var params = { from: from, to: to };
1183
+ var queryUpdated = query.replace('$from', params.from).replace('$to', params.to);
1184
+ // const query = '*[_type == "article" && defined(title) && defined(thumbnail)][$from...$to] { title, summary, thumbnail { asset-> }, url }'
1509
1185
 
1510
- /**
1511
- * Checks if a list cache value for `key` exists.
1512
- *
1513
- * @private
1514
- * @name has
1515
- * @memberOf ListCache
1516
- * @param {string} key The key of the entry to check.
1517
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
1518
- */
1519
- function listCacheHas(key) {
1520
- return _assocIndexOf(this.__data__, key) > -1;
1521
- }
1186
+ if (_this.pointer && _this.pointerArray) {
1187
+ var pointer = _this.pointer;
1188
+ client.fetch(queryUpdated).then(function (dataArr) {
1189
+ _this.setState(function (state, props) {
1190
+ if (dataArr[_this.pointerArray][pointer].length > 0) {
1191
+ return {
1192
+ data: [].concat(toConsumableArray(data), toConsumableArray(dataArr[_this.pointerArray][pointer])),
1193
+ scrolling: true
1194
+ };
1195
+ } else {
1196
+ return {
1197
+ scrolling: false
1198
+ };
1199
+ }
1200
+ });
1201
+ });
1202
+ } else {
1203
+ client.fetch(queryUpdated).then(function (dataArr) {
1204
+ _this.setState(function (state, props) {
1205
+ if (dataArr.length > 0) {
1206
+ return {
1207
+ data: [].concat(toConsumableArray(data), toConsumableArray(dataArr)),
1208
+ scrolling: true
1209
+ };
1210
+ } else {
1211
+ return {
1212
+ scrolling: false
1213
+ };
1214
+ }
1215
+ });
1216
+ });
1217
+ }
1218
+ }, _this.urlFor = function (source) {
1219
+ var client = _this.props.client;
1522
1220
 
1523
- var _listCacheHas = listCacheHas;
1221
+ var builder = imageUrlBuilder(client);
1222
+ return builder.image(source);
1223
+ }, _this.renderCardImage = function (row, page) {
1224
+ if (row.thumbnail && row.thumbnail.asset) {
1225
+ return _this.urlFor(row.thumbnail.asset).url();
1226
+ /*} else if (page === 'videos' && row.youtubeURL) {
1227
+ return `https://img.youtube.com/vi/${getYouTubeId(row.youtubeURL)}/0.jpg`*/
1228
+ } else {
1229
+ return _this.defaultImage;
1230
+ }
1231
+ }, _this.cardLoader = function (page, columns, variant) {
1232
+ var mode = variant && variant === 'bottom' ? 'column-reverse' : 'column';
1524
1233
 
1525
- /**
1526
- * Sets the list cache `key` to `value`.
1527
- *
1528
- * @private
1529
- * @name set
1530
- * @memberOf ListCache
1531
- * @param {string} key The key of the value to set.
1532
- * @param {*} value The value to set.
1533
- * @returns {Object} Returns the list cache instance.
1534
- */
1535
- function listCacheSet(key, value) {
1536
- var data = this.__data__,
1537
- index = _assocIndexOf(data, key);
1234
+ var itemCounter = 0;
1235
+ var lgVar = 12;
1236
+ return React__default.createElement(
1237
+ Row,
1238
+ null,
1239
+ _this.state.data && _this.state.data.map(function (row, index) {
1240
+ if (columns === 'rotate' && itemCounter % 3 === 0) {
1241
+ lgVar = 12;
1242
+ } else if (columns && columns !== 'rotate') {
1243
+ lgVar = Math.floor(12 / columns);
1244
+ } else {
1245
+ lgVar = 6;
1246
+ }
1538
1247
 
1539
- if (index < 0) {
1540
- ++this.size;
1541
- data.push([key, value]);
1542
- } else {
1543
- data[index][1] = value;
1248
+ return React__default.createElement(
1249
+ Col,
1250
+ { key: itemCounter, md: 12, lg: lgVar, counter: itemCounter++, style: { display: 'flex', flex: '1 0 auto' } },
1251
+ React__default.createElement(
1252
+ Card,
1253
+ { className: 'content-card', style: { flexDirection: mode } },
1254
+ React__default.createElement(
1255
+ Link,
1256
+ { href: _this.mapping[row.contentCategory.name] + '/[url]', as: _this.mapping[row.contentCategory.name] + '/' + row.url.current },
1257
+ React__default.createElement(
1258
+ 'a',
1259
+ null,
1260
+ React__default.createElement(Card.Img, { variant: 'top', src: _this.renderCardImage(row, page), alt: row.thumbnail && row.thumbnail.asset ? row.thumbnail.asset.originalFilename : '' })
1261
+ )
1262
+ ),
1263
+ React__default.createElement(
1264
+ Card.Body,
1265
+ null,
1266
+ React__default.createElement(
1267
+ Link,
1268
+ { href: _this.mapping[row.contentCategory.name] + '/[url]', as: _this.mapping[row.contentCategory.name] + '/' + row.url.current },
1269
+ React__default.createElement(
1270
+ 'a',
1271
+ null,
1272
+ React__default.createElement(
1273
+ Card.Title,
1274
+ null,
1275
+ row.title
1276
+ ),
1277
+ React__default.createElement(
1278
+ Card.Text,
1279
+ null,
1280
+ row.summary
1281
+ )
1282
+ )
1283
+ )
1284
+ )
1285
+ )
1286
+ );
1287
+ })
1288
+ );
1289
+ }, _temp), possibleConstructorReturn(_this, _ret);
1544
1290
  }
1545
- return this;
1546
- }
1547
1291
 
1548
- var _listCacheSet = listCacheSet;
1549
-
1550
- /**
1551
- * Creates an list cache object.
1552
- *
1553
- * @private
1554
- * @constructor
1555
- * @param {Array} [entries] The key-value pairs to cache.
1556
- */
1557
- function ListCache(entries) {
1558
- var index = -1,
1559
- length = entries == null ? 0 : entries.length;
1292
+ createClass(DeckContent, [{
1293
+ key: 'componentDidUpdate',
1294
+ value: function componentDidUpdate(prevProps, prevState) {
1295
+ if (this.state.dataKeptToCompareNewDatarecord !== this.props.dataRecord) {
1296
+ // eslint-disable-next-line react/no-did-update-set-state
1297
+ this.setState({
1298
+ data: this.props.dataRecord,
1299
+ dataKeptToCompareNewDatarecord: this.props.dataRecord,
1300
+ per: this.props.params ? this.props.params.to : 2,
1301
+ page: 1,
1302
+ from: this.props.params ? this.props.params.from : 0,
1303
+ to: this.props.params ? this.props.params.to : 2,
1304
+ total_pages: null,
1305
+ scrolling: true,
1306
+ query: this.props.query
1307
+ });
1308
+ }
1309
+ }
1310
+ }, {
1311
+ key: 'componentDidMount',
1312
+ value: function componentDidMount() {
1313
+ // this.loadData();
1314
+ }
1315
+ }, {
1316
+ key: 'render',
1317
+ value: function render() {
1318
+ var _this2 = this;
1560
1319
 
1561
- this.clear();
1562
- while (++index < length) {
1563
- var entry = entries[index];
1564
- this.set(entry[0], entry[1]);
1565
- }
1566
- }
1320
+ var _props = this.props,
1321
+ columns = _props.columns,
1322
+ variant = _props.variant,
1323
+ autoScroll = _props.autoScroll,
1324
+ page = _props.page;
1567
1325
 
1568
- // Add methods to `ListCache`.
1569
- ListCache.prototype.clear = _listCacheClear;
1570
- ListCache.prototype['delete'] = _listCacheDelete;
1571
- ListCache.prototype.get = _listCacheGet;
1572
- ListCache.prototype.has = _listCacheHas;
1573
- ListCache.prototype.set = _listCacheSet;
1574
1326
 
1575
- var _ListCache = ListCache;
1576
-
1577
- /* Built-in method references that are verified to be native. */
1578
- var Map = _getNative(_root, 'Map');
1579
-
1580
- var _Map = Map;
1581
-
1582
- /**
1583
- * Removes all key-value entries from the map.
1584
- *
1585
- * @private
1586
- * @name clear
1587
- * @memberOf MapCache
1588
- */
1589
- function mapCacheClear() {
1590
- this.size = 0;
1591
- this.__data__ = {
1592
- 'hash': new _Hash,
1593
- 'map': new (_Map || _ListCache),
1594
- 'string': new _Hash
1595
- };
1596
- }
1597
-
1598
- var _mapCacheClear = mapCacheClear;
1599
-
1600
- /**
1601
- * Checks if `value` is suitable for use as unique object key.
1602
- *
1603
- * @private
1604
- * @param {*} value The value to check.
1605
- * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
1606
- */
1607
- function isKeyable(value) {
1608
- var type = typeof value;
1609
- return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
1610
- ? (value !== '__proto__')
1611
- : (value === null);
1612
- }
1613
-
1614
- var _isKeyable = isKeyable;
1615
-
1616
- /**
1617
- * Gets the data for `map`.
1618
- *
1619
- * @private
1620
- * @param {Object} map The map to query.
1621
- * @param {string} key The reference key.
1622
- * @returns {*} Returns the map data.
1623
- */
1624
- function getMapData(map, key) {
1625
- var data = map.__data__;
1626
- return _isKeyable(key)
1627
- ? data[typeof key == 'string' ? 'string' : 'hash']
1628
- : data.map;
1629
- }
1630
-
1631
- var _getMapData = getMapData;
1632
-
1633
- /**
1634
- * Removes `key` and its value from the map.
1635
- *
1636
- * @private
1637
- * @name delete
1638
- * @memberOf MapCache
1639
- * @param {string} key The key of the value to remove.
1640
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
1641
- */
1642
- function mapCacheDelete(key) {
1643
- var result = _getMapData(this, key)['delete'](key);
1644
- this.size -= result ? 1 : 0;
1645
- return result;
1646
- }
1647
-
1648
- var _mapCacheDelete = mapCacheDelete;
1649
-
1650
- /**
1651
- * Gets the map value for `key`.
1652
- *
1653
- * @private
1654
- * @name get
1655
- * @memberOf MapCache
1656
- * @param {string} key The key of the value to get.
1657
- * @returns {*} Returns the entry value.
1658
- */
1659
- function mapCacheGet(key) {
1660
- return _getMapData(this, key).get(key);
1661
- }
1662
-
1663
- var _mapCacheGet = mapCacheGet;
1664
-
1665
- /**
1666
- * Checks if a map value for `key` exists.
1667
- *
1668
- * @private
1669
- * @name has
1670
- * @memberOf MapCache
1671
- * @param {string} key The key of the entry to check.
1672
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
1673
- */
1674
- function mapCacheHas(key) {
1675
- return _getMapData(this, key).has(key);
1676
- }
1677
-
1678
- var _mapCacheHas = mapCacheHas;
1679
-
1680
- /**
1681
- * Sets the map `key` to `value`.
1682
- *
1683
- * @private
1684
- * @name set
1685
- * @memberOf MapCache
1686
- * @param {string} key The key of the value to set.
1687
- * @param {*} value The value to set.
1688
- * @returns {Object} Returns the map cache instance.
1689
- */
1690
- function mapCacheSet(key, value) {
1691
- var data = _getMapData(this, key),
1692
- size = data.size;
1693
-
1694
- data.set(key, value);
1695
- this.size += data.size == size ? 0 : 1;
1696
- return this;
1697
- }
1698
-
1699
- var _mapCacheSet = mapCacheSet;
1700
-
1701
- /**
1702
- * Creates a map cache object to store key-value pairs.
1703
- *
1704
- * @private
1705
- * @constructor
1706
- * @param {Array} [entries] The key-value pairs to cache.
1707
- */
1708
- function MapCache(entries) {
1709
- var index = -1,
1710
- length = entries == null ? 0 : entries.length;
1711
-
1712
- this.clear();
1713
- while (++index < length) {
1714
- var entry = entries[index];
1715
- this.set(entry[0], entry[1]);
1716
- }
1717
- }
1718
-
1719
- // Add methods to `MapCache`.
1720
- MapCache.prototype.clear = _mapCacheClear;
1721
- MapCache.prototype['delete'] = _mapCacheDelete;
1722
- MapCache.prototype.get = _mapCacheGet;
1723
- MapCache.prototype.has = _mapCacheHas;
1724
- MapCache.prototype.set = _mapCacheSet;
1725
-
1726
- var _MapCache = MapCache;
1727
-
1728
- /** Error message constants. */
1729
- var FUNC_ERROR_TEXT = 'Expected a function';
1730
-
1731
- /**
1732
- * Creates a function that memoizes the result of `func`. If `resolver` is
1733
- * provided, it determines the cache key for storing the result based on the
1734
- * arguments provided to the memoized function. By default, the first argument
1735
- * provided to the memoized function is used as the map cache key. The `func`
1736
- * is invoked with the `this` binding of the memoized function.
1737
- *
1738
- * **Note:** The cache is exposed as the `cache` property on the memoized
1739
- * function. Its creation may be customized by replacing the `_.memoize.Cache`
1740
- * constructor with one whose instances implement the
1741
- * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
1742
- * method interface of `clear`, `delete`, `get`, `has`, and `set`.
1743
- *
1744
- * @static
1745
- * @memberOf _
1746
- * @since 0.1.0
1747
- * @category Function
1748
- * @param {Function} func The function to have its output memoized.
1749
- * @param {Function} [resolver] The function to resolve the cache key.
1750
- * @returns {Function} Returns the new memoized function.
1751
- * @example
1752
- *
1753
- * var object = { 'a': 1, 'b': 2 };
1754
- * var other = { 'c': 3, 'd': 4 };
1755
- *
1756
- * var values = _.memoize(_.values);
1757
- * values(object);
1758
- * // => [1, 2]
1759
- *
1760
- * values(other);
1761
- * // => [3, 4]
1762
- *
1763
- * object.a = 2;
1764
- * values(object);
1765
- * // => [1, 2]
1766
- *
1767
- * // Modify the result cache.
1768
- * values.cache.set(object, ['a', 'b']);
1769
- * values(object);
1770
- * // => ['a', 'b']
1771
- *
1772
- * // Replace `_.memoize.Cache`.
1773
- * _.memoize.Cache = WeakMap;
1774
- */
1775
- function memoize(func, resolver) {
1776
- if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
1777
- throw new TypeError(FUNC_ERROR_TEXT);
1778
- }
1779
- var memoized = function() {
1780
- var args = arguments,
1781
- key = resolver ? resolver.apply(this, args) : args[0],
1782
- cache = memoized.cache;
1783
-
1784
- if (cache.has(key)) {
1785
- return cache.get(key);
1786
- }
1787
- var result = func.apply(this, args);
1788
- memoized.cache = cache.set(key, result) || cache;
1789
- return result;
1790
- };
1791
- memoized.cache = new (memoize.Cache || _MapCache);
1792
- return memoized;
1793
- }
1794
-
1795
- // Expose `MapCache`.
1796
- memoize.Cache = _MapCache;
1797
-
1798
- var memoize_1 = memoize;
1799
-
1800
- /** Used as the maximum memoize cache size. */
1801
- var MAX_MEMOIZE_SIZE = 500;
1802
-
1803
- /**
1804
- * A specialized version of `_.memoize` which clears the memoized function's
1805
- * cache when it exceeds `MAX_MEMOIZE_SIZE`.
1806
- *
1807
- * @private
1808
- * @param {Function} func The function to have its output memoized.
1809
- * @returns {Function} Returns the new memoized function.
1810
- */
1811
- function memoizeCapped(func) {
1812
- var result = memoize_1(func, function(key) {
1813
- if (cache.size === MAX_MEMOIZE_SIZE) {
1814
- cache.clear();
1327
+ return React__default.createElement(
1328
+ 'div',
1329
+ { className: 'contentDeck' },
1330
+ autoScroll ? React__default.createElement(
1331
+ React__default.Fragment,
1332
+ null,
1333
+ React__default.createElement(
1334
+ InfiniteScroll,
1335
+ { dataLength: this.state.data.length, next: this.loadMore, hasMore: this.state.scrolling },
1336
+ this.cardLoader(page, columns, variant)
1337
+ ),
1338
+ React__default.createElement(
1339
+ 'noscript',
1340
+ null,
1341
+ 'Manual Pagination Here'
1342
+ )
1343
+ ) : React__default.createElement(
1344
+ React__default.Fragment,
1345
+ null,
1346
+ this.cardLoader(page, columns, variant),
1347
+ React__default.createElement(
1348
+ 'div',
1349
+ { style: { padding: '0px 10px' } },
1350
+ this.state.scrolling ? React__default.createElement(
1351
+ 'button',
1352
+ {
1353
+ style: { margin: 'auto', width: '100%' },
1354
+ onClick: function onClick(e) {
1355
+ _this2.loadMore();
1356
+ } },
1357
+ 'Load More'
1358
+ ) : React__default.createElement(
1359
+ 'p',
1360
+ { style: { textAlign: 'center' } },
1361
+ React__default.createElement(
1362
+ 'b',
1363
+ null,
1364
+ 'End of data'
1365
+ )
1366
+ )
1367
+ ),
1368
+ React__default.createElement(
1369
+ 'noscript',
1370
+ null,
1371
+ 'Manual Pagination Here'
1372
+ )
1373
+ )
1374
+ );
1815
1375
  }
1816
- return key;
1817
- });
1818
-
1819
- var cache = result.cache;
1820
- return result;
1821
- }
1822
-
1823
- var _memoizeCapped = memoizeCapped;
1824
-
1825
- /** Used to match property names within property paths. */
1826
- var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
1827
-
1828
- /** Used to match backslashes in property paths. */
1829
- var reEscapeChar = /\\(\\)?/g;
1830
-
1831
- /**
1832
- * Converts `string` to a property path array.
1833
- *
1834
- * @private
1835
- * @param {string} string The string to convert.
1836
- * @returns {Array} Returns the property path array.
1837
- */
1838
- var stringToPath = _memoizeCapped(function(string) {
1839
- var result = [];
1840
- if (string.charCodeAt(0) === 46 /* . */) {
1841
- result.push('');
1842
- }
1843
- string.replace(rePropName, function(match, number, quote, subString) {
1844
- result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
1845
- });
1846
- return result;
1847
- });
1848
-
1849
- var _stringToPath = stringToPath;
1850
-
1851
- /**
1852
- * A specialized version of `_.map` for arrays without support for iteratee
1853
- * shorthands.
1854
- *
1855
- * @private
1856
- * @param {Array} [array] The array to iterate over.
1857
- * @param {Function} iteratee The function invoked per iteration.
1858
- * @returns {Array} Returns the new mapped array.
1859
- */
1860
- function arrayMap(array, iteratee) {
1861
- var index = -1,
1862
- length = array == null ? 0 : array.length,
1863
- result = Array(length);
1864
-
1865
- while (++index < length) {
1866
- result[index] = iteratee(array[index], index, array);
1867
- }
1868
- return result;
1869
- }
1870
-
1871
- var _arrayMap = arrayMap;
1872
-
1873
- /** Used as references for various `Number` constants. */
1874
- var INFINITY = 1 / 0;
1875
-
1876
- /** Used to convert symbols to primitives and strings. */
1877
- var symbolProto = _Symbol ? _Symbol.prototype : undefined,
1878
- symbolToString = symbolProto ? symbolProto.toString : undefined;
1879
-
1880
- /**
1881
- * The base implementation of `_.toString` which doesn't convert nullish
1882
- * values to empty strings.
1883
- *
1884
- * @private
1885
- * @param {*} value The value to process.
1886
- * @returns {string} Returns the string.
1887
- */
1888
- function baseToString(value) {
1889
- // Exit early for strings to avoid a performance hit in some environments.
1890
- if (typeof value == 'string') {
1891
- return value;
1892
- }
1893
- if (isArray_1(value)) {
1894
- // Recursively convert values (susceptible to call stack limits).
1895
- return _arrayMap(value, baseToString) + '';
1896
- }
1897
- if (isSymbol_1(value)) {
1898
- return symbolToString ? symbolToString.call(value) : '';
1899
- }
1900
- var result = (value + '');
1901
- return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
1902
- }
1903
-
1904
- var _baseToString = baseToString;
1905
-
1906
- /**
1907
- * Converts `value` to a string. An empty string is returned for `null`
1908
- * and `undefined` values. The sign of `-0` is preserved.
1909
- *
1910
- * @static
1911
- * @memberOf _
1912
- * @since 4.0.0
1913
- * @category Lang
1914
- * @param {*} value The value to convert.
1915
- * @returns {string} Returns the converted string.
1916
- * @example
1917
- *
1918
- * _.toString(null);
1919
- * // => ''
1920
- *
1921
- * _.toString(-0);
1922
- * // => '-0'
1923
- *
1924
- * _.toString([1, 2, 3]);
1925
- * // => '1,2,3'
1926
- */
1927
- function toString(value) {
1928
- return value == null ? '' : _baseToString(value);
1929
- }
1930
-
1931
- var toString_1 = toString;
1932
-
1933
- /**
1934
- * Casts `value` to a path array if it's not one.
1935
- *
1936
- * @private
1937
- * @param {*} value The value to inspect.
1938
- * @param {Object} [object] The object to query keys on.
1939
- * @returns {Array} Returns the cast property path array.
1940
- */
1941
- function castPath(value, object) {
1942
- if (isArray_1(value)) {
1943
- return value;
1944
- }
1945
- return _isKey(value, object) ? [value] : _stringToPath(toString_1(value));
1946
- }
1947
-
1948
- var _castPath = castPath;
1949
-
1950
- /** Used as references for various `Number` constants. */
1951
- var INFINITY$1 = 1 / 0;
1952
-
1953
- /**
1954
- * Converts `value` to a string key if it's not a string or symbol.
1955
- *
1956
- * @private
1957
- * @param {*} value The value to inspect.
1958
- * @returns {string|symbol} Returns the key.
1959
- */
1960
- function toKey(value) {
1961
- if (typeof value == 'string' || isSymbol_1(value)) {
1962
- return value;
1963
- }
1964
- var result = (value + '');
1965
- return (result == '0' && (1 / value) == -INFINITY$1) ? '-0' : result;
1966
- }
1967
-
1968
- var _toKey = toKey;
1969
-
1970
- /**
1971
- * The base implementation of `_.get` without support for default values.
1972
- *
1973
- * @private
1974
- * @param {Object} object The object to query.
1975
- * @param {Array|string} path The path of the property to get.
1976
- * @returns {*} Returns the resolved value.
1977
- */
1978
- function baseGet(object, path) {
1979
- path = _castPath(path, object);
1980
-
1981
- var index = 0,
1982
- length = path.length;
1983
-
1984
- while (object != null && index < length) {
1985
- object = object[_toKey(path[index++])];
1986
- }
1987
- return (index && index == length) ? object : undefined;
1988
- }
1989
-
1990
- var _baseGet = baseGet;
1991
-
1992
- /**
1993
- * Gets the value at `path` of `object`. If the resolved value is
1994
- * `undefined`, the `defaultValue` is returned in its place.
1995
- *
1996
- * @static
1997
- * @memberOf _
1998
- * @since 3.7.0
1999
- * @category Object
2000
- * @param {Object} object The object to query.
2001
- * @param {Array|string} path The path of the property to get.
2002
- * @param {*} [defaultValue] The value returned for `undefined` resolved values.
2003
- * @returns {*} Returns the resolved value.
2004
- * @example
2005
- *
2006
- * var object = { 'a': [{ 'b': { 'c': 3 } }] };
2007
- *
2008
- * _.get(object, 'a[0].b.c');
2009
- * // => 3
2010
- *
2011
- * _.get(object, ['a', '0', 'b', 'c']);
2012
- * // => 3
2013
- *
2014
- * _.get(object, 'a.b.c', 'default');
2015
- * // => 'default'
2016
- */
2017
- function get$1(object, path, defaultValue) {
2018
- var result = object == null ? undefined : _baseGet(object, path);
2019
- return result === undefined ? defaultValue : result;
2020
- }
2021
-
2022
- var get_1 = get$1;
1376
+ }]);
1377
+ return DeckContent;
1378
+ }(React__default.Component);
2023
1379
 
2024
1380
  var DeckQueue = function (_React$Component) {
2025
1381
  inherits(DeckQueue, _React$Component);
@@ -2098,6 +1454,11 @@ var DeckQueue = function (_React$Component) {
2098
1454
  });
2099
1455
  });
2100
1456
  }
1457
+ }, _this.urlFor = function (source) {
1458
+ var client = _this.props.client;
1459
+
1460
+ var builder = imageUrlBuilder(client);
1461
+ return builder.image(source);
2101
1462
  }, _temp), possibleConstructorReturn(_this, _ret);
2102
1463
  }
2103
1464
 
@@ -2113,7 +1474,8 @@ var DeckQueue = function (_React$Component) {
2113
1474
  Row,
2114
1475
  null,
2115
1476
  this.state.data && this.state.data.map(function (row, index) {
2116
- var thumbnailURL = get_1(row, 'thumbnail.asset.url', _this2.props.defaultImage);
1477
+ // const thumbnailURL = get(row, 'thumbnail.asset.url', this.props.defaultImage)
1478
+ var thumbnailURL = row.thumbnail && row.thumbnail.asset ? _this2.urlFor(row.thumbnail.asset).url() : _this2.props.defaultImage;
2117
1479
  return React__default.createElement(
2118
1480
  Col,
2119
1481
  { key: index, md: 12, lg: lgVar, style: { display: 'flex', flex: '1 0 auto' } },
@@ -2213,7 +1575,15 @@ var DeckQueue = function (_React$Component) {
2213
1575
 
2214
1576
  var ThumbnailCard = function ThumbnailCard(_ref) {
2215
1577
  var size = _ref.size,
2216
- mediaData = _ref.mediaData;
1578
+ mediaData = _ref.mediaData,
1579
+ client = _ref.client,
1580
+ defaultImage = _ref.defaultImage;
1581
+
1582
+ var builder = imageUrlBuilder(client);
1583
+
1584
+ var urlFor = function urlFor(source) {
1585
+ return builder.image(source);
1586
+ };
2217
1587
 
2218
1588
  return React__default.createElement(
2219
1589
  'div',
@@ -2222,7 +1592,13 @@ var ThumbnailCard = function ThumbnailCard(_ref) {
2222
1592
  return React__default.createElement(
2223
1593
  Media,
2224
1594
  { className: 'mb-3 thumbnail-card' },
2225
- React__default.createElement('img', { width: size, height: size, className: 'mr-3', src: item.thumbnail.asset.url, alt: 'Generic placeholder' }),
1595
+ React__default.createElement('img', {
1596
+ width: size,
1597
+ height: size,
1598
+ className: 'mr-3',
1599
+ src: item.thumbnail && item.thumbnail.asset ? urlFor(item.thumbnail.asset).url() : defaultImage,
1600
+ alt: 'Generic placeholder'
1601
+ }),
2226
1602
  React__default.createElement(
2227
1603
  Media.Body,
2228
1604
  null,
@@ -2248,8 +1624,15 @@ var TaxonomyCard = function TaxonomyCard(props) {
2248
1624
  _props$icon = props.icon,
2249
1625
  icon = _props$icon === undefined ? false : _props$icon,
2250
1626
  data = props.dataRecord,
2251
- defaultImage = props.defaultImage;
1627
+ defaultImage = props.defaultImage,
1628
+ client = props.client;
1629
+
1630
+
1631
+ var builder = imageUrlBuilder(client);
2252
1632
 
1633
+ var urlFor = function urlFor(source) {
1634
+ return builder.image(source);
1635
+ };
2253
1636
 
2254
1637
  var mode = variant && variant === 'bottom' ? 'column-reverse' : 'column';
2255
1638
 
@@ -2270,8 +1653,7 @@ var TaxonomyCard = function TaxonomyCard(props) {
2270
1653
  } else {
2271
1654
  lgVar = 6;
2272
1655
  }
2273
- var thumbnailURL = get_1(row, 'thumbnail.asset.url', defaultImage);
2274
-
1656
+ var thumbnailURL = row.thumbnail && row.thumbnail.asset ? urlFor(row.thumbnail.asset).url() : defaultImage;
2275
1657
  return React__default.createElement(
2276
1658
  Col,
2277
1659
  { key: itemCounter, md: 12, lg: lgVar, counter: itemCounter++, style: { display: 'flex', flex: '1 0 auto' } },
@@ -2326,7 +1708,8 @@ var TaxonomyCard = function TaxonomyCard(props) {
2326
1708
  top: '50%',
2327
1709
  transform: 'translateY(-50%) translateX(50px)',
2328
1710
  transition: 'all .25s',
2329
- pointerEvents: 'none' } },
1711
+ pointerEvents: 'none'
1712
+ } },
2330
1713
  '\u2192'
2331
1714
  )
2332
1715
  )
@@ -5737,606 +5120,69 @@ var TemplateNormal = function TemplateNormal(props) {
5737
5120
  Container,
5738
5121
  null,
5739
5122
  layout()
5740
- )
5741
- );
5742
- };
5743
-
5744
- var AD = function AD(_ref) {
5745
- var networkID = _ref.networkID,
5746
- adUnit = _ref.adUnit,
5747
- sizeMapping = _ref.sizeMapping,
5748
- className = _ref.className,
5749
- slotId = _ref.slotId,
5750
- sizes = _ref.sizes,
5751
- minInViewPercent = _ref.minInViewPercent,
5752
- _ref$targeting = _ref.targeting,
5753
- targeting = _ref$targeting === undefined ? { desktop: {} } : _ref$targeting;
5754
-
5755
-
5756
- return React__default.createElement(
5757
- lib_1,
5758
- { dfpNetworkId: networkID, targetingArguments: targeting.desktop, sizeMapping: sizeMapping, lazyLoad: { fetchMarginPercent: 500, renderMarginPercent: 200, mobileScaling: 2.0 } },
5759
- React__default.createElement(
5760
- 'div',
5761
- { className: className },
5762
- React__default.createElement(lib_2, {
5763
- slotId: slotId,
5764
- sizes: sizes,
5765
- adUnit: adUnit,
5766
- sizeMapping: sizeMapping
5767
- })
5768
- )
5769
- );
5770
- };
5771
-
5772
- AD.propTypes = {
5773
- networkID: PropTypes.string.isRequired,
5774
- adUnit: PropTypes.string.isRequired,
5775
- slotId: PropTypes.string,
5776
- className: PropTypes.string,
5777
- sizeMapping: PropTypes.array,
5778
- sizes: PropTypes.array,
5779
- minInViewPercent: PropTypes.number
5780
- };
5781
-
5782
- var AD300x250 = function AD300x250(_ref) {
5783
- var networkID = _ref.networkID,
5784
- adUnit = _ref.adUnit,
5785
- targeting = _ref.targeting;
5786
-
5787
- return React__default.createElement(AD, { networkID: networkID, adUnit: adUnit, targeting: targeting, className: 'AD300x250', sizes: [[300, 250], [300, 100]] });
5788
- };
5789
-
5790
- var AD300x250x600 = function AD300x250x600(_ref) {
5791
- var networkID = _ref.networkID,
5792
- adUnit = _ref.adUnit,
5793
- targeting = _ref.targeting;
5794
-
5795
- return React__default.createElement(AD, {
5796
- networkID: networkID,
5797
- adUnit: adUnit,
5798
- className: 'AD300x250',
5799
- targeting: targeting,
5800
- sizes: [[300, 250], [300, 600], [300, 100]]
5801
- });
5802
- };
5803
-
5804
- var parseAssetId_1 = createCommonjsModule(function (module, exports) {
5805
- Object.defineProperty(exports, "__esModule", { value: true });
5806
- var example = 'image-Tb9Ew8CXIwaY6R1kjMvI0uRR-2000x3000-jpg';
5807
- function parseAssetId(ref) {
5808
- var _a = ref.split('-'), id = _a[1], dimensionString = _a[2], format = _a[3];
5809
- if (!id || !dimensionString || !format) {
5810
- throw new Error("Malformed asset _ref '" + ref + "'. Expected an id like \"" + example + "\".");
5811
- }
5812
- var _b = dimensionString.split('x'), imgWidthStr = _b[0], imgHeightStr = _b[1];
5813
- var width = +imgWidthStr;
5814
- var height = +imgHeightStr;
5815
- var isValidAssetId = isFinite(width) && isFinite(height);
5816
- if (!isValidAssetId) {
5817
- throw new Error("Malformed asset _ref '" + ref + "'. Expected an id like \"" + example + "\".");
5818
- }
5819
- return { id: id, width: width, height: height, format: format };
5820
- }
5821
- exports.default = parseAssetId;
5822
-
5823
- });
5824
-
5825
- unwrapExports(parseAssetId_1);
5826
-
5827
- var parseSource_1 = createCommonjsModule(function (module, exports) {
5828
- var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
5829
- __assign = Object.assign || function(t) {
5830
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5831
- s = arguments[i];
5832
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
5833
- t[p] = s[p];
5834
- }
5835
- return t;
5836
- };
5837
- return __assign.apply(this, arguments);
5838
- };
5839
- Object.defineProperty(exports, "__esModule", { value: true });
5840
- var isRef = function (src) {
5841
- var source = src;
5842
- return source ? typeof source._ref === 'string' : false;
5843
- };
5844
- var isAsset = function (src) {
5845
- var source = src;
5846
- return source ? typeof source._id === 'string' : false;
5847
- };
5848
- var isAssetStub = function (src) {
5849
- var source = src;
5850
- return source && source.asset ? typeof source.asset.url === 'string' : false;
5851
- };
5852
- // Convert an asset-id, asset or image to an image record suitable for processing
5853
- // eslint-disable-next-line complexity
5854
- function parseSource(source) {
5855
- if (!source) {
5856
- return null;
5857
- }
5858
- var image;
5859
- if (typeof source === 'string' && isUrl(source)) {
5860
- // Someone passed an existing image url?
5861
- image = {
5862
- asset: { _ref: urlToId(source) }
5863
- };
5864
- }
5865
- else if (typeof source === 'string') {
5866
- // Just an asset id
5867
- image = {
5868
- asset: { _ref: source }
5869
- };
5870
- }
5871
- else if (isRef(source)) {
5872
- // We just got passed an asset directly
5873
- image = {
5874
- asset: source
5875
- };
5876
- }
5877
- else if (isAsset(source)) {
5878
- // If we were passed an image asset document
5879
- image = {
5880
- asset: {
5881
- _ref: source._id || ''
5882
- }
5883
- };
5884
- }
5885
- else if (isAssetStub(source)) {
5886
- // If we were passed a partial asset (`url`, but no `_id`)
5887
- image = {
5888
- asset: {
5889
- _ref: urlToId(source.asset.url)
5890
- }
5891
- };
5892
- }
5893
- else if (typeof source.asset === 'object') {
5894
- // Probably an actual image with materialized asset
5895
- image = source;
5896
- }
5897
- else {
5898
- // We got something that does not look like an image, or it is an image
5899
- // that currently isn't sporting an asset.
5900
- return null;
5901
- }
5902
- var img = source;
5903
- if (img.crop) {
5904
- image.crop = img.crop;
5905
- }
5906
- if (img.hotspot) {
5907
- image.hotspot = img.hotspot;
5908
- }
5909
- return applyDefaults(image);
5910
- }
5911
- exports.default = parseSource;
5912
- function isUrl(url) {
5913
- return /^https?:\/\//.test("" + url);
5914
- }
5915
- function urlToId(url) {
5916
- var parts = url.split('/').slice(-1);
5917
- return ("image-" + parts[0]).replace(/\.([a-z]+)$/, '-$1');
5918
- }
5919
- // Mock crop and hotspot if image lacks it
5920
- function applyDefaults(image) {
5921
- if (image.crop && image.hotspot) {
5922
- return image;
5923
- }
5924
- // We need to pad in default values for crop or hotspot
5925
- var result = __assign({}, image);
5926
- if (!result.crop) {
5927
- result.crop = {
5928
- left: 0,
5929
- top: 0,
5930
- bottom: 0,
5931
- right: 0
5932
- };
5933
- }
5934
- if (!result.hotspot) {
5935
- result.hotspot = {
5936
- x: 0.5,
5937
- y: 0.5,
5938
- height: 1.0,
5939
- width: 1.0
5940
- };
5941
- }
5942
- return result;
5943
- }
5944
-
5945
- });
5946
-
5947
- unwrapExports(parseSource_1);
5948
-
5949
- var urlForImage_1 = createCommonjsModule(function (module, exports) {
5950
- var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
5951
- __assign = Object.assign || function(t) {
5952
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5953
- s = arguments[i];
5954
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
5955
- t[p] = s[p];
5956
- }
5957
- return t;
5958
- };
5959
- return __assign.apply(this, arguments);
5960
- };
5961
- var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
5962
- return (mod && mod.__esModule) ? mod : { "default": mod };
5963
- };
5964
- Object.defineProperty(exports, "__esModule", { value: true });
5965
- var parseAssetId_1$$1 = __importDefault(parseAssetId_1);
5966
- var parseSource_1$$1 = __importDefault(parseSource_1);
5967
- exports.parseSource = parseSource_1$$1.default;
5968
- exports.SPEC_NAME_TO_URL_NAME_MAPPINGS = [
5969
- ['width', 'w'],
5970
- ['height', 'h'],
5971
- ['format', 'fm'],
5972
- ['download', 'dl'],
5973
- ['blur', 'blur'],
5974
- ['sharpen', 'sharp'],
5975
- ['invert', 'invert'],
5976
- ['orientation', 'or'],
5977
- ['minHeight', 'min-h'],
5978
- ['maxHeight', 'max-h'],
5979
- ['minWidth', 'min-w'],
5980
- ['maxWidth', 'max-w'],
5981
- ['quality', 'q'],
5982
- ['fit', 'fit'],
5983
- ['crop', 'crop'],
5984
- ['auto', 'auto'],
5985
- ['dpr', 'dpr']
5986
- ];
5987
- function urlForImage(options) {
5988
- var spec = __assign({}, (options || {}));
5989
- var source = spec.source;
5990
- delete spec.source;
5991
- var image = parseSource_1$$1.default(source);
5992
- if (!image) {
5993
- return null;
5994
- }
5995
- var id = image.asset._ref || image.asset._id || '';
5996
- var asset = parseAssetId_1$$1.default(id);
5997
- // Compute crop rect in terms of pixel coordinates in the raw source image
5998
- var cropLeft = Math.round(image.crop.left * asset.width);
5999
- var cropTop = Math.round(image.crop.top * asset.height);
6000
- var crop = {
6001
- left: cropLeft,
6002
- top: cropTop,
6003
- width: Math.round(asset.width - image.crop.right * asset.width - cropLeft),
6004
- height: Math.round(asset.height - image.crop.bottom * asset.height - cropTop)
6005
- };
6006
- // Compute hot spot rect in terms of pixel coordinates
6007
- var hotSpotVerticalRadius = (image.hotspot.height * asset.height) / 2;
6008
- var hotSpotHorizontalRadius = (image.hotspot.width * asset.width) / 2;
6009
- var hotSpotCenterX = image.hotspot.x * asset.width;
6010
- var hotSpotCenterY = image.hotspot.y * asset.height;
6011
- var hotspot = {
6012
- left: hotSpotCenterX - hotSpotHorizontalRadius,
6013
- top: hotSpotCenterY - hotSpotVerticalRadius,
6014
- right: hotSpotCenterX + hotSpotHorizontalRadius,
6015
- bottom: hotSpotCenterY + hotSpotVerticalRadius
6016
- };
6017
- // If irrelevant, or if we are requested to: don't perform crop/fit based on
6018
- // the crop/hotspot.
6019
- if (!(spec.rect || spec.focalPoint || spec.ignoreImageParams || spec.crop)) {
6020
- spec = __assign({}, spec, fit({ crop: crop, hotspot: hotspot }, spec));
6021
- }
6022
- return specToImageUrl(__assign({}, spec, { asset: asset }));
6023
- }
6024
- exports.default = urlForImage;
6025
- // eslint-disable-next-line complexity
6026
- function specToImageUrl(spec) {
6027
- var cdnUrl = spec.baseUrl || 'https://cdn.sanity.io';
6028
- var filename = spec.asset.id + "-" + spec.asset.width + "x" + spec.asset.height + "." + spec.asset.format;
6029
- var baseUrl = cdnUrl + "/images/" + spec.projectId + "/" + spec.dataset + "/" + filename;
6030
- var params = [];
6031
- if (spec.rect) {
6032
- // Only bother url with a crop if it actually crops anything
6033
- var _a = spec.rect, left = _a.left, top_1 = _a.top, width = _a.width, height = _a.height;
6034
- var isEffectiveCrop = left !== 0 || top_1 !== 0 || height !== spec.asset.height || width !== spec.asset.width;
6035
- if (isEffectiveCrop) {
6036
- params.push("rect=" + left + "," + top_1 + "," + width + "," + height);
6037
- }
6038
- }
6039
- if (spec.bg) {
6040
- params.push("bg=" + spec.bg);
6041
- }
6042
- if (spec.focalPoint) {
6043
- params.push("fp-x=" + spec.focalPoint.x);
6044
- params.push("fp-x=" + spec.focalPoint.y);
6045
- }
6046
- var flip = [spec.flipHorizontal && 'h', spec.flipVertical && 'v'].filter(Boolean).join('');
6047
- if (flip) {
6048
- params.push("flip=" + flip);
6049
- }
6050
- // Map from spec name to url param name, and allow using the actual param name as an alternative
6051
- exports.SPEC_NAME_TO_URL_NAME_MAPPINGS.forEach(function (mapping) {
6052
- var specName = mapping[0], param = mapping[1];
6053
- if (typeof spec[specName] !== 'undefined') {
6054
- params.push(param + "=" + encodeURIComponent(spec[specName]));
6055
- }
6056
- else if (typeof spec[param] !== 'undefined') {
6057
- params.push(param + "=" + encodeURIComponent(spec[param]));
6058
- }
6059
- });
6060
- if (params.length === 0) {
6061
- return baseUrl;
6062
- }
6063
- return baseUrl + "?" + params.join('&');
6064
- }
6065
- function fit(source, spec) {
6066
- var cropRect;
6067
- var imgWidth = spec.width;
6068
- var imgHeight = spec.height;
6069
- // If we are not constraining the aspect ratio, we'll just use the whole crop
6070
- if (!(imgWidth && imgHeight)) {
6071
- return { width: imgWidth, height: imgHeight, rect: source.crop };
6072
- }
6073
- var crop = source.crop;
6074
- var hotspot = source.hotspot;
6075
- // If we are here, that means aspect ratio is locked and fitting will be a bit harder
6076
- var desiredAspectRatio = imgWidth / imgHeight;
6077
- var cropAspectRatio = crop.width / crop.height;
6078
- if (cropAspectRatio > desiredAspectRatio) {
6079
- // The crop is wider than the desired aspect ratio. That means we are cutting from the sides
6080
- var height = crop.height;
6081
- var width = height * desiredAspectRatio;
6082
- var top_2 = crop.top;
6083
- // Center output horizontally over hotspot
6084
- var hotspotXCenter = (hotspot.right - hotspot.left) / 2 + hotspot.left;
6085
- var left = hotspotXCenter - width / 2;
6086
- // Keep output within crop
6087
- if (left < crop.left) {
6088
- left = crop.left;
6089
- }
6090
- else if (left + width > crop.left + crop.width) {
6091
- left = crop.left + crop.width - width;
6092
- }
6093
- cropRect = {
6094
- left: Math.round(left),
6095
- top: Math.round(top_2),
6096
- width: Math.round(width),
6097
- height: Math.round(height)
6098
- };
6099
- }
6100
- else {
6101
- // The crop is taller than the desired ratio, we are cutting from top and bottom
6102
- var width = crop.width;
6103
- var height = width / desiredAspectRatio;
6104
- var left = crop.left;
6105
- // Center output vertically over hotspot
6106
- var hotspotYCenter = (hotspot.bottom - hotspot.top) / 2 + hotspot.top;
6107
- var top_3 = hotspotYCenter - height / 2;
6108
- // Keep output rect within crop
6109
- if (top_3 < crop.top) {
6110
- top_3 = crop.top;
6111
- }
6112
- else if (top_3 + height > crop.top + crop.height) {
6113
- top_3 = crop.top + crop.height - height;
6114
- }
6115
- cropRect = {
6116
- left: Math.max(0, Math.floor(left)),
6117
- top: Math.max(0, Math.floor(top_3)),
6118
- width: Math.round(width),
6119
- height: Math.round(height)
6120
- };
6121
- }
6122
- return {
6123
- width: imgWidth,
6124
- height: imgHeight,
6125
- rect: cropRect
6126
- };
6127
- }
5123
+ )
5124
+ );
5125
+ };
6128
5126
 
6129
- });
5127
+ var AD = function AD(_ref) {
5128
+ var networkID = _ref.networkID,
5129
+ adUnit = _ref.adUnit,
5130
+ sizeMapping = _ref.sizeMapping,
5131
+ className = _ref.className,
5132
+ slotId = _ref.slotId,
5133
+ sizes = _ref.sizes,
5134
+ minInViewPercent = _ref.minInViewPercent,
5135
+ _ref$targeting = _ref.targeting,
5136
+ targeting = _ref$targeting === undefined ? { desktop: {} } : _ref$targeting;
6130
5137
 
6131
- unwrapExports(urlForImage_1);
6132
- var urlForImage_2 = urlForImage_1.parseSource;
6133
- var urlForImage_3 = urlForImage_1.SPEC_NAME_TO_URL_NAME_MAPPINGS;
6134
5138
 
6135
- var builder = createCommonjsModule(function (module, exports) {
6136
- var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
6137
- __assign = Object.assign || function(t) {
6138
- for (var s, i = 1, n = arguments.length; i < n; i++) {
6139
- s = arguments[i];
6140
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6141
- t[p] = s[p];
6142
- }
6143
- return t;
6144
- };
6145
- return __assign.apply(this, arguments);
6146
- };
6147
- var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
6148
- if (mod && mod.__esModule) return mod;
6149
- var result = {};
6150
- if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
6151
- result["default"] = mod;
6152
- return result;
5139
+ return React__default.createElement(
5140
+ lib_1,
5141
+ { dfpNetworkId: networkID, targetingArguments: targeting.desktop, sizeMapping: sizeMapping, lazyLoad: { fetchMarginPercent: 500, renderMarginPercent: 200, mobileScaling: 2.0 } },
5142
+ React__default.createElement(
5143
+ 'div',
5144
+ { className: className },
5145
+ React__default.createElement(lib_2, {
5146
+ slotId: slotId,
5147
+ sizes: sizes,
5148
+ adUnit: adUnit,
5149
+ sizeMapping: sizeMapping
5150
+ })
5151
+ )
5152
+ );
6153
5153
  };
6154
- Object.defineProperty(exports, "__esModule", { value: true });
6155
- var urlForImage_1$$1 = __importStar(urlForImage_1);
6156
- var validFits = ['clip', 'crop', 'fill', 'fillmax', 'max', 'scale', 'min'];
6157
- var validCrops = ['top', 'bottom', 'left', 'right', 'center', 'focalpoint', 'entropy'];
6158
- var validAutoModes = ['format'];
6159
- function isSanityClient(client) {
6160
- return client ? typeof client.clientConfig === 'object' : false;
6161
- }
6162
- function rewriteSpecName(key) {
6163
- var specs = urlForImage_1$$1.SPEC_NAME_TO_URL_NAME_MAPPINGS;
6164
- for (var _i = 0, specs_1 = specs; _i < specs_1.length; _i++) {
6165
- var entry = specs_1[_i];
6166
- var specName = entry[0], param = entry[1];
6167
- if (key === specName || key === param) {
6168
- return specName;
6169
- }
6170
- }
6171
- return key;
6172
- }
6173
- function urlBuilder(options) {
6174
- // Did we get a SanityClient?
6175
- var client = options;
6176
- if (isSanityClient(client)) {
6177
- // Inherit config from client
6178
- var _a = client.clientConfig, apiHost = _a.apiHost, projectId = _a.projectId, dataset = _a.dataset;
6179
- return new ImageUrlBuilder(null, {
6180
- baseUrl: apiHost.replace(/^https:\/\/api\./, 'https://cdn.'),
6181
- projectId: projectId,
6182
- dataset: dataset
6183
- });
6184
- }
6185
- // Or just accept the options as given
6186
- return new ImageUrlBuilder(null, options);
6187
- }
6188
- exports.default = urlBuilder;
6189
- var ImageUrlBuilder = /** @class */ (function () {
6190
- function ImageUrlBuilder(parent, options) {
6191
- this.options = parent
6192
- ? __assign({}, (parent.options || {}), (options || {})) : __assign({}, (options || {})); // Copy options
6193
- }
6194
- ImageUrlBuilder.prototype.withOptions = function (options) {
6195
- var baseUrl = options.baseUrl || '';
6196
- var newOptions = { baseUrl: baseUrl };
6197
- for (var key in options) {
6198
- if (options.hasOwnProperty(key)) {
6199
- var specKey = rewriteSpecName(key);
6200
- newOptions[specKey] = options[key];
6201
- }
6202
- }
6203
- return new ImageUrlBuilder(this, __assign({ baseUrl: baseUrl }, newOptions));
6204
- };
6205
- // The image to be represented. Accepts a Sanity 'image'-document, 'asset'-document or
6206
- // _id of asset. To get the benefit of automatic hot-spot/crop integration with the content
6207
- // studio, the 'image'-document must be provided.
6208
- ImageUrlBuilder.prototype.image = function (source) {
6209
- return this.withOptions({ source: source });
6210
- };
6211
- // Specify the dataset
6212
- ImageUrlBuilder.prototype.dataset = function (dataset) {
6213
- return this.withOptions({ dataset: dataset });
6214
- };
6215
- // Specify the projectId
6216
- ImageUrlBuilder.prototype.projectId = function (projectId) {
6217
- return this.withOptions({ projectId: projectId });
6218
- };
6219
- // Specify background color
6220
- ImageUrlBuilder.prototype.bg = function (bg) {
6221
- return this.withOptions({ bg: bg });
6222
- };
6223
- // Set DPR scaling factor
6224
- ImageUrlBuilder.prototype.dpr = function (dpr) {
6225
- return this.withOptions({ dpr: dpr });
6226
- };
6227
- // Specify the width of the image in pixels
6228
- ImageUrlBuilder.prototype.width = function (width) {
6229
- return this.withOptions({ width: width });
6230
- };
6231
- // Specify the height of the image in pixels
6232
- ImageUrlBuilder.prototype.height = function (height) {
6233
- return this.withOptions({ height: height });
6234
- };
6235
- // Specify focal point in fraction of image dimensions. Each component 0.0-1.0
6236
- ImageUrlBuilder.prototype.focalPoint = function (x, y) {
6237
- return this.withOptions({ focalPoint: { x: x, y: y } });
6238
- };
6239
- ImageUrlBuilder.prototype.maxWidth = function (maxWidth) {
6240
- return this.withOptions({ maxWidth: maxWidth });
6241
- };
6242
- ImageUrlBuilder.prototype.minWidth = function (minWidth) {
6243
- return this.withOptions({ minWidth: minWidth });
6244
- };
6245
- ImageUrlBuilder.prototype.maxHeight = function (maxHeight) {
6246
- return this.withOptions({ maxHeight: maxHeight });
6247
- };
6248
- ImageUrlBuilder.prototype.minHeight = function (minHeight) {
6249
- return this.withOptions({ minHeight: minHeight });
6250
- };
6251
- // Specify width and height in pixels
6252
- ImageUrlBuilder.prototype.size = function (width, height) {
6253
- return this.withOptions({ width: width, height: height });
6254
- };
6255
- // Specify blur between 0 and 100
6256
- ImageUrlBuilder.prototype.blur = function (blur) {
6257
- return this.withOptions({ blur: blur });
6258
- };
6259
- ImageUrlBuilder.prototype.sharpen = function (sharpen) {
6260
- return this.withOptions({ sharpen: sharpen });
6261
- };
6262
- // Specify the desired rectangle of the image
6263
- ImageUrlBuilder.prototype.rect = function (left, top, width, height) {
6264
- return this.withOptions({ rect: { left: left, top: top, width: width, height: height } });
6265
- };
6266
- // Specify the image format of the image. 'jpg', 'pjpg', 'png', 'webp'
6267
- ImageUrlBuilder.prototype.format = function (format) {
6268
- return this.withOptions({ format: format });
6269
- };
6270
- ImageUrlBuilder.prototype.invert = function (invert) {
6271
- return this.withOptions({ invert: invert });
6272
- };
6273
- // Rotation in degrees 0, 90, 180, 270
6274
- ImageUrlBuilder.prototype.orientation = function (orientation) {
6275
- return this.withOptions({ orientation: orientation });
6276
- };
6277
- // Compression quality 0-100
6278
- ImageUrlBuilder.prototype.quality = function (quality) {
6279
- return this.withOptions({ quality: quality });
6280
- };
6281
- // Make it a download link. Parameter is default filename.
6282
- ImageUrlBuilder.prototype.forceDownload = function (download) {
6283
- return this.withOptions({ download: download });
6284
- };
6285
- // Flip image horizontally
6286
- ImageUrlBuilder.prototype.flipHorizontal = function () {
6287
- return this.withOptions({ flipHorizontal: true });
6288
- };
6289
- // Flip image verically
6290
- ImageUrlBuilder.prototype.flipVertical = function () {
6291
- return this.withOptions({ flipVertical: true });
6292
- };
6293
- // Ignore crop/hotspot from image record, even when present
6294
- ImageUrlBuilder.prototype.ignoreImageParams = function () {
6295
- return this.withOptions({ ignoreImageParams: true });
6296
- };
6297
- ImageUrlBuilder.prototype.fit = function (value) {
6298
- if (validFits.indexOf(value) === -1) {
6299
- throw new Error("Invalid fit mode \"" + value + "\"");
6300
- }
6301
- return this.withOptions({ fit: value });
6302
- };
6303
- ImageUrlBuilder.prototype.crop = function (value) {
6304
- if (validCrops.indexOf(value) === -1) {
6305
- throw new Error("Invalid crop mode \"" + value + "\"");
6306
- }
6307
- return this.withOptions({ crop: value });
6308
- };
6309
- ImageUrlBuilder.prototype.auto = function (value) {
6310
- if (validAutoModes.indexOf(value) === -1) {
6311
- throw new Error("Invalid auto mode \"" + value + "\"");
6312
- }
6313
- return this.withOptions({ auto: value });
6314
- };
6315
- // Gets the url based on the submitted parameters
6316
- ImageUrlBuilder.prototype.url = function () {
6317
- return urlForImage_1$$1.default(this.options);
6318
- };
6319
- // Synonym for url()
6320
- ImageUrlBuilder.prototype.toString = function () {
6321
- return this.url();
6322
- };
6323
- return ImageUrlBuilder;
6324
- }());
6325
5154
 
6326
- });
5155
+ AD.propTypes = {
5156
+ networkID: PropTypes.string.isRequired,
5157
+ adUnit: PropTypes.string.isRequired,
5158
+ slotId: PropTypes.string,
5159
+ className: PropTypes.string,
5160
+ sizeMapping: PropTypes.array,
5161
+ sizes: PropTypes.array,
5162
+ minInViewPercent: PropTypes.number
5163
+ };
6327
5164
 
6328
- unwrapExports(builder);
5165
+ var AD300x250 = function AD300x250(_ref) {
5166
+ var networkID = _ref.networkID,
5167
+ adUnit = _ref.adUnit,
5168
+ targeting = _ref.targeting;
6329
5169
 
6330
- var node = createCommonjsModule(function (module) {
6331
- var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
6332
- return (mod && mod.__esModule) ? mod : { "default": mod };
5170
+ return React__default.createElement(AD, { networkID: networkID, adUnit: adUnit, targeting: targeting, className: 'AD300x250', sizes: [[300, 250], [300, 100]] });
6333
5171
  };
6334
- var builder_1 = __importDefault(builder);
6335
- module.exports = builder_1.default;
6336
5172
 
6337
- });
5173
+ var AD300x250x600 = function AD300x250x600(_ref) {
5174
+ var networkID = _ref.networkID,
5175
+ adUnit = _ref.adUnit,
5176
+ targeting = _ref.targeting;
6338
5177
 
6339
- var imageUrlBuilder = unwrapExports(node);
5178
+ return React__default.createElement(AD, {
5179
+ networkID: networkID,
5180
+ adUnit: adUnit,
5181
+ className: 'AD300x250',
5182
+ targeting: targeting,
5183
+ sizes: [[300, 250], [300, 600], [300, 100]]
5184
+ });
5185
+ };
6340
5186
 
6341
5187
  var FigureComponent = function FigureComponent(_ref) {
6342
5188
  var caption = _ref.caption,
@@ -6391,7 +5237,7 @@ var Slideshow = function Slideshow(_ref) {
6391
5237
  );
6392
5238
  };
6393
5239
 
6394
- var isArray$1 = Array.isArray;
5240
+ var isArray = Array.isArray;
6395
5241
  var keyList = Object.keys;
6396
5242
  var hasProp = Object.prototype.hasOwnProperty;
6397
5243
 
@@ -6399,8 +5245,8 @@ var fastDeepEqual = function equal(a, b) {
6399
5245
  if (a === b) return true;
6400
5246
 
6401
5247
  if (a && b && typeof a == 'object' && typeof b == 'object') {
6402
- var arrA = isArray$1(a)
6403
- , arrB = isArray$1(b)
5248
+ var arrA = isArray(a)
5249
+ , arrB = isArray(b)
6404
5250
  , i
6405
5251
  , length
6406
5252
  , key;
@@ -7482,7 +6328,7 @@ function format(f) {
7482
6328
  }
7483
6329
  });
7484
6330
  for (var x = args[i]; i < len; x = args[++i]) {
7485
- if (isNull(x) || !isObject$1(x)) {
6331
+ if (isNull(x) || !isObject(x)) {
7486
6332
  str += ' ' + x;
7487
6333
  } else {
7488
6334
  str += ' ' + inspect(x);
@@ -7633,7 +6479,7 @@ function formatValue(ctx, value, recurseTimes) {
7633
6479
  // Check that value is an object with an inspect function on it
7634
6480
  if (ctx.customInspect &&
7635
6481
  value &&
7636
- isFunction$1(value.inspect) &&
6482
+ isFunction(value.inspect) &&
7637
6483
  // Filter out the util module, it's inspect function is special
7638
6484
  value.inspect !== inspect &&
7639
6485
  // Also filter out any prototype objects using the circular check.
@@ -7668,7 +6514,7 @@ function formatValue(ctx, value, recurseTimes) {
7668
6514
 
7669
6515
  // Some type of object without properties can be shortcutted.
7670
6516
  if (keys.length === 0) {
7671
- if (isFunction$1(value)) {
6517
+ if (isFunction(value)) {
7672
6518
  var name = value.name ? ': ' + value.name : '';
7673
6519
  return ctx.stylize('[Function' + name + ']', 'special');
7674
6520
  }
@@ -7686,13 +6532,13 @@ function formatValue(ctx, value, recurseTimes) {
7686
6532
  var base = '', array = false, braces = ['{', '}'];
7687
6533
 
7688
6534
  // Make Array say that they are Array
7689
- if (isArray$2(value)) {
6535
+ if (isArray$1(value)) {
7690
6536
  array = true;
7691
6537
  braces = ['[', ']'];
7692
6538
  }
7693
6539
 
7694
6540
  // Make functions say that they are functions
7695
- if (isFunction$1(value)) {
6541
+ if (isFunction(value)) {
7696
6542
  var n = value.name ? ': ' + value.name : '';
7697
6543
  base = ' [Function' + n + ']';
7698
6544
  }
@@ -7768,7 +6614,7 @@ function formatError(value) {
7768
6614
  function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
7769
6615
  var output = [];
7770
6616
  for (var i = 0, l = value.length; i < l; ++i) {
7771
- if (hasOwnProperty$4(value, String(i))) {
6617
+ if (hasOwnProperty(value, String(i))) {
7772
6618
  output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
7773
6619
  String(i), true));
7774
6620
  } else {
@@ -7799,7 +6645,7 @@ function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
7799
6645
  str = ctx.stylize('[Setter]', 'special');
7800
6646
  }
7801
6647
  }
7802
- if (!hasOwnProperty$4(visibleKeys, key)) {
6648
+ if (!hasOwnProperty(visibleKeys, key)) {
7803
6649
  name = '[' + key + ']';
7804
6650
  }
7805
6651
  if (!str) {
@@ -7865,7 +6711,7 @@ function reduceToSingleString(output, base, braces) {
7865
6711
 
7866
6712
  // NOTE: These type checking functions intentionally don't use `instanceof`
7867
6713
  // because it is fragile and can be easily faked with `Object.create()`.
7868
- function isArray$2(ar) {
6714
+ function isArray$1(ar) {
7869
6715
  return Array.isArray(ar);
7870
6716
  }
7871
6717
 
@@ -7889,7 +6735,7 @@ function isString(arg) {
7889
6735
  return typeof arg === 'string';
7890
6736
  }
7891
6737
 
7892
- function isSymbol$1(arg) {
6738
+ function isSymbol(arg) {
7893
6739
  return typeof arg === 'symbol';
7894
6740
  }
7895
6741
 
@@ -7898,23 +6744,23 @@ function isUndefined(arg) {
7898
6744
  }
7899
6745
 
7900
6746
  function isRegExp(re) {
7901
- return isObject$1(re) && objectToString$1(re) === '[object RegExp]';
6747
+ return isObject(re) && objectToString(re) === '[object RegExp]';
7902
6748
  }
7903
6749
 
7904
- function isObject$1(arg) {
6750
+ function isObject(arg) {
7905
6751
  return typeof arg === 'object' && arg !== null;
7906
6752
  }
7907
6753
 
7908
6754
  function isDate(d) {
7909
- return isObject$1(d) && objectToString$1(d) === '[object Date]';
6755
+ return isObject(d) && objectToString(d) === '[object Date]';
7910
6756
  }
7911
6757
 
7912
6758
  function isError(e) {
7913
- return isObject$1(e) &&
7914
- (objectToString$1(e) === '[object Error]' || e instanceof Error);
6759
+ return isObject(e) &&
6760
+ (objectToString(e) === '[object Error]' || e instanceof Error);
7915
6761
  }
7916
6762
 
7917
- function isFunction$1(arg) {
6763
+ function isFunction(arg) {
7918
6764
  return typeof arg === 'function';
7919
6765
  }
7920
6766
 
@@ -7931,7 +6777,7 @@ function isBuffer(maybeBuf) {
7931
6777
  return Buffer.isBuffer(maybeBuf);
7932
6778
  }
7933
6779
 
7934
- function objectToString$1(o) {
6780
+ function objectToString(o) {
7935
6781
  return Object.prototype.toString.call(o);
7936
6782
  }
7937
6783
 
@@ -7961,7 +6807,7 @@ function log() {
7961
6807
 
7962
6808
  function _extend(origin, add) {
7963
6809
  // Don't do anything if add isn't an object
7964
- if (!add || !isObject$1(add)) return origin;
6810
+ if (!add || !isObject(add)) return origin;
7965
6811
 
7966
6812
  var keys = Object.keys(add);
7967
6813
  var i = keys.length;
@@ -7970,7 +6816,7 @@ function _extend(origin, add) {
7970
6816
  }
7971
6817
  return origin;
7972
6818
  }
7973
- function hasOwnProperty$4(obj, prop) {
6819
+ function hasOwnProperty(obj, prop) {
7974
6820
  return Object.prototype.hasOwnProperty.call(obj, prop);
7975
6821
  }
7976
6822
 
@@ -7980,19 +6826,19 @@ var util = {
7980
6826
  log: log,
7981
6827
  isBuffer: isBuffer,
7982
6828
  isPrimitive: isPrimitive,
7983
- isFunction: isFunction$1,
6829
+ isFunction: isFunction,
7984
6830
  isError: isError,
7985
6831
  isDate: isDate,
7986
- isObject: isObject$1,
6832
+ isObject: isObject,
7987
6833
  isRegExp: isRegExp,
7988
6834
  isUndefined: isUndefined,
7989
- isSymbol: isSymbol$1,
6835
+ isSymbol: isSymbol,
7990
6836
  isString: isString,
7991
6837
  isNumber: isNumber,
7992
6838
  isNullOrUndefined: isNullOrUndefined,
7993
6839
  isNull: isNull,
7994
6840
  isBoolean: isBoolean,
7995
- isArray: isArray$2,
6841
+ isArray: isArray$1,
7996
6842
  inspect: inspect,
7997
6843
  deprecate: deprecate,
7998
6844
  format: format,
@@ -9021,7 +7867,7 @@ object-assign
9021
7867
  */
9022
7868
  /* eslint-disable no-unused-vars */
9023
7869
  var getOwnPropertySymbols = Object.getOwnPropertySymbols;
9024
- var hasOwnProperty$5 = Object.prototype.hasOwnProperty;
7870
+ var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
9025
7871
  var propIsEnumerable = Object.prototype.propertyIsEnumerable;
9026
7872
 
9027
7873
  function toObject(val) {
@@ -9085,7 +7931,7 @@ var objectAssign = shouldUseNative() ? Object.assign : function (target, source)
9085
7931
  from = Object(arguments[s]);
9086
7932
 
9087
7933
  for (var key in from) {
9088
- if (hasOwnProperty$5.call(from, key)) {
7934
+ if (hasOwnProperty$1.call(from, key)) {
9089
7935
  to[key] = from[key];
9090
7936
  }
9091
7937
  }